aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2006-10-21 00:51:32 +0000
committerTravis Howell2006-10-21 00:51:32 +0000
commit4e859bb26ea6b75f954f3b5b155eea74104dbfa1 (patch)
tree1e32b11070ca1edb867410bc46a517441fb4f340 /engines
parent5e9041b1b558f8891435204b15e1db41f0686ad9 (diff)
downloadscummvm-rg350-4e859bb26ea6b75f954f3b5b155eea74104dbfa1.tar.gz
scummvm-rg350-4e859bb26ea6b75f954f3b5b155eea74104dbfa1.tar.bz2
scummvm-rg350-4e859bb26ea6b75f954f3b5b155eea74104dbfa1.zip
Cleanup
svn-id: r24396
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/agos.h5
-rw-r--r--engines/agos/icons.cpp8
-rw-r--r--engines/agos/menus.cpp8
-rw-r--r--engines/agos/script.cpp2
-rw-r--r--engines/agos/script_pp.cpp2
-rw-r--r--engines/agos/vga.cpp197
6 files changed, 84 insertions, 138 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 1f7688c76d..36c1b26ee5 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -767,11 +767,12 @@ protected:
void showmessage_helper_3(uint a, uint b);
void showmessage_print_char(byte chr);
- void set_video_mode_internal(uint16 mode, uint16 vga_res_id);
-
void loadZone(uint zoneNum);
void animate(uint windowNum, uint zoneNum, uint vgaSpriteId, uint x, uint y, uint palette, bool setZone = true);
+ void setImage(uint16 vga_res_id, bool setZone);
+ void setWindowImage(uint16 mode, uint16 vga_res_id);
+
void playSpeech(uint speech_id, uint vga_sprite_id);
void skipSpeech();
diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp
index 225e1956db..cbccc4495a 100644
--- a/engines/agos/icons.cpp
+++ b/engines/agos/icons.cpp
@@ -568,7 +568,7 @@ void AGOSEngine::defineArrowBoxes(WindowBlock *window) {
ha->priority = 100;
ha->window = window;
ha->verb = 1;
- set_video_mode_internal(6, 103);
+ setWindowImage(6, 103);
} else if (getGameType() == GType_ELVIRA2) {
ha->x = 54;
ha->y = 178;
@@ -579,7 +579,7 @@ void AGOSEngine::defineArrowBoxes(WindowBlock *window) {
ha->priority = 100;
ha->window = window;
ha->verb = 1;
- set_video_mode_internal(6, 106);
+ setWindowImage(6, 106);
} else {
ha->x = 30 * 8;
ha->y = 170;
@@ -705,10 +705,10 @@ void AGOSEngine::removeArrows(WindowBlock *window, uint num) {
stopAnimateSimon1(128);
} else if (getGameType() == GType_WW) {
setBitFlag(22, false);
- set_video_mode_internal(6, 103);
+ setWindowImage(6, 103);
} else if (getGameType() == GType_ELVIRA2) {
setBitFlag(21, false);
- set_video_mode_internal(6, 106);
+ setWindowImage(6, 106);
}
}
diff --git a/engines/agos/menus.cpp b/engines/agos/menus.cpp
index 37bae53478..9168bb6021 100644
--- a/engines/agos/menus.cpp
+++ b/engines/agos/menus.cpp
@@ -161,9 +161,9 @@ void AGOSEngine::clearMenuStrip() {
disableBox(i);
if (getGameType() == GType_WW) {
- set_video_mode_internal(2, 101);
+ setWindowImage(2, 101);
} else {
- set_video_mode_internal(2, 102);
+ setWindowImage(2, 102);
}
}
@@ -205,9 +205,9 @@ void AGOSEngine::doMenuStrip(uint menuNum) {
_variableArray[var + 4] = id - 111;
if (getGameType() == GType_WW) {
- set_video_mode_internal(2, 102);
+ setWindowImage(2, 102);
} else {
- set_video_mode_internal(2, 103);
+ setWindowImage(2, 103);
}
}
diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp
index 5ebdadfdbe..09581ca4bd 100644
--- a/engines/agos/script.cpp
+++ b/engines/agos/script.cpp
@@ -668,7 +668,7 @@ void AGOSEngine::o_picture() {
if (_lockWord & 0x10)
error("o_picture: _lockWord & 0x10");
- set_video_mode_internal(mode, vga_res);
+ setWindowImage(mode, vga_res);
}
void AGOSEngine::o_loadZone() {
diff --git a/engines/agos/script_pp.cpp b/engines/agos/script_pp.cpp
index 698cbdfd51..e5b8e068f7 100644
--- a/engines/agos/script_pp.cpp
+++ b/engines/agos/script_pp.cpp
@@ -104,7 +104,7 @@ void AGOSEngine::o4_restoreOopsPosition() {
_variableArray[i] = _variableArray2[i];
}
i = _variableArray[999] * 100 + 11;
- set_video_mode_internal(4,i);
+ setWindowImage(4,i);
if (getBitFlag(110)) {
_gameTime += 10;
} else {
diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp
index c612e6c1ce..c27a28cd5e 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.cpp
@@ -408,11 +408,8 @@ void AGOSEngine::vc1_fadeOut() {
}
void AGOSEngine::vc2_call() {
- VgaPointersEntry *vpe;
- uint16 count, num, res;
+ uint16 num;
byte *old_file_1, *old_file_2;
- byte *b, *bb;
- const byte *vcPtrOrg;
if (getGameType() == GType_ELVIRA2) {
num = vcReadNextWord();
@@ -423,86 +420,10 @@ void AGOSEngine::vc2_call() {
old_file_1 = _curVgaFile1;
old_file_2 = _curVgaFile2;
- for (;;) {
- res = num / 100;
- vpe = &_vgaBufferPointers[res];
-
- _curVgaFile1 = vpe->vgaFile1;
- _curVgaFile2 = vpe->vgaFile2;
- if (vpe->vgaFile1 != NULL)
- break;
- if (_zoneNumber != res)
- _noOverWrite = _zoneNumber;
-
- loadZone(res);
- _noOverWrite = 0xFFFF;
- }
-
-
- bb = _curVgaFile1;
- if (getGameType() == GType_FF || getGameType() == GType_PP) {
- b = bb + READ_LE_UINT16(bb + 2);
- count = READ_LE_UINT16(&((VgaFileHeader2_Feeble *) b)->imageCount);
- b = bb + READ_LE_UINT16(&((VgaFileHeader2_Feeble *) b)->imageTable);
-
- while (count--) {
- if (READ_LE_UINT16(&((ImageHeader_Feeble *) b)->id) == num)
- break;
- b += sizeof(ImageHeader_Feeble);
- }
- assert(READ_LE_UINT16(&((ImageHeader_Feeble *) b)->id) == num);
- } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
- 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)
- break;
- b += sizeof(ImageHeader_Simon);
- }
- assert(READ_BE_UINT16(&((ImageHeader_Simon *) b)->id) == num);
- } else {
- b = bb + READ_BE_UINT16(bb + 10);
- b += 20;
-
- 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)
- break;
- b += sizeof(ImageHeader_WW);
- }
- assert(READ_BE_UINT16(&((ImageHeader_WW *) b)->id) == num);
- }
-
- if (_startVgaScript) {
- if (getGameType() == GType_FF || getGameType() == GType_PP) {
- dump_vga_script(_curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble*)b)->scriptOffs), res, num);
- } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
- dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon*)b)->scriptOffs), res, num);
- } else {
- dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_WW*)b)->scriptOffs), res, num);
- }
- }
-
- vcPtrOrg = _vcPtr;
-
- if (getGameType() == GType_FF || getGameType() == GType_PP) {
- _vcPtr = _curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble *) b)->scriptOffs);
- } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
- _vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon *) b)->scriptOffs);
- } else {
- _vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_WW *) b)->scriptOffs);
- }
-
- runVgaScript();
+ setImage(num, false);
_curVgaFile1 = old_file_1;
_curVgaFile2 = old_file_2;
-
- _vcPtr = vcPtrOrg;
}
void AGOSEngine::vc3_loadSprite() {
@@ -1226,10 +1147,10 @@ void AGOSEngine::vc36_setWindowImage() {
if (windowNum == 16) {
_copyPartialMode = 2;
} else {
- set_video_mode_internal(windowNum, vga_res);
+ setWindowImage(windowNum, vga_res);
}
} else {
- set_video_mode_internal(windowNum, vga_res);
+ setWindowImage(windowNum, vga_res);
}
}
@@ -1874,42 +1795,38 @@ void AGOSEngine::animate(uint windowNum, uint zoneNum, uint vgaSpriteId, uint x,
}
}
-void AGOSEngine::set_video_mode_internal(uint16 mode, uint16 vga_res_id) {
- uint num, num_lines;
+void AGOSEngine::setImage(uint16 vga_res_id, bool setZone) {
+ uint zoneNum;
VgaPointersEntry *vpe;
byte *bb, *b;
- uint16 count, updateWindow;
+ uint16 count;
const byte *vc_ptr_org;
- _windowNum = updateWindow = mode;
- _lockWord |= 0x20;
-
- if (getGameType() == GType_FF || getGameType() == GType_PP) {
- vc27_resetSprite();
- }
-
- if (vga_res_id == 0) {
- if (getGameType() == GType_SIMON1) {
- _unkPalFlag = true;
- } else if (getGameType() == GType_SIMON2) {
- _useBackGround = true;
- _restoreWindow6 = true;
- }
- }
-
- _zoneNumber = num = vga_res_id / 100;
+ zoneNum = vga_res_id / 100;
for (;;) {
- vpe = &_vgaBufferPointers[num];
-
+ vpe = &_vgaBufferPointers[zoneNum];
_curVgaFile1 = vpe->vgaFile1;
_curVgaFile2 = vpe->vgaFile2;
- _curSfxFile = vpe->sfxFile;
- if (vpe->vgaFile1 != NULL)
- break;
+ if (setZone) {
+ _curSfxFile = vpe->sfxFile;
+ _zoneNumber = zoneNum;
+
+ if (vpe->vgaFile1 != NULL)
+ break;
+
+ loadZone(zoneNum);
+ } else {
+
+ if (vpe->vgaFile1 != NULL)
+ break;
+ if (_zoneNumber != zoneNum)
+ _noOverWrite = _zoneNumber;
- loadZone(num);
+ loadZone(zoneNum);
+ _noOverWrite = 0xFFFF;
+ }
}
bb = _curVgaFile1;
@@ -1955,11 +1872,45 @@ void AGOSEngine::set_video_mode_internal(uint16 mode, uint16 vga_res_id) {
if (_startVgaScript) {
if (getGameType() == GType_FF || getGameType() == GType_PP) {
- dump_vga_script(_curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble*)b)->scriptOffs), num, vga_res_id);
+ dump_vga_script(_curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble*)b)->scriptOffs), zoneNum, vga_res_id);
} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
- dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon*)b)->scriptOffs), num, vga_res_id);
+ dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon*)b)->scriptOffs), zoneNum, vga_res_id);
} else {
- dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_WW*)b)->scriptOffs), num, vga_res_id);
+ dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_WW*)b)->scriptOffs), zoneNum, vga_res_id);
+ }
+ }
+
+ vc_ptr_org = _vcPtr;
+
+ if (getGameType() == GType_FF || getGameType() == GType_PP) {
+ _vcPtr = _curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble *) b)->scriptOffs);
+ } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
+ _vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon *) b)->scriptOffs);
+ } else {
+ _vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_WW *) b)->scriptOffs);
+ }
+
+ runVgaScript();
+ _vcPtr = vc_ptr_org;
+}
+
+void AGOSEngine::setWindowImage(uint16 mode, uint16 vga_res_id) {
+ uint num_lines;
+ uint16 updateWindow;
+
+ _windowNum = updateWindow = mode;
+ _lockWord |= 0x20;
+
+ if (getGameType() == GType_FF || getGameType() == GType_PP) {
+ vc27_resetSprite();
+ }
+
+ if (vga_res_id == 0) {
+ if (getGameType() == GType_SIMON1) {
+ _unkPalFlag = true;
+ } else if (getGameType() == GType_SIMON2) {
+ _useBackGround = true;
+ _restoreWindow6 = true;
}
}
@@ -1984,18 +1935,7 @@ void AGOSEngine::set_video_mode_internal(uint16 mode, uint16 vga_res_id) {
}
}
- vc_ptr_org = _vcPtr;
-
- if (getGameType() == GType_FF || getGameType() == GType_PP) {
- _vcPtr = _curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble *) b)->scriptOffs);
- } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
- _vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon *) b)->scriptOffs);
- } else {
- _vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_WW *) b)->scriptOffs);
- }
-
- runVgaScript();
- _vcPtr = vc_ptr_org;
+ setImage(vga_res_id, true);
if (getGameType() == GType_FF || getGameType() == GType_PP) {
fillFrontFromBack(0, 0, _screenWidth, _screenHeight);
@@ -2010,7 +1950,7 @@ void AGOSEngine::set_video_mode_internal(uint16 mode, uint16 vga_res_id) {
_syncFlag2 = 1;
}
_useBackGround = false;
- } else {
+ } else if (getGameType() == GType_SIMON1) {
// Allow one section of Simon the Sorcerer 1 introduction to be displayed
// in lower half of screen
if (_subroutine == 2923 || _subroutine == 2926)
@@ -2020,7 +1960,12 @@ void AGOSEngine::set_video_mode_internal(uint16 mode, uint16 vga_res_id) {
fillFrontFromBack(0, 0, _screenWidth, num_lines);
fillBackGroundFromBack(num_lines);
-
+ _syncFlag2 = 1;
+ _timer5 = 0;
+ } else {
+ num_lines = _windowNum == 4 ? 134 : 200;
+ fillFrontFromBack(0, 0, _screenWidth, num_lines);
+ fillBackGroundFromBack(num_lines);
_syncFlag2 = 1;
_timer5 = 0;
}