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

Method vUpdate

src/scene_file.cpp:178–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178void Scene_File::vUpdate() {
179 UpdateArrows();
180
181 if (IsWindowMoving()) {
182 for (auto& fw: file_windows) {
183 fw->Update();
184 }
185 return;
186 }
187
188 if (HandleExtraCommandsWindow()) {
189 return;
190 }
191
192 if (Input::IsTriggered(Input::CANCEL)) {
193 Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Cancel));
194 Scene::Pop();
195 } else if (Input::IsTriggered(Input::DECISION)) {
196 if (IsSlotValid(index)) {
197 Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Decision));
198 Action(index);
199 }
200 else {
201 Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Buzzer));
202 }
203 } else if (Input::IsTriggered(Input::SHIFT)) {
204#ifdef EMSCRIPTEN
205 extra_commands_window->SetX(SCREEN_TARGET_WIDTH - extra_commands_window->GetWidth() - 8);
206 extra_commands_window->SetY(file_windows[index]->GetY() + 8);
207 extra_commands_window->SetItemEnabled(0, file_windows[index]->IsValid() && file_windows[index]->HasParty());
208 extra_commands_window->SetVisible(true);
209 return;
210#endif
211 }
212
213 int old_top_index = top_index;
214 int old_index = index;
215 int max_index = static_cast<int>(file_windows.size()) - 1;
216
217 if (Input::IsRepeated(Input::DOWN) || Input::IsTriggered(Input::SCROLL_DOWN)) {
218 if (Input::IsTriggered(Input::DOWN) || Input::IsTriggered(Input::SCROLL_DOWN)
219 || index < max_index) {
220 Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Cursor));
221 index = (index + 1) % file_windows.size();
222 }
223
224 //top_index = std::max(top_index, index - 3 + 1);
225 }
226 if (Input::IsRepeated(Input::UP) || Input::IsTriggered(Input::SCROLL_UP)) {
227 if (Input::IsTriggered(Input::UP) || Input::IsTriggered(Input::SCROLL_UP)
228 || index >= 1) {
229 Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Cursor));
230 index = (index + max_index) % file_windows.size();
231 }
232
233 //top_index = std::min(top_index, index);
234 }
235

Callers

nothing calls this directly

Calls 13

maxFunction · 0.85
minFunction · 0.85
SePlayMethod · 0.80
SetItemEnabledMethod · 0.80
HasPartyMethod · 0.80
UpdateMethod · 0.45
SetXMethod · 0.45
GetWidthMethod · 0.45
SetYMethod · 0.45
GetYMethod · 0.45
IsValidMethod · 0.45
SetVisibleMethod · 0.45

Tested by

no test coverage detected