// Update void Window_Selectable::Update() { Window_Base::Update(); if (active && item_max > 0 && index >= 0) { if (Input::IsRepeated(Input::DOWN)) { if ((column_max == 1 && Input::IsTriggered(Input::DOWN)) || index < item_max - column_max) { Game_System::SePlay(Data::system.cursor_se); index = (index + column_max) % item_max; } } if (Input::IsRepeated(Input::UP)) { if ((column_max == 1 && Input::IsTriggered(Input::UP)) || index >= column_max) { Game_System::SePlay(Data::system.cursor_se); index = (index - column_max + item_max) % item_max; } } if (Input::IsRepeated(Input::RIGHT)) { if (column_max >= 2 && index < item_max - 1) { Game_System::SePlay(Data::system.cursor_se); index += 1; } } if (Input::IsRepeated(Input::LEFT)) { if (column_max >= 2 && index > 0) { Game_System::SePlay(Data::system.cursor_se); index -= 1; } } } if (active && help_window != NULL) { UpdateHelp(); } UpdateCursorRect(); }
void Window_BattleOption::Update() { Window_Base::Update(); int num_commands = commands.size(); if (active && num_commands >= 0 && index >= 0) { if (Input::IsRepeated(Input::DOWN)) { Game_System::SePlay(Main_Data::game_data.system.cursor_se); index++; } if (Input::IsRepeated(Input::UP)) { Game_System::SePlay(Main_Data::game_data.system.cursor_se); index--; } index += num_commands; index %= num_commands; if (index < top_row) top_row = index; if (index > top_row + num_rows - 1) top_row = index - num_rows + 1; } UpdateCursorRect(); }
void Window_Selectable::SetIndex(int nindex) { index = min(nindex, item_max - 1); if (active && help_window != NULL) { UpdateHelp(); } UpdateCursorRect(); }
void Window_BattleOption::Update() { Window_Base::Update(); int num_commands = commands.size(); if (active && num_commands > 0 && index >= 0) { if (Input::IsRepeated(Input::DOWN) || Input::IsTriggered(Input::SCROLL_DOWN)) { Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Cursor)); index++; } if (Input::IsRepeated(Input::UP) || Input::IsTriggered(Input::SCROLL_UP)) { Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Cursor)); index--; } index += num_commands; index %= num_commands; if (index < top_row) top_row = index; if (index > top_row + num_rows - 1) top_row = index - num_rows + 1; } UpdateCursorRect(); }
void Window_BattleCommand::Update() { Window_Base::Update(); int num_commands = commands.size(); int old_index = index; if (active && num_commands > 0 && index >= 0) { if (Input::IsRepeated(Input::DOWN)) { Game_System::SePlay(Main_Data::game_data.system.cursor_se); index++; } if (Input::IsRepeated(Input::UP)) { Game_System::SePlay(Main_Data::game_data.system.cursor_se); index--; } index += num_commands; index %= num_commands; if (index < top_row) top_row = index; if (index > top_row + num_rows - 1) top_row = index - num_rows + 1; cycle++; if (cycle % 20 == 0 || old_index != index) Refresh(); } UpdateCursorRect(); }
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_BattleCommand::Update() { Window_Base::Update(); size_t num_commands = commands.size(); int old_index = index; if (active && num_commands > 0 && index >= 0) { if (Input::IsRepeated(Input::DOWN) || Input::IsTriggered(Input::SCROLL_DOWN)) { Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Cursor)); index++; } if (Input::IsRepeated(Input::UP) || Input::IsTriggered(Input::SCROLL_UP)) { Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Cursor)); index--; } index += num_commands; index %= num_commands; if (index < top_row) top_row = index; if (index > top_row + num_rows - 1) top_row = index - num_rows + 1; cycle++; if (cycle % 20 == 0 || old_index != index) Refresh(); } UpdateCursorRect(); }
void Window_NumberInput::SetMaxDigits(int idigits_max) { // Only accepts values between 1 and 6 (or 7) as RPG2K (or RPG2k3) int top = Player::IsRPG2k() ? 6 : 7; digits_max = (idigits_max > top) ? top : (idigits_max <= 0) ? 1 : idigits_max; ResetIndex(); UpdateCursorRect(); Refresh(); }
Window_SaveFile::Window_SaveFile(int ix, int iy, int iwidth, int iheight) : Window_Base(ix, iy, iwidth, iheight), index(0), hero_hp(0), hero_level(0), corrupted(false) { SetContents(Bitmap::Create(width - 8, height - 16)); contents->SetTransparentColor(windowskin->GetTransparentColor()); SetZ(9999); Refresh(); UpdateCursorRect(); }
void Window_NumberInput::SetNumber(int inumber) { int num = 1; for (int i = 0; i < digits_max; ++i) { num *= 10; } number = min(max(abs(inumber), 0), num - 1); index = 0; plus = inumber >= 0; UpdateCursorRect(); Refresh(); }
void Window_Keyboard::Update() { Window_Base::Update(); if (active) { if (Input::IsRepeated(Input::DOWN)) { play_cursor = true; row = (row + 1) % row_max; if(col > 0 && GetSelected().empty() && !items[mode][row][col - 1].empty()) { col--; } } if (Input::IsRepeated(Input::UP)) { play_cursor = true; row = (row + row_max - 1) % row_max; if(col > 0 && GetSelected().empty() && !items[mode][row][col - 1].empty()) { col--; } } if (Input::IsRepeated(Input::RIGHT)) { play_cursor = true; col += 1; if (col >= col_max) { col = 0; if(mode == Letter) { row = (row + 1) % row_max; } } } if (Input::IsRepeated(Input::LEFT)) { play_cursor = true; col -= 1; if (col < 0) { col = col_max - 1; if(mode == Letter) { row = (row + row_max - 1) % row_max; } } } } if(GetSelected().empty()) { Update(); return; } if(play_cursor) { Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Cursor)); play_cursor = false; } UpdateCursorRect(); }
Window_SaveFile::Window_SaveFile(int ix, int iy, int iwidth, int iheight) : Window_Base(ix, iy, iwidth, iheight) { index = 0; hero_hp = 0; hero_level = 0; SetContents(Surface::CreateSurface(width - 8, height - 16)); contents->SetTransparentColor(windowskin->GetTransparentColor()); SetZ(9999); Refresh(); UpdateCursorRect(); }
Window_NumberInput::Window_NumberInput(int ix, int iy, int iwidth, int iheight) : Window_Selectable(ix, iy, iwidth, iheight), digits_max(6) { number = 0; SetContents(Bitmap::Create(width - 16, height - 16)); contents->SetTransparentColor(windowskin->GetTransparentColor()); cursor_width = 14; SetZ(10001); opacity = 0; index = 0; active = false; Refresh(); UpdateCursorRect(); }
void Window_BattleStatus::ChooseActiveCharacter() { int num_actors = Game_Battle::allies.size(); int old_index = index < 0 ? 0 : index; index = -1; for (int i = 0; i < num_actors; i++) { int new_index = (old_index + i) % num_actors; if (Game_Battle::GetAlly(new_index).IsReady()) { index = new_index; break; } } if (index != old_index) UpdateCursorRect(); }
int Window_BattleStatus::ChooseActiveCharacter() { int old_index = index < 0 ? 0 : index; index = -1; for (int i = 0; i < item_max; i++) { int new_index = (old_index + i) % item_max; if ((*Main_Data::game_party)[new_index].IsGaugeFull()) { index = new_index; return index; } } if (index != old_index) UpdateCursorRect(); return index; }
Window_NumberInput::Window_NumberInput(int ix, int iy, int iwidth, int iheight) : Window_Selectable(ix, iy, iwidth, iheight), digits_max(Player::IsRPG2k() ? 6 : 7) { number = 0; plus = true; SetContents(Bitmap::Create(width - 16, height - 16)); cursor_width = 14; // Above the message window SetZ(Priority_Window + 150); opacity = 0; ResetIndex(); active = false; show_operator = false; Refresh(); UpdateCursorRect(); }
void Window_NumberInput::Update() { Window_Selectable::Update(); if (active) { if (Input::IsRepeated(Input::DOWN) || Input::IsRepeated(Input::UP)) { Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Cursor)); if (show_operator && index == 0) { plus = !plus; } else { int place = 1; for (int i = 0; i < (digits_max - 1 - (int)index + (int)show_operator); ++i) { place *= 10; } int n = number / place % 10; number -= n * place; if (Input::IsRepeated(Input::UP)) { n = (n + 1) % 10; } if (Input::IsRepeated(Input::DOWN)) { n = (n + 9) % 10; } number += n * place; } if (number == 0) { plus = true; } Refresh(); } if (Input::IsRepeated(Input::RIGHT)) { if (digits_max >= 2) { Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Cursor)); index = (index + 1) % (digits_max + (int)show_operator); } } if (Input::IsRepeated(Input::LEFT)) { Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Cursor)); index = (index + digits_max - 1 + (int)show_operator) % (digits_max + (int)show_operator); } UpdateCursorRect(); } }
Window_Keyboard::Window_Keyboard(int ix, int iy, int iwidth, int iheight) : Window_Base(ix, iy, iwidth, iheight) , play_cursor(false) { row = 0; col = 0; SetContents(Bitmap::Create(width - 16, height - 16)); contents->SetTransparentColor(windowskin->GetTransparentColor()); SetZ(9999); row_spacing = 16; col_spacing = (contents->GetWidth() - 2 * border_x) / col_max; mode = Letter; Refresh(); UpdateCursorRect(); }
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(); }
void Window_Shop::Update() { Window_Base::Update(); if (active) { switch (mode) { case Scene_Shop::BuySellLeave: case Scene_Shop::BuySellLeave2: if (Input::IsRepeated(Input::DOWN)) { if (index < leave_index) { index++; } else { index = 1; } Game_System::SePlay(Data::system.cursor_se); } if (Input::IsRepeated(Input::UP)) { if (index > 1) { index--; } else { index = leave_index; } Game_System::SePlay(Data::system.cursor_se); } if (Input::IsTriggered(Input::DECISION)) { Game_System::SePlay(Data::system.decision_se); if (index == buy_index) choice = Scene_Shop::Buy; if (index == sell_index) choice = Scene_Shop::Sell; if (index == leave_index) choice = Scene_Shop::Leave; } break; } } UpdateCursorRect(); }
void Window_NumberInput::Update() { Window_Selectable::Update(); if (active) { if (Input::IsRepeated(Input::DOWN) || Input::IsRepeated(Input::UP)) { Game_System::SePlay(Data::system.cursor_se); int place = 1; for (int i = 0; i < (digits_max - 1 - (int)index); ++i) { place *= 10; } int n = number / place % 10; number -= n * place; if (Input::IsRepeated(Input::UP)) { n = (n + 1) % 10; } if (Input::IsRepeated(Input::DOWN)) { n = (n + 9) % 10; } number += n * place; Refresh(); } if (Input::IsRepeated(Input::RIGHT)) { if (digits_max >= 2) { Game_System::SePlay(Data::system.cursor_se); index = (index + 1) % digits_max; } } if (Input::IsRepeated(Input::LEFT)) { Game_System::SePlay(Data::system.cursor_se); index = (index + digits_max - 1) % digits_max; } UpdateCursorRect(); } }
void Window_Keyboard::SetMode(Window_Keyboard::Mode nmode) { mode = nmode; Refresh(); UpdateCursorRect(); }
void Window_SaveFile::Update() { Window_Base::Update(); UpdateCursorRect(); }