diff options
author | Eugene Sandulenko | 2014-12-26 00:07:54 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2015-12-15 00:05:02 +0100 |
commit | fefb78457e8828c64aedb0d6aa9e595d342c0416 (patch) | |
tree | 0631ac7259708d3f1d7921fd18d74faae16094c5 | |
parent | 7baabb22c1e787af780a8ec3df87788223b5cd00 (diff) | |
download | scummvm-rg350-fefb78457e8828c64aedb0d6aa9e595d342c0416.tar.gz scummvm-rg350-fefb78457e8828c64aedb0d6aa9e595d342c0416.tar.bz2 scummvm-rg350-fefb78457e8828c64aedb0d6aa9e595d342c0416.zip |
LAB: Cleanup
-rw-r--r-- | engines/lab/parsetypes.h | 46 | ||||
-rw-r--r-- | engines/lab/processroom.cpp | 138 | ||||
-rw-r--r-- | engines/lab/readdiff.cpp | 59 | ||||
-rw-r--r-- | engines/lab/text.cpp | 2 |
4 files changed, 13 insertions, 232 deletions
diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index defe9afddf..5120c413f8 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -105,20 +105,17 @@ typedef struct closeData { an item */ uint16 depth; /* Level of the closeup. */ char *GraphicName, *Message; - struct closeData *NextCloseUp, *SubCloseUps; + closeData *NextCloseUp, *SubCloseUps; } CloseData; typedef CloseData *CloseDataPtr; - - -typedef struct viewData { +struct viewData { int16 *Condition; char *GraphicName; struct viewData *NextCondition; CloseDataPtr closeUps; - -} viewData; +}; typedef viewData *ViewDataPtr; @@ -128,26 +125,22 @@ struct Action { byte *Data; /* Message, or a pointer to array of messages. */ Action *NextAction; - }; typedef Action *ActionPtr; -typedef struct rule { +struct Rule { int16 RuleType, Param1, Param2, *Condition; ActionPtr ActionList; - struct rule *NextRule; - -} Rule; + Rule *NextRule; +}; typedef Rule *RulePtr; - - -typedef struct { +struct RoomData { uint16 NorthDoor, SouthDoor, EastDoor, WestDoor; byte WipeType; @@ -155,26 +148,12 @@ typedef struct { ViewDataPtr NorthView, SouthView, EastView, WestView; RulePtr RuleList; char *RoomMsg; +}; -} RoomData; - - - -typedef struct inventoryData { - /* New inventory stuff */ - /* - int16 *Condition; - char *GraphicName, - * InvName; - struct inventoryData *NextInventory; - CloseDataPtr closeUps; - RulePtr RuleList; - */ - - /* Old inventory stuff */ +struct InventoryData { uint16 Many; char *name, *BInvName; -} InventoryData; +}; @@ -213,11 +192,10 @@ typedef struct inventoryData { -typedef struct { +struct MapData { uint16 x, y, PageNumber, SpecialID; uint32 MapFlags; - -} MapData; +}; #if defined(WIN32) #pragma pack(pop) diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 10d5dfbc2b..5699c63880 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -36,9 +36,7 @@ #include "lab/timing.h" #include "lab/diff.h" #include "lab/vga.h" -#if !defined(DOSCODE) #include "lab/interface.h" -#endif namespace Lab { @@ -46,7 +44,6 @@ namespace Lab { extern int g_IsRegistered; #endif - /* Global parser data */ RoomData *Rooms; @@ -56,27 +53,20 @@ uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction; extern char *FACINGNORTH, *FACINGEAST, *FACINGSOUTH, *FACINGWEST; extern bool LongWinInFront; - #define NOFILE "no file" - - extern const char *CurFileName; const char *ViewPath = "LAB:Rooms/"; - const char *NewFileName; - extern bool DoNotDrawMessage; extern bool NoFlip, IsBM, noupdatediff, waiteffect, mwaiteffect, QuitLab, EffectPlaying, soundplaying, MusicOn, DoBlack, ContMusic, DoNotReset; extern char diffcmap[256 * 3]; extern CloseDataPtr CPtr; - - /*****************************************************************************/ /* Generates a random number. */ /*****************************************************************************/ @@ -87,9 +77,6 @@ uint16 getRandom(uint16 max) { return ((micros + secs) % max); } - - - /*****************************************************************************/ /* Checks whether all the conditions in a condition list are met. */ /*****************************************************************************/ @@ -114,9 +101,6 @@ static bool checkConditions(int16 *Condition) { return res; } - - - /*****************************************************************************/ /* Gets the current ViewDataPointer. */ /*****************************************************************************/ @@ -149,8 +133,6 @@ ViewDataPtr getViewData(uint16 roomNum, uint16 direction) { return ViewPtr; } - - /*****************************************************************************/ /* Gets an object, if any, from the user's click on the screen. */ /*****************************************************************************/ @@ -177,9 +159,6 @@ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr LCPtr) { return NULL; } - - - /*****************************************************************************/ /* Goes through the list of closeups to find a match. */ /* NYI: Known bug here. If there are two objects that have closeups, and */ @@ -206,11 +185,6 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr Main, CloseDataPtr List) { return NULL; } - - - - - /*****************************************************************************/ /* Returns the current picture name. */ /*****************************************************************************/ @@ -229,7 +203,6 @@ char *getPictName(CloseDataPtr *LCPtr) { return ViewPtr->GraphicName; } - /*****************************************************************************/ /* Draws the current direction to the screen. */ /*****************************************************************************/ @@ -272,7 +245,6 @@ void drawDirection(CloseDataPtr LCPtr) { drawMessage(Message); } -#if !defined(DOSCODE) void getRoomMessage(int MyRoomNum, int MyDirection, char *msg) { getViewData(MyRoomNum, MyDirection); @@ -292,11 +264,6 @@ void getRoomMessage(int MyRoomNum, int MyDirection, char *msg) { else if (MyDirection == WEST) strcat(msg, FACINGWEST); } -#endif - - - - /*****************************************************************************/ /* process a arrow gadget movement. */ @@ -341,10 +308,6 @@ bool processArrow(uint16 *direction, uint16 Arrow) { return true; } - - - - /*****************************************************************************/ /* Sets the current close up data, but uses absolute cords. */ /*****************************************************************************/ @@ -371,10 +334,6 @@ void setCurCloseAbs(uint16 x, uint16 y, CloseDataPtr *cptr) { } } - - - - /*****************************************************************************/ /* Sets the current close up data. */ /*****************************************************************************/ @@ -401,8 +360,6 @@ void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr) { } } - - /*****************************************************************************/ /* Takes the currently selected item. */ /*****************************************************************************/ @@ -434,8 +391,6 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { return false; } - - /*****************************************************************************/ /* Processes the action list. */ /*****************************************************************************/ @@ -627,9 +582,7 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { case WAITSECS: addCurTime(APtr->Param1, 0, &StartSecs, &StartMicros); -#if !defined(DOSCODE) WSDL_UpdateScreen(); -#endif while (1) { g_music->newCheckMusic(); @@ -760,10 +713,6 @@ static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) { g_music->_doNotFileFlushAudio = false; } - - - - /*****************************************************************************/ /* Does the work for doActionRule. */ /*****************************************************************************/ @@ -802,9 +751,6 @@ static bool doActionRuleSub(int16 Action, int16 roomNum, CloseDataPtr LCPtr, Clo return false; } - - - /*****************************************************************************/ /* Goes through the rules if an action is taken. */ /*****************************************************************************/ @@ -830,8 +776,6 @@ bool doActionRule(int16 x, int16 y, int16 Action, int16 roomNum, CloseDataPtr *L return false; } - - /*****************************************************************************/ /* Does the work for doActionRule. */ /*****************************************************************************/ @@ -864,9 +808,6 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, C return false; } - - - /*****************************************************************************/ /* Goes thru the rules if the user tries to operate an item on an object. */ /*****************************************************************************/ @@ -885,7 +826,6 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { return true; else if (doOperateRuleSub(ItemNum, RoomNum, *LCPtr, LCPtr, true)) return true; - else { NewFileName = CurFileName; @@ -902,9 +842,6 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) { return false; } - - - /*****************************************************************************/ /* Goes thru the rules if the user tries to go forward. */ /*****************************************************************************/ @@ -927,8 +864,6 @@ bool doGoForward(CloseDataPtr *LCPtr) { return false; } - - /*****************************************************************************/ /* Goes thru the rules if the user tries to turn. */ /*****************************************************************************/ @@ -957,9 +892,6 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) { return false; } - - - /*****************************************************************************/ /* Goes thru the rules if the user tries to go to the main view */ /*****************************************************************************/ @@ -982,74 +914,4 @@ bool doMainView(CloseDataPtr *LCPtr) { return false; } - - - -/*****************************************************************************/ -/* Goes thru the rules whenever (probably after an action or something), and */ -/* sets the conditions. */ -/*****************************************************************************/ -/* - bool doConditions(int16 x, - int16 y, - CloseDataPtr *LCPtr) - { - RulePtr RPtr; - - NewFileName = NOFILE; - - RPtr = Rooms[RoomNum].RuleList; - - while (RPtr) - { - if (RPtr->RuleType == CONDITIONS) - { - if (checkConditions(RPtr->Condition)) - { - doActions(RPtr->ActionList, LCPtr); - return true; - } - } - - RPtr = RPtr->NextRule; - } - return false; - } - */ - -#if defined(DEMODATA) -#include <stdio.h> - -static void WriteDemoData_CloseUps(FILE *fh, CloseDataPtr cd) { - while (cd != NULL) { - if (*cd->GraphicName) - fprintf(fh, "%s\n", cd->GraphicName); - - WriteDemoData_CloseUps(fh, cd->SubCloseUps); - cd = cd->NextCloseUp; - } -} - -static void WriteDemoData_ViewData(FILE *fh, ViewDataPtr vd) { - if (vd == NULL) - return; - - if (*vd->GraphicName != 0) - fprintf(fh, "%s\n", vd->GraphicName); - - WriteDemoData_CloseUps(fh, vd->closeUps); -} - -void writeDemoData() { - FILE *fh = fopen("c:\\depot\\labyrinth\\demodata.log", "a+w"); - - WriteDemoData_ViewData(fh, getViewData(RoomNum, NORTH)); - WriteDemoData_ViewData(fh, getViewData(RoomNum, SOUTH)); - WriteDemoData_ViewData(fh, getViewData(RoomNum, EAST)); - WriteDemoData_ViewData(fh, getViewData(RoomNum, WEST)); - - fclose(fh); -} -#endif - } // End of namespace Lab diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp index 1ceeb44769..2d6c7d8211 100644 --- a/engines/lab/readdiff.cpp +++ b/engines/lab/readdiff.cpp @@ -153,8 +153,6 @@ void diffNextFrame(void) { if (header == 65535) /* Already done. */ return; -#if !defined(DOSCODE) - if (DispBitMap->Flags & BITMAPF_VIDEO) { DispBitMap->Planes[0] = getVGABaseAddr(); DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000; @@ -163,30 +161,12 @@ void diffNextFrame(void) { DispBitMap->Planes[4] = DispBitMap->Planes[3] + 0x10000; } -#endif - mouseHide(); while (1) { - /* NYI: Don't need. - if (ReadIsError) - { - IsPlaying = false; - mouseShow(); - return; - } - */ - if (CurBit >= numchunks) { mouseShow(); -#ifdef undef /* NYI: Don't need. */ - - while (!ReadIsDone && !ReadIsError) /* Wait for the file to load */ - waitTOF(); - -#endif - if (!NoFlip && !IsBM) { if (headerdata.fps) { waitForTime(WaitSec, WaitMicros); @@ -255,9 +235,6 @@ void diffNextFrame(void) { if (IsBM) skip(difffile, size); else { -#if defined(DOSCODE) - setPage(CurBit); -#endif readBlock(DrawBitMap->Planes[CurBit], size, difffile); } @@ -265,9 +242,6 @@ void diffNextFrame(void) { break; case 11L: -#if defined(DOSCODE) - setPage(CurBit); -#endif skip(difffile, 4L); runLengthDecode(DrawBitMap->Planes[CurBit], *difffile); CurBit++; @@ -275,9 +249,6 @@ void diffNextFrame(void) { break; case 12L: -#if defined(DOSCODE) - setPage(CurBit); -#endif skip(difffile, 4L); VRunLengthDecode(DrawBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow); CurBit++; @@ -285,18 +256,12 @@ void diffNextFrame(void) { break; case 20L: -#if defined(DOSCODE) - setPage(CurBit); -#endif unDiff(DrawBitMap->Planes[CurBit], DispBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow, false); CurBit++; skip(difffile, size); break; case 21L: -#if defined(DOSCODE) - setPage(CurBit); -#endif unDiff(DrawBitMap->Planes[CurBit], DispBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow, true); CurBit++; skip(difffile, size); @@ -341,26 +306,20 @@ void diffNextFrame(void) { } case 65535L: if ((framenumber == 1) || PlayOnce || StopPlayingEnd) { -#if !defined(DOSCODE) int didTOF = 0; -#endif if (waiteffect) { while (EffectPlaying) { g_music->updateMusic(); waitTOF(); -#if !defined(DOSCODE) if (DispBitMap->Flags & BITMAPF_VIDEO) didTOF = 1; - -#endif } } IsPlaying = false; mouseShow(); -#if !defined(DOSCODE) if (DispBitMap->Flags & BITMAPF_VIDEO) ungetVGABaseAddr(); @@ -368,7 +327,6 @@ void diffNextFrame(void) { if (!didTOF) WSDL_UpdateScreen(); -#endif return; } @@ -382,12 +340,9 @@ void diffNextFrame(void) { } } -#if !defined(DOSCODE) - if (DispBitMap->Flags & BITMAPF_VIDEO) ungetVGABaseAddr(); -#endif } @@ -453,7 +408,6 @@ void playDiff(void) { #endif if (header == 0) { -#if defined(IS_MACOSX) // sizeof(headerdata) != 18, but the padding might be at the end readBlock(&headerdata.Version, 2, difffile); readBlock(&headerdata.x, 2, difffile); @@ -463,9 +417,7 @@ void playDiff(void) { readBlock(&headerdata.BufferSize, 4, difffile); readBlock(&headerdata.Machine, 2, difffile); readBlock(&headerdata.Flags, 4, difffile); -#else - readBlock(&headerdata, 18, difffile); -#endif + skip(difffile, size - 18); #if !defined(DOSCODE) @@ -480,19 +432,10 @@ void playDiff(void) { diffheight = headerdata.y; DataBytesPerRow = diffwidth; -#if defined(DOSCODE) - numchunks = (((int32) diffwidth) * diffheight) / VGABytesPerPage; - - if ((numchunks * VGABytesPerPage) < (((int32) diffwidth) * diffheight)) - numchunks++; - -#else numchunks = (((int32) diffwidth) * diffheight) / 0x10000; if ((uint32)(numchunks * 0x10000) < (uint32)(((int32) diffwidth) * diffheight)) numchunks++; - -#endif } else { return; } diff --git a/engines/lab/text.cpp b/engines/lab/text.cpp index 5795a08960..92711acf5d 100644 --- a/engines/lab/text.cpp +++ b/engines/lab/text.cpp @@ -284,9 +284,7 @@ void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *tex text++; } -#if !defined(DOSCODE) ungetVGABaseAddr(); -#endif } } // End of namespace Lab |