[Scummvm-cvs-logs] scummvm master -> b893f9f93f58413bd45daec5d4b88a0ca4bb5db1

dreammaster dreammaster at scummvm.org
Sun Sep 4 11:19:14 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b893f9f93f TSAGE: Implemented missing interface functionality, including gun loading dialog


Commit: b893f9f93f58413bd45daec5d4b88a0ca4bb5db1
    https://github.com/scummvm/scummvm/commit/b893f9f93f58413bd45daec5d4b88a0ca4bb5db1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-09-04T02:11:59-07:00

Commit Message:
TSAGE: Implemented missing interface functionality, including gun loading dialog

Changed paths:
    engines/tsage/blue_force/blueforce_dialogs.cpp
    engines/tsage/blue_force/blueforce_dialogs.h
    engines/tsage/blue_force/blueforce_logic.cpp
    engines/tsage/blue_force/blueforce_logic.h
    engines/tsage/blue_force/blueforce_ui.cpp
    engines/tsage/blue_force/blueforce_ui.h
    engines/tsage/core.cpp
    engines/tsage/core.h
    engines/tsage/events.cpp
    engines/tsage/events.h
    engines/tsage/globals.cpp
    engines/tsage/globals.h
    engines/tsage/tsage.cpp



diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp
index ec99df8..be72b78 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 1ead39a..0fee0eb 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 31ebab3..3eafac7 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 9de7add..5d2c3a7 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 56c1357..42605b4 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 809701f..766f7dd 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
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index 10d2663..4dc4c72 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -55,21 +55,30 @@ InvObject::InvObject(int sceneNumber, int rlbNum, int cursorNum, CursorType curs
 	DEALLOCATE(imgData);
 }
 
