[Scummvm-cvs-logs] SF.net SVN: scummvm:[39136] scummvm/trunk/engines/agos
Kirben at users.sourceforge.net
Kirben at users.sourceforge.net
Thu Mar 5 22:38:17 CET 2009
Revision: 39136
http://scummvm.svn.sourceforge.net/scummvm/?rev=39136&view=rev
Author: Kirben
Date: 2009-03-05 21:38:17 +0000 (Thu, 05 Mar 2009)
Log Message:
-----------
Add minor verb code differences in Elvira 1/2.
Modified Paths:
--------------
scummvm/trunk/engines/agos/agos.h
scummvm/trunk/engines/agos/intern.h
scummvm/trunk/engines/agos/script_e1.cpp
scummvm/trunk/engines/agos/verb.cpp
Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h 2009-03-05 20:37:53 UTC (rev 39135)
+++ scummvm/trunk/engines/agos/agos.h 2009-03-05 21:38:17 UTC (rev 39136)
@@ -798,7 +798,7 @@
void waitWindow(WindowBlock *window);
HitArea *findBox(uint hitarea_id);
- void boxController(uint x, uint y, uint mode);
+ virtual void boxController(uint x, uint y, uint mode);
void handleVerbClicked(uint verb);
virtual void clearName();
void displayName(HitArea * ha);
@@ -1297,6 +1297,7 @@
void oe1_animate();
void oe1_stopAnimate();
void oe1_menu();
+ void oe1_addBox();
void oe1_enableInput();
void oe1_setTime();
void oe1_ifTime();
@@ -1462,6 +1463,8 @@
virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
+ virtual void boxController(uint x, uint y, uint mode);
+
virtual void addArrows(WindowBlock *window, uint8 num);
virtual void removeArrows(WindowBlock *window, uint num);
Modified: scummvm/trunk/engines/agos/intern.h
===================================================================
--- scummvm/trunk/engines/agos/intern.h 2009-03-05 20:37:53 UTC (rev 39135)
+++ scummvm/trunk/engines/agos/intern.h 2009-03-05 21:38:17 UTC (rev 39136)
@@ -201,12 +201,14 @@
};
enum BoxFlags {
- kBFTextBox = 0x1,
+ kBFToggleBox = 0x1, // Elvira 1/2
+ kBFTextBox = 0x1, // Others
kBFBoxSelected = 0x2,
- kBFNoTouchName = 0x4,
+ kBFInvertSelect = 0x4, // Elvira 1/2
+ kBFNoTouchName = 0x4, // Others
kBFInvertTouch = 0x8,
- kBFDragBox = 0x10, // Simon 1/2
kBFHyperBox = 0x10, // Feeble Files
+ kBFDragBox = 0x10, // Others
kBFBoxInUse = 0x20,
kBFBoxDead = 0x40,
kBFBoxItem = 0x80
Modified: scummvm/trunk/engines/agos/script_e1.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_e1.cpp 2009-03-05 20:37:53 UTC (rev 39135)
+++ scummvm/trunk/engines/agos/script_e1.cpp 2009-03-05 21:38:17 UTC (rev 39136)
@@ -327,7 +327,7 @@
OPCODE(o_closeWindow),
OPCODE(oe1_menu),
OPCODE(o_invalid),
- OPCODE(o_addBox),
+ OPCODE(oe1_addBox),
/* 236 */
OPCODE(o_delBox),
OPCODE(o_enableBox),
@@ -755,6 +755,40 @@
drawMenuStrip(a, b);
}
+void AGOSEngine_Elvira1::oe1_addBox() {
+ // 235: add item box
+ uint flags = 0;
+ uint id = getVarOrWord();
+ uint params = id / 1000;
+ uint x, y, w, h, verb;
+ Item *item;
+
+ id = id % 1000;
+
+ if (params & 1)
+ flags |= kBFInvertTouch;
+ if (params & 2)
+ flags |= kBFInvertSelect;
+ if (params & 4)
+ flags |= kBFBoxItem;
+ if (params & 8)
+ flags |= kBFToggleBox;
+ if (params & 16)
+ flags |= kBFDragBox;
+
+ x = getVarOrWord();
+ y = getVarOrWord();
+ w = getVarOrWord();
+ h = getVarOrWord();
+ item = getNextItemPtrStrange();
+ verb = getVarOrWord();
+ if (x >= 1000) {
+ verb += 0x4000;
+ x -= 1000;
+ }
+ defineBox(id, x, y, w, h, flags, verb, item);
+}
+
void AGOSEngine_Elvira1::oe1_bitClear() {
// 251: set bit off
int var = getVarOrWord();
Modified: scummvm/trunk/engines/agos/verb.cpp
===================================================================
--- scummvm/trunk/engines/agos/verb.cpp 2009-03-05 20:37:53 UTC (rev 39135)
+++ scummvm/trunk/engines/agos/verb.cpp 2009-03-05 21:38:17 UTC (rev 39136)
@@ -685,6 +685,91 @@
HitArea *ha = _hitAreas;
uint count = ARRAYSIZE(_hitAreas);
uint16 priority = 0;
+
+ best_ha = NULL;
+
+ do {
+ if (ha->flags & kBFBoxInUse) {
+ if (!(ha->flags & kBFBoxDead)) {
+ if (x >= ha->x && y >= ha->y &&
+ x - ha->x < ha->width && y - ha->y < ha->height && priority <= ha->priority) {
+ priority = ha->priority;
+ best_ha = ha;
+ } else {
+ if (ha->flags & kBFBoxSelected) {
+ hitarea_leave(ha , true);
+ ha->flags &= ~kBFBoxSelected;
+ }
+ }
+ } else {
+ ha->flags &= ~kBFBoxSelected;
+ }
+ }
+ } while (ha++, --count);
+
+ _currentBoxNum = 0;
+ _currentBox = best_ha;
+
+ if (best_ha == NULL)
+ return;
+
+ _currentBoxNum = best_ha->id;
+
+ if (mode != 0) {
+ if (mode == 3) {
+ if (best_ha->verb & 0x4000) {
+ if (getGameType() == GType_ELVIRA1 && _variableArray[500] == 0) {
+ _variableArray[500] = best_ha->verb & 0xBFFF;
+ }
+
+ if (_clickOnly != 0 && best_ha->id < 8) {
+ uint id = best_ha->id;
+ if (id >= 4)
+ id -= 4;
+
+ invertBox(findBox(id), 0, 0, 0, 0);
+ _clickOnly = 0;
+ return;
+ }
+ }
+
+ if (best_ha->flags & kBFDragBox)
+ _lastClickRem = best_ha;
+ } else {
+ _lastHitArea = best_ha;
+ }
+ }
+
+ if (_clickOnly != 0)
+ return;
+
+ if (best_ha->flags & kBFInvertTouch) {
+ if (!(best_ha->flags & kBFBoxSelected)) {
+ hitarea_leave(best_ha, false);
+ best_ha->flags |= kBFBoxSelected;
+ }
+ } else {
+ if (mode == 0)
+ return;
+
+ if (!(best_ha->flags & kBFInvertSelect))
+ return;
+
+ if (best_ha->flags & kBFToggleBox) {
+ hitarea_leave(best_ha, false);
+ best_ha->flags ^= kBFInvertSelect;
+ } else if (!(best_ha->flags & kBFBoxSelected)) {
+ hitarea_leave(best_ha, false);
+ best_ha->flags |= kBFBoxSelected;
+ }
+ }
+}
+
+void AGOSEngine_Waxworks::boxController(uint x, uint y, uint mode) {
+ HitArea *best_ha;
+ HitArea *ha = _hitAreas;
+ uint count = ARRAYSIZE(_hitAreas);
+ uint16 priority = 0;
uint16 x_ = x;
uint16 y_ = y;
@@ -734,24 +819,6 @@
if (mode != 0) {
if (mode == 3) {
- if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2) {
- if (best_ha->verb & 0x4000) {
- if (getGameType() == GType_ELVIRA1 && _variableArray[500] == 0) {
- _variableArray[500] = best_ha->verb & 0xBFFF;
- }
-
- if (_clickOnly != 0 && best_ha->id < 8) {
- uint id = best_ha->id;
- if (id >= 4)
- id -= 4;
-
- invertBox(findBox(id), 0, 0, 0, 0);
- _clickOnly = 0;
- return;
- }
- }
- }
-
if (best_ha->flags & kBFDragBox) {
_lastClickRem = best_ha;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list