mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-06 10:17:14 +00:00
ZVISION: Keep a member variable ZVision pointer instead of passing it in every process()
This commit is contained in:
parent
2431f60c02
commit
7095e613d5
@ -28,14 +28,15 @@
|
||||
|
||||
namespace ZVision {
|
||||
|
||||
NodeTimer::NodeTimer(uint32 key, uint timeInSeconds)
|
||||
: _key(key), _timeLeft(timeInSeconds * 1000) {}
|
||||
TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds)
|
||||
: _engine(engine), _key(key), _timeLeft(timeInSeconds * 1000) {
|
||||
}
|
||||
|
||||
bool NodeTimer::process(ZVision *engine, uint32 deltaTimeInMillis) {
|
||||
bool TimerNode::process(uint32 deltaTimeInMillis) {
|
||||
_timeLeft -= deltaTimeInMillis;
|
||||
|
||||
if (_timeLeft <= 0) {
|
||||
engine->getScriptManager()->setStateValue(_key, 0);
|
||||
_engine->getScriptManager()->setStateValue(_key, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -32,23 +32,29 @@ class ZVision;
|
||||
class ActionNode {
|
||||
public:
|
||||
virtual ~ActionNode() {}
|
||||
virtual bool process(ZVision *engine, uint32 deltaTimeInMillis) = 0;
|
||||
/**
|
||||
* Processes the node given the deltaTime since last frame
|
||||
*
|
||||
* @param deltaTimeInMillis The number of milliseconds that have passed since last frame
|
||||
* @return If true, the node can be deleted after process() finishes
|
||||
*/
|
||||
virtual bool process(uint32 deltaTimeInMillis) = 0;
|
||||
};
|
||||
|
||||
class NodeTimer : public ActionNode {
|
||||
class TimerNode : public ActionNode {
|
||||
public:
|
||||
NodeTimer(uint32 key, uint timeInSeconds);
|
||||
TimerNode(ZVision *engine, uint32 key, uint timeInSeconds);
|
||||
/**
|
||||
* Decrement the timer by the delta time. If the timer is finished, set the status
|
||||
* in _globalState and let this node be deleted
|
||||
*
|
||||
* @param engine Pointer to the ZVision instance
|
||||
* @param deltaTimeInMillis Amount of time that has passed since the last frame
|
||||
* @return Node should be deleted after this (true) or kept (false)
|
||||
* @param deltaTimeInMillis The number of milliseconds that have passed since last frame
|
||||
* @return If true, the node can be deleted after process() finishes
|
||||
*/
|
||||
bool process(ZVision *engine, uint32 deltaTimeInMillis);
|
||||
bool process(uint32 deltaTimeInMillis);
|
||||
|
||||
private:
|
||||
ZVision *_engine;
|
||||
uint32 _key;
|
||||
uint32 _timeLeft;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user