-InvObject::InvObject(int visage, int strip, int frame, int sceneNumber) {
+InvObject::InvObject(int visage, int strip, int frame) {
+	assert(_vm->getGameID() == GType_BlueForce);
 	_visage = visage;
 	_strip = strip;
 	_frame = frame;
-	_sceneNumber = sceneNumber;
+	_sceneNumber = 0;
+	_iconResNum = 10;
 }
 
 void InvObject::setCursor() {
-	_globals->_events._currentCursor = _cursorId;
+	if (_vm->getGameID() == GType_BlueForce) {
+		// Blue Force cursor handling
+		_cursorId = (CursorType)BF_GLOBALS._inventory->indexOf(this);
+		_globals->_events.setCursor(_cursorId);
+	} else {
+		// Ringworld cursor handling
+		_globals->_events._currentCursor = _cursorId;
 
-	if (_iconResNum != -1) {
-		GfxSurface s = surfaceFromRes(_iconResNum, _rlbNum, _cursorNum);
+		if (_iconResNum != -1) {
+			GfxSurface s = surfaceFromRes(_iconResNum, _rlbNum, _cursorNum);
 
-		Graphics::Surface src = s.lockSurface();
-		_globals->_events.setCursor(src, s._transColor, s._centroid, _cursorId);
+			Graphics::Surface src = s.lockSurface();
+			_globals->_events.setCursor(src, s._transColor, s._centroid, _cursorId);
+		}
 	}
 }
 
@@ -84,6 +93,18 @@ void InvObjectList::synchronize(Serializer &s) {
 	SYNC_POINTER(_selectedItem);
 }
 
+int InvObjectList::indexOf(InvObject *obj) const {
+	int idx = 0;
+	SynchronizedList<InvObject *>::const_iterator i;
+	
+	for (i = _itemList.begin(); i != _itemList.end(); ++i, ++idx) {
+		if ((*i) == obj)
+			return idx;
+	}
+
+	return -1;
+}
+
 /*--------------------------------------------------------------------------*/
 
 void EventHandler::dispatch() {
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index 13761ce..ede1bfc 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -61,7 +61,7 @@ public:
 	int _frame;
 public:
 	InvObject(int sceneNumber, int rlbNum, int cursorNum, CursorType cursorId, const Common::String description);
-	InvObject(int visage, int strip, int frame, int sceneNumber);
+	InvObject(int visage, int strip, int frame);
 
 	bool inInventory() const { return _sceneNumber == 1; }
 	void setCursor();
@@ -78,6 +78,7 @@ public:
 	InvObject *_selectedItem;
 
 	InvObjectList();
+	int indexOf(InvObject *obj) const;
 
 	virtual Common::String getClassName() { return "InvObjectList"; }
 	virtual void synchronize(Serializer &s);
diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp
index 6bda6c9..00c200e 100644
--- a/engines/tsage/events.cpp
+++ b/engines/tsage/events.cpp
@@ -149,6 +149,7 @@ void EventsClass::setCursor(CursorType cursorType) {
 	const byte *cursor;
 	bool delFlag = true;
 	uint size;
+	bool questionEnabled = false;
 
 	switch (cursorType) {
 	case CURSOR_NONE:
@@ -191,6 +192,13 @@ void EventsClass::setCursor(CursorType cursorType) {
 		_currentCursor = CURSOR_TALK;
 		break;
 
+	case CURSOR_EXIT:
+		// Exit cursor (Blue Force)
+		assert(_vm->getGameID() == GType_BlueForce);
+		cursor = _resourceManager->getSubResource(1, 5, 7, &size);
+		_currentCursor = CURSOR_TALK;
+		break;
+
 	case CURSOR_ARROW:
 		// Arrow cursor
 		cursor = CURSOR_ARROW_DATA;
@@ -199,14 +207,22 @@ void EventsClass::setCursor(CursorType cursorType) {
 
 	case CURSOR_WALK:
 	default:
-		// Walk cursor
 		if (_vm->getGameID() == GType_BlueForce) {
-			cursor = _resourceManager->getSubResource(1, 5, 1, &size);
+			if (cursorType == CURSOR_WALK) {
+				cursor = _resourceManager->getSubResource(1, 5, 1, &size);
+			} else {
+				// Inventory icon
+				cursor = _resourceManager->getSubResource(10, ((int)cursorType - 1) / 20 + 1, 
+					((int)cursorType - 1) % 20 + 1, &size);
+				questionEnabled = true;
+			}
+			_currentCursor = cursorType;
 		} else {
+			// For Ringworld, always treat as the walk cursor
 			cursor = CURSOR_WALK_DATA;
+			_currentCursor = CURSOR_WALK;
 			delFlag = false;
 		}
-		_currentCursor = CURSOR_WALK;
 		break;
 	}
 
@@ -220,6 +236,10 @@ void EventsClass::setCursor(CursorType cursorType) {
 
 	if (delFlag)
 		DEALLOCATE(cursor);
+
+	// For Blue Force, enable the question button when an inventory icon is selected
+	if (_vm->getGameID() == GType_BlueForce)
+		BF_GLOBALS._uiElements._question.setEnabled(questionEnabled);
 }
 
 void EventsClass::pushCursor(CursorType cursorType) {
diff --git a/engines/tsage/events.h b/engines/tsage/events.h
index db19410..d23e9db 100644
--- a/engines/tsage/events.h
+++ b/engines/tsage/events.h
@@ -54,6 +54,7 @@ public:
 };
 
 enum CursorType {
+	// Ringworld objects
 	OBJECT_STUNNER = 0, OBJECT_SCANNER = 1, OBJECT_STASIS_BOX = 2,
 	OBJECT_INFODISK = 3, OBJECT_STASIS_NEGATOR = 4, OBJECT_KEY_DEVICE = 5, OBJECT_MEDKIT = 6,
 	OBJECT_LADDER = 7, OBJECT_ROPE = 8, OBJECT_KEY = 9, OBJECT_TRANSLATOR = 10, OBJECT_ALE = 11,
@@ -63,7 +64,26 @@ enum CursorType {
 	OBJECT_NULLIFIER = 25, OBJECT_PEG = 26, OBJECT_VIAL = 27, OBJECT_JACKET = 28,
 	OBJECT_TUNIC2 = 29, OBJECT_BONE = 30, OBJECT_EMPTY_JAR = 31, OBJECT_JAR = 32,
 
+	// Blue Force objects
+	INV_NONE = 0, INV_COLT45 = 1, INV_AMMO_CLIP = 2, INV_SPARE_CLIP = 3, INV_HANDCUFFS = 4, 
+	INV_GREENS_GUN = 5,	INV_TICKET_BOOK = 6, INV_MIRANDA_CARD = 7, INV_FOREST_RAP = 8, 
+	INV_GREEN_ID = 9, INV_BASEBALL_CARD = 10, INV_BOOKING_GREEN = 11, INV_FLARE = 12, 
+	INV_COBB_RAPP = 13, INV_22_BULLET = 14, INV_AUTO_RIFLE = 15, INV_WIG = 16, INV_FRANKIE_ID = 17,
+	INV_TYRONE_ID = 18, INV_22_SNUB = 19, INV_BOOKING_FRANKIE = 21, INV_BOOKING_GANG = 22,
+	INV_FBI_TELETYPE = 23, INV_DA_NOTE = 24, INV_PRINT_OUT = 25, INV_WHAREHOUSE_KEYS = 26,
+	INV_CENTER_PUNCH = 27, INV_TRANQ_GUN = 28, INV_HOOK = 29, INV_RAGS = 30, INV_JAR = 31,
+	INV_SCREWDRIVER = 32, INV_D_FLOPPY = 33, INV_BLANK_DISK = 34, INV_STICK = 35,
+	INV_CRATE1 = 36, INV_CRATE2 = 37, INV_SHOEBOX = 38, INV_BADGE = 39, INV_RENTAL_COUPON = 41,
+	INV_NICKEL = 42, INV_LYLE_CARD = 43, INV_CARTER_NOTE = 44, INV_MUG_SHOT = 45, 
+	INV_CLIPPING = 46, INV_MICROFILM  = 47, INV_WAVE_KEYS = 48,	INV_RENTAL_KEYS = 49, 
+	INV_NAPKIN = 50, INV_DMV_PRINTOUT = 51, INV_FISHING_NET = 52, INV_ID = 53, 
+	INV_9MM_BULLETS = 54, INV_SCHEDULE = 55, INV_GRENADES = 56, INV_YELLOW_CORD = 57,
+	INV_HALF_YELLOW_CORD = 58, INV_BLACK_CORD = 59, INV_HALF_BLACK_CORD = 61, INV_WARRANT = 62,
+	INV_JACKET = 63, INV_GREENS_KNIFE = 64, INV_DOG_WHISTLE = 65, INV_AMMO_BELT = 66,
+
+	// Cursors
 	CURSOR_WALK = 0x100, CURSOR_LOOK = 0x200, CURSOR_700 = 700, CURSOR_USE = 0x400, CURSOR_TALK = 0x800,
+	CURSOR_1000 = 0x1000, CURSOR_EXIT = 0x7004,
 	CURSOR_NONE = -1, CURSOR_CROSSHAIRS = -2, CURSOR_ARROW = -3
 };
 
@@ -101,6 +121,7 @@ public:
 	Common::EventType type() { return _event.type; }
 	uint32 getFrameNumber() const { return _frameNumber; }
 	void delay(int numFrames);
+	bool isInventoryIcon() const { return _currentCursor < 256; }
 
 	virtual void listenerSynchronize(Serializer &s);
 	static void loadNotifierProc(bool postFlag);
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index ebad77a..9d48fa5 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -184,26 +184,42 @@ void Globals::dispatchSounds() {
 namespace BlueForce {
 
 BlueForceGlobals::BlueForceGlobals(): Globals() {
+}
+
+void BlueForceGlobals::synchronize(Serializer &s) {
+	Globals::synchronize(s);
+	error("Sync variables");
+}
+
+void BlueForceGlobals::reset() {
+	Globals::reset();
+	_scenePalette.clearListeners();
+	
+	_scrollFollower = &_player;
+	_bookmark = bNone;
+
+	// Reset the inventory
+	((BlueForceInvObjectList *)_inventory)->reset();
+	BF_GLOBALS._uiElements.updateInventory();
+	BF_GLOBALS._uiElements._scoreValue = 0;
+
+	_mapLocationId = 1;
+	_driveFromScene = 300;
+	_driveToScene = 0;
+
 	_interfaceY = 0;
 	_v51C44 = 1;
-	_dayNumber = 1;
+	_dayNumber = 0;
 	_v4CEA4 = 0;
 	_v4CEA8 = 0;
 	_v4CEB8 = 0;
 	_v4CEBA = 0;
-	_driveFromScene = 0;
-	_driveToScene = 0;
 	_v4CF9E = 0;
 	_v4E238 = 0;
 	_v501FC = 0;
 	_v51C42 = 0;
-	_bookmark = bNone;
-	_mapLocationId = 1;
-}
-
-void BlueForceGlobals::synchronize(Serializer &s) {
-	Globals::synchronize(s);
-	error("Sync variables");
+	_clip1Frame = 8;
+	_clip2Frame = 8;
 }
 
 } // end of namespace BlueForce
diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h
index dda95a9..c8eb21a 100644
--- a/engines/tsage/globals.h
+++ b/engines/tsage/globals.h
@@ -181,8 +181,11 @@ public:
 	int _interfaceY;
 	Bookmark _bookmark;
 	int _mapLocationId;
+	int _clip1Frame, _clip2Frame;
 
 	BlueForceGlobals();
+	void reset();
+
 	virtual Common::String getClassName() { return "BFGlobals"; }
 	virtual void synchronize(Serializer &s);
 };
diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp
index 2fcabff..ca63c4c 100644
--- a/engines/tsage/tsage.cpp
+++ b/engines/tsage/tsage.cpp
@@ -82,6 +82,12 @@ void TSageEngine::initialize() {
 			_resourceManager->addLib("TSAGE.RLB");
 		}
 		_globals = new BlueForce::BlueForceGlobals();
+		
+		// Setup the user interface
+		BF_GLOBALS._uiElements.setup(Common::Point(0, BF_INTERFACE_Y - 2));
+
+		// Reset all global variables
+		BF_GLOBALS.reset();
 	}
 
 	_globals->gfxManager().setDefaults();






More information about the Scummvm-git-logs mailing list