aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2007-05-17 09:00:14 +0000
committerTravis Howell2007-05-17 09:00:14 +0000
commitd4191508f6a036169498037e00000e026d528632 (patch)
tree9c79fb9cd79217d6b643bbbbf89464101b7a1673
parent565d0d0a7d4b4f87ed402bb1c237afc7f8d85ca7 (diff)
downloadscummvm-rg350-d4191508f6a036169498037e00000e026d528632.tar.gz
scummvm-rg350-d4191508f6a036169498037e00000e026d528632.tar.bz2
scummvm-rg350-d4191508f6a036169498037e00000e026d528632.zip
Cleanup.
svn-id: r26858
-rw-r--r--engines/agos/agos.h13
-rw-r--r--engines/agos/cursor.cpp44
-rw-r--r--engines/agos/event.cpp10
-rw-r--r--engines/agos/input.cpp34
-rw-r--r--engines/agos/verb.cpp24
-rw-r--r--engines/agos/vga_ww.cpp4
-rw-r--r--engines/agos/zones.cpp148
7 files changed, 152 insertions, 125 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 38d7e50d44..0560afbb3b 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -762,7 +762,7 @@ protected:
void displayBoxStars();
void invertBox(HitArea * ha, byte a, byte b, byte c, byte d);
- void handleMouseMoved();
+ virtual void handleMouseMoved();
void initMouse();
virtual void drawMousePointer();
@@ -815,10 +815,10 @@ protected:
void writeChar(WindowBlock *window, int x, int y, int offs, int val);
byte *allocBlock(uint32 size);
- void checkNoOverWrite();
+ virtual void checkNoOverWrite();
void checkRunningAnims();
- void checkAnims(uint a);
- void checkZonePtrs();
+ virtual void checkAnims(uint a);
+ virtual void checkZonePtrs();
void setZoneBuffers();
void runVgaScript();
@@ -1609,6 +1609,10 @@ protected:
void listSaveGames(int n);
void saveUserGame(int slot);
void windowBackSpace(WindowBlock *window);
+
+ virtual void checkNoOverWrite();
+ virtual void checkAnims(uint a);
+ virtual void checkZonePtrs();
};
class AGOSEngine_PuzzlePack : public AGOSEngine_Feeble {
@@ -1646,6 +1650,7 @@ protected:
const OpcodeEntryPuzzlePack *_opcodesPuzzlePack;
+ virtual void handleMouseMoved();
virtual void drawMousePointer();
virtual void resetVerbs();
diff --git a/engines/agos/cursor.cpp b/engines/agos/cursor.cpp
index 47ec6797d3..b6c7a52c24 100644
--- a/engines/agos/cursor.cpp
+++ b/engines/agos/cursor.cpp
@@ -300,7 +300,7 @@ static const byte _mouseOffs[29 * 32] = {
0,0,10,7,10,6,10,5,10,4,10,3,10,4,10,5,10,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
-void AGOSEngine::handleMouseMoved() {
+void AGOSEngine_PuzzlePack::handleMouseMoved() {
uint x;
if (getGameId() != GID_DIMP && _mouseHideCount) {
@@ -311,6 +311,38 @@ void AGOSEngine::handleMouseMoved() {
CursorMan.showMouse(true);
_mouse = _eventMan->getMousePos();
+ x = 0;
+ if (_lastHitArea3 == 0 && _leftButtonDown != 0) {
+ _verbHitArea = 300;
+ _leftButtonDown = 0;
+ x = 1;
+ }
+
+ if (_rightButtonDown != 0) {
+ _verbHitArea = (getGameId() == GID_DIMP) ? 301 : 300;
+ _rightButtonDown = 0;
+ x = 1;
+ }
+
+ boxController(_mouse.x, _mouse.y, x);
+ _lastHitArea3 = _lastHitArea;
+ if (x == 1 && _lastHitArea == NULL)
+ _lastHitArea3 = (HitArea *) -1;
+
+ drawMousePointer();
+}
+
+void AGOSEngine::handleMouseMoved() {
+ uint x;
+
+ if (_mouseHideCount) {
+ CursorMan.showMouse(false);
+ return;
+ }
+
+ CursorMan.showMouse(true);
+ _mouse = _eventMan->getMousePos();
+
if (_defaultVerb) {
uint id = 101;
if (_mouse.y >= 136)
@@ -386,8 +418,6 @@ void AGOSEngine::handleMouseMoved() {
}
}
- // FIXME: The value of _mouseOld is *never* changed and hence
- // always equal to (0,0). This seems like a bug.
if (_mouse != _mouseOld)
_needHitAreaRecalc++;
@@ -416,14 +446,8 @@ void AGOSEngine::handleMouseMoved() {
x = 0;
if (_lastHitArea3 == 0 && _leftButtonDown != 0) {
- if (getGameType() == GType_PP)
- _verbHitArea = 300;
_leftButtonDown = 0;
x = 1;
- } else if (getGameType() == GType_PP && _rightButtonDown != 0) {
- _verbHitArea = 300;
- _rightButtonDown = 0;
- x = 1;
} else {
if (_litBoxFlag == 0 && _needHitAreaRecalc == 0)
goto get_out;
@@ -436,6 +460,8 @@ boxstuff:
_lastHitArea3 = (HitArea *) -1;
get_out:
+
+ _mouseOld = _mouse;
drawMousePointer();
_needHitAreaRecalc = 0;
diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp
index 3297e1182e..0385741187 100644
--- a/engines/agos/event.cpp
+++ b/engines/agos/event.cpp
@@ -490,13 +490,13 @@ void AGOSEngine_Feeble::timer_proc1() {
return;
}
}
- }
- if (getGameType() == GType_FF) {
- _moviePlay->nextFrame();
- }
+ if (getGameType() == GType_FF) {
+ _moviePlay->nextFrame();
+ }
- animateSprites();
+ animateSprites();
+ }
if (_copyPartialMode == 2) {
fillFrontFromBack(0, 0, _screenWidth, _screenHeight);
diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp
index efe7eb2d24..3c02018421 100644
--- a/engines/agos/input.cpp
+++ b/engines/agos/input.cpp
@@ -40,7 +40,7 @@ uint AGOSEngine::setVerbText(HitArea *ha) {
if (ha->flags & kBFTextBox) {
if (getGameType() == GType_PP)
id = ha->id;
- else if (getGameType() == GType_FF && (_lastHitArea->flags & kBFHyperBox))
+ else if (getGameType() == GType_FF && (ha->flags & kBFHyperBox))
id = ha->data;
else
id = ha->flags / 256;
@@ -160,6 +160,7 @@ out_of_here:
_lastHitArea3 = 0;
_lastHitArea = 0;
_lastNameOn = NULL;
+
_mouseCursor = 0;
_noRightClick = 0;
}
@@ -191,9 +192,9 @@ void AGOSEngine::waitForInput() {
_dragAccept = 1;
for (;;) {
- if (getGameType() != GType_FF && getGameType() != GType_PP && _keyPressed == 35)
+ if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) && _keyPressed == 35)
displayBoxStars();
- if (processSpecialKeys() != 0) {
+ if (processSpecialKeys()) {
if ((getGameType() == GType_PP && getGameId() != GID_DIMP) ||
getGameType() == GType_WW)
goto out_of_here;
@@ -203,14 +204,14 @@ void AGOSEngine::waitForInput() {
_lastHitArea3 = NULL;
_dragAccept = 1;
} else {
- if (_lastHitArea3 != 0 || _dragMode != 0)
+ if (_lastHitArea3 || _dragMode)
break;
hitarea_stuff_helper();
delay(100);
}
}
- if (_lastHitArea3 == 0 && _dragMode != 0) {
+ if (!_lastHitArea3 && _dragMode) {
ha = _lastClickRem;
if (ha == 0 || ha->item_ptr == NULL || !(ha->flags & kBFDragBox)) {
@@ -254,11 +255,8 @@ void AGOSEngine::waitForInput() {
}
ha = _lastHitArea;
- if (_lastHitArea == NULL) {
- continue;
- }
-
- if (ha->id == 0x7FFB) {
+ if (ha == NULL) {
+ } else if (ha->id == 0x7FFB) {
inventoryUp(ha->window);
} else if (ha->id == 0x7FFC) {
inventoryDown(ha->window);
@@ -298,7 +296,7 @@ void AGOSEngine::waitForInput() {
waitForSync(34);
}
}
- if (ha->item_ptr && (ha->verb == 0 || _verbHitArea != 0 ||
+ if (ha->item_ptr && (!ha->verb || _verbHitArea ||
(_hitAreaSubjectItem != ha->item_ptr && (ha->flags & kBFBoxItem)))
) {
_hitAreaSubjectItem = ha->item_ptr;
@@ -307,7 +305,7 @@ void AGOSEngine::waitForInput() {
displayName(ha);
_nameLocked = 1;
- if (_verbHitArea != 0) {
+ if (_verbHitArea) {
break;
}
@@ -318,8 +316,8 @@ void AGOSEngine::waitForInput() {
else if (getGameType() == GType_ELVIRA1)
lightMenuStrip(getUserFlag1(ha->item_ptr, 6));
} else {
- if (ha->verb != 0) {
- if (getGameType() == GType_WW && _mouseCursor != 0 && _mouseCursor < 4) {
+ if (ha->verb) {
+ if (getGameType() == GType_WW && _mouseCursor && _mouseCursor < 4) {
_hitAreaSubjectItem = ha->item_ptr;
break;
}
@@ -371,7 +369,7 @@ void AGOSEngine::hitarea_stuff_helper() {
} else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW ||
getGameType() == GType_SIMON1) {
uint subr_id = (uint16)_variableArray[254];
- if (subr_id != 0) {
+ if (subr_id) {
Subroutine *sub = getSubroutineByID(subr_id);
if (sub != NULL) {
startSubroutineEx(sub);
@@ -398,7 +396,7 @@ void AGOSEngine::hitarea_stuff_helper_2() {
Subroutine *sub;
subr_id = (uint16)_variableArray[249];
- if (subr_id != 0) {
+ if (subr_id) {
sub = getSubroutineByID(subr_id);
if (sub != NULL) {
_variableArray[249] = 0;
@@ -409,7 +407,7 @@ void AGOSEngine::hitarea_stuff_helper_2() {
}
subr_id = (uint16)_variableArray[254];
- if (subr_id != 0) {
+ if (subr_id) {
sub = getSubroutineByID(subr_id);
if (sub != NULL) {
_variableArray[254] = 0;
@@ -446,7 +444,7 @@ void AGOSEngine::permitInput() {
}
_curWindow = 0;
- if (_windowArray[0] != 0) {
+ if (_windowArray[0]) {
_textWindow = _windowArray[0];
justifyStart();
}
diff --git a/engines/agos/verb.cpp b/engines/agos/verb.cpp
index 9acd1b0113..124065eaeb 100644
--- a/engines/agos/verb.cpp
+++ b/engines/agos/verb.cpp
@@ -465,8 +465,7 @@ void AGOSEngine::defineBox(int id, int x, int y, int width, int height, int flag
ha->verb = verb;
ha->item_ptr = item_ptr;
- if ((getGameType() == GType_FF || getGameType() == GType_PP) &&
- (ha->flags & kBFHyperBox)) {
+ if (getGameType() == GType_FF && (ha->flags & kBFHyperBox)) {
ha->data = _hyperLink;
ha->priority = 50;
}
@@ -535,9 +534,6 @@ void AGOSEngine::resetVerbs() {
}
void AGOSEngine_Feeble::setVerb(HitArea *ha) {
- if (getGameType() == GType_PP)
- return;
-
int cursor = _mouseCursor;
if (_noRightClick)
return;
@@ -736,27 +732,13 @@ void AGOSEngine::boxController(uint x, uint y, uint mode) {
}
void AGOSEngine::displayName(HitArea *ha) {
- if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2)
+ if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2 || getGameType() == GType_PP)
return;
bool result;
int x = 0, y = 0;
- if (getGameType() == GType_PP) {
- if (ha->flags & kBFHyperBox) {
- _lastNameOn = ha;
- return;
- }
- if (findBox(50))
- return;
-
- y = ha->y;
- y -= 17;
- if (y < 0)
- y = 0;
- y += 2;
- x = ha->width / 2 + ha->x;
- } else if (getGameType() == GType_FF) {
+ if (getGameType() == GType_FF) {
if (ha->flags & kBFHyperBox) {
_lastNameOn = ha;
return;
diff --git a/engines/agos/vga_ww.cpp b/engines/agos/vga_ww.cpp
index da881908f0..3c18fd5a08 100644
--- a/engines/agos/vga_ww.cpp
+++ b/engines/agos/vga_ww.cpp
@@ -177,7 +177,7 @@ void AGOSEngine::vc62_fastFadeOut() {
memcpy(_videoBuf1, _currentPalette, _fastFadeCount * 4);
if (getGameType() == GType_FF || getGameType() == GType_PP) {
- if (getBitFlag(75)) {
+ if (getGameType() == GType_FF && getBitFlag(75)) {
fadeCount = 4;
fadeSize = 64;
} else {
@@ -196,7 +196,7 @@ void AGOSEngine::vc62_fastFadeOut() {
}
if (getGameType() == GType_FF || getGameType() == GType_PP) {
- clearSurfaces(480);
+ clearSurfaces(_screenHeight);
} else if (getGameType() == GType_WW) {
memset(getFrontBuf(), 0, _screenWidth * _screenHeight);
} else {
diff --git a/engines/agos/zones.cpp b/engines/agos/zones.cpp
index e8d2077f4b..630d85d145 100644
--- a/engines/agos/zones.cpp
+++ b/engines/agos/zones.cpp
@@ -103,7 +103,21 @@ byte *AGOSEngine::allocBlock(uint32 size) {
}
}
-void AGOSEngine::checkNoOverWrite() {
+void AGOSEngine::checkRunningAnims() {
+ VgaSprite *vsp;
+ if (getGameType() != GType_FF && getGameType() != GType_PP &&
+ (_lockWord & 0x20)) {
+ return;
+ }
+
+ for (vsp = _vgaSprites; vsp->id; vsp++) {
+ checkAnims(vsp->zoneNum);
+ if (_rejectBlock == true)
+ return;
+ }
+}
+
+void AGOSEngine_Feeble::checkNoOverWrite() {
VgaPointersEntry *vpe;
if (_noOverWrite == 0xFFFF)
@@ -111,40 +125,70 @@ void AGOSEngine::checkNoOverWrite() {
vpe = &_vgaBufferPointers[_noOverWrite];
- if (getGameType() == GType_FF || getGameType() == GType_PP) {
- if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block) {
- _rejectBlock = true;
- _vgaMemPtr = vpe->vgaFile1End;
- } else if (vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block) {
- _rejectBlock = true;
- _vgaMemPtr = vpe->vgaFile2End;
- } else if (vpe->sfxFile && vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
- _rejectBlock = true;
- _vgaMemPtr = vpe->sfxFileEnd;
- } else {
- _rejectBlock = false;
- }
+ if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block) {
+ _rejectBlock = true;
+ _vgaMemPtr = vpe->vgaFile1End;
+ } else if (vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block) {
+ _rejectBlock = true;
+ _vgaMemPtr = vpe->vgaFile2End;
+ } else if (vpe->sfxFile && vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
+ _rejectBlock = true;
+ _vgaMemPtr = vpe->sfxFileEnd;
} else {
- if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
- _vgaMemPtr <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
- _rejectBlock = true;
- _vgaMemPtr = vpe->vgaFile1 + 0x5000;
- } else {
- _rejectBlock = false;
- }
+ _rejectBlock = false;
}
}
-void AGOSEngine::checkRunningAnims() {
- VgaSprite *vsp;
- if (getGameType() != GType_FF && getGameType() != GType_PP && (_lockWord & 0x20)) {
- return;
+void AGOSEngine_Feeble::checkAnims(uint a) {
+ VgaPointersEntry *vpe;
+
+ vpe = &_vgaBufferPointers[a];
+
+ if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block) {
+ _rejectBlock = true;
+ _vgaMemPtr = vpe->vgaFile1End;
+ } else if (vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block) {
+ _rejectBlock = true;
+ _vgaMemPtr = vpe->vgaFile2End;
+ } else if (vpe->sfxFile && vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
+ _rejectBlock = true;
+ _vgaMemPtr = vpe->sfxFileEnd;
+ } else {
+ _rejectBlock = false;
}
+}
- for (vsp = _vgaSprites; vsp->id; vsp++) {
- checkAnims(vsp->zoneNum);
- if (_rejectBlock == true)
- return;
+void AGOSEngine_Feeble::checkZonePtrs() {
+ uint count = ARRAYSIZE(_vgaBufferPointers);
+ VgaPointersEntry *vpe = _vgaBufferPointers;
+ do {
+ if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block ||
+ vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block ||
+ vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
+ vpe->vgaFile1 = NULL;
+ vpe->vgaFile1End = NULL;
+ vpe->vgaFile2 = NULL;
+ vpe->vgaFile2End = NULL;
+ vpe->sfxFile = NULL;
+ vpe->sfxFileEnd = NULL;
+ }
+ } while (++vpe, --count);
+}
+
+void AGOSEngine::checkNoOverWrite() {
+ VgaPointersEntry *vpe;
+
+ if (_noOverWrite == 0xFFFF)
+ return;
+
+ vpe = &_vgaBufferPointers[_noOverWrite];
+
+ if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
+ _vgaMemPtr <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
+ _rejectBlock = true;
+ _vgaMemPtr = vpe->vgaFile1 + 0x5000;
+ } else {
+ _rejectBlock = false;
}
}
@@ -153,27 +197,12 @@ void AGOSEngine::checkAnims(uint a) {
vpe = &_vgaBufferPointers[a];
- if (getGameType() == GType_FF || getGameType() == GType_PP) {
- if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block) {
- _rejectBlock = true;
- _vgaMemPtr = vpe->vgaFile1End;
- } else if (vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block) {
- _rejectBlock = true;
- _vgaMemPtr = vpe->vgaFile2End;
- } else if (vpe->sfxFile && vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
- _rejectBlock = true;
- _vgaMemPtr = vpe->sfxFileEnd;
- } else {
- _rejectBlock = false;
- }
+ if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
+ _block <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
+ _rejectBlock = true;
+ _vgaMemPtr = vpe->vgaFile1 + 0x5000;
} else {
- if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
- _block <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
- _rejectBlock = true;
- _vgaMemPtr = vpe->vgaFile1 + 0x5000;
- } else {
- _rejectBlock = false;
- }
+ _rejectBlock = false;
}
}
@@ -181,23 +210,10 @@ void AGOSEngine::checkZonePtrs() {
uint count = ARRAYSIZE(_vgaBufferPointers);
VgaPointersEntry *vpe = _vgaBufferPointers;
do {
- if (getGameType() == GType_FF || getGameType() == GType_PP) {
- if (vpe->vgaFile1 < _blockEnd && vpe->vgaFile1End > _block ||
- vpe->vgaFile2 < _blockEnd && vpe->vgaFile2End > _block ||
- vpe->sfxFile < _blockEnd && vpe->sfxFileEnd > _block) {
- vpe->vgaFile1 = NULL;
- vpe->vgaFile1End = NULL;
- vpe->vgaFile2 = NULL;
- vpe->vgaFile2End = NULL;
- vpe->sfxFile = NULL;
- vpe->sfxFileEnd = NULL;
- }
- } else {
- if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
- _block <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
- vpe->vgaFile1 = NULL;
- vpe->vgaFile2 = NULL;
- }
+ if (_block <= vpe->vgaFile1 && _blockEnd >= vpe->vgaFile1 ||
+ _block <= vpe->vgaFile2 && _blockEnd >= vpe->vgaFile2) {
+ vpe->vgaFile1 = NULL;
+ vpe->vgaFile2 = NULL;
}
} while (++vpe, --count);
}