aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2014-12-25 19:13:52 +0100
committerEugene Sandulenko2015-12-15 00:05:02 +0100
commitcb8f8432966ccee632bf4e79e367d6d941dfdedb (patch)
tree356ebc283875676eee2177c8533f6ce062603acf /engines
parent471dbaa758f0ebea9f3d76caa7fd769c6809d395 (diff)
downloadscummvm-rg350-cb8f8432966ccee632bf4e79e367d6d941dfdedb.tar.gz
scummvm-rg350-cb8f8432966ccee632bf4e79e367d6d941dfdedb.tar.bz2
scummvm-rg350-cb8f8432966ccee632bf4e79e367d6d941dfdedb.zip
LAB: Objectify LabSets
Diffstat (limited to 'engines')
-rw-r--r--engines/lab/engine.cpp65
-rw-r--r--engines/lab/lab.cpp3
-rw-r--r--engines/lab/lab.h2
-rw-r--r--engines/lab/labfun.h17
-rw-r--r--engines/lab/labsets.cpp7
-rw-r--r--engines/lab/map.cpp63
-rw-r--r--engines/lab/modernsavegame.cpp2
-rw-r--r--engines/lab/processroom.cpp17
-rw-r--r--engines/lab/savegame.cpp29
-rw-r--r--engines/lab/special.cpp41
10 files changed, 129 insertions, 117 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index dec1806db5..4db1451921 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "lab/lab.h"
#include "lab/stddefines.h"
#include "lab/labfun.h"
#include "lab/diff.h"
@@ -222,8 +223,8 @@ static void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) {
}
if (Alternate) {
- if ((CurInv <= NumInv) && g_engine->_conditions->in(CurInv) && Inventory[CurInv].BInvName) {
- if ((CurInv == LAMPNUM) && g_engine->_conditions->in(LAMPON)) /* LAB: Labyrith specific */
+ if ((CurInv <= NumInv) && g_lab->_conditions->in(CurInv) && Inventory[CurInv].BInvName) {
+ if ((CurInv == LAMPNUM) && g_lab->_conditions->in(LAMPON)) /* LAB: Labyrith specific */
drawMessage(LAMPONMSG);
else if (Inventory[CurInv].Many > 1) {
ManyPtr = numtostr(ManyText, Inventory[CurInv].Many);
@@ -517,10 +518,10 @@ static const char *getInvName(uint16 CurInv) {
if (MainDisplay)
return Inventory[CurInv].BInvName;
- if ((CurInv == LAMPNUM) && g_engine->_conditions->in(LAMPON))
+ if ((CurInv == LAMPNUM) && g_lab->_conditions->in(LAMPON))
return "P:Mines/120";
- else if ((CurInv == BELTNUM) && g_engine->_conditions->in(BELTGLOW))
+ else if ((CurInv == BELTNUM) && g_lab->_conditions->in(BELTGLOW))
return "P:Future/BeltGlow";
else if (CurInv == WESTPAPERNUM) {
@@ -596,7 +597,7 @@ static bool doUse(uint16 CurInv) {
stopDiff();
CurFileName = " ";
CPtr = NULL;
- doMap(RoomsFound, RoomNum);
+ doMap(RoomNum);
VGASetPal(initcolors, 8);
drawMessage(NULL);
drawPanel();
@@ -608,7 +609,7 @@ static bool doUse(uint16 CurInv) {
stopDiff();
CurFileName = " ";
CPtr = NULL;
- doJournal(Conditions);
+ doJournal();
drawPanel();
drawMessage(NULL);
}
@@ -616,12 +617,12 @@ static bool doUse(uint16 CurInv) {
else if (CurInv == LAMPNUM) { /* LAB: Labyrinth specific */
interfaceOff();
- if (g_engine->_conditions->in(LAMPON)) {
+ if (g_lab->_conditions->in(LAMPON)) {
drawMessage(TURNLAMPOFF);
- g_engine->_conditions->exclElement(LAMPON);
+ g_lab->_conditions->exclElement(LAMPON);
} else {
drawMessage(TURNLAMPON);
- g_engine->_conditions->inclElement(LAMPON);
+ g_lab->_conditions->inclElement(LAMPON);
}
DoBlack = false;
@@ -634,25 +635,25 @@ static bool doUse(uint16 CurInv) {
}
else if (CurInv == BELTNUM) { /* LAB: Labyrinth specific */
- if (!g_engine->_conditions->in(BELTGLOW))
- g_engine->_conditions->inclElement(BELTGLOW);
+ if (!g_lab->_conditions->in(BELTGLOW))
+ g_lab->_conditions->inclElement(BELTGLOW);
DoBlack = false;
Test = getInvName(CurInv);
}
else if (CurInv == WHISKEYNUM) { /* LAB: Labyrinth specific */
- g_engine->_conditions->inclElement(USEDHELMET);
+ g_lab->_conditions->inclElement(USEDHELMET);
drawMessage(USEWHISKEY);
}
else if (CurInv == PITHHELMETNUM) { /* LAB: Labyrinth specific */
- g_engine->_conditions->inclElement(USEDHELMET);
+ g_lab->_conditions->inclElement(USEDHELMET);
drawMessage(USEPITH);
}
else if (CurInv == HELMETNUM) { /* LAB: Labyrinth specific */
- g_engine->_conditions->inclElement(USEDHELMET);
+ g_lab->_conditions->inclElement(USEDHELMET);
drawMessage(USEHELMET);
}
@@ -677,7 +678,7 @@ static void decIncInv(uint16 *CurInv, bool dec) {
(*CurInv)++;
while (*CurInv && (*CurInv <= NumInv)) {
- if (g_engine->_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) {
+ if (g_lab->_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) {
Test = getInvName(*CurInv);
break;
}
@@ -695,7 +696,7 @@ static void decIncInv(uint16 *CurInv, bool dec) {
*CurInv = 1;
while (*CurInv && (*CurInv <= NumInv)) {
- if (g_engine->_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) {
+ if (g_lab->_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) {
Test = getInvName(*CurInv);
break;
}
@@ -748,13 +749,13 @@ static void process(void) {
readRoomData("LAB:Doors");
readInventory("LAB:Inventor");
- if (!(g_engine->_conditions = new LargeSet(HighestCondition + 1)))
+ if (!(g_lab->_conditions = new LargeSet(HighestCondition + 1)))
return;
- if (!(g_engine->_roomsFound = new LargeSet(ManyRooms + 1)))
+ if (!(g_lab->_roomsFound = new LargeSet(ManyRooms + 1)))
return;
- g_engine->_conditions->readInitialConditions("LAB:Conditio");
+ g_lab->_conditions->readInitialConditions("LAB:Conditio");
LongWinInFront = false;
drawPanel();
@@ -788,7 +789,7 @@ static void process(void) {
Test = getPictName(&CPtr);
if (noupdatediff) {
- g_engine->_roomsFound->inclElement(RoomNum); /* Potentially entered another room */
+ g_lab->_roomsFound->inclElement(RoomNum); /* Potentially entered another room */
ForceDraw = (strcmp(Test, CurFileName) != 0) || ForceDraw;
noupdatediff = false;
@@ -797,7 +798,7 @@ static void process(void) {
else if (strcmp(Test, CurFileName) != 0) {
interfaceOff();
- g_engine->_roomsFound->inclElement(RoomNum); /* Potentially entered another room */
+ g_lab->_roomsFound->inclElement(RoomNum); /* Potentially entered another room */
CurFileName = Test;
if (CPtr) {
@@ -1089,7 +1090,7 @@ from_crumbs:
MainDisplay = false;
- if (LastInv && g_engine->_conditions->in(LastInv)) {
+ if (LastInv && g_lab->_conditions->in(LastInv)) {
CurInv = LastInv;
Test = getInvName(CurInv);
} else
@@ -1171,7 +1172,7 @@ from_crumbs:
if (OldRoomNum != RoomNum) {
drawMessage(GOFORWARDDIR);
- g_engine->_roomsFound->inclElement(RoomNum); /* Potentially entered a new room */
+ g_lab->_roomsFound->inclElement(RoomNum); /* Potentially entered a new room */
CurFileName = " ";
ForceDraw = true;
} else {
@@ -1315,11 +1316,11 @@ from_crumbs:
if ((CurInv == 0) || (CurInv > NumInv)) {
CurInv = 1;
- while ((CurInv <= NumInv) && (!g_engine->_conditions->in(CurInv)))
+ while ((CurInv <= NumInv) && (!g_lab->_conditions->in(CurInv)))
CurInv++;
}
- if ((CurInv <= NumInv) && g_engine->_conditions->in(CurInv) &&
+ if ((CurInv <= NumInv) && g_lab->_conditions->in(CurInv) &&
Inventory[CurInv].BInvName)
Test = getInvName(CurInv);
@@ -1398,9 +1399,9 @@ from_crumbs:
if (CPtr) {
if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labrinth specific code */
- mouseCombination(Conditions, MouseX, MouseY);
+ mouseCombination(MouseX, MouseY);
else if ((CPtr->CloseUpType == SPECIALBRICK) && MainDisplay)
- mouseTile(Conditions, MouseX, MouseY);
+ mouseTile(MouseX, MouseY);
else
doit = true;
} else
@@ -1453,11 +1454,11 @@ from_crumbs:
}
else if ((ActionMode == 5) &&
- g_engine->_conditions->in(CurInv)) { /* Use an item on something else */
+ g_lab->_conditions->in(CurInv)) { /* Use an item on something else */
if (doOperateRule(MouseX, MouseY, CurInv, &CPtr)) {
CurFileName = NewFileName;
- if (!g_engine->_conditions->in(CurInv))
+ if (!g_lab->_conditions->in(CurInv))
decIncInv(&CurInv, false);
} else if (MouseY < (VGAScaleY(149) + SVGACord(2)))
drawMessage(NOTHING);
@@ -1509,7 +1510,7 @@ from_crumbs:
interfaceOn(); /* Sets the correct gadget list */
if (Alternate) {
- if (LastInv && g_engine->_conditions->in(LastInv))
+ if (LastInv && g_lab->_conditions->in(LastInv))
CurInv = LastInv;
else
decIncInv(&CurInv, false);
@@ -1525,8 +1526,8 @@ from_crumbs:
}
}
- delete g_engine->_conditions;
- delete g_engine->_roomsFound;
+ delete g_lab->_conditions;
+ delete g_lab->_roomsFound;
if (Rooms)
free(Rooms);
diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp
index 7054072210..971543a3f2 100644
--- a/engines/lab/lab.cpp
+++ b/engines/lab/lab.cpp
@@ -45,8 +45,11 @@ bool LabEngine::hasFeature(EngineFeature f) const {
return (f == kSupportsRTL) ? true : false;
}
+LabEngine *g_lab;
+
LabEngine::LabEngine(OSystem *syst)
: Engine(syst) {
+ g_lab = this;
}
LabEngine::~LabEngine() {
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index 42429553f8..bdb0b4d89b 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -50,6 +50,8 @@ public:
LargeSet *_conditions, *_roomsFound;
};
+extern LabEngine *g_lab;
+
} // End of namespace Lab
#endif // LAB_H
diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h
index 93d5166480..abb0871669 100644
--- a/engines/lab/labfun.h
+++ b/engines/lab/labfun.h
@@ -281,7 +281,7 @@ public:
~LargeSet();
- bool in(set, uint16 element);
+ bool in(uint16 element);
void inclElement(uint16 element);
@@ -289,7 +289,8 @@ public:
bool readInitialConditions(const char *fileName);
-private:
+public:
+ uint16 _lastElement;
uint16 *_array;
};
@@ -333,9 +334,9 @@ bool getFont(const char *filename, TextFont *textfont);
void readImage(byte **buffer, Image **im);
-void doMap(LargeSet RoomsFound, uint16 CurRoom);
+void doMap(uint16 CurRoom);
-void doJournal(LargeSet Conditions);
+void doJournal();
void doNotes(void);
@@ -353,9 +354,9 @@ bool saveRestoreGame(void);
/*----- From saveGame.c ----*/
/*--------------------------*/
-bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters, LargeSet Conditions, LargeSet Rooms, uint16 filenum, uint16 type);
+bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters, uint16 filenum, uint16 type);
-bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuarters, LargeSet Conditions, LargeSet Rooms, uint16 filenum, uint16 type);
+bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuarters, uint16 filenum, uint16 type);
@@ -365,11 +366,11 @@ bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuart
void showCombination(const char *filename);
-void mouseCombination(LargeSet Conditions, uint16 x, uint16 y);
+void mouseCombination(uint16 x, uint16 y);
void showTile(const char *filename, bool showsolution);
-void mouseTile(LargeSet Conditions, uint16 x, uint16 y);
+void mouseTile(uint16 x, uint16 y);
void inner_main();
diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp
index cee9cda56b..eefbc79cb4 100644
--- a/engines/lab/labsets.cpp
+++ b/engines/lab/labsets.cpp
@@ -33,10 +33,11 @@
namespace Lab {
-LabSet::LabSet(uint16 last) {
+LargeSet::LargeSet(uint16 last) {
last = (((last + 15) >> 4) << 4);
- _array = (uint16 *)calloc(last >> 3);
+ _array = (uint16 *)calloc(last >> 3, 2);
+ _lastElement = last;
}
LargeSet::~LargeSet() {
@@ -48,7 +49,7 @@ bool LargeSet::in(uint16 element) {
}
void LargeSet::inclElement(uint16 element) {
- _array[(element - 1) >> 4]) |= 1 << ((element - 1) % 16);
+ _array[(element - 1) >> 4] |= 1 << ((element - 1) % 16);
}
void LargeSet::exclElement(uint16 element) {
diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp
index d3380b7ecb..eac13648eb 100644
--- a/engines/lab/map.cpp
+++ b/engines/lab/map.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "lab/lab.h"
#include "lab/stddefines.h"
#include "lab/labfun.h"
#include "lab/diff.h"
@@ -533,7 +534,7 @@ static bool onFloor(uint16 Floor) {
for (drawroom = 1; drawroom <= MaxRooms; drawroom++) {
if ((Maps[drawroom].PageNumber == Floor)
- && g_engine->_roomsFound->in(drawroom)
+ && g_lab->_roomsFound->in(drawroom)
&& Maps[drawroom].x) {
return true;
}
@@ -548,7 +549,7 @@ static bool onFloor(uint16 Floor) {
/*****************************************************************************/
/* Figures out which floor, if any, should be gone to if the up arrow is hit */
/*****************************************************************************/
-static void getUpFloor(LargeSet RoomsFound, uint16 *Floor, bool *isfloor) {
+static void getUpFloor(uint16 *Floor, bool *isfloor) {
do {
*isfloor = true;
@@ -559,7 +560,7 @@ static void getUpFloor(LargeSet RoomsFound, uint16 *Floor, bool *isfloor) {
*isfloor = false;
return;
}
- } while ((!onFloor(RoomsFound, *Floor)) && (*Floor <= CARNIVAL));
+ } while ((!onFloor(*Floor)) && (*Floor <= CARNIVAL));
}
@@ -569,7 +570,7 @@ static void getUpFloor(LargeSet RoomsFound, uint16 *Floor, bool *isfloor) {
/* Figures out which floor, if any, should be gone to if the down arrow is */
/* hit. */
/*****************************************************************************/
-static void getDownFloor(LargeSet RoomsFound, uint16 *Floor, bool *isfloor) {
+static void getDownFloor(uint16 *Floor, bool *isfloor) {
do {
*isfloor = true;
@@ -593,7 +594,7 @@ static void getDownFloor(LargeSet RoomsFound, uint16 *Floor, bool *isfloor) {
} else
(*Floor)--;
- } while ((!onFloor(RoomsFound, *Floor)) && *Floor);
+ } while ((!onFloor(*Floor)) && *Floor);
}
@@ -603,7 +604,7 @@ static void getDownFloor(LargeSet RoomsFound, uint16 *Floor, bool *isfloor) {
/*****************************************************************************/
/* Draws the map */
/*****************************************************************************/
-static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein) {
+static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein) {
uint16 drawroom;
char *sptr;
@@ -623,7 +624,7 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F
for (drawroom = 1; drawroom <= MaxRooms; drawroom++) {
if ((Maps[drawroom].PageNumber == Floor)
- && g_engine->_roomsFound->in(drawroom)
+ && g_lab->_roomsFound->in(drawroom)
&& Maps[drawroom].x) {
drawRoom(drawroom, (bool)(drawroom == CurRoom));
g_music->checkMusic();
@@ -631,12 +632,12 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F
}
if ((Maps[CurRoom].PageNumber == Floor) /* Makes sure the X is drawn in corridors */
- && g_engine->_roomsFound->in(CurRoom) /* NOTE: this here on purpose just in case there's some wierd condition, like the surreal maze where there are no rooms */
+ && g_lab->_roomsFound->in(CurRoom) /* NOTE: this here on purpose just in case there's some wierd condition, like the surreal maze where there are no rooms */
&& Maps[CurRoom].x)
drawRoom(CurRoom, true);
tempfloor = Floor;
- getUpFloor(RoomsFound, &tempfloor, &noghoast);
+ getUpFloor(&tempfloor, &noghoast);
if (noghoast)
unGhoastGadget(&upgadget);
@@ -644,7 +645,7 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F
ghoastGadget(&upgadget, 12);
tempfloor = Floor;
- getDownFloor(RoomsFound, &tempfloor, &noghoast);
+ getDownFloor(&tempfloor, &noghoast);
if (noghoast)
unGhoastGadget(&downgadget);
@@ -653,20 +654,20 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F
/* LAB: Labyrinth specific code */
if (Floor == LOWERFLOOR) {
- if (onFloor(RoomsFound, SURMAZEFLOOR))
+ if (onFloor(SURMAZEFLOOR))
drawImage(Maze, mapScaleX(538), mapScaleY(277));
}
else if (Floor == MIDDLEFLOOR) {
- if (onFloor(RoomsFound, CARNIVAL))
+ if (onFloor(CARNIVAL))
drawImage(Maze, mapScaleX(358), mapScaleY(72));
- if (onFloor(RoomsFound, MEDMAZEFLOOR))
+ if (onFloor(MEDMAZEFLOOR))
drawImage(Maze, mapScaleX(557), mapScaleY(325));
}
else if (Floor == UPPERFLOOR) {
- if (onFloor(RoomsFound, HEDGEMAZEFLOOR))
+ if (onFloor(HEDGEMAZEFLOOR))
drawImage(HugeMaze, mapScaleX(524), mapScaleY(97));
}
@@ -729,7 +730,7 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F
/*****************************************************************************/
/* Processes the map. */
/*****************************************************************************/
-void processMap(uint16 CurRoom, LargeSet RoomsFound) {
+void processMap(uint16 CurRoom) {
uint32 Class, place = 1;
uint16 Code, Qualifier, MouseX, MouseY, GadgetID, CurFloor, OldFloor, OldMsg, CurMsg, drawroom, x1, y1, x2, y2;
char *sptr;
@@ -789,21 +790,21 @@ void processMap(uint16 CurRoom, LargeSet RoomsFound) {
return;
} else if (GadgetID == 1) { /* Up arrow */
OldFloor = CurFloor;
- getUpFloor(RoomsFound, &CurFloor, &drawmap);
+ getUpFloor(&CurFloor, &drawmap);
if (drawmap) {
fade(false, 0);
- drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false);
+ drawMap(CurRoom, CurMsg, CurFloor, false, false);
fade(true, 0);
} else
CurFloor = OldFloor;
} else if (GadgetID == 2) { /* Down arrow */
OldFloor = CurFloor;
- getDownFloor(RoomsFound, &CurFloor, &drawmap);
+ getDownFloor(&CurFloor, &drawmap);
if (drawmap) {
fade(false, 0);
- drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false);
+ drawMap(CurRoom, CurMsg, CurFloor, false, false);
fade(true, 0);
} else
CurFloor = OldFloor;
@@ -813,41 +814,41 @@ void processMap(uint16 CurRoom, LargeSet RoomsFound) {
else if ((Class == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & Qualifier)) {
if ((CurFloor == LOWERFLOOR) && (MouseX >= mapScaleX(538)) && (MouseY >= mapScaleY(277))
&& (MouseX <= mapScaleX(633)) && (MouseY <= mapScaleY(352))
- && onFloor(RoomsFound, SURMAZEFLOOR)) {
+ && onFloor(SURMAZEFLOOR)) {
CurFloor = SURMAZEFLOOR;
fade(false, 0);
- drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false);
+ drawMap(CurRoom, CurMsg, CurFloor, false, false);
fade(true, 0);
}
else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(358)) && (MouseY >= mapScaleY(71))
&& (MouseX <= mapScaleX(452)) && (MouseY <= mapScaleY(147))
- && onFloor(RoomsFound, CARNIVAL)) {
+ && onFloor(CARNIVAL)) {
CurFloor = CARNIVAL;
fade(false, 0);
- drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false);
+ drawMap(CurRoom, CurMsg, CurFloor, false, false);
fade(true, 0);
}
else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(557)) && (MouseY >= mapScaleY(325))
&& (MouseX <= mapScaleX(653)) && (MouseY <= mapScaleY(401))
- && onFloor(RoomsFound, MEDMAZEFLOOR)) {
+ && onFloor(MEDMAZEFLOOR)) {
CurFloor = MEDMAZEFLOOR;
fade(false, 0);
- drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false);
+ drawMap(CurRoom, CurMsg, CurFloor, false, false);
fade(true, 0);
}
else if ((CurFloor == UPPERFLOOR) && (MouseX >= mapScaleX(524)) && (MouseY >= mapScaleY(97))
&& (MouseX <= mapScaleX(645)) && (MouseY <= mapScaleY(207))
- && onFloor(RoomsFound, HEDGEMAZEFLOOR)) {
+ && onFloor(HEDGEMAZEFLOOR)) {
CurFloor = HEDGEMAZEFLOOR;
fade(false, 0);
- drawMap(RoomsFound, CurRoom, CurMsg, CurFloor, false, false);
+ drawMap(CurRoom, CurMsg, CurFloor, false, false);
fade(true, 0);
}
@@ -858,7 +859,7 @@ void processMap(uint16 CurRoom, LargeSet RoomsFound) {
roomCords(drawroom, &x1, &y1, &x2, &y2);
if ((Maps[drawroom].PageNumber == CurFloor)
- && g_engine->_roomsFound->in(drawroom)
+ && g_lab->_roomsFound->in(drawroom)
&& (MouseX >= x1) && (MouseX <= x2)
&& (MouseY >= y1) && (MouseY <= y2)) {
CurMsg = drawroom;
@@ -915,7 +916,7 @@ void mapCleanUp(void) {
/*****************************************************************************/
/* Does the map processing. */
/*****************************************************************************/
-void doMap(LargeSet RoomsFound, uint16 CurRoom) {
+void doMap(uint16 CurRoom) {
FadePalette = AmigaMapPalette;
g_music->checkMusic();
@@ -931,13 +932,13 @@ void doMap(LargeSet RoomsFound, uint16 CurRoom) {
else if (Direction == WEST)
XMark = MapWest;
- drawMap(RoomsFound, CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true);
+ drawMap(CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true);
mouseShow();
attachGadgetList(MapGadgetList);
#if !defined(DOSCODE)
WSDL_UpdateScreen();
#endif
- processMap(CurRoom, RoomsFound);
+ processMap(CurRoom);
attachGadgetList(NULL);
fade(false, 0);
blackAllScreen();
diff --git a/engines/lab/modernsavegame.cpp b/engines/lab/modernsavegame.cpp
index 2be33b8aa5..71eedb9d38 100644
--- a/engines/lab/modernsavegame.cpp
+++ b/engines/lab/modernsavegame.cpp
@@ -83,7 +83,7 @@ int getSaveGameList(struct SaveGameInfo *info, int maxNum) {
fread(&t, 1, 2, fh);
info->Direction = swapUShort(t);
- toSeek = 2 + Conditions->lastElement / 8 + RoomsFound->lastElement / 8 + 6 + 2 * 16;
+ toSeek = 2 + Conditions->lastElement / 8 + g_lab->_roomsFound->_lastElement / 8 + 6 + 2 * 16;
fseek(fh, toSeek, SEEK_CUR);
info->SaveGameImage = NULL;
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index 19e113391c..10d5dfbc2b 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "lab/lab.h"
#include "lab/stddefines.h"
#include "lab/labfun.h"
#include "lab/parsetypes.h"
@@ -103,10 +104,10 @@ static bool checkConditions(int16 *Condition) {
return true;
Counter = 1;
- res = g_engine->_conditions->in(Condition[0]);
+ res = g_lab->_conditions->in(Condition[0]);
while (Condition[Counter] && res) {
- res = g_engine->_conditions->in(Condition[Counter]);
+ res = g_lab->_conditions->in(Condition[Counter]);
Counter++;
}
@@ -413,7 +414,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) {
VPtr = getViewData(RoomNum, Direction);
LCPtr = VPtr->closeUps;
} else if ((*cptr)->CloseUpType < 0) {
- g_engine->_conditions->inclElement(abs((*cptr)->CloseUpType));
+ g_lab->_conditions->inclElement(abs((*cptr)->CloseUpType));
return true;
} else
LCPtr = (*cptr)->SubCloseUps;
@@ -423,7 +424,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) {
if ((x >= scaleX(LCPtr->x1)) && (y >= scaleY(LCPtr->y1)) &&
(x <= scaleX(LCPtr->x2)) && (y <= scaleY(LCPtr->y2)) &&
(LCPtr->CloseUpType < 0)) {
- g_engine->_conditions->inclElement(abs(LCPtr->CloseUpType));
+ g_lab->_conditions->inclElement(abs(LCPtr->CloseUpType));
return true;
}
@@ -511,11 +512,11 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) {
break;
case SETELEMENT:
- g_engine->_conditions->inclElement(APtr->Param1);
+ g_lab->_conditions->inclElement(APtr->Param1);
break;
case UNSETELEMENT:
- g_engine->_conditions->exclElement(APtr->Param1);
+ g_lab->_conditions->exclElement(APtr->Param1);
break;
case SHOWMESSAGE:
@@ -610,13 +611,13 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) {
(Inventory[APtr->Param1].Many)--;
if (Inventory[APtr->Param1].Many == 0)
- g_engine->_conditions->exclElement(APtr->Param1);
+ g_lab->_conditions->exclElement(APtr->Param1);
break;
case ADDINV:
(Inventory[APtr->Param1].Many) += APtr->Param2;
- g_engine->_conditions->inclElement(APtr->Param1);
+ g_lab->_conditions->inclElement(APtr->Param1);
break;
case SHOWDIR:
diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp
index ed25c38ef2..c5d3499071 100644
--- a/engines/lab/savegame.cpp
+++ b/engines/lab/savegame.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "lab/lab.h"
#include "lab/stddefines.h"
#include "lab/labfun.h"
#include "lab/modernsavegame.h"
@@ -134,7 +135,7 @@ extern bool FollowingCrumbs;
/* Writes the game out to disk. */
/* Assumes that the file has already been openned and is there. */
/*****************************************************************************/
-static bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, LargeSet set1, LargeSet set2, LABFH file) {
+static bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, LABFH file) {
#if !defined(DOSCODE)
uint16 temp;
CrumbData crumbs[sizeof(BreadCrumbs) / sizeof(CrumbData)];
@@ -156,11 +157,11 @@ static bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, LargeSet
saveGameWriteBlock(file, &temp, 2L);
#endif
- last = set1->lastElement / 8;
- saveGameWriteBlock(file, &(set1->array[0]), (uint32) last);
+ last = g_lab->_conditions->_lastElement / 8;
+ saveGameWriteBlock(file, g_lab->_conditions->_array, (uint32) last);
- last = set2->lastElement / 8;
- saveGameWriteBlock(file, &(set2->array[0]), (uint32) last);
+ last = g_lab->_roomsFound->_lastElement / 8;
+ saveGameWriteBlock(file, g_lab->_roomsFound->_array, (uint32) last);
/* LAB: the combination lock and tile stuff */
for (counter = 0; counter < 6; counter++) {
@@ -198,7 +199,7 @@ static bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, LargeSet
/* Reads the game from disk. */
/* Assumes that the file has already been openned and is there. */
/*****************************************************************************/
-static bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, LargeSet set1, LargeSet set2, LABFH file) {
+static bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, LABFH file) {
#if !defined(DOSCODE)
uint16 t;
CrumbData crumbs[sizeof(BreadCrumbs) / sizeof(CrumbData)];
@@ -230,11 +231,11 @@ static bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, Large
*Quarters = swapUShort(t);
#endif
- last = set1->lastElement / 8;
- saveGameReadBlock(file, &(set1->array[0]), (uint32) last);
+ last = g_lab->_conditions->_lastElement / 8;
+ saveGameReadBlock(file, g_lab->_conditions->_array, (uint32) last);
- last = set2->lastElement / 8;
- saveGameReadBlock(file, &(set2->array[0]), (uint32) last);
+ last = g_lab->_roomsFound->_lastElement / 8;
+ saveGameReadBlock(file, g_lab->_roomsFound->_array, (uint32) last);
/* LAB: the combination lock and tile stuff */
for (counter = 0; counter < 6; counter++) {
@@ -281,7 +282,7 @@ static bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, Large
/*****************************************************************************/
/* Saves the game to the floppy disk. */
/*****************************************************************************/
-bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters, LargeSet Conditions, LargeSet Rooms, uint16 filenum, uint16 type) {
+bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters, uint16 filenum, uint16 type) {
LABFH FPtr;
g_music->checkMusic();
@@ -290,7 +291,7 @@ bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters
FileNum = filenum;
if ((FPtr = saveGameOpen(path, true)) != INVALID_LABFH)
- saveGame(RoomNum, Direction, NumQuarters, Conditions, Rooms, FPtr);
+ saveGame(RoomNum, Direction, NumQuarters, FPtr);
else
return false;
@@ -303,7 +304,7 @@ bool saveFloppy(char *path, uint16 RoomNum, uint16 Direction, uint16 NumQuarters
/*****************************************************************************/
/* Reads the game from the floppy disk. */
/*****************************************************************************/
-bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuarters, LargeSet Conditions, LargeSet Rooms, uint16 filenum, uint16 type) {
+bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuarters, uint16 filenum, uint16 type) {
LABFH FPtr;
g_music->checkMusic();
@@ -312,7 +313,7 @@ bool readFloppy(char *path, uint16 *RoomNum, uint16 *Direction, uint16 *NumQuart
FileNum = filenum;
if ((FPtr = saveGameOpen(path, false)) != INVALID_LABFH) {
- if (!loadGame(RoomNum, Direction, NumQuarters, Conditions, Rooms, FPtr))
+ if (!loadGame(RoomNum, Direction, NumQuarters, FPtr))
return false;
} else
return false;
diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp
index 022f203f52..b033386f38 100644
--- a/engines/lab/special.cpp
+++ b/engines/lab/special.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "lab/lab.h"
#include "lab/labfun.h"
#include "lab/parsefun.h"
#include "lab/interface.h"
@@ -159,7 +160,7 @@ void showCombination(const char *filename) {
/*****************************************************************************/
/* Changes the combination number of one of the slots */
/*****************************************************************************/
-static void changeCombination(LargeSet Conditions, uint16 number) {
+static void changeCombination(uint16 number) {
struct Image display;
uint16 counter, combnum;
bool unlocked = true;
@@ -199,9 +200,9 @@ static void changeCombination(LargeSet Conditions, uint16 number) {
unlocked = (combination[counter] == solution[counter]) && unlocked;
if (unlocked)
- g_engine->_conditions->inclElement(COMBINATIONUNLOCKED);
+ g_lab->_conditions->inclElement(COMBINATIONUNLOCKED);
else
- g_engine->_conditions->exclElement(COMBINATIONUNLOCKED);
+ g_lab->_conditions->exclElement(COMBINATIONUNLOCKED);
#if !defined(DOSCODE)
ungetVGABaseAddr();
@@ -215,7 +216,7 @@ static void changeCombination(LargeSet Conditions, uint16 number) {
/*****************************************************************************/
/* Processes mouse clicks and changes the combination. */
/*****************************************************************************/
-void mouseCombination(LargeSet Conditions, uint16 x, uint16 y) {
+void mouseCombination(uint16 x, uint16 y) {
uint16 number;
x = VGAUnScaleX(x);
@@ -237,7 +238,7 @@ void mouseCombination(LargeSet Conditions, uint16 x, uint16 y) {
else
return;
- changeCombination(Conditions, number);
+ changeCombination(number);
}
}
@@ -411,7 +412,7 @@ static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) {
/*****************************************************************************/
/* Changes the combination number of one of the slots */
/*****************************************************************************/
-static void changeTile(LargeSet Conditions, uint16 col, uint16 row) {
+static void changeTile(uint16 col, uint16 row) {
bool check;
int16 scrolltype = -1;
@@ -479,7 +480,7 @@ static void changeTile(LargeSet Conditions, uint16 col, uint16 row) {
}
if (check) {
- g_engine->_conditions->inclElement(BRICKOPEN); /* unlocked combination */
+ g_lab->_conditions->inclElement(BRICKOPEN); /* unlocked combination */
DoBlack = true;
check = readPict("p:Up/BDOpen", true);
}
@@ -493,7 +494,7 @@ static void changeTile(LargeSet Conditions, uint16 col, uint16 row) {
/*****************************************************************************/
/* Processes mouse clicks and changes the combination. */
/*****************************************************************************/
-void mouseTile(LargeSet Conditions, uint16 x, uint16 y) {
+void mouseTile(uint16 x, uint16 y) {
x = VGAUnScaleX(x);
y = VGAUnScaleY(y);
@@ -504,7 +505,7 @@ void mouseTile(LargeSet Conditions, uint16 x, uint16 y) {
y = (y - 26) / 25;
if ((x < 4) && (y < 4))
- changeTile(Conditions, x, y);
+ changeTile(x, y);
}
@@ -641,7 +642,7 @@ static struct Gadget ForwardG, CancelG, BackG;
/*****************************************************************************/
/* Loads in the data for the journal. */
/*****************************************************************************/
-static bool loadJournalData(LargeSet Conditions) {
+static bool loadJournalData() {
byte **buffer;
char filename[20];
struct Gadget *TopGadget = &BackG;
@@ -658,10 +659,10 @@ static bool loadJournalData(LargeSet Conditions) {
g_music->checkMusic();
strcpy(filename, "Lab:Rooms/j0");
- bridge = g_engine->_conditions->in(BRIDGE0) || g_engine->_conditions->in(BRIDGE1);
- dirty = g_engine->_conditions->in(DIRTY);
- news = !g_engine->_conditions->in(NONEWS);
- clean = !g_engine->_conditions->in(NOCLEAN);
+ bridge = g_lab->_conditions->in(BRIDGE0) || g_lab->_conditions->in(BRIDGE1);
+ dirty = g_lab->_conditions->in(DIRTY);
+ news = !g_lab->_conditions->in(NONEWS);
+ clean = !g_lab->_conditions->in(NOCLEAN);
if (bridge && clean && news)
filename[11] = '8';
@@ -918,7 +919,7 @@ static void journalCleanUp(void) {
/*****************************************************************************/
/* Does the journal processing. */
/*****************************************************************************/
-void doJournal(LargeSet Conditions) {
+void doJournal() {
resetBuffer();
blackAllScreen();
@@ -936,7 +937,7 @@ void doJournal(LargeSet Conditions) {
ScreenImage.ImageData = getVGABaseAddr();
g_music->checkMusic();
- loadJournalData(Conditions);
+ loadJournalData();
drawJournal(0, true);
@@ -1338,7 +1339,7 @@ static bool doSaveGame() {
sprintf(DrivePath, "%s%s%d", g_SaveGamePath, g_PathSeperator, g_CurSaveGameNumber);
- isok = saveFloppy(DrivePath, RoomNum, Direction, Inventory[QUARTERNUM].Many, Conditions, RoomsFound, g_CurSaveGameNumber, device);
+ isok = saveFloppy(DrivePath, RoomNum, Direction, Inventory[QUARTERNUM].Many, g_CurSaveGameNumber, device);
g_music->resetMusic();
if (isok)
@@ -1356,7 +1357,7 @@ static bool doLoadGame() {
snprintf(drivePath, 260, "%s%s%d", g_SaveGamePath, g_PathSeperator, g_CurSaveGameNumber);
- isok = readFloppy(drivePath, &RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), Conditions, RoomsFound, g_CurSaveGameNumber, device);
+ isok = readFloppy(drivePath, &RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), g_CurSaveGameNumber, device);
g_music->resetMusic();
if (isok)
@@ -1877,9 +1878,9 @@ bool saveRestoreGame(void) {
eatMessages();
if (issave)
- isok = saveFloppy(DrivePath, RoomNum, Direction, Inventory[QUARTERNUM].Many, Conditions, RoomsFound, filenum, device);
+ isok = saveFloppy(DrivePath, RoomNum, Direction, Inventory[QUARTERNUM].Many, filenum, device);
else {
- isok = readFloppy(DrivePath, &RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), Conditions, RoomsFound, filenum, device);
+ isok = readFloppy(DrivePath, &RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), filenum, device);
g_music->resetMusic();
}
}