mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 05:01:43 +00:00
LAB: Started objectifying LargeSets
This commit is contained in:
parent
6ab5edf762
commit
471dbaa758
@ -53,7 +53,6 @@ extern bool DoBlack, waiteffect, EffectPlaying, stopsound, DoNotDrawMessage, IsH
|
||||
extern RoomData *Rooms;
|
||||
extern InventoryData *Inventory;
|
||||
extern uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction;
|
||||
extern LargeSet Conditions, RoomsFound;
|
||||
CloseDataPtr CPtr;
|
||||
|
||||
#if !defined(DOSCODE)
|
||||
@ -223,8 +222,8 @@ static void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr) {
|
||||
}
|
||||
|
||||
if (Alternate) {
|
||||
if ((CurInv <= NumInv) && In(Conditions, CurInv) && Inventory[CurInv].BInvName) {
|
||||
if ((CurInv == LAMPNUM) && In(Conditions, LAMPON)) /* LAB: Labyrith specific */
|
||||
if ((CurInv <= NumInv) && g_engine->_conditions->in(CurInv) && Inventory[CurInv].BInvName) {
|
||||
if ((CurInv == LAMPNUM) && g_engine->_conditions->in(LAMPON)) /* LAB: Labyrith specific */
|
||||
drawMessage(LAMPONMSG);
|
||||
else if (Inventory[CurInv].Many > 1) {
|
||||
ManyPtr = numtostr(ManyText, Inventory[CurInv].Many);
|
||||
@ -518,10 +517,10 @@ static const char *getInvName(uint16 CurInv) {
|
||||
if (MainDisplay)
|
||||
return Inventory[CurInv].BInvName;
|
||||
|
||||
if ((CurInv == LAMPNUM) && In(Conditions, LAMPON))
|
||||
if ((CurInv == LAMPNUM) && g_engine->_conditions->in(LAMPON))
|
||||
return "P:Mines/120";
|
||||
|
||||
else if ((CurInv == BELTNUM) && In(Conditions, BELTGLOW))
|
||||
else if ((CurInv == BELTNUM) && g_engine->_conditions->in(BELTGLOW))
|
||||
return "P:Future/BeltGlow";
|
||||
|
||||
else if (CurInv == WESTPAPERNUM) {
|
||||
@ -617,12 +616,12 @@ static bool doUse(uint16 CurInv) {
|
||||
else if (CurInv == LAMPNUM) { /* LAB: Labyrinth specific */
|
||||
interfaceOff();
|
||||
|
||||
if (In(Conditions, LAMPON)) {
|
||||
if (g_engine->_conditions->in(LAMPON)) {
|
||||
drawMessage(TURNLAMPOFF);
|
||||
exclElement(Conditions, LAMPON);
|
||||
g_engine->_conditions->exclElement(LAMPON);
|
||||
} else {
|
||||
drawMessage(TURNLAMPON);
|
||||
inclElement(Conditions, LAMPON);
|
||||
g_engine->_conditions->inclElement(LAMPON);
|
||||
}
|
||||
|
||||
DoBlack = false;
|
||||
@ -635,25 +634,25 @@ static bool doUse(uint16 CurInv) {
|
||||
}
|
||||
|
||||
else if (CurInv == BELTNUM) { /* LAB: Labyrinth specific */
|
||||
if (!In(Conditions, BELTGLOW))
|
||||
inclElement(Conditions, BELTGLOW);
|
||||
if (!g_engine->_conditions->in(BELTGLOW))
|
||||
g_engine->_conditions->inclElement(BELTGLOW);
|
||||
|
||||
DoBlack = false;
|
||||
Test = getInvName(CurInv);
|
||||
}
|
||||
|
||||
else if (CurInv == WHISKEYNUM) { /* LAB: Labyrinth specific */
|
||||
inclElement(Conditions, USEDHELMET);
|
||||
g_engine->_conditions->inclElement(USEDHELMET);
|
||||
drawMessage(USEWHISKEY);
|
||||
}
|
||||
|
||||
else if (CurInv == PITHHELMETNUM) { /* LAB: Labyrinth specific */
|
||||
inclElement(Conditions, USEDHELMET);
|
||||
g_engine->_conditions->inclElement(USEDHELMET);
|
||||
drawMessage(USEPITH);
|
||||
}
|
||||
|
||||
else if (CurInv == HELMETNUM) { /* LAB: Labyrinth specific */
|
||||
inclElement(Conditions, USEDHELMET);
|
||||
g_engine->_conditions->inclElement(USEDHELMET);
|
||||
drawMessage(USEHELMET);
|
||||
}
|
||||
|
||||
@ -678,7 +677,7 @@ static void decIncInv(uint16 *CurInv, bool dec) {
|
||||
(*CurInv)++;
|
||||
|
||||
while (*CurInv && (*CurInv <= NumInv)) {
|
||||
if (In(Conditions, *CurInv) && Inventory[*CurInv].BInvName) {
|
||||
if (g_engine->_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) {
|
||||
Test = getInvName(*CurInv);
|
||||
break;
|
||||
}
|
||||
@ -696,7 +695,7 @@ static void decIncInv(uint16 *CurInv, bool dec) {
|
||||
*CurInv = 1;
|
||||
|
||||
while (*CurInv && (*CurInv <= NumInv)) {
|
||||
if (In(Conditions, *CurInv) && Inventory[*CurInv].BInvName) {
|
||||
if (g_engine->_conditions->in(*CurInv) && Inventory[*CurInv].BInvName) {
|
||||
Test = getInvName(*CurInv);
|
||||
break;
|
||||
}
|
||||
@ -749,13 +748,13 @@ static void process(void) {
|
||||
readRoomData("LAB:Doors");
|
||||
readInventory("LAB:Inventor");
|
||||
|
||||
if (!createSet(&Conditions, HighestCondition + 1))
|
||||
if (!(g_engine->_conditions = new LargeSet(HighestCondition + 1)))
|
||||
return;
|
||||
|
||||
if (!createSet(&RoomsFound, ManyRooms + 1))
|
||||
if (!(g_engine->_roomsFound = new LargeSet(ManyRooms + 1)))
|
||||
return;
|
||||
|
||||
readInitialConditions(Conditions, "LAB:Conditio");
|
||||
g_engine->_conditions->readInitialConditions("LAB:Conditio");
|
||||
|
||||
LongWinInFront = false;
|
||||
drawPanel();
|
||||
@ -789,7 +788,7 @@ static void process(void) {
|
||||
Test = getPictName(&CPtr);
|
||||
|
||||
if (noupdatediff) {
|
||||
inclElement(RoomsFound, RoomNum); /* Potentially entered another room */
|
||||
g_engine->_roomsFound->inclElement(RoomNum); /* Potentially entered another room */
|
||||
ForceDraw = (strcmp(Test, CurFileName) != 0) || ForceDraw;
|
||||
|
||||
noupdatediff = false;
|
||||
@ -798,7 +797,7 @@ static void process(void) {
|
||||
|
||||
else if (strcmp(Test, CurFileName) != 0) {
|
||||
interfaceOff();
|
||||
inclElement(RoomsFound, RoomNum); /* Potentially entered another room */
|
||||
g_engine->_roomsFound->inclElement(RoomNum); /* Potentially entered another room */
|
||||
CurFileName = Test;
|
||||
|
||||
if (CPtr) {
|
||||
@ -1090,7 +1089,7 @@ from_crumbs:
|
||||
|
||||
MainDisplay = false;
|
||||
|
||||
if (LastInv && In(Conditions, LastInv)) {
|
||||
if (LastInv && g_engine->_conditions->in(LastInv)) {
|
||||
CurInv = LastInv;
|
||||
Test = getInvName(CurInv);
|
||||
} else
|
||||
@ -1172,7 +1171,7 @@ from_crumbs:
|
||||
|
||||
if (OldRoomNum != RoomNum) {
|
||||
drawMessage(GOFORWARDDIR);
|
||||
inclElement(RoomsFound, RoomNum); /* Potentially entered a new room */
|
||||
g_engine->_roomsFound->inclElement(RoomNum); /* Potentially entered a new room */
|
||||
CurFileName = " ";
|
||||
ForceDraw = true;
|
||||
} else {
|
||||
@ -1316,11 +1315,11 @@ from_crumbs:
|
||||
if ((CurInv == 0) || (CurInv > NumInv)) {
|
||||
CurInv = 1;
|
||||
|
||||
while ((CurInv <= NumInv) && (!In(Conditions, CurInv)))
|
||||
while ((CurInv <= NumInv) && (!g_engine->_conditions->in(CurInv)))
|
||||
CurInv++;
|
||||
}
|
||||
|
||||
if ((CurInv <= NumInv) && In(Conditions, CurInv) &&
|
||||
if ((CurInv <= NumInv) && g_engine->_conditions->in(CurInv) &&
|
||||
Inventory[CurInv].BInvName)
|
||||
Test = getInvName(CurInv);
|
||||
|
||||
@ -1454,11 +1453,11 @@ from_crumbs:
|
||||
}
|
||||
|
||||
else if ((ActionMode == 5) &&
|
||||
In(Conditions, CurInv)) { /* Use an item on something else */
|
||||
g_engine->_conditions->in(CurInv)) { /* Use an item on something else */
|
||||
if (doOperateRule(MouseX, MouseY, CurInv, &CPtr)) {
|
||||
CurFileName = NewFileName;
|
||||
|
||||
if (!In(Conditions, CurInv))
|
||||
if (!g_engine->_conditions->in(CurInv))
|
||||
decIncInv(&CurInv, false);
|
||||
} else if (MouseY < (VGAScaleY(149) + SVGACord(2)))
|
||||
drawMessage(NOTHING);
|
||||
@ -1510,7 +1509,7 @@ from_crumbs:
|
||||
interfaceOn(); /* Sets the correct gadget list */
|
||||
|
||||
if (Alternate) {
|
||||
if (LastInv && In(Conditions, LastInv))
|
||||
if (LastInv && g_engine->_conditions->in(LastInv))
|
||||
CurInv = LastInv;
|
||||
else
|
||||
decIncInv(&CurInv, false);
|
||||
@ -1526,11 +1525,8 @@ from_crumbs:
|
||||
}
|
||||
}
|
||||
|
||||
if (Conditions)
|
||||
deleteSet(Conditions);
|
||||
|
||||
if (RoomsFound)
|
||||
deleteSet(RoomsFound);
|
||||
delete g_engine->_conditions;
|
||||
delete g_engine->_roomsFound;
|
||||
|
||||
if (Rooms)
|
||||
free(Rooms);
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "common/array.h"
|
||||
|
||||
#include "engines/engine.h"
|
||||
#include "lab/labfun.h"
|
||||
|
||||
namespace Lab {
|
||||
|
||||
@ -45,6 +46,8 @@ public:
|
||||
virtual Common::Error run();
|
||||
|
||||
bool hasFeature(EngineFeature f) const;
|
||||
|
||||
LargeSet *_conditions, *_roomsFound;
|
||||
};
|
||||
|
||||
} // End of namespace Lab
|
||||
|
@ -275,26 +275,23 @@ extern Music *g_music;
|
||||
/*----- From LabSets.c ------*/
|
||||
/*---------------------------*/
|
||||
|
||||
typedef struct {
|
||||
uint16 lastElement, array[1];
|
||||
} LargeSetRecord;
|
||||
class LargeSet {
|
||||
public:
|
||||
LargeSet(uint16 last);
|
||||
|
||||
typedef LargeSetRecord *LargeSet;
|
||||
~LargeSet();
|
||||
|
||||
bool in(set, uint16 element);
|
||||
|
||||
void inclElement(uint16 element);
|
||||
|
||||
bool createSet(LargeSet *set, uint16 last);
|
||||
|
||||
void deleteSet(LargeSet set);
|
||||
|
||||
bool In(LargeSet set, uint16 element);
|
||||
|
||||
void inclElement(LargeSet set, uint16 element);
|
||||
|
||||
void exclElement(LargeSet set, uint16 element);
|
||||
|
||||
void exclElement(uint16 element);
|
||||
|
||||
bool readInitialConditions(const char *fileName);
|
||||
|
||||
private:
|
||||
uint16 *_array;
|
||||
};
|
||||
|
||||
/*---------------------------*/
|
||||
/*----- From Machine.c ------*/
|
||||
|
@ -33,65 +33,57 @@
|
||||
|
||||
namespace Lab {
|
||||
|
||||
const uint32 LargeSetSIZE = sizeof(LargeSetRecord) - 2;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Creates a large set. */
|
||||
/*****************************************************************************/
|
||||
bool createSet(LargeSet *set, uint16 last) {
|
||||
LabSet::LabSet(uint16 last) {
|
||||
last = (((last + 15) >> 4) << 4);
|
||||
|
||||
if ((*set = (LargeSet)calloc((last >> 3) + LargeSetSIZE, 1))) {
|
||||
(*set)->lastElement = last;
|
||||
return true;
|
||||
} else /* Not Enough Memory! */
|
||||
_array = (uint16 *)calloc(last >> 3);
|
||||
}
|
||||
|
||||
LargeSet::~LargeSet() {
|
||||
free(_array);
|
||||
}
|
||||
|
||||
bool LargeSet::in(uint16 element) {
|
||||
return ((1 << ((element - 1) % 16)) & (_array[(element - 1) >> 4])) > 0;
|
||||
}
|
||||
|
||||
void LargeSet::inclElement(uint16 element) {
|
||||
_array[(element - 1) >> 4]) |= 1 << ((element - 1) % 16);
|
||||
}
|
||||
|
||||
void LargeSet::exclElement(uint16 element) {
|
||||
_array[(element - 1) >> 4] &= ~(1 << ((element - 1) % 16));
|
||||
}
|
||||
|
||||
bool LargeSet::readInitialConditions(const char *fileName) {
|
||||
byte **file;
|
||||
uint16 many, set;
|
||||
char temp[5];
|
||||
|
||||
if ((file = g_music->newOpen(fileName)) != NULL) {
|
||||
readBlock(temp, 4L, file);
|
||||
temp[4] = '\0';
|
||||
|
||||
if (strcmp(temp, "CON0") != 0)
|
||||
return false;
|
||||
|
||||
readBlock(&many, 2L, file);
|
||||
#if !defined(DOSCODE)
|
||||
swapUShortPtr(&many, 1);
|
||||
#endif
|
||||
|
||||
for (int counter = 0; counter < many; counter++) {
|
||||
readBlock(&set, 2L, file);
|
||||
#if !defined(DOSCODE)
|
||||
swapUShortPtr(&set, 1);
|
||||
#endif
|
||||
inclElement(set);
|
||||
}
|
||||
} else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Deletes a large set. */
|
||||
/*****************************************************************************/
|
||||
void deleteSet(LargeSet set) {
|
||||
if (set)
|
||||
free(set);
|
||||
}
|
||||
|
||||
|
||||
#define INCL(BITSET,BIT) ((BITSET) |= (BIT))
|
||||
|
||||
#define EXCL(BITSET,BIT) ((BITSET) &= (~(BIT)))
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Tests if an element is in the set. */
|
||||
/*****************************************************************************/
|
||||
bool In(LargeSet set, uint16 element) {
|
||||
return ((1 << ((element - 1) % 16)) & (set->array[(element - 1) >> 4])) > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Sets an element in the Large set. */
|
||||
/*****************************************************************************/
|
||||
void inclElement(LargeSet set, uint16 element) {
|
||||
INCL((set->array[(element - 1) >> 4]), (1 << ((element - 1) % 16)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Removes an element in the Large set. */
|
||||
/*****************************************************************************/
|
||||
void exclElement(LargeSet set, uint16 element) {
|
||||
EXCL((set->array[(element - 1) >> 4]), (1 << ((element - 1) % 16)));
|
||||
}
|
||||
|
||||
} // End of namespace Lab
|
||||
|
@ -159,7 +159,7 @@ void decrypt(byte *text) {
|
||||
return;
|
||||
|
||||
while (*text != '\0') {
|
||||
(*text) -= (byte) 95;
|
||||
(*text) -= (byte)95;
|
||||
text++;
|
||||
}
|
||||
}
|
||||
|
@ -147,27 +147,6 @@ uint16 VGAUnScaleY(uint16 y) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(WIN32)
|
||||
/*****************************************************************************/
|
||||
/* Replaces all occurences of a character in a string with a new one. */
|
||||
/*****************************************************************************/
|
||||
static void strrplc(char *text, char orig, char replace) {
|
||||
uint16 counter;
|
||||
|
||||
counter = 0;
|
||||
|
||||
while (text[counter]) {
|
||||
if (text[counter] == orig)
|
||||
text[counter] = replace;
|
||||
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Checks to see if all the characters in the second string are at the start */
|
||||
/* of the first. */
|
||||
|
@ -528,12 +528,12 @@ static void drawRoom(uint16 CurRoom, bool drawx) {
|
||||
/*****************************************************************************/
|
||||
/* Checks if a floor has been visitted. */
|
||||
/*****************************************************************************/
|
||||
static bool onFloor(LargeSet RoomsFound, uint16 Floor) {
|
||||
static bool onFloor(uint16 Floor) {
|
||||
uint16 drawroom;
|
||||
|
||||
for (drawroom = 1; drawroom <= MaxRooms; drawroom++) {
|
||||
if ((Maps[drawroom].PageNumber == Floor)
|
||||
&& In(RoomsFound, drawroom)
|
||||
&& g_engine->_roomsFound->in(drawroom)
|
||||
&& Maps[drawroom].x) {
|
||||
return true;
|
||||
}
|
||||
@ -623,7 +623,7 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F
|
||||
|
||||
for (drawroom = 1; drawroom <= MaxRooms; drawroom++) {
|
||||
if ((Maps[drawroom].PageNumber == Floor)
|
||||
&& In(RoomsFound, drawroom)
|
||||
&& g_engine->_roomsFound->in(drawroom)
|
||||
&& Maps[drawroom].x) {
|
||||
drawRoom(drawroom, (bool)(drawroom == CurRoom));
|
||||
g_music->checkMusic();
|
||||
@ -631,7 +631,7 @@ static void drawMap(LargeSet RoomsFound, uint16 CurRoom, uint16 CurMsg, uint16 F
|
||||
}
|
||||
|
||||
if ((Maps[CurRoom].PageNumber == Floor) /* Makes sure the X is drawn in corridors */
|
||||
&& In(RoomsFound, CurRoom) /* NOTE: this here on purpose just in case there's some wierd condition, like the surreal maze where there are no rooms */
|
||||
&& 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 */
|
||||
&& Maps[CurRoom].x)
|
||||
drawRoom(CurRoom, true);
|
||||
|
||||
@ -858,7 +858,7 @@ void processMap(uint16 CurRoom, LargeSet RoomsFound) {
|
||||
roomCords(drawroom, &x1, &y1, &x2, &y2);
|
||||
|
||||
if ((Maps[drawroom].PageNumber == CurFloor)
|
||||
&& In(RoomsFound, drawroom)
|
||||
&& g_engine->_roomsFound->in(drawroom)
|
||||
&& (MouseX >= x1) && (MouseX <= x2)
|
||||
&& (MouseY >= y1) && (MouseY <= y2)) {
|
||||
CurMsg = drawroom;
|
||||
|
@ -39,9 +39,6 @@ byte g_SaveGameImage[SAVED_IMAGE_SIZE]; // 640 x 358
|
||||
char g_SaveGamePath[512];
|
||||
char g_PathSeperator[4];
|
||||
|
||||
extern LargeSet Conditions,
|
||||
RoomsFound;
|
||||
|
||||
#define SAVEVERSION "LBS3"
|
||||
|
||||
int getSaveGameList(struct SaveGameInfo *info, int maxNum) {
|
||||
|
@ -60,9 +60,6 @@ char *numtostr(char *text, uint16 Num);
|
||||
|
||||
bool readViews(uint16 RoomNum, const char *Path);
|
||||
|
||||
bool readInitialConditions(LargeSet Conditions, const char *fileName);
|
||||
|
||||
|
||||
|
||||
/* From ProcessRoom.c */
|
||||
|
||||
|
@ -51,8 +51,6 @@ extern int g_IsRegistered;
|
||||
RoomData *Rooms;
|
||||
InventoryData *Inventory;
|
||||
uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction;
|
||||
LargeSet Conditions, RoomsFound;
|
||||
|
||||
|
||||
extern char *FACINGNORTH, *FACINGEAST, *FACINGSOUTH, *FACINGWEST;
|
||||
extern bool LongWinInFront;
|
||||
@ -105,10 +103,10 @@ static bool checkConditions(int16 *Condition) {
|
||||
return true;
|
||||
|
||||
Counter = 1;
|
||||
res = In(Conditions, Condition[0]);
|
||||
res = g_engine->_conditions->in(Condition[0]);
|
||||
|
||||
while (Condition[Counter] && res) {
|
||||
res = In(Conditions, Condition[Counter]);
|
||||
res = g_engine->_conditions->in(Condition[Counter]);
|
||||
Counter++;
|
||||
}
|
||||
|
||||
@ -415,7 +413,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) {
|
||||
VPtr = getViewData(RoomNum, Direction);
|
||||
LCPtr = VPtr->closeUps;
|
||||
} else if ((*cptr)->CloseUpType < 0) {
|
||||
inclElement(Conditions, abs((*cptr)->CloseUpType));
|
||||
g_engine->_conditions->inclElement(abs((*cptr)->CloseUpType));
|
||||
return true;
|
||||
} else
|
||||
LCPtr = (*cptr)->SubCloseUps;
|
||||
@ -425,7 +423,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)) {
|
||||
inclElement(Conditions, abs(LCPtr->CloseUpType));
|
||||
g_engine->_conditions->inclElement(abs(LCPtr->CloseUpType));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -513,11 +511,11 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) {
|
||||
break;
|
||||
|
||||
case SETELEMENT:
|
||||
inclElement(Conditions, APtr->Param1);
|
||||
g_engine->_conditions->inclElement(APtr->Param1);
|
||||
break;
|
||||
|
||||
case UNSETELEMENT:
|
||||
exclElement(Conditions, APtr->Param1);
|
||||
g_engine->_conditions->exclElement(APtr->Param1);
|
||||
break;
|
||||
|
||||
case SHOWMESSAGE:
|
||||
@ -612,13 +610,13 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) {
|
||||
(Inventory[APtr->Param1].Many)--;
|
||||
|
||||
if (Inventory[APtr->Param1].Many == 0)
|
||||
exclElement(Conditions, APtr->Param1);
|
||||
g_engine->_conditions->exclElement(APtr->Param1);
|
||||
|
||||
break;
|
||||
|
||||
case ADDINV:
|
||||
(Inventory[APtr->Param1].Many) += APtr->Param2;
|
||||
inclElement(Conditions, APtr->Param1);
|
||||
g_engine->_conditions->inclElement(APtr->Param1);
|
||||
break;
|
||||
|
||||
case SHOWDIR:
|
||||
|
@ -46,9 +46,6 @@ static bool UseMemory = false;
|
||||
extern RoomData *Rooms;
|
||||
extern InventoryData *Inventory;
|
||||
extern uint16 NumInv, ManyRooms, HighestCondition, Direction;
|
||||
extern LargeSet Conditions, RoomsFound;
|
||||
|
||||
|
||||
|
||||
static uint16 allocroom;
|
||||
|
||||
@ -474,40 +471,4 @@ bool readViews(uint16 RoomNum, const char *Path) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Reads the initial conditions and sets the LargeSet accordingly. */
|
||||
/*****************************************************************************/
|
||||
bool readInitialConditions(LargeSet conditions, const char *fileName) {
|
||||
byte **file;
|
||||
uint16 many, set;
|
||||
char temp[5];
|
||||
|
||||
if ((file = g_music->newOpen(fileName)) != NULL) {
|
||||
readBlock(temp, 4L, file);
|
||||
temp[4] = '\0';
|
||||
|
||||
if (strcmp(temp, "CON0") != 0)
|
||||
return false;
|
||||
|
||||
readBlock(&many, 2L, file);
|
||||
#if !defined(DOSCODE)
|
||||
swapUShortPtr(&many, 1);
|
||||
#endif
|
||||
|
||||
for (int counter = 0; counter < many; counter++) {
|
||||
readBlock(&set, 2L, file);
|
||||
#if !defined(DOSCODE)
|
||||
swapUShortPtr(&set, 1);
|
||||
#endif
|
||||
inclElement(conditions, set);
|
||||
}
|
||||
} else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Lab
|
||||
|
@ -195,20 +195,13 @@ static void changeCombination(LargeSet Conditions, uint16 number) {
|
||||
bltBitMap(Images[combnum], 0, (Images[combnum])->Height - (2 * counter), &(display), VGAScaleX(combx[number]), VGAScaleY(65), (Images[combnum])->Width, 2);
|
||||
}
|
||||
|
||||
/*
|
||||
if (memcmp(combination, solution, (size_t) 12) == 0)
|
||||
inclElement(Conditions, COMBINATIONUNLOCKED);
|
||||
else
|
||||
exclElement(Conditions, COMBINATIONUNLOCKED);
|
||||
*/
|
||||
|
||||
for (counter = 0; counter < 6; counter++)
|
||||
unlocked = (combination[counter] == solution[counter]) && unlocked;
|
||||
|
||||
if (unlocked)
|
||||
inclElement(Conditions, COMBINATIONUNLOCKED);
|
||||
g_engine->_conditions->inclElement(COMBINATIONUNLOCKED);
|
||||
else
|
||||
exclElement(Conditions, COMBINATIONUNLOCKED);
|
||||
g_engine->_conditions->exclElement(COMBINATIONUNLOCKED);
|
||||
|
||||
#if !defined(DOSCODE)
|
||||
ungetVGABaseAddr();
|
||||
@ -486,7 +479,7 @@ static void changeTile(LargeSet Conditions, uint16 col, uint16 row) {
|
||||
}
|
||||
|
||||
if (check) {
|
||||
inclElement(Conditions, BRICKOPEN); /* unlocked combination */
|
||||
g_engine->_conditions->inclElement(BRICKOPEN); /* unlocked combination */
|
||||
DoBlack = true;
|
||||
check = readPict("p:Up/BDOpen", true);
|
||||
}
|
||||
@ -665,10 +658,10 @@ static bool loadJournalData(LargeSet Conditions) {
|
||||
g_music->checkMusic();
|
||||
|
||||
strcpy(filename, "Lab:Rooms/j0");
|
||||
bridge = In(Conditions, BRIDGE0) || In(Conditions, BRIDGE1);
|
||||
dirty = In(Conditions, DIRTY);
|
||||
news = !In(Conditions, NONEWS);
|
||||
clean = !In(Conditions, NOCLEAN);
|
||||
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);
|
||||
|
||||
if (bridge && clean && news)
|
||||
filename[11] = '8';
|
||||
@ -981,9 +974,6 @@ struct Image *Arrow1, *NoArrow1, *DriveButton;
|
||||
|
||||
extern InventoryData *Inventory;
|
||||
extern uint16 RoomNum, Direction;
|
||||
extern LargeSet Conditions, RoomsFound;
|
||||
|
||||
|
||||
|
||||
extern char *SAVETEXT, *LOADTEXT, *BOOKMARKTEXT, *PERSONALTEXT, *DISKTEXT, *SAVEBOOK, *RESTOREBOOK, *SAVEFLASH, *RESTOREFLASH, *SAVEDISK, *RESTOREDISK, *SELECTDISK, *NODISKINDRIVE, *WRITEPROTECTED, *FORMATFLOPPY, *FORMATTING;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user