mirror of
https://github.com/GearsProgress/Poke_Transporter_GB.git
synced 2026-05-09 04:23:24 -05:00
Merge 92758f44ec into 2258752f16
This commit is contained in:
commit
de6bcd80e4
|
|
@ -23,7 +23,7 @@ int ptgb_write_textbox(const byte *text, bool instant, bool waitForUser, int tex
|
|||
int ptgb_write_simple(const byte *text, bool instant);
|
||||
int ptgb_write(const byte *text, bool instant, int length, int box_type);
|
||||
int ptgb_write_debug(const u16* charset, const char *text, bool instant);
|
||||
void wait_for_user_to_continue();
|
||||
void wait_for_user_to_continue(int right, int bottom);
|
||||
void scroll_text(bool instant, TTC *tc, int left, int top, int right, int bottom);
|
||||
|
||||
#endif
|
||||
|
|
@ -235,7 +235,7 @@ private:
|
|||
vertical_menu_settings settings_;
|
||||
i_vertical_menu_state_changed_handler *state_changed_handler_;
|
||||
i_run_cycle_handler *run_cycle_handler_;
|
||||
unsigned focused_index_;
|
||||
int focused_index_;
|
||||
unsigned viewport_start_index_;
|
||||
ptgb::vector<i_item_widget*> items_;
|
||||
bool is_focused_;
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ void dbg_inject_pkmn(void *context, unsigned user_param)
|
|||
npf_snprintf(text_buffer, sizeof(text_buffer), "%s received a Celebi!\n Celebi was sent to box %d!", decoded_OT_utf8, boxIndex);
|
||||
ptgb_write_debug(tables.gen3_charset, text_buffer, false);
|
||||
|
||||
wait_for_user_to_continue();
|
||||
wait_for_user_to_continue(H_MAX, V_MAX);
|
||||
|
||||
if(!g_debug_options.ignore_game_pak && !g_debug_options.ignore_game_pak_sprites)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -250,7 +250,12 @@ int main_menu_loop()
|
|||
}
|
||||
else if (key_hit(KEY_UP))
|
||||
{
|
||||
curr_selection = ((curr_selection + (NUM_MENU_OPTIONS - 1)) % NUM_MENU_OPTIONS);
|
||||
if (curr_selection == 0) {
|
||||
curr_selection = NUM_MENU_OPTIONS - 1;
|
||||
}
|
||||
else {
|
||||
curr_selection = ((curr_selection + (NUM_MENU_OPTIONS - 1)) % NUM_MENU_OPTIONS);
|
||||
}
|
||||
}
|
||||
else if (key_hit(KEY_A))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -173,6 +173,35 @@ int pokedex_loop()
|
|||
delay++;
|
||||
}
|
||||
}
|
||||
else if (key_hit(KEY_LEFT) || key_hit(KEY_RIGHT))
|
||||
{
|
||||
dex_shift += key_tri_horz() * 7;
|
||||
update = true;
|
||||
}
|
||||
else if (key_held(KEY_LEFT) || key_held(KEY_RIGHT))
|
||||
{
|
||||
if (delay > SPEED_DELAY)
|
||||
{
|
||||
if ((get_frame_count() % speed == 0))
|
||||
{
|
||||
if (count > 3 && speed >= 5)
|
||||
{
|
||||
speed = speed / 2;
|
||||
count = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
count++;
|
||||
}
|
||||
dex_shift += key_tri_horz() * 7;
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delay++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
speed = 20;
|
||||
|
|
|
|||
|
|
@ -183,7 +183,12 @@ int text_loop(int script)
|
|||
}
|
||||
else if (key_hit(KEY_UP))
|
||||
{
|
||||
text_section = (text_section + 1) % NUM_TEXT_SECTIONS;
|
||||
if (text_section == 0) {
|
||||
text_section = NUM_TEXT_SECTIONS - 1;
|
||||
}
|
||||
else {
|
||||
text_section = ((text_section + (NUM_TEXT_SECTIONS - 1)) % NUM_TEXT_SECTIONS);
|
||||
}
|
||||
update_text = true;
|
||||
}
|
||||
else if (key_hit(KEY_DOWN))
|
||||
|
|
@ -281,7 +286,10 @@ int ptgb_write_textbox(const byte *text, bool instant, bool waitForUser,
|
|||
int out = ptgb_write(text, instant, 9999, text_box_type_tables[text_section][text_key]); // This is kinda silly but it'll work.
|
||||
if (waitForUser)
|
||||
{
|
||||
wait_for_user_to_continue();
|
||||
|
||||
int right = H_MAX - 5;
|
||||
int bottom = V_MAX - 5;
|
||||
wait_for_user_to_continue(right, bottom);
|
||||
}
|
||||
if (eraseMainBox)
|
||||
{
|
||||
|
|
@ -301,12 +309,12 @@ int ptgb_write_simple(const byte *text, bool instant)
|
|||
// Re-implementing TTE's "tte_write" to use the gen 3 character encoding chart
|
||||
int ptgb_write(const byte *text, bool instant, int length, int box_type)
|
||||
{
|
||||
int left, top, right, bottom;
|
||||
|
||||
instant = instant || g_debug_options.instant_text_speed;
|
||||
if (text == NULL)
|
||||
return 0;
|
||||
|
||||
int left, top, right, bottom;
|
||||
|
||||
if (box_type == -1)
|
||||
{
|
||||
left = 0;
|
||||
|
|
@ -340,7 +348,7 @@ int ptgb_write(const byte *text, bool instant, int length, int box_type)
|
|||
{
|
||||
tc->drawgProc(0x79);
|
||||
}
|
||||
wait_for_user_to_continue();
|
||||
wait_for_user_to_continue(right, bottom);
|
||||
scroll_text(instant, tc, left, top, right, bottom);
|
||||
break;
|
||||
case 0xFB:
|
||||
|
|
@ -348,7 +356,7 @@ int ptgb_write(const byte *text, bool instant, int length, int box_type)
|
|||
{
|
||||
tc->drawgProc(0xB9);
|
||||
}
|
||||
wait_for_user_to_continue();
|
||||
wait_for_user_to_continue(right, bottom);
|
||||
tte_erase_rect(left, top, right, bottom);
|
||||
tte_set_pos(left, top);
|
||||
break;
|
||||
|
|
@ -437,7 +445,7 @@ int ptgb_write_debug(const u16 *charset, const char *text, bool instant)
|
|||
return ptgb_write_simple(temp_holding, instant);
|
||||
}
|
||||
|
||||
void wait_for_user_to_continue()
|
||||
void wait_for_user_to_continue(int right, int bottom)
|
||||
{
|
||||
if (get_curr_flex_background() == FLEXBG_FENNEL)
|
||||
{
|
||||
|
|
@ -451,11 +459,29 @@ void wait_for_user_to_continue()
|
|||
fennel_speak(0);
|
||||
}
|
||||
}
|
||||
|
||||
//obj_set_pos(scroll_indicator_red, right-16, bottom-11);
|
||||
//obj_set_pos(scroll_indicator_gray, right-16, bottom-10);
|
||||
//obj_unhide(scroll_indicator_red, 0);
|
||||
|
||||
key_poll();
|
||||
while (!(key_hit(KEY_A) || key_hit(KEY_B)))
|
||||
{
|
||||
/*
|
||||
int frameCount = get_frame_count();
|
||||
if (frameCount % 60 == 0) {
|
||||
obj_unhide(scroll_indicator_red, 0);
|
||||
obj_hide(scroll_indicator_gray);
|
||||
}
|
||||
else if (frameCount % 30 == 0) {
|
||||
obj_hide(scroll_indicator_red);
|
||||
obj_unhide(scroll_indicator_gray, 0);
|
||||
}
|
||||
*/
|
||||
global_next_frame();
|
||||
}
|
||||
//obj_hide(scroll_indicator_red);
|
||||
//obj_hide(scroll_indicator_gray);
|
||||
}
|
||||
|
||||
void scroll_text(bool instant, TTC *tc, int left, int top, int right, int bottom)
|
||||
|
|
|
|||
|
|
@ -175,23 +175,34 @@ MenuInputHandleState vertical_menu::handle_input()
|
|||
return MenuInputHandleState::CANCELLED;
|
||||
}
|
||||
|
||||
if(key_hit(KEY_DOWN) && focused_index_ < (items_.size() - 1u))
|
||||
if(key_hit(KEY_DOWN))
|
||||
{
|
||||
const unsigned current_viewport_end_index = get_viewport_end_index(viewport_start_index_, get_num_visible_items(settings_.height, settings_.margin_top, settings_.margin_bottom, settings_.item_height), items_.size());
|
||||
const unsigned num_visible_items = get_num_visible_items(settings_.height, settings_.margin_top, settings_.margin_bottom, settings_.item_height);
|
||||
const unsigned current_viewport_end_index = get_viewport_end_index(viewport_start_index_, num_visible_items, items_.size());
|
||||
++focused_index_;
|
||||
if(focused_index_ >= current_viewport_end_index)
|
||||
if(focused_index_ == current_viewport_end_index)
|
||||
{
|
||||
++viewport_start_index_;
|
||||
viewport_changed = true;
|
||||
}
|
||||
if (focused_index_ > items_.size() - 1) {
|
||||
viewport_start_index_ = 0;
|
||||
focused_index_ = 0;
|
||||
viewport_changed = true;
|
||||
}
|
||||
did_navigate = true;
|
||||
}
|
||||
else if(key_hit(KEY_UP) && focused_index_ > 0)
|
||||
else if(key_hit(KEY_UP))
|
||||
{
|
||||
--focused_index_;
|
||||
if(focused_index_ < viewport_start_index_)
|
||||
if(focused_index_ < 0)
|
||||
{
|
||||
--viewport_start_index_;
|
||||
const unsigned num_visible_items = get_num_visible_items(settings_.height, settings_.margin_top, settings_.margin_bottom, settings_.item_height);
|
||||
const unsigned current_viewport_end_index = get_viewport_end_index(viewport_start_index_, num_visible_items, items_.size());
|
||||
const unsigned max_index = items_.size() - 1;
|
||||
|
||||
viewport_start_index_ = (max_index - num_visible_items) + 1;
|
||||
focused_index_ = max_index;
|
||||
viewport_changed = true;
|
||||
}
|
||||
did_navigate = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user