Beispiel #1
0
void Scene_Map::Update() {
	if (Game_Temp::transition_processing) {
		Game_Temp::transition_processing = false;

		Graphics::Transition(Game_Temp::transition_type, 32, Game_Temp::transition_erase);
	}

	if (auto_transition) {
		auto_transition = false;

		if (!auto_transition_erase) {
			// Fade Out not handled here but in StartTeleportPlayer because otherwise
			// emscripten hangs before fading out when doing async loading...
			Graphics::Transition((Graphics::TransitionType)Game_System::GetTransition(Game_System::Transition_TeleportShow), 32, false);
			return;
		}
	}

	// Async loading note:
	// Fade In must be done before finish teleport, otherwise chipset is not
	// loaded and renders black while fading -> ugly

	if (Main_Data::game_player->IsTeleporting()) {
		FinishTeleportPlayer();
		return;
	}

	Main_Data::game_party->UpdateTimers();

	Game_Map::Update();
	Main_Data::game_screen->Update();
	spriteset->Update();
	message_window->Update();

	StartTeleportPlayer();

	if (Game_Temp::gameover) {
		Game_Temp::gameover = false;
		Scene::Push(std::make_shared<Scene_Gameover>());
	}

	if (Game_Temp::to_title) {
		Game_Temp::to_title = false;
		Scene::PopUntil(Scene::Title);
	}

	if (Game_Message::visible)
		return;

	// ESC-Menu calling
	if (Input::IsTriggered(Input::CANCEL)) {
		// Prevent calling when disabled or the main interpreter is running
		if (Game_System::GetAllowMenu() && !Game_Map::GetInterpreter().IsRunning()) {
			Game_Temp::menu_calling = true;
		}
	}

	if (Player::debug_flag) {
		if (Input::IsTriggered(Input::DEBUG_MENU)) {
			CallDebug();
		}
		else if (Input::IsTriggered(Input::DEBUG_SAVE)) {
			CallSave();
		}
	}

	if (!Main_Data::game_player->IsMoving()) {
		if (Game_Temp::menu_calling) {
			CallMenu();
			return;
		}

		if (Game_Temp::name_calling) {
			CallName();
			return;
		}

		if (Game_Temp::shop_calling) {
			CallShop();
			return;
		}

		if (Game_Temp::save_calling) {
			CallSave();
			return;
		}

		if (Game_Temp::load_calling) {
			CallLoad();
			return;
		}

		if (Game_Temp::battle_calling) {
			CallBattle();
			return;
		}
	}
}
void Scene_Map::Update() {
	if (Game_Temp::transition_processing) {
		Game_Temp::transition_processing = false;

		Graphics::Transition(Game_Temp::transition_type, 32, Game_Temp::transition_erase);
	}

	if (auto_transition) {
		auto_transition = false;

		if (!auto_transition_erase) {
			// Fade Out not handled here but in StartTeleportPlayer because otherwise
			// emscripten hangs before fading out when doing async loading...
			Graphics::Transition((Graphics::TransitionType)Game_System::GetTransition(Game_System::Transition_TeleportShow), 32, false);
			return;
		}
	}

	// Async loading note:
	// Fade In must be done before finish teleport, otherwise chipset is not
	// loaded and renders black while fading -> ugly

	if (!Game_Map::IsTeleportDelayed() && Main_Data::game_player->IsTeleporting()) {
		FinishTeleportPlayer();
		return;
	}
	// The delay is only needed for one frame to execute pending transitions,
	// the interpreters continue on the old map afterwards
	Game_Map::SetTeleportDelayed(false);

	Main_Data::game_party->UpdateTimers();

	Game_Map::Update();
	Main_Data::game_screen->Update();
	spriteset->Update();
	message_window->Update();

	StartTeleportPlayer();

	if (Game_Temp::gameover) {
		Game_Temp::gameover = false;
		Scene::Push(std::make_shared<Scene_Gameover>());
	}

	if (Game_Temp::to_title) {
		Game_Temp::to_title = false;
		Scene::PopUntil(Scene::Title);
	}

	if (Game_Message::visible)
		return;

	if (Player::debug_flag) {
		// ESC-Menu calling can be force called when TestPlay mode is on and cancel is pressed 5 times while holding SHIFT
		if (Input::IsPressed(Input::SHIFT)) {
			if (Input::IsTriggered(Input::CANCEL)) {
				debug_menuoverwrite_counter++;
				if (debug_menuoverwrite_counter >= 5) {
					Game_Temp::menu_calling = true;
					debug_menuoverwrite_counter = 0;
				}
			}
		} else {
			debug_menuoverwrite_counter = 0;
		}

		if (Input::IsTriggered(Input::DEBUG_MENU)) {
			CallDebug();
		}
		else if (Input::IsTriggered(Input::DEBUG_SAVE)) {
			CallSave();
		}
	}

	if (!Main_Data::game_player->IsMoving()) {
		if (Game_Temp::menu_calling) {
			CallMenu();
			return;
		}

		if (Game_Temp::name_calling) {
			CallName();
			return;
		}

		if (Game_Temp::shop_calling) {
			CallShop();
			return;
		}

		if (Game_Temp::save_calling) {
			CallSave();
			return;
		}

		if (Game_Temp::load_calling) {
			CallLoad();
			return;
		}

		if (Game_Temp::battle_calling) {
			CallBattle();
			return;
		}
	}
}
Beispiel #3
0
void Scene_Map::Update() {
	if (Main_Data::game_player->IsTeleporting()) {
		FinishTeleportPlayer();
	}

	Game_Map::GetInterpreter().Update();

	Main_Data::game_party->UpdateTimers();

	Game_Map::Update();
	Main_Data::game_player->Update();
	Main_Data::game_screen->Update();
	spriteset->Update();
	message_window->Update();

	StartTeleportPlayer();

	if (Game_Temp::gameover) {
		Game_Temp::gameover = false;
		Scene::Push(EASYRPG_MAKE_SHARED<Scene_Gameover>());
	}

	if (Game_Temp::to_title) {
		Game_Temp::to_title = false;
		Scene::PopUntil(Scene::Title);
	}

	if (Game_Message::visible)
		return;

	// ESC-Menu calling
	if (Input::IsTriggered(Input::CANCEL)) {
		Game_Temp::menu_calling = true;
		Game_Temp::menu_beep = true;
	}

	if (Player::debug_flag) {
		if (Input::IsTriggered(Input::DEBUG_MENU)) {
			CallDebug();
		}
		else if (Input::IsTriggered(Input::DEBUG_SAVE)) {
			CallSave();
		}
	}

	if (!Main_Data::game_player->IsMoving()) {
		if (Game_Temp::menu_calling) {
			CallMenu();
			return;
		}

		if (Game_Temp::name_calling) {
			CallName();
			return;
		}

		if (Game_Temp::shop_calling) {
			CallShop();
			return;
		}

		if (Game_Temp::save_calling) {
			CallSave();
			return;
		}

		if (Game_Temp::battle_calling) {
			CallBattle();
			return;
		}

		if (Game_Temp::transition_processing) {
			Game_Temp::transition_processing = false;

			Graphics::Transition(Game_Temp::transition_type, 32, Game_Temp::transition_erase);
		}
	}
}