aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/lab/engine.cpp4
-rw-r--r--engines/lab/readparse.cpp89
2 files changed, 2 insertions, 91 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index c1883a0fda..f7f65e24b1 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -673,8 +673,8 @@ static void mainGameLoop() {
RoomNum = 1;
Direction = NORTH;
- readRoomData("LAB:Doors");
- readInventory("LAB:Inventor");
+ g_resource->readRoomData("LAB:Doors");
+ g_resource->readInventory("LAB:Inventor");
if (!(g_lab->_conditions = new LargeSet(HighestCondition + 1)))
return;
diff --git a/engines/lab/readparse.cpp b/engines/lab/readparse.cpp
index 3d3c270c31..624f7a3b89 100644
--- a/engines/lab/readparse.cpp
+++ b/engines/lab/readparse.cpp
@@ -58,49 +58,6 @@ static bool rallocate(void **Ptr, uint32 Size) {
/*****************************************************************************/
-/* Reads in the RoomData. */
-/*****************************************************************************/
-bool readRoomData(const char *fileName) {
- byte **file;
- uint16 Counter;
- char Temp[5];
-
- if ((file = g_music->newOpen(fileName)) != NULL) {
- readBlock(Temp, 4L, file);
- Temp[4] = '\0';
-
- if (strcmp(Temp, "DOR1") != 0)
- return false;
-
- readBlock(&ManyRooms, 2L, file);
- swapUShortPtr(&ManyRooms, 1);
- readBlock(&HighestCondition, 2L, file);
- swapUShortPtr(&HighestCondition, 1);
-
- if ((Rooms = (RoomData *)calloc(ManyRooms + 1, sizeof(RoomData)))) {
- for (Counter = 1; Counter <= ManyRooms; Counter++) {
- readBlock(&(Rooms[Counter].NorthDoor), 2L, file);
- readBlock(&(Rooms[Counter].SouthDoor), 2L, file);
- readBlock(&(Rooms[Counter].EastDoor), 2L, file);
- readBlock(&(Rooms[Counter].WestDoor), 2L, file);
-
- swapUShortPtr(&(Rooms[Counter].NorthDoor), 1);
- swapUShortPtr(&(Rooms[Counter].SouthDoor), 1);
- swapUShortPtr(&(Rooms[Counter].EastDoor), 1);
- swapUShortPtr(&(Rooms[Counter].WestDoor), 1);
-
- readBlock(&(Rooms[Counter].WipeType), 1L, file);
- }
- } else
- return false;
- } else
- return false;
-
- return true;
-}
-
-
-/*****************************************************************************/
/* Reads in a NULL terminated string, and allocates memory for it. */
/*****************************************************************************/
static bool readString(char **string, byte **file) {
@@ -129,52 +86,6 @@ static bool readString(char **string, byte **file) {
/*****************************************************************************/
-/* Reads in the Inventory data. */
-/*****************************************************************************/
-bool readInventory(const char *fileName) {
- byte **file;
- uint16 Counter;
- char Temp[5];
-
- if ((file = g_music->newOpen(fileName)) != NULL) {
- readBlock(Temp, 4L, file);
- Temp[4] = '\0';
-
- if (strcmp(Temp, "INV1") != 0)
- return false;
-
- readBlock(&NumInv, 2L, file);
- swapUShortPtr(&NumInv, 1);
-
- UseMemory = true;
-
- if (rallocate((void **) &Inventory, (NumInv + 1) * sizeof(InventoryData))) {
- for (Counter = 1; Counter <= NumInv; Counter++) {
- readBlock(&(Inventory[Counter].Many), 2L, file);
- swapUShortPtr(&(Inventory[Counter].Many), 1);
-
- if (!readString(&(Inventory[Counter].name), file)) {
- UseMemory = false;
- return false;
- }
-
- if (!readString(&(Inventory[Counter].BInvName), file)) {
- UseMemory = false;
- return false;
- }
- }
- } else {
- UseMemory = false;
- return false;
- }
- } else
- return false;
-
- UseMemory = false;
- return true;
-}
-
-/*****************************************************************************/
/* Reads in a list of conditions. */
/*****************************************************************************/
static int16 *readConditions(byte **file) {