aboutsummaryrefslogtreecommitdiff
path: root/engines/lure
diff options
context:
space:
mode:
authorPaul Gilbert2007-05-28 11:36:59 +0000
committerPaul Gilbert2007-05-28 11:36:59 +0000
commit5e0fd79a5ae5655360124715edc06c7cd65a0b8a (patch)
treece101859e6e9f5d33df2323071b6910e6cd1aed1 /engines/lure
parent30142129c0effaf3974c2ce7f9605c5eec8cc2db (diff)
downloadscummvm-rg350-5e0fd79a5ae5655360124715edc06c7cd65a0b8a.tar.gz
scummvm-rg350-5e0fd79a5ae5655360124715edc06c7cd65a0b8a.tar.bz2
scummvm-rg350-5e0fd79a5ae5655360124715edc06c7cd65a0b8a.zip
Implemented new script methods
svn-id: r26992
Diffstat (limited to 'engines/lure')
-rw-r--r--engines/lure/scripts.cpp37
-rw-r--r--engines/lure/scripts.h2
2 files changed, 39 insertions, 0 deletions
diff --git a/engines/lure/scripts.cpp b/engines/lure/scripts.cpp
index 6e651fbc68..85214348e8 100644
--- a/engines/lure/scripts.cpp
+++ b/engines/lure/scripts.cpp
@@ -463,6 +463,34 @@ void Script::decreaseNumGroats(uint16 characterId, uint16 numGroats, uint16 v3)
fields.numGroats() -= numGroats;
}
+// Sets a character moving to the player's room (if they're not already there)
+
+void Script::moveCharacterToPlayer(uint16 characterId, uint16 v2, uint16 v3) {
+ Resources &res = Resources::getReference();
+ Hotspot *playerHotspot = res.getActiveHotspot(PLAYER_ID);
+ Hotspot *charHotspot = res.getActiveHotspot(characterId);
+ assert(charHotspot);
+
+ // If character in same room as player, then no need to do anything
+ if (!charHotspot->currentActions().isEmpty() &&
+ (charHotspot->currentActions().top().roomNumber() == playerHotspot->roomNumber()))
+ return;
+
+ uint16 destRoom = playerHotspot->roomNumber();
+ RoomTranslationRecord *rec;
+ for (rec = &roomTranslations[0]; rec->srcRoom != 0; ++rec) {
+ if (rec->srcRoom == destRoom) {
+ destRoom = rec->destRoom;
+ break;
+ }
+ }
+
+ if (charHotspot->currentActions().isEmpty())
+ charHotspot->currentActions().addFront(DISPATCH_ACTION, destRoom);
+ else
+ charHotspot->currentActions().top().setRoomNumber(destRoom);
+}
+
// Sets the tick handler for the village Skorl to an alternate handler
void Script::setVillageSkorlTickProc(uint16 v1, uint16 v2, uint16 v3) {
@@ -510,6 +538,13 @@ void Script::enableGargoylesTalk(uint16 v1, uint16 v2, uint16 v3) {
g2->actions = 1 << (TALK_TO - 1);
}
+// Flags the player as dead
+
+void Script::killPlayer(uint16 v1, uint16 v2, uint16 v3) {
+ Game &game = Game::getReference();
+ game.setState(GS_RESTORE_RESTART);
+}
+
// Loads the specified animation, completely bypassing the standard process
// of checking for a load proc/sequence
@@ -600,11 +635,13 @@ SequenceMethodRecord scriptMethods[] = {
{49, Script::setSupportData},
{50, Script::givePlayerItem},
{51, Script::decreaseNumGroats},
+ {53, Script::moveCharacterToPlayer},
{54, Script::setVillageSkorlTickProc},
{55, Script::freeGoewin},
{56, Script::barmanServe},
{57, Script::getNumGroats},
{59, Script::enableGargoylesTalk},
+ {61, Script::killPlayer},
{62, Script::animationLoad},
{63, Script::addActions},
{64, Script::randomToGeneral},
diff --git a/engines/lure/scripts.h b/engines/lure/scripts.h
index e964328130..71126b7066 100644
--- a/engines/lure/scripts.h
+++ b/engines/lure/scripts.h
@@ -118,11 +118,13 @@ public:
static void setSupportData(uint16 hotspotId, uint16 index, uint16 v3);
static void givePlayerItem(uint16 hotspotId, uint16 v2, uint16 v3);
static void decreaseNumGroats(uint16 characterId, uint16 numGroats, uint16 v3);
+ static void moveCharacterToPlayer(uint16 characterId, uint16 v2, uint16 v3);
static void setVillageSkorlTickProc(uint16 v1, uint16 v2, uint16 v3);
static void freeGoewin(uint16 v1, uint16 v2, uint16 v3);
static void barmanServe(uint16 v1, uint16 v2, uint16 v3);
static void getNumGroats(uint16 v1, uint16 v2, uint16 v3);
static void enableGargoylesTalk(uint16 v1, uint16 v2, uint16 v3);
+ static void killPlayer(uint16 v1, uint16 v2, uint16 v3);
static void animationLoad(uint16 hotspotId, uint16 v2, uint16 v3);
static void addActions(uint16 hotspotId, uint16 actions, uint16 v3);
static void randomToGeneral(uint16 maxVal, uint16 minVal, uint16 v3);