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; _anyEmergency = false;
_triggerMode = KERNEL_TRIGGER_PARSER; _triggerMode = KERNEL_TRIGGER_PARSER;
_triggerSetupMode = KERNEL_TRIGGER_PARSER; _triggerSetupMode = KERNEL_TRIGGER_PARSER;
_ticksExpiry = 0;
_winStatus = 0; _winStatus = 0;
// Load the inventory object list // Load the inventory object list

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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