AVALANCHE: move some engine init instructions to Gyro

This commit is contained in:
Strangerke 2013-09-18 08:00:30 +02:00
parent 8be433b960
commit 9ba81f6097
6 changed files with 32 additions and 29 deletions

View file

@ -430,7 +430,7 @@ bool AvalancheEngine::loadGame(const int16 slot) {
synchronize(sz);
delete f;
_gyro->isLoaded = true;
_gyro->_isLoaded = true;
_gyro->_seeScroll = true; // This prevents display of the new sprites before the new picture is loaded.
if (_gyro->_holdTheDawn) {

View file

@ -125,34 +125,22 @@ void Avalot::handleKeyDown(Common::Event &event) {
}
void Avalot::setup() {
_vm->_gyro->_mouse = _vm->_gyro->kMouseStateNo;
_vm->_gyro->_letMeOut = false;
_vm->_gyro->init();
_vm->_scrolls->resetScroll();
CursorMan.showMouse(true);
_vm->_gyro->_holdTheDawn = true;
_vm->_lucerna->dusk();
_vm->_gyro->_currentMouse = 177;
_vm->_gyro->setMousePointerWait();
_vm->_gyro->_dropsOk = true;
_vm->_gyro->_mouseText = "";
_vm->_lucerna->loadDigits();
_vm->_gyro->_cheat = false;
_vm->_gyro->_cp = 0;
_vm->_parser->_inputTextPos = 0;
_vm->_parser->_quote = true;
_vm->_gyro->_ledStatus = 177;
_vm->_gyro->_defaultLed = 2;
// TSkellern = 0; Replace with a more local variable sometime
_vm->_animation->_direction = Animation::kDirStopped;
_vm->_gyro->_enidFilename = ""; // Undefined.
_vm->_lucerna->drawToolbar();
_vm->_scrolls->setReadyLight(2);
for (int i = 0; i < 3; i++)
_vm->_gyro->_scoreToDisplay[i] = -1; // Impossible digits.
_vm->_animation->_direction = Animation::kDirStopped;
_vm->_animation->loadAnims();
_vm->_gyro->_holdTheDawn = false;
_vm->_lucerna->dawn();
_vm->_parser->_cursorState = false;
_vm->_parser->cursorOn();
@ -168,7 +156,7 @@ void Avalot::setup() {
_vm->loadGame(loadSlot);
} else {
_vm->_gyro->isLoaded = false; // Set to true in _vm->loadGame().
_vm->_gyro->_isLoaded = false; // Set to true in _vm->loadGame().
_vm->_gyro->newGame(); // No game was requested- load the default.
_vm->_gyro->_soundFx = !_vm->_gyro->_soundFx;

View file

@ -592,4 +592,24 @@ void Gyro::hangAroundForAWhile() {
slowDown();
}
void Gyro::init() {
_mouse = kMouseStateNo;
_letMeOut = false;
_holdTheDawn = true;
_currentMouse = 177;
_dropsOk = true;
_mouseText = "";
_cheat = false;
_cp = 0;
_ledStatus = 177;
_defaultLed = 2;
_enidFilename = ""; // Undefined.
for (int i = 0; i < 3; i++)
_scoreToDisplay[i] = -1; // Impossible digits.
_holdTheDawn = false;
setMousePointerWait();
CursorMan.showMouse(true);
}
} // End of namespace Avalanche

View file

@ -42,7 +42,6 @@
namespace Avalanche {
class AvalancheEngine;
static const byte kObjectNum = 18; // always preface with a #
static const int16 kCarryLimit = 12; // carry limit
@ -187,11 +186,8 @@ public:
static const int16 kXW = 30;
static const int16 kYW = 36; // x width & y whatsit
static const int16 kMargin = 5;
static const MouseHotspotType kMouseHotSpots[9];
static const int16 kMaxSprites = 2; // Current max no. of sprites.
// For Thinkabout:
@ -363,11 +359,9 @@ public:
byte _lastPerson; // Last person to have been selected using the People menu.
bool _doingSpriteRun; // Only set to True if we're doing a sprite_run at this moment. This stops the trippancy system from moving any of the sprites.
bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning.
bool isLoaded; // Is it a loaded gamestate?
bool _isLoaded; // Is it a loaded gamestate?
Common::String _enidFilename;
Gyro(AvalancheEngine *vm);
~Gyro();
@ -397,6 +391,7 @@ public:
Common::String getItem(byte which); // Called get_better in the original.
Common::String f5Does(); // This procedure determines what f5 does.
void init();
private:
AvalancheEngine *_vm;

View file

@ -835,7 +835,7 @@ void Lucerna::enterRoom(byte room, byte ped) {
}
_vm->_gyro->_seeScroll = false; // Now it can work again!
_vm->_gyro->isLoaded = false;
_vm->_gyro->_isLoaded = false;
}
void Lucerna::thinkAbout(byte object, bool type) {

View file

@ -57,7 +57,7 @@ Timer::Timer(AvalancheEngine *vm) {
* @remarks Originally called 'set_up_timer'
*/
void Timer::addTimer(int32 duration, byte action, byte reason) {
if ((_vm->_gyro->isLoaded == false) || (_timerLost == true)) {
if ((_vm->_gyro->_isLoaded == false) || (_timerLost == true)) {
byte i = 0;
while ((i < 7) && (_times[i]._timeLeft != 0))
i++;
@ -70,7 +70,7 @@ void Timer::addTimer(int32 duration, byte action, byte reason) {
_times[i]._action = action;
_times[i]._reason = reason;
} else {
_vm->_gyro->isLoaded = false;
_vm->_gyro->_isLoaded = false;
return;
}
}