Skip to content

Commit 33968d9

Browse files
committed
removed usages of prepareRunFunction
1 parent ef1cc3b commit 33968d9

7 files changed

Lines changed: 1 addition & 24 deletions

File tree

lib/ZenLib

src/logic/DialogManager.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ std::vector<ChoiceEntry> DialogManager::evaluateConditions(NpcHandle player,
8989
int32_t valid = 0;
9090
if (info.condition)
9191
{
92-
m_World.getScriptEngine().prepareRunFunction();
9392
valid = m_World.getScriptEngine().runFunctionBySymIndex(info.condition);
9493
}
9594

@@ -241,7 +240,6 @@ void DialogManager::performChoice(size_t choice)
241240
getVM().setInstance("other", ZMemory::toBigHandle(m_Interaction.player), Daedalus::IC_Npc);
242241

243242
// Call the script routine attached to the choice
244-
m_World.getScriptEngine().prepareRunFunction();
245243
size_t fnSym = choiceEntry.functionSym;
246244
m_World.getScriptEngine().runFunctionBySymIndex(fnSym);
247245

src/logic/MobController.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ void MobController::callOnStateFunc(Handle::EntityHandle npc, int state)
308308
s.setInstanceNPC("self", VobTypes::getScriptHandle(nv));
309309
s.setInstanceItem("item", nv.playerController->getInteractItem());
310310

311-
s.prepareRunFunction();
312311
s.runFunctionBySymIndex(idx);
313312
}
314313
}

src/logic/NpcScriptState.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ bool Logic::NpcScriptState::startAIState(size_t symIdx, bool endOldState, bool i
8484
m_CurrentState.isRoutineState = isRoutineState;
8585

8686
// Just call the function
87-
s.prepareRunFunction();
8887
s.setInstance("self", VobTypes::getScriptObject(vob).instanceSymbol);
8988
s.runFunctionBySymIndex(symIdx);
9089

@@ -245,7 +244,6 @@ bool NpcScriptState::doAIState(float deltaTime)
245244
if (m_CurrentState.symIndex > 0)
246245
{
247246
// Call setup-function
248-
s.prepareRunFunction();
249247
s.runFunctionBySymIndex(m_CurrentState.symIndex);
250248
}
251249

@@ -261,7 +259,6 @@ bool NpcScriptState::doAIState(float deltaTime)
261259
// Call looping-function
262260
if (m_CurrentState.symLoop > 0)
263261
{
264-
s.prepareRunFunction();
265262
end = s.runFunctionBySymIndex(m_CurrentState.symLoop) != 0;
266263
}
267264

@@ -295,7 +292,6 @@ bool NpcScriptState::doAIState(float deltaTime)
295292
// Call end-function
296293
if (m_CurrentState.symEnd > 0)
297294
{
298-
s.prepareRunFunction();
299295
s.runFunctionBySymIndex(m_CurrentState.symEnd);
300296
}
301297

@@ -450,7 +446,6 @@ void NpcScriptState::reinitRoutine()
450446

451447
if (newSymFn != 0)
452448
{
453-
s.prepareRunFunction();
454449
s.runFunctionBySymIndex(newSymFn);
455450

456451
LogInfo() << "Changed routine on "

src/logic/PlayerController.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,6 @@ bool PlayerController::EV_Manipulate(std::shared_ptr<EventMessages::ManipulateMe
924924

925925
if (message.symIdx != static_cast<size_t>(-1))
926926
{
927-
m_World.getScriptEngine().prepareRunFunction();
928927
m_World.getScriptEngine().runFunctionBySymIndex(message.symIdx);
929928
}
930929
return false;
@@ -1302,7 +1301,6 @@ bool PlayerController::useItem(Daedalus::GameState::ItemHandle item)
13021301
if (data.on_state[0])
13031302
{
13041303
m_World.getScriptEngine().setInstanceNPC("self", getScriptHandle());
1305-
m_World.getScriptEngine().prepareRunFunction();
13061304
m_World.getScriptEngine().runFunctionBySymIndex(data.on_state[0]);
13071305

13081306
return true;
@@ -1337,8 +1335,6 @@ bool PlayerController::canUse(Daedalus::GameState::ItemHandle item)
13371335
s.setInstanceNPC("self", getScriptHandle());
13381336
s.setInstanceItem("item", item);
13391337

1340-
s.prepareRunFunction();
1341-
13421338
s.pushInt(data.cond_value[i]);
13431339
s.pushInt(data.cond_atr[i]);
13441340
s.pushInt(isPlayerControlled() ? 1 : 0);

src/logic/ScriptEngine.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ bool ScriptEngine::initVMWithLoadedDAT()
7070
return true;
7171
}
7272

73-
void ScriptEngine::prepareRunFunction()
74-
{
75-
// Clean the VM for this run
76-
m_pVM->pushState();
77-
}
78-
7973
int32_t ScriptEngine::runFunction(const std::string& fname, bool clearDataStack)
8074
{
8175
assert(getVM().getDATFile().hasSymbolName(fname));
@@ -153,15 +147,13 @@ void ScriptEngine::initForWorld(const std::string& world, bool firstStart)
153147
if (firstStart && m_pVM->getDATFile().hasSymbolName("startup_" + world))
154148
{
155149
LogInfo() << "Running: Startup_" << world;
156-
prepareRunFunction();
157150
runFunction("startup_" + world);
158151
LogInfo() << "Done!";
159152
}
160153

161154
if (m_pVM->getDATFile().hasSymbolName("init_" + world))
162155
{
163156
LogInfo() << "Running init_" << world;
164-
prepareRunFunction();
165157
runFunction("init_" + world);
166158
LogInfo() << "Done!";
167159
}
@@ -253,8 +245,6 @@ void ScriptEngine::onNPCInitialized(Daedalus::GameState::NpcHandle npc)
253245

254246
if (npcData.daily_routine != 0)
255247
{
256-
prepareRunFunction();
257-
258248
m_pVM->setInstance("self", ZMemory::toBigHandle(npc), Daedalus::IC_Npc);
259249
m_pVM->setCurrentInstance(getSymbolIndexByName("self"));
260250

src/target/REGoth.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,6 @@ void REGoth::initConsole()
664664
return "error: could not find script functions";
665665

666666
int exp = std::stoi(args[1]);
667-
s1.prepareRunFunction();
668667
s1.pushInt(exp);
669668
s1.runFunction(scriptName, false);
670669

0 commit comments

Comments
 (0)