LAB: Renames and moved vars to classes

This commit is contained in:
Eugene Sandulenko 2015-12-03 11:01:50 +01:00 committed by Willem Jan Palenstijn
parent 5c246e4189
commit 646c29d5a3
9 changed files with 132 additions and 136 deletions

View file

@ -40,10 +40,6 @@
namespace Lab { namespace Lab {
bool LongWinInFront = false;
TextFont *MsgFont;
extern bool stopsound, DoNotDrawMessage; extern bool stopsound, DoNotDrawMessage;
/* Global parser data */ /* Global parser data */
@ -468,7 +464,7 @@ void LabEngine::interfaceOn() {
_event->mouseShow(); _event->mouseShow();
} }
if (LongWinInFront) if (_longWinInFront)
_event->attachGadgetList(NULL); _event->attachGadgetList(NULL);
else if (_alternate) else if (_alternate)
_event->attachGadgetList(_invGadgetList); _event->attachGadgetList(_invGadgetList);
@ -608,7 +604,7 @@ void LabEngine::mainGameLoop() {
_conditions->readInitialConditions("LAB:Conditio"); _conditions->readInitialConditions("LAB:Conditio");
LongWinInFront = false; _longWinInFront = false;
drawPanel(); drawPanel();
perFlipGadget(actionMode); perFlipGadget(actionMode);
@ -758,7 +754,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm
_anim->_doBlack = false; _anim->_doBlack = false;
if ((msgClass == RAWKEY) && (!LongWinInFront)) { if ((msgClass == RAWKEY) && (!_longWinInFront)) {
if (code == 13) { /* The return key */ if (code == 13) { /* The return key */
msgClass = MOUSEBUTTONS; msgClass = MOUSEBUTTONS;
Qualifier = IEQUALIFIER_LEFTBUTTON; Qualifier = IEQUALIFIER_LEFTBUTTON;
@ -846,12 +842,12 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm
eatMessages(); eatMessages();
} }
if (LongWinInFront) { if (_longWinInFront) {
if ((msgClass == RAWKEY) || if ((msgClass == RAWKEY) ||
((msgClass == MOUSEBUTTONS) && ((msgClass == MOUSEBUTTONS) &&
((IEQUALIFIER_LEFTBUTTON & Qualifier) || ((IEQUALIFIER_LEFTBUTTON & Qualifier) ||
(IEQUALIFIER_RBUTTON & Qualifier)))) { (IEQUALIFIER_RBUTTON & Qualifier)))) {
LongWinInFront = false; _longWinInFront = false;
DoNotDrawMessage = false; DoNotDrawMessage = false;
drawPanel(); drawPanel();
drawRoomMessage(curInv, CPtr); drawRoomMessage(curInv, CPtr);
@ -1274,7 +1270,7 @@ void LabEngine::go() {
if (!doIntro) if (!doIntro)
_music->initMusic(); _music->initMusic();
MsgFont = _resource->getFont("P:AvanteG.12"); _msgFont = _resource->getFont("P:AvanteG.12");
_event->mouseHide(); _event->mouseHide();
@ -1311,7 +1307,7 @@ void LabEngine::go() {
} }
} }
closeFont(MsgFont); closeFont(_msgFont);
freeRoomBuffer(); freeRoomBuffer();
freeBuffer(); freeBuffer();

View file

@ -42,8 +42,6 @@ namespace Lab {
BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1;
extern bool stopsound; extern bool stopsound;
extern TextFont *MsgFont;
/*****************************************************************************/ /*****************************************************************************/
/* Scales the x co-ordinates to that of the new display. In the room parser */ /* Scales the x co-ordinates to that of the new display. In the room parser */
@ -194,8 +192,6 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) {
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
bool DoNotDrawMessage = false; bool DoNotDrawMessage = false;
extern bool LongWinInFront, Alternate;
/*----- The flowText routines -----*/ /*----- The flowText routines -----*/
/******************************************************************************/ /******************************************************************************/
@ -266,7 +262,7 @@ uint32 flowText(void *font, /* the TextAttr pointer */
bool output, /* Whether to output any text */ bool output, /* Whether to output any text */
uint16 x1, /* Cords */ uint16 x1, /* Cords */
uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */ uint16 y1, uint16 x2, uint16 y2, const char *str) { /* The text itself */
TextFont *msgfont = (TextFont *)font; TextFont *_msgFont = (TextFont *)font;
char linebuffer[256]; char linebuffer[256];
const char *temp; const char *temp;
uint16 numlines, actlines, fontheight, width; uint16 numlines, actlines, fontheight, width;
@ -282,7 +278,7 @@ uint32 flowText(void *font, /* the TextAttr pointer */
g_lab->setAPen(pencolor); g_lab->setAPen(pencolor);
fontheight = textHeight(msgfont) + spacing; fontheight = textHeight(_msgFont) + spacing;
numlines = (y2 - y1 + 1) / fontheight; numlines = (y2 - y1 + 1) / fontheight;
width = x2 - x1 + 1; width = x2 - x1 + 1;
y = y1; y = y1;
@ -292,7 +288,7 @@ uint32 flowText(void *font, /* the TextAttr pointer */
actlines = 0; actlines = 0;
while (temp[0]) { while (temp[0]) {
getLine(msgfont, linebuffer, &temp, width); getLine(_msgFont, linebuffer, &temp, width);
actlines++; actlines++;
} }
@ -303,15 +299,15 @@ uint32 flowText(void *font, /* the TextAttr pointer */
temp = str; temp = str;
while (numlines && str[0]) { while (numlines && str[0]) {
getLine(msgfont, linebuffer, &str, width); getLine(_msgFont, linebuffer, &str, width);
x = x1; x = x1;
if (centerh) if (centerh)
x += (width - textLength(msgfont, linebuffer, strlen(linebuffer))) / 2; x += (width - textLength(_msgFont, linebuffer, strlen(linebuffer))) / 2;
if (output) if (output)
text(msgfont, x, y, pencolor, linebuffer, strlen(linebuffer)); text(_msgFont, x, y, pencolor, linebuffer, strlen(linebuffer));
numlines--; numlines--;
y += fontheight; y += fontheight;
@ -370,8 +366,8 @@ int32 LabEngine::longDrawMessage(const char *str) {
_event->mouseHide(); _event->mouseHide();
strcpy(newText, str); strcpy(newText, str);
if (!LongWinInFront) { if (!_longWinInFront) {
LongWinInFront = true; _longWinInFront = true;
setAPen(3); /* Clear Area */ setAPen(3); /* Clear Area */
rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199)); rectFill(0, VGAScaleY(149) + SVGACord(2), VGAScaleX(319), VGAScaleY(199));
} }
@ -379,7 +375,7 @@ int32 LabEngine::longDrawMessage(const char *str) {
createBox(198); createBox(198);
_event->mouseShow(); _event->mouseShow();
return flowText(MsgFont, 0, 1, 7, false, true, true, true, VGAScaleX(6), VGAScaleY(155), VGAScaleX(313), VGAScaleY(195), str); return flowText(_msgFont, 0, 1, 7, false, true, true, true, VGAScaleX(6), VGAScaleY(155), VGAScaleX(313), VGAScaleY(195), str);
} }
void LabEngine::drawStaticMessage(byte index) { void LabEngine::drawStaticMessage(byte index) {
@ -396,18 +392,18 @@ void LabEngine::drawMessage(const char *str) {
} }
if (str) { if (str) {
if ((textLength(MsgFont, str, strlen(str)) > VGAScaleX(306))) { if ((textLength(_msgFont, str, strlen(str)) > VGAScaleX(306))) {
longDrawMessage(str); longDrawMessage(str);
_lastMessageLong = true; _lastMessageLong = true;
} else { } else {
if (LongWinInFront) { if (_longWinInFront) {
LongWinInFront = false; _longWinInFront = false;
drawPanel(); drawPanel();
} }
_event->mouseHide(); _event->mouseHide();
createBox(168); createBox(168);
text(MsgFont, VGAScaleX(7), VGAScaleY(155) + SVGACord(2), 1, str, strlen(str)); text(_msgFont, VGAScaleX(7), VGAScaleY(155) + SVGACord(2), 1, str, strlen(str));
_event->mouseShow(); _event->mouseShow();
_lastMessageLong = false; _lastMessageLong = false;
} }

View file

@ -109,6 +109,9 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)
_curFileName = " "; _curFileName = " ";
_longWinInFront = false;
_msgFont = 0;
//const Common::FSNode gameDataDir(ConfMan.get("path")); //const Common::FSNode gameDataDir(ConfMan.get("path"));
//SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game");
//SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict");

View file

@ -130,6 +130,10 @@ private:
int _lastWaitTOFTicks; int _lastWaitTOFTicks;
bool _lastMessageLong; bool _lastMessageLong;
bool _lastTooLong; bool _lastTooLong;
TextFont *_msgFont;
public:
bool _longWinInFront;
private: private:
bool createScreen(bool HiRes); bool createScreen(bool HiRes);
@ -161,8 +165,8 @@ public:
void doScrollBlack(); void doScrollBlack();
void doScrollWipe(char *filename); void doScrollWipe(char *filename);
void doScrollBounce(); void doScrollBounce();
void doWipe(uint16 WipeType, CloseDataPtr *CPtr, char *filename); void doWipe(uint16 WipeType, CloseDataPtr *cPtr, char *filename);
void doTransWipe(CloseDataPtr *CPtr, char *filename); void doTransWipe(CloseDataPtr *cPtr, char *filename);
Gadget *checkNumGadgetHit(Gadget *gadlist, uint16 key); Gadget *checkNumGadgetHit(Gadget *gadlist, uint16 key);
IntuiMessage *getMsg(); IntuiMessage *getMsg();
void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein); void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, bool fadein);
@ -176,7 +180,7 @@ public:
void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2);
void eatMessages(); void eatMessages();
void drawStaticMessage(byte index); void drawStaticMessage(byte index);
void drawDirection(CloseDataPtr LCPtr); void drawDirection(CloseDataPtr lcPtr);
int followCrumbs(); int followCrumbs();
void changeVolume(int delta); void changeVolume(int delta);

View file

@ -81,8 +81,6 @@ static MapData *Maps;
extern char *LOWERFLOORS, *MIDDLEFLOORS, *UPPERFLOORS, *MEDMAZEFLOORS, *HEDGEMAZEFLOORS, *SURMAZEFLOORS, *CARNIVALFLOOR, *SURMAZEMSG; extern char *LOWERFLOORS, *MIDDLEFLOORS, *UPPERFLOORS, *MEDMAZEFLOORS, *HEDGEMAZEFLOORS, *SURMAZEFLOORS, *CARNIVALFLOOR, *SURMAZEMSG;
extern TextFont *MsgFont;
uint16 *FadePalette; uint16 *FadePalette;
static uint16 MapGadX[3] = {101, 55, 8}, MapGadY[3] = {105, 105, 105}; static uint16 MapGadX[3] = {101, 55, 8}, MapGadY[3] = {105, 105, 105};
@ -550,7 +548,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou
HugeMaze->drawImage(mapScaleX(524), mapScaleY(97)); HugeMaze->drawImage(mapScaleX(524), mapScaleY(97));
} else if (Floor == SURMAZEFLOOR) { } else if (Floor == SURMAZEFLOOR) {
sptr = (char *)_resource->getStaticText(kTextSurmazeMessage).c_str(); sptr = (char *)_resource->getStaticText(kTextSurmazeMessage).c_str();
flowText(MsgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr); flowText(_msgFont, 0, 7, 0, true, true, true, true, mapScaleX(360), 0, mapScaleX(660), mapScaleY(450), sptr);
} }
switch (Floor) { switch (Floor) {
@ -581,10 +579,10 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou
} }
if (sptr) if (sptr)
flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(75), VGAScaleX(134), VGAScaleY(97), sptr); flowText(_msgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(75), VGAScaleX(134), VGAScaleY(97), sptr);
if ((sptr = _rooms[CurMsg]._roomMsg)) if ((sptr = _rooms[CurMsg]._roomMsg))
flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); flowText(_msgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr);
if (fadein) if (fadein)
fade(true, 0); fade(true, 0);
@ -739,7 +737,7 @@ void LabEngine::processMap(uint16 CurRoom) {
_event->mouseHide(); _event->mouseHide();
setAPen(3); setAPen(3);
rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186)); rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186));
flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr); flowText(_msgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr);
if (Maps[OldMsg].PageNumber == CurFloor) if (Maps[OldMsg].PageNumber == CurFloor)
drawRoom(OldMsg, (bool)(OldMsg == CurRoom)); drawRoom(OldMsg, (bool)(OldMsg == CurRoom));

View file

@ -49,16 +49,16 @@ void freeRoomBuffer();
/* From ProcessRoom.c */ /* From ProcessRoom.c */
ViewData *getViewData(uint16 RoomNum, uint16 Direction); ViewData *getViewData(uint16 RoomNum, uint16 Direction);
char *getPictName(CloseDataPtr *LCPtr); char *getPictName(CloseDataPtr *lcptr);
void drawDirection(CloseDataPtr LCPtr); void drawDirection(CloseDataPtr lcptr);
bool processArrow(uint16 *Direction, uint16 Arrow); bool processArrow(uint16 *Direction, uint16 Arrow);
void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords = false); void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords = false);
bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr); bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr);
bool doActionRule(Common::Point pos, int16 action, int16 RoomNum, CloseDataPtr *LCPtr); bool doActionRule(Common::Point pos, int16 action, int16 RoomNum, CloseDataPtr *lcptr);
bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr); bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *lcptr);
bool doGoForward(CloseDataPtr *LCPtr); bool doGoForward(CloseDataPtr *lcptr);
bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr); bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr);
bool doMainView(CloseDataPtr *LCPtr); bool doMainView(CloseDataPtr *lcptr);
} // End of namespace Lab } // End of namespace Lab

View file

@ -48,7 +48,7 @@ RoomData *_rooms;
InventoryData *Inventory; InventoryData *Inventory;
uint16 NumInv, ManyRooms, HighestCondition, Direction; uint16 NumInv, ManyRooms, HighestCondition, Direction;
extern bool DoNotDrawMessage, noupdatediff, QuitLab, MusicOn, LongWinInFront; extern bool DoNotDrawMessage, noupdatediff, QuitLab, MusicOn;
extern CloseDataPtr CPtr; extern CloseDataPtr CPtr;
/*****************************************************************************/ /*****************************************************************************/
@ -116,24 +116,24 @@ ViewData *getViewData(uint16 roomNum, uint16 direction) {
/*****************************************************************************/ /*****************************************************************************/
/* Gets an object, if any, from the user's click on the screen. */ /* Gets an object, if any, from the user's click on the screen. */
/*****************************************************************************/ /*****************************************************************************/
static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr LCPtr) { static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr lcptr) {
ViewData *VPtr; ViewData *VPtr;
if (LCPtr == NULL) { if (lcptr == NULL) {
VPtr = getViewData(g_lab->_roomNum, Direction); VPtr = getViewData(g_lab->_roomNum, Direction);
LCPtr = VPtr->closeUps; lcptr = VPtr->closeUps;
} }
else else
LCPtr = LCPtr->SubCloseUps; lcptr = lcptr->SubCloseUps;
while (LCPtr != NULL) { while (lcptr != NULL) {
if ((x >= scaleX(LCPtr->x1)) && (y >= scaleY(LCPtr->y1)) && if ((x >= scaleX(lcptr->x1)) && (y >= scaleY(lcptr->y1)) &&
(x <= scaleX(LCPtr->x2)) && (y <= scaleY(LCPtr->y2))) (x <= scaleX(lcptr->x2)) && (y <= scaleY(lcptr->y2)))
return LCPtr; return lcptr;
LCPtr = LCPtr->NextCloseUp; lcptr = lcptr->NextCloseUp;
} }
return NULL; return NULL;
@ -168,14 +168,14 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr Main, CloseDataPtr List) {
/*****************************************************************************/ /*****************************************************************************/
/* Returns the current picture name. */ /* Returns the current picture name. */
/*****************************************************************************/ /*****************************************************************************/
char *getPictName(CloseDataPtr *LCPtr) { char *getPictName(CloseDataPtr *lcptr) {
ViewData *ViewPtr = getViewData(g_lab->_roomNum, Direction); ViewData *ViewPtr = getViewData(g_lab->_roomNum, Direction);
if (*LCPtr != NULL) { if (*lcptr != NULL) {
*LCPtr = findCPtrMatch(*LCPtr, ViewPtr->closeUps); *lcptr = findCPtrMatch(*lcptr, ViewPtr->closeUps);
if (*LCPtr) if (*lcptr)
return (*LCPtr)->GraphicName; return (*lcptr)->GraphicName;
} }
return ViewPtr->GraphicName; return ViewPtr->GraphicName;
@ -184,9 +184,9 @@ char *getPictName(CloseDataPtr *LCPtr) {
/*****************************************************************************/ /*****************************************************************************/
/* Draws the current direction to the screen. */ /* Draws the current direction to the screen. */
/*****************************************************************************/ /*****************************************************************************/
void LabEngine::drawDirection(CloseDataPtr LCPtr) { void LabEngine::drawDirection(CloseDataPtr lcptr) {
if (LCPtr != NULL && LCPtr->Message) { if (lcptr != NULL && lcptr->Message) {
drawMessage(LCPtr->Message); drawMessage(lcptr->Message);
return; return;
} }
@ -257,34 +257,34 @@ bool processArrow(uint16 *direction, uint16 Arrow) {
/*****************************************************************************/ /*****************************************************************************/
void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) { void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) {
ViewData *VPtr; ViewData *VPtr;
CloseDataPtr LCPtr; CloseDataPtr lcptr;
uint16 x1, y1, x2, y2; uint16 x1, y1, x2, y2;
if (*cptr == NULL) { if (*cptr == NULL) {
VPtr = getViewData(g_lab->_roomNum, Direction); VPtr = getViewData(g_lab->_roomNum, Direction);
LCPtr = VPtr->closeUps; lcptr = VPtr->closeUps;
} else } else
LCPtr = (*cptr)->SubCloseUps; lcptr = (*cptr)->SubCloseUps;
while (LCPtr != NULL) { while (lcptr != NULL) {
if (!useAbsoluteCoords) { if (!useAbsoluteCoords) {
x1 = LCPtr->x1; x1 = lcptr->x1;
y1 = LCPtr->y1; y1 = lcptr->y1;
x2 = LCPtr->x2; x2 = lcptr->x2;
y2 = LCPtr->y2; y2 = lcptr->y2;
} else { } else {
x1 = scaleX(LCPtr->x1); x1 = scaleX(lcptr->x1);
y1 = scaleY(LCPtr->y1); y1 = scaleY(lcptr->y1);
x2 = scaleX(LCPtr->x2); x2 = scaleX(lcptr->x2);
y2 = scaleY(LCPtr->y2); y2 = scaleY(lcptr->y2);
} }
if (pos.x >= x1 && pos.y >= y1 && pos.x <= x2 && pos.y <= y2 && LCPtr->GraphicName) { if (pos.x >= x1 && pos.y >= y1 && pos.x <= x2 && pos.y <= y2 && lcptr->GraphicName) {
*cptr = LCPtr; *cptr = lcptr;
return; return;
} }
LCPtr = LCPtr->NextCloseUp; lcptr = lcptr->NextCloseUp;
} }
} }
@ -293,27 +293,27 @@ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords)
/*****************************************************************************/ /*****************************************************************************/
bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) {
ViewData *VPtr; ViewData *VPtr;
CloseDataPtr LCPtr; CloseDataPtr lcptr;
if (*cptr == NULL) { if (*cptr == NULL) {
VPtr = getViewData(g_lab->_roomNum, Direction); VPtr = getViewData(g_lab->_roomNum, Direction);
LCPtr = VPtr->closeUps; lcptr = VPtr->closeUps;
} else if ((*cptr)->CloseUpType < 0) { } else if ((*cptr)->CloseUpType < 0) {
g_lab->_conditions->inclElement(abs((*cptr)->CloseUpType)); g_lab->_conditions->inclElement(abs((*cptr)->CloseUpType));
return true; return true;
} else } else
LCPtr = (*cptr)->SubCloseUps; lcptr = (*cptr)->SubCloseUps;
while (LCPtr != NULL) { while (lcptr != NULL) {
if ((x >= scaleX(LCPtr->x1)) && (y >= scaleY(LCPtr->y1)) && if ((x >= scaleX(lcptr->x1)) && (y >= scaleY(lcptr->y1)) &&
(x <= scaleX(LCPtr->x2)) && (y <= scaleY(LCPtr->y2)) && (x <= scaleX(lcptr->x2)) && (y <= scaleY(lcptr->y2)) &&
(LCPtr->CloseUpType < 0)) { (lcptr->CloseUpType < 0)) {
g_lab->_conditions->inclElement(abs(LCPtr->CloseUpType)); g_lab->_conditions->inclElement(abs(lcptr->CloseUpType));
return true; return true;
} }
LCPtr = LCPtr->NextCloseUp; lcptr = lcptr->NextCloseUp;
} }
return false; return false;
@ -322,8 +322,8 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) {
/*****************************************************************************/ /*****************************************************************************/
/* Processes the action list. */ /* Processes the action list. */
/*****************************************************************************/ /*****************************************************************************/
static void doActions(Action *APtr, CloseDataPtr *LCPtr) { static void doActions(Action *APtr, CloseDataPtr *lcptr) {
CloseDataPtr TLCPtr; CloseDataPtr tlcptr;
bool FirstLoaded = true; bool FirstLoaded = true;
char **str, *Test; char **str, *Test;
uint32 StartSecs, StartMicros, CurSecs, CurMicros; uint32 StartSecs, StartMicros, CurSecs, CurMicros;
@ -371,7 +371,7 @@ static void doActions(Action *APtr, CloseDataPtr *LCPtr) {
break; break;
case WIPECMD: case WIPECMD:
g_lab->doWipe(APtr->Param1, LCPtr, (char *)APtr->Data); g_lab->doWipe(APtr->Param1, lcptr, (char *)APtr->Data);
break; break;
case NOUPDATE: case NOUPDATE:
@ -384,7 +384,7 @@ static void doActions(Action *APtr, CloseDataPtr *LCPtr) {
break; break;
case SHOWCURPICT: case SHOWCURPICT:
Test = getPictName(LCPtr); Test = getPictName(lcptr);
if (strcmp(Test, g_lab->_curFileName) != 0) { if (strcmp(Test, g_lab->_curFileName) != 0) {
g_lab->_curFileName = Test; g_lab->_curFileName = Test;
@ -404,7 +404,7 @@ static void doActions(Action *APtr, CloseDataPtr *LCPtr) {
case SHOWMESSAGE: case SHOWMESSAGE:
DoNotDrawMessage = false; DoNotDrawMessage = false;
if (LongWinInFront) if (g_lab->_longWinInFront)
g_lab->longDrawMessage((char *)APtr->Data); g_lab->longDrawMessage((char *)APtr->Data);
else else
g_lab->drawMessage((char *)APtr->Data); g_lab->drawMessage((char *)APtr->Data);
@ -413,7 +413,7 @@ static void doActions(Action *APtr, CloseDataPtr *LCPtr) {
break; break;
case CSHOWMESSAGE: case CSHOWMESSAGE:
if (*LCPtr == NULL) { if (*lcptr == NULL) {
DoNotDrawMessage = false; DoNotDrawMessage = false;
g_lab->drawMessage((char *)APtr->Data); g_lab->drawMessage((char *)APtr->Data);
DoNotDrawMessage = true; DoNotDrawMessage = true;
@ -432,7 +432,7 @@ static void doActions(Action *APtr, CloseDataPtr *LCPtr) {
if (APtr->Param1 & 0x8000) { if (APtr->Param1 & 0x8000) {
// This is a Wyrmkeep Windows trial version, thus stop at this // This is a Wyrmkeep Windows trial version, thus stop at this
// point, since we can't check for game payment status // point, since we can't check for game payment status
readPict(getPictName(LCPtr), true); readPict(getPictName(lcptr), true);
APtr = NULL; APtr = NULL;
GUI::MessageDialog trialMessage("This is the end of the trial version. You can play the full game using the original interpreter from Wyrmkeep"); GUI::MessageDialog trialMessage("This is the end of the trial version. You can play the full game using the original interpreter from Wyrmkeep");
trialMessage.runModal(); trialMessage.runModal();
@ -441,20 +441,20 @@ static void doActions(Action *APtr, CloseDataPtr *LCPtr) {
g_lab->_roomNum = APtr->Param1; g_lab->_roomNum = APtr->Param1;
Direction = APtr->Param2 - 1; Direction = APtr->Param2 - 1;
*LCPtr = NULL; *lcptr = NULL;
g_lab->_anim->_doBlack = true; g_lab->_anim->_doBlack = true;
break; break;
case SETCLOSEUP: case SETCLOSEUP:
TLCPtr = getObject(scaleX(APtr->Param1), scaleY(APtr->Param2), *LCPtr); tlcptr = getObject(scaleX(APtr->Param1), scaleY(APtr->Param2), *lcptr);
if (TLCPtr) if (tlcptr)
*LCPtr = TLCPtr; *lcptr = tlcptr;
break; break;
case MAINVIEW: case MAINVIEW:
*LCPtr = NULL; *lcptr = NULL;
break; break;
case SUBINV: case SUBINV:
@ -603,10 +603,10 @@ static void doActions(Action *APtr, CloseDataPtr *LCPtr) {
/*****************************************************************************/ /*****************************************************************************/
/* Does the work for doActionRule. */ /* Does the work for doActionRule. */
/*****************************************************************************/ /*****************************************************************************/
static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, CloseDataPtr *Set, bool AllowDefaults) { static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr lcptr, CloseDataPtr *Set, bool AllowDefaults) {
action++; action++;
if (LCPtr) { if (lcptr) {
RuleList *rules = _rooms[g_lab->_roomNum]._rules; RuleList *rules = _rooms[g_lab->_roomNum]._rules;
if ((rules == NULL) && (roomNum == 0)) { if ((rules == NULL) && (roomNum == 0)) {
@ -617,10 +617,10 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
if (((*rule)->RuleType == ACTION) && if (((*rule)->RuleType == ACTION) &&
(((*rule)->Param1 == action) || (((*rule)->Param1 == 0) && AllowDefaults))) { (((*rule)->Param1 == action) || (((*rule)->Param1 == 0) && AllowDefaults))) {
if ((((*rule)->Param2 == LCPtr->CloseUpType) || if ((((*rule)->Param2 == lcptr->CloseUpType) ||
(((*rule)->Param2 == 0) && AllowDefaults)) (((*rule)->Param2 == 0) && AllowDefaults))
|| ||
((action == 1) && ((*rule)->Param2 == (-LCPtr->CloseUpType)))) { ((action == 1) && ((*rule)->Param2 == (-lcptr->CloseUpType)))) {
if (checkConditions((*rule)->Condition)) { if (checkConditions((*rule)->Condition)) {
doActions((*rule)->ActionList, Set); doActions((*rule)->ActionList, Set);
return true; return true;
@ -636,23 +636,23 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo
/*****************************************************************************/ /*****************************************************************************/
/* Goes through the rules if an action is taken. */ /* Goes through the rules if an action is taken. */
/*****************************************************************************/ /*****************************************************************************/
bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *LCPtr) { bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *lcptr) {
CloseDataPtr TLCPtr; CloseDataPtr tlcptr;
if (roomNum) if (roomNum)
g_lab->_newFileName = NOFILE; g_lab->_newFileName = NOFILE;
else else
g_lab->_newFileName = g_lab->_curFileName; g_lab->_newFileName = g_lab->_curFileName;
TLCPtr = getObject(pos.x, pos.y, *LCPtr); tlcptr = getObject(pos.x, pos.y, *lcptr);
if (doActionRuleSub(action, roomNum, TLCPtr, LCPtr, false)) if (doActionRuleSub(action, roomNum, tlcptr, lcptr, false))
return true; return true;
else if (doActionRuleSub(action, roomNum, *LCPtr, LCPtr, false)) else if (doActionRuleSub(action, roomNum, *lcptr, lcptr, false))
return true; return true;
else if (doActionRuleSub(action, roomNum, TLCPtr, LCPtr, true)) else if (doActionRuleSub(action, roomNum, tlcptr, lcptr, true))
return true; return true;
else if (doActionRuleSub(action, roomNum, *LCPtr, LCPtr, true)) else if (doActionRuleSub(action, roomNum, *lcptr, lcptr, true))
return true; return true;
return false; return false;
@ -661,9 +661,9 @@ bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *
/*****************************************************************************/ /*****************************************************************************/
/* Does the work for doActionRule. */ /* Does the work for doActionRule. */
/*****************************************************************************/ /*****************************************************************************/
static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, CloseDataPtr *Set, bool AllowDefaults) { static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr lcptr, CloseDataPtr *Set, bool AllowDefaults) {
if (LCPtr) if (lcptr)
if (LCPtr->CloseUpType > 0) { if (lcptr->CloseUpType > 0) {
RuleList *rules = _rooms[roomNum]._rules; RuleList *rules = _rooms[roomNum]._rules;
if ((rules == NULL) && (roomNum == 0)) { if ((rules == NULL) && (roomNum == 0)) {
@ -674,7 +674,7 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, C
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
if (((*rule)->RuleType == OPERATE) && if (((*rule)->RuleType == OPERATE) &&
(((*rule)->Param1 == ItemNum) || (((*rule)->Param1 == 0) && AllowDefaults)) && (((*rule)->Param1 == ItemNum) || (((*rule)->Param1 == 0) && AllowDefaults)) &&
(((*rule)->Param2 == LCPtr->CloseUpType) || (((*rule)->Param2 == 0) && AllowDefaults))) { (((*rule)->Param2 == lcptr->CloseUpType) || (((*rule)->Param2 == 0) && AllowDefaults))) {
if (checkConditions((*rule)->Condition)) { if (checkConditions((*rule)->Condition)) {
doActions((*rule)->ActionList, Set); doActions((*rule)->ActionList, Set);
return true; return true;
@ -689,31 +689,31 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, C
/*****************************************************************************/ /*****************************************************************************/
/* Goes thru the rules if the user tries to operate an item on an object. */ /* Goes thru the rules if the user tries to operate an item on an object. */
/*****************************************************************************/ /*****************************************************************************/
bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *lcptr) {
CloseDataPtr TLCPtr; CloseDataPtr tlcptr;
g_lab->_newFileName = NOFILE; g_lab->_newFileName = NOFILE;
TLCPtr = getObject(x, y, *LCPtr); tlcptr = getObject(x, y, *lcptr);
if (doOperateRuleSub(ItemNum, g_lab->_roomNum, TLCPtr, LCPtr, false)) if (doOperateRuleSub(ItemNum, g_lab->_roomNum, tlcptr, lcptr, false))
return true; return true;
else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *LCPtr, LCPtr, false)) else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *lcptr, lcptr, false))
return true; return true;
else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, TLCPtr, LCPtr, true)) else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, tlcptr, lcptr, true))
return true; return true;
else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *LCPtr, LCPtr, true)) else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *lcptr, lcptr, true))
return true; return true;
else { else {
g_lab->_newFileName = g_lab->_curFileName; g_lab->_newFileName = g_lab->_curFileName;
if (doOperateRuleSub(ItemNum, 0, TLCPtr, LCPtr, false)) if (doOperateRuleSub(ItemNum, 0, tlcptr, lcptr, false))
return true; return true;
else if (doOperateRuleSub(ItemNum, 0, *LCPtr, LCPtr, false)) else if (doOperateRuleSub(ItemNum, 0, *lcptr, lcptr, false))
return true; return true;
else if (doOperateRuleSub(ItemNum, 0, TLCPtr, LCPtr, true)) else if (doOperateRuleSub(ItemNum, 0, tlcptr, lcptr, true))
return true; return true;
else if (doOperateRuleSub(ItemNum, 0, *LCPtr, LCPtr, true)) else if (doOperateRuleSub(ItemNum, 0, *lcptr, lcptr, true))
return true; return true;
} }
@ -723,13 +723,13 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) {
/*****************************************************************************/ /*****************************************************************************/
/* Goes thru the rules if the user tries to go forward. */ /* Goes thru the rules if the user tries to go forward. */
/*****************************************************************************/ /*****************************************************************************/
bool doGoForward(CloseDataPtr *LCPtr) { bool doGoForward(CloseDataPtr *lcptr) {
RuleList *rules = _rooms[g_lab->_roomNum]._rules; RuleList *rules = _rooms[g_lab->_roomNum]._rules;
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) { if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) {
if (checkConditions((*rule)->Condition)) { if (checkConditions((*rule)->Condition)) {
doActions((*rule)->ActionList, LCPtr); doActions((*rule)->ActionList, lcptr);
return true; return true;
} }
} }
@ -741,7 +741,7 @@ bool doGoForward(CloseDataPtr *LCPtr) {
/*****************************************************************************/ /*****************************************************************************/
/* Goes thru the rules if the user tries to turn. */ /* Goes thru the rules if the user tries to turn. */
/*****************************************************************************/ /*****************************************************************************/
bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { bool doTurn(uint16 from, uint16 to, CloseDataPtr *lcptr) {
from++; from++;
to++; to++;
@ -752,7 +752,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) {
(((*rule)->RuleType == TURNFROMTO) && (((*rule)->RuleType == TURNFROMTO) &&
((*rule)->Param1 == from) && ((*rule)->Param2 == to))) { ((*rule)->Param1 == from) && ((*rule)->Param2 == to))) {
if (checkConditions((*rule)->Condition)) { if (checkConditions((*rule)->Condition)) {
doActions((*rule)->ActionList, LCPtr); doActions((*rule)->ActionList, lcptr);
return true; return true;
} }
} }
@ -764,12 +764,12 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) {
/*****************************************************************************/ /*****************************************************************************/
/* Goes thru the rules if the user tries to go to the main view */ /* Goes thru the rules if the user tries to go to the main view */
/*****************************************************************************/ /*****************************************************************************/
bool doMainView(CloseDataPtr *LCPtr) { bool doMainView(CloseDataPtr *lcptr) {
RuleList *rules = _rooms[g_lab->_roomNum]._rules; RuleList *rules = _rooms[g_lab->_roomNum]._rules;
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
if ((*rule)->RuleType == GOMAINVIEW) { if ((*rule)->RuleType == GOMAINVIEW) {
if (checkConditions((*rule)->Condition)) { if (checkConditions((*rule)->Condition)) {
doActions((*rule)->ActionList, LCPtr); doActions((*rule)->ActionList, lcptr);
return true; return true;
} }
} }

View file

@ -53,7 +53,7 @@ namespace Lab {
/* Lab: Labyrinth specific */ /* Lab: Labyrinth specific */
extern byte combination[6]; extern byte combination[6];
extern uint16 CurTile[4] [4]; extern uint16 CurTile[4] [4];
extern char *getPictName(CloseDataPtr *LCPtr); extern char *getPictName(CloseDataPtr *lcptr);
void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveName) { void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveName) {
out->writeUint32BE(SAVEGAME_ID); out->writeUint32BE(SAVEGAME_ID);
@ -137,8 +137,8 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc)
return false; return false;
// Load scene pic // Load scene pic
CloseDataPtr CPtr = NULL; CloseDataPtr cPtr = NULL;
readPict(getPictName(&CPtr), true); readPict(getPictName(&cPtr), true);
writeSaveGameHeader(file, desc); writeSaveGameHeader(file, desc);
file->writeUint16LE(g_lab->_roomNum); file->writeUint16LE(g_lab->_roomNum);

View file

@ -81,7 +81,6 @@ uint16 CurTile[4][4] = {
{ 10, 13, 12, 0 } { 10, 13, 12, 0 }
}; };
extern TextFont *MsgFont;
extern uint16 *FadePalette; extern uint16 *FadePalette;
extern BitMap *DispBitMap, *DrawBitMap; extern BitMap *DispBitMap, *DrawBitMap;
extern CloseDataPtr CPtr; extern CloseDataPtr CPtr;