MCPcopy Create free account
hub / github.com/EasyRPG/Player / Update

Method Update

src/game_event.cpp:578–609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

576}
577
578AsyncOp Game_Event::Update(bool resume_async) {
579 if (!data()->active || (!resume_async && page == NULL)) {
580 return {};
581 }
582
583 // RPG_RT runs the parallel interpreter everytime Update is called.
584 // That means if the event updates multiple times due to makeway,
585 // the interpreter will run multiple times per frame.
586 // This results in event waits to finish quicker during collisions as
587 // the wait will tick by 1 each time the interpreter is invoked.
588 if ((resume_async || GetTrigger() == lcf::rpg::EventPage::Trigger_parallel) && interpreter) {
589 if (!interpreter->IsRunning() && page && !page->event_commands.empty()) {
590 interpreter->Push(this);
591 }
592 interpreter->Update(!resume_async);
593
594 // Suspend due to async op ...
595 if (interpreter->IsAsyncPending()) {
596 return interpreter->GetAsyncOp();
597 }
598
599 // RPG_RT only exits if active is false here, but not if there is
600 // no active page...
601 if (!data()->active) {
602 return {};
603 }
604 }
605
606 Game_Character::Update();
607
608 return {};
609}
610
611const lcf::rpg::EventPage* Game_Event::GetPage(int page) const {
612 if (page <= 0 || page - 1 >= static_cast<int>(event->pages.size())) {

Callers

nothing calls this directly

Calls 6

IsRunningMethod · 0.80
UpdateFunction · 0.70
emptyMethod · 0.45
PushMethod · 0.45
IsAsyncPendingMethod · 0.45
GetAsyncOpMethod · 0.45

Tested by

no test coverage detected