MADS: Fix/clean up ending of ScreenObjects::check

This commit is contained in:
Paul Gilbert 2014-04-02 20:28:57 -04:00
parent 0c1001fbf4
commit 041773705b
7 changed files with 18 additions and 8 deletions

View file

@ -60,7 +60,6 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm),
_anyEmergency = false;
_triggerMode = KERNEL_TRIGGER_PARSER;
_triggerSetupMode = KERNEL_TRIGGER_PARSER;
_ticksExpiry = 0;
_winStatus = 0;
// Load the inventory object list

View file

@ -138,7 +138,6 @@ public:
TriggerMode _triggerSetupMode;
uint32 _priorFrameTimer;
Common::String _aaName;
uint32 _ticksExpiry;
int _winStatus;
public:
virtual ~Game();

View file

@ -582,4 +582,8 @@ void Scene::resetScene() {
_sequences.clear();
}
void Scene::backgroundAnimation() {
warning("TODO: Scene::backgroundAnimation");
}
} // End of namespace MADS

View file

@ -210,6 +210,8 @@ public:
void changeDepthSurface(int arg1);
void resetScene();
void backgroundAnimation();
};
} // End of namespace MADS

View file

@ -266,6 +266,7 @@ ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) {
_scrollerY = -1;
_milliTime = 0;
_eventFlag = false;
_baseTime = 0;
}
void ScreenObjects::add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId) {
@ -343,7 +344,7 @@ void ScreenObjects::check(bool scanFlag) {
scene._action.refresh();
uint32 currentTicks = _vm->_events->getFrameCounter();
if (currentTicks >= _vm->_game->_ticksExpiry) {
if (currentTicks >= _baseTime) {
// Check the user interface slots to see if there's any slots that need to be expired
UISlots &uiSlots = userInterface._uiSlots;
for (uint idx = 0; idx < uiSlots.size(); ++idx) {
@ -354,12 +355,16 @@ void ScreenObjects::check(bool scanFlag) {
slot._slotType = ST_EXPIRED;
}
// TODO: The stuff here could probably be moved to Scene::doFrame
// Any background animation
scene.backgroundAnimation();
// Handle animating the selected inventory animation
userInterface.inventoryAnim();
// Set the next frame expiry
_vm->_game->_ticksExpiry = currentTicks + 6;
}
// Set the base time
_baseTime = currentTicks + 6;
}
}
int ScreenObjects::scanBackwards(const Common::Point &pt, int layer) {

View file

@ -161,6 +161,7 @@ public:
int _uiCount;
uint32 _milliTime;
bool _eventFlag;
uint32 _baseTime;
/*
* Constructor

View file

@ -264,7 +264,7 @@ void UserInterface::setup(int id) {
scene._userInterface._uiSlots.clear();
scene._userInterface._uiSlots.fullRefresh();
_vm->_game->_ticksExpiry = _vm->_events->getFrameCounter();
_vm->_game->_screenObjects._baseTime = _vm->_events->getFrameCounter();
_highlightedCommandIndex = -1;
_highlightedActionIndex = -1;
_highlightedItemIndex = -1;
@ -590,7 +590,7 @@ void UserInterface::noInventoryAnim() {
if (_invSpritesIndex >= 0) {
scene._sprites.remove(_invSpritesIndex);
_vm->_game->_ticksExpiry = _vm->_events->getFrameCounter();
_vm->_game->_screenObjects._baseTime = _vm->_events->getFrameCounter();
_invSpritesIndex = -1;
}