handle all wait types in one action

This commit is contained in:
2024-09-04 20:37:48 -05:00
committed by Celtic Minstrel
parent 4e37a0c796
commit 6b7b42951d
3 changed files with 21 additions and 18 deletions

View File

@@ -993,11 +993,7 @@ void handle_alchemy(bool& need_redraw, bool& need_reprint) {
else add_string_to_buf("Alchemy: Only in town.");
}
void handle_town_wait(bool& need_redraw, bool& need_reprint) {
if(recording){
record_action("handle_town_wait", "");
}
static void handle_town_wait(bool& need_redraw, bool& need_reprint) {
std::vector<short> store_hp;
sf::Event dummy_evt;
need_reprint = true;
@@ -1040,6 +1036,22 @@ void handle_town_wait(bool& need_redraw, bool& need_reprint) {
put_pc_screen();
}
void handle_wait(bool& did_something, bool& need_redraw, bool& need_reprint) {
if(recording){
record_action("handle_wait", "");
}
if(overall_mode == MODE_TOWN) {
handle_town_wait(need_redraw, need_reprint);
} else if(overall_mode == MODE_COMBAT) {
handle_stand_ready(need_redraw, need_reprint);
advance_time(did_something, need_redraw, need_reprint);
} else if(overall_mode == MODE_OUTDOORS) {
add_string_to_buf("Wait: In town only.");
print_buf();
}
}
void handle_combat_switch(bool& did_something, bool& need_redraw, bool& need_reprint) {
if(recording){
record_action("handle_combat_switch", "");
@@ -2379,16 +2391,7 @@ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){
break;
case 'w': // Wait / delay
if(overall_mode == MODE_TOWN) {
handle_town_wait(need_redraw, need_reprint);
} else if(overall_mode == MODE_COMBAT) {
handle_stand_ready(need_redraw, need_reprint);
advance_time(did_something, need_redraw, need_reprint);
} else if(overall_mode == MODE_OUTDOORS) {
add_string_to_buf("Wait: In town only.");
print_buf();
return false;
}
handle_wait(did_something, need_redraw, need_reprint);
break;
case 'd': // Parry

View File

@@ -48,7 +48,7 @@ void handle_equip_item(short item_hit, bool& need_redraw);
void handle_use_item(short item_hit, bool& did_something, bool& need_redraw);
void handle_item_shop_action(short item_hit);
void handle_alchemy(bool& need_redraw, bool& need_reprint);
void handle_town_wait(bool& need_redraw, bool& need_reprint);
void handle_wait(bool& did_something, bool& need_redraw, bool& need_reprint);
void handle_combat_switch(bool& did_something, bool& need_redraw, bool& need_reprint);
void handle_missile(bool& need_redraw, bool& need_reprint);
void handle_get_items(bool& did_something, bool& need_redraw, bool& need_reprint);

View File

@@ -318,8 +318,8 @@ static void replay_next_action() {
handle_item_shop_action(item_hit);
}else if(t == "handle_alchemy"){
handle_alchemy(need_redraw, need_reprint);
}else if(t == "handle_town_wait"){
handle_town_wait(need_redraw, need_reprint);
}else if(t == "handle_wait"){
handle_wait(did_something, need_redraw, need_reprint);
}else if(t == "handle_combat_switch"){
handle_combat_switch(did_something, need_redraw, need_reprint);
}else if(t == "handle_missile"){