From f4c27c212738d538d1bee44c514d41e937303fdd Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 18 Oct 2006 11:52:55 +0000 Subject: Add mouse cursors for WW svn-id: r24361 --- engines/agos/agos.cpp | 32 +++++++++++++++++++-- engines/agos/agos.h | 1 + engines/agos/cursor.cpp | 75 +++++++++++++++++++++++++++++++++++++++++++++++- engines/agos/res_ami.cpp | 2 +- engines/agos/verb.cpp | 33 ++++++++++++++++++--- 5 files changed, 135 insertions(+), 8 deletions(-) (limited to 'engines/agos') diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index d5158290c3..532e2cb699 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -204,6 +204,7 @@ AGOSEngine::AGOSEngine(OSystem *syst) _currentBoxNumber = 0; _iOverflow = 0; + _nameLocked = 0; _hitAreaObjectItem = 0; _lastHitArea = 0; _lastNameOn = 0; @@ -1228,6 +1229,7 @@ void AGOSEngine::setup_cond_c_helper() { _lastHitArea = 0; _hitAreaObjectItem = NULL; + _nameLocked = 0; last = _lastNameOn; clearName(); @@ -1332,11 +1334,15 @@ void AGOSEngine::hitarea_stuff() { _verbHitArea = 0; _hitAreaSubjectItem = NULL; _hitAreaObjectItem = NULL; + _nameLocked = 0; - if (getGameType() == GType_WW) + if (getGameType() == GType_WW) { + _mouseCursor = 0; + _needHitAreaRecalc++; clearMenuStrip(); - else + } else { resetVerbs(); + } startOver: for (;;) { @@ -1376,6 +1382,9 @@ startOver: _defaultVerb = 0; } else { if (getGameType() == GType_WW) { + if (_mouseCursor == 3) + _verbHitArea = 236; + if (ha->id == 98) { loadSprite(2, 0, 110, 0, 0, 0); waitForSync(34); @@ -1421,7 +1430,10 @@ startOver: _variableArray[10] = id; else _variableArray[60] = id; + + _nameLocked = 2; displayName(ha); + _nameLocked = 1; if (_verbHitArea != 0) { break; @@ -1437,6 +1449,11 @@ startOver: if (ha->item_ptr) goto if_1; } else { + if (getGameType() == GType_WW && _mouseCursor != 0 && _mouseCursor < 4) { + _hitAreaSubjectItem = ha->item_ptr; + break; + } + _verbHitArea = ha->verb & 0xBFFF; if (ha->verb & 0x4000) { _hitAreaSubjectItem = ha->item_ptr; @@ -1444,6 +1461,16 @@ startOver: } if (_hitAreaSubjectItem != NULL) break; + + if (getGameType() == GType_WW) { + if (ha->id == 109) { + _mouseCursor = 2; + _needHitAreaRecalc++; + } else if (ha->id == 117) { + _mouseCursor = 3; + _needHitAreaRecalc++; + } + } } } } @@ -1452,6 +1479,7 @@ startOver: if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) clearMenuStrip(); + _nameLocked = 0; _needHitAreaRecalc++; } diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 426365acfc..831d860b91 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -340,6 +340,7 @@ protected: uint16 _defaultVerb; uint _currentBoxNumber; uint _iOverflow; + uint _nameLocked; uint16 _windowNum; diff --git a/engines/agos/cursor.cpp b/engines/agos/cursor.cpp index 3d4c6768a4..01d9dea9aa 100644 --- a/engines/agos/cursor.cpp +++ b/engines/agos/cursor.cpp @@ -31,6 +31,52 @@ namespace AGOS { +static const uint16 _common_cursors[7][32] = { +// Mouse Info +{ 0xC000, 0x8000, 0xE000, 0xC000, 0xF000, 0xE000, 0xF800, 0xF000, + 0xFC00, 0xF800, 0xFE00, 0xFC00, 0xFC00, 0xF000, 0x9800, 0x9000, + 0x0C00, 0x0800, 0x0C00, 0x0800, 0x0600, 0x0400, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + +// Hand Info +{ 0x01C0, 0x01C0, 0x07F0, 0x0770, 0x07F0, 0x0550, 0x07FC, 0x055C, + 0x07FC, 0x0554, 0x3FFC, 0x3D54, 0x3FFC, 0x2554, 0x3FFE, 0x2402, + 0x1FFC, 0x1204, 0x1FFC, 0x1004, 0x0FF8, 0x0808, 0x07F8, 0x0408, + 0x03F8, 0x03F8, 0x03F8, 0x0208, 0x03F8, 0x03F8, 0x0000, 0x0000 }, + +// Sword Info +{ + 0x0000, 0x0000, 0xC000, 0x4000, 0xF000, 0x7000, 0x7800, 0x3800, + 0x3C00, 0x1C00, 0x1E00, 0x0E00, 0x0F00, 0x0700, 0x0780, 0x0380, + 0x3C6, 0x01C0, 0x01FF, 0x00E6, 0x00FE, 0x007C, 0x007C, 0x0038, + 0x0FC, 0x0078, 0x01FE, 0x00CC, 0x01CF, 0x0086, 0x0086, 0x0000 }, + +// Move Forward +{ 0x0180, 0x0100, 0x03C0, 0x0380, 0x07E0, 0x07C0, 0x0FF0, 0x0FE0, + 0x1FF8, 0x1FF0, 0x03C0, 0x0380, 0x03C0, 0x0380, 0x03C0, 0x0380, + 0x3C0, 0x0380, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + +// Mouse Right +{ 0x00C0, 0x0080, 0x00E0, 0x00C0, 0x00F0, 0x00E0, 0x1FF8, 0x1FF0, + 0x3FFC, 0x3FF8, 0x3FF8, 0x3FF0, 0x3CF0, 0x38E0, 0x3CE0, 0x38C0, + 0x3CC0, 0x3880, 0x3C00, 0x3800, 0x3C00, 0x3800, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + +// Mouse Back +{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x03C0, 0x0380, 0x03C0, 0x0380, 0x03C0, 0x0380, 0x03C0, 0x0380, + 0x1FF8, 0x1FF0, 0x0FF0, 0x0FE0, 0x07E0, 0x07C0, 0x03C0, 0x0380, + 0x0180, 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + +// Move Left +{ 0x0C00, 0x0800, 0x1C00, 0x1800, 0x3C00, 0x3800, 0x7FE0, 0x7FC0, + 0xFFF0, 0xFFE0, 0x7FF0, 0x7FE0, 0x3CF0, 0x38E0, 0x1CF0, 0x18E0, + 0x0CF0, 0x08E0, 0x00F0, 0x00E0, 0x00F0, 0x00E0, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + +}; + #ifdef PALMOS_68K static const byte *_simon1_cursor; #else @@ -402,6 +448,10 @@ void AGOSEngine::initMouse() { _maxCursorWidth = 40; _maxCursorHeight = 40; _mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1); + } else if (getGameType() != GType_SIMON1 && getGameType() != GType_SIMON2) { + _maxCursorWidth = 16; + _maxCursorHeight = 16; + _mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1); } } @@ -418,8 +468,31 @@ void AGOSEngine::drawMousePointer() { CursorMan.replaceCursor(_mouseData, _maxCursorWidth, _maxCursorHeight, 37, 48, 0); } else if (getGameType() == GType_SIMON2) { CursorMan.replaceCursor(_simon2_cursors[_mouseCursor], 16, 16, 7, 7); - } else { + } else if (getGameType() == GType_SIMON1) { CursorMan.replaceCursor(_simon1_cursor, 16, 16, 0, 0); + } else { + const uint16 *src; + int i, j; + + memset(_mouseData, 0xFF, _maxCursorWidth * _maxCursorHeight); + + uint cursor = (_mouseCursor == 0) ? _mouseCursor : _mouseCursor - 1; + src = _common_cursors[cursor]; + + for (i = 0; i < 16; i++) { + for (j = 0; j < 16; j++) { + if (src[0] & (1 << (15 - (j % 16)))) { + if (src[1] & (1 << (15 - (j % 16)))) { + _mouseData[16 * i + j] = 65; + } else { + _mouseData[16 * i + j] = 0; + } + } + } + src += 2; + } + + CursorMan.replaceCursor(_mouseData, 16, 16, 0, 0, 0xFF); } } diff --git a/engines/agos/res_ami.cpp b/engines/agos/res_ami.cpp index 5dd5b5064b..76ff32ecf6 100644 --- a/engines/agos/res_ami.cpp +++ b/engines/agos/res_ami.cpp @@ -253,7 +253,7 @@ static void convertclip(uint32 offset, uint16 height, uint16 width) { word2 <<= 1; word3 <<= 1; word4 <<= 1; - *clipoutptr++ = outbyte * 16 + outbyte1; bufoutend++; + *clipoutptr++ = (outbyte * 16 + outbyte1); bufoutend++; } } } diff --git a/engines/agos/verb.cpp b/engines/agos/verb.cpp index ea4c631c30..f5caad58af 100644 --- a/engines/agos/verb.cpp +++ b/engines/agos/verb.cpp @@ -177,6 +177,12 @@ static const char *const english_verb_prep_names[] = { }; void AGOSEngine::clearName() { + if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2) + return; + + //if (_nameLocked == 1) + // return; + HitArea *last; HitArea *ha; @@ -738,6 +744,9 @@ void AGOSEngine::boxController(uint x, uint y, uint mode) { if (best_ha == NULL) { clearName(); + if (getGameType() == GType_WW && _mouseCursor >= 4) + _mouseCursor = 0; + return; } @@ -761,12 +770,25 @@ void AGOSEngine::boxController(uint x, uint y, uint mode) { } } - if (best_ha->flags & kBFNoTouchName) { - clearName(); - } else if (best_ha != _lastNameOn) { - displayName(best_ha); + if ((getGameType() == GType_WW) && (_mouseCursor == 0 || _mouseCursor >= 4)) { + uint verb = best_ha->verb & 0x3FFF; + if (verb >= 239 && verb <= 242) { + uint cursor = verb - 235; + if (_mouseCursor != cursor) { + _mouseCursor = cursor; + _needHitAreaRecalc++; + } + } } + //if (_nameLocked == 0) { + if (best_ha->flags & kBFNoTouchName) { + clearName(); + } else if (best_ha != _lastNameOn) { + displayName(best_ha); + } + //} + if (best_ha->flags & kBFInvertTouch && !(best_ha->flags & kBFBoxSelected)) { hitarea_leave(best_ha, false); best_ha->flags |= kBFBoxSelected; @@ -776,6 +798,9 @@ void AGOSEngine::boxController(uint x, uint y, uint mode) { } void AGOSEngine::displayName(HitArea *ha) { + if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2) + return; + bool result; int x = 0, y = 0; -- cgit v1.2.3