diff options
author | Filippos Karapetis | 2015-07-21 22:10:30 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2015-12-15 00:05:02 +0100 |
commit | c3bb54989c21faccf77ee151fd0c4b530bc12a97 (patch) | |
tree | 3214e44a5fc4edd137451020dfa483620b7d22a7 /engines/lab | |
parent | 8bf15cbe4bfda68dd38dbb4ed44a269f57f93b5a (diff) | |
download | scummvm-rg350-c3bb54989c21faccf77ee151fd0c4b530bc12a97.tar.gz scummvm-rg350-c3bb54989c21faccf77ee151fd0c4b530bc12a97.tar.bz2 scummvm-rg350-c3bb54989c21faccf77ee151fd0c4b530bc12a97.zip |
LAB: Cleanup
Diffstat (limited to 'engines/lab')
-rw-r--r-- | engines/lab/readparse.cpp | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/engines/lab/readparse.cpp b/engines/lab/readparse.cpp index 672688cac3..3d3c270c31 100644 --- a/engines/lab/readparse.cpp +++ b/engines/lab/readparse.cpp @@ -35,21 +35,17 @@ namespace Lab { +/* Global parser data */ + #define MAXSTRINGLENGTH 250 static bool UseMemory = false; - - - -/* Global parser data */ +static uint16 allocroom; extern RoomData *Rooms; extern InventoryData *Inventory; extern uint16 NumInv, ManyRooms, HighestCondition, Direction; -static uint16 allocroom; - - static bool rallocate(void **Ptr, uint32 Size) { if (UseMemory) return ((*Ptr = calloc(Size, 1)) != 0); @@ -104,8 +100,6 @@ bool readRoomData(const char *fileName) { } - - /*****************************************************************************/ /* Reads in a NULL terminated string, and allocates memory for it. */ /*****************************************************************************/ @@ -134,7 +128,6 @@ static bool readString(char **string, byte **file) { } - /*****************************************************************************/ /* Reads in the Inventory data. */ /*****************************************************************************/ @@ -244,8 +237,6 @@ static bool readCloseUps(CloseDataPtr *CPtr, uint16 depth, byte **file) { } - - /*****************************************************************************/ /* Reads in a View. */ /*****************************************************************************/ @@ -258,7 +249,7 @@ static bool readView(ViewDataPtr *VPtr, byte **file) { readBlock(&c, 1L, file); if (c == 1) { - if (rallocate((void **) VPtr, sizeof(viewData))) { + if (rallocate((void **)VPtr, sizeof(viewData))) { (*VPtr)->closeUps = NULL; (*VPtr)->NextCondition = NULL; @@ -273,16 +264,16 @@ static bool readView(ViewDataPtr *VPtr, byte **file) { readCloseUps(&((*VPtr)->closeUps), 0, file); VPtr = &((*VPtr)->NextCondition); - } else + } + else return false; - } else + } + else return true; } } - - /*****************************************************************************/ /* Reads in an Action. */ /*****************************************************************************/ @@ -321,9 +312,6 @@ static bool readAction(ActionPtr *APtr, byte **file) { } - - - /*****************************************************************************/ /* Reads in a rule. */ /*****************************************************************************/ @@ -355,14 +343,11 @@ static bool readRule(RulePtr *RPtr, byte **file) { } - - - /*****************************************************************************/ /* Reads in the views of a room. */ /*****************************************************************************/ -bool readViews(uint16 RoomNum, const char *Path) { - Common::String fileName = Common::String(Path) + Common::String::format("%d", RoomNum); +bool readViews(uint16 RoomNum) { + Common::String fileName = "LAB:Rooms/" + Common::String::format("%d", RoomNum); char Temp[10]; byte **file; @@ -378,19 +363,14 @@ bool readViews(uint16 RoomNum, const char *Path) { readString(&(Rooms[RoomNum].RoomMsg), file); readView(&Rooms[RoomNum].NorthView, file); - g_music->checkMusic(); - readView(&Rooms[RoomNum].SouthView, file); - g_music->checkMusic(); - readView(&Rooms[RoomNum].EastView, file); - g_music->checkMusic(); - readView(&Rooms[RoomNum].WestView, file); - g_music->checkMusic(); readRule(&Rooms[RoomNum].RuleList, file); + g_music->updateMusic(); + return true; } else return false; |