Exemplo n.º 1
0
void Window_BattleStatus::Update() {
	Window_Base::Update();

	int num_actors = Game_Battle::allies.size();
	for (int i = 0; i < num_actors; i++)
		RefreshGauge(i);

	if (active && index >= 0) {
		if (Input::IsRepeated(Input::DOWN)) {
			Game_System::SePlay(Data::system.cursor_se);
			for (int i = 1; i < num_actors; i++) {
				int new_index = (index + i) % num_actors;
				if (Game_Battle::GetAlly(new_index).IsReady()) {
					index = new_index;
					break;
				}
			}
		}
		if (Input::IsRepeated(Input::UP)) {
			Game_System::SePlay(Data::system.cursor_se);
			for (int i = num_actors - 1; i > 0; i--) {
				int new_index = (index + i) % num_actors;
				if (Game_Battle::GetAlly(new_index).IsReady()) {
					index = new_index;
					break;
				}
			}
		}
	}

	ChooseActiveCharacter();

	UpdateCursorRect();
}
void Window_BattleStatus::Refresh() {
	contents->Clear();

	if (enemy) {
		item_max = Main_Data::game_enemyparty->GetBattlerCount();
	}
	else {
		item_max = Main_Data::game_party->GetBattlerCount();
	}

	item_max = std::min(item_max, 4);

	for (int i = 0; i < item_max; i++) {
		Game_Battler* actor;
		if (enemy) {
			actor = &(*Main_Data::game_enemyparty)[i];
		}
		else {
			actor = &(*Main_Data::game_party)[i];
		}

		if (!enemy && Data::battlecommands.battle_type == RPG::BattleCommands::BattleType_gauge) {
			FileRequestAsync* request = AsyncHandler::RequestFile("System2", Data::system.system2_name);
			if (!request->IsReady()) {
				request_id = request->Bind(&Window_BattleStatus::OnSystem2Ready, this);
				request->Start();
				break;
			}
			else {
				DrawActorFace(static_cast<Game_Actor*>(actor), 80 * i, 24);
			}
		}
		else {
			int y = 2 + i * 16;

			DrawActorName(actor, 4, y);
			DrawActorState(actor, 84, y);
			DrawActorHp(actor, 126, y, true);
			DrawActorSp(actor, 198, y, false);
		}
	}

	RefreshGauge();
}
void Window_BattleStatus::Update() {
	// Window Selectable update logic skipped on purpose
	// (breaks up/down-logic)
	Window_Base::Update();

	int old_item_max = item_max;
	if (enemy) {
		item_max = Main_Data::game_enemyparty->GetBattlerCount();
	} else {
		item_max = Main_Data::game_party->GetBattlerCount();
	}

	if (item_max != old_item_max) {
		Refresh();
	} else if (Player::IsRPG2k3()) {
		RefreshGauge();
	}

	if (active && index >= 0) {
		if (Input::IsRepeated(Input::DOWN)) {
			Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Cursor));
			for (int i = 1; i < item_max; i++) {
				int new_index = (index + i) % item_max;
				if (IsChoiceValid((*Main_Data::game_party)[new_index])) {
					index = new_index;
					break;
				}
			}
		}
		if (Input::IsRepeated(Input::UP)) {
			Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Cursor));
			for (int i = item_max - 1; i > 0; i--) {
				int new_index = (index + i) % item_max;
				if (IsChoiceValid((*Main_Data::game_party)[new_index])) {
					index = new_index;
					break;
				}
			}
		}
	}

	UpdateCursorRect();
}