diff options
Diffstat (limited to 'engines/tsage/blue_force')
-rw-r--r-- | engines/tsage/blue_force/blueforce_dialogs.cpp | 169 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_dialogs.h | 18 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.cpp | 342 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.h | 118 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_ui.cpp | 81 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_ui.h | 9 |
6 files changed, 524 insertions, 213 deletions
diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp index ec99df8c3b..be72b78622 100644 --- a/engines/tsage/blue_force/blueforce_dialogs.cpp +++ b/engines/tsage/blue_force/blueforce_dialogs.cpp @@ -196,6 +196,175 @@ void RightClickDialog::execute() { _gfxManager.deactivate(); } +/*--------------------------------------------------------------------------*/ + +AmmoBeltDialog::AmmoBeltDialog() : GfxDialog() { + _cursorNum = BF_GLOBALS._events.getCursor(); + _inDialog = -1; + _closeFlag = false; + + // Get the dialog image + _surface = surfaceFromRes(9, 5, 2); + + // Set the dialog position + _dialogRect.resize(_surface, 0, 0, 100); + _dialogRect.center(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2); + + _bounds = _dialogRect; + _gfxManager._bounds = _bounds; + _savedArea = NULL; + + // Set up area rects + _gunRect.set(0, 0, 82, 48); + _clip1Rect.set(90, 6, _bounds.width(), 39); + _clip2Rect.set(90, 40, _bounds.width(), _bounds.height()); + _loadedRect.set(50, 40, 60, 50); +} + +AmmoBeltDialog::~AmmoBeltDialog() { + BF_GLOBALS._events.setCursor(_cursorNum); +} + +void AmmoBeltDialog::execute() { + // Draw the dialog + draw(); + + // Dialog event handler loop + _gfxManager.activate(); + + while (!_vm->shouldQuit() && !_closeFlag) { + Event evt; + while (_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) { + evt.mousePos.x -= _bounds.left; + evt.mousePos.y -= _bounds.top; + + process(evt); + } + + g_system->delayMillis(10); + g_system->updateScreen(); + } + + _gfxManager.deactivate(); +} + +bool AmmoBeltDialog::process(Event &event) { + switch (event.eventType) { + case EVENT_MOUSE_MOVE: { + // Handle updating cursor depending on whether cursor is in dialog or not + int inDialog = Rect(0, 0, _bounds.width(), _bounds.height()).contains(event.mousePos); + if (inDialog != _inDialog) { + // Update cursor + BF_GLOBALS._events.setCursor(inDialog ? CURSOR_USE : CURSOR_EXIT); + _inDialog = inDialog; + } + return true; + } + + case EVENT_BUTTON_DOWN: + if (!_inDialog) + // Clicked outside dialog, so flag to close it + _closeFlag = true; + else { + int v = (BF_GLOBALS.getFlag(fGunLoaded) ? 1 : 0) * (BF_GLOBALS.getFlag(fLoadedSpare) ? 2 : 1); + + // Handle first clip + if ((v != 1) && _clip1Rect.contains(event.mousePos)) { + if (BF_GLOBALS.getFlag(fGunLoaded)) { + event.mousePos.x = event.mousePos.y = 0; + } + + BF_GLOBALS.setFlag(fGunLoaded); + BF_GLOBALS.clearFlag(fLoadedSpare); + } + + // Handle second clip + if ((v != 2) && _clip2Rect.contains(event.mousePos)) { + if (BF_GLOBALS.getFlag(fGunLoaded)) { + event.mousePos.x = event.mousePos.y = 0; + } + + BF_GLOBALS.setFlag(fGunLoaded); + BF_GLOBALS.setFlag(fLoadedSpare); + } + + if (_gunRect.contains(event.mousePos) && BF_GLOBALS.getFlag(fGunLoaded)) { + BF_GLOBALS.clearFlag(fGunLoaded); + v = (BF_GLOBALS.getFlag(fGunLoaded) ? 1 : 0) * (BF_GLOBALS.getFlag(fLoadedSpare) ? 2 : 1); + + if (v != 2) + BF_GLOBALS.clearFlag(fLoadedSpare); + } + + draw(); + } + + return true; + + case EVENT_KEYPRESS: + if ((event.kbd.keycode == Common::KEYCODE_ESCAPE) || (event.kbd.keycode == Common::KEYCODE_RETURN)) { + // Escape pressed, so flag to close dialog + _closeFlag = true; + return true; + } + break; + + default: + break; + } + + return false; +} + +void AmmoBeltDialog::draw() { + Rect bounds = _bounds; + + if (!_savedArea) { + // Save the covered background area + _savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds); + } else { + bounds.moveTo(0, 0); + } + + // Draw the dialog image + _globals->gfxManager().copyFrom(_surface, bounds.left, bounds.top); + + // Setup clip flags + bool clip1 = true, clip2 = true; + bool gunLoaded = BF_GLOBALS.getFlag(fGunLoaded); + if (gunLoaded) { + // A clip is currently loaded. Hide the appropriate clip + if (BF_GLOBALS.getFlag(fLoadedSpare)) + clip2 = false; + else + clip1 = false; + } + + // Draw the first clip if necessary + if (clip1) { + GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip1Frame); + _clip1Rect.resize(clipSurface, _clip1Rect.left, _clip1Rect.top, 100); + _globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip1Rect.left, + bounds.top + _clip1Rect.top); + } + + // Draw the second clip if necessary + if (clip2) { + GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip2Frame); + _clip2Rect.resize(clipSurface, _clip2Rect.left, _clip2Rect.top, 100); + _globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip2Rect.left, + bounds.top + _clip2Rect.top); + } + + // If a clip is loaded, draw the 'loaded' portion of the gun + if (gunLoaded) { + GfxSurface loadedSurface = surfaceFromRes(9, 7, 1); + _loadedRect.resize(loadedSurface, _loadedRect.left, _loadedRect.top, 100); + _globals->gfxManager().copyFrom(loadedSurface, bounds.left + _loadedRect.left, + bounds.top + _loadedRect.top); + } +} + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_dialogs.h b/engines/tsage/blue_force/blueforce_dialogs.h index 1ead39a089..0fee0eb4a8 100644 --- a/engines/tsage/blue_force/blueforce_dialogs.h +++ b/engines/tsage/blue_force/blueforce_dialogs.h @@ -54,6 +54,24 @@ public: void execute(); }; +class AmmoBeltDialog : public GfxDialog { +private: + GfxSurface _surface; + Visage _cursorImages; + Rect _dialogRect, _loadedRect, _gunRect, _clip1Rect, _clip2Rect; + CursorType _cursorNum; + int _inDialog; + bool _closeFlag; +public: + AmmoBeltDialog(); + ~AmmoBeltDialog(); + + virtual void draw(); + virtual bool process(Event &event); + void execute(); +}; + + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 31ebab3c47..3eafac7a08 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -551,12 +551,15 @@ void SceneHandlerExt::postInit(SceneObjectList *OwnerList) { // Load the low end palette data BF_GLOBALS._scenePalette.loadPalette(2); BF_GLOBALS._scenePalette.refresh(); - - // Setup the user interface - BF_GLOBALS._uiElements.setup(Common::Point(0, BF_INTERFACE_Y - 2)); } void SceneHandlerExt::process(Event &event) { + if (BF_GLOBALS._uiElements._active) { + BF_GLOBALS._uiElements.process(event); + if (event.handled) + return; + } + SceneHandler::process(event); // TODO: All the new stuff from Blue Force @@ -701,142 +704,227 @@ SpeakerJakeNoHead::SpeakerJakeNoHead(): VisualSpeaker() { /*--------------------------------------------------------------------------*/ BlueForceInvObjectList::BlueForceInvObjectList(): - _business_card(9, 4, 2, 0), - _lauras_sweater(9, 4, 3, 0), - _handcuffs(9, 1, 4, 0), - _magnum(9, 1, 5, 0), - _ticket_book(9, 1, 6, 0), - _miranda_card(9, 1, 7, 0), - _forest_follet(9, 1, 8, 0), - _bradford_id(9, 1, 9, 0), - _baseball_card(9, 1, 10, 0), - _slip_bradford(9, 1, 11, 0), - _flare(9, 1, 12, 0), - _rap_sheet(9, 1, 13, 0), - _cartridges(9, 1, 14, 0), - _rifle(9, 1, 15, 0), - _wig(9, 1, 16, 0), - _frankies_id(9, 1, 17, 0), - _tyrones_id(9, 1, 18, 0), - _pistol22(9, 1, 19, 0), - _unused(1, 1, 1, 0), - _slip_frankie(9, 2, 1, 0), - _slip_tyrone(9, 2, 2, 0), - _atf_teletype(9, 2, 3, 0), - _da_note(9, 2, 4, 0), - _blueprints(9, 2, 5, 0), - _planter_key(9, 2, 6, 0), - _center_punch(9, 2, 7, 0), - _tranquilizer(9, 2, 8, 0), - _boat_hook(9, 2, 9, 0), - _oily_rags(9, 2, 10, 0), - _fuel_jar(9, 2, 11, 0), - _screwdriver(9, 2, 12, 0), - _floppy_disk1(9, 2, 13, 0), - _floppy_disk2(9, 2, 14, 0), - _driftwood(9, 2, 15, 0), - _crate_piece1(9, 2, 16, 0), - _crate_piece2(9, 2, 17, 0), - _shoebox(9, 2, 18, 0), - _badge(9, 2, 19, 0), - _unused2(1, 1, 1, 0), - _rental_coupons(9, 3, 1, 0), - _nickel(9, 3, 2, 0), - _calendar(9, 3, 3, 0), - _dixon_note(9, 3, 4, 0), - _cobb_mugshot(9, 3, 5, 0), - _murder_article(9, 3, 6, 0), - _microfiche(9, 3, 7, 0), - _future_wave_keys(9, 3, 8, 0), - _rental_boat_keys(9, 3, 9, 0), - _napkin(9, 3, 10, 0), - _cobb_printout(9, 3, 11, 0), - _fishing_net(9, 3, 12, 0), - _id(9, 3, 13, 0), - _rounds_9mm(9, 3, 14, 0), - _dates_note(9, 3, 15, 0), - _hand_grenade(9, 3, 16, 0), - _cord_110(9, 3, 17, 0), - _cord_110_plug(9, 3, 18, 0), - _cord_220(9, 3, 19, 0), - _unused3(1, 1, 1, 0), - _cord_220_plug(9, 4, 1, 0), - _official_document(9, 4, 2, 0), - _red_sweater(9, 4, 3, 0), - _jackknife(9, 4, 4, 0), - _whistle(9, 4, 5, 0), - _gun(9, 1, 2, 0), - _alley_cat_key(9, 4, 7, 0) { + _none(9, 5, 1), + _colt45(9, 1, 1), + _ammoClip(9, 4, 2), + _spareClip(9, 4, 3), + _handcuffs(9, 1, 4), + _greensGun(9, 1, 5), + _ticketBook(9, 1, 6), + _mirandaCard(9, 1, 7), + _forestRap(9, 1, 8), + _greenId(9, 1, 9), + _baseballCard(9, 1, 10), + _bookingGreen(9, 1, 11), + _flare(9, 1, 12), + _cobbRap(9, 1, 13), + _bullet22(9, 1, 14), + _autoRifle(9, 1, 15), + _wig(9, 1, 16), + _frankieId(9, 1, 17), + _tyroneId(9, 1, 18), + _snub22(9, 1, 19), + _bug(1, 1, 1), + _bookingFrankie(9, 2, 1), + _bookingGang(9, 2, 2), + _fbiTeletype(9, 2, 3), + _daNote(9, 2, 4), + _printOut(9, 2, 5), + _warehouseKeys(9, 2, 6), + _centerPunch(9, 2, 7), + _tranqGun(9, 2, 8), + _hook(9, 2, 9), + _rags(9, 2, 10), + _jar(9, 2, 11), + _screwdriver(9, 2, 12), + _dFloppy(9, 2, 13), + _blankDisk(9, 2, 14), + _stick(9, 2, 15), + _crate1(9, 2, 16), + _crate2(9, 2, 17), + _shoebox(9, 2, 18), + _badge(9, 2, 19), + _bug2(1, 1, 1), + _rentalCoupon(9, 3, 1), + _nickel(9, 3, 2), + _lyleCard(9, 3, 3), + _carterNote(9, 3, 4), + _mugshot(9, 3, 5), + _clipping(9, 3, 6), + _microfilm(9, 3, 7), + _waveKeys(9, 3, 8), + _rentalKeys(9, 3, 9), + _napkin(9, 3, 10), + _dmvPrintout(9, 3, 11), + _fishingNet(9, 3, 12), + _id(9, 3, 13), + _bullets9mm(9, 3, 14), + _schedule(9, 3, 15), + _grenades(9, 3, 16), + _yellowCord(9, 3, 17), + _halfYellowCord(9, 3, 18), + _blackCord(9, 3, 19), + _bug3(1, 1, 1), + _halfBlackCord(9, 4, 1), + _warrant(9, 4, 2), + _jacket(9, 4, 3), + _greensKnife(9, 4, 4), + _dogWhistle(9, 4, 5), + _ammoBelt(9, 1, 2), + _lastInvent(9, 4, 7) { // Add the items to the list - _itemList.push_back(&_business_card); - _itemList.push_back(&_lauras_sweater); + _itemList.push_back(&_none); + _itemList.push_back(&_colt45); + _itemList.push_back(&_ammoClip); + _itemList.push_back(&_spareClip); _itemList.push_back(&_handcuffs); - _itemList.push_back(&_magnum); - _itemList.push_back(&_ticket_book); - _itemList.push_back(&_miranda_card); - _itemList.push_back(&_forest_follet); - _itemList.push_back(&_bradford_id); - _itemList.push_back(&_baseball_card); - _itemList.push_back(&_slip_bradford); + _itemList.push_back(&_greensGun); + _itemList.push_back(&_ticketBook); + _itemList.push_back(&_mirandaCard); + _itemList.push_back(&_forestRap); + _itemList.push_back(&_greenId); + _itemList.push_back(&_baseballCard); + _itemList.push_back(&_bookingGreen); _itemList.push_back(&_flare); - _itemList.push_back(&_rap_sheet); - _itemList.push_back(&_cartridges); - _itemList.push_back(&_rifle); + _itemList.push_back(&_cobbRap); + _itemList.push_back(&_bullet22); + _itemList.push_back(&_autoRifle); _itemList.push_back(&_wig); - _itemList.push_back(&_frankies_id); - _itemList.push_back(&_tyrones_id); - _itemList.push_back(&_pistol22); - _itemList.push_back(&_unused); - _itemList.push_back(&_slip_frankie); - _itemList.push_back(&_slip_tyrone); - _itemList.push_back(&_atf_teletype); - _itemList.push_back(&_da_note); - _itemList.push_back(&_blueprints); - _itemList.push_back(&_planter_key); - _itemList.push_back(&_center_punch); - _itemList.push_back(&_tranquilizer); - _itemList.push_back(&_boat_hook); - _itemList.push_back(&_oily_rags); - _itemList.push_back(&_fuel_jar); + _itemList.push_back(&_frankieId); + _itemList.push_back(&_tyroneId); + _itemList.push_back(&_snub22); + _itemList.push_back(&_bug); + _itemList.push_back(&_bookingFrankie); + _itemList.push_back(&_bookingGang); + _itemList.push_back(&_fbiTeletype); + _itemList.push_back(&_daNote); + _itemList.push_back(&_printOut); + _itemList.push_back(&_warehouseKeys); + _itemList.push_back(&_centerPunch); + _itemList.push_back(&_tranqGun); + _itemList.push_back(&_hook); + _itemList.push_back(&_rags); + _itemList.push_back(&_jar); _itemList.push_back(&_screwdriver); - _itemList.push_back(&_floppy_disk1); - _itemList.push_back(&_floppy_disk2); - _itemList.push_back(&_driftwood); - _itemList.push_back(&_crate_piece1); - _itemList.push_back(&_crate_piece2); + _itemList.push_back(&_dFloppy); + _itemList.push_back(&_blankDisk); + _itemList.push_back(&_stick); + _itemList.push_back(&_crate1); + _itemList.push_back(&_crate2); _itemList.push_back(&_shoebox); _itemList.push_back(&_badge); - _itemList.push_back(&_unused2); - _itemList.push_back(&_rental_coupons); + _itemList.push_back(&_bug2); + _itemList.push_back(&_rentalCoupon); _itemList.push_back(&_nickel); - _itemList.push_back(&_calendar); - _itemList.push_back(&_dixon_note); - _itemList.push_back(&_cobb_mugshot); - _itemList.push_back(&_murder_article); - _itemList.push_back(&_microfiche); - _itemList.push_back(&_future_wave_keys); - _itemList.push_back(&_rental_boat_keys); + _itemList.push_back(&_lyleCard); + _itemList.push_back(&_carterNote); + _itemList.push_back(&_mugshot); + _itemList.push_back(&_clipping); + _itemList.push_back(&_microfilm); + _itemList.push_back(&_waveKeys); + _itemList.push_back(&_rentalKeys); _itemList.push_back(&_napkin); - _itemList.push_back(&_cobb_printout); - _itemList.push_back(&_fishing_net); + _itemList.push_back(&_dmvPrintout); + _itemList.push_back(&_fishingNet); _itemList.push_back(&_id); - _itemList.push_back(&_rounds_9mm); - _itemList.push_back(&_dates_note); - _itemList.push_back(&_hand_grenade); - _itemList.push_back(&_cord_110); - _itemList.push_back(&_cord_110_plug); - _itemList.push_back(&_cord_220); - _itemList.push_back(&_unused3); - _itemList.push_back(&_cord_220_plug); - _itemList.push_back(&_official_document); - _itemList.push_back(&_red_sweater); - _itemList.push_back(&_jackknife); - _itemList.push_back(&_whistle); - _itemList.push_back(&_gun); - _itemList.push_back(&_alley_cat_key); -} + _itemList.push_back(&_bullets9mm); + _itemList.push_back(&_schedule); + _itemList.push_back(&_grenades); + _itemList.push_back(&_yellowCord); + _itemList.push_back(&_halfYellowCord); + _itemList.push_back(&_blackCord); + _itemList.push_back(&_bug3); + _itemList.push_back(&_halfBlackCord); + _itemList.push_back(&_warrant); + _itemList.push_back(&_jacket); + _itemList.push_back(&_greensKnife); + _itemList.push_back(&_dogWhistle); + _itemList.push_back(&_ammoBelt); + _itemList.push_back(&_lastInvent); +} + +void BlueForceInvObjectList::reset() { + // Reset all object scene numbers + SynchronizedList<InvObject *>::iterator i; + for (i = _itemList.begin(); i != _itemList.end(); ++i) { + (*i)->_sceneNumber = 0; + } + + // Set up default inventory + setObjectRoom(INV_COLT45, 1); + setObjectRoom(INV_HANDCUFFS, 1); + setObjectRoom(INV_AMMO_BELT, 1); + setObjectRoom(INV_ID, 1); + + // Set default room for other objects + setObjectRoom(INV_TICKET_BOOK, 60); + setObjectRoom(INV_MIRANDA_CARD, 60); + setObjectRoom(INV_FOREST_RAP, 320); + setObjectRoom(INV_GREEN_ID, 370); + setObjectRoom(INV_BASEBALL_CARD, 840); + setObjectRoom(INV_BOOKING_GREEN, 390); + setObjectRoom(INV_FLARE, 355); + setObjectRoom(INV_COBB_RAPP, 810); + setObjectRoom(INV_22_BULLET, 415); + setObjectRoom(INV_AUTO_RIFLE, 415); + setObjectRoom(INV_WIG, 415); + setObjectRoom(INV_FRANKIE_ID, 410); + setObjectRoom(INV_TYRONE_ID, 410); + setObjectRoom(INV_22_SNUB, 410); + setObjectRoom(INV_FBI_TELETYPE, 320); + setObjectRoom(INV_DA_NOTE, 320); + setObjectRoom(INV_PRINT_OUT, 570); + setObjectRoom(INV_WHAREHOUSE_KEYS, 360); + setObjectRoom(INV_CENTER_PUNCH, 0); + setObjectRoom(INV_TRANQ_GUN, 830); + setObjectRoom(INV_HOOK, 350); + setObjectRoom(INV_RAGS, 870); + setObjectRoom(INV_JAR, 870); + setObjectRoom(INV_SCREWDRIVER, 355); + setObjectRoom(INV_D_FLOPPY, 570); + setObjectRoom(INV_BLANK_DISK, 560); + setObjectRoom(INV_STICK, 710); + setObjectRoom(INV_CRATE1, 710); + setObjectRoom(INV_CRATE2, 870); + setObjectRoom(INV_SHOEBOX, 270); + setObjectRoom(INV_BADGE, 560); + setObjectRoom(INV_RENTAL_COUPON, 0); + setObjectRoom(INV_NICKEL, 560); + setObjectRoom(INV_LYLE_CARD, 270); + setObjectRoom(INV_CARTER_NOTE, 830); + setObjectRoom(INV_MUG_SHOT, 810); + setObjectRoom(INV_CLIPPING, 810); + setObjectRoom(INV_MICROFILM, 810); + setObjectRoom(INV_WAVE_KEYS, 840); + setObjectRoom(INV_RENTAL_KEYS, 840); + setObjectRoom(INV_NAPKIN, 115); + setObjectRoom(INV_DMV_PRINTOUT, 810); + setObjectRoom(INV_FISHING_NET, 830); + setObjectRoom(INV_9MM_BULLETS, 930); + setObjectRoom(INV_SCHEDULE, 930); + setObjectRoom(INV_GRENADES, 355); + setObjectRoom(INV_GREENS_KNIFE, 370); + setObjectRoom(INV_JACKET, 880); + setObjectRoom(INV_DOG_WHISTLE, 880); + setObjectRoom(INV_YELLOW_CORD, 910); + setObjectRoom(INV_BLACK_CORD, 910); +} + +void BlueForceInvObjectList::setObjectRoom(int objectNum, int sceneNumber) { + // Find the appropriate object + int num = objectNum; + SynchronizedList<InvObject *>::iterator i = _itemList.begin(); + while (num-- > 0) ++i; + (*i)->_sceneNumber = sceneNumber; + + // If the item is the currently active one, default back to the use cursor + if (BF_GLOBALS._events.getCursor() == objectNum) + BF_GLOBALS._events.setCursor(CURSOR_USE); + // Update the user interface if necessary + BF_GLOBALS._uiElements.updateInventory(); +} } // End of namespace BlueForce diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index 9de7add49d..5d2c3a7955 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -217,74 +217,78 @@ public: class BlueForceInvObjectList : public InvObjectList { public: - InvObject _business_card; - InvObject _lauras_sweater; + InvObject _none; + InvObject _colt45; + InvObject _ammoClip; + InvObject _spareClip; InvObject _handcuffs; - InvObject _magnum; - InvObject _ticket_book; - InvObject _miranda_card; - InvObject _forest_follet; - InvObject _bradford_id; - InvObject _baseball_card; - InvObject _slip_bradford; + InvObject _greensGun; + InvObject _ticketBook; + InvObject _mirandaCard; + InvObject _forestRap; + InvObject _greenId; + InvObject _baseballCard; + InvObject _bookingGreen; InvObject _flare; - InvObject _rap_sheet; - InvObject _cartridges; - InvObject _rifle; + InvObject _cobbRap; + InvObject _bullet22; + InvObject _autoRifle; InvObject _wig; - InvObject _frankies_id; - InvObject _tyrones_id; - InvObject _pistol22; - InvObject _unused; - InvObject _slip_frankie; - InvObject _slip_tyrone; - InvObject _atf_teletype; - InvObject _da_note; - InvObject _blueprints; - InvObject _planter_key; - InvObject _center_punch; - InvObject _tranquilizer; - InvObject _boat_hook; - InvObject _oily_rags; - InvObject _fuel_jar; + InvObject _frankieId; + InvObject _tyroneId; + InvObject _snub22; + InvObject _bug; + InvObject _bookingFrankie; + InvObject _bookingGang; + InvObject _fbiTeletype; + InvObject _daNote; + InvObject _printOut; + InvObject _warehouseKeys; + InvObject _centerPunch; + InvObject _tranqGun; + InvObject _hook; + InvObject _rags; + InvObject _jar; InvObject _screwdriver; - InvObject _floppy_disk1; - InvObject _floppy_disk2; - InvObject _driftwood; - InvObject _crate_piece1; - InvObject _crate_piece2; + InvObject _dFloppy; + InvObject _blankDisk; + InvObject _stick; + InvObject _crate1; + InvObject _crate2; InvObject _shoebox; InvObject _badge; - InvObject _unused2; - InvObject _rental_coupons; + InvObject _bug2; + InvObject _rentalCoupon; InvObject _nickel; - InvObject _calendar; - InvObject _dixon_note; - InvObject _cobb_mugshot; - InvObject _murder_article; - InvObject _microfiche; - InvObject _future_wave_keys; - InvObject _rental_boat_keys; + InvObject _lyleCard; + InvObject _carterNote; + InvObject _mugshot; + InvObject _clipping; + InvObject _microfilm; + InvObject _waveKeys; + InvObject _rentalKeys; InvObject _napkin; - InvObject _cobb_printout; - InvObject _fishing_net; + InvObject _dmvPrintout; + InvObject _fishingNet; InvObject _id; - InvObject _rounds_9mm; - InvObject _dates_note; - InvObject _hand_grenade; - InvObject _cord_110; - InvObject _cord_110_plug; - InvObject _cord_220; - InvObject _unused3; - InvObject _cord_220_plug; - InvObject _official_document; - InvObject _red_sweater; - InvObject _jackknife; - InvObject _whistle; - InvObject _gun; - InvObject _alley_cat_key; + InvObject _bullets9mm; + InvObject _schedule; + InvObject _grenades; + InvObject _yellowCord; + InvObject _halfYellowCord; + InvObject _blackCord; + InvObject _bug3; + InvObject _halfBlackCord; + InvObject _warrant; + InvObject _jacket; + InvObject _greensKnife; + InvObject _dogWhistle; + InvObject _ammoBelt; + InvObject _lastInvent; BlueForceInvObjectList(); + void reset(); + void setObjectRoom(int objectNum, int sceneNumber); virtual Common::String getClassName() { return "BlueForceInvObjectList"; } }; diff --git a/engines/tsage/blue_force/blueforce_ui.cpp b/engines/tsage/blue_force/blueforce_ui.cpp index 56c13572cc..42605b4c5f 100644 --- a/engines/tsage/blue_force/blueforce_ui.cpp +++ b/engines/tsage/blue_force/blueforce_ui.cpp @@ -21,6 +21,7 @@ */ #include "tsage/blue_force/blueforce_ui.h" +#include "tsage/blue_force/blueforce_dialogs.h" #include "tsage/blue_force/blueforce_logic.h" #include "tsage/tsage.h" #include "tsage/core.h" @@ -112,26 +113,35 @@ void UIScore::updateScore() { UIInventorySlot::UIInventorySlot(): UIElement() { _objIndex = 0; + _object = NULL; } void UIInventorySlot::synchronize(Serializer &s) { UIElement::synchronize(s); s.syncAsSint16LE(_objIndex); + SYNC_POINTER(_object); } void UIInventorySlot::process(Event &event) { if (event.eventType == EVENT_BUTTON_DOWN) { event.handled = true; - if (_objIndex == 66) { - // Handle showing gun and ammo - warning("TODO: show gun"); - } else if (_objIndex != 0) { - GLOBALS._events.setCursor((CursorType)_objIndex); + if (_objIndex == INV_AMMO_BELT) { + // Handle showing ammo belt + showAmmoBelt(); + + } else if (_objIndex != INV_NONE) { + _object->setCursor(); } } } +void UIInventorySlot::showAmmoBelt() { + AmmoBeltDialog *dlg = new AmmoBeltDialog(); + dlg->execute(); + delete dlg; +} + /*--------------------------------------------------------------------------*/ UIInventoryScroll::UIInventoryScroll() { @@ -155,7 +165,7 @@ void UIInventoryScroll::process(Event &event) { UICollection::UICollection(): EventHandler() { _clearScreen = false; _visible = false; - _field4E = 0; + _cursorChanged = false; } void UICollection::setup(const Common::Point &pt) { @@ -200,18 +210,46 @@ void UICollection::draw() { /*--------------------------------------------------------------------------*/ +UIElements::UIElements(): UICollection() { + _cursorVisage.setVisage(1, 5); +} + void UIElements::process(Event &event) { if (_clearScreen && BF_GLOBALS._player._enabled && (BF_GLOBALS._sceneManager._sceneNumber != 50)) { if (_bounds.contains(event.mousePos)) { + // Cursor inside UI area + if (!_cursorChanged) { + if (BF_GLOBALS._events.isInventoryIcon()) { + // Inventory icon being displayed, so leave alone + } else { + // Change to the inventory use cursor + GfxSurface surface = _cursorVisage.getFrame(6); + BF_GLOBALS._events.setCursor(surface); + } + _cursorChanged = true; + } + + // Pass event to any element that the cursor falls on + for (int idx = (int)_objList.size() - 1; idx >= 0; --idx) { + if (_objList[idx]->_bounds.contains(event.mousePos) && _objList[idx]->_enabled) { + _objList[idx]->process(event); + if (event.handled) + break; + } + } + + if (event.eventType == EVENT_BUTTON_DOWN) + event.handled = true; - } else if (_field4E) { - BF_GLOBALS._events.hideCursor(); - BF_GLOBALS._events.setCursor((CursorType)1); - _field4E = 0; + } else if (_cursorChanged) { + // Cursor outside UI area, so reset as necessary + BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor()); + _cursorChanged = false; SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; if (scene->_eventHandler) { - error("TODO: UIElements::process _eventHandler"); + GfxSurface surface = _cursorVisage.getFrame(7); + BF_GLOBALS._events.setCursor(surface); } } } @@ -313,12 +351,14 @@ void UIElements::updateInventory() { // Handle refreshing slot graphics UIInventorySlot *slotList[4] = { &_slot1, &_slot2, &_slot3, &_slot4 }; - + + // Loop through the inventory objects SynchronizedList<InvObject *>::iterator i; int objIndex = 0; for (i = BLUE_INVENTORY._itemList.begin(); i != BLUE_INVENTORY._itemList.end(); ++i, ++objIndex) { InvObject *obj = *i; + // Check whether the object is in any of the four inventory slots for (int slotIndex = 0; slotIndex < 4; ++slotIndex) { int idx = _slotStart + slotIndex; int objectIdx = (idx < (int)_itemList.size()) ? _itemList[idx] : 0; @@ -327,6 +367,7 @@ void UIElements::updateInventory() { UIInventorySlot *slot = slotList[slotIndex]; slot->_objIndex = objIndex; + slot->_object = obj; slot->setVisage(obj->_visage); slot->setStrip(obj->_strip); slot->setFrame(obj->_frame); @@ -334,6 +375,7 @@ void UIElements::updateInventory() { } } + // Refresh the display if necessary if (_active) draw(); } @@ -354,21 +396,6 @@ void UIElements::updateInvList() { } } -/** - * Updates an inventory slot with the item to be displayed - -void UIElements::updateInvSlot(UIInventorySlot *slot, int objIndex) { - slot->_objIndex = objIndex; - int itemId = (objIndex < (int)_itemList.size()) ? _itemList[objIndex] : 0; - InvObject *obj = BF_GLOBALS._inventory->_itemList[itemId + 2]; - - // TODO: Validate usage of fields - slot->setVisage(obj._displayResNum); - slot->setStrip(obj._rlbNum); - slot->setFrame(obj._cursorNum); -} -*/ - } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_ui.h b/engines/tsage/blue_force/blueforce_ui.h index 809701f83e..766f7dd6e5 100644 --- a/engines/tsage/blue_force/blueforce_ui.h +++ b/engines/tsage/blue_force/blueforce_ui.h @@ -69,8 +69,11 @@ public: }; class UIInventorySlot: public UIElement { +private: + void showAmmoBelt(); public: int _objIndex; + InvObject *_object; UIInventorySlot(); virtual Common::String getClassName() { return "UIInventorySlot"; } @@ -96,7 +99,7 @@ public: Rect _bounds; bool _visible; bool _clearScreen; - int _field4E; + bool _cursorChanged; Common::Array<UIElement *> _objList; UICollection(); @@ -110,7 +113,6 @@ public: class UIElements: public UICollection { private: void add(UIElement *obj); - void updateInventory(); void updateInvList(); public: UIElement _object1; @@ -122,11 +124,14 @@ public: int _itemCount, _slotStart, _scoreValue; bool _active; Common::Array<int> _itemList; + Visage _cursorVisage; + UIElements(); virtual void postInit(SceneObjectList *OwnerList = NULL) { error("Wrong init() called"); } virtual void process(Event &event); void setup(const Common::Point &pt); + void updateInventory(); }; } // End of namespace BlueForce |