aboutsummaryrefslogtreecommitdiff
path: root/engines/agos
diff options
context:
space:
mode:
authorTravis Howell2007-04-15 05:33:21 +0000
committerTravis Howell2007-04-15 05:33:21 +0000
commit95661d65af55c60178339d2f1f966197d828aabe (patch)
treeab7671e0c0743511fae0769652574493a1058248 /engines/agos
parent2d3e77db85b50ae7f6b36bfff658dd02c29f9155 (diff)
downloadscummvm-rg350-95661d65af55c60178339d2f1f966197d828aabe.tar.gz
scummvm-rg350-95661d65af55c60178339d2f1f966197d828aabe.tar.bz2
scummvm-rg350-95661d65af55c60178339d2f1f966197d828aabe.zip
Cleanup.
svn-id: r26482
Diffstat (limited to 'engines/agos')
-rw-r--r--engines/agos/agos.h21
-rw-r--r--engines/agos/verb.cpp285
2 files changed, 159 insertions, 147 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 6d32474f4b..39d757d9e2 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -630,8 +630,8 @@ protected:
void defineBox(int id, int x, int y, int width, int height, int flags, int verb, Item *item_ptr);
HitArea *findEmptyHitArea();
- void resetVerbs();
- void setVerb(HitArea * ha);
+ virtual void resetVerbs();
+ virtual void setVerb(HitArea * ha);
void hitarea_leave(HitArea * ha, bool state = false);
void leaveHitAreaById(uint hitarea_id);
@@ -737,8 +737,8 @@ protected:
void checkUp(WindowBlock *window);
void checkDown(WindowBlock *window);
- void inventoryUp(WindowBlock *window);
- void inventoryDown(WindowBlock *window);
+ virtual void inventoryUp(WindowBlock *window);
+ virtual void inventoryDown(WindowBlock *window);
WindowBlock *openWindow(uint x, uint y, uint w, uint h, uint flags, uint fillColor, uint textColor);
uint getWindowNum(WindowBlock *window);
@@ -752,7 +752,7 @@ protected:
HitArea *findBox(uint hitarea_id);
void boxController(uint x, uint y, uint mode);
void handleVerbClicked(uint verb);
- void clearName();
+ virtual void clearName();
void displayName(HitArea * ha);
void resetNameWindow();
void displayBoxStars();
@@ -1471,8 +1471,15 @@ public:
virtual void drawMousePointer();
protected:
- virtual void drawIconArray(uint i, Item *item_ptr, int line, int classMask);
+ virtual void resetVerbs();
+ virtual void setVerb(HitArea * ha);
+
+ virtual void inventoryUp(WindowBlock *window);
+ virtual void inventoryDown(WindowBlock *window);
+
+ virtual void clearName();
+ virtual void drawIconArray(uint i, Item *item_ptr, int line, int classMask);
private:
};
@@ -1483,6 +1490,8 @@ public:
virtual void setupOpcodes(OpcodeProc *op);
+protected:
+ virtual void resetVerbs();
private:
};
diff --git a/engines/agos/verb.cpp b/engines/agos/verb.cpp
index 59d75b4061..dfc1a6ceb0 100644
--- a/engines/agos/verb.cpp
+++ b/engines/agos/verb.cpp
@@ -176,6 +176,14 @@ static const char *const english_verb_prep_names[] = {
"", "", "", "to whom ?"
};
+void AGOSEngine_Feeble::clearName() {
+ stopAnimateSimon2(2, 6);
+ _lastNameOn = NULL;
+ _animatePointer = 0;
+ _mouseAnim = 1;
+ return;
+}
+
void AGOSEngine::clearName() {
if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2)
return;
@@ -186,14 +194,6 @@ void AGOSEngine::clearName() {
HitArea *last;
HitArea *ha;
- if (getGameType() == GType_FF || getGameType() == GType_PP) {
- stopAnimateSimon2(2, 6);
- _lastNameOn = NULL;
- _animatePointer = 0;
- _mouseAnim = 1;
- return;
- }
-
if (getGameType() == GType_SIMON2) {
if (getBitFlag(79)) {
sendSync(202);
@@ -474,118 +474,121 @@ void AGOSEngine::defineBox(int id, int x, int y, int width, int height, int flag
_needHitAreaRecalc++;
}
+void AGOSEngine_PuzzlePack::resetVerbs() {
+ _verbHitArea = 300;
+}
+
+void AGOSEngine_Feeble::resetVerbs() {
+ _verbHitArea = 300;
+ int cursor = 0;
+ int animMax = 16;
+
+ if (getBitFlag(203)) {
+ cursor = 14;
+ animMax = 9;
+ } else if (getBitFlag(204)) {
+ cursor = 15;
+ animMax = 9;
+ } else if (getBitFlag(207)) {
+ cursor = 26;
+ animMax = 2;
+ }
+
+ _mouseCursor = cursor;
+ _mouseAnimMax = animMax;
+ _mouseAnim = 1;
+ _needHitAreaRecalc++;
+
+ if (getBitFlag(99)) {
+ setVerb(NULL);
+ }
+}
+
void AGOSEngine::resetVerbs() {
if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2)
return;
- if (getGameType() == GType_PP) {
- _verbHitArea = 300;
- } else if (getGameType() == GType_FF) {
- _verbHitArea = 300;
- int cursor = 0;
- int animMax = 16;
-
- if (getBitFlag(203)) {
- cursor = 14;
- animMax = 9;
- } else if (getBitFlag(204)) {
- cursor = 15;
- animMax = 9;
- } else if (getBitFlag(207)) {
- cursor = 26;
- animMax = 2;
- }
-
- _mouseCursor = cursor;
- _mouseAnimMax = animMax;
- _mouseAnim = 1;
- _needHitAreaRecalc++;
+ uint id;
+ HitArea *ha;
- if (getBitFlag(99)) {
- setVerb(NULL);
- }
+ if (getGameType() == GType_SIMON2) {
+ id = 2;
+ if (!getBitFlag(79))
+ id = (_mouse.y >= 136) ? 102 : 101;
} else {
- uint id;
- HitArea *ha;
-
- if (getGameType() == GType_SIMON2) {
- id = 2;
- if (!getBitFlag(79))
- id = (_mouse.y >= 136) ? 102 : 101;
- } else {
- id = (_mouse.y >= 136) ? 102 : 101;
- }
+ id = (_mouse.y >= 136) ? 102 : 101;
+ }
- _defaultVerb = id;
+ _defaultVerb = id;
- ha = findBox(id);
- if (ha == NULL)
- return;
+ ha = findBox(id);
+ if (ha == NULL)
+ return;
- if (ha->flags & kBFBoxDead) {
- _defaultVerb = 999;
- _currentVerbBox = NULL;
- } else {
- _verbHitArea = ha->verb;
- setVerb(ha);
- }
+ if (ha->flags & kBFBoxDead) {
+ _defaultVerb = 999;
+ _currentVerbBox = NULL;
+ } else {
+ _verbHitArea = ha->verb;
+ setVerb(ha);
}
}
-void AGOSEngine::setVerb(HitArea *ha) {
- if (getGameType() == GType_PP) {
+void AGOSEngine_Feeble::setVerb(HitArea *ha) {
+ if (getGameType() == GType_PP)
return;
- } else if (getGameType() == GType_FF) {
- int cursor = _mouseCursor;
- if (_noRightClick)
- return;
- if (cursor > 13)
- cursor = 0;
- cursor++;
- if (cursor == 5)
+ int cursor = _mouseCursor;
+ if (_noRightClick)
+ return;
+
+ if (cursor > 13)
+ cursor = 0;
+ cursor++;
+ if (cursor == 5)
+ cursor = 1;
+ if (cursor == 4) {
+ if (getBitFlag(72)) {
cursor = 1;
- if (cursor == 4) {
- if (getBitFlag(72)) {
- cursor = 1;
- }
- } else if (cursor == 2) {
- if (getBitFlag(99)) {
- cursor = 3;
- }
}
+ } else if (cursor == 2) {
+ if (getBitFlag(99)) {
+ cursor = 3;
+ }
+ }
- _mouseCursor = cursor;
- _mouseAnimMax = (cursor == 4) ? 14: 16;
- _mouseAnim = 1;
- _needHitAreaRecalc++;
- _verbHitArea = cursor + 300;
- } else {
- HitArea *tmp = _currentVerbBox;
-
- if (ha == tmp)
- return;
+ _mouseCursor = cursor;
+ _mouseAnimMax = (cursor == 4) ? 14: 16;
+ _mouseAnim = 1;
+ _needHitAreaRecalc++;
+ _verbHitArea = cursor + 300;
+}
- if (getGameType() == GType_SIMON1) {
- if (tmp != NULL) {
- tmp->flags |= kBFInvertTouch;
- invertBox(tmp, 213, 208, 213, 10);
- }
+void AGOSEngine::setVerb(HitArea *ha) {
+ HitArea *tmp = _currentVerbBox;
- if (ha->flags & kBFBoxSelected)
- invertBox(ha, 218, 213, 213, 5);
- else
- invertBox(ha, 223, 218, 218, 10);
+ if (ha == tmp)
+ return;
- ha->flags &= ~(kBFBoxSelected + kBFInvertTouch);
- } else {
- if (ha->id < 101)
- return;
- _mouseCursor = ha->id - 101;
- _needHitAreaRecalc++;
+ if (getGameType() == GType_SIMON1) {
+ if (tmp != NULL) {
+ tmp->flags |= kBFInvertTouch;
+ invertBox(tmp, 213, 208, 213, 10);
}
- _currentVerbBox = ha;
+
+ if (ha->flags & kBFBoxSelected)
+ invertBox(ha, 218, 213, 213, 5);
+ else
+ invertBox(ha, 223, 218, 218, 10);
+
+ ha->flags &= ~(kBFBoxSelected + kBFInvertTouch);
+ } else {
+ if (ha->id < 101)
+ return;
+ _mouseCursor = ha->id - 101;
+ _needHitAreaRecalc++;
}
+ _currentVerbBox = ha;
}
void AGOSEngine::hitarea_leave(HitArea *ha, bool state) {
@@ -658,55 +661,55 @@ void AGOSEngine::checkDown(WindowBlock *window) {
}
}
-void AGOSEngine::inventoryUp(WindowBlock *window) {
- if (getGameType() == GType_FF) {
- _marks = 0;
- checkUp(window);
- animate(4, 9, 21, 0 ,0, 0);
- while (1) {
- if (_currentBox->id != 0x7FFB || !getBitFlag(89))
- break;
- checkUp(window);
- delay(1);
- }
- waitForMark(2);
- checkUp(window);
- sendSync(922);
- waitForMark(1);
+void AGOSEngine_Feeble::inventoryUp(WindowBlock *window) {
+ _marks = 0;
+ checkUp(window);
+ animate(4, 9, 21, 0 ,0, 0);
+ while (1) {
+ if (_currentBox->id != 0x7FFB || !getBitFlag(89))
+ break;
checkUp(window);
- } else {
- if (window->iconPtr->line == 0)
- return;
-
- mouseOff();
- uint index = getWindowNum(window);
- drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line - 1, window->iconPtr->classMask);
- mouseOn();
+ delay(1);
}
+ waitForMark(2);
+ checkUp(window);
+ sendSync(922);
+ waitForMark(1);
+ checkUp(window);
}
-void AGOSEngine::inventoryDown(WindowBlock *window) {
- if (getGameType() == GType_FF) {
- _marks = 0;
- checkDown(window);
- animate(4, 9, 23, 0, 0, 0);
- while (1) {
- if (_currentBox->id != 0x7FFC || !getBitFlag(89))
- break;
- checkDown(window);
- delay(1);
- }
- waitForMark(2);
- checkDown(window);
- sendSync(924);
- waitForMark(1);
+void AGOSEngine::inventoryUp(WindowBlock *window) {
+ if (window->iconPtr->line == 0)
+ return;
+
+ mouseOff();
+ uint index = getWindowNum(window);
+ drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line - 1, window->iconPtr->classMask);
+ mouseOn();
+}
+
+void AGOSEngine_Feeble::inventoryDown(WindowBlock *window) {
+ _marks = 0;
+ checkDown(window);
+ animate(4, 9, 23, 0, 0, 0);
+ while (1) {
+ if (_currentBox->id != 0x7FFC || !getBitFlag(89))
+ break;
checkDown(window);
- } else {
- mouseOff();
- uint index = getWindowNum(window);
- drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line + 1, window->iconPtr->classMask);
- mouseOn();
+ delay(1);
}
+ waitForMark(2);
+ checkDown(window);
+ sendSync(924);
+ waitForMark(1);
+ checkDown(window);
+}
+
+void AGOSEngine::inventoryDown(WindowBlock *window) {
+ mouseOff();
+ uint index = getWindowNum(window);
+ drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line + 1, window->iconPtr->classMask);
+ mouseOn();
}
void AGOSEngine::boxController(uint x, uint y, uint mode) {