From 22a14014b3fee7bdd4220f6b21d065f3a10763bb Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sat, 7 Oct 2006 03:43:51 +0000 Subject: Minor cleanup svn-id: r24159 --- engines/agos/agos.cpp | 24 ++++++++++++------------ engines/agos/debug.cpp | 12 ++++++------ engines/agos/vga.cpp | 24 ++++++++++++------------ engines/agos/vga.h | 50 +++++++++++++------------------------------------- 4 files changed, 43 insertions(+), 67 deletions(-) diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index eb049d5592..68ed28354b 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -1668,7 +1668,7 @@ void AGOSEngine::set_video_mode_internal(uint16 mode, uint16 vga_res_id) { bb = _curVgaFile1; if (getGameType() == GType_FF || getGameType() == GType_PP) { - b = bb + READ_LE_UINT16(&((VgaFileHeader_Feeble *) bb)->hdr2_start); + b = bb + READ_LE_UINT16(bb + 2); count = READ_LE_UINT16(&((VgaFileHeader2_Feeble *) b)->imageCount); b = bb + READ_LE_UINT16(&((VgaFileHeader2_Feeble *) b)->imageTable); @@ -1680,9 +1680,9 @@ void AGOSEngine::set_video_mode_internal(uint16 mode, uint16 vga_res_id) { assert(READ_LE_UINT16(&((ImageHeader_Feeble *) b)->id) == vga_res_id); } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { - b = bb + READ_BE_UINT16(&((VgaFileHeader_Simon *) bb)->hdr2_start); - count = READ_BE_UINT16(&((VgaFileHeader2_Simon *) b)->imageCount); - b = bb + READ_BE_UINT16(&((VgaFileHeader2_Simon *) b)->imageTable); + b = bb + READ_BE_UINT16(bb + 4); + count = READ_BE_UINT16(&((VgaFileHeader2_Common *) b)->imageCount); + b = bb + READ_BE_UINT16(&((VgaFileHeader2_Common *) b)->imageTable); while (count--) { if (READ_BE_UINT16(&((ImageHeader_Simon *) b)->id) == vga_res_id) @@ -1694,8 +1694,8 @@ void AGOSEngine::set_video_mode_internal(uint16 mode, uint16 vga_res_id) { b = bb + READ_BE_UINT16(bb + 10); b += 20; - count = READ_BE_UINT16(&((VgaFileHeader2_WW *) b)->imageCount); - b = bb + READ_BE_UINT16(&((VgaFileHeader2_WW *) b)->imageTable); + count = READ_BE_UINT16(&((VgaFileHeader2_Common *) b)->imageCount); + b = bb + READ_BE_UINT16(&((VgaFileHeader2_Common *) b)->imageTable); while (count--) { if (READ_BE_UINT16(&((ImageHeader_WW *) b)->id) == vga_res_id) @@ -2157,19 +2157,19 @@ void AGOSEngine::loadSprite(uint windowNum, uint zoneNum, uint vgaSpriteId, uint pp = _curVgaFile1; if (getGameType() == GType_FF || getGameType() == GType_PP) { - p = pp + READ_LE_UINT16(&((VgaFileHeader_Feeble *) pp)->hdr2_start); + p = pp + READ_LE_UINT16(pp + 2); count = READ_LE_UINT16(&((VgaFileHeader2_Feeble *) p)->animationCount); p = pp + READ_LE_UINT16(&((VgaFileHeader2_Feeble *) p)->animationTable); } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { - p = pp + READ_BE_UINT16(&((VgaFileHeader_Simon *) pp)->hdr2_start); - count = READ_BE_UINT16(&((VgaFileHeader2_Simon *) p)->animationCount); - p = pp + READ_BE_UINT16(&((VgaFileHeader2_Simon *) p)->animationTable); + p = pp + READ_BE_UINT16(pp + 4); + count = READ_BE_UINT16(&((VgaFileHeader2_Common *) p)->animationCount); + p = pp + READ_BE_UINT16(&((VgaFileHeader2_Common *) p)->animationTable); } else { p = pp + READ_BE_UINT16(pp + 10); p += 20; - count = READ_BE_UINT16(&((VgaFileHeader2_WW *) p)->animationCount); - p = pp + READ_BE_UINT16(&((VgaFileHeader2_WW *) p)->animationTable); + count = READ_BE_UINT16(&((VgaFileHeader2_Common *) p)->animationCount); + p = pp + READ_BE_UINT16(&((VgaFileHeader2_Common *) p)->animationTable); } for (;;) { diff --git a/engines/agos/debug.cpp b/engines/agos/debug.cpp index 8a59f13481..64ffc5c83a 100644 --- a/engines/agos/debug.cpp +++ b/engines/agos/debug.cpp @@ -276,9 +276,9 @@ void AGOSEngine::dump_vga_file(const byte *vga) { int count; pp = vga; - p = pp + READ_BE_UINT16(&((const VgaFileHeader_Simon *) pp)->hdr2_start); - count = READ_BE_UINT16(&((const VgaFileHeader2_Simon *) p)->animationCount); - p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Simon *) p)->animationTable); + p = pp + READ_BE_UINT16(pp + 4); + count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationCount); + p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationTable); while (--count >= 0) { int id = READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->id); @@ -287,9 +287,9 @@ void AGOSEngine::dump_vga_file(const byte *vga) { } pp = vga; - p = pp + READ_BE_UINT16(&((const VgaFileHeader_Simon *) pp)->hdr2_start); - count = READ_BE_UINT16(&((const VgaFileHeader2_Simon *) p)->imageCount); - p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Simon *) p)->imageTable); + p = pp + READ_BE_UINT16(pp + 4);; + count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageCount); + p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageTable); while (--count >= 0) { int id = READ_BE_UINT16(&((const ImageHeader_Simon *) p)->id); diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp index 436e0b82ad..d6a8637c2b 100644 --- a/engines/agos/vga.cpp +++ b/engines/agos/vga.cpp @@ -444,7 +444,7 @@ void AGOSEngine::vc2_call() { bb = _curVgaFile1; if (getGameType() == GType_FF || getGameType() == GType_PP) { - b = bb + READ_LE_UINT16(&((VgaFileHeader_Feeble *) bb)->hdr2_start); + b = bb + READ_LE_UINT16(bb + 2); count = READ_LE_UINT16(&((VgaFileHeader2_Feeble *) b)->imageCount); b = bb + READ_LE_UINT16(&((VgaFileHeader2_Feeble *) b)->imageTable); @@ -455,9 +455,9 @@ void AGOSEngine::vc2_call() { } assert(READ_LE_UINT16(&((ImageHeader_Feeble *) b)->id) == num); } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { - b = bb + READ_BE_UINT16(&((VgaFileHeader_Simon *) bb)->hdr2_start); - count = READ_BE_UINT16(&((VgaFileHeader2_Simon *) b)->imageCount); - b = bb + READ_BE_UINT16(&((VgaFileHeader2_Simon *) b)->imageTable); + b = bb + READ_BE_UINT16(bb + 4); + count = READ_BE_UINT16(&((VgaFileHeader2_Common *) b)->imageCount); + b = bb + READ_BE_UINT16(&((VgaFileHeader2_Common *) b)->imageTable); while (count--) { if (READ_BE_UINT16(&((ImageHeader_Simon *) b)->id) == num) @@ -469,8 +469,8 @@ void AGOSEngine::vc2_call() { b = bb + READ_BE_UINT16(bb + 10); b += 20; - count = READ_BE_UINT16(&((VgaFileHeader2_WW *) b)->imageCount); - b = bb + READ_BE_UINT16(&((VgaFileHeader2_WW *) b)->imageTable); + count = READ_BE_UINT16(&((VgaFileHeader2_Common *) b)->imageCount); + b = bb + READ_BE_UINT16(&((VgaFileHeader2_Common *) b)->imageTable); while (count--) { if (READ_BE_UINT16(&((ImageHeader_WW *) b)->id) == num) @@ -571,7 +571,7 @@ void AGOSEngine::vc3_loadSprite() { pp = _curVgaFile1; if (getGameType() == GType_FF || getGameType() == GType_PP) { - p = pp + READ_LE_UINT16(&((VgaFileHeader_Feeble *) pp)->hdr2_start); + p = pp + READ_LE_UINT16(pp + 2); count = READ_LE_UINT16(&((VgaFileHeader2_Feeble *) p)->animationCount); p = pp + READ_LE_UINT16(&((VgaFileHeader2_Feeble *) p)->animationTable); @@ -582,9 +582,9 @@ void AGOSEngine::vc3_loadSprite() { } assert(READ_LE_UINT16(&((AnimationHeader_Feeble *) p)->id) == vgaSpriteId); } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { - p = pp + READ_BE_UINT16(&((VgaFileHeader_Simon *) pp)->hdr2_start); - count = READ_BE_UINT16(&((VgaFileHeader2_Simon *) p)->animationCount); - p = pp + READ_BE_UINT16(&((VgaFileHeader2_Simon *) p)->animationTable); + p = pp + READ_BE_UINT16(pp + 4); + count = READ_BE_UINT16(&((VgaFileHeader2_Common *) p)->animationCount); + p = pp + READ_BE_UINT16(&((VgaFileHeader2_Common *) p)->animationTable); while (count--) { if (READ_BE_UINT16(&((AnimationHeader_Simon *) p)->id) == vgaSpriteId) @@ -596,8 +596,8 @@ void AGOSEngine::vc3_loadSprite() { p = pp + READ_BE_UINT16(pp + 10); p += 20; - count = READ_BE_UINT16(&((VgaFileHeader2_WW *) p)->animationCount); - p = pp + READ_BE_UINT16(&((VgaFileHeader2_WW *) p)->animationTable); + count = READ_BE_UINT16(&((VgaFileHeader2_Common *) p)->animationCount); + p = pp + READ_BE_UINT16(&((VgaFileHeader2_Common *) p)->animationTable); while (count--) { if (READ_BE_UINT16(&((AnimationHeader_WW *) p)->id) == vgaSpriteId) diff --git a/engines/agos/vga.h b/engines/agos/vga.h index e9403f12b2..e6d3741707 100644 --- a/engines/agos/vga.h +++ b/engines/agos/vga.h @@ -29,12 +29,6 @@ namespace AGOS { #include "common/pack-start.h" // START STRUCT PACKING // Feeble Files -struct VgaFileHeader_Feeble { - uint16 x_1; - uint16 hdr2_start; - uint16 x_2, x_3; -}; - struct VgaFileHeader2_Feeble { uint16 imageCount; uint16 x_2; @@ -60,24 +54,6 @@ struct AnimationHeader_Feeble { }; // Simon 1/2 -struct VgaFileHeader_Simon { - uint16 x_1, x_2; - uint16 hdr2_start; - uint16 x_3, x_4; -}; - -struct VgaFileHeader2_Simon { - uint16 x_1; - uint16 imageCount; - uint16 x_2; - uint16 animationCount; - uint16 x_3; - uint16 imageTable; - uint16 x_4; - uint16 animationTable; - uint16 x_5; -}; - struct ImageHeader_Simon { uint16 id; uint16 x_1; @@ -92,19 +68,7 @@ struct AnimationHeader_Simon { }; -// Waxworks -struct VgaFileHeader2_WW { - uint16 x_1; - uint16 imageCount; - uint16 x_2; - uint16 animationCount; - uint16 x_3; - uint16 imageTable; - uint16 x_4; - uint16 animationTable; - uint16 x_5; -}; - +// Elvira 1/2 and Waxworks struct ImageHeader_WW { uint16 id; uint16 x_1; @@ -119,6 +83,18 @@ struct AnimationHeader_WW { uint16 scriptOffs; }; +// Common +struct VgaFileHeader2_Common { + uint16 x_1; + uint16 imageCount; + uint16 x_2; + uint16 animationCount; + uint16 x_3; + uint16 imageTable; + uint16 x_4; + uint16 animationTable; + uint16 x_5; +}; #include "common/pack-end.h" // END STRUCT PACKING -- cgit v1.2.3