ZVISION: Basic integration of SideFX into scriptManager.
This commit is contained in:
parent
82348a74df
commit
a6f025c74f
2 changed files with 33 additions and 2 deletions
|
@ -108,6 +108,16 @@ void ScriptManager::createReferenceTable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptManager::updateNodes(uint deltaTimeMillis) {
|
void ScriptManager::updateNodes(uint deltaTimeMillis) {
|
||||||
|
// If process() returns true, it means the node can be deleted
|
||||||
|
for (SideFXList::iterator iter = _activeSideFx.begin(); iter != _activeSideFx.end();) {
|
||||||
|
if ((*iter)->process(deltaTimeMillis)) {
|
||||||
|
delete (*iter);
|
||||||
|
// Remove the node
|
||||||
|
iter = _activeSideFx.erase(iter);
|
||||||
|
} else {
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
// If process() returns true, it means the node can be deleted
|
// If process() returns true, it means the node can be deleted
|
||||||
for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end();) {
|
for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end();) {
|
||||||
if ((*iter)->process(deltaTimeMillis)) {
|
if ((*iter)->process(deltaTimeMillis)) {
|
||||||
|
@ -273,6 +283,20 @@ void ScriptManager::focusControl(uint32 key) {
|
||||||
_currentlyFocusedControl = key;
|
_currentlyFocusedControl = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptManager::addSideFX(SideFX *fx) {
|
||||||
|
_activeSideFx.push_back(fx);
|
||||||
|
}
|
||||||
|
|
||||||
|
SideFX *ScriptManager::getSideFX(uint32 key) {
|
||||||
|
for (SideFXList::iterator iter = _activeSideFx.begin(); iter != _activeSideFx.end(); ++iter) {
|
||||||
|
if ((*iter)->getKey() == key) {
|
||||||
|
return (*iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptManager::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
|
void ScriptManager::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
|
||||||
for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||||
(*iter)->onMouseDown(screenSpacePos, backgroundImageSpacePos);
|
(*iter)->onMouseDown(screenSpacePos, backgroundImageSpacePos);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include "zvision/puzzle.h"
|
#include "zvision/puzzle.h"
|
||||||
#include "zvision/control.h"
|
#include "zvision/control.h"
|
||||||
|
#include "zvision/sidefx.h"
|
||||||
|
|
||||||
#include "common/hashmap.h"
|
#include "common/hashmap.h"
|
||||||
#include "common/queue.h"
|
#include "common/queue.h"
|
||||||
|
@ -54,6 +55,7 @@ typedef Common::List<Puzzle *> PuzzleList;
|
||||||
typedef Common::Queue<Puzzle *> PuzzleQueue;
|
typedef Common::Queue<Puzzle *> PuzzleQueue;
|
||||||
typedef Common::List<Control *> ControlList;
|
typedef Common::List<Control *> ControlList;
|
||||||
typedef Common::HashMap<uint32, uint32> StateMap;
|
typedef Common::HashMap<uint32, uint32> StateMap;
|
||||||
|
typedef Common::List<SideFX *> SideFXList;
|
||||||
|
|
||||||
class ScriptManager {
|
class ScriptManager {
|
||||||
public:
|
public:
|
||||||
|
@ -78,6 +80,8 @@ private:
|
||||||
PuzzleList _globalPuzzles;
|
PuzzleList _globalPuzzles;
|
||||||
/** Holds the currently active controls */
|
/** Holds the currently active controls */
|
||||||
ControlList _activeControls;
|
ControlList _activeControls;
|
||||||
|
/** Holds the currently active timers, musics, other */
|
||||||
|
SideFXList _activeSideFx;
|
||||||
|
|
||||||
Location _currentLocation;
|
Location _currentLocation;
|
||||||
|
|
||||||
|
@ -99,6 +103,9 @@ public:
|
||||||
|
|
||||||
void focusControl(uint32 key);
|
void focusControl(uint32 key);
|
||||||
|
|
||||||
|
void addSideFX(SideFX *fx);
|
||||||
|
SideFX *getSideFX(uint32 key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when LeftMouse is pushed.
|
* Called when LeftMouse is pushed.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue