aboutsummaryrefslogtreecommitdiff
path: root/engines/lure/scripts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/lure/scripts.cpp')
-rw-r--r--engines/lure/scripts.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/engines/lure/scripts.cpp b/engines/lure/scripts.cpp
index 68714da526..f24e5c301f 100644
--- a/engines/lure/scripts.cpp
+++ b/engines/lure/scripts.cpp
@@ -38,12 +38,12 @@ namespace Lure {
// This list of hotspot Ids are used by sequence method #5 to deallocate a set
// of hotspot Ids at once
-uint16 dealloc_list_1[] = {0x13F2, 0x418, 0x2711, 0x2712, 0x40D, 0x3EA, 0x411, 0};
-uint16 dealloc_list_2[] = {0x2729, 0x272A, 0x272B, 0x272C, 0x272E, 0x272E, 0x272F, 0};
-uint16 dealloc_list_3[] = {0x3EF, 0x3E9, 0x3EB, 0x3EC, 0x3ED, 0x3EE, 0x3F0, 0x3F1,
+static const uint16 dealloc_list_1[] = {0x13F2, 0x418, 0x2711, 0x2712, 0x40D, 0x3EA, 0x411, 0};
+static const uint16 dealloc_list_2[] = {0x2729, 0x272A, 0x272B, 0x272C, 0x272E, 0x272E, 0x272F, 0};
+static const uint16 dealloc_list_3[] = {0x3EF, 0x3E9, 0x3EB, 0x3EC, 0x3ED, 0x3EE, 0x3F0, 0x3F1,
0x420, 0x429, 0x436, 0x2715, 0x2716, 0x2717, 0x2718, 0x2719, 0x271A, 0x271E,
0x271F, 0x2720, 0x2721, 0x2722, 0x2725, 0x2726, 0};
-uint16 *hotspot_dealloc_set[4] = {&dealloc_list_1[0], &dealloc_list_2[0],
+static const uint16 *hotspot_dealloc_set[4] = {&dealloc_list_1[0], &dealloc_list_2[0],
&dealloc_list_3[1], &dealloc_list_3[0]};
/*------------------------------------------------------------------------*/
@@ -99,7 +99,7 @@ void Script::deactivateHotspotSet(uint16 listIndex, uint16 v2, uint16 v3) {
if (listIndex > 3)
error("Script::deactiveHotspotSet - Invalid list index");
Resources &res = Resources::getReference();
- uint16 *hotspotId = hotspot_dealloc_set[listIndex];
+ const uint16 *hotspotId = hotspot_dealloc_set[listIndex];
while (*hotspotId != 0) {
res.deactivateHotspot(*hotspotId);
@@ -276,8 +276,7 @@ void Script::isSkorlInCell(uint16 v1, uint16 v2, uint16 v3) {
// Called by the script when Ratpouch is pushing the bricks in the Outer Cell
-void Script::ratpouchPushBricks(uint16 v1, uint16 v2, uint16 v3)
-{
+void Script::ratpouchPushBricks(uint16 v1, uint16 v2, uint16 v3) {
Resources &res = Resources::getReference();
// Mark the bricks exit as now open
@@ -308,8 +307,7 @@ void Script::characterChangeRoom(uint16 y, uint16 x, uint16 roomNumber) {
// Pauses Ratpouch for a long period (as good as idefinite)
-void Script::pauseRatpouch(uint16 v1, uint16 v2, uint16 v3)
-{
+void Script::pauseRatpouch(uint16 v1, uint16 v2, uint16 v3) {
Resources &res = Resources::getReference();
Hotspot *ratpouch = res.getActiveHotspot(RATPOUCH_ID);
assert(ratpouch);
@@ -598,7 +596,7 @@ void Script::moveCharacterToPlayer(uint16 characterId, uint16 v2, uint16 v3) {
return;
uint16 destRoom = playerHotspot->roomNumber();
- RoomTranslationRecord *rec;
+ const RoomTranslationRecord *rec;
for (rec = &roomTranslations[0]; rec->srcRoom != 0; ++rec) {
if (rec->srcRoom == destRoom) {
destRoom = rec->destRoom;
@@ -739,7 +737,7 @@ struct SequenceMethodRecord {
SequenceMethodPtr proc;
};
-SequenceMethodRecord scriptMethods[] = {
+static const SequenceMethodRecord scriptMethods[] = {
{0, Script::activateHotspot},
{1, Script::setHotspotScript},
{2, Script::addSound2},
@@ -809,14 +807,14 @@ SequenceMethodRecord scriptMethods[] = {
{66, Script::checkSound},
{0xff, NULL}};
-const char *scriptOpcodes[] = {
+static const char *scriptOpcodes[] = {
"ABORT", "ADD", "SUBTRACT", "MULTIPLY", "DIVIDE", "EQUALS", "NOT_EQUALS",
"LT", "GT", "LTE", "GTE", "AND", "OR", "LOGICAL_AND", "LOGICAL_OR",
"GET_FIELD", "SET_FIELD", "PUSH", "SUBROUTINE", "EXEC", "END",
"COND_JUMP", "JUMP", "ABORT2", "ABORT3", "RANDOM"
};
-const char *scriptMethodNames[67] = {
+static const char *scriptMethodNames[67] = {
"ACTIVATE HOTSPOT", "SET HOTSPOT SCRIPT", "ADD SOUND 2", "SET HOTSPOT FLAG MASK",
"CLEAR SEQUENCE DELAY LIST", "DEACTIVATE HOTSPOT SET", "DEACTIVATE HOTSPOT",
"RESET PATHFINDER", "ADD DELAYED SCRIPT", "KILL SOUND",
@@ -865,7 +863,7 @@ uint16 Script::execute(uint16 startOffset) {
uint16 fieldNum;
uint32 tempVal;
SequenceMethodPtr ptr;
- SequenceMethodRecord *rec;
+ const SequenceMethodRecord *rec;
char debugInfo[MAX_DESC_SIZE];
uint16 offset = startOffset;
@@ -1157,8 +1155,7 @@ int16 HotspotScript::nextVal(MemoryBlock *data, uint16 &offset) {
return value;
}
-bool HotspotScript::execute(Hotspot *h)
-{
+bool HotspotScript::execute(Hotspot *h) {
Resources &r = Resources::getReference();
Room &room = Room::getReference();
MemoryBlock *scriptData = r.hotspotScriptData();