aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2011-10-24 21:45:08 +1100
committerPaul Gilbert2011-10-24 21:45:08 +1100
commit8b66b16c0e352c945474afe46980ed54e1aaf389 (patch)
tree3914c984b8c86fcc0b234226217955322de23659 /engines
parent364bc272250743aad8b96039fe1979df4e599db8 (diff)
downloadscummvm-rg350-8b66b16c0e352c945474afe46980ed54e1aaf389.tar.gz
scummvm-rg350-8b66b16c0e352c945474afe46980ed54e1aaf389.tar.bz2
scummvm-rg350-8b66b16c0e352c945474afe46980ed54e1aaf389.zip
TSAGE: Further work on standardising user interface for use in Blue Force and Return to Ringworld
Diffstat (limited to 'engines')
-rw-r--r--engines/tsage/core.cpp2
-rw-r--r--engines/tsage/globals.cpp13
-rw-r--r--engines/tsage/globals.h7
-rw-r--r--engines/tsage/user_interface.cpp33
4 files changed, 33 insertions, 22 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index a56b30ad4d..59027e68c9 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -71,7 +71,7 @@ InvObject::InvObject(int strip, int frame) {
_strip = strip;
_frame = frame;
- _visage = 0;
+ _visage = 7;
_sceneNumber = 0;
_iconResNum = 10;
}
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index 7711e7fba7..4bcee21b23 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -205,6 +205,12 @@ void TsAGE2Globals::reset() {
T2_GLOBALS._uiElements._active = false;
}
+void TsAGE2Globals::synchronize(Serializer &s) {
+ Globals::synchronize(s);
+
+ s.syncAsSint16LE(_interfaceY);
+}
+
/*--------------------------------------------------------------------------*/
namespace BlueForce {
@@ -213,7 +219,7 @@ BlueForceGlobals::BlueForceGlobals(): TsAGE2Globals() {
}
void BlueForceGlobals::synchronize(Serializer &s) {
- Globals::synchronize(s);
+ TsAGE2Globals::synchronize(s);
s.syncAsSint16LE(_dayNumber);
s.syncAsSint16LE(_v4CEA4);
@@ -252,7 +258,6 @@ void BlueForceGlobals::synchronize(Serializer &s) {
s.syncAsSint16LE(_v50CC8);
s.syncAsSint16LE(_v51C42);
s.syncAsSint16LE(_v51C44);
- s.syncAsSint16LE(_interfaceY);
s.syncAsSint16LE(_bookmark);
s.syncAsSint16LE(_mapLocationId);
s.syncAsSint16LE(_clip1Bullets);
@@ -361,7 +366,9 @@ void Ringworld2Globals::reset() {
T2_GLOBALS._uiElements._active = false;
}
-
+void Ringworld2Globals::synchronize(Serializer &s) {
+ TsAGE2Globals::synchronize(s);
+}
} // end of namespace Ringworld2
diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h
index a5293a5ad1..1e50c08f56 100644
--- a/engines/tsage/globals.h
+++ b/engines/tsage/globals.h
@@ -108,9 +108,11 @@ public:
UIElements _uiElements;
SelectItemProc _onSelectItem;
int _interfaceY;
+ ASoundExt _inventorySound;
TsAGE2Globals() { _onSelectItem = NULL; }
virtual void reset();
+ virtual void synchronize(Serializer &s);
};
extern Globals *g_globals;
@@ -182,7 +184,7 @@ enum Flag {
class BlueForceGlobals: public TsAGE2Globals {
public:
- ASoundExt _sound1, _sound2, _sound3;
+ ASoundExt _sound1, _sound3;
StripProxy _stripProxy;
int _dayNumber;
int _v4CEA4;
@@ -228,8 +230,8 @@ public:
bool getHasBullets();
virtual Common::String getClassName() { return "BFGlobals"; }
- virtual void synchronize(Serializer &s);
virtual void reset();
+ virtual void synchronize(Serializer &s);
void set2Flags(int flagNum);
bool removeFlag(int flagNum);
};
@@ -243,6 +245,7 @@ public:
ASoundExt _sound1, _sound2, _sound3, _sound4;
virtual void reset();
+ virtual void synchronize(Serializer &s);
};
} // End of namespace Ringworld2
diff --git a/engines/tsage/user_interface.cpp b/engines/tsage/user_interface.cpp
index b7f96b3806..9e7db8f87b 100644
--- a/engines/tsage/user_interface.cpp
+++ b/engines/tsage/user_interface.cpp
@@ -25,6 +25,7 @@
#include "tsage/tsage.h"
#include "tsage/blue_force/blueforce_dialogs.h"
#include "tsage/blue_force/blueforce_logic.h"
+#include "tsage/ringworld2/ringworld2_logic.h"
namespace TsAGE {
@@ -96,16 +97,16 @@ void UIQuestion::showItem(int resNum, int rlbNum, int frameNum) {
imgRect.center(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);
// Save the area behind where the image will be displayed
- GfxSurface *savedArea = Surface_getArea(BF_GLOBALS.gfxManager().getSurface(), imgRect);
+ GfxSurface *savedArea = Surface_getArea(GLOBALS.gfxManager().getSurface(), imgRect);
// Draw the image
- BF_GLOBALS.gfxManager().copyFrom(objImage, imgRect);
+ GLOBALS.gfxManager().copyFrom(objImage, imgRect);
// Wait for a press
- BF_GLOBALS._events.waitForPress();
+ GLOBALS._events.waitForPress();
// Restore the old area
- BF_GLOBALS.gfxManager().copyFrom(*savedArea, imgRect);
+ GLOBALS.gfxManager().copyFrom(*savedArea, imgRect);
delete savedArea;
}
@@ -232,8 +233,8 @@ void UICollection::show() {
void UICollection::erase() {
if (_clearScreen) {
Rect tempRect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT);
- BF_GLOBALS._screenSurface.fillRect(tempRect, 0);
- BF_GLOBALS._sceneManager._scene->_backSurface.fillRect(tempRect, 0);
+ GLOBALS._screenSurface.fillRect(tempRect, 0);
+ GLOBALS._sceneManager._scene->_backSurface.fillRect(tempRect, 0);
_clearScreen = false;
}
}
@@ -253,7 +254,7 @@ void UICollection::draw() {
_objList[idx]->draw();
// Draw the resulting UI onto the screen
- BF_GLOBALS._screenSurface.copyFrom(BF_GLOBALS._sceneManager._scene->_backSurface,
+ GLOBALS._screenSurface.copyFrom(GLOBALS._sceneManager._scene->_backSurface,
Rect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT),
Rect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT));
@@ -301,16 +302,16 @@ void UIElements::synchronize(Serializer &s) {
}
void UIElements::process(Event &event) {
- if (_clearScreen && BF_GLOBALS._player._enabled && (BF_GLOBALS._sceneManager._sceneNumber != 50)) {
+ if (_clearScreen && GLOBALS._player._enabled && (GLOBALS._sceneManager._sceneNumber != 50)) {
if (_bounds.contains(event.mousePos)) {
// Cursor inside UI area
if (!_cursorChanged) {
- if (BF_GLOBALS._events.isInventoryIcon()) {
+ if (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);
+ GLOBALS._events.setCursor(surface);
}
_cursorChanged = true;
}
@@ -329,13 +330,13 @@ void UIElements::process(Event &event) {
} else if (_cursorChanged) {
// Cursor outside UI area, so reset as necessary
- BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor());
+ GLOBALS._events.setCursor(GLOBALS._events.getCursor());
_cursorChanged = false;
/*
- SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene;
+ SceneExt *scene = (SceneExt *)GLOBALS._sceneManager._scene;
if (scene->_focusObject) {
GfxSurface surface = _cursorVisage.getFrame(7);
- BF_GLOBALS._events.setCursor(surface);
+ GLOBALS._events.setCursor(surface);
}
*/
}
@@ -459,7 +460,7 @@ void UIElements::updateInventory() {
// Loop through the inventory objects
SynchronizedList<InvObject *>::iterator i;
int objIndex = 0;
- for (i = BF_INVENTORY._itemList.begin(); i != BF_INVENTORY._itemList.end(); ++i, ++objIndex) {
+ for (i = GLOBALS._inventory->_itemList.begin(); i != GLOBALS._inventory->_itemList.end(); ++i, ++objIndex) {
InvObject *obj = *i;
// Check whether the object is in any of the four inventory slots
@@ -493,7 +494,7 @@ void UIElements::updateInvList() {
SynchronizedList<InvObject *>::iterator i;
int itemIndex = 0;
- for (i = BF_GLOBALS._inventory->_itemList.begin(); i != BF_GLOBALS._inventory->_itemList.end(); ++i, ++itemIndex) {
+ for (i = GLOBALS._inventory->_itemList.begin(); i != GLOBALS._inventory->_itemList.end(); ++i, ++itemIndex) {
InvObject *invObject = *i;
if (invObject->inInventory())
_itemList.push_back(itemIndex);
@@ -505,7 +506,7 @@ void UIElements::updateInvList() {
*/
void UIElements::addScore(int amount) {
_scoreValue += amount;
- BF_GLOBALS._sound2.play(0);
+ T2_GLOBALS._inventorySound.play(0);
updateInventory();
}