diff options
-rw-r--r-- | engines/agi/preagi_mickey.cpp | 10 | ||||
-rw-r--r-- | engines/agi/preagi_winnie.cpp | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index e61637194c..58a73f20c3 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -210,8 +210,6 @@ void Mickey::printDatString(int iStr) { } void Mickey::printDesc(int iRoom) { - char *buffer = (char *)malloc(256); - MSA_DAT_HEADER hdr; char szFile[256] = {0}; @@ -223,6 +221,7 @@ void Mickey::printDesc(int iRoom) { if (!infile.open(szFile)) return; + char *buffer = (char *)malloc(256); memset(buffer, 0, 256); infile.seek(hdr.ofsDesc[iRoom - 1] + IDI_MSA_OFS_DAT, SEEK_SET); @@ -234,7 +233,6 @@ void Mickey::printDesc(int iRoom) { } bool Mickey::checkMenu() { - char *buffer = new char[sizeof(MSA_MENU)]; MSA_MENU menu; int iSel0, iSel1; MSA_DAT_HEADER hdr; @@ -245,6 +243,8 @@ bool Mickey::checkMenu() { readDatHdr(szFile, &hdr); if (!infile.open(szFile)) return false; + + char *buffer = new char[sizeof(MSA_MENU)]; infile.seek(hdr.ofsRoom[_game.iRoom - 1] + IDI_MSA_OFS_DAT, SEEK_SET); infile.read((uint8 *)buffer, sizeof(MSA_MENU)); infile.close(); @@ -725,7 +725,6 @@ void Mickey::playSound(ENUM_MSA_SOUND iSound) { // Graphics void Mickey::drawObj(ENUM_MSA_OBJECT iObj, int x0, int y0) { - uint8* buffer = new uint8[4096]; char szFile[255] = {0}; sprintf(szFile, IDS_MSA_PATH_OBJ, IDS_MSA_NAME_OBJ[iObj]); @@ -733,6 +732,7 @@ void Mickey::drawObj(ENUM_MSA_OBJECT iObj, int x0, int y0) { if (!file.open(szFile)) return; + uint8* buffer = new uint8[4096]; uint32 size = file.size(); file.read(buffer, size); file.close(); @@ -747,7 +747,6 @@ void Mickey::drawObj(ENUM_MSA_OBJECT iObj, int x0, int y0) { } void Mickey::drawPic(int iPic) { - uint8* buffer = new uint8[4096]; char szFile[255] = {0}; sprintf(szFile, IDS_MSA_PATH_PIC, iPic); @@ -755,6 +754,7 @@ void Mickey::drawPic(int iPic) { if (!file.open(szFile)) return; + uint8* buffer = new uint8[4096]; uint32 size = file.size(); file.read(buffer, size); file.close(); diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index 85cf2d29ef..2004fc227f 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -1053,7 +1053,6 @@ phase2: void Winnie::drawPic(const char *szName) { char szFile[256] = {0}; Common::File file; - uint8 *buffer = (uint8 *)malloc(4096); // construct filename if (_vm->getPlatform() != Common::kPlatformAmiga) @@ -1065,6 +1064,7 @@ void Winnie::drawPic(const char *szName) { return; } + uint8 *buffer = (uint8 *)malloc(4096); uint32 size = file.size(); file.read(buffer, size); file.close(); |