MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / prepareMoveActions

Method prepareMoveActions

Source/EffectManager.cpp:47–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47void EffectManager::prepareMoveActions(float dt, bool idk)
48{
49 for(auto d : _activeMoveActions) d.second->release();
50 _activeMoveActions.clear();
51 for (auto commandObject : _groupActions)
52 {
53 if (commandObject->_actionID == 0)
54 {
55 CCMoveNode* moveNode;
56 if (!this->_activeMoveActions.contains(commandObject->_groupID))
57 {
58 moveNode = CCMoveNode::create();
59 moveNode->retain();
60 this->_activeMoveActions[commandObject->_groupID] = moveNode;
61 }
62 if (!moveNode)
63 moveNode = this->_activeMoveActions[commandObject->_groupID];
64
65 ax::Point unk, newPos;
66
67 if (!commandObject->_actionDoneForNextLoop)
68 {
69 commandObject->step(dt);
70 moveNode->_delta1 = commandObject->_delta1;
71 commandObject->_delta2 += commandObject->_delta1;
72
73 unk = commandObject->_unkPoint, newPos = commandObject->_newPos;
74
75 if (commandObject->_followPlayerX)
76 {
77 unk.x = this->_xAccel;
78 if (idk)
79 commandObject->_newPos.x += this->_xAccel;
80 else
81 newPos.x += this->_xAccel;
82 }
83 if (commandObject->_followPlayerY)
84 {
85 unk.y = this->_yAccel;
86 if (idk)
87 commandObject->_newPos.y += this->_yAccel;
88 else
89 newPos.y += this->_yAccel;
90 }
91
92 moveNode->_newPosStatic.x += unk.x;
93 moveNode->_newPosStatic.y += unk.y;
94 moveNode->_newPosOptimized.x += newPos.x;
95 moveNode->_newPosOptimized.y += newPos.y;
96 }
97 else
98 {
99 moveNode->_newPosOptimized.x += newPos.x;
100 moveNode->_newPosOptimized.y += newPos.y;
101 }
102
103 commandObject->_delta1 = 0;
104

Callers 1

updateMethod · 0.80

Calls 4

createFunction · 0.85
stepMethod · 0.80
beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected