From 366b65486f84840be52b5a6f04be64f3a51f57d9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 22 Sep 2007 10:10:01 +0000 Subject: [PATCH] Code simplification. Removed IDI_MSA_MAX_STR and fRmTxt - oRmTxt is used instead, as the two arrays contained non-null values for the same rooms. Also, room object indices are no longer read from the original executable svn-id: r29016 --- engines/agi/preagi_mickey.cpp | 22 ++++++++++++++-------- engines/agi/preagi_mickey.h | 5 ++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index c4d89069825..4a6386944b9 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -949,7 +949,7 @@ void Mickey::printRoomDesc() { waitAnyKeyAnim(); // print extended room description - if (game.fRmTxt[game.iRoom]) { + if (game.oRmTxt[game.iRoom]) { printExeMsg(game.oRmTxt[game.iRoom] + IDI_MSA_OFS_EXE); } } @@ -1340,13 +1340,13 @@ void Mickey::intro() { void Mickey::getItem(ENUM_MSA_ITEM iItem) { game.fItem[iItem] = true; game.iItem[game.nItems++] = iItem; - game.fRmTxt[game.iRoom] = 0; + game.oRmTxt[game.iRoom] = 0; playSound(IDI_MSA_SND_TAKE); drawRoom(); } void Mickey::getXtal(int iStr) { - game.fRmTxt[game.iRoom] = 0; + game.oRmTxt[game.iRoom] = 0; game.fHasXtal = true; game.nXtals++; playSound(IDI_MSA_SND_CRYSTAL); @@ -2149,8 +2149,8 @@ void Mickey::initVars() { memset(&game, 0, sizeof(game)); memset(&game.iItem, IDI_MSA_OBJECT_NONE, sizeof(game.iItem)); // read room extended desc flags - readExe(IDO_MSA_ROOM_TEXT, buffer, sizeof(buffer)); - memcpy(game.fRmTxt, buffer, sizeof(game.fRmTxt)); + //readExe(IDO_MSA_ROOM_TEXT, buffer, sizeof(buffer)); + //memcpy(game.fRmTxt, buffer, sizeof(game.fRmTxt)); // read room extended desc offsets readExe(IDO_MSA_ROOM_TEXT_OFFSETS, buffer, sizeof(buffer)); @@ -2159,8 +2159,8 @@ void Mickey::initVars() { game.oRmTxt[i] = buffer[i*2] + 256 * buffer[i*2+1]; // read room object indices - readExe(IDO_MSA_ROOM_OBJECT, buffer, sizeof(buffer)); - memcpy(game.iRmObj, buffer, sizeof(game.iRmObj)); + //readExe(IDO_MSA_ROOM_OBJECT, buffer, sizeof(buffer)); + //memcpy(game.iRmObj, buffer, sizeof(game.iRmObj)); // read room picture indices //readExe(IDO_MSA_ROOM_PICTURE, buffer, sizeof(buffer)); @@ -2170,11 +2170,17 @@ void Mickey::initVars() { readExe(IDO_MSA_ROOM_MENU_FIX, buffer, sizeof(buffer)); memcpy(game.nRmMenu, buffer, sizeof(game.nRmMenu)); - // set room picture indices + // set room picture and room object indices for (int i = 0; i < IDI_MSA_MAX_ROOM; i++) { game.iRmPic[i] = i; + game.iRmObj[i] = -1; } game.iRmPic[IDI_MSA_PIC_SHIP_AIRLOCK] = IDI_MSA_PIC_SHIP_AIRLOCK_0; + game.iRmObj[23] = 11; + game.iRmObj[110] = 21; + game.iRmObj[112] = 20; + game.iRmObj[119] = 19; + game.iRmObj[154] = 1; #if 0 // DEBUG diff --git a/engines/agi/preagi_mickey.h b/engines/agi/preagi_mickey.h index fe0b6479151..078035eb326 100644 --- a/engines/agi/preagi_mickey.h +++ b/engines/agi/preagi_mickey.h @@ -75,7 +75,6 @@ const char IDS_MSA_INSERT_DISK[][40] = { #define IDI_MSA_MAX_PIC_ROOM 224 #define IDI_MSA_MAX_SOUND 8 #define IDI_MSA_MAX_ROOM 160 -#define IDI_MSA_MAX_STR 160 #define IDI_MSA_MAX_BUTTON 6 #define IDI_MSA_MAX_ITEM 11 @@ -466,7 +465,7 @@ struct MSA_DAT_HEADER { uint16 filelen; uint16 ofsRoom[IDI_MSA_MAX_ROOM]; uint16 ofsDesc[IDI_MSA_MAX_ROOM]; - uint16 ofsStr[IDI_MSA_MAX_STR]; + uint16 ofsStr[IDI_MSA_MAX_ROOM]; }; struct MSA_SND_NOTE { @@ -716,7 +715,7 @@ struct MSA_GAME { int iItem[IDI_MSA_MAX_ITEM]; int nItems; - int8 fRmTxt[IDI_MSA_MAX_ROOM]; + //int8 fRmTxt[IDI_MSA_MAX_ROOM]; int8 iRmObj[IDI_MSA_MAX_ROOM]; uint8 iRmPic[IDI_MSA_MAX_ROOM]; uint16 oRmTxt[IDI_MSA_MAX_ROOM];