TSAGE: Added 'g' prefix to global variables
This commit is contained in:
parent
edd1ebb820
commit
f99e904f9a
35 changed files with 4198 additions and 4198 deletions
|
@ -66,10 +66,10 @@ RightClickDialog::RightClickDialog() : GfxDialog() {
|
||||||
// Set the dialog position
|
// Set the dialog position
|
||||||
Rect dialogRect;
|
Rect dialogRect;
|
||||||
dialogRect.resize(_surface, 0, 0, 100);
|
dialogRect.resize(_surface, 0, 0, 100);
|
||||||
dialogRect.center(_globals->_events._mousePos.x, _globals->_events._mousePos.y);
|
dialogRect.center(g_globals->_events._mousePos.x, g_globals->_events._mousePos.y);
|
||||||
|
|
||||||
// Ensure the dialog will be entirely on-screen
|
// Ensure the dialog will be entirely on-screen
|
||||||
Rect screenRect = _globals->gfxManager()._bounds;
|
Rect screenRect = g_globals->gfxManager()._bounds;
|
||||||
screenRect.collapse(4, 4);
|
screenRect.collapse(4, 4);
|
||||||
dialogRect.contain(screenRect);
|
dialogRect.contain(screenRect);
|
||||||
|
|
||||||
|
@ -88,10 +88,10 @@ RightClickDialog::~RightClickDialog() {
|
||||||
|
|
||||||
void RightClickDialog::draw() {
|
void RightClickDialog::draw() {
|
||||||
// Save the covered background area
|
// Save the covered background area
|
||||||
_savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds);
|
_savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
|
||||||
|
|
||||||
// Draw the dialog image
|
// Draw the dialog image
|
||||||
_globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top);
|
g_globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top);
|
||||||
|
|
||||||
// Pre-process rect lists
|
// Pre-process rect lists
|
||||||
for (int idx = 0; idx < 5; ++idx) {
|
for (int idx = 0; idx < 5; ++idx) {
|
||||||
|
@ -153,9 +153,9 @@ void RightClickDialog::execute() {
|
||||||
// Dialog event handler loop
|
// Dialog event handler loop
|
||||||
_gfxManager.activate();
|
_gfxManager.activate();
|
||||||
|
|
||||||
while (!_vm->shouldQuit() && (_selectedAction == -1)) {
|
while (!g_vm->shouldQuit() && (_selectedAction == -1)) {
|
||||||
Event evt;
|
Event evt;
|
||||||
while (_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) {
|
while (g_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) {
|
||||||
evt.mousePos.x -= _bounds.left;
|
evt.mousePos.x -= _bounds.left;
|
||||||
evt.mousePos.y -= _bounds.top;
|
evt.mousePos.y -= _bounds.top;
|
||||||
|
|
||||||
|
@ -232,9 +232,9 @@ void AmmoBeltDialog::execute() {
|
||||||
// Dialog event handler loop
|
// Dialog event handler loop
|
||||||
_gfxManager.activate();
|
_gfxManager.activate();
|
||||||
|
|
||||||
while (!_vm->shouldQuit() && !_closeFlag) {
|
while (!g_vm->shouldQuit() && !_closeFlag) {
|
||||||
Event evt;
|
Event evt;
|
||||||
while (_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) {
|
while (g_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) {
|
||||||
evt.mousePos.x -= _bounds.left;
|
evt.mousePos.x -= _bounds.left;
|
||||||
evt.mousePos.y -= _bounds.top;
|
evt.mousePos.y -= _bounds.top;
|
||||||
|
|
||||||
|
@ -321,13 +321,13 @@ void AmmoBeltDialog::draw() {
|
||||||
|
|
||||||
if (!_savedArea) {
|
if (!_savedArea) {
|
||||||
// Save the covered background area
|
// Save the covered background area
|
||||||
_savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds);
|
_savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
|
||||||
} else {
|
} else {
|
||||||
bounds.moveTo(0, 0);
|
bounds.moveTo(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the dialog image
|
// Draw the dialog image
|
||||||
_globals->gfxManager().copyFrom(_surface, bounds.left, bounds.top);
|
g_globals->gfxManager().copyFrom(_surface, bounds.left, bounds.top);
|
||||||
|
|
||||||
// Setup clip flags
|
// Setup clip flags
|
||||||
bool clip1 = true, clip2 = true;
|
bool clip1 = true, clip2 = true;
|
||||||
|
@ -344,7 +344,7 @@ void AmmoBeltDialog::draw() {
|
||||||
if (clip1) {
|
if (clip1) {
|
||||||
GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip1Bullets);
|
GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip1Bullets);
|
||||||
_clip1Rect.resize(clipSurface, _clip1Rect.left, _clip1Rect.top, 100);
|
_clip1Rect.resize(clipSurface, _clip1Rect.left, _clip1Rect.top, 100);
|
||||||
_globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip1Rect.left,
|
g_globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip1Rect.left,
|
||||||
bounds.top + _clip1Rect.top);
|
bounds.top + _clip1Rect.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ void AmmoBeltDialog::draw() {
|
||||||
if (clip2) {
|
if (clip2) {
|
||||||
GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip2Bullets);
|
GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip2Bullets);
|
||||||
_clip2Rect.resize(clipSurface, _clip2Rect.left, _clip2Rect.top, 100);
|
_clip2Rect.resize(clipSurface, _clip2Rect.left, _clip2Rect.top, 100);
|
||||||
_globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip2Rect.left,
|
g_globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip2Rect.left,
|
||||||
bounds.top + _clip2Rect.top);
|
bounds.top + _clip2Rect.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ void AmmoBeltDialog::draw() {
|
||||||
if (gunLoaded) {
|
if (gunLoaded) {
|
||||||
GfxSurface loadedSurface = surfaceFromRes(9, 7, 1);
|
GfxSurface loadedSurface = surfaceFromRes(9, 7, 1);
|
||||||
_loadedRect.resize(loadedSurface, _loadedRect.left, _loadedRect.top, 100);
|
_loadedRect.resize(loadedSurface, _loadedRect.left, _loadedRect.top, 100);
|
||||||
_globals->gfxManager().copyFrom(loadedSurface, bounds.left + _loadedRect.left,
|
g_globals->gfxManager().copyFrom(loadedSurface, bounds.left + _loadedRect.left,
|
||||||
bounds.top + _loadedRect.top);
|
bounds.top + _loadedRect.top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,9 +43,9 @@ namespace BlueForce {
|
||||||
|
|
||||||
void BlueForceGame::start() {
|
void BlueForceGame::start() {
|
||||||
// Start the game
|
// Start the game
|
||||||
_globals->_sceneManager.changeScene(300);
|
g_globals->_sceneManager.changeScene(300);
|
||||||
|
|
||||||
_globals->_events.setCursor(CURSOR_WALK);
|
g_globals->_events.setCursor(CURSOR_WALK);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scene *BlueForceGame::createScene(int sceneNumber) {
|
Scene *BlueForceGame::createScene(int sceneNumber) {
|
||||||
|
@ -240,20 +240,20 @@ void BlueForceGame::processEvent(Event &event) {
|
||||||
case Common::KEYCODE_F4:
|
case Common::KEYCODE_F4:
|
||||||
// F4 - Restart
|
// F4 - Restart
|
||||||
restartGame();
|
restartGame();
|
||||||
_globals->_events.setCursorFromFlag();
|
g_globals->_events.setCursorFromFlag();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Common::KEYCODE_F7:
|
case Common::KEYCODE_F7:
|
||||||
// F7 - Restore
|
// F7 - Restore
|
||||||
restoreGame();
|
restoreGame();
|
||||||
_globals->_events.setCursorFromFlag();
|
g_globals->_events.setCursorFromFlag();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Common::KEYCODE_F10:
|
case Common::KEYCODE_F10:
|
||||||
// F10 - Pause
|
// F10 - Pause
|
||||||
GfxDialog::setPalette();
|
GfxDialog::setPalette();
|
||||||
MessageDialog::show(GAME_PAUSED_MSG, OK_BTN_STRING);
|
MessageDialog::show(GAME_PAUSED_MSG, OK_BTN_STRING);
|
||||||
_globals->_events.setCursorFromFlag();
|
g_globals->_events.setCursorFromFlag();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -470,16 +470,16 @@ void NamedObject::setDetails(int resNum, int lookLineNum, int talkLineNum, int u
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 2:
|
case 2:
|
||||||
_globals->_sceneItems.push_front(this);
|
g_globals->_sceneItems.push_front(this);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
_globals->_sceneItems.addBefore(item, this);
|
g_globals->_sceneItems.addBefore(item, this);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
_globals->_sceneItems.addAfter(item, this);
|
g_globals->_sceneItems.addAfter(item, this);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_globals->_sceneItems.push_back(this);
|
g_globals->_sceneItems.push_back(this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace BlueForce {
|
||||||
|
|
||||||
using namespace TsAGE;
|
using namespace TsAGE;
|
||||||
|
|
||||||
#define BF_INVENTORY (*((::TsAGE::BlueForce::BlueForceInvObjectList *)_globals->_inventory))
|
#define BF_INVENTORY (*((::TsAGE::BlueForce::BlueForceInvObjectList *)g_globals->_inventory))
|
||||||
|
|
||||||
class BlueForceGame: public Game {
|
class BlueForceGame: public Game {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -56,9 +56,9 @@ void Scene100::Action1::signal() {
|
||||||
setDelay(6);
|
setDelay(6);
|
||||||
break;
|
break;
|
||||||
case 1: {
|
case 1: {
|
||||||
Common::String msg1 = _resourceManager->getMessage(100, _state++);
|
Common::String msg1 = g_resourceManager->getMessage(100, _state++);
|
||||||
if (msg1.compareTo("LASTCREDIT")) {
|
if (msg1.compareTo("LASTCREDIT")) {
|
||||||
Common::String msg2 = _resourceManager->getMessage(100, _state++);
|
Common::String msg2 = g_resourceManager->getMessage(100, _state++);
|
||||||
setTextStrings(msg1, msg2, this);
|
setTextStrings(msg1, msg2, this);
|
||||||
--_actionIndex;
|
--_actionIndex;
|
||||||
} else {
|
} else {
|
||||||
|
@ -121,7 +121,7 @@ void Scene100::Action1::setTextStrings(const Common::String &msg1, const Common:
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene100::Action2::signal() {
|
void Scene100::Action2::signal() {
|
||||||
Scene100 *scene = (Scene100 *)_globals->_sceneManager._scene;
|
Scene100 *scene = (Scene100 *)g_globals->_sceneManager._scene;
|
||||||
static byte black[3] = {0, 0, 0};
|
static byte black[3] = {0, 0, 0};
|
||||||
|
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
|
@ -139,7 +139,7 @@ void Scene100::Action2::signal() {
|
||||||
ConfMan.flushToDisk();
|
ConfMan.flushToDisk();
|
||||||
} else {
|
} else {
|
||||||
// Prompt user for whether to start play or watch introduction
|
// Prompt user for whether to start play or watch introduction
|
||||||
_globals->_player.enableControl();
|
g_globals->_player.enableControl();
|
||||||
|
|
||||||
if (MessageDialog::show2(WATCH_INTRO_MSG, START_PLAY_BTN_STRING, INTRODUCTION_BTN_STRING) == 0) {
|
if (MessageDialog::show2(WATCH_INTRO_MSG, START_PLAY_BTN_STRING, INTRODUCTION_BTN_STRING) == 0) {
|
||||||
// Signal to start the game
|
// Signal to start the game
|
||||||
|
@ -150,7 +150,7 @@ void Scene100::Action2::signal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point the introduction needs to start
|
// At this point the introduction needs to start
|
||||||
_globals->_scenePalette.addFader(black, 1, 2, this);
|
g_globals->_scenePalette.addFader(black, 1, 2, this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -178,9 +178,9 @@ void Scene100::postInit(SceneObjectList *OwnerList) {
|
||||||
BF_GLOBALS._v51C44 = 1;
|
BF_GLOBALS._v51C44 = 1;
|
||||||
BF_GLOBALS._interfaceY = SCREEN_HEIGHT;
|
BF_GLOBALS._interfaceY = SCREEN_HEIGHT;
|
||||||
|
|
||||||
_globals->_player.postInit();
|
g_globals->_player.postInit();
|
||||||
_globals->_player.hide();
|
g_globals->_player.hide();
|
||||||
_globals->_player.disableControl();
|
g_globals->_player.disableControl();
|
||||||
_index = 109;
|
_index = 109;
|
||||||
|
|
||||||
if (BF_GLOBALS._dayNumber < 6) {
|
if (BF_GLOBALS._dayNumber < 6) {
|
||||||
|
|
|
@ -355,7 +355,7 @@ void Scene666::signal() {
|
||||||
_text._fontNumber = 4;
|
_text._fontNumber = 4;
|
||||||
_text._width = 150;
|
_text._width = 150;
|
||||||
|
|
||||||
Common::String msg = _resourceManager->getMessage(666, BF_GLOBALS._deathReason);
|
Common::String msg = g_resourceManager->getMessage(666, BF_GLOBALS._deathReason);
|
||||||
sceneBounds = BF_GLOBALS._sceneManager._scene->_sceneBounds;
|
sceneBounds = BF_GLOBALS._sceneManager._scene->_sceneBounds;
|
||||||
sceneBounds.collapse(4, 2);
|
sceneBounds.collapse(4, 2);
|
||||||
BF_GLOBALS.gfxManager()._font.getStringBounds(msg.c_str(), textRect, _text._width);
|
BF_GLOBALS.gfxManager()._font.getStringBounds(msg.c_str(), textRect, _text._width);
|
||||||
|
|
|
@ -272,7 +272,7 @@ void UICollection::draw() {
|
||||||
|
|
||||||
UIElements::UIElements(): UICollection() {
|
UIElements::UIElements(): UICollection() {
|
||||||
_cursorVisage.setVisage(1, 5);
|
_cursorVisage.setVisage(1, 5);
|
||||||
_saver->addLoadNotifier(&UIElements::loadNotifierProc);
|
g_saver->addLoadNotifier(&UIElements::loadNotifierProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIElements::synchronize(Serializer &s) {
|
void UIElements::synchronize(Serializer &s) {
|
||||||
|
|
|
@ -78,7 +78,7 @@ void SequenceManager::remove() {
|
||||||
_sequenceData.clear();
|
_sequenceData.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_globals->_sceneObjects->contains(&_sceneText))
|
if (g_globals->_sceneObjects->contains(&_sceneText))
|
||||||
_sceneText.remove();
|
_sceneText.remove();
|
||||||
|
|
||||||
Common::set_to(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
|
Common::set_to(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
|
||||||
|
@ -86,7 +86,7 @@ void SequenceManager::remove() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SequenceManager::signal() {
|
void SequenceManager::signal() {
|
||||||
if (_globals->_sceneObjects->contains(&_sceneText))
|
if (g_globals->_sceneObjects->contains(&_sceneText))
|
||||||
_sceneText.hide();
|
_sceneText.hide();
|
||||||
|
|
||||||
bool continueFlag = true;
|
bool continueFlag = true;
|
||||||
|
@ -143,8 +143,8 @@ void SequenceManager::signal() {
|
||||||
v1 = getNextValue();
|
v1 = getNextValue();
|
||||||
v3 = getNextValue();
|
v3 = getNextValue();
|
||||||
v2 = getNextValue();
|
v2 = getNextValue();
|
||||||
_globals->_sceneManager._scene->_sceneBounds.moveTo(v3, v2);
|
g_globals->_sceneManager._scene->_sceneBounds.moveTo(v3, v2);
|
||||||
_globals->_sceneManager._scene->loadScene(v1);
|
g_globals->_sceneManager._scene->loadScene(v1);
|
||||||
break;
|
break;
|
||||||
case 10: {
|
case 10: {
|
||||||
int resNum= getNextValue();
|
int resNum= getNextValue();
|
||||||
|
@ -224,7 +224,7 @@ void SequenceManager::signal() {
|
||||||
int minPercent = getNextValue();
|
int minPercent = getNextValue();
|
||||||
int yEnd = getNextValue();
|
int yEnd = getNextValue();
|
||||||
int maxPercent = getNextValue();
|
int maxPercent = getNextValue();
|
||||||
_globals->_sceneManager._scene->setZoomPercents(yStart, minPercent, yEnd, maxPercent);
|
g_globals->_sceneManager._scene->setZoomPercents(yStart, minPercent, yEnd, maxPercent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 26:
|
case 26:
|
||||||
|
@ -252,7 +252,7 @@ void SequenceManager::signal() {
|
||||||
break;
|
break;
|
||||||
case 30:
|
case 30:
|
||||||
v1 = getNextValue();
|
v1 = getNextValue();
|
||||||
_globals->_scrollFollower = (v1 == -1) ? NULL : _objectList[v1];
|
g_globals->_scrollFollower = (v1 == -1) ? NULL : _objectList[v1];
|
||||||
break;
|
break;
|
||||||
case 31:
|
case 31:
|
||||||
_sceneObject->setObjectWrapper(new SceneObjectWrapper());
|
_sceneObject->setObjectWrapper(new SceneObjectWrapper());
|
||||||
|
@ -266,7 +266,7 @@ void SequenceManager::signal() {
|
||||||
setDelay(1);
|
setDelay(1);
|
||||||
else {
|
else {
|
||||||
_sceneText.remove();
|
_sceneText.remove();
|
||||||
_globals->_sceneManager._scene->_stripManager.start(v1, this);
|
g_globals->_sceneManager._scene->_stripManager.start(v1, this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 34: {
|
case 34: {
|
||||||
|
@ -319,7 +319,7 @@ void SequenceManager::signal() {
|
||||||
|
|
||||||
void SequenceManager::process(Event &event) {
|
void SequenceManager::process(Event &event) {
|
||||||
if (((event.eventType == EVENT_BUTTON_DOWN) || (event.eventType == EVENT_KEYPRESS)) &&
|
if (((event.eventType == EVENT_BUTTON_DOWN) || (event.eventType == EVENT_KEYPRESS)) &&
|
||||||
!event.handled && _globals->_sceneObjects->contains(&_sceneText)) {
|
!event.handled && g_globals->_sceneObjects->contains(&_sceneText)) {
|
||||||
// Remove the text item
|
// Remove the text item
|
||||||
_sceneText.remove();
|
_sceneText.remove();
|
||||||
setDelay(2);
|
setDelay(2);
|
||||||
|
@ -334,8 +334,8 @@ void SequenceManager::attached(EventHandler *newOwner, EventHandler *endHandler,
|
||||||
// Get the sequence number to use
|
// Get the sequence number to use
|
||||||
_resNum = va_arg(va, int);
|
_resNum = va_arg(va, int);
|
||||||
|
|
||||||
byte *seqData = _resourceManager->getResource(RES_SEQUENCE, _resNum, 0);
|
byte *seqData = g_resourceManager->getResource(RES_SEQUENCE, _resNum, 0);
|
||||||
uint seqSize = _vm->_memoryManager.getSize(seqData);
|
uint seqSize = g_vm->_memoryManager.getSize(seqData);
|
||||||
|
|
||||||
_sequenceData.resize(seqSize);
|
_sequenceData.resize(seqSize);
|
||||||
Common::copy(seqData, seqData + seqSize, &_sequenceData[0]);
|
Common::copy(seqData, seqData + seqSize, &_sequenceData[0]);
|
||||||
|
@ -375,14 +375,14 @@ void SequenceManager::setMessage(int resNum, int lineNum, int fontNum, int color
|
||||||
_sceneText._width = width;
|
_sceneText._width = width;
|
||||||
|
|
||||||
// Get the display message
|
// Get the display message
|
||||||
Common::String msg = _resourceManager->getMessage(resNum, lineNum);
|
Common::String msg = g_resourceManager->getMessage(resNum, lineNum);
|
||||||
|
|
||||||
// Set the text message
|
// Set the text message
|
||||||
_sceneText.setup(msg);
|
_sceneText.setup(msg);
|
||||||
|
|
||||||
// Move the text to the correct position
|
// Move the text to the correct position
|
||||||
Rect textRect = _sceneText._bounds;
|
Rect textRect = _sceneText._bounds;
|
||||||
Rect sceneBounds = _globals->_sceneManager._scene->_sceneBounds;
|
Rect sceneBounds = g_globals->_sceneManager._scene->_sceneBounds;
|
||||||
sceneBounds.collapse(4, 2);
|
sceneBounds.collapse(4, 2);
|
||||||
textRect.moveTo(pt);
|
textRect.moveTo(pt);
|
||||||
textRect.contain(sceneBounds);
|
textRect.contain(sceneBounds);
|
||||||
|
@ -405,14 +405,14 @@ void SequenceManager::setMessage(int resNum, int lineNum, int fontNum, int color
|
||||||
}
|
}
|
||||||
|
|
||||||
SequenceManager *SequenceManager::globalManager() {
|
SequenceManager *SequenceManager::globalManager() {
|
||||||
return &_globals->_sequenceManager;
|
return &g_globals->_sequenceManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
ConversationChoiceDialog::ConversationChoiceDialog() {
|
ConversationChoiceDialog::ConversationChoiceDialog() {
|
||||||
_stdColor = 23;
|
_stdColor = 23;
|
||||||
_highlightColor = _globals->_scenePalette._colors.background;
|
_highlightColor = g_globals->_scenePalette._colors.background;
|
||||||
_fontNumber = 1;
|
_fontNumber = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,17 +443,17 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) {
|
||||||
|
|
||||||
// Draw the dialog
|
// Draw the dialog
|
||||||
draw();
|
draw();
|
||||||
_globals->_events.showCursor();
|
g_globals->_events.showCursor();
|
||||||
|
|
||||||
// Event handling loop
|
// Event handling loop
|
||||||
Event event;
|
Event event;
|
||||||
while (!_vm->shouldQuit()) {
|
while (!g_vm->shouldQuit()) {
|
||||||
while (!_globals->_events.getEvent(event, EVENT_KEYPRESS | EVENT_BUTTON_DOWN | EVENT_MOUSE_MOVE) &&
|
while (!g_globals->_events.getEvent(event, EVENT_KEYPRESS | EVENT_BUTTON_DOWN | EVENT_MOUSE_MOVE) &&
|
||||||
!_vm->shouldQuit()) {
|
!g_vm->shouldQuit()) {
|
||||||
g_system->delayMillis(10);
|
g_system->delayMillis(10);
|
||||||
g_system->updateScreen();
|
g_system->updateScreen();
|
||||||
}
|
}
|
||||||
if (_vm->shouldQuit())
|
if (g_vm->shouldQuit())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode >= Common::KEYCODE_1) &&
|
if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode >= Common::KEYCODE_1) &&
|
||||||
|
@ -504,7 +504,7 @@ void ConversationChoiceDialog::draw() {
|
||||||
// Make a backup copy of the area the dialog will occupy
|
// Make a backup copy of the area the dialog will occupy
|
||||||
Rect tempRect = _bounds;
|
Rect tempRect = _bounds;
|
||||||
tempRect.collapse(-10, -10);
|
tempRect.collapse(-10, -10);
|
||||||
_savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), tempRect);
|
_savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), tempRect);
|
||||||
|
|
||||||
// Fill in the contents of the entire dialog
|
// Fill in the contents of the entire dialog
|
||||||
_gfxManager._bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
_gfxManager._bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
|
@ -573,8 +573,8 @@ void StripManager::start(int stripNum, EventHandler *owner, StripCallback *callb
|
||||||
|
|
||||||
_stripNum = stripNum;
|
_stripNum = stripNum;
|
||||||
_callbackObject = callback;
|
_callbackObject = callback;
|
||||||
_sceneNumber = _globals->_sceneManager._scene->_screenNumber;
|
_sceneNumber = g_globals->_sceneManager._scene->_screenNumber;
|
||||||
_sceneBounds = _globals->_sceneManager._scene->_sceneBounds;
|
_sceneBounds = g_globals->_sceneManager._scene->_sceneBounds;
|
||||||
_script.clear();
|
_script.clear();
|
||||||
|
|
||||||
assert(owner);
|
assert(owner);
|
||||||
|
@ -603,8 +603,8 @@ void StripManager::reset() {
|
||||||
|
|
||||||
void StripManager::load() {
|
void StripManager::load() {
|
||||||
// Get the script
|
// Get the script
|
||||||
byte *script = _resourceManager->getResource(RES_STRIP, _stripNum, 2);
|
byte *script = g_resourceManager->getResource(RES_STRIP, _stripNum, 2);
|
||||||
uint scriptSize = _vm->_memoryManager.getSize(script);
|
uint scriptSize = g_vm->_memoryManager.getSize(script);
|
||||||
|
|
||||||
_script.resize(scriptSize);
|
_script.resize(scriptSize);
|
||||||
Common::copy(script, script + scriptSize, &_script[0]);
|
Common::copy(script, script + scriptSize, &_script[0]);
|
||||||
|
@ -612,8 +612,8 @@ void StripManager::load() {
|
||||||
DEALLOCATE(script);
|
DEALLOCATE(script);
|
||||||
|
|
||||||
// Get the object list
|
// Get the object list
|
||||||
byte *obj44List = _resourceManager->getResource(RES_STRIP, _stripNum, 1);
|
byte *obj44List = g_resourceManager->getResource(RES_STRIP, _stripNum, 1);
|
||||||
int dataSize = _vm->_memoryManager.getSize(obj44List);
|
int dataSize = g_vm->_memoryManager.getSize(obj44List);
|
||||||
assert((dataSize % 0x44) == 0);
|
assert((dataSize % 0x44) == 0);
|
||||||
|
|
||||||
byte *dataP = obj44List;
|
byte *dataP = obj44List;
|
||||||
|
@ -677,9 +677,9 @@ void StripManager::remove() {
|
||||||
if (_activeSpeaker)
|
if (_activeSpeaker)
|
||||||
_activeSpeaker->remove();
|
_activeSpeaker->remove();
|
||||||
|
|
||||||
if (_sceneNumber != _globals->_sceneManager._scene->_screenNumber) {
|
if (_sceneNumber != g_globals->_sceneManager._scene->_screenNumber) {
|
||||||
_globals->_sceneManager._scene->_sceneBounds = _sceneBounds;
|
g_globals->_sceneManager._scene->_sceneBounds = _sceneBounds;
|
||||||
_globals->_sceneManager._scene->loadScene(_sceneNumber);
|
g_globals->_sceneManager._scene->loadScene(_sceneNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_onEnd)
|
if (_onEnd)
|
||||||
|
@ -744,9 +744,9 @@ void StripManager::signal() {
|
||||||
_activeSpeaker->remove();
|
_activeSpeaker->remove();
|
||||||
_activeSpeaker = speakerP;
|
_activeSpeaker = speakerP;
|
||||||
|
|
||||||
if ((_activeSpeaker->_newSceneNumber == -1) && (_globals->_sceneManager._scene->_screenNumber != _sceneNumber)) {
|
if ((_activeSpeaker->_newSceneNumber == -1) && (g_globals->_sceneManager._scene->_screenNumber != _sceneNumber)) {
|
||||||
_globals->_sceneManager._scene->_sceneBounds = _sceneBounds;
|
g_globals->_sceneManager._scene->_sceneBounds = _sceneBounds;
|
||||||
_globals->_sceneManager._scene->loadScene(_sceneNumber);
|
g_globals->_sceneManager._scene->loadScene(_sceneNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
_activeSpeaker->proc12(this);
|
_activeSpeaker->proc12(this);
|
||||||
|
@ -839,7 +839,7 @@ Speaker::Speaker() : EventHandler() {
|
||||||
_textPos = Common::Point(10, 20);
|
_textPos = Common::Point(10, 20);
|
||||||
_fontNumber = 2;
|
_fontNumber = 2;
|
||||||
_textMode = ALIGN_LEFT;
|
_textMode = ALIGN_LEFT;
|
||||||
_color1 = _color2 = _color3 = _globals->_scenePalette._colors.foreground;
|
_color1 = _color2 = _color3 = g_globals->_scenePalette._colors.foreground;
|
||||||
_action = NULL;
|
_action = NULL;
|
||||||
_speakerName = "SPEAKER";
|
_speakerName = "SPEAKER";
|
||||||
}
|
}
|
||||||
|
@ -872,9 +872,9 @@ void Speaker::remove() {
|
||||||
void Speaker::proc12(Action *action) {
|
void Speaker::proc12(Action *action) {
|
||||||
_action = action;
|
_action = action;
|
||||||
if (_newSceneNumber != -1) {
|
if (_newSceneNumber != -1) {
|
||||||
_oldSceneNumber = _globals->_sceneManager._sceneNumber;
|
_oldSceneNumber = g_globals->_sceneManager._sceneNumber;
|
||||||
_sceneBounds = _globals->_sceneManager._scene->_sceneBounds;
|
_sceneBounds = g_globals->_sceneManager._scene->_sceneBounds;
|
||||||
_globals->_sceneManager._scene->loadScene(_newSceneNumber);
|
g_globals->_sceneManager._scene->loadScene(_newSceneNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_hideObjects)
|
if (_hideObjects)
|
||||||
|
@ -882,14 +882,14 @@ void Speaker::proc12(Action *action) {
|
||||||
_objectList.activate();
|
_objectList.activate();
|
||||||
|
|
||||||
// Draw the speaker objects without any fading
|
// Draw the speaker objects without any fading
|
||||||
FadeMode fadeMode = _globals->_sceneManager._fadeMode;
|
FadeMode fadeMode = g_globals->_sceneManager._fadeMode;
|
||||||
_globals->_sceneManager._fadeMode = FADEMODE_IMMEDIATE;
|
g_globals->_sceneManager._fadeMode = FADEMODE_IMMEDIATE;
|
||||||
_globals->_sceneObjects->draw();
|
g_globals->_sceneObjects->draw();
|
||||||
_globals->_sceneManager._fadeMode = fadeMode;
|
g_globals->_sceneManager._fadeMode = fadeMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Speaker::setText(const Common::String &msg) {
|
void Speaker::setText(const Common::String &msg) {
|
||||||
_globals->_sceneObjects->draw();
|
g_globals->_sceneObjects->draw();
|
||||||
|
|
||||||
_sceneText._color1 = _color1;
|
_sceneText._color1 = _color1;
|
||||||
_sceneText._color2 = _color2;
|
_sceneText._color2 = _color2;
|
||||||
|
@ -942,16 +942,16 @@ void ScreenSpeaker::setText(const Common::String &msg) {
|
||||||
gfxMan._font.setFontNumber(_fontNumber);
|
gfxMan._font.setFontNumber(_fontNumber);
|
||||||
Rect textRect;
|
Rect textRect;
|
||||||
|
|
||||||
_globals->gfxManager().getStringBounds(msg.c_str(), textRect, _textWidth);
|
g_globals->gfxManager().getStringBounds(msg.c_str(), textRect, _textWidth);
|
||||||
if (_npc) {
|
if (_npc) {
|
||||||
textRect.center(_npc->_position.x, _npc->_bounds.top - (textRect.height() / 2 + 10));
|
textRect.center(_npc->_position.x, _npc->_bounds.top - (textRect.height() / 2 + 10));
|
||||||
} else {
|
} else {
|
||||||
textRect.center(_globals->_sceneManager._scene->_sceneBounds.left +
|
textRect.center(g_globals->_sceneManager._scene->_sceneBounds.left +
|
||||||
(_globals->_sceneManager._scene->_sceneBounds.width() / 2),
|
(g_globals->_sceneManager._scene->_sceneBounds.width() / 2),
|
||||||
_globals->_sceneManager._scene->_sceneBounds.top);
|
g_globals->_sceneManager._scene->_sceneBounds.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect rect2 = _globals->_sceneManager._scene->_sceneBounds;
|
Rect rect2 = g_globals->_sceneManager._scene->_sceneBounds;
|
||||||
rect2.collapse(10, 6);
|
rect2.collapse(10, 6);
|
||||||
textRect.contain(rect2);
|
textRect.contain(rect2);
|
||||||
|
|
||||||
|
@ -967,14 +967,14 @@ void ScreenSpeaker::setText(const Common::String &msg) {
|
||||||
void SpeakerAction::signal() {
|
void SpeakerAction::signal() {
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
setDelay(_globals->_randomSource.getRandomNumber(60) + 60);
|
setDelay(g_globals->_randomSource.getRandomNumber(60) + 60);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
static_cast<SceneObject *>(_owner)->setFrame(1);
|
static_cast<SceneObject *>(_owner)->setFrame(1);
|
||||||
static_cast<SceneObject *>(_owner)->animate(ANIM_MODE_5, this, NULL);
|
static_cast<SceneObject *>(_owner)->animate(ANIM_MODE_5, this, NULL);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
setDelay(_globals->_randomSource.getRandomNumber(10));
|
setDelay(g_globals->_randomSource.getRandomNumber(10));
|
||||||
_actionIndex = 0;
|
_actionIndex = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -166,7 +166,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ADD_PLAYER_MOVER(X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \
|
#define ADD_PLAYER_MOVER(X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \
|
||||||
_globals->_player.addMover(mover, &pt, this); }
|
g_globals->_player.addMover(mover, &pt, this); }
|
||||||
#define ADD_PLAYER_MOVER_NULL(OBJ, X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \
|
#define ADD_PLAYER_MOVER_NULL(OBJ, X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \
|
||||||
OBJ.addMover(mover, &pt, NULL); }
|
OBJ.addMover(mover, &pt, NULL); }
|
||||||
#define ADD_PLAYER_MOVER_THIS(OBJ, X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \
|
#define ADD_PLAYER_MOVER_THIS(OBJ, X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \
|
||||||
|
|
|
@ -68,9 +68,9 @@ bool Debugger::Cmd_Scene(int argc, const char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 3)
|
if (argc == 3)
|
||||||
_globals->_sceneManager._sceneNumber = strToInt(argv[2]);
|
g_globals->_sceneManager._sceneNumber = strToInt(argv[2]);
|
||||||
|
|
||||||
_globals->_sceneManager.changeScene(strToInt(argv[1]));
|
g_globals->_sceneManager.changeScene(strToInt(argv[1]));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,20 +87,20 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) {
|
||||||
int color = 16;
|
int color = 16;
|
||||||
|
|
||||||
// Lock the background surface for access
|
// Lock the background surface for access
|
||||||
Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface();
|
Graphics::Surface destSurface = g_globals->_sceneManager._scene->_backSurface.lockSurface();
|
||||||
|
|
||||||
// Loop through drawing each walk region in a different color to the background surface
|
// Loop through drawing each walk region in a different color to the background surface
|
||||||
Common::String regionsDesc;
|
Common::String regionsDesc;
|
||||||
|
|
||||||
for (uint regionIndex = 0; regionIndex < _globals->_walkRegions._regionList.size(); ++regionIndex, ++color) {
|
for (uint regionIndex = 0; regionIndex < g_globals->_walkRegions._regionList.size(); ++regionIndex, ++color) {
|
||||||
WalkRegion &wr = _globals->_walkRegions._regionList[regionIndex];
|
WalkRegion &wr = g_globals->_walkRegions._regionList[regionIndex];
|
||||||
|
|
||||||
for (int yp = wr._bounds.top; yp < wr._bounds.bottom; ++yp) {
|
for (int yp = wr._bounds.top; yp < wr._bounds.bottom; ++yp) {
|
||||||
LineSliceSet sliceSet = wr.getLineSlices(yp);
|
LineSliceSet sliceSet = wr.getLineSlices(yp);
|
||||||
|
|
||||||
for (uint idx = 0; idx < sliceSet.items.size(); ++idx)
|
for (uint idx = 0; idx < sliceSet.items.size(); ++idx)
|
||||||
destSurface.hLine(sliceSet.items[idx].xs - _globals->_sceneOffset.x, yp,
|
destSurface.hLine(sliceSet.items[idx].xs - g_globals->_sceneOffset.x, yp,
|
||||||
sliceSet.items[idx].xe - _globals->_sceneOffset.x, color);
|
sliceSet.items[idx].xe - g_globals->_sceneOffset.x, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
regionsDesc += Common::String::format("Region #%d d bounds=%d,%d,%d,%d\n",
|
regionsDesc += Common::String::format("Region #%d d bounds=%d,%d,%d,%d\n",
|
||||||
|
@ -108,12 +108,12 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release the surface
|
// Release the surface
|
||||||
_globals->_sceneManager._scene->_backSurface.unlockSurface();
|
g_globals->_sceneManager._scene->_backSurface.unlockSurface();
|
||||||
|
|
||||||
// Mark the scene as requiring a full redraw
|
// Mark the scene as requiring a full redraw
|
||||||
_globals->_paneRefreshFlag[0] = 2;
|
g_globals->_paneRefreshFlag[0] = 2;
|
||||||
|
|
||||||
DebugPrintf("Total regions = %d\n", _globals->_walkRegions._regionList.size());
|
DebugPrintf("Total regions = %d\n", g_globals->_walkRegions._regionList.size());
|
||||||
DebugPrintf("%s\n", regionsDesc.c_str());
|
DebugPrintf("%s\n", regionsDesc.c_str());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -134,12 +134,12 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
// Lock the background surface for access
|
// Lock the background surface for access
|
||||||
Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface();
|
Graphics::Surface destSurface = g_globals->_sceneManager._scene->_backSurface.lockSurface();
|
||||||
|
|
||||||
Common::List<Region>::iterator i = _globals->_sceneManager._scene->_priorities.begin();
|
Common::List<Region>::iterator i = g_globals->_sceneManager._scene->_priorities.begin();
|
||||||
Common::String regionsDesc;
|
Common::String regionsDesc;
|
||||||
|
|
||||||
for (; i != _globals->_sceneManager._scene->_priorities.end(); ++i, ++color, ++count) {
|
for (; i != g_globals->_sceneManager._scene->_priorities.end(); ++i, ++color, ++count) {
|
||||||
Region &r = *i;
|
Region &r = *i;
|
||||||
|
|
||||||
if ((regionNum == 0) || (regionNum == (count + 1))) {
|
if ((regionNum == 0) || (regionNum == (count + 1))) {
|
||||||
|
@ -147,8 +147,8 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) {
|
||||||
byte *destP = (byte *)destSurface.getBasePtr(0, y);
|
byte *destP = (byte *)destSurface.getBasePtr(0, y);
|
||||||
|
|
||||||
for (int x = 0; x < destSurface.w; ++x) {
|
for (int x = 0; x < destSurface.w; ++x) {
|
||||||
if (r.contains(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + x,
|
if (r.contains(Common::Point(g_globals->_sceneManager._scene->_sceneBounds.left + x,
|
||||||
_globals->_sceneManager._scene->_sceneBounds.top + y)))
|
g_globals->_sceneManager._scene->_sceneBounds.top + y)))
|
||||||
*destP = color;
|
*destP = color;
|
||||||
++destP;
|
++destP;
|
||||||
}
|
}
|
||||||
|
@ -160,10 +160,10 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release the surface
|
// Release the surface
|
||||||
_globals->_sceneManager._scene->_backSurface.unlockSurface();
|
g_globals->_sceneManager._scene->_backSurface.unlockSurface();
|
||||||
|
|
||||||
// Mark the scene as requiring a full redraw
|
// Mark the scene as requiring a full redraw
|
||||||
_globals->_paneRefreshFlag[0] = 2;
|
g_globals->_paneRefreshFlag[0] = 2;
|
||||||
|
|
||||||
DebugPrintf("Total regions = %d\n", count);
|
DebugPrintf("Total regions = %d\n", count);
|
||||||
DebugPrintf("%s", regionsDesc.c_str());
|
DebugPrintf("%s", regionsDesc.c_str());
|
||||||
|
@ -187,12 +187,12 @@ bool Debugger::Cmd_SceneRegions(int argc, const char **argv) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
// Lock the background surface for access
|
// Lock the background surface for access
|
||||||
Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface();
|
Graphics::Surface destSurface = g_globals->_sceneManager._scene->_backSurface.lockSurface();
|
||||||
|
|
||||||
Common::List<Region>::iterator i = _globals->_sceneRegions.begin();
|
Common::List<Region>::iterator i = g_globals->_sceneRegions.begin();
|
||||||
Common::String regionsDesc;
|
Common::String regionsDesc;
|
||||||
|
|
||||||
for (; i != _globals->_sceneRegions.end(); ++i, ++color, ++count) {
|
for (; i != g_globals->_sceneRegions.end(); ++i, ++color, ++count) {
|
||||||
Region &r = *i;
|
Region &r = *i;
|
||||||
|
|
||||||
if ((regionNum == 0) || (regionNum == (count + 1))) {
|
if ((regionNum == 0) || (regionNum == (count + 1))) {
|
||||||
|
@ -200,8 +200,8 @@ bool Debugger::Cmd_SceneRegions(int argc, const char **argv) {
|
||||||
byte *destP = (byte *)destSurface.getBasePtr(0, y);
|
byte *destP = (byte *)destSurface.getBasePtr(0, y);
|
||||||
|
|
||||||
for (int x = 0; x < destSurface.w; ++x) {
|
for (int x = 0; x < destSurface.w; ++x) {
|
||||||
if (r.contains(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + x,
|
if (r.contains(Common::Point(g_globals->_sceneManager._scene->_sceneBounds.left + x,
|
||||||
_globals->_sceneManager._scene->_sceneBounds.top + y)))
|
g_globals->_sceneManager._scene->_sceneBounds.top + y)))
|
||||||
*destP = color;
|
*destP = color;
|
||||||
++destP;
|
++destP;
|
||||||
}
|
}
|
||||||
|
@ -213,10 +213,10 @@ bool Debugger::Cmd_SceneRegions(int argc, const char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release the surface
|
// Release the surface
|
||||||
_globals->_sceneManager._scene->_backSurface.unlockSurface();
|
g_globals->_sceneManager._scene->_backSurface.unlockSurface();
|
||||||
|
|
||||||
// Mark the scene as requiring a full redraw
|
// Mark the scene as requiring a full redraw
|
||||||
_globals->_paneRefreshFlag[0] = 2;
|
g_globals->_paneRefreshFlag[0] = 2;
|
||||||
|
|
||||||
DebugPrintf("Total regions = %d\n", count);
|
DebugPrintf("Total regions = %d\n", count);
|
||||||
DebugPrintf("%s", regionsDesc.c_str());
|
DebugPrintf("%s", regionsDesc.c_str());
|
||||||
|
@ -235,7 +235,7 @@ bool Debugger::Cmd_SetFlag(int argc, const char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int flagNum = strToInt(argv[1]);
|
int flagNum = strToInt(argv[1]);
|
||||||
_globals->setFlag(flagNum);
|
g_globals->setFlag(flagNum);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ bool Debugger::Cmd_GetFlag(int argc, const char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int flagNum = strToInt(argv[1]);
|
int flagNum = strToInt(argv[1]);
|
||||||
DebugPrintf("Value: %d\n", _globals->getFlag(flagNum));
|
DebugPrintf("Value: %d\n", g_globals->getFlag(flagNum));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ bool Debugger::Cmd_ClearFlag(int argc, const char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int flagNum = strToInt(argv[1]);
|
int flagNum = strToInt(argv[1]);
|
||||||
_globals->clearFlag(flagNum);
|
g_globals->clearFlag(flagNum);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,14 +444,14 @@ bool Debugger::Cmd_MoveObject(int argc, const char **argv) {
|
||||||
*/
|
*/
|
||||||
bool Debugger::Cmd_Hotspots(int argc, const char **argv) {
|
bool Debugger::Cmd_Hotspots(int argc, const char **argv) {
|
||||||
int colIndex = 16;
|
int colIndex = 16;
|
||||||
const Rect &sceneBounds = _globals->_sceneManager._scene->_sceneBounds;
|
const Rect &sceneBounds = g_globals->_sceneManager._scene->_sceneBounds;
|
||||||
|
|
||||||
// Lock the background surface for access
|
// Lock the background surface for access
|
||||||
Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface();
|
Graphics::Surface destSurface = g_globals->_sceneManager._scene->_backSurface.lockSurface();
|
||||||
|
|
||||||
// Iterate through the scene items
|
// Iterate through the scene items
|
||||||
SynchronizedList<SceneItem *>::iterator i;
|
SynchronizedList<SceneItem *>::iterator i;
|
||||||
for (i = _globals->_sceneItems.reverse_begin(); i != _globals->_sceneItems.end(); --i, ++colIndex) {
|
for (i = g_globals->_sceneItems.reverse_begin(); i != g_globals->_sceneItems.end(); --i, ++colIndex) {
|
||||||
SceneItem *o = *i;
|
SceneItem *o = *i;
|
||||||
|
|
||||||
// Draw the contents of the hotspot area
|
// Draw the contents of the hotspot area
|
||||||
|
@ -461,11 +461,11 @@ bool Debugger::Cmd_Hotspots(int argc, const char **argv) {
|
||||||
o->_bounds.right - sceneBounds.left - 1, o->_bounds.bottom - sceneBounds.top - 1), colIndex);
|
o->_bounds.right - sceneBounds.left - 1, o->_bounds.bottom - sceneBounds.top - 1), colIndex);
|
||||||
} else {
|
} else {
|
||||||
// Scene uses a region, so get it and use it to fill out only the correct parts
|
// Scene uses a region, so get it and use it to fill out only the correct parts
|
||||||
SceneRegions::iterator ri = _globals->_sceneRegions.begin();
|
SceneRegions::iterator ri = g_globals->_sceneRegions.begin();
|
||||||
while ((ri != _globals->_sceneRegions.end()) && ((*ri)._regionId != o->_sceneRegionId))
|
while ((ri != g_globals->_sceneRegions.end()) && ((*ri)._regionId != o->_sceneRegionId))
|
||||||
++ri;
|
++ri;
|
||||||
|
|
||||||
if (ri != _globals->_sceneRegions.end()) {
|
if (ri != g_globals->_sceneRegions.end()) {
|
||||||
// Fill out the areas defined by the region
|
// Fill out the areas defined by the region
|
||||||
Region &r = *ri;
|
Region &r = *ri;
|
||||||
|
|
||||||
|
@ -481,10 +481,10 @@ bool Debugger::Cmd_Hotspots(int argc, const char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release the surface
|
// Release the surface
|
||||||
_globals->_sceneManager._scene->_backSurface.unlockSurface();
|
g_globals->_sceneManager._scene->_backSurface.unlockSurface();
|
||||||
|
|
||||||
// Mark the scene as requiring a full redraw
|
// Mark the scene as requiring a full redraw
|
||||||
_globals->_paneRefreshFlag[0] = 2;
|
g_globals->_paneRefreshFlag[0] = 2;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -499,7 +499,7 @@ bool Debugger::Cmd_Sound(int argc, const char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int soundNum = strToInt(argv[1]);
|
int soundNum = strToInt(argv[1]);
|
||||||
_globals->_soundHandler.play(soundNum);
|
g_globals->_soundHandler.play(soundNum);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,16 +64,16 @@ MessageDialog::MessageDialog(const Common::String &message, const Common::String
|
||||||
setDefaults();
|
setDefaults();
|
||||||
|
|
||||||
// Set the dialog's center
|
// Set the dialog's center
|
||||||
setCenter(_globals->_dialogCenter.x, _globals->_dialogCenter.y);
|
setCenter(g_globals->_dialogCenter.x, g_globals->_dialogCenter.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
int MessageDialog::show(const Common::String &message, const Common::String &btn1Message, const Common::String &btn2Message) {
|
int MessageDialog::show(const Common::String &message, const Common::String &btn1Message, const Common::String &btn2Message) {
|
||||||
// Ensure that the cursor is the arrow
|
// Ensure that the cursor is the arrow
|
||||||
_globals->_events.setCursor(CURSOR_ARROW);
|
g_globals->_events.setCursor(CURSOR_ARROW);
|
||||||
|
|
||||||
int result = show2(message, btn1Message, btn2Message);
|
int result = show2(message, btn1Message, btn2Message);
|
||||||
|
|
||||||
_globals->_events.setCursorFromFlag();
|
g_globals->_events.setCursorFromFlag();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ void ModalDialog::draw() {
|
||||||
// Make a backup copy of the area the dialog will occupy
|
// Make a backup copy of the area the dialog will occupy
|
||||||
Rect tempRect = _bounds;
|
Rect tempRect = _bounds;
|
||||||
tempRect.collapse(-10, -10);
|
tempRect.collapse(-10, -10);
|
||||||
_savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), tempRect);
|
_savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), tempRect);
|
||||||
|
|
||||||
_gfxManager.activate();
|
_gfxManager.activate();
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ void ModalDialog::drawFrame() {
|
||||||
_bounds.collapse(-10, -10);
|
_bounds.collapse(-10, -10);
|
||||||
|
|
||||||
// Fill the dialog area
|
// Fill the dialog area
|
||||||
_globals->gfxManager().fillRect(origRect, 54);
|
g_globals->gfxManager().fillRect(origRect, 54);
|
||||||
|
|
||||||
// Draw top line
|
// Draw top line
|
||||||
GfxSurface surface = surfaceFromRes(8, 1, 7);
|
GfxSurface surface = surfaceFromRes(8, 1, 7);
|
||||||
|
@ -285,14 +285,14 @@ void InventoryDialog::execute() {
|
||||||
bool lookFlag = false;
|
bool lookFlag = false;
|
||||||
_gfxManager.activate();
|
_gfxManager.activate();
|
||||||
|
|
||||||
while (!_vm->shouldQuit()) {
|
while (!g_vm->shouldQuit()) {
|
||||||
// Get events
|
// Get events
|
||||||
Event event;
|
Event event;
|
||||||
while (!_globals->_events.getEvent(event) && !_vm->shouldQuit()) {
|
while (!g_globals->_events.getEvent(event) && !g_vm->shouldQuit()) {
|
||||||
g_system->delayMillis(10);
|
g_system->delayMillis(10);
|
||||||
g_system->updateScreen();
|
g_system->updateScreen();
|
||||||
}
|
}
|
||||||
if (_vm->shouldQuit())
|
if (g_vm->shouldQuit())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
hiliteObj = NULL;
|
hiliteObj = NULL;
|
||||||
|
@ -319,18 +319,18 @@ void InventoryDialog::execute() {
|
||||||
if (hiliteObj == &_btnOk) {
|
if (hiliteObj == &_btnOk) {
|
||||||
// Ok button clicked
|
// Ok button clicked
|
||||||
if (lookFlag)
|
if (lookFlag)
|
||||||
_globals->_events.setCursor(CURSOR_WALK);
|
g_globals->_events.setCursor(CURSOR_WALK);
|
||||||
break;
|
break;
|
||||||
} else if (hiliteObj == &_btnLook) {
|
} else if (hiliteObj == &_btnLook) {
|
||||||
// Look button clicked
|
// Look button clicked
|
||||||
if (_btnLook._message == LOOK_BTN_STRING) {
|
if (_btnLook._message == LOOK_BTN_STRING) {
|
||||||
_btnLook._message = PICK_BTN_STRING;
|
_btnLook._message = PICK_BTN_STRING;
|
||||||
lookFlag = 1;
|
lookFlag = 1;
|
||||||
_globals->_events.setCursor(CURSOR_LOOK);
|
g_globals->_events.setCursor(CURSOR_LOOK);
|
||||||
} else {
|
} else {
|
||||||
_btnLook._message = LOOK_BTN_STRING;
|
_btnLook._message = LOOK_BTN_STRING;
|
||||||
lookFlag = 0;
|
lookFlag = 0;
|
||||||
_globals->_events.setCursor(CURSOR_WALK);
|
g_globals->_events.setCursor(CURSOR_WALK);
|
||||||
}
|
}
|
||||||
|
|
||||||
hiliteObj->draw();
|
hiliteObj->draw();
|
||||||
|
@ -338,7 +338,7 @@ void InventoryDialog::execute() {
|
||||||
// Inventory item selected
|
// Inventory item selected
|
||||||
InvObject *invObject = static_cast<GfxInvImage *>(hiliteObj)->_invObject;
|
InvObject *invObject = static_cast<GfxInvImage *>(hiliteObj)->_invObject;
|
||||||
if (lookFlag) {
|
if (lookFlag) {
|
||||||
_globals->_screenSurface.displayText(invObject->_description);
|
g_globals->_screenSurface.displayText(invObject->_description);
|
||||||
} else {
|
} else {
|
||||||
RING_INVENTORY._selectedItem = invObject;
|
RING_INVENTORY._selectedItem = invObject;
|
||||||
invObject->setCursor();
|
invObject->setCursor();
|
||||||
|
@ -360,20 +360,20 @@ void OptionsDialog::show() {
|
||||||
if (btn == &dlg->_btnQuit) {
|
if (btn == &dlg->_btnQuit) {
|
||||||
// Quit game
|
// Quit game
|
||||||
if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1) {
|
if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1) {
|
||||||
_vm->quitGame();
|
g_vm->quitGame();
|
||||||
}
|
}
|
||||||
} else if (btn == &dlg->_btnRestart) {
|
} else if (btn == &dlg->_btnRestart) {
|
||||||
// Restart game
|
// Restart game
|
||||||
_globals->_game->restartGame();
|
g_globals->_game->restartGame();
|
||||||
} else if (btn == &dlg->_btnSound) {
|
} else if (btn == &dlg->_btnSound) {
|
||||||
// Sound dialog
|
// Sound dialog
|
||||||
SoundDialog::execute();
|
SoundDialog::execute();
|
||||||
} else if (btn == &dlg->_btnSave) {
|
} else if (btn == &dlg->_btnSave) {
|
||||||
// Save button
|
// Save button
|
||||||
_globals->_game->saveGame();
|
g_globals->_game->saveGame();
|
||||||
} else if (btn == &dlg->_btnRestore) {
|
} else if (btn == &dlg->_btnRestore) {
|
||||||
// Restore button
|
// Restore button
|
||||||
_globals->_game->restoreGame();
|
g_globals->_game->restoreGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
dlg->remove();
|
dlg->remove();
|
||||||
|
@ -421,8 +421,8 @@ void SoundDialog::execute() {
|
||||||
ConfigDialog *dlg = new ConfigDialog();
|
ConfigDialog *dlg = new ConfigDialog();
|
||||||
dlg->runModal();
|
dlg->runModal();
|
||||||
delete dlg;
|
delete dlg;
|
||||||
_globals->_soundManager.syncSounds();
|
g_globals->_soundManager.syncSounds();
|
||||||
_globals->_events.setCursorFromFlag();
|
g_globals->_events.setCursorFromFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace TsAGE
|
} // End of namespace TsAGE
|
||||||
|
|
|
@ -39,8 +39,8 @@ EventsClass::EventsClass() {
|
||||||
_frameNumber = 0;
|
_frameNumber = 0;
|
||||||
_priorFrameTime = 0;
|
_priorFrameTime = 0;
|
||||||
_prevDelayFrame = 0;
|
_prevDelayFrame = 0;
|
||||||
_saver->addListener(this);
|
g_saver->addListener(this);
|
||||||
_saver->addLoadNotifier(&EventsClass::loadNotifierProc);
|
g_saver->addLoadNotifier(&EventsClass::loadNotifierProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventsClass::pollEvent() {
|
bool EventsClass::pollEvent() {
|
||||||
|
@ -79,7 +79,7 @@ bool EventsClass::pollEvent() {
|
||||||
|
|
||||||
void EventsClass::waitForPress(int eventMask) {
|
void EventsClass::waitForPress(int eventMask) {
|
||||||
Event evt;
|
Event evt;
|
||||||
while (!_vm->shouldQuit() && !getEvent(evt, eventMask))
|
while (!g_vm->shouldQuit() && !getEvent(evt, eventMask))
|
||||||
g_system->delayMillis(10);
|
g_system->delayMillis(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ void EventsClass::waitForPress(int eventMask) {
|
||||||
* Standard event retrieval, which only returns keyboard and mouse clicks
|
* Standard event retrieval, which only returns keyboard and mouse clicks
|
||||||
*/
|
*/
|
||||||
bool EventsClass::getEvent(Event &evt, int eventMask) {
|
bool EventsClass::getEvent(Event &evt, int eventMask) {
|
||||||
while (pollEvent() && !_vm->shouldQuit()) {
|
while (pollEvent() && !g_vm->shouldQuit()) {
|
||||||
evt.handled = false;
|
evt.handled = false;
|
||||||
evt.eventType = EVENT_NONE;
|
evt.eventType = EVENT_NONE;
|
||||||
evt.mousePos = _event.mouse;
|
evt.mousePos = _event.mouse;
|
||||||
|
@ -143,7 +143,7 @@ void EventsClass::setCursor(CursorType cursorType) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_lastCursor = cursorType;
|
_lastCursor = cursorType;
|
||||||
_globals->clearFlag(122);
|
g_globals->clearFlag(122);
|
||||||
CursorMan.showMouse(true);
|
CursorMan.showMouse(true);
|
||||||
|
|
||||||
const byte *cursor;
|
const byte *cursor;
|
||||||
|
@ -154,55 +154,55 @@ void EventsClass::setCursor(CursorType cursorType) {
|
||||||
switch (cursorType) {
|
switch (cursorType) {
|
||||||
case CURSOR_NONE:
|
case CURSOR_NONE:
|
||||||
// No cursor
|
// No cursor
|
||||||
_globals->setFlag(122);
|
g_globals->setFlag(122);
|
||||||
|
|
||||||
if ((_vm->getFeatures() & GF_DEMO) || (_vm->getGameID() == GType_BlueForce)) {
|
if ((g_vm->getFeatures() & GF_DEMO) || (g_vm->getGameID() == GType_BlueForce)) {
|
||||||
CursorMan.showMouse(false);
|
CursorMan.showMouse(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cursor = _resourceManager->getSubResource(4, 1, 6, &size);
|
cursor = g_resourceManager->getSubResource(4, 1, 6, &size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURSOR_LOOK:
|
case CURSOR_LOOK:
|
||||||
// Look cursor
|
// Look cursor
|
||||||
if (_vm->getGameID() == GType_BlueForce)
|
if (g_vm->getGameID() == GType_BlueForce)
|
||||||
cursor = _resourceManager->getSubResource(1, 5, 3, &size);
|
cursor = g_resourceManager->getSubResource(1, 5, 3, &size);
|
||||||
else
|
else
|
||||||
cursor = _resourceManager->getSubResource(4, 1, 5, &size);
|
cursor = g_resourceManager->getSubResource(4, 1, 5, &size);
|
||||||
_currentCursor = CURSOR_LOOK;
|
_currentCursor = CURSOR_LOOK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURSOR_USE:
|
case CURSOR_USE:
|
||||||
// Use cursor
|
// Use cursor
|
||||||
if (_vm->getGameID() == GType_BlueForce) {
|
if (g_vm->getGameID() == GType_BlueForce) {
|
||||||
cursor = _resourceManager->getSubResource(1, 5, 2, &size);
|
cursor = g_resourceManager->getSubResource(1, 5, 2, &size);
|
||||||
} else {
|
} else {
|
||||||
cursor = _resourceManager->getSubResource(4, 1, 4, &size);
|
cursor = g_resourceManager->getSubResource(4, 1, 4, &size);
|
||||||
}
|
}
|
||||||
_currentCursor = CURSOR_USE;
|
_currentCursor = CURSOR_USE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURSOR_TALK:
|
case CURSOR_TALK:
|
||||||
// Talk cursor
|
// Talk cursor
|
||||||
if (_vm->getGameID() == GType_BlueForce) {
|
if (g_vm->getGameID() == GType_BlueForce) {
|
||||||
cursor = _resourceManager->getSubResource(1, 5, 4, &size);
|
cursor = g_resourceManager->getSubResource(1, 5, 4, &size);
|
||||||
} else {
|
} else {
|
||||||
cursor = _resourceManager->getSubResource(4, 1, 3, &size);
|
cursor = g_resourceManager->getSubResource(4, 1, 3, &size);
|
||||||
}
|
}
|
||||||
_currentCursor = CURSOR_TALK;
|
_currentCursor = CURSOR_TALK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURSOR_EXIT:
|
case CURSOR_EXIT:
|
||||||
// Exit cursor (Blue Force)
|
// Exit cursor (Blue Force)
|
||||||
assert(_vm->getGameID() == GType_BlueForce);
|
assert(g_vm->getGameID() == GType_BlueForce);
|
||||||
cursor = _resourceManager->getSubResource(1, 5, 7, &size);
|
cursor = g_resourceManager->getSubResource(1, 5, 7, &size);
|
||||||
_currentCursor = CURSOR_EXIT;
|
_currentCursor = CURSOR_EXIT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURSOR_PRINTER:
|
case CURSOR_PRINTER:
|
||||||
// Printer cursor (Blue Force)
|
// Printer cursor (Blue Force)
|
||||||
assert(_vm->getGameID() == GType_BlueForce);
|
assert(g_vm->getGameID() == GType_BlueForce);
|
||||||
cursor = _resourceManager->getSubResource(1, 7, 6, &size);
|
cursor = g_resourceManager->getSubResource(1, 7, 6, &size);
|
||||||
_currentCursor = CURSOR_PRINTER;
|
_currentCursor = CURSOR_PRINTER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -214,12 +214,12 @@ void EventsClass::setCursor(CursorType cursorType) {
|
||||||
|
|
||||||
case CURSOR_WALK:
|
case CURSOR_WALK:
|
||||||
default:
|
default:
|
||||||
if (_vm->getGameID() == GType_BlueForce) {
|
if (g_vm->getGameID() == GType_BlueForce) {
|
||||||
if (cursorType == CURSOR_WALK) {
|
if (cursorType == CURSOR_WALK) {
|
||||||
cursor = _resourceManager->getSubResource(1, 5, 1, &size);
|
cursor = g_resourceManager->getSubResource(1, 5, 1, &size);
|
||||||
} else {
|
} else {
|
||||||
// Inventory icon
|
// Inventory icon
|
||||||
cursor = _resourceManager->getSubResource(10, ((int)cursorType - 1) / 20 + 1,
|
cursor = g_resourceManager->getSubResource(10, ((int)cursorType - 1) / 20 + 1,
|
||||||
((int)cursorType - 1) % 20 + 1, &size);
|
((int)cursorType - 1) % 20 + 1, &size);
|
||||||
questionEnabled = true;
|
questionEnabled = true;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ void EventsClass::setCursor(CursorType cursorType) {
|
||||||
DEALLOCATE(cursor);
|
DEALLOCATE(cursor);
|
||||||
|
|
||||||
// For Blue Force, enable the question button when an inventory icon is selected
|
// For Blue Force, enable the question button when an inventory icon is selected
|
||||||
if (_vm->getGameID() == GType_BlueForce)
|
if (g_vm->getGameID() == GType_BlueForce)
|
||||||
BF_GLOBALS._uiElements._question.setEnabled(questionEnabled);
|
BF_GLOBALS._uiElements._question.setEnabled(questionEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,22 +257,22 @@ void EventsClass::pushCursor(CursorType cursorType) {
|
||||||
switch (cursorType) {
|
switch (cursorType) {
|
||||||
case CURSOR_NONE:
|
case CURSOR_NONE:
|
||||||
// No cursor
|
// No cursor
|
||||||
cursor = _resourceManager->getSubResource(4, 1, 6, &size);
|
cursor = g_resourceManager->getSubResource(4, 1, 6, &size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURSOR_LOOK:
|
case CURSOR_LOOK:
|
||||||
// Look cursor
|
// Look cursor
|
||||||
cursor = _resourceManager->getSubResource(4, 1, 5, &size);
|
cursor = g_resourceManager->getSubResource(4, 1, 5, &size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURSOR_USE:
|
case CURSOR_USE:
|
||||||
// Use cursor
|
// Use cursor
|
||||||
cursor = _resourceManager->getSubResource(4, 1, 4, &size);
|
cursor = g_resourceManager->getSubResource(4, 1, 4, &size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURSOR_TALK:
|
case CURSOR_TALK:
|
||||||
// Talk cursor
|
// Talk cursor
|
||||||
cursor = _resourceManager->getSubResource(4, 1, 3, &size);
|
cursor = g_resourceManager->getSubResource(4, 1, 3, &size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURSOR_ARROW:
|
case CURSOR_ARROW:
|
||||||
|
@ -338,7 +338,7 @@ CursorType EventsClass::hideCursor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventsClass::isCursorVisible() const {
|
bool EventsClass::isCursorVisible() const {
|
||||||
return !_globals->getFlag(122);
|
return !g_globals->getFlag(122);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -373,10 +373,10 @@ void EventsClass::listenerSynchronize(Serializer &s) {
|
||||||
|
|
||||||
void EventsClass::loadNotifierProc(bool postFlag) {
|
void EventsClass::loadNotifierProc(bool postFlag) {
|
||||||
if (postFlag) {
|
if (postFlag) {
|
||||||
if (_globals->_events._lastCursor == CURSOR_NONE)
|
if (g_globals->_events._lastCursor == CURSOR_NONE)
|
||||||
_globals->_events._lastCursor = _globals->_events._currentCursor;
|
g_globals->_events._lastCursor = g_globals->_events._currentCursor;
|
||||||
else
|
else
|
||||||
_globals->_events._lastCursor = CURSOR_NONE;
|
g_globals->_events._lastCursor = CURSOR_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
|
|
||||||
namespace TsAGE {
|
namespace TsAGE {
|
||||||
|
|
||||||
Globals *_globals = NULL;
|
Globals *g_globals = NULL;
|
||||||
ResourceManager *_resourceManager = NULL;
|
ResourceManager *g_resourceManager = NULL;
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface
|
||||||
_stripNum = 0;
|
_stripNum = 0;
|
||||||
_gfxEdgeAdjust = 3;
|
_gfxEdgeAdjust = 3;
|
||||||
|
|
||||||
if (_vm->getFeatures() & GF_DEMO) {
|
if (g_vm->getFeatures() & GF_DEMO) {
|
||||||
_gfxFontNumber = 0;
|
_gfxFontNumber = 0;
|
||||||
_gfxColors.background = 6;
|
_gfxColors.background = 6;
|
||||||
_gfxColors.foreground = 0;
|
_gfxColors.foreground = 0;
|
||||||
|
@ -67,7 +67,7 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface
|
||||||
_color1 = _gfxColors.foreground;
|
_color1 = _gfxColors.foreground;
|
||||||
_color2 = _gfxColors.foreground;
|
_color2 = _gfxColors.foreground;
|
||||||
_color3 = _gfxColors.foreground;
|
_color3 = _gfxColors.foreground;
|
||||||
} else if (_vm->getGameID() == GType_BlueForce) {
|
} else if (g_vm->getGameID() == GType_BlueForce) {
|
||||||
// Blue Force
|
// Blue Force
|
||||||
_gfxFontNumber = 0;
|
_gfxFontNumber = 0;
|
||||||
_gfxColors.background = 89;
|
_gfxColors.background = 89;
|
||||||
|
@ -75,7 +75,7 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface
|
||||||
_fontColors.background = 88;
|
_fontColors.background = 88;
|
||||||
_fontColors.foreground = 92;
|
_fontColors.foreground = 92;
|
||||||
_dialogCenter.y = 140;
|
_dialogCenter.y = 140;
|
||||||
} else if ((_vm->getGameID() == GType_Ringworld) && (_vm->getFeatures() & GF_CD)) {
|
} else if ((g_vm->getGameID() == GType_Ringworld) && (g_vm->getFeatures() & GF_CD)) {
|
||||||
_gfxFontNumber = 50;
|
_gfxFontNumber = 50;
|
||||||
_gfxColors.background = 53;
|
_gfxColors.background = 53;
|
||||||
_gfxColors.foreground = 0;
|
_gfxColors.foreground = 0;
|
||||||
|
@ -108,9 +108,9 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface
|
||||||
_scrollFollower = NULL;
|
_scrollFollower = NULL;
|
||||||
_inventory = NULL;
|
_inventory = NULL;
|
||||||
|
|
||||||
switch (_vm->getGameID()) {
|
switch (g_vm->getGameID()) {
|
||||||
case GType_Ringworld:
|
case GType_Ringworld:
|
||||||
if (!(_vm->getFeatures() & GF_DEMO)) {
|
if (!(g_vm->getFeatures() & GF_DEMO)) {
|
||||||
_inventory = new Ringworld::RingworldInvObjectList();
|
_inventory = new Ringworld::RingworldInvObjectList();
|
||||||
_game = new Ringworld::RingworldGame();
|
_game = new Ringworld::RingworldGame();
|
||||||
} else {
|
} else {
|
||||||
|
@ -132,12 +132,12 @@ Globals::~Globals() {
|
||||||
delete _inventory;
|
delete _inventory;
|
||||||
delete _sceneHandler;
|
delete _sceneHandler;
|
||||||
delete _game;
|
delete _game;
|
||||||
_globals = NULL;
|
g_globals = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Globals::reset() {
|
void Globals::reset() {
|
||||||
Common::set_to(&_flags[0], &_flags[MAX_FLAGS], false);
|
Common::set_to(&_flags[0], &_flags[MAX_FLAGS], false);
|
||||||
_saver->addFactory(classFactoryProc);
|
g_saver->addFactory(classFactoryProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Globals::synchronize(Serializer &s) {
|
void Globals::synchronize(Serializer &s) {
|
||||||
|
|
|
@ -97,14 +97,14 @@ public:
|
||||||
void dispatchSounds();
|
void dispatchSounds();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Globals *_globals;
|
extern Globals *g_globals;
|
||||||
|
|
||||||
#define GLOBALS (*_globals)
|
#define GLOBALS (*g_globals)
|
||||||
#define BF_GLOBALS (*((::TsAGE::BlueForce::BlueForceGlobals *)_globals))
|
#define BF_GLOBALS (*((::TsAGE::BlueForce::BlueForceGlobals *)g_globals))
|
||||||
|
|
||||||
// Note: Currently this can't be part of the _globals structure, since it needs to be constructed
|
// Note: Currently this can't be part of the g_globals structure, since it needs to be constructed
|
||||||
// prior to many of the fields in Globals execute their constructors
|
// prior to many of the fields in Globals execute their constructors
|
||||||
extern ResourceManager *_resourceManager;
|
extern ResourceManager *g_resourceManager;
|
||||||
|
|
||||||
|
|
||||||
namespace BlueForce {
|
namespace BlueForce {
|
||||||
|
|
|
@ -120,7 +120,7 @@ GfxSurface surfaceFromRes(const byte *imgData) {
|
||||||
|
|
||||||
GfxSurface surfaceFromRes(int resNum, int rlbNum, int subNum) {
|
GfxSurface surfaceFromRes(int resNum, int rlbNum, int subNum) {
|
||||||
uint size;
|
uint size;
|
||||||
byte *imgData = _resourceManager->getSubResource(resNum, rlbNum, subNum, &size);
|
byte *imgData = g_resourceManager->getSubResource(resNum, rlbNum, subNum, &size);
|
||||||
GfxSurface surface = surfaceFromRes(imgData);
|
GfxSurface surface = surfaceFromRes(imgData);
|
||||||
DEALLOCATE(imgData);
|
DEALLOCATE(imgData);
|
||||||
|
|
||||||
|
@ -202,8 +202,8 @@ void Rect::resize(const GfxSurface &surface, int xp, int yp, int percent) {
|
||||||
* Expands the pane region to contain the specified Rect
|
* Expands the pane region to contain the specified Rect
|
||||||
*/
|
*/
|
||||||
void Rect::expandPanes() {
|
void Rect::expandPanes() {
|
||||||
_globals->_paneRegions[0].uniteRect(*this);
|
g_globals->_paneRegions[0].uniteRect(*this);
|
||||||
_globals->_paneRegions[1].uniteRect(*this);
|
g_globals->_paneRegions[1].uniteRect(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -408,7 +408,7 @@ bool GfxSurface::displayText(const Common::String &msg, const Common::Point &pt)
|
||||||
|
|
||||||
// Write for a mouse or keypress
|
// Write for a mouse or keypress
|
||||||
Event event;
|
Event event;
|
||||||
while (!_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS) && !_vm->shouldQuit())
|
while (!g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS) && !g_vm->shouldQuit())
|
||||||
;
|
;
|
||||||
|
|
||||||
// Restore the display area
|
// Restore the display area
|
||||||
|
@ -423,15 +423,15 @@ bool GfxSurface::displayText(const Common::String &msg, const Common::Point &pt)
|
||||||
* Loads a quarter of a screen from a resource
|
* Loads a quarter of a screen from a resource
|
||||||
*/
|
*/
|
||||||
void GfxSurface::loadScreenSection(Graphics::Surface &dest, int xHalf, int yHalf, int xSection, int ySection) {
|
void GfxSurface::loadScreenSection(Graphics::Surface &dest, int xHalf, int yHalf, int xSection, int ySection) {
|
||||||
int screenNum = _globals->_sceneManager._scene->_activeScreenNumber;
|
int screenNum = g_globals->_sceneManager._scene->_activeScreenNumber;
|
||||||
Rect updateRect(0, 0, 160, 100);
|
Rect updateRect(0, 0, 160, 100);
|
||||||
updateRect.translate(xHalf * 160, yHalf * 100);
|
updateRect.translate(xHalf * 160, yHalf * 100);
|
||||||
int xHalfCount = (_globals->_sceneManager._scene->_backgroundBounds.right + 159) / 160;
|
int xHalfCount = (g_globals->_sceneManager._scene->_backgroundBounds.right + 159) / 160;
|
||||||
int yHalfCount = (_globals->_sceneManager._scene->_backgroundBounds.bottom + 99) / 100;
|
int yHalfCount = (g_globals->_sceneManager._scene->_backgroundBounds.bottom + 99) / 100;
|
||||||
|
|
||||||
if (xSection < xHalfCount && ySection < yHalfCount) {
|
if (xSection < xHalfCount && ySection < yHalfCount) {
|
||||||
int rlbNum = xSection * yHalfCount + ySection;
|
int rlbNum = xSection * yHalfCount + ySection;
|
||||||
byte *data = _resourceManager->getResource(RES_BITMAP, screenNum, rlbNum);
|
byte *data = g_resourceManager->getResource(RES_BITMAP, screenNum, rlbNum);
|
||||||
|
|
||||||
for (int y = 0; y < updateRect.height(); ++y) {
|
for (int y = 0; y < updateRect.height(); ++y) {
|
||||||
byte *pSrc = data + y * 160;
|
byte *pSrc = data + y * 160;
|
||||||
|
@ -582,8 +582,8 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi
|
||||||
|
|
||||||
while (tempSrc < (pSrc + destBounds.width())) {
|
while (tempSrc < (pSrc + destBounds.width())) {
|
||||||
if (!priorityRegion || !priorityRegion->contains(Common::Point(
|
if (!priorityRegion || !priorityRegion->contains(Common::Point(
|
||||||
xp + _globals->_sceneManager._scene->_sceneBounds.left,
|
xp + g_globals->_sceneManager._scene->_sceneBounds.left,
|
||||||
destBounds.top + y + _globals->_sceneManager._scene->_sceneBounds.top))) {
|
destBounds.top + y + g_globals->_sceneManager._scene->_sceneBounds.top))) {
|
||||||
if (*tempSrc != src._transColor)
|
if (*tempSrc != src._transColor)
|
||||||
*tempDest = *tempSrc;
|
*tempDest = *tempSrc;
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,7 @@ void GfxSurface::draw(const Common::Point &pt, Rect *rect) {
|
||||||
*rect = tempRect;
|
*rect = tempRect;
|
||||||
} else {
|
} else {
|
||||||
// Draw image
|
// Draw image
|
||||||
_globals->gfxManager().copyFrom(*this, tempRect, NULL);
|
g_globals->gfxManager().copyFrom(*this, tempRect, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -623,12 +623,12 @@ GfxElement::GfxElement() {
|
||||||
|
|
||||||
void GfxElement::setDefaults() {
|
void GfxElement::setDefaults() {
|
||||||
_flags = 0;
|
_flags = 0;
|
||||||
_fontNumber = _globals->_gfxFontNumber;
|
_fontNumber = g_globals->_gfxFontNumber;
|
||||||
_colors = _globals->_gfxColors;
|
_colors = g_globals->_gfxColors;
|
||||||
_fontColors = _globals->_fontColors;
|
_fontColors = g_globals->_fontColors;
|
||||||
_color1 = _globals->_color1;
|
_color1 = g_globals->_color1;
|
||||||
_color2 = _globals->_color2;
|
_color2 = g_globals->_color2;
|
||||||
_color3 = _globals->_color3;
|
_color3 = g_globals->_color3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -636,13 +636,13 @@ void GfxElement::setDefaults() {
|
||||||
*/
|
*/
|
||||||
void GfxElement::highlight() {
|
void GfxElement::highlight() {
|
||||||
// Get a lock on the surface
|
// Get a lock on the surface
|
||||||
GfxManager &gfxManager = _globals->gfxManager();
|
GfxManager &gfxManager = g_globals->gfxManager();
|
||||||
Graphics::Surface surface = gfxManager.lockSurface();
|
Graphics::Surface surface = gfxManager.lockSurface();
|
||||||
|
|
||||||
// Scan through the contents of the element, switching any occurances of the foreground
|
// Scan through the contents of the element, switching any occurances of the foreground
|
||||||
// color with the background color and vice versa
|
// color with the background color and vice versa
|
||||||
Rect tempRect(_bounds);
|
Rect tempRect(_bounds);
|
||||||
tempRect.collapse(_globals->_gfxEdgeAdjust - 1, _globals->_gfxEdgeAdjust - 1);
|
tempRect.collapse(g_globals->_gfxEdgeAdjust - 1, g_globals->_gfxEdgeAdjust - 1);
|
||||||
|
|
||||||
for (int yp = tempRect.top; yp < tempRect.bottom; ++yp) {
|
for (int yp = tempRect.top; yp < tempRect.bottom; ++yp) {
|
||||||
byte *lineP = (byte *)surface.getBasePtr(tempRect.left, yp);
|
byte *lineP = (byte *)surface.getBasePtr(tempRect.left, yp);
|
||||||
|
@ -661,7 +661,7 @@ void GfxElement::highlight() {
|
||||||
*/
|
*/
|
||||||
void GfxElement::drawFrame() {
|
void GfxElement::drawFrame() {
|
||||||
// Get a lock on the surface and save the active font
|
// Get a lock on the surface and save the active font
|
||||||
GfxManager &gfxManager = _globals->gfxManager();
|
GfxManager &gfxManager = g_globals->gfxManager();
|
||||||
gfxManager.lockSurface();
|
gfxManager.lockSurface();
|
||||||
|
|
||||||
uint8 bgColor, fgColor;
|
uint8 bgColor, fgColor;
|
||||||
|
@ -674,7 +674,7 @@ void GfxElement::drawFrame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect tempRect = _bounds;
|
Rect tempRect = _bounds;
|
||||||
tempRect.collapse(_globals->_gfxEdgeAdjust, _globals->_gfxEdgeAdjust);
|
tempRect.collapse(g_globals->_gfxEdgeAdjust, g_globals->_gfxEdgeAdjust);
|
||||||
tempRect.collapse(-1, -1);
|
tempRect.collapse(-1, -1);
|
||||||
gfxManager.fillRect(tempRect, _colors.background);
|
gfxManager.fillRect(tempRect, _colors.background);
|
||||||
|
|
||||||
|
@ -715,10 +715,10 @@ bool GfxElement::focusedEvent(Event &event) {
|
||||||
|
|
||||||
// HACK: It should use the GfxManager object to figure out the relative
|
// HACK: It should use the GfxManager object to figure out the relative
|
||||||
// position, but for now this seems like the easiest way.
|
// position, but for now this seems like the easiest way.
|
||||||
int xOffset = mousePos.x - _globals->_events._mousePos.x;
|
int xOffset = mousePos.x - g_globals->_events._mousePos.x;
|
||||||
int yOffset = mousePos.y - _globals->_events._mousePos.y;
|
int yOffset = mousePos.y - g_globals->_events._mousePos.y;
|
||||||
|
|
||||||
while (event.eventType != EVENT_BUTTON_UP && !_vm->shouldQuit()) {
|
while (event.eventType != EVENT_BUTTON_UP && !g_vm->shouldQuit()) {
|
||||||
g_system->delayMillis(10);
|
g_system->delayMillis(10);
|
||||||
|
|
||||||
if (_bounds.contains(mousePos)) {
|
if (_bounds.contains(mousePos)) {
|
||||||
|
@ -733,7 +733,7 @@ bool GfxElement::focusedEvent(Event &event) {
|
||||||
highlight();
|
highlight();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_globals->_events.getEvent(event, EVENT_MOUSE_MOVE | EVENT_BUTTON_UP)) {
|
if (g_globals->_events.getEvent(event, EVENT_MOUSE_MOVE | EVENT_BUTTON_UP)) {
|
||||||
if (event.eventType == EVENT_MOUSE_MOVE) {
|
if (event.eventType == EVENT_MOUSE_MOVE) {
|
||||||
mousePos.x = event.mousePos.x + xOffset;
|
mousePos.x = event.mousePos.x + xOffset;
|
||||||
mousePos.y = event.mousePos.y + yOffset;
|
mousePos.y = event.mousePos.y + yOffset;
|
||||||
|
@ -769,7 +769,7 @@ void GfxImage::setDefaults() {
|
||||||
|
|
||||||
// Decode the image
|
// Decode the image
|
||||||
uint size;
|
uint size;
|
||||||
byte *imgData = _resourceManager->getSubResource(_resNum, _rlbNum, _cursorNum, &size);
|
byte *imgData = g_resourceManager->getSubResource(_resNum, _rlbNum, _cursorNum, &size);
|
||||||
_surface = surfaceFromRes(imgData);
|
_surface = surfaceFromRes(imgData);
|
||||||
DEALLOCATE(imgData);
|
DEALLOCATE(imgData);
|
||||||
|
|
||||||
|
@ -781,9 +781,9 @@ void GfxImage::setDefaults() {
|
||||||
|
|
||||||
void GfxImage::draw() {
|
void GfxImage::draw() {
|
||||||
Rect tempRect = _bounds;
|
Rect tempRect = _bounds;
|
||||||
tempRect.translate(_globals->gfxManager()._topLeft.x, _globals->gfxManager()._topLeft.y);
|
tempRect.translate(g_globals->gfxManager()._topLeft.x, g_globals->gfxManager()._topLeft.y);
|
||||||
|
|
||||||
_globals->gfxManager().copyFrom(_surface, tempRect);
|
g_globals->gfxManager().copyFrom(_surface, tempRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
@ -805,7 +805,7 @@ void GfxMessage::setDefaults() {
|
||||||
GfxElement::setDefaults();
|
GfxElement::setDefaults();
|
||||||
|
|
||||||
GfxFontBackup font;
|
GfxFontBackup font;
|
||||||
GfxManager &gfxManager = _globals->gfxManager();
|
GfxManager &gfxManager = g_globals->gfxManager();
|
||||||
Rect tempRect;
|
Rect tempRect;
|
||||||
|
|
||||||
gfxManager._font.setFontNumber(this->_fontNumber);
|
gfxManager._font.setFontNumber(this->_fontNumber);
|
||||||
|
@ -818,7 +818,7 @@ void GfxMessage::setDefaults() {
|
||||||
|
|
||||||
void GfxMessage::draw() {
|
void GfxMessage::draw() {
|
||||||
GfxFontBackup font;
|
GfxFontBackup font;
|
||||||
GfxManager &gfxManager = _globals->gfxManager();
|
GfxManager &gfxManager = g_globals->gfxManager();
|
||||||
|
|
||||||
// Set the font and color
|
// Set the font and color
|
||||||
gfxManager.setFillFlag(false);
|
gfxManager.setFillFlag(false);
|
||||||
|
@ -838,7 +838,7 @@ void GfxButton::setDefaults() {
|
||||||
GfxElement::setDefaults();
|
GfxElement::setDefaults();
|
||||||
|
|
||||||
GfxFontBackup font;
|
GfxFontBackup font;
|
||||||
GfxManager &gfxManager = _globals->gfxManager();
|
GfxManager &gfxManager = g_globals->gfxManager();
|
||||||
Rect tempRect;
|
Rect tempRect;
|
||||||
|
|
||||||
// Get the string bounds and round up the x end to a multiple of 16
|
// Get the string bounds and round up the x end to a multiple of 16
|
||||||
|
@ -847,8 +847,8 @@ void GfxButton::setDefaults() {
|
||||||
tempRect.right = ((tempRect.right + 15) / 16) * 16;
|
tempRect.right = ((tempRect.right + 15) / 16) * 16;
|
||||||
|
|
||||||
// Set the button bounds
|
// Set the button bounds
|
||||||
tempRect.collapse(-_globals->_gfxEdgeAdjust, -_globals->_gfxEdgeAdjust);
|
tempRect.collapse(-g_globals->_gfxEdgeAdjust, -g_globals->_gfxEdgeAdjust);
|
||||||
if (_vm->getFeatures() & GF_CD)
|
if (g_vm->getFeatures() & GF_CD)
|
||||||
--tempRect.top;
|
--tempRect.top;
|
||||||
tempRect.moveTo(_bounds.left, _bounds.top);
|
tempRect.moveTo(_bounds.left, _bounds.top);
|
||||||
_bounds = tempRect;
|
_bounds = tempRect;
|
||||||
|
@ -857,7 +857,7 @@ void GfxButton::setDefaults() {
|
||||||
void GfxButton::draw() {
|
void GfxButton::draw() {
|
||||||
// Get a lock on the surface and save the active font
|
// Get a lock on the surface and save the active font
|
||||||
GfxFontBackup font;
|
GfxFontBackup font;
|
||||||
GfxManager &gfxManager = _globals->gfxManager();
|
GfxManager &gfxManager = g_globals->gfxManager();
|
||||||
gfxManager.lockSurface();
|
gfxManager.lockSurface();
|
||||||
|
|
||||||
// Draw a basic frame for the button
|
// Draw a basic frame for the button
|
||||||
|
@ -873,8 +873,8 @@ void GfxButton::draw() {
|
||||||
|
|
||||||
// Display the button's text
|
// Display the button's text
|
||||||
Rect tempRect(_bounds);
|
Rect tempRect(_bounds);
|
||||||
tempRect.collapse(_globals->_gfxEdgeAdjust, _globals->_gfxEdgeAdjust);
|
tempRect.collapse(g_globals->_gfxEdgeAdjust, g_globals->_gfxEdgeAdjust);
|
||||||
if (_vm->getFeatures() & GF_CD)
|
if (g_vm->getFeatures() & GF_CD)
|
||||||
++tempRect.top;
|
++tempRect.top;
|
||||||
gfxManager._font.writeLines(_message.c_str(), tempRect, ALIGN_CENTER);
|
gfxManager._font.writeLines(_message.c_str(), tempRect, ALIGN_CENTER);
|
||||||
|
|
||||||
|
@ -936,14 +936,14 @@ void GfxDialog::setDefaults() {
|
||||||
|
|
||||||
// Set the dialog boundaries
|
// Set the dialog boundaries
|
||||||
_gfxManager._bounds = tempRect;
|
_gfxManager._bounds = tempRect;
|
||||||
tempRect.collapse(-_globals->_gfxEdgeAdjust * 2, -_globals->_gfxEdgeAdjust * 2);
|
tempRect.collapse(-g_globals->_gfxEdgeAdjust * 2, -g_globals->_gfxEdgeAdjust * 2);
|
||||||
_bounds = tempRect;
|
_bounds = tempRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxDialog::remove() {
|
void GfxDialog::remove() {
|
||||||
if (_savedArea) {
|
if (_savedArea) {
|
||||||
// Restore the area the dialog covered
|
// Restore the area the dialog covered
|
||||||
_globals->_gfxManagerInstance.copyFrom(*_savedArea, _bounds.left, _bounds.top);
|
g_globals->_gfxManagerInstance.copyFrom(*_savedArea, _bounds.left, _bounds.top);
|
||||||
|
|
||||||
delete _savedArea;
|
delete _savedArea;
|
||||||
_savedArea = NULL;
|
_savedArea = NULL;
|
||||||
|
@ -954,7 +954,7 @@ void GfxDialog::draw() {
|
||||||
Rect tempRect(_bounds);
|
Rect tempRect(_bounds);
|
||||||
|
|
||||||
// Make a backup copy of the area the dialog will occupy
|
// Make a backup copy of the area the dialog will occupy
|
||||||
_savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds);
|
_savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
|
||||||
|
|
||||||
// Set the palette for use in the dialog
|
// Set the palette for use in the dialog
|
||||||
setPalette();
|
setPalette();
|
||||||
|
@ -966,7 +966,7 @@ void GfxDialog::draw() {
|
||||||
drawFrame();
|
drawFrame();
|
||||||
|
|
||||||
// Reset the dialog's graphics manager to only draw within the dialog boundaries
|
// Reset the dialog's graphics manager to only draw within the dialog boundaries
|
||||||
tempRect.translate(_globals->_gfxEdgeAdjust * 2, _globals->_gfxEdgeAdjust * 2);
|
tempRect.translate(g_globals->_gfxEdgeAdjust * 2, g_globals->_gfxEdgeAdjust * 2);
|
||||||
_gfxManager._bounds = tempRect;
|
_gfxManager._bounds = tempRect;
|
||||||
|
|
||||||
// Draw each element in the dialog in order
|
// Draw each element in the dialog in order
|
||||||
|
@ -1003,7 +1003,7 @@ void GfxDialog::addElements(GfxElement *ge, ...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxDialog::setTopLeft(int xp, int yp) {
|
void GfxDialog::setTopLeft(int xp, int yp) {
|
||||||
_bounds.moveTo(xp - _globals->_gfxEdgeAdjust * 2, yp - _globals->_gfxEdgeAdjust * 2);
|
_bounds.moveTo(xp - g_globals->_gfxEdgeAdjust * 2, yp - g_globals->_gfxEdgeAdjust * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxDialog::setCenter(int xp, int yp) {
|
void GfxDialog::setCenter(int xp, int yp) {
|
||||||
|
@ -1029,9 +1029,9 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) {
|
||||||
GfxButton *selectedButton = NULL;
|
GfxButton *selectedButton = NULL;
|
||||||
|
|
||||||
bool breakFlag = false;
|
bool breakFlag = false;
|
||||||
while (!_vm->shouldQuit() && !breakFlag) {
|
while (!g_vm->shouldQuit() && !breakFlag) {
|
||||||
Event event;
|
Event event;
|
||||||
while (_globals->_events.getEvent(event) && !breakFlag) {
|
while (g_globals->_events.getEvent(event) && !breakFlag) {
|
||||||
// Adjust mouse positions to be relative within the dialog
|
// Adjust mouse positions to be relative within the dialog
|
||||||
event.mousePos.x -= _gfxManager._bounds.left;
|
event.mousePos.x -= _gfxManager._bounds.left;
|
||||||
event.mousePos.y -= _gfxManager._bounds.top;
|
event.mousePos.y -= _gfxManager._bounds.top;
|
||||||
|
@ -1069,28 +1069,28 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxDialog::setPalette() {
|
void GfxDialog::setPalette() {
|
||||||
if (_vm->getGameID() == GType_BlueForce) {
|
if (g_vm->getGameID() == GType_BlueForce) {
|
||||||
_globals->_scenePalette.loadPalette(2);
|
g_globals->_scenePalette.loadPalette(2);
|
||||||
_globals->_scenePalette.setPalette(0, 1);
|
g_globals->_scenePalette.setPalette(0, 1);
|
||||||
_globals->_scenePalette.setPalette(_globals->_gfxColors.background, 1);
|
g_globals->_scenePalette.setPalette(g_globals->_gfxColors.background, 1);
|
||||||
_globals->_scenePalette.setPalette(_globals->_gfxColors.foreground, 1);
|
g_globals->_scenePalette.setPalette(g_globals->_gfxColors.foreground, 1);
|
||||||
_globals->_scenePalette.setPalette(_globals->_fontColors.background, 1);
|
g_globals->_scenePalette.setPalette(g_globals->_fontColors.background, 1);
|
||||||
_globals->_scenePalette.setPalette(_globals->_fontColors.foreground, 1);
|
g_globals->_scenePalette.setPalette(g_globals->_fontColors.foreground, 1);
|
||||||
_globals->_scenePalette.setEntry(255, 0xff, 0xff, 0xff);
|
g_globals->_scenePalette.setEntry(255, 0xff, 0xff, 0xff);
|
||||||
_globals->_scenePalette.setPalette(255, 1);
|
g_globals->_scenePalette.setPalette(255, 1);
|
||||||
} else {
|
} else {
|
||||||
_globals->_scenePalette.loadPalette(0);
|
g_globals->_scenePalette.loadPalette(0);
|
||||||
_globals->_scenePalette.setPalette(0, 1);
|
g_globals->_scenePalette.setPalette(0, 1);
|
||||||
_globals->_scenePalette.setPalette(_globals->_scenePalette._colors.foreground, 1);
|
g_globals->_scenePalette.setPalette(g_globals->_scenePalette._colors.foreground, 1);
|
||||||
_globals->_scenePalette.setPalette(_globals->_fontColors.background, 1);
|
g_globals->_scenePalette.setPalette(g_globals->_fontColors.background, 1);
|
||||||
_globals->_scenePalette.setPalette(_globals->_fontColors.foreground, 1);
|
g_globals->_scenePalette.setPalette(g_globals->_fontColors.foreground, 1);
|
||||||
_globals->_scenePalette.setPalette(255, 1);
|
g_globals->_scenePalette.setPalette(255, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
GfxManager::GfxManager() : _surface(_globals->_screenSurface), _oldManager(NULL) {
|
GfxManager::GfxManager() : _surface(g_globals->_screenSurface), _oldManager(NULL) {
|
||||||
_font.setOwner(this);
|
_font.setOwner(this);
|
||||||
_font._fillFlag = false;
|
_font._fillFlag = false;
|
||||||
_bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
_bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
|
@ -1109,19 +1109,19 @@ void GfxManager::setDefaults() {
|
||||||
_pane0Rect4 = screenBounds;
|
_pane0Rect4 = screenBounds;
|
||||||
|
|
||||||
_font._edgeSize = Common::Point(1, 1);
|
_font._edgeSize = Common::Point(1, 1);
|
||||||
_font._colors = _globals->_fontColors;
|
_font._colors = g_globals->_fontColors;
|
||||||
_font.setFontNumber(_globals->_gfxFontNumber);
|
_font.setFontNumber(g_globals->_gfxFontNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxManager::activate() {
|
void GfxManager::activate() {
|
||||||
assert(!contains(_globals->_gfxManagers, this));
|
assert(!contains(g_globals->_gfxManagers, this));
|
||||||
_globals->_gfxManagers.push_front(this);
|
g_globals->_gfxManagers.push_front(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxManager::deactivate() {
|
void GfxManager::deactivate() {
|
||||||
// Assert that there will still be another manager, and we're correctly removing our own
|
// Assert that there will still be another manager, and we're correctly removing our own
|
||||||
assert((_globals->_gfxManagers.size() > 1) && (&_globals->gfxManager() == this));
|
assert((g_globals->_gfxManagers.size() > 1) && (&g_globals->gfxManager() == this));
|
||||||
_globals->_gfxManagers.pop_front();
|
g_globals->_gfxManagers.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GfxManager::getStringWidth(const char *s, int numChars) {
|
int GfxManager::getStringWidth(const char *s, int numChars) {
|
||||||
|
@ -1159,7 +1159,7 @@ void GfxManager::setDialogPalette() {
|
||||||
// Get the main palette information
|
// Get the main palette information
|
||||||
byte palData[256 * 3];
|
byte palData[256 * 3];
|
||||||
uint count, start;
|
uint count, start;
|
||||||
_resourceManager->getPalette(0, &palData[0], &start, &count);
|
g_resourceManager->getPalette(0, &palData[0], &start, &count);
|
||||||
g_system->getPaletteManager()->setPalette(&palData[0], start, count);
|
g_system->getPaletteManager()->setPalette(&palData[0], start, count);
|
||||||
|
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
|
@ -1194,7 +1194,7 @@ int GfxManager::getAngle(const Common::Point &p1, const Common::Point &p2) {
|
||||||
|
|
||||||
|
|
||||||
GfxFont::GfxFont() {
|
GfxFont::GfxFont() {
|
||||||
_fontNumber = (_vm->getFeatures() & GF_DEMO) ? 0 : 50;
|
_fontNumber = (g_vm->getFeatures() & GF_DEMO) ? 0 : 50;
|
||||||
_numChars = 0;
|
_numChars = 0;
|
||||||
_bpp = 0;
|
_bpp = 0;
|
||||||
_fontData = NULL;
|
_fontData = NULL;
|
||||||
|
@ -1218,9 +1218,9 @@ void GfxFont::setFontNumber(uint32 fontNumber) {
|
||||||
|
|
||||||
_fontNumber = fontNumber;
|
_fontNumber = fontNumber;
|
||||||
|
|
||||||
_fontData = _resourceManager->getResource(RES_FONT, _fontNumber, 0, true);
|
_fontData = g_resourceManager->getResource(RES_FONT, _fontNumber, 0, true);
|
||||||
if (!_fontData)
|
if (!_fontData)
|
||||||
_fontData = _resourceManager->getResource(RES_FONT, _fontNumber, 0);
|
_fontData = g_resourceManager->getResource(RES_FONT, _fontNumber, 0);
|
||||||
|
|
||||||
_numChars = READ_LE_UINT16(_fontData + 4);
|
_numChars = READ_LE_UINT16(_fontData + 4);
|
||||||
_fontSize.y = READ_LE_UINT16(_fontData + 6);
|
_fontSize.y = READ_LE_UINT16(_fontData + 6);
|
||||||
|
@ -1509,17 +1509,17 @@ void GfxFont::writeLines(const char *s, const Rect &bounds, TextAlign align) {
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
GfxFontBackup::GfxFontBackup() {
|
GfxFontBackup::GfxFontBackup() {
|
||||||
_edgeSize = _globals->gfxManager()._font._edgeSize;
|
_edgeSize = g_globals->gfxManager()._font._edgeSize;
|
||||||
_position = _globals->gfxManager()._font._position;
|
_position = g_globals->gfxManager()._font._position;
|
||||||
_colors = _globals->gfxManager()._font._colors;
|
_colors = g_globals->gfxManager()._font._colors;
|
||||||
_fontNumber = _globals->gfxManager()._font._fontNumber;
|
_fontNumber = g_globals->gfxManager()._font._fontNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
GfxFontBackup::~GfxFontBackup() {
|
GfxFontBackup::~GfxFontBackup() {
|
||||||
_globals->gfxManager()._font.setFontNumber(_fontNumber);
|
g_globals->gfxManager()._font.setFontNumber(_fontNumber);
|
||||||
_globals->gfxManager()._font._edgeSize = _edgeSize;
|
g_globals->gfxManager()._font._edgeSize = _edgeSize;
|
||||||
_globals->gfxManager()._font._position = _position;
|
g_globals->gfxManager()._font._position = _position;
|
||||||
_globals->gfxManager()._font._colors = _colors;
|
g_globals->gfxManager()._font._colors = _colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -438,7 +438,7 @@ ResourceManager::~ResourceManager() {
|
||||||
void ResourceManager::addLib(const Common::String &libName) {
|
void ResourceManager::addLib(const Common::String &libName) {
|
||||||
assert(_libList.size() < 5);
|
assert(_libList.size() < 5);
|
||||||
|
|
||||||
_libList.push_back(new TLib(_vm->_memoryManager, libName));
|
_libList.push_back(new TLib(g_vm->_memoryManager, libName));
|
||||||
}
|
}
|
||||||
|
|
||||||
byte *ResourceManager::getResource(uint16 id, bool suppressErrors) {
|
byte *ResourceManager::getResource(uint16 id, bool suppressErrors) {
|
||||||
|
|
|
@ -31,9 +31,9 @@ namespace Ringworld {
|
||||||
|
|
||||||
void RingworldDemoGame::start() {
|
void RingworldDemoGame::start() {
|
||||||
// Start the demo's single scene
|
// Start the demo's single scene
|
||||||
_globals->_sceneManager.changeScene(1);
|
g_globals->_sceneManager.changeScene(1);
|
||||||
|
|
||||||
_globals->_events.setCursor(CURSOR_NONE);
|
g_globals->_events.setCursor(CURSOR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scene *RingworldDemoGame::createScene(int sceneNumber) {
|
Scene *RingworldDemoGame::createScene(int sceneNumber) {
|
||||||
|
@ -43,11 +43,11 @@ Scene *RingworldDemoGame::createScene(int sceneNumber) {
|
||||||
|
|
||||||
void RingworldDemoGame::quitGame() {
|
void RingworldDemoGame::quitGame() {
|
||||||
if (MessageDialog::show(DEMO_EXIT_MSG, EXIT_BTN_STRING, DEMO_BTN_STRING) == 0)
|
if (MessageDialog::show(DEMO_EXIT_MSG, EXIT_BTN_STRING, DEMO_BTN_STRING) == 0)
|
||||||
_vm->quitGame();
|
g_vm->quitGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RingworldDemoGame::pauseGame() {
|
void RingworldDemoGame::pauseGame() {
|
||||||
_globals->_events.setCursor(CURSOR_ARROW);
|
g_globals->_events.setCursor(CURSOR_ARROW);
|
||||||
MessageDialog *dlg = new MessageDialog(DEMO_PAUSED_MSG, EXIT_BTN_STRING, DEMO_RESUME_BTN_STRING);
|
MessageDialog *dlg = new MessageDialog(DEMO_PAUSED_MSG, EXIT_BTN_STRING, DEMO_RESUME_BTN_STRING);
|
||||||
dlg->draw();
|
dlg->draw();
|
||||||
|
|
||||||
|
@ -55,10 +55,10 @@ void RingworldDemoGame::pauseGame() {
|
||||||
bool exitFlag = selectedButton != &dlg->_btn2;
|
bool exitFlag = selectedButton != &dlg->_btn2;
|
||||||
|
|
||||||
delete dlg;
|
delete dlg;
|
||||||
_globals->_events.hideCursor();
|
g_globals->_events.hideCursor();
|
||||||
|
|
||||||
if (exitFlag)
|
if (exitFlag)
|
||||||
_vm->quitGame();
|
g_vm->quitGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RingworldDemoGame::processEvent(Event &event) {
|
void RingworldDemoGame::processEvent(Event &event) {
|
||||||
|
@ -74,8 +74,8 @@ void RingworldDemoGame::processEvent(Event &event) {
|
||||||
ConfigDialog *dlg = new ConfigDialog();
|
ConfigDialog *dlg = new ConfigDialog();
|
||||||
dlg->runModal();
|
dlg->runModal();
|
||||||
delete dlg;
|
delete dlg;
|
||||||
_globals->_soundManager.syncSounds();
|
g_globals->_soundManager.syncSounds();
|
||||||
_globals->_events.setCursorFromFlag();
|
g_globals->_events.setCursorFromFlag();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,18 +54,18 @@ RightClickButton::RightClickButton(int buttonIndex, int xp, int yp) : GfxButton(
|
||||||
void RightClickButton::highlight() {
|
void RightClickButton::highlight() {
|
||||||
if (_savedButton) {
|
if (_savedButton) {
|
||||||
// Button was previously highlighted, so de-highlight by restoring saved area
|
// Button was previously highlighted, so de-highlight by restoring saved area
|
||||||
_globals->gfxManager().copyFrom(*_savedButton, _bounds.left, _bounds.top);
|
g_globals->gfxManager().copyFrom(*_savedButton, _bounds.left, _bounds.top);
|
||||||
delete _savedButton;
|
delete _savedButton;
|
||||||
_savedButton = NULL;
|
_savedButton = NULL;
|
||||||
} else {
|
} else {
|
||||||
// Highlight button by getting the needed highlighted image resource
|
// Highlight button by getting the needed highlighted image resource
|
||||||
_savedButton = Surface_getArea(_globals->gfxManager().getSurface(), _bounds);
|
_savedButton = Surface_getArea(g_globals->gfxManager().getSurface(), _bounds);
|
||||||
|
|
||||||
uint size;
|
uint size;
|
||||||
byte *imgData = _resourceManager->getSubResource(7, 2, _buttonIndex, &size);
|
byte *imgData = g_resourceManager->getSubResource(7, 2, _buttonIndex, &size);
|
||||||
|
|
||||||
GfxSurface btnSelected = surfaceFromRes(imgData);
|
GfxSurface btnSelected = surfaceFromRes(imgData);
|
||||||
_globals->gfxManager().copyFrom(btnSelected, _bounds.left, _bounds.top);
|
g_globals->gfxManager().copyFrom(btnSelected, _bounds.left, _bounds.top);
|
||||||
|
|
||||||
DEALLOCATE(imgData);
|
DEALLOCATE(imgData);
|
||||||
}
|
}
|
||||||
|
@ -83,17 +83,17 @@ RightClickDialog::RightClickDialog() : GfxDialog(),
|
||||||
|
|
||||||
// Set the palette and change the cursor
|
// Set the palette and change the cursor
|
||||||
_gfxManager.setDialogPalette();
|
_gfxManager.setDialogPalette();
|
||||||
_globals->_events.setCursor(CURSOR_ARROW);
|
g_globals->_events.setCursor(CURSOR_ARROW);
|
||||||
|
|
||||||
// Get the dialog image
|
// Get the dialog image
|
||||||
_surface = surfaceFromRes(7, 1, 1);
|
_surface = surfaceFromRes(7, 1, 1);
|
||||||
|
|
||||||
// Set the dialog position
|
// Set the dialog position
|
||||||
dialogRect.resize(_surface, 0, 0, 100);
|
dialogRect.resize(_surface, 0, 0, 100);
|
||||||
dialogRect.center(_globals->_events._mousePos.x, _globals->_events._mousePos.y);
|
dialogRect.center(g_globals->_events._mousePos.x, g_globals->_events._mousePos.y);
|
||||||
|
|
||||||
// Ensure the dialog will be entirely on-screen
|
// Ensure the dialog will be entirely on-screen
|
||||||
Rect screenRect = _globals->gfxManager()._bounds;
|
Rect screenRect = g_globals->gfxManager()._bounds;
|
||||||
screenRect.collapse(4, 4);
|
screenRect.collapse(4, 4);
|
||||||
dialogRect.contain(screenRect);
|
dialogRect.contain(screenRect);
|
||||||
|
|
||||||
|
@ -122,10 +122,10 @@ RightClickButton *RightClickDialog::findButton(const Common::Point &pt) {
|
||||||
|
|
||||||
void RightClickDialog::draw() {
|
void RightClickDialog::draw() {
|
||||||
// Save the covered background area
|
// Save the covered background area
|
||||||
_savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds);
|
_savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
|
||||||
|
|
||||||
// Draw the dialog image
|
// Draw the dialog image
|
||||||
_globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top);
|
g_globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RightClickDialog::process(Event &event) {
|
bool RightClickDialog::process(Event &event) {
|
||||||
|
@ -173,9 +173,9 @@ void RightClickDialog::execute() {
|
||||||
// Dialog event handler loop
|
// Dialog event handler loop
|
||||||
_gfxManager.activate();
|
_gfxManager.activate();
|
||||||
|
|
||||||
while (!_vm->shouldQuit() && (_selectedAction == -1)) {
|
while (!g_vm->shouldQuit() && (_selectedAction == -1)) {
|
||||||
Event evt;
|
Event evt;
|
||||||
while (_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) {
|
while (g_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) {
|
||||||
evt.mousePos.x -= _bounds.left;
|
evt.mousePos.x -= _bounds.left;
|
||||||
evt.mousePos.y -= _bounds.top;
|
evt.mousePos.y -= _bounds.top;
|
||||||
|
|
||||||
|
@ -190,19 +190,19 @@ void RightClickDialog::execute() {
|
||||||
switch (_selectedAction) {
|
switch (_selectedAction) {
|
||||||
case 1:
|
case 1:
|
||||||
// Look action
|
// Look action
|
||||||
_globals->_events.setCursor(CURSOR_LOOK);
|
g_globals->_events.setCursor(CURSOR_LOOK);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// Walk action
|
// Walk action
|
||||||
_globals->_events.setCursor(CURSOR_WALK);
|
g_globals->_events.setCursor(CURSOR_WALK);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// Use cursor
|
// Use cursor
|
||||||
_globals->_events.setCursor(CURSOR_USE);
|
g_globals->_events.setCursor(CURSOR_USE);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
// Talk cursor
|
// Talk cursor
|
||||||
_globals->_events.setCursor(CURSOR_TALK);
|
g_globals->_events.setCursor(CURSOR_TALK);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
// Inventory dialog
|
// Inventory dialog
|
||||||
|
|
|
@ -278,7 +278,7 @@ void SceneArea::display() {
|
||||||
_bounds.setWidth(_surface.getBounds().width());
|
_bounds.setWidth(_surface.getBounds().width());
|
||||||
_bounds.setHeight(_surface.getBounds().height());
|
_bounds.setHeight(_surface.getBounds().height());
|
||||||
|
|
||||||
_savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds);
|
_savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
|
||||||
draw2();
|
draw2();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,13 +297,13 @@ void SceneArea::draw(bool flag) {
|
||||||
void SceneArea::wait() {
|
void SceneArea::wait() {
|
||||||
// Wait until a mouse or keypress
|
// Wait until a mouse or keypress
|
||||||
Event event;
|
Event event;
|
||||||
while (!_vm->shouldQuit() && !_globals->_events.getEvent(event)) {
|
while (!g_vm->shouldQuit() && !g_globals->_events.getEvent(event)) {
|
||||||
g_system->updateScreen();
|
g_system->updateScreen();
|
||||||
g_system->delayMillis(10);
|
g_system->delayMillis(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
SynchronizedList<SceneItem *>::iterator ii;
|
SynchronizedList<SceneItem *>::iterator ii;
|
||||||
for (ii = _globals->_sceneItems.begin(); ii != _globals->_sceneItems.end(); ++ii) {
|
for (ii = g_globals->_sceneItems.begin(); ii != g_globals->_sceneItems.end(); ++ii) {
|
||||||
SceneItem *sceneItem = *ii;
|
SceneItem *sceneItem = *ii;
|
||||||
if (sceneItem->contains(event.mousePos)) {
|
if (sceneItem->contains(event.mousePos)) {
|
||||||
sceneItem->doAction(_actionId);
|
sceneItem->doAction(_actionId);
|
||||||
|
@ -311,7 +311,7 @@ void SceneArea::wait() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_globals->_events.setCursor(CURSOR_ARROW);
|
g_globals->_events.setCursor(CURSOR_ARROW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneArea::synchronize(Serializer &s) {
|
void SceneArea::synchronize(Serializer &s) {
|
||||||
|
@ -406,11 +406,11 @@ RingworldInvObjectList::RingworldInvObjectList() :
|
||||||
|
|
||||||
void RingworldGame::start() {
|
void RingworldGame::start() {
|
||||||
// Set some default flags
|
// Set some default flags
|
||||||
_globals->setFlag(12);
|
g_globals->setFlag(12);
|
||||||
_globals->setFlag(34);
|
g_globals->setFlag(34);
|
||||||
|
|
||||||
// Set the screen to scroll in response to the player moving off-screen
|
// Set the screen to scroll in response to the player moving off-screen
|
||||||
_globals->_scrollFollower = &_globals->_player;
|
g_globals->_scrollFollower = &g_globals->_player;
|
||||||
|
|
||||||
// Set the object's that will be in the player's inventory by default
|
// Set the object's that will be in the player's inventory by default
|
||||||
RING_INVENTORY._stunner._sceneNumber = 1;
|
RING_INVENTORY._stunner._sceneNumber = 1;
|
||||||
|
@ -421,8 +421,8 @@ void RingworldGame::start() {
|
||||||
|
|
||||||
if (ConfMan.hasKey("save_slot")) {
|
if (ConfMan.hasKey("save_slot")) {
|
||||||
slot = ConfMan.getInt("save_slot");
|
slot = ConfMan.getInt("save_slot");
|
||||||
Common::String file = _vm->generateSaveName(slot);
|
Common::String file = g_vm->generateSaveName(slot);
|
||||||
Common::InSaveFile *in = _vm->_system->getSavefileManager()->openForLoading(file);
|
Common::InSaveFile *in = g_vm->_system->getSavefileManager()->openForLoading(file);
|
||||||
if (in)
|
if (in)
|
||||||
delete in;
|
delete in;
|
||||||
else
|
else
|
||||||
|
@ -430,28 +430,28 @@ void RingworldGame::start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slot >= 0)
|
if (slot >= 0)
|
||||||
_globals->_sceneHandler->_loadGameSlot = slot;
|
g_globals->_sceneHandler->_loadGameSlot = slot;
|
||||||
else
|
else
|
||||||
// Switch to the title screen
|
// Switch to the title screen
|
||||||
_globals->_sceneManager.setNewScene(1000);
|
g_globals->_sceneManager.setNewScene(1000);
|
||||||
|
|
||||||
_globals->_events.showCursor();
|
g_globals->_events.showCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RingworldGame::restart() {
|
void RingworldGame::restart() {
|
||||||
_globals->_scenePalette.clearListeners();
|
g_globals->_scenePalette.clearListeners();
|
||||||
_globals->_soundHandler.stop();
|
g_globals->_soundHandler.stop();
|
||||||
|
|
||||||
// Reset the flags
|
// Reset the flags
|
||||||
_globals->reset();
|
g_globals->reset();
|
||||||
_globals->setFlag(34);
|
g_globals->setFlag(34);
|
||||||
|
|
||||||
// Clear save/load slots
|
// Clear save/load slots
|
||||||
_globals->_sceneHandler->_saveGameSlot = -1;
|
g_globals->_sceneHandler->_saveGameSlot = -1;
|
||||||
_globals->_sceneHandler->_loadGameSlot = -1;
|
g_globals->_sceneHandler->_loadGameSlot = -1;
|
||||||
|
|
||||||
_globals->_stripNum = 0;
|
g_globals->_stripNum = 0;
|
||||||
_globals->_events.setCursor(CURSOR_WALK);
|
g_globals->_events.setCursor(CURSOR_WALK);
|
||||||
|
|
||||||
// Reset item properties
|
// Reset item properties
|
||||||
RING_INVENTORY._stunner._sceneNumber = 1;
|
RING_INVENTORY._stunner._sceneNumber = 1;
|
||||||
|
@ -489,37 +489,37 @@ void RingworldGame::restart() {
|
||||||
RING_INVENTORY._selectedItem = NULL;
|
RING_INVENTORY._selectedItem = NULL;
|
||||||
|
|
||||||
// Change to the first game scene
|
// Change to the first game scene
|
||||||
_globals->_sceneManager.changeScene(30);
|
g_globals->_sceneManager.changeScene(30);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RingworldGame::endGame(int resNum, int lineNum) {
|
void RingworldGame::endGame(int resNum, int lineNum) {
|
||||||
_globals->_events.setCursor(CURSOR_WALK);
|
g_globals->_events.setCursor(CURSOR_WALK);
|
||||||
Common::String msg = _resourceManager->getMessage(resNum, lineNum);
|
Common::String msg = g_resourceManager->getMessage(resNum, lineNum);
|
||||||
bool savesExist = _saver->savegamesExist();
|
bool savesExist = g_saver->savegamesExist();
|
||||||
|
|
||||||
if (!savesExist) {
|
if (!savesExist) {
|
||||||
// No savegames exist, so prompt the user to restart or quit
|
// No savegames exist, so prompt the user to restart or quit
|
||||||
if (MessageDialog::show(msg, QUIT_BTN_STRING, RESTART_BTN_STRING) == 0)
|
if (MessageDialog::show(msg, QUIT_BTN_STRING, RESTART_BTN_STRING) == 0)
|
||||||
_vm->quitGame();
|
g_vm->quitGame();
|
||||||
else
|
else
|
||||||
restart();
|
restart();
|
||||||
} else {
|
} else {
|
||||||
// Savegames exist, so prompt for Restore/Restart
|
// Savegames exist, so prompt for Restore/Restart
|
||||||
bool breakFlag;
|
bool breakFlag;
|
||||||
do {
|
do {
|
||||||
if (_vm->shouldQuit()) {
|
if (g_vm->shouldQuit()) {
|
||||||
breakFlag = true;
|
breakFlag = true;
|
||||||
} else if (MessageDialog::show(msg, RESTART_BTN_STRING, RESTORE_BTN_STRING) == 0) {
|
} else if (MessageDialog::show(msg, RESTART_BTN_STRING, RESTORE_BTN_STRING) == 0) {
|
||||||
restart();
|
restart();
|
||||||
breakFlag = true;
|
breakFlag = true;
|
||||||
} else {
|
} else {
|
||||||
handleSaveLoad(false, _globals->_sceneHandler->_loadGameSlot, _globals->_sceneHandler->_saveName);
|
handleSaveLoad(false, g_globals->_sceneHandler->_loadGameSlot, g_globals->_sceneHandler->_saveName);
|
||||||
breakFlag = _globals->_sceneHandler->_loadGameSlot >= 0;
|
breakFlag = g_globals->_sceneHandler->_loadGameSlot >= 0;
|
||||||
}
|
}
|
||||||
} while (!breakFlag);
|
} while (!breakFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
_globals->_events.setCursorFromFlag();
|
g_globals->_events.setCursorFromFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RingworldGame::processEvent(Event &event) {
|
void RingworldGame::processEvent(Event &event) {
|
||||||
|
@ -544,20 +544,20 @@ void RingworldGame::processEvent(Event &event) {
|
||||||
case Common::KEYCODE_F4:
|
case Common::KEYCODE_F4:
|
||||||
// F4 - Restart
|
// F4 - Restart
|
||||||
restartGame();
|
restartGame();
|
||||||
_globals->_events.setCursorFromFlag();
|
g_globals->_events.setCursorFromFlag();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Common::KEYCODE_F7:
|
case Common::KEYCODE_F7:
|
||||||
// F7 - Restore
|
// F7 - Restore
|
||||||
restoreGame();
|
restoreGame();
|
||||||
_globals->_events.setCursorFromFlag();
|
g_globals->_events.setCursorFromFlag();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Common::KEYCODE_F10:
|
case Common::KEYCODE_F10:
|
||||||
// F10 - Pause
|
// F10 - Pause
|
||||||
GfxDialog::setPalette();
|
GfxDialog::setPalette();
|
||||||
MessageDialog::show(GAME_PAUSED_MSG, OK_BTN_STRING);
|
MessageDialog::show(GAME_PAUSED_MSG, OK_BTN_STRING);
|
||||||
_globals->_events.setCursorFromFlag();
|
g_globals->_events.setCursorFromFlag();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -144,7 +144,7 @@ public:
|
||||||
virtual Common::String getClassName() { return "RingworldInvObjectList"; }
|
virtual Common::String getClassName() { return "RingworldInvObjectList"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RING_INVENTORY (*((::TsAGE::Ringworld::RingworldInvObjectList *)_globals->_inventory))
|
#define RING_INVENTORY (*((::TsAGE::Ringworld::RingworldInvObjectList *)g_globals->_inventory))
|
||||||
|
|
||||||
class RingworldGame: public Game {
|
class RingworldGame: public Game {
|
||||||
public:
|
public:
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -36,11 +36,11 @@ namespace Ringworld {
|
||||||
*--------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void Scene1000::Action1::signal() {
|
void Scene1000::Action1::signal() {
|
||||||
Scene1000 *scene = (Scene1000 *)_globals->_sceneManager._scene;
|
Scene1000 *scene = (Scene1000 *)g_globals->_sceneManager._scene;
|
||||||
|
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
_globals->_player.disableControl();
|
g_globals->_player.disableControl();
|
||||||
setDelay(10);
|
setDelay(10);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -63,7 +63,7 @@ void Scene1000::Action1::signal() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
_globals->_sceneManager.changeScene(1400);
|
g_globals->_sceneManager.changeScene(1400);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ void Scene1000::Action1::signal() {
|
||||||
void Scene1000::Action2::signal() {
|
void Scene1000::Action2::signal() {
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
_globals->_player.disableControl();
|
g_globals->_player.disableControl();
|
||||||
setDelay(10);
|
setDelay(10);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -82,7 +82,7 @@ void Scene1000::Action2::signal() {
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
SceneItem::display(0, 0);
|
SceneItem::display(0, 0);
|
||||||
_globals->_sceneManager.changeScene(2000);
|
g_globals->_sceneManager.changeScene(2000);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -90,11 +90,11 @@ void Scene1000::Action2::signal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene1000::Action3::signal() {
|
void Scene1000::Action3::signal() {
|
||||||
Scene1000 *scene = (Scene1000 *)_globals->_sceneManager._scene;
|
Scene1000 *scene = (Scene1000 *)g_globals->_sceneManager._scene;
|
||||||
|
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
_globals->_sceneManager._scene->loadBackground(0, 0);
|
g_globals->_sceneManager._scene->loadBackground(0, 0);
|
||||||
setDelay(60);
|
setDelay(60);
|
||||||
break;
|
break;
|
||||||
case 1: {
|
case 1: {
|
||||||
|
@ -108,11 +108,11 @@ void Scene1000::Action3::signal() {
|
||||||
setDelay(60);
|
setDelay(60);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
_globals->_player.show();
|
g_globals->_player.show();
|
||||||
setDelay(240);
|
setDelay(240);
|
||||||
break;
|
break;
|
||||||
case 5: {
|
case 5: {
|
||||||
_globals->_player.enableControl();
|
g_globals->_player.enableControl();
|
||||||
|
|
||||||
const char *SEEN_INTRO = "seen_intro";
|
const char *SEEN_INTRO = "seen_intro";
|
||||||
if (!ConfMan.hasKey(SEEN_INTRO) || !ConfMan.getBool(SEEN_INTRO)) {
|
if (!ConfMan.hasKey(SEEN_INTRO) || !ConfMan.getBool(SEEN_INTRO)) {
|
||||||
|
@ -123,31 +123,31 @@ void Scene1000::Action3::signal() {
|
||||||
setDelay(1);
|
setDelay(1);
|
||||||
} else {
|
} else {
|
||||||
// Prompt user for whether to start play or watch introduction
|
// Prompt user for whether to start play or watch introduction
|
||||||
_globals->_player.enableControl();
|
g_globals->_player.enableControl();
|
||||||
|
|
||||||
if (MessageDialog::show2(WATCH_INTRO_MSG, START_PLAY_BTN_STRING, INTRODUCTION_BTN_STRING) == 0) {
|
if (MessageDialog::show2(WATCH_INTRO_MSG, START_PLAY_BTN_STRING, INTRODUCTION_BTN_STRING) == 0) {
|
||||||
_actionIndex = 20;
|
_actionIndex = 20;
|
||||||
_globals->_soundHandler.fadeOut(this);
|
g_globals->_soundHandler.fadeOut(this);
|
||||||
} else {
|
} else {
|
||||||
setDelay(1);
|
setDelay(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_globals->_player.disableControl();
|
g_globals->_player.disableControl();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6: {
|
case 6: {
|
||||||
scene->_object3.remove();
|
scene->_object3.remove();
|
||||||
_globals->_player.setStrip2(2);
|
g_globals->_player.setStrip2(2);
|
||||||
NpcMover *mover = new NpcMover();
|
NpcMover *mover = new NpcMover();
|
||||||
Common::Point pt(480, 100);
|
Common::Point pt(480, 100);
|
||||||
_globals->_player.addMover(mover, &pt, this);
|
g_globals->_player.addMover(mover, &pt, this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 7:
|
case 7:
|
||||||
_globals->_scenePalette.loadPalette(1002);
|
g_globals->_scenePalette.loadPalette(1002);
|
||||||
_globals->_scenePalette.refresh();
|
g_globals->_scenePalette.refresh();
|
||||||
_globals->_scenePalette.addRotation(80, 95, -1);
|
g_globals->_scenePalette.addRotation(80, 95, -1);
|
||||||
scene->_object3.postInit();
|
scene->_object3.postInit();
|
||||||
scene->_object3.setVisage(1002);
|
scene->_object3.setVisage(1002);
|
||||||
scene->_object3.setStrip(1);
|
scene->_object3.setStrip(1);
|
||||||
|
@ -216,14 +216,14 @@ void Scene1000::Action3::signal() {
|
||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
zoom(false);
|
zoom(false);
|
||||||
_globals->_scenePalette.clearListeners();
|
g_globals->_scenePalette.clearListeners();
|
||||||
_globals->_soundHandler.fadeOut(this);
|
g_globals->_soundHandler.fadeOut(this);
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
_globals->_sceneManager.changeScene(10);
|
g_globals->_sceneManager.changeScene(10);
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
_globals->_sceneManager.changeScene(30);
|
g_globals->_sceneManager.changeScene(30);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -231,19 +231,19 @@ void Scene1000::Action3::signal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene1000::Action3::zoom(bool up) {
|
void Scene1000::Action3::zoom(bool up) {
|
||||||
Scene1000 *scene = (Scene1000 *)_globals->_sceneManager._scene;
|
Scene1000 *scene = (Scene1000 *)g_globals->_sceneManager._scene;
|
||||||
|
|
||||||
if (up) {
|
if (up) {
|
||||||
while ((scene->_object3._percent < 100) && !_vm->shouldQuit()) {
|
while ((scene->_object3._percent < 100) && !g_vm->shouldQuit()) {
|
||||||
scene->_object3.changeZoom(MIN(scene->_object3._percent + 5, 100));
|
scene->_object3.changeZoom(MIN(scene->_object3._percent + 5, 100));
|
||||||
_globals->_sceneObjects->draw();
|
g_globals->_sceneObjects->draw();
|
||||||
_globals->_events.delay(1);
|
g_globals->_events.delay(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while ((scene->_object3._percent > 0) && !_vm->shouldQuit()) {
|
while ((scene->_object3._percent > 0) && !g_vm->shouldQuit()) {
|
||||||
scene->_object3.changeZoom(MAX(scene->_object3._percent - 5, 0));
|
scene->_object3.changeZoom(MAX(scene->_object3._percent - 5, 0));
|
||||||
_globals->_sceneObjects->draw();
|
g_globals->_sceneObjects->draw();
|
||||||
_globals->_events.delay(1);
|
g_globals->_events.delay(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ void Scene1000::postInit(SceneObjectList *OwnerList) {
|
||||||
setZoomPercents(0, 100, 200, 100);
|
setZoomPercents(0, 100, 200, 100);
|
||||||
loadScene(1000);
|
loadScene(1000);
|
||||||
|
|
||||||
if (_globals->_sceneManager._previousScene == 2000) {
|
if (g_globals->_sceneManager._previousScene == 2000) {
|
||||||
setZoomPercents(150, 10, 180, 100);
|
setZoomPercents(150, 10, 180, 100);
|
||||||
_object1.postInit();
|
_object1.postInit();
|
||||||
_object1.setVisage(1001);
|
_object1.setVisage(1001);
|
||||||
|
@ -266,12 +266,12 @@ void Scene1000::postInit(SceneObjectList *OwnerList) {
|
||||||
|
|
||||||
setAction(&_action2);
|
setAction(&_action2);
|
||||||
|
|
||||||
_globals->_sceneManager._scene->_sceneBounds.center(_object1._position.x, _object1._position.y);
|
g_globals->_sceneManager._scene->_sceneBounds.center(_object1._position.x, _object1._position.y);
|
||||||
_globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
|
g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
|
||||||
|
|
||||||
_globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
|
g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
|
||||||
_globals->_soundHandler.play(114);
|
g_globals->_soundHandler.play(114);
|
||||||
} else if (_globals->_sceneManager._previousScene == 2222) {
|
} else if (g_globals->_sceneManager._previousScene == 2222) {
|
||||||
setZoomPercents(150, 10, 180, 100);
|
setZoomPercents(150, 10, 180, 100);
|
||||||
_object1.postInit();
|
_object1.postInit();
|
||||||
_object1.setVisage(1001);
|
_object1.setVisage(1001);
|
||||||
|
@ -280,28 +280,28 @@ void Scene1000::postInit(SceneObjectList *OwnerList) {
|
||||||
_object1._moveDiff = Common::Point(2, 2);
|
_object1._moveDiff = Common::Point(2, 2);
|
||||||
_object1.setPosition(Common::Point(120, 180));
|
_object1.setPosition(Common::Point(120, 180));
|
||||||
|
|
||||||
_globals->_sceneManager._scene->_sceneBounds.center(_object1._position.x, _object1._position.y);
|
g_globals->_sceneManager._scene->_sceneBounds.center(_object1._position.x, _object1._position.y);
|
||||||
_globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
|
g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
|
||||||
_globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
|
g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
|
||||||
|
|
||||||
setAction(&_action1);
|
setAction(&_action1);
|
||||||
} else {
|
} else {
|
||||||
_globals->_soundHandler.play(4);
|
g_globals->_soundHandler.play(4);
|
||||||
setZoomPercents(0, 10, 30, 100);
|
setZoomPercents(0, 10, 30, 100);
|
||||||
_object3.postInit();
|
_object3.postInit();
|
||||||
_object3.setVisage(1050);
|
_object3.setVisage(1050);
|
||||||
_object3.changeZoom(-1);
|
_object3.changeZoom(-1);
|
||||||
_object3.setPosition(Common::Point(158, 0));
|
_object3.setPosition(Common::Point(158, 0));
|
||||||
|
|
||||||
_globals->_player.postInit();
|
g_globals->_player.postInit();
|
||||||
_globals->_player.setVisage(1050);
|
g_globals->_player.setVisage(1050);
|
||||||
_globals->_player.setStrip(3);
|
g_globals->_player.setStrip(3);
|
||||||
_globals->_player.setPosition(Common::Point(160, 191));
|
g_globals->_player.setPosition(Common::Point(160, 191));
|
||||||
_globals->_player._moveDiff.x = 12;
|
g_globals->_player._moveDiff.x = 12;
|
||||||
_globals->_player.hide();
|
g_globals->_player.hide();
|
||||||
_globals->_player.disableControl();
|
g_globals->_player.disableControl();
|
||||||
|
|
||||||
_globals->_sceneManager._scene->_sceneBounds.center(_object3._position.x, _object3._position.y);
|
g_globals->_sceneManager._scene->_sceneBounds.center(_object3._position.x, _object3._position.y);
|
||||||
|
|
||||||
setAction(&_action3);
|
setAction(&_action3);
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ void Scene1000::postInit(SceneObjectList *OwnerList) {
|
||||||
*--------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void Scene1001::Action1::signal() {
|
void Scene1001::Action1::signal() {
|
||||||
Scene1001 *scene = (Scene1001 *)_globals->_sceneManager._scene;
|
Scene1001 *scene = (Scene1001 *)g_globals->_sceneManager._scene;
|
||||||
|
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -478,9 +478,9 @@ void Scene1001::Action1::signal() {
|
||||||
setDelay(30);
|
setDelay(30);
|
||||||
break;
|
break;
|
||||||
case 19: {
|
case 19: {
|
||||||
_globals->_soundHandler.play(91);
|
g_globals->_soundHandler.play(91);
|
||||||
byte adjustData[4] = {0xff, 0xff, 0xff, 0};
|
byte adjustData[4] = {0xff, 0xff, 0xff, 0};
|
||||||
_globals->_scenePalette.fade(adjustData, false, 0);
|
g_globals->_scenePalette.fade(adjustData, false, 0);
|
||||||
|
|
||||||
scene->_object1._strip = 7;
|
scene->_object1._strip = 7;
|
||||||
scene->_object1._frame = 1;
|
scene->_object1._frame = 1;
|
||||||
|
@ -490,8 +490,8 @@ void Scene1001::Action1::signal() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 20:
|
case 20:
|
||||||
_globals->_scenePalette.loadPalette(16);
|
g_globals->_scenePalette.loadPalette(16);
|
||||||
_globals->_scenePalette.refresh();
|
g_globals->_scenePalette.refresh();
|
||||||
setDelay(6);
|
setDelay(6);
|
||||||
break;
|
break;
|
||||||
case 21:
|
case 21:
|
||||||
|
@ -499,14 +499,14 @@ void Scene1001::Action1::signal() {
|
||||||
scene->_object1.animate(ANIM_MODE_5, this);
|
scene->_object1.animate(ANIM_MODE_5, this);
|
||||||
break;
|
break;
|
||||||
case 22:
|
case 22:
|
||||||
_globals->_soundHandler.play(92);
|
g_globals->_soundHandler.play(92);
|
||||||
scene->_stripManager.start(111, this);
|
scene->_stripManager.start(111, this);
|
||||||
break;
|
break;
|
||||||
case 23:
|
case 23:
|
||||||
setDelay(60);
|
setDelay(60);
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
_globals->_sceneManager.changeScene(2000);
|
g_globals->_sceneManager.changeScene(2000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -529,7 +529,7 @@ void Scene1001::postInit(SceneObjectList *OwnerList) {
|
||||||
_object3.setStrip2(4);
|
_object3.setStrip2(4);
|
||||||
_object3.setPosition(Common::Point(61, 177));
|
_object3.setPosition(Common::Point(61, 177));
|
||||||
|
|
||||||
_globals->_soundHandler.play(85);
|
g_globals->_soundHandler.play(85);
|
||||||
setAction(&_action1);
|
setAction(&_action1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,11 +540,11 @@ void Scene1001::postInit(SceneObjectList *OwnerList) {
|
||||||
*--------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void Scene1250::Action1::signal() {
|
void Scene1250::Action1::signal() {
|
||||||
Scene1250 *scene = (Scene1250 *)_globals->_sceneManager._scene;
|
Scene1250 *scene = (Scene1250 *)g_globals->_sceneManager._scene;
|
||||||
|
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
setDelay(_globals->_randomSource.getRandomNumber(120) + 60);
|
setDelay(g_globals->_randomSource.getRandomNumber(120) + 60);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
scene->_object1.animate(ANIM_MODE_5, this);
|
scene->_object1.animate(ANIM_MODE_5, this);
|
||||||
|
@ -554,11 +554,11 @@ void Scene1250::Action1::signal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene1250::Action2::signal() {
|
void Scene1250::Action2::signal() {
|
||||||
Scene1250 *scene = (Scene1250 *)_globals->_sceneManager._scene;
|
Scene1250 *scene = (Scene1250 *)g_globals->_sceneManager._scene;
|
||||||
|
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
switch (_globals->_randomSource.getRandomNumber(2)) {
|
switch (g_globals->_randomSource.getRandomNumber(2)) {
|
||||||
case 0:
|
case 0:
|
||||||
scene->_object2.setPosition(Common::Point(163, 75));
|
scene->_object2.setPosition(Common::Point(163, 75));
|
||||||
break;
|
break;
|
||||||
|
@ -580,7 +580,7 @@ void Scene1250::Action2::signal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene1250::Action3::signal() {
|
void Scene1250::Action3::signal() {
|
||||||
Scene1250 *scene = (Scene1250 *)_globals->_sceneManager._scene;
|
Scene1250 *scene = (Scene1250 *)g_globals->_sceneManager._scene;
|
||||||
|
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -593,13 +593,13 @@ void Scene1250::Action3::signal() {
|
||||||
setDelay(6);
|
setDelay(6);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
_globals->_sceneManager.changeScene(1000);
|
g_globals->_sceneManager.changeScene(1000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene1250::Action4::signal() {
|
void Scene1250::Action4::signal() {
|
||||||
Scene1250 *scene = (Scene1250 *)_globals->_sceneManager._scene;
|
Scene1250 *scene = (Scene1250 *)g_globals->_sceneManager._scene;
|
||||||
|
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -612,7 +612,7 @@ void Scene1250::Action4::signal() {
|
||||||
setDelay(6);
|
setDelay(6);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
_globals->_sceneManager.changeScene(2000);
|
g_globals->_sceneManager.changeScene(2000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -643,14 +643,14 @@ void Scene1250::postInit(SceneObjectList *OwnerList) {
|
||||||
_object2._frame = 1;
|
_object2._frame = 1;
|
||||||
_object2.setAction(&_action2);
|
_object2.setAction(&_action2);
|
||||||
|
|
||||||
_globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
|
g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
|
||||||
_globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
|
g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
|
||||||
|
|
||||||
if ((_globals->_sceneManager._previousScene != 2000) || (_globals->_stripNum != 1250)) {
|
if ((g_globals->_sceneManager._previousScene != 2000) || (g_globals->_stripNum != 1250)) {
|
||||||
setAction(&_action4);
|
setAction(&_action4);
|
||||||
} else {
|
} else {
|
||||||
setAction(&_action3);
|
setAction(&_action3);
|
||||||
_globals->_soundHandler.play(114);
|
g_globals->_soundHandler.play(114);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -660,7 +660,7 @@ void Scene1250::postInit(SceneObjectList *OwnerList) {
|
||||||
*--------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void Scene1400::Action1::signal() {
|
void Scene1400::Action1::signal() {
|
||||||
Scene1400 *scene = (Scene1400 *)_globals->_sceneManager._scene;
|
Scene1400 *scene = (Scene1400 *)g_globals->_sceneManager._scene;
|
||||||
|
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -671,23 +671,23 @@ void Scene1400::Action1::signal() {
|
||||||
|
|
||||||
Common::Point pt(160, 700);
|
Common::Point pt(160, 700);
|
||||||
NpcMover *mover = new NpcMover();
|
NpcMover *mover = new NpcMover();
|
||||||
_globals->_player.addMover(mover, &pt, this);
|
g_globals->_player.addMover(mover, &pt, this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
_globals->_player.setStrip2(3);
|
g_globals->_player.setStrip2(3);
|
||||||
_globals->_player.changeZoom(100);
|
g_globals->_player.changeZoom(100);
|
||||||
|
|
||||||
Common::Point pt(160, 100);
|
Common::Point pt(160, 100);
|
||||||
NpcMover *mover = new NpcMover();
|
NpcMover *mover = new NpcMover();
|
||||||
_globals->_player.addMover(mover, &pt, this);
|
g_globals->_player.addMover(mover, &pt, this);
|
||||||
|
|
||||||
SceneItem::display(0, 0);
|
SceneItem::display(0, 0);
|
||||||
setDelay(360);
|
setDelay(360);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
SceneItem::display(1400, 2, SET_X, 60, SET_Y, _globals->_sceneManager._scene->_sceneBounds.bottom - 80,
|
SceneItem::display(1400, 2, SET_X, 60, SET_Y, g_globals->_sceneManager._scene->_sceneBounds.bottom - 80,
|
||||||
SET_FONT, 2, SET_FG_COLOR, 13, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
|
SET_FONT, 2, SET_FG_COLOR, 13, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
|
||||||
setDelay(420);
|
setDelay(420);
|
||||||
break;
|
break;
|
||||||
|
@ -696,7 +696,7 @@ void Scene1400::Action1::signal() {
|
||||||
setDelay(360);
|
setDelay(360);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
SceneItem::display(1400, 3, SET_X, 60, SET_Y, _globals->_sceneManager._scene->_sceneBounds.bottom - 80,
|
SceneItem::display(1400, 3, SET_X, 60, SET_Y, g_globals->_sceneManager._scene->_sceneBounds.bottom - 80,
|
||||||
SET_FONT, 2, SET_FG_COLOR, 23, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
|
SET_FONT, 2, SET_FG_COLOR, 23, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
|
||||||
setDelay(360);
|
setDelay(360);
|
||||||
break;
|
break;
|
||||||
|
@ -704,25 +704,25 @@ void Scene1400::Action1::signal() {
|
||||||
SceneItem::display(0, 0);
|
SceneItem::display(0, 0);
|
||||||
break;
|
break;
|
||||||
case 7: {
|
case 7: {
|
||||||
_globals->_player._frame = 1;
|
g_globals->_player._frame = 1;
|
||||||
_globals->_player.setStrip2(1);
|
g_globals->_player.setStrip2(1);
|
||||||
_globals->_player._numFrames = 5;
|
g_globals->_player._numFrames = 5;
|
||||||
_globals->_player.animate(ANIM_MODE_5, this);
|
g_globals->_player.animate(ANIM_MODE_5, this);
|
||||||
|
|
||||||
Common::Point pt(205, 70);
|
Common::Point pt(205, 70);
|
||||||
NpcMover *mover = new NpcMover();
|
NpcMover *mover = new NpcMover();
|
||||||
_globals->_player.addMover(mover, &pt, NULL);
|
g_globals->_player.addMover(mover, &pt, NULL);
|
||||||
_globals->_sceneManager._fadeMode = FADEMODE_NONE;
|
g_globals->_sceneManager._fadeMode = FADEMODE_NONE;
|
||||||
|
|
||||||
scene->loadScene(1402);
|
scene->loadScene(1402);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 8:
|
case 8:
|
||||||
_globals->_player.setStrip2(2);
|
g_globals->_player.setStrip2(2);
|
||||||
_globals->_player._numFrames = 10;
|
g_globals->_player._numFrames = 10;
|
||||||
_globals->_player.animate(ANIM_MODE_2, NULL);
|
g_globals->_player.animate(ANIM_MODE_2, NULL);
|
||||||
|
|
||||||
SceneItem::display(1400, 4, SET_X, 30, SET_Y, _globals->_player._position.y + 10, SET_FONT, 2,
|
SceneItem::display(1400, 4, SET_X, 30, SET_Y, g_globals->_player._position.y + 10, SET_FONT, 2,
|
||||||
SET_FG_COLOR, 13, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
|
SET_FG_COLOR, 13, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
|
||||||
setDelay(300);
|
setDelay(300);
|
||||||
break;
|
break;
|
||||||
|
@ -730,16 +730,16 @@ void Scene1400::Action1::signal() {
|
||||||
SceneItem::display(0, 0);
|
SceneItem::display(0, 0);
|
||||||
Common::Point pt(450, 45);
|
Common::Point pt(450, 45);
|
||||||
NpcMover *mover = new NpcMover();
|
NpcMover *mover = new NpcMover();
|
||||||
_globals->_player.addMover(mover, &pt, this);
|
g_globals->_player.addMover(mover, &pt, this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 10:
|
case 10:
|
||||||
_globals->_sceneManager._scrollerRect = Rect(40, 20, 280, 180);
|
g_globals->_sceneManager._scrollerRect = Rect(40, 20, 280, 180);
|
||||||
_globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
|
g_globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
|
||||||
_globals->_stripNum = 1500;
|
g_globals->_stripNum = 1500;
|
||||||
_globals->_soundHandler.stop();
|
g_globals->_soundHandler.stop();
|
||||||
|
|
||||||
_globals->_sceneManager.changeScene(1500);
|
g_globals->_sceneManager.changeScene(1500);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -748,41 +748,41 @@ void Scene1400::Action1::dispatch() {
|
||||||
Action::dispatch();
|
Action::dispatch();
|
||||||
|
|
||||||
if ((_actionIndex > 3) && (_actionIndex < 9))
|
if ((_actionIndex > 3) && (_actionIndex < 9))
|
||||||
_globals->_sceneText.setPosition(Common::Point(60, _globals->_sceneManager._scene->_sceneBounds.bottom - 80));
|
g_globals->_sceneText.setPosition(Common::Point(60, g_globals->_sceneManager._scene->_sceneBounds.bottom - 80));
|
||||||
|
|
||||||
if ((_actionIndex <= 2) && (_globals->_player._percent > 22))
|
if ((_actionIndex <= 2) && (g_globals->_player._percent > 22))
|
||||||
_globals->_player.changeZoom(100 - (800 - _globals->_player._position.y));
|
g_globals->_player.changeZoom(100 - (800 - g_globals->_player._position.y));
|
||||||
|
|
||||||
if ((_actionIndex >= 9) && (_globals->_player._percent > 22))
|
if ((_actionIndex >= 9) && (g_globals->_player._percent > 22))
|
||||||
_globals->_player.changeZoom(100 - (_globals->_player._position.x - 205));
|
g_globals->_player.changeZoom(100 - (g_globals->_player._position.x - 205));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void Scene1400::postInit(SceneObjectList *OwnerList) {
|
void Scene1400::postInit(SceneObjectList *OwnerList) {
|
||||||
if (_globals->_stripNum != 1400) {
|
if (g_globals->_stripNum != 1400) {
|
||||||
loadScene(1401);
|
loadScene(1401);
|
||||||
} else {
|
} else {
|
||||||
loadScene(1402);
|
loadScene(1402);
|
||||||
}
|
}
|
||||||
Scene::postInit();
|
Scene::postInit();
|
||||||
|
|
||||||
_globals->_sceneManager._scrollerRect = Rect(40, 90, 280, 180);
|
g_globals->_sceneManager._scrollerRect = Rect(40, 90, 280, 180);
|
||||||
_globals->_player.postInit();
|
g_globals->_player.postInit();
|
||||||
_globals->_player.setVisage(1401);
|
g_globals->_player.setVisage(1401);
|
||||||
_globals->_player.animate(ANIM_MODE_2, 0);
|
g_globals->_player.animate(ANIM_MODE_2, 0);
|
||||||
_globals->_player.setStrip2(4);
|
g_globals->_player.setStrip2(4);
|
||||||
_globals->_player.fixPriority(4);
|
g_globals->_player.fixPriority(4);
|
||||||
_globals->_player.disableControl();
|
g_globals->_player.disableControl();
|
||||||
|
|
||||||
_globals->_player._moveDiff = Common::Point(4, 2);
|
g_globals->_player._moveDiff = Common::Point(4, 2);
|
||||||
_globals->_player.setPosition(Common::Point(160, 800));
|
g_globals->_player.setPosition(Common::Point(160, 800));
|
||||||
_globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position);
|
g_globals->_sceneManager._scene->_sceneBounds.center(g_globals->_player._position);
|
||||||
_globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
|
g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
|
||||||
_globals->_sceneOffset.y = (_globals->_sceneManager._scene->_sceneBounds.top / 100) * 100;
|
g_globals->_sceneOffset.y = (g_globals->_sceneManager._scene->_sceneBounds.top / 100) * 100;
|
||||||
|
|
||||||
setAction(&_action1);
|
setAction(&_action1);
|
||||||
_globals->_soundHandler.play(118);
|
g_globals->_soundHandler.play(118);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------
|
||||||
|
@ -791,7 +791,7 @@ void Scene1400::postInit(SceneObjectList *OwnerList) {
|
||||||
*--------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void Scene1500::Action1::signal() {
|
void Scene1500::Action1::signal() {
|
||||||
Scene1500 *scene = (Scene1500 *)_globals->_sceneManager._scene;
|
Scene1500 *scene = (Scene1500 *)g_globals->_sceneManager._scene;
|
||||||
|
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0: {
|
case 0: {
|
||||||
|
@ -856,17 +856,17 @@ void Scene1500::Action1::signal() {
|
||||||
scene->_soundHandler.play(124, this);
|
scene->_soundHandler.play(124, this);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
_globals->_soundHandler.play(126, this);
|
g_globals->_soundHandler.play(126, this);
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
_globals->_soundHandler.play(127);
|
g_globals->_soundHandler.play(127);
|
||||||
_globals->_sceneManager.changeScene(2000);
|
g_globals->_sceneManager.changeScene(2000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene1500::Action2::signal() {
|
void Scene1500::Action2::signal() {
|
||||||
Scene1500 *scene = (Scene1500 *)_globals->_sceneManager._scene;
|
Scene1500 *scene = (Scene1500 *)g_globals->_sceneManager._scene;
|
||||||
|
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -897,8 +897,8 @@ void Scene1500::Action2::signal() {
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
scene->_soundHandler.release();
|
scene->_soundHandler.release();
|
||||||
_globals->_stripNum = 1505;
|
g_globals->_stripNum = 1505;
|
||||||
_globals->_sceneManager.changeScene(2400);
|
g_globals->_sceneManager.changeScene(2400);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -909,8 +909,8 @@ void Scene1500::postInit(SceneObjectList *OwnerList) {
|
||||||
loadScene(1500);
|
loadScene(1500);
|
||||||
Scene::postInit();
|
Scene::postInit();
|
||||||
|
|
||||||
if ((_globals->_stripNum == 1500) || ((_globals->_stripNum != 1504) && (_globals->_stripNum != 2751))) {
|
if ((g_globals->_stripNum == 1500) || ((g_globals->_stripNum != 1504) && (g_globals->_stripNum != 2751))) {
|
||||||
_globals->_soundHandler.play(120);
|
g_globals->_soundHandler.play(120);
|
||||||
setZoomPercents(105, 20, 145, 100);
|
setZoomPercents(105, 20, 145, 100);
|
||||||
|
|
||||||
setAction(&_action1);
|
setAction(&_action1);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -36,7 +36,7 @@ namespace Ringworld {
|
||||||
*--------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void Scene3500::Action1::signal() {
|
void Scene3500::Action1::signal() {
|
||||||
Scene3500 *scene = (Scene3500 *)_globals->_sceneManager._scene;
|
Scene3500 *scene = (Scene3500 *)g_globals->_sceneManager._scene;
|
||||||
|
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -49,13 +49,13 @@ void Scene3500::Action1::signal() {
|
||||||
setDelay(3);
|
setDelay(3);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
_globals->_sceneManager.changeScene(9999);
|
g_globals->_sceneManager.changeScene(9999);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene3500::Action2::signal() {
|
void Scene3500::Action2::signal() {
|
||||||
Scene3500 *scene = (Scene3500 *)_globals->_sceneManager._scene;
|
Scene3500 *scene = (Scene3500 *)g_globals->_sceneManager._scene;
|
||||||
|
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -68,7 +68,7 @@ void Scene3500::Action2::signal() {
|
||||||
setDelay(3);
|
setDelay(3);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
_globals->_sceneManager.changeScene(2012);
|
g_globals->_sceneManager.changeScene(2012);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,17 +76,17 @@ void Scene3500::Action2::signal() {
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void Scene3500::postInit(SceneObjectList *OwnerList) {
|
void Scene3500::postInit(SceneObjectList *OwnerList) {
|
||||||
loadScene((_globals->_stripNum == 3600) ? 3600 : 3500);
|
loadScene((g_globals->_stripNum == 3600) ? 3600 : 3500);
|
||||||
Scene::postInit();
|
Scene::postInit();
|
||||||
|
|
||||||
_stripManager.addSpeaker(&_speakerQText);
|
_stripManager.addSpeaker(&_speakerQText);
|
||||||
_stripManager.addSpeaker(&_speakerMText);
|
_stripManager.addSpeaker(&_speakerMText);
|
||||||
_stripManager.addSpeaker(&_speakerSText);
|
_stripManager.addSpeaker(&_speakerSText);
|
||||||
|
|
||||||
_globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
|
g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
|
||||||
_globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.top / 160) * 160;
|
g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.top / 160) * 160;
|
||||||
|
|
||||||
setAction((_globals->_stripNum == 3600) ? (Action *)&_action2 : (Action *)&_action1);
|
setAction((g_globals->_stripNum == 3600) ? (Action *)&_action2 : (Action *)&_action1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------
|
||||||
|
@ -102,7 +102,7 @@ Scene3700::Viewer::Viewer() {
|
||||||
|
|
||||||
_frameList[0] = 1;
|
_frameList[0] = 1;
|
||||||
for (int idx = 1; idx <= 3; ++idx)
|
for (int idx = 1; idx <= 3; ++idx)
|
||||||
_frameList[idx] = _globals->_randomSource.getRandomNumber(4) + 1;
|
_frameList[idx] = g_globals->_randomSource.getRandomNumber(4) + 1;
|
||||||
|
|
||||||
_active = true;
|
_active = true;
|
||||||
_countdownCtr = 0;
|
_countdownCtr = 0;
|
||||||
|
@ -132,7 +132,7 @@ void Scene3700::Viewer::dispatch() {
|
||||||
|
|
||||||
int newFrame;
|
int newFrame;
|
||||||
do {
|
do {
|
||||||
newFrame = _globals->_randomSource.getRandomNumber(4) + 1;
|
newFrame = g_globals->_randomSource.getRandomNumber(4) + 1;
|
||||||
} while (newFrame == _frameList[2]);
|
} while (newFrame == _frameList[2]);
|
||||||
|
|
||||||
_frameList[1] = newFrame;
|
_frameList[1] = newFrame;
|
||||||
|
@ -146,27 +146,27 @@ void Scene3700::Viewer::reposition() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene3700::Viewer::draw() {
|
void Scene3700::Viewer::draw() {
|
||||||
Region *priorityRegion = _globals->_sceneManager._scene->_priorities.find(1);
|
Region *priorityRegion = g_globals->_sceneManager._scene->_priorities.find(1);
|
||||||
|
|
||||||
for (int idx = 0; idx < 4; ++idx) {
|
for (int idx = 0; idx < 4; ++idx) {
|
||||||
Visage &v = (idx == 0) ? _images1 : _images2;
|
Visage &v = (idx == 0) ? _images1 : _images2;
|
||||||
|
|
||||||
GfxSurface img = v.getFrame(_frameList[idx]);
|
GfxSurface img = v.getFrame(_frameList[idx]);
|
||||||
Rect destRect = img.getBounds();
|
Rect destRect = img.getBounds();
|
||||||
destRect.resize(img, (_position.x - _globals->_sceneOffset.x),
|
destRect.resize(img, (_position.x - g_globals->_sceneOffset.x),
|
||||||
(_position.y - _globals->_sceneOffset.y - _yDiff), _percentList[idx]);
|
(_position.y - g_globals->_sceneOffset.y - _yDiff), _percentList[idx]);
|
||||||
|
|
||||||
destRect.translate(-_globals->_sceneManager._scene->_sceneBounds.left,
|
destRect.translate(-g_globals->_sceneManager._scene->_sceneBounds.left,
|
||||||
-_globals->_sceneManager._scene->_sceneBounds.top);
|
-g_globals->_sceneManager._scene->_sceneBounds.top);
|
||||||
|
|
||||||
_globals->gfxManager().copyFrom(img, destRect, priorityRegion);
|
g_globals->gfxManager().copyFrom(img, destRect, priorityRegion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void Scene3700::Action1::signal() {
|
void Scene3700::Action1::signal() {
|
||||||
Scene3700 *scene = (Scene3700 *)_globals->_sceneManager._scene;
|
Scene3700 *scene = (Scene3700 *)g_globals->_sceneManager._scene;
|
||||||
|
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -218,11 +218,11 @@ void Scene3700::Action1::signal() {
|
||||||
case 8:
|
case 8:
|
||||||
scene->_hotspot1.remove();
|
scene->_hotspot1.remove();
|
||||||
scene->_hotspot2.show();
|
scene->_hotspot2.show();
|
||||||
_globals->setFlag(59);
|
g_globals->setFlag(59);
|
||||||
setDelay(30);
|
setDelay(30);
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
_globals->_sceneManager.changeScene(2100);
|
g_globals->_sceneManager.changeScene(2100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ void Scene3700::postInit(TsAGE::SceneObjectList *OwnerList) {
|
||||||
_viewer.setPosition(Common::Point(195, 83));
|
_viewer.setPosition(Common::Point(195, 83));
|
||||||
|
|
||||||
setAction(&_action1);
|
setAction(&_action1);
|
||||||
_globals->_soundHandler.play(195);
|
g_globals->_soundHandler.play(195);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace Ringworld
|
} // End of namespace Ringworld
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -51,7 +51,7 @@ void SpeakerGText::setText(const Common::String &msg) {
|
||||||
|
|
||||||
// Set the text
|
// Set the text
|
||||||
Rect textRect;
|
Rect textRect;
|
||||||
_globals->gfxManager()._font.getStringBounds(msg.c_str(), textRect, _textWidth);
|
g_globals->gfxManager()._font.getStringBounds(msg.c_str(), textRect, _textWidth);
|
||||||
textRect.center(_sceneObject._position.x, _sceneObject._position.y);
|
textRect.center(_sceneObject._position.x, _sceneObject._position.y);
|
||||||
_textPos.x = textRect.left;
|
_textPos.x = textRect.left;
|
||||||
Speaker::setText(msg);
|
Speaker::setText(msg);
|
||||||
|
@ -74,13 +74,13 @@ SpeakerPOR::SpeakerPOR() {
|
||||||
void SpeakerPOR::SpeakerAction1::signal(){
|
void SpeakerPOR::SpeakerAction1::signal(){
|
||||||
switch (_actionIndex++) {
|
switch (_actionIndex++) {
|
||||||
case 0:
|
case 0:
|
||||||
setDelay(_globals->_randomSource.getRandomNumber(60) + 60);
|
setDelay(g_globals->_randomSource.getRandomNumber(60) + 60);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
static_cast<SceneObject *>(_owner)->animate(ANIM_MODE_5, this, NULL);
|
static_cast<SceneObject *>(_owner)->animate(ANIM_MODE_5, this, NULL);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
setDelay(_globals->_randomSource.getRandomNumber(10));
|
setDelay(g_globals->_randomSource.getRandomNumber(10));
|
||||||
_actionIndex = 0;
|
_actionIndex = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -32,14 +32,14 @@
|
||||||
|
|
||||||
namespace TsAGE {
|
namespace TsAGE {
|
||||||
|
|
||||||
Saver *_saver;
|
Saver *g_saver;
|
||||||
|
|
||||||
SavedObject::SavedObject() {
|
SavedObject::SavedObject() {
|
||||||
_saver->addObject(this);
|
g_saver->addObject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
SavedObject::~SavedObject() {
|
SavedObject::~SavedObject() {
|
||||||
_saver->removeObject(this);
|
g_saver->removeObject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
@ -52,7 +52,7 @@ Saver::Saver() {
|
||||||
Saver::~Saver() {
|
Saver::~Saver() {
|
||||||
// Internal validation that no saved object is still present
|
// Internal validation that no saved object is still present
|
||||||
int totalLost = 0;
|
int totalLost = 0;
|
||||||
for (SynchronizedList<SavedObject *>::iterator i = _saver->_objList.begin(); i != _saver->_objList.end(); ++i) {
|
for (SynchronizedList<SavedObject *>::iterator i = g_saver->_objList.begin(); i != g_saver->_objList.end(); ++i) {
|
||||||
SavedObject *so = *i;
|
SavedObject *so = *i;
|
||||||
if (so)
|
if (so)
|
||||||
++totalLost;
|
++totalLost;
|
||||||
|
@ -72,7 +72,7 @@ void Serializer::syncPointer(SavedObject **ptr, Common::Serializer::Version minV
|
||||||
if (isSaving()) {
|
if (isSaving()) {
|
||||||
// Get the object index for the given pointer and write it out
|
// Get the object index for the given pointer and write it out
|
||||||
if (*ptr) {
|
if (*ptr) {
|
||||||
idx = _saver->blockIndexOf(*ptr);
|
idx = g_saver->blockIndexOf(*ptr);
|
||||||
assert(idx > 0);
|
assert(idx > 0);
|
||||||
}
|
}
|
||||||
syncAsUint32LE(idx);
|
syncAsUint32LE(idx);
|
||||||
|
@ -82,7 +82,7 @@ void Serializer::syncPointer(SavedObject **ptr, Common::Serializer::Version minV
|
||||||
*ptr = NULL;
|
*ptr = NULL;
|
||||||
if (idx > 0)
|
if (idx > 0)
|
||||||
// For non-zero (null) pointers, create a record for later resolving it to an address
|
// For non-zero (null) pointers, create a record for later resolving it to an address
|
||||||
_saver->addSavedObjectPtr(ptr, idx);
|
g_saver->addSavedObjectPtr(ptr, idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ void Serializer::syncAsDouble(double &v) {
|
||||||
|
|
||||||
Common::Error Saver::save(int slot, const Common::String &saveName) {
|
Common::Error Saver::save(int slot, const Common::String &saveName) {
|
||||||
assert(!getMacroRestoreFlag());
|
assert(!getMacroRestoreFlag());
|
||||||
Common::StackLock slock1(_globals->_soundManager._serverDisabledMutex);
|
Common::StackLock slock1(g_globals->_soundManager._serverDisabledMutex);
|
||||||
|
|
||||||
// Signal any objects registered for notification
|
// Signal any objects registered for notification
|
||||||
_saveNotifiers.notify(false);
|
_saveNotifiers.notify(false);
|
||||||
|
@ -130,7 +130,7 @@ Common::Error Saver::save(int slot, const Common::String &saveName) {
|
||||||
_saveSlot = slot;
|
_saveSlot = slot;
|
||||||
|
|
||||||
// Set up the serializer
|
// Set up the serializer
|
||||||
Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(_vm->generateSaveName(slot));
|
Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(g_vm->generateSaveName(slot));
|
||||||
Serializer serializer(NULL, saveFile);
|
Serializer serializer(NULL, saveFile);
|
||||||
serializer.setSaveVersion(TSAGE_SAVEGAME_VERSION);
|
serializer.setSaveVersion(TSAGE_SAVEGAME_VERSION);
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ Common::Error Saver::save(int slot, const Common::String &saveName) {
|
||||||
|
|
||||||
Common::Error Saver::restore(int slot) {
|
Common::Error Saver::restore(int slot) {
|
||||||
assert(!getMacroRestoreFlag());
|
assert(!getMacroRestoreFlag());
|
||||||
Common::StackLock slock1(_globals->_soundManager._serverDisabledMutex);
|
Common::StackLock slock1(g_globals->_soundManager._serverDisabledMutex);
|
||||||
|
|
||||||
// Signal any objects registered for notification
|
// Signal any objects registered for notification
|
||||||
_loadNotifiers.notify(false);
|
_loadNotifiers.notify(false);
|
||||||
|
@ -176,7 +176,7 @@ Common::Error Saver::restore(int slot) {
|
||||||
_unresolvedPtrs.clear();
|
_unresolvedPtrs.clear();
|
||||||
|
|
||||||
// Set up the serializer
|
// Set up the serializer
|
||||||
Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(_vm->generateSaveName(slot));
|
Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(g_vm->generateSaveName(slot));
|
||||||
Serializer serializer(saveFile, NULL);
|
Serializer serializer(saveFile, NULL);
|
||||||
|
|
||||||
// Read in the savegame header
|
// Read in the savegame header
|
||||||
|
@ -279,10 +279,10 @@ void Saver::writeSavegameHeader(Common::OutSaveFile *out, tSageSavegameHeader &h
|
||||||
|
|
||||||
// Create a thumbnail and save it
|
// Create a thumbnail and save it
|
||||||
Graphics::Surface *thumb = new Graphics::Surface();
|
Graphics::Surface *thumb = new Graphics::Surface();
|
||||||
Graphics::Surface s = _globals->_screenSurface.lockSurface();
|
Graphics::Surface s = g_globals->_screenSurface.lockSurface();
|
||||||
::createThumbnail(thumb, (const byte *)s.pixels, SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette);
|
::createThumbnail(thumb, (const byte *)s.pixels, SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette);
|
||||||
Graphics::saveThumbnail(*out, *thumb);
|
Graphics::saveThumbnail(*out, *thumb);
|
||||||
_globals->_screenSurface.unlockSurface();
|
g_globals->_screenSurface.unlockSurface();
|
||||||
delete thumb;
|
delete thumb;
|
||||||
|
|
||||||
// Write out the save date/time
|
// Write out the save date/time
|
||||||
|
@ -293,7 +293,7 @@ void Saver::writeSavegameHeader(Common::OutSaveFile *out, tSageSavegameHeader &h
|
||||||
out->writeSint16LE(td.tm_mday);
|
out->writeSint16LE(td.tm_mday);
|
||||||
out->writeSint16LE(td.tm_hour);
|
out->writeSint16LE(td.tm_hour);
|
||||||
out->writeSint16LE(td.tm_min);
|
out->writeSint16LE(td.tm_min);
|
||||||
out->writeUint32LE(_globals->_events.getFrameNumber());
|
out->writeUint32LE(g_globals->_events.getFrameNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -335,7 +335,7 @@ void Saver::removeObject(SavedObject *obj) {
|
||||||
* Returns true if any savegames exist
|
* Returns true if any savegames exist
|
||||||
*/
|
*/
|
||||||
bool Saver::savegamesExist() const {
|
bool Saver::savegamesExist() const {
|
||||||
Common::String slot1Name = _vm->generateSaveName(1);
|
Common::String slot1Name = g_vm->generateSaveName(1);
|
||||||
|
|
||||||
Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(slot1Name);
|
Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(slot1Name);
|
||||||
bool result = saveFile != NULL;
|
bool result = saveFile != NULL;
|
||||||
|
|
|
@ -232,7 +232,7 @@ public:
|
||||||
void listObjects();
|
void listObjects();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Saver *_saver;
|
extern Saver *g_saver;
|
||||||
|
|
||||||
} // End of namespace TsAGE
|
} // End of namespace TsAGE
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ SceneManager::SceneManager() {
|
||||||
_previousScene = 0;
|
_previousScene = 0;
|
||||||
_fadeMode = FADEMODE_GRADUAL;
|
_fadeMode = FADEMODE_GRADUAL;
|
||||||
_scrollerRect = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
_scrollerRect = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
_saver->addListener(this);
|
g_saver->addListener(this);
|
||||||
_objectCount = 0;
|
_objectCount = 0;
|
||||||
_loadMode = 0;
|
_loadMode = 0;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ void SceneManager::checkScene() {
|
||||||
_nextSceneNumber = -1;
|
_nextSceneNumber = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_globals->dispatchSounds();
|
g_globals->dispatchSounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneManager::sceneChange() {
|
void SceneManager::sceneChange() {
|
||||||
|
@ -73,16 +73,16 @@ void SceneManager::sceneChange() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear the scene objects
|
// Clear the scene objects
|
||||||
SynchronizedList<SceneObject *>::iterator io = _globals->_sceneObjects->begin();
|
SynchronizedList<SceneObject *>::iterator io = g_globals->_sceneObjects->begin();
|
||||||
while (io != _globals->_sceneObjects->end()) {
|
while (io != g_globals->_sceneObjects->end()) {
|
||||||
SceneObject *sceneObj = *io;
|
SceneObject *sceneObj = *io;
|
||||||
++io;
|
++io;
|
||||||
sceneObj->removeObject();
|
sceneObj->removeObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear the hotspot list
|
// Clear the hotspot list
|
||||||
SynchronizedList<SceneItem *>::iterator ii = _globals->_sceneItems.begin();
|
SynchronizedList<SceneItem *>::iterator ii = g_globals->_sceneItems.begin();
|
||||||
while (ii != _globals->_sceneItems.end()) {
|
while (ii != g_globals->_sceneItems.end()) {
|
||||||
SceneItem *sceneItem = *ii;
|
SceneItem *sceneItem = *ii;
|
||||||
++ii;
|
++ii;
|
||||||
sceneItem->remove();
|
sceneItem->remove();
|
||||||
|
@ -107,37 +107,37 @@ void SceneManager::sceneChange() {
|
||||||
|
|
||||||
// Ensure that the same number of objects are registered now as when the scene started
|
// Ensure that the same number of objects are registered now as when the scene started
|
||||||
if (_objectCount > 0) {
|
if (_objectCount > 0) {
|
||||||
assert(_objectCount == _saver->getObjectCount());
|
assert(_objectCount == g_saver->getObjectCount());
|
||||||
}
|
}
|
||||||
_objectCount = _saver->getObjectCount();
|
_objectCount = g_saver->getObjectCount();
|
||||||
_globals->_sceneHandler->_delayTicks = 2;
|
g_globals->_sceneHandler->_delayTicks = 2;
|
||||||
|
|
||||||
// Instantiate and set the new scene
|
// Instantiate and set the new scene
|
||||||
_scene = getNewScene();
|
_scene = getNewScene();
|
||||||
|
|
||||||
if (!_saver->getMacroRestoreFlag())
|
if (!g_saver->getMacroRestoreFlag())
|
||||||
_scene->postInit();
|
_scene->postInit();
|
||||||
else
|
else
|
||||||
_scene->loadScene(activeScreenNumber);
|
_scene->loadScene(activeScreenNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scene *SceneManager::getNewScene() {
|
Scene *SceneManager::getNewScene() {
|
||||||
return _globals->_game->createScene(_nextSceneNumber);
|
return g_globals->_game->createScene(_nextSceneNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneManager::fadeInIfNecessary() {
|
void SceneManager::fadeInIfNecessary() {
|
||||||
if (_hasPalette) {
|
if (_hasPalette) {
|
||||||
uint32 adjustData = 0;
|
uint32 adjustData = 0;
|
||||||
for (int percent = 0; percent < 100; percent += 5) {
|
for (int percent = 0; percent < 100; percent += 5) {
|
||||||
if (_globals->_sceneManager._fadeMode == FADEMODE_IMMEDIATE)
|
if (g_globals->_sceneManager._fadeMode == FADEMODE_IMMEDIATE)
|
||||||
percent = 100;
|
percent = 100;
|
||||||
|
|
||||||
_globals->_scenePalette.fade((const byte *)&adjustData, false, percent);
|
g_globals->_scenePalette.fade((const byte *)&adjustData, false, percent);
|
||||||
g_system->updateScreen();
|
g_system->updateScreen();
|
||||||
g_system->delayMillis(10);
|
g_system->delayMillis(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
_globals->_scenePalette.refresh();
|
g_globals->_scenePalette.refresh();
|
||||||
_hasPalette = false;
|
_hasPalette = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ void SceneManager::changeScene(int newSceneNumber) {
|
||||||
// Fade out the scene
|
// Fade out the scene
|
||||||
ScenePalette scenePalette;
|
ScenePalette scenePalette;
|
||||||
uint32 adjustData = 0;
|
uint32 adjustData = 0;
|
||||||
_globals->_scenePalette.clearListeners();
|
g_globals->_scenePalette.clearListeners();
|
||||||
scenePalette.getPalette();
|
scenePalette.getPalette();
|
||||||
|
|
||||||
for (int percent = 100; percent >= 0; percent -= 5) {
|
for (int percent = 100; percent >= 0; percent -= 5) {
|
||||||
|
@ -157,7 +157,7 @@ void SceneManager::changeScene(int newSceneNumber) {
|
||||||
|
|
||||||
// Stop any objects that were animating
|
// Stop any objects that were animating
|
||||||
SynchronizedList<SceneObject *>::iterator i;
|
SynchronizedList<SceneObject *>::iterator i;
|
||||||
for (i = _globals->_sceneObjects->begin(); i != _globals->_sceneObjects->end(); ++i) {
|
for (i = g_globals->_sceneObjects->begin(); i != g_globals->_sceneObjects->end(); ++i) {
|
||||||
SceneObject *sceneObj = *i;
|
SceneObject *sceneObj = *i;
|
||||||
Common::Point pt(0, 0);
|
Common::Point pt(0, 0);
|
||||||
sceneObj->addMover(NULL, &pt);
|
sceneObj->addMover(NULL, &pt);
|
||||||
|
@ -168,10 +168,10 @@ void SceneManager::changeScene(int newSceneNumber) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Blank out the screen
|
// Blank out the screen
|
||||||
_globals->_screenSurface.fillRect(_globals->_screenSurface.getBounds(), 0);
|
g_globals->_screenSurface.fillRect(g_globals->_screenSurface.getBounds(), 0);
|
||||||
|
|
||||||
// If there are any fading sounds, wait until fading is complete
|
// If there are any fading sounds, wait until fading is complete
|
||||||
while (_globals->_soundManager.isFading()) {
|
while (g_globals->_soundManager.isFading()) {
|
||||||
g_system->delayMillis(10);
|
g_system->delayMillis(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,30 +180,30 @@ void SceneManager::changeScene(int newSceneNumber) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneManager::setup() {
|
void SceneManager::setup() {
|
||||||
_saver->addLoadNotifier(SceneManager::loadNotifier);
|
g_saver->addLoadNotifier(SceneManager::loadNotifier);
|
||||||
setBackSurface();
|
setBackSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneManager::setBackSurface() {
|
void SceneManager::setBackSurface() {
|
||||||
int size = _globals->_sceneManager._scene->_backgroundBounds.width() *
|
int size = g_globals->_sceneManager._scene->_backgroundBounds.width() *
|
||||||
_globals->_sceneManager._scene->_backgroundBounds.height();
|
g_globals->_sceneManager._scene->_backgroundBounds.height();
|
||||||
|
|
||||||
if (size > 96000) {
|
if (size > 96000) {
|
||||||
if (_globals->_sceneManager._scene->_backgroundBounds.width() <= SCREEN_WIDTH) {
|
if (g_globals->_sceneManager._scene->_backgroundBounds.width() <= SCREEN_WIDTH) {
|
||||||
// Standard size creation
|
// Standard size creation
|
||||||
_globals->_sceneManager._scene->_backSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT * 3 / 2);
|
g_globals->_sceneManager._scene->_backSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT * 3 / 2);
|
||||||
_globals->_sceneManager._scrollerRect = Rect(0, 30, SCREEN_WIDTH, SCREEN_HEIGHT - 30);
|
g_globals->_sceneManager._scrollerRect = Rect(0, 30, SCREEN_WIDTH, SCREEN_HEIGHT - 30);
|
||||||
} else {
|
} else {
|
||||||
// Wide screen needs extra space to allow for scrolling
|
// Wide screen needs extra space to allow for scrolling
|
||||||
_globals->_sceneManager._scene->_backSurface.create(SCREEN_WIDTH * 3 / 2, SCREEN_HEIGHT);
|
g_globals->_sceneManager._scene->_backSurface.create(SCREEN_WIDTH * 3 / 2, SCREEN_HEIGHT);
|
||||||
_globals->_sceneManager._scrollerRect = Rect(80, 0, SCREEN_WIDTH - 80, SCREEN_HEIGHT);
|
g_globals->_sceneManager._scrollerRect = Rect(80, 0, SCREEN_WIDTH - 80, SCREEN_HEIGHT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_globals->_sceneManager._scene->_backSurface.create(
|
g_globals->_sceneManager._scene->_backSurface.create(
|
||||||
_globals->_sceneManager._scene->_backgroundBounds.width(),
|
g_globals->_sceneManager._scene->_backgroundBounds.width(),
|
||||||
_globals->_sceneManager._scene->_backgroundBounds.height()
|
g_globals->_sceneManager._scene->_backgroundBounds.height()
|
||||||
);
|
);
|
||||||
_globals->_sceneManager._scrollerRect = Rect(80, 20, SCREEN_WIDTH - 80, SCREEN_HEIGHT - 20);
|
g_globals->_sceneManager._scrollerRect = Rect(80, 20, SCREEN_WIDTH - 80, SCREEN_HEIGHT - 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,9 +212,9 @@ void SceneManager::saveListener(int saveMode) {
|
||||||
|
|
||||||
void SceneManager::loadNotifier(bool postFlag) {
|
void SceneManager::loadNotifier(bool postFlag) {
|
||||||
if (postFlag) {
|
if (postFlag) {
|
||||||
if (_globals->_sceneManager._scene->_activeScreenNumber != -1)
|
if (g_globals->_sceneManager._scene->_activeScreenNumber != -1)
|
||||||
_globals->_sceneManager._scene->loadSceneData(_globals->_sceneManager._scene->_activeScreenNumber);
|
g_globals->_sceneManager._scene->loadSceneData(g_globals->_sceneManager._scene->_activeScreenNumber);
|
||||||
_globals->_sceneManager._hasPalette = true;
|
g_globals->_sceneManager._hasPalette = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,17 +226,17 @@ void SceneManager::setBgOffset(const Common::Point &pt, int loadCount) {
|
||||||
void SceneManager::listenerSynchronize(Serializer &s) {
|
void SceneManager::listenerSynchronize(Serializer &s) {
|
||||||
s.validate("SceneManager");
|
s.validate("SceneManager");
|
||||||
|
|
||||||
if (s.isLoading() && !_globals->_sceneManager._scene)
|
if (s.isLoading() && !g_globals->_sceneManager._scene)
|
||||||
// Loading a savegame straight from the launcher, so instantiate a blank placeholder scene
|
// Loading a savegame straight from the launcher, so instantiate a blank placeholder scene
|
||||||
// in order for the savegame loading to work correctly
|
// in order for the savegame loading to work correctly
|
||||||
_globals->_sceneManager._scene = new Scene();
|
g_globals->_sceneManager._scene = new Scene();
|
||||||
|
|
||||||
// Depreciated: the background scene objects used to be located here
|
// Depreciated: the background scene objects used to be located here
|
||||||
uint32 unused = 0;
|
uint32 unused = 0;
|
||||||
s.syncAsUint32LE(unused);
|
s.syncAsUint32LE(unused);
|
||||||
|
|
||||||
s.syncAsSint32LE(_sceneNumber);
|
s.syncAsSint32LE(_sceneNumber);
|
||||||
s.syncAsUint16LE(_globals->_sceneManager._scene->_activeScreenNumber);
|
s.syncAsUint16LE(g_globals->_sceneManager._scene->_activeScreenNumber);
|
||||||
|
|
||||||
if (s.isLoading()) {
|
if (s.isLoading()) {
|
||||||
changeScene(_sceneNumber);
|
changeScene(_sceneNumber);
|
||||||
|
@ -247,8 +247,8 @@ void SceneManager::listenerSynchronize(Serializer &s) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_globals->_sceneManager._scrollerRect.synchronize(s);
|
g_globals->_sceneManager._scrollerRect.synchronize(s);
|
||||||
SYNC_POINTER(_globals->_scrollFollower);
|
SYNC_POINTER(g_globals->_scrollFollower);
|
||||||
s.syncAsSint16LE(_loadMode);
|
s.syncAsSint16LE(_loadMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,8 +307,8 @@ void Scene::dispatch() {
|
||||||
void Scene::loadScene(int sceneNum) {
|
void Scene::loadScene(int sceneNum) {
|
||||||
debug(1, "loadScene(%d)", sceneNum);
|
debug(1, "loadScene(%d)", sceneNum);
|
||||||
_screenNumber = sceneNum;
|
_screenNumber = sceneNum;
|
||||||
if (_globals->_scenePalette.loadPalette(sceneNum))
|
if (g_globals->_scenePalette.loadPalette(sceneNum))
|
||||||
_globals->_sceneManager._hasPalette = true;
|
g_globals->_sceneManager._hasPalette = true;
|
||||||
|
|
||||||
loadSceneData(sceneNum);
|
loadSceneData(sceneNum);
|
||||||
}
|
}
|
||||||
|
@ -317,19 +317,19 @@ void Scene::loadSceneData(int sceneNum) {
|
||||||
_activeScreenNumber = sceneNum;
|
_activeScreenNumber = sceneNum;
|
||||||
|
|
||||||
// Get the basic scene size
|
// Get the basic scene size
|
||||||
byte *data = _resourceManager->getResource(RES_BITMAP, sceneNum, 9999);
|
byte *data = g_resourceManager->getResource(RES_BITMAP, sceneNum, 9999);
|
||||||
_backgroundBounds = Rect(0, 0, READ_LE_UINT16(data), READ_LE_UINT16(data + 2));
|
_backgroundBounds = Rect(0, 0, READ_LE_UINT16(data), READ_LE_UINT16(data + 2));
|
||||||
_globals->_sceneManager._scene->_sceneBounds.contain(_backgroundBounds);
|
g_globals->_sceneManager._scene->_sceneBounds.contain(_backgroundBounds);
|
||||||
DEALLOCATE(data);
|
DEALLOCATE(data);
|
||||||
|
|
||||||
// Set up a surface for storing the scene background
|
// Set up a surface for storing the scene background
|
||||||
SceneManager::setBackSurface();
|
SceneManager::setBackSurface();
|
||||||
|
|
||||||
// Load the data lists for the scene
|
// Load the data lists for the scene
|
||||||
_globals->_walkRegions.load(sceneNum);
|
g_globals->_walkRegions.load(sceneNum);
|
||||||
|
|
||||||
// Load the item regions of the scene
|
// Load the item regions of the scene
|
||||||
_globals->_sceneRegions.load(sceneNum);
|
g_globals->_sceneRegions.load(sceneNum);
|
||||||
|
|
||||||
// Load the priority regions
|
// Load the priority regions
|
||||||
_priorities.load(sceneNum);
|
_priorities.load(sceneNum);
|
||||||
|
@ -337,13 +337,13 @@ void Scene::loadSceneData(int sceneNum) {
|
||||||
// Initialize the section enabled list
|
// Initialize the section enabled list
|
||||||
Common::set_to(&_enabledSections[0], &_enabledSections[16 * 16], 0xffff);
|
Common::set_to(&_enabledSections[0], &_enabledSections[16 * 16], 0xffff);
|
||||||
|
|
||||||
_globals->_sceneOffset.x = (_sceneBounds.left / 160) * 160;
|
g_globals->_sceneOffset.x = (_sceneBounds.left / 160) * 160;
|
||||||
_globals->_sceneOffset.y = (_sceneBounds.top / 100) * 100;
|
g_globals->_sceneOffset.y = (_sceneBounds.top / 100) * 100;
|
||||||
_globals->_paneRefreshFlag[0] = 1;
|
g_globals->_paneRefreshFlag[0] = 1;
|
||||||
_globals->_paneRefreshFlag[1] = 1;
|
g_globals->_paneRefreshFlag[1] = 1;
|
||||||
_globals->_sceneManager._loadMode = 1;
|
g_globals->_sceneManager._loadMode = 1;
|
||||||
_globals->_sceneManager._sceneLoadCount = 0;
|
g_globals->_sceneManager._sceneLoadCount = 0;
|
||||||
_globals->_sceneManager._sceneBgOffset = Common::Point(0, 0);
|
g_globals->_sceneManager._sceneBgOffset = Common::Point(0, 0);
|
||||||
|
|
||||||
// Load the background for the scene
|
// Load the background for the scene
|
||||||
loadBackground(0, 0);
|
loadBackground(0, 0);
|
||||||
|
@ -355,35 +355,35 @@ void Scene::loadBackground(int xAmount, int yAmount) {
|
||||||
_sceneBounds.contain(_backgroundBounds);
|
_sceneBounds.contain(_backgroundBounds);
|
||||||
_sceneBounds.left &= ~3;
|
_sceneBounds.left &= ~3;
|
||||||
_sceneBounds.right &= ~3;
|
_sceneBounds.right &= ~3;
|
||||||
_globals->_sceneOffset.x &= ~3;
|
g_globals->_sceneOffset.x &= ~3;
|
||||||
|
|
||||||
if ((_sceneBounds.top != _oldSceneBounds.top) || (_sceneBounds.left != _oldSceneBounds.left)) {
|
if ((_sceneBounds.top != _oldSceneBounds.top) || (_sceneBounds.left != _oldSceneBounds.left)) {
|
||||||
if (_globals->_sceneManager._loadMode == 0) {
|
if (g_globals->_sceneManager._loadMode == 0) {
|
||||||
_globals->_paneRefreshFlag[0] = 2;
|
g_globals->_paneRefreshFlag[0] = 2;
|
||||||
_globals->_paneRefreshFlag[1] = 2;
|
g_globals->_paneRefreshFlag[1] = 2;
|
||||||
_globals->_sceneManager._loadMode = 2;
|
g_globals->_sceneManager._loadMode = 2;
|
||||||
}
|
}
|
||||||
_oldSceneBounds = _sceneBounds;
|
_oldSceneBounds = _sceneBounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
_globals->_sceneOffset.x = (_sceneBounds.left / 160) * 160;
|
g_globals->_sceneOffset.x = (_sceneBounds.left / 160) * 160;
|
||||||
_globals->_sceneOffset.y = (_sceneBounds.top / 100) * 100;
|
g_globals->_sceneOffset.y = (_sceneBounds.top / 100) * 100;
|
||||||
|
|
||||||
if ((_backgroundBounds.width() / 160) == 3)
|
if ((_backgroundBounds.width() / 160) == 3)
|
||||||
_globals->_sceneOffset.x = 0;
|
g_globals->_sceneOffset.x = 0;
|
||||||
if ((_backgroundBounds.height() / 100) == 3)
|
if ((_backgroundBounds.height() / 100) == 3)
|
||||||
_globals->_sceneOffset.y = 0;
|
g_globals->_sceneOffset.y = 0;
|
||||||
|
|
||||||
if ((_globals->_sceneOffset.x != _globals->_prevSceneOffset.x) ||
|
if ((g_globals->_sceneOffset.x != g_globals->_prevSceneOffset.x) ||
|
||||||
(_globals->_sceneOffset.y != _globals->_prevSceneOffset.y)) {
|
(g_globals->_sceneOffset.y != g_globals->_prevSceneOffset.y)) {
|
||||||
// Change has happend, so refresh background
|
// Change has happend, so refresh background
|
||||||
_globals->_prevSceneOffset = _globals->_sceneOffset;
|
g_globals->_prevSceneOffset = g_globals->_sceneOffset;
|
||||||
refreshBackground(xAmount, yAmount);
|
refreshBackground(xAmount, yAmount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::refreshBackground(int xAmount, int yAmount) {
|
void Scene::refreshBackground(int xAmount, int yAmount) {
|
||||||
if (_globals->_sceneManager._scene->_activeScreenNumber == -1)
|
if (g_globals->_sceneManager._scene->_activeScreenNumber == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Set the quadrant ranges
|
// Set the quadrant ranges
|
||||||
|
@ -428,7 +428,7 @@ void Scene::refreshBackground(int xAmount, int yAmount) {
|
||||||
(xSectionSrc + 1) * 160, (ySectionSrc + 1) * 100);
|
(xSectionSrc + 1) * 160, (ySectionSrc + 1) * 100);
|
||||||
Rect destBounds(xSectionDest * 160, ySectionDest * 100,
|
Rect destBounds(xSectionDest * 160, ySectionDest * 100,
|
||||||
(xSectionDest + 1) * 160, (ySectionDest + 1) * 100);
|
(xSectionDest + 1) * 160, (ySectionDest + 1) * 100);
|
||||||
if (_vm->getGameID() == GType_BlueForce) {
|
if (g_vm->getGameID() == GType_BlueForce) {
|
||||||
// For Blue Force, if the scene has an interface area, exclude it from the copy
|
// For Blue Force, if the scene has an interface area, exclude it from the copy
|
||||||
srcBounds.bottom = MIN<int16>(srcBounds.bottom, BF_GLOBALS._interfaceY);
|
srcBounds.bottom = MIN<int16>(srcBounds.bottom, BF_GLOBALS._interfaceY);
|
||||||
destBounds.bottom = MIN<int16>(destBounds.bottom, BF_GLOBALS._interfaceY);
|
destBounds.bottom = MIN<int16>(destBounds.bottom, BF_GLOBALS._interfaceY);
|
||||||
|
@ -460,7 +460,7 @@ void Scene::drawBackgroundObjects() {
|
||||||
// Handle updating object priority
|
// Handle updating object priority
|
||||||
if (!(obj->_flags & OBJFLAG_FIXED_PRIORITY)) {
|
if (!(obj->_flags & OBJFLAG_FIXED_PRIORITY)) {
|
||||||
obj->_priority = MIN((int)obj->_position.y - 1,
|
obj->_priority = MIN((int)obj->_position.y - 1,
|
||||||
(int)_globals->_sceneManager._scene->_backgroundBounds.bottom);
|
(int)g_globals->_sceneManager._scene->_backgroundBounds.bottom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,35 +513,35 @@ void Scene::setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent
|
||||||
|
|
||||||
void Game::restartGame() {
|
void Game::restartGame() {
|
||||||
if (MessageDialog::show(RESTART_MSG, CANCEL_BTN_STRING, RESTART_BTN_STRING) == 1)
|
if (MessageDialog::show(RESTART_MSG, CANCEL_BTN_STRING, RESTART_BTN_STRING) == 1)
|
||||||
_globals->_game->restart();
|
g_globals->_game->restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::saveGame() {
|
void Game::saveGame() {
|
||||||
if (!_vm->canSaveGameStateCurrently())
|
if (!g_vm->canSaveGameStateCurrently())
|
||||||
MessageDialog::show(SAVING_NOT_ALLOWED_MSG, OK_BTN_STRING);
|
MessageDialog::show(SAVING_NOT_ALLOWED_MSG, OK_BTN_STRING);
|
||||||
else {
|
else {
|
||||||
// Show the save dialog
|
// Show the save dialog
|
||||||
handleSaveLoad(true, _globals->_sceneHandler->_saveGameSlot, _globals->_sceneHandler->_saveName);
|
handleSaveLoad(true, g_globals->_sceneHandler->_saveGameSlot, g_globals->_sceneHandler->_saveName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::restoreGame() {
|
void Game::restoreGame() {
|
||||||
if (!_vm->canLoadGameStateCurrently())
|
if (!g_vm->canLoadGameStateCurrently())
|
||||||
MessageDialog::show(RESTORING_NOT_ALLOWED_MSG, OK_BTN_STRING);
|
MessageDialog::show(RESTORING_NOT_ALLOWED_MSG, OK_BTN_STRING);
|
||||||
else {
|
else {
|
||||||
// Show the load dialog
|
// Show the load dialog
|
||||||
handleSaveLoad(false, _globals->_sceneHandler->_loadGameSlot, _globals->_sceneHandler->_saveName);
|
handleSaveLoad(false, g_globals->_sceneHandler->_loadGameSlot, g_globals->_sceneHandler->_saveName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::quitGame() {
|
void Game::quitGame() {
|
||||||
if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1)
|
if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1)
|
||||||
_vm->quitGame();
|
g_vm->quitGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {
|
void Game::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {
|
||||||
const EnginePlugin *plugin = 0;
|
const EnginePlugin *plugin = 0;
|
||||||
EngineMan.findGame(_vm->getGameId(), &plugin);
|
EngineMan.findGame(g_vm->getGameId(), &plugin);
|
||||||
GUI::SaveLoadChooser *dialog;
|
GUI::SaveLoadChooser *dialog;
|
||||||
if (saveFlag)
|
if (saveFlag)
|
||||||
dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
|
dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
|
||||||
|
@ -569,7 +569,7 @@ void Game::execute() {
|
||||||
activeFlag = true;
|
activeFlag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (activeFlag && !_vm->shouldQuit());
|
} while (activeFlag && !g_vm->shouldQuit());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace TsAGE
|
} // End of namespace TsAGE
|
||||||
|
|
|
@ -54,7 +54,7 @@ SoundManager::SoundManager() {
|
||||||
SoundManager::~SoundManager() {
|
SoundManager::~SoundManager() {
|
||||||
if (__sndmgrReady) {
|
if (__sndmgrReady) {
|
||||||
Common::StackLock slock(_serverDisabledMutex);
|
Common::StackLock slock(_serverDisabledMutex);
|
||||||
_vm->_mixer->stopAll();
|
g_vm->_mixer->stopAll();
|
||||||
|
|
||||||
for (Common::List<Sound *>::iterator i = _soundList.begin(); i != _soundList.end(); ) {
|
for (Common::List<Sound *>::iterator i = _soundList.begin(); i != _soundList.end(); ) {
|
||||||
Sound *s = *i;
|
Sound *s = *i;
|
||||||
|
@ -84,9 +84,9 @@ SoundManager::~SoundManager() {
|
||||||
|
|
||||||
void SoundManager::postInit() {
|
void SoundManager::postInit() {
|
||||||
if (!__sndmgrReady) {
|
if (!__sndmgrReady) {
|
||||||
_saver->addSaveNotifier(&SoundManager::saveNotifier);
|
g_saver->addSaveNotifier(&SoundManager::saveNotifier);
|
||||||
_saver->addLoadNotifier(&SoundManager::loadNotifier);
|
g_saver->addLoadNotifier(&SoundManager::loadNotifier);
|
||||||
_saver->addListener(this);
|
g_saver->addListener(this);
|
||||||
|
|
||||||
|
|
||||||
// I originally separated the sound manager update method into a separate thread, since
|
// I originally separated the sound manager update method into a separate thread, since
|
||||||
|
@ -211,7 +211,7 @@ void SoundManager::installDriver(int driverNum) {
|
||||||
case ROLAND_DRIVER_NUM:
|
case ROLAND_DRIVER_NUM:
|
||||||
case ADLIB_DRIVER_NUM: {
|
case ADLIB_DRIVER_NUM: {
|
||||||
// Handle loading bank infomation
|
// Handle loading bank infomation
|
||||||
byte *bankData = _resourceManager->getResource(RES_BANK, driverNum, 0, true);
|
byte *bankData = g_resourceManager->getResource(RES_BANK, driverNum, 0, true);
|
||||||
if (bankData) {
|
if (bankData) {
|
||||||
// Install the patch bank data
|
// Install the patch bank data
|
||||||
_sfInstallPatchBank(driver, bankData);
|
_sfInstallPatchBank(driver, bankData);
|
||||||
|
@ -1383,7 +1383,7 @@ void SoundManager::_sfUnInstallDriver(SoundDriver *driver) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundManager::_sfInstallPatchBank(SoundDriver *driver, const byte *bankData) {
|
void SoundManager::_sfInstallPatchBank(SoundDriver *driver, const byte *bankData) {
|
||||||
driver->installPatch(bankData, _vm->_memoryManager.getSize(bankData));
|
driver->installPatch(bankData, g_vm->_memoryManager.getSize(bankData));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1536,7 +1536,7 @@ void Sound::play(int soundNum) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::stop() {
|
void Sound::stop() {
|
||||||
_globals->_soundManager.removeFromPlayList(this);
|
g_globals->_soundManager.removeFromPlayList(this);
|
||||||
_unPrime();
|
_unPrime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1560,7 +1560,7 @@ void Sound::_prime(int soundResID, bool dontQueue) {
|
||||||
// Sound number specified
|
// Sound number specified
|
||||||
_isEmpty = false;
|
_isEmpty = false;
|
||||||
_remoteReceiver = NULL;
|
_remoteReceiver = NULL;
|
||||||
byte *soundData = _resourceManager->getResource(RES_SOUND, soundResID, 0);
|
byte *soundData = g_resourceManager->getResource(RES_SOUND, soundResID, 0);
|
||||||
_soundManager->checkResVersion(soundData);
|
_soundManager->checkResVersion(soundData);
|
||||||
_group = _soundManager->determineGroup(soundData);
|
_group = _soundManager->determineGroup(soundData);
|
||||||
_sndResPriority = _soundManager->extractPriority(soundData);
|
_sndResPriority = _soundManager->extractPriority(soundData);
|
||||||
|
@ -1568,7 +1568,7 @@ void Sound::_prime(int soundResID, bool dontQueue) {
|
||||||
_soundManager->extractTrackInfo(&_trackInfo, soundData, _group);
|
_soundManager->extractTrackInfo(&_trackInfo, soundData, _group);
|
||||||
|
|
||||||
for (int idx = 0; idx < _trackInfo._numTracks; ++idx) {
|
for (int idx = 0; idx < _trackInfo._numTracks; ++idx) {
|
||||||
_channelData[idx] = _resourceManager->getResource(RES_SOUND, soundResID, _trackInfo._chunks[idx]);
|
_channelData[idx] = g_resourceManager->getResource(RES_SOUND, soundResID, _trackInfo._chunks[idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEALLOCATE(soundData);
|
DEALLOCATE(soundData);
|
||||||
|
@ -1667,7 +1667,7 @@ bool Sound::isMuted() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::pause(bool flag) {
|
void Sound::pause(bool flag) {
|
||||||
Common::StackLock slock(_globals->_soundManager._serverSuspendedMutex);
|
Common::StackLock slock(g_globals->_soundManager._serverSuspendedMutex);
|
||||||
|
|
||||||
if (flag)
|
if (flag)
|
||||||
++_pausedCount;
|
++_pausedCount;
|
||||||
|
@ -1678,7 +1678,7 @@ void Sound::pause(bool flag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::mute(bool flag) {
|
void Sound::mute(bool flag) {
|
||||||
Common::StackLock slock(_globals->_soundManager._serverSuspendedMutex);
|
Common::StackLock slock(g_globals->_soundManager._serverSuspendedMutex);
|
||||||
|
|
||||||
if (flag)
|
if (flag)
|
||||||
++_mutedCount;
|
++_mutedCount;
|
||||||
|
@ -1689,7 +1689,7 @@ void Sound::mute(bool flag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag) {
|
void Sound::fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag) {
|
||||||
Common::StackLock slock(_globals->_soundManager._serverSuspendedMutex);
|
Common::StackLock slock(g_globals->_soundManager._serverSuspendedMutex);
|
||||||
|
|
||||||
if (fadeDest > 127)
|
if (fadeDest > 127)
|
||||||
fadeDest = 127;
|
fadeDest = 127;
|
||||||
|
@ -1789,7 +1789,7 @@ void Sound::_soPrimeSound(bool dontQueue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::_soSetTimeIndex(uint timeIndex) {
|
void Sound::_soSetTimeIndex(uint timeIndex) {
|
||||||
Common::StackLock slock(_globals->_soundManager._serverSuspendedMutex);
|
Common::StackLock slock(g_globals->_soundManager._serverSuspendedMutex);
|
||||||
|
|
||||||
if (timeIndex != _timer) {
|
if (timeIndex != _timer) {
|
||||||
_soundManager->_soTimeIndexFlag = true;
|
_soundManager->_soTimeIndexFlag = true;
|
||||||
|
@ -2392,13 +2392,13 @@ int Sound::_soFindSound(VoiceTypeStruct *vtStruct, int channelNum) {
|
||||||
ASound::ASound(): EventHandler() {
|
ASound::ASound(): EventHandler() {
|
||||||
_action = NULL;
|
_action = NULL;
|
||||||
_cueValue = -1;
|
_cueValue = -1;
|
||||||
if (_globals)
|
if (g_globals)
|
||||||
_globals->_sounds.push_back(this);
|
g_globals->_sounds.push_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASound::~ASound() {
|
ASound::~ASound() {
|
||||||
if (_globals)
|
if (g_globals)
|
||||||
_globals->_sounds.remove(this);
|
g_globals->_sounds.remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASound::synchronize(Serializer &s) {
|
void ASound::synchronize(Serializer &s) {
|
||||||
|
@ -2544,7 +2544,7 @@ AdlibSoundDriver::AdlibSoundDriver(): SoundDriver() {
|
||||||
_groupData.v2 = 0;
|
_groupData.v2 = 0;
|
||||||
_groupData.pData = &adlib_group_data[0];
|
_groupData.pData = &adlib_group_data[0];
|
||||||
|
|
||||||
_mixer = _vm->_mixer;
|
_mixer = g_vm->_mixer;
|
||||||
_sampleRate = _mixer->getOutputRate();
|
_sampleRate = _mixer->getOutputRate();
|
||||||
_opl = OPL::Config::create();
|
_opl = OPL::Config::create();
|
||||||
assert(_opl);
|
assert(_opl);
|
||||||
|
@ -2858,7 +2858,7 @@ SoundBlasterDriver::SoundBlasterDriver(): SoundDriver() {
|
||||||
static byte const group_data[] = { 3, 1, 1, 0, 0xff };
|
static byte const group_data[] = { 3, 1, 1, 0, 0xff };
|
||||||
_groupData.pData = group_data;
|
_groupData.pData = group_data;
|
||||||
|
|
||||||
_mixer = _vm->_mixer;
|
_mixer = g_vm->_mixer;
|
||||||
_sampleRate = _mixer->getOutputRate();
|
_sampleRate = _mixer->getOutputRate();
|
||||||
_audioStream = NULL;
|
_audioStream = NULL;
|
||||||
_channelData = NULL;
|
_channelData = NULL;
|
||||||
|
@ -2904,7 +2904,7 @@ void SoundBlasterDriver::playSound(const byte *channelData, int dataOffset, int
|
||||||
_channelData = channelData + dataOffset;
|
_channelData = channelData + dataOffset;
|
||||||
|
|
||||||
// Make a copy of the buffer
|
// Make a copy of the buffer
|
||||||
int dataSize = _vm->_memoryManager.getSize(channelData);
|
int dataSize = g_vm->_memoryManager.getSize(channelData);
|
||||||
byte *soundData = (byte *)malloc(dataSize - dataOffset);
|
byte *soundData = (byte *)malloc(dataSize - dataOffset);
|
||||||
Common::copy(_channelData, _channelData + (dataSize - dataOffset), soundData);
|
Common::copy(_channelData, _channelData + (dataSize - dataOffset), soundData);
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,11 @@
|
||||||
|
|
||||||
namespace TsAGE {
|
namespace TsAGE {
|
||||||
|
|
||||||
TSageEngine *_vm = NULL;
|
TSageEngine *g_vm = NULL;
|
||||||
|
|
||||||
TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc) : Engine(system),
|
TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc) : Engine(system),
|
||||||
_gameDescription(gameDesc) {
|
_gameDescription(gameDesc) {
|
||||||
_vm = this;
|
g_vm = this;
|
||||||
DebugMan.addDebugChannel(kRingDebugScripts, "scripts", "Scripts debugging");
|
DebugMan.addDebugChannel(kRingDebugScripts, "scripts", "Scripts debugging");
|
||||||
_debugger = new Debugger();
|
_debugger = new Debugger();
|
||||||
}
|
}
|
||||||
|
@ -61,27 +61,27 @@ bool TSageEngine::hasFeature(EngineFeature f) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSageEngine::initialize() {
|
void TSageEngine::initialize() {
|
||||||
_saver = new Saver();
|
g_saver = new Saver();
|
||||||
|
|
||||||
// Set up the resource manager
|
// Set up the resource manager
|
||||||
_resourceManager = new ResourceManager();
|
g_resourceManager = new ResourceManager();
|
||||||
if (_vm->getFeatures() & GF_DEMO) {
|
if (g_vm->getFeatures() & GF_DEMO) {
|
||||||
// Add the single library file associated with the demo
|
// Add the single library file associated with the demo
|
||||||
_resourceManager->addLib(getPrimaryFilename());
|
g_resourceManager->addLib(getPrimaryFilename());
|
||||||
_globals = new Globals();
|
g_globals = new Globals();
|
||||||
|
|
||||||
} else if (_vm->getGameID() == GType_Ringworld) {
|
} else if (g_vm->getGameID() == GType_Ringworld) {
|
||||||
_resourceManager->addLib("RING.RLB");
|
g_resourceManager->addLib("RING.RLB");
|
||||||
_resourceManager->addLib("TSAGE.RLB");
|
g_resourceManager->addLib("TSAGE.RLB");
|
||||||
_globals = new Globals();
|
g_globals = new Globals();
|
||||||
|
|
||||||
} else if (_vm->getGameID() == GType_BlueForce) {
|
} else if (g_vm->getGameID() == GType_BlueForce) {
|
||||||
_resourceManager->addLib("BLUE.RLB");
|
g_resourceManager->addLib("BLUE.RLB");
|
||||||
if (_vm->getFeatures() & GF_FLOPPY) {
|
if (g_vm->getFeatures() & GF_FLOPPY) {
|
||||||
_resourceManager->addLib("FILES.RLB");
|
g_resourceManager->addLib("FILES.RLB");
|
||||||
_resourceManager->addLib("TSAGE.RLB");
|
g_resourceManager->addLib("TSAGE.RLB");
|
||||||
}
|
}
|
||||||
_globals = new BlueForce::BlueForceGlobals();
|
g_globals = new BlueForce::BlueForceGlobals();
|
||||||
|
|
||||||
// Setup the user interface
|
// Setup the user interface
|
||||||
BF_GLOBALS._uiElements.setup(Common::Point(0, BF_INTERFACE_Y - 2));
|
BF_GLOBALS._uiElements.setup(Common::Point(0, BF_INTERFACE_Y - 2));
|
||||||
|
@ -90,26 +90,26 @@ void TSageEngine::initialize() {
|
||||||
BF_GLOBALS.reset();
|
BF_GLOBALS.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
_globals->gfxManager().setDefaults();
|
g_globals->gfxManager().setDefaults();
|
||||||
|
|
||||||
// Setup sound settings
|
// Setup sound settings
|
||||||
syncSoundSettings();
|
syncSoundSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSageEngine::deinitialize() {
|
void TSageEngine::deinitialize() {
|
||||||
delete _globals;
|
delete g_globals;
|
||||||
delete _resourceManager;
|
delete g_resourceManager;
|
||||||
delete _saver;
|
delete g_saver;
|
||||||
_resourceManager = NULL;
|
g_resourceManager = NULL;
|
||||||
_saver = NULL;
|
g_saver = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error TSageEngine::run() {
|
Common::Error TSageEngine::run() {
|
||||||
// Basic initialisation
|
// Basic initialisation
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
_globals->_sceneHandler->registerHandler();
|
g_globals->_sceneHandler->registerHandler();
|
||||||
_globals->_game->execute();
|
g_globals->_game->execute();
|
||||||
|
|
||||||
deinitialize();
|
deinitialize();
|
||||||
return Common::kNoError;
|
return Common::kNoError;
|
||||||
|
@ -119,28 +119,28 @@ Common::Error TSageEngine::run() {
|
||||||
* Returns true if it is currently okay to restore a game
|
* Returns true if it is currently okay to restore a game
|
||||||
*/
|
*/
|
||||||
bool TSageEngine::canLoadGameStateCurrently() {
|
bool TSageEngine::canLoadGameStateCurrently() {
|
||||||
return (_globals->getFlag(50) == 0);
|
return (g_globals->getFlag(50) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if it is currently okay to save the game
|
* Returns true if it is currently okay to save the game
|
||||||
*/
|
*/
|
||||||
bool TSageEngine::canSaveGameStateCurrently() {
|
bool TSageEngine::canSaveGameStateCurrently() {
|
||||||
return (_globals->getFlag(50) == 0);
|
return (g_globals->getFlag(50) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the savegame at the specified slot index
|
* Load the savegame at the specified slot index
|
||||||
*/
|
*/
|
||||||
Common::Error TSageEngine::loadGameState(int slot) {
|
Common::Error TSageEngine::loadGameState(int slot) {
|
||||||
return _saver->restore(slot);
|
return g_saver->restore(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the game to the given slot index, and with the given name
|
* Save the game to the given slot index, and with the given name
|
||||||
*/
|
*/
|
||||||
Common::Error TSageEngine::saveGameState(int slot, const Common::String &desc) {
|
Common::Error TSageEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
return _saver->save(slot, desc);
|
return g_saver->save(slot, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -154,7 +154,7 @@ Common::String TSageEngine::generateSaveName(int slot) {
|
||||||
void TSageEngine::syncSoundSettings() {
|
void TSageEngine::syncSoundSettings() {
|
||||||
Engine::syncSoundSettings();
|
Engine::syncSoundSettings();
|
||||||
|
|
||||||
_globals->_soundManager.syncSounds();
|
g_globals->_soundManager.syncSounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TSageEngine::shouldQuit() {
|
bool TSageEngine::shouldQuit() {
|
||||||
|
|
|
@ -94,11 +94,11 @@ public:
|
||||||
void deinitialize();
|
void deinitialize();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TSageEngine *_vm;
|
extern TSageEngine *g_vm;
|
||||||
|
|
||||||
#define ALLOCATE_HANDLE(x) _vm->_memoryManager.allocate(x)
|
#define ALLOCATE_HANDLE(x) g_vm->_memoryManager.allocate(x)
|
||||||
#define ALLOCATE(x) _vm->_memoryManager.allocate2(x)
|
#define ALLOCATE(x) g_vm->_memoryManager.allocate2(x)
|
||||||
#define DEALLOCATE(x) _vm->_memoryManager.deallocate(x)
|
#define DEALLOCATE(x) g_vm->_memoryManager.deallocate(x)
|
||||||
|
|
||||||
} // End of namespace TsAGE
|
} // End of namespace TsAGE
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue