mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
Bugfix to have Ratpouch correctly follow player, and new object animation handlers added
svn-id: r26487
This commit is contained in:
parent
3586004c96
commit
2d617677df
@ -64,7 +64,6 @@ Hotspot::Hotspot(HotspotData *res): _pathFinder(this) {
|
||||
_layer = res->layer;
|
||||
_sequenceOffset = res->sequenceOffset;
|
||||
_tickCtr = res->tickTimeout;
|
||||
_actions = res->actions;
|
||||
_colourOffset = res->colourOffset;
|
||||
|
||||
_override = resources.getHotspotOverride(res->hotspotId);
|
||||
@ -2006,7 +2005,6 @@ void Hotspot::saveToStream(Common::WriteStream *stream) {
|
||||
stream->writeByte(_layer);
|
||||
stream->writeUint16LE(_sequenceOffset);
|
||||
stream->writeUint16LE(_tickCtr);
|
||||
stream->writeUint32LE(_actions);
|
||||
stream->writeByte(_colourOffset);
|
||||
stream->writeUint16LE(_animId);
|
||||
stream->writeUint16LE(_frameNumber);
|
||||
@ -2042,7 +2040,6 @@ void Hotspot::loadFromStream(Common::ReadStream *stream) {
|
||||
_layer = stream->readByte();
|
||||
_sequenceOffset = stream->readUint16LE();
|
||||
_tickCtr = stream->readUint16LE();
|
||||
_actions = stream->readUint32LE();
|
||||
_colourOffset = stream->readByte();
|
||||
setAnimation(stream->readUint16LE());
|
||||
setFrameNumber(stream->readUint16LE());
|
||||
@ -2062,6 +2059,8 @@ void Hotspot::loadFromStream(Common::ReadStream *stream) {
|
||||
|
||||
HandlerMethodPtr HotspotTickHandlers::getHandler(uint16 procOffset) {
|
||||
switch (procOffset) {
|
||||
case 0x41BD:
|
||||
return defaultHandler;
|
||||
case STANDARD_CHARACTER_TICK_PROC:
|
||||
return standardCharacterAnimHandler;
|
||||
case VOICE_TICK_PROC_ID:
|
||||
@ -2080,12 +2079,16 @@ HandlerMethodPtr HotspotTickHandlers::getHandler(uint16 procOffset) {
|
||||
return standardAnimHandler2;
|
||||
case 0x7F3A:
|
||||
return standardAnimHandler;
|
||||
case 0x7F54:
|
||||
return sonicRatAnimHandler;
|
||||
case 0x7F69:
|
||||
return droppingTorchAnimHandler;
|
||||
case 0x7FA1:
|
||||
return playerSewerExitAnimHandler;
|
||||
case 0x8009:
|
||||
return fireAnimHandler;
|
||||
case 0x813F:
|
||||
return teaAnimHandler;
|
||||
case 0x8180:
|
||||
return goewinCaptiveAnimHandler;
|
||||
case 0x81B3:
|
||||
@ -2100,12 +2103,18 @@ HandlerMethodPtr HotspotTickHandlers::getHandler(uint16 procOffset) {
|
||||
return barmanAnimHandler;
|
||||
case 0x85ce:
|
||||
return skorlGaurdAnimHandler;
|
||||
case 0x862D:
|
||||
return gargoyleAnimHandler;
|
||||
case 0x86FA:
|
||||
case 0x86FF:
|
||||
return skullAnimHandler;
|
||||
case 0x882A:
|
||||
return rackSerfAnimHandler;
|
||||
case TALK_TICK_PROC_ID:
|
||||
return talkAnimHandler;
|
||||
default:
|
||||
return defaultHandler;
|
||||
error("Unknown tick proc %xh for hotspot", procOffset);
|
||||
// return defaultHandler;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2681,11 +2690,10 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) {
|
||||
// The character is currently moving
|
||||
h.setOccupied(false);
|
||||
|
||||
if ((h.destHotspotId() != 0) && (h.destHotspotId() != 0xffff)) {
|
||||
// Player is walking to a room exit hotspot
|
||||
if (h.destHotspotId() != 0) {
|
||||
RoomExitJoinData *joinRec = res.getExitJoin(h.destHotspotId());
|
||||
if (joinRec->blocked) {
|
||||
// Exit now blocked, so stop walking
|
||||
if ((joinRec != NULL) && (joinRec->blocked)) {
|
||||
// Player is walking to a blocked room exit, so stop walking
|
||||
actions.pop();
|
||||
h.setOccupied(true);
|
||||
break;
|
||||
@ -2757,18 +2765,6 @@ void HotspotTickHandlers::followerAnimHandler(Hotspot &h) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fields.wanderingCharsLoaded()) {
|
||||
// Start Ratpouch to sewer exit to meet player
|
||||
fields.wanderingCharsLoaded() = false;
|
||||
h.setBlockedFlag(false);
|
||||
CharacterScheduleEntry *newEntry = res.charSchedules().getEntry(RETURN_SUPPORT_ID);
|
||||
h.currentActions().addFront(DISPATCH_ACTION, newEntry, 7);
|
||||
h.setActionCtr(0);
|
||||
|
||||
standardCharacterAnimHandler(h);
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle any pause countdown
|
||||
if (countdownCtr > 0) {
|
||||
--countdownCtr;
|
||||
@ -2841,6 +2837,16 @@ void HotspotTickHandlers::skorlAnimHandler(Hotspot &h) {
|
||||
standardCharacterAnimHandler(h);
|
||||
}
|
||||
|
||||
void HotspotTickHandlers::sonicRatAnimHandler(Hotspot &h) {
|
||||
if (h.actionCtr() == 0) {
|
||||
HotspotData *player = Resources::getReference().getHotspot(PLAYER_ID);
|
||||
if (Support::charactersIntersecting(h.resource(), player))
|
||||
h.setActionCtr(1);
|
||||
} else {
|
||||
standardAnimHandler(h);
|
||||
}
|
||||
}
|
||||
|
||||
void HotspotTickHandlers::droppingTorchAnimHandler(Hotspot &h) {
|
||||
if (h.frameCtr() > 0)
|
||||
h.setFrameCtr(h.frameCtr() - 1);
|
||||
@ -2886,6 +2892,10 @@ void HotspotTickHandlers::playerSewerExitAnimHandler(Hotspot &h) {
|
||||
ratpouchHotspot->setCharacterMode(CHARMODE_NONE);
|
||||
ratpouchHotspot->setDelayCtr(0);
|
||||
ratpouchHotspot->setActions(0x821C00);
|
||||
|
||||
// Ratpouch has previously been moved to room 8. Start him moving to room 7
|
||||
ratpouchHotspot->currentActions().clear();
|
||||
ratpouchHotspot->currentActions().addFront(DISPATCH_ACTION, 7);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2894,6 +2904,19 @@ void HotspotTickHandlers::fireAnimHandler(Hotspot &h) {
|
||||
h.setOccupied(true);
|
||||
}
|
||||
|
||||
void HotspotTickHandlers::teaAnimHandler(Hotspot &h) {
|
||||
if (h.frameCtr() > 0) {
|
||||
h.decrFrameCtr();
|
||||
return;
|
||||
}
|
||||
|
||||
if (h.executeScript()) {
|
||||
// Signal that the tea is done
|
||||
h.setScript(0xB82);
|
||||
Resources::getReference().fieldList().setField(27, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void HotspotTickHandlers::goewinCaptiveAnimHandler(Hotspot &h) {
|
||||
if (h.actionCtr() > 0) {
|
||||
if (h.executeScript()) {
|
||||
@ -3400,6 +3423,18 @@ void HotspotTickHandlers::skorlGaurdAnimHandler(Hotspot &h) {
|
||||
h.setFrameNumber(h.actionCtr());
|
||||
}
|
||||
|
||||
void HotspotTickHandlers::gargoyleAnimHandler(Hotspot &h) {
|
||||
h.handleTalkDialog();
|
||||
}
|
||||
|
||||
void HotspotTickHandlers::skullAnimHandler(Hotspot &h) {
|
||||
Resources &res = Resources::getReference();
|
||||
RoomExitJoinData *joinRec = res.getExitJoin(
|
||||
(h.hotspotId() == 0x42f) ? 0x272A : 0x272C);
|
||||
|
||||
h.setFrameNumber(joinRec->blocked ? 0 : 1);
|
||||
}
|
||||
|
||||
void HotspotTickHandlers::rackSerfAnimHandler(Hotspot &h) {
|
||||
Resources &res = Resources::getReference();
|
||||
|
||||
|
@ -65,9 +65,11 @@ private:
|
||||
static void playerAnimHandler(Hotspot &h);
|
||||
static void followerAnimHandler(Hotspot &h);
|
||||
static void skorlAnimHandler(Hotspot &h);
|
||||
static void sonicRatAnimHandler(Hotspot &h);
|
||||
static void droppingTorchAnimHandler(Hotspot &h);
|
||||
static void playerSewerExitAnimHandler(Hotspot &h);
|
||||
static void fireAnimHandler(Hotspot &h);
|
||||
static void teaAnimHandler(Hotspot &h);
|
||||
static void goewinCaptiveAnimHandler(Hotspot &h);
|
||||
static void prisonerAnimHandler(Hotspot &h);
|
||||
static void catrionaAnimHandler(Hotspot &h);
|
||||
@ -76,6 +78,8 @@ private:
|
||||
static void headAnimHandler(Hotspot &h);
|
||||
static void barmanAnimHandler(Hotspot &h);
|
||||
static void skorlGaurdAnimHandler(Hotspot &h);
|
||||
static void gargoyleAnimHandler(Hotspot &h);
|
||||
static void skullAnimHandler(Hotspot &h);
|
||||
static void rackSerfAnimHandler(Hotspot &h);
|
||||
|
||||
public:
|
||||
@ -246,7 +250,6 @@ private:
|
||||
uint8 _layer;
|
||||
uint16 _sequenceOffset;
|
||||
uint16 _tickCtr;
|
||||
uint32 _actions;
|
||||
uint8 _colourOffset;
|
||||
bool _persistant;
|
||||
HotspotOverrideData *_override;
|
||||
@ -410,7 +413,10 @@ public:
|
||||
_layer = newLayer;
|
||||
_data->layer = newLayer;
|
||||
}
|
||||
void setActions(uint32 newActions) { _actions = newActions; }
|
||||
void setActions(uint32 newActions) {
|
||||
assert(_data);
|
||||
_data->actions = newActions;
|
||||
}
|
||||
void setCharRectY(uint16 value) { _charRectY = value; }
|
||||
void setSkipFlag(bool value) { _skipFlag = value; }
|
||||
CharacterMode characterMode() {
|
||||
|
@ -1079,7 +1079,6 @@ ValueTableData::ValueTableData() {
|
||||
_playerPendingPos.isSet = false;
|
||||
_flags = GAMEFLAG_4 | GAMEFLAG_1;
|
||||
_hdrFlagMask = 1;
|
||||
_wanderingCharsLoaded = false;
|
||||
|
||||
for (uint16 index = 0; index < NUM_VALUE_FIELDS; ++index)
|
||||
_fieldList[index] = 0;
|
||||
@ -1126,7 +1125,6 @@ void ValueTableData::saveToStream(Common::WriteStream *stream)
|
||||
stream->writeSint16LE(_playerPendingPos.pos.y);
|
||||
stream->writeByte(_flags);
|
||||
stream->writeByte(_hdrFlagMask);
|
||||
stream->writeByte(_wanderingCharsLoaded);
|
||||
|
||||
// Write out the special fields
|
||||
for (int index = 0; index < NUM_VALUE_FIELDS; ++index)
|
||||
@ -1145,7 +1143,6 @@ void ValueTableData::loadFromStream(Common::ReadStream *stream)
|
||||
_playerPendingPos.pos.y = stream->readSint16LE();
|
||||
_flags = stream->readByte();
|
||||
_hdrFlagMask = stream->readByte();
|
||||
_wanderingCharsLoaded = stream->readByte() != 0;
|
||||
|
||||
// Read in the field list
|
||||
for (int index = 0; index < NUM_VALUE_FIELDS; ++index)
|
||||
|
@ -796,7 +796,6 @@ private:
|
||||
PlayerPendingPosition _playerPendingPos;
|
||||
uint8 _flags;
|
||||
uint8 _hdrFlagMask;
|
||||
bool _wanderingCharsLoaded;
|
||||
|
||||
uint16 _fieldList[NUM_VALUE_FIELDS];
|
||||
bool isKnownField(uint16 fieldIndex);
|
||||
@ -814,7 +813,6 @@ public:
|
||||
uint8 &hdrFlagMask() { return _hdrFlagMask; }
|
||||
PlayerNewPosition &playerNewPos() { return _playerNewPos; }
|
||||
PlayerPendingPosition &playerPendingPos() { return _playerPendingPos; }
|
||||
bool &wanderingCharsLoaded() { return _wanderingCharsLoaded; }
|
||||
|
||||
void saveToStream(Common::WriteStream *stream);
|
||||
void loadFromStream(Common::ReadStream *stream);
|
||||
|
Loading…
Reference in New Issue
Block a user