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;
_keyPressed = false;
_mouseClicked = false;
_currentTimer = 0;
}
EventsManager::~EventsManager() {

View File

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

View File

@ -54,6 +54,8 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm),
_v5 = _v6 = 0;
_aaName = "*I0.AA";
_playerSpritesFlag = false;
_currentTimer = 0;
_updateSceneFlag = false;
}
Game::~Game() {
@ -181,7 +183,65 @@ void Game::sectionLoop() {
_player._direction = _player._newDirection;
_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
_scene.free();

View File

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

View File

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

View File

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

View File

@ -35,6 +35,10 @@ Player::Player(MADSEngine *vm): _vm(vm) {
_spritesStart = _numSprites = 0;
_stepEnabled = false;
_visible = false;
_visible3 = false;
_special = 0;
_ticksAmount = 0;
_priorTimer = 0;
}
void Player::reset() {
@ -66,4 +70,21 @@ void Player::moveComplete() {
_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

View File

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

View File

@ -39,6 +39,8 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm), _action(_vm) {
_animVal1 = 0;
_depthStyle = 0;
_v1A = _v1C = 0;
_roomChanged = false;
_reloadSceneFlag = false;
_verbList.push_back(VerbInit(VERB_LOOK, 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;
}
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() {
warning("TODO: Scene::free");
}

View File

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