MADS: Implemented more of the multi-scene loop

This commit is contained in:
Paul Gilbert 2014-03-02 20:50:35 -05:00
parent 72163a233f
commit a0996b7384
10 changed files with 132 additions and 3 deletions

View File

@ -39,6 +39,7 @@ EventsManager::EventsManager(MADSEngine *vm) {
_priorFrameTime = 0; _priorFrameTime = 0;
_keyPressed = false; _keyPressed = false;
_mouseClicked = false; _mouseClicked = false;
_currentTimer = 0;
} }
EventsManager::~EventsManager() { EventsManager::~EventsManager() {

View File

@ -60,6 +60,7 @@ public:
SpriteAsset *_cursorSprites; SpriteAsset *_cursorSprites;
bool _mouseClicked; bool _mouseClicked;
bool _keyPressed; bool _keyPressed;
uint32 _currentTimer;
public: public:
/** /**
* Constructor * Constructor

View File

@ -54,6 +54,8 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm),
_v5 = _v6 = 0; _v5 = _v6 = 0;
_aaName = "*I0.AA"; _aaName = "*I0.AA";
_playerSpritesFlag = false; _playerSpritesFlag = false;
_currentTimer = 0;
_updateSceneFlag = false;
} }
Game::~Game() { Game::~Game() {
@ -181,7 +183,65 @@ void Game::sectionLoop() {
_player._direction = _player._newDirection; _player._direction = _player._newDirection;
_player.moveComplete(); _player.moveComplete();
// TODO: main section loop logic goes here switch (_vm->_screenFade) {
case SCREEN_FADE_SMOOTH:
_abortTimers2 = 2;
break;
case SCREEN_FADE_FAST:
_abortTimers2 = 20;
break;
default:
_abortTimers2 = 21;
break;
}
_abortTimers = 0;
_abortTimersMode2 = ABORTMODE_1;
_currentTimer = _vm->_events->_currentTimer;
// Call the scene logic for entering the given scene
_scene._sceneLogic->enter();
// Set player data
_player._destPos = _player._playerPos;
_player._newDirection = _player._direction;
_player._destFacing = _player._direction;
_player.setupFrame();
_player.updateFrame();
_player._visible3 = _player._visible;
_player._special = _scene.getDepthHighBits(_player._playerPos);
_player._priorTimer = _vm->_events->_currentTimer + _player._ticksAmount;
_player.idle();
warning("TODO: _selectedObject IF block");
_v1 = 5;
_scene._roomChanged = false;
if ((_v5 || _v6) && !_updateSceneFlag) {
_scene._currentSceneId = _scene._priorSceneId;
_updateSceneFlag = true;
}
else {
_updateSceneFlag = false;
_scene.loop();
}
_vm->_events->resetCursor();
_v1 = 3;
delete _quotes;
_quotes = nullptr;
delete _scene._animation;
_scene._animation = nullptr;
_scene._reloadSceneFlag = false;
warning("TODO: sub_1DD8C, sub_1DD7E");
if (!_playerSpritesFlag) {
_player._spritesLoaded = false;
_player._spritesChanged = true;
}
// Clear the scene // Clear the scene
_scene.free(); _scene.free();

View File

@ -65,6 +65,7 @@ protected:
int _v3; int _v3;
int _v5; int _v5;
int _v6; int _v6;
bool _updateSceneFlag;
Common::String _aaName; Common::String _aaName;
bool _playerSpritesFlag; bool _playerSpritesFlag;
int _objectHiliteVocabIdx; int _objectHiliteVocabIdx;
@ -111,6 +112,10 @@ public:
Scene _scene; Scene _scene;
int _v2; int _v2;
int _v4; int _v4;
int _abortTimers;
int _abortTimers2;
AbortTimerMode _abortTimersMode2;
uint32 _currentTimer;
public: public:
virtual ~Game(); virtual ~Game();

View File

@ -41,6 +41,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) :
_easyMouse = true; _easyMouse = true;
_invObjectStill = false; _invObjectStill = false;
_textWindowStill = false; _textWindowStill = false;
_screenFade = SCREEN_FADE_FAST;
_debugger = nullptr; _debugger = nullptr;
_dialogs = nullptr; _dialogs = nullptr;

View File

@ -67,6 +67,12 @@ enum {
GType_Riddle = 3 GType_Riddle = 3
}; };
enum ScreenFade {
SCREEN_FADE_SMOOTH = 0,
SCREEN_FADE_MEDIUM = 1,
SCREEN_FADE_FAST = 2
};
struct MADSGameDescription; struct MADSGameDescription;
@ -97,7 +103,7 @@ public:
bool _easyMouse; bool _easyMouse;
bool _invObjectStill; bool _invObjectStill;
bool _textWindowStill; bool _textWindowStill;
ScreenFade _screenFade;
public: public:
MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc); MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc);
virtual ~MADSEngine(); virtual ~MADSEngine();

View File

@ -35,6 +35,10 @@ Player::Player(MADSEngine *vm): _vm(vm) {
_spritesStart = _numSprites = 0; _spritesStart = _numSprites = 0;
_stepEnabled = false; _stepEnabled = false;
_visible = false; _visible = false;
_visible3 = false;
_special = 0;
_ticksAmount = 0;
_priorTimer = 0;
} }
void Player::reset() { void Player::reset() {
@ -66,4 +70,21 @@ void Player::moveComplete() {
_action->_inProgress = false; _action->_inProgress = false;
} }
void Player::setupFrame() {
resetActionList();
warning("TODO: Player::setupFrame");
}
void Player::updateFrame() {
warning("TODO: Player::updateFrame");
}
void Player::resetActionList() {
warning("TODO: Player::resetActionList");
}
void Player::idle() {
warning("TODO: Player::idle");
}
} // End of namespace MADS } // End of namespace MADS

View File

@ -37,6 +37,8 @@ private:
MADSAction *_action; MADSAction *_action;
void reset(); void reset();
void resetActionList();
public: public:
int _direction; int _direction;
int _newDirection; int _newDirection;
@ -47,13 +49,16 @@ public:
bool _stepEnabled; bool _stepEnabled;
bool _spritesChanged; bool _spritesChanged;
bool _visible; bool _visible;
bool _visible3;
Common::Point _playerPos; Common::Point _playerPos;
Common::Point _destPos; Common::Point _destPos;
bool _moving; bool _moving;
int _v844C0, _v844BE; int _v844C0, _v844BE;
int _next; int _next;
int _routeCount; int _routeCount;
int _special;
int _ticksAmount;
uint32 _priorTimer;
public: public:
Player(MADSEngine *vm); Player(MADSEngine *vm);
@ -62,6 +67,12 @@ public:
void turnToDestFacing(); void turnToDestFacing();
void moveComplete(); void moveComplete();
void setupFrame();
void updateFrame();
void idle();
}; };
} // End of namespace MADS } // End of namespace MADS

View File

@ -39,6 +39,8 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm), _action(_vm) {
_animVal1 = 0; _animVal1 = 0;
_depthStyle = 0; _depthStyle = 0;
_v1A = _v1C = 0; _v1A = _v1C = 0;
_roomChanged = false;
_reloadSceneFlag = false;
_verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_LOOK, 2, 0));
_verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0));
@ -254,6 +256,19 @@ void Scene::initPaletteAnimation(Common::Array<RGB4> &animData, bool animFlag) {
_animFlag = animFlag; _animFlag = animFlag;
} }
bool Scene::getDepthHighBits(const Common::Point &pt) {
if (_sceneInfo->_depthStyle == 2) {
return 0;
} else {
const byte *p = _depthSurface.getBasePtr(pt.x, pt.y);
return (*p & 0x70) >> 4;
}
}
void Scene::loop() {
}
void Scene::free() { void Scene::free() {
warning("TODO: Scene::free"); warning("TODO: Scene::free");
} }

View File

@ -98,6 +98,8 @@ public:
int _v1A; int _v1A;
int _v1C; int _v1C;
MADSAction _action; MADSAction _action;
bool _roomChanged;
bool _reloadSceneFlag;
/** /**
* Constructor * Constructor
@ -157,6 +159,12 @@ public:
*/ */
void loadVocab(); void loadVocab();
bool getDepthHighBits(const Common::Point &pt);
/**
* Main scene loop
*/
void loop();
/** /**
* Clear the data for the scene * Clear the data for the scene