record and replay the burma shave easter egg

This commit is contained in:
2025-01-15 15:04:44 -06:00
parent 346ce7eb94
commit 4eb425cc91
3 changed files with 25 additions and 8 deletions

View File

@@ -2226,6 +2226,24 @@ void cancel_item_target(bool& did_something, bool& need_redraw, bool& need_repri
did_something = need_redraw = need_reprint = true; did_something = need_redraw = need_reprint = true;
} }
// I'm finally adding the easter egg to the replay system
// because it allows forcing the text buffer into a specific state
// which I'm debugging.
std::vector<std::string> easter_egg_messages = {
"If Valorim ...",
"You want to save ...",
"Back up your save files ...",
"Burma Shave."
};
void easter_egg(int idx) {
if(recording){
record_action("easter_egg", boost::lexical_cast<std::string>(idx));
}
add_string_to_buf(easter_egg_messages[idx]);
print_buf();
}
bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){
bool are_done = false; bool are_done = false;
location pass_point; // TODO: This isn't needed location pass_point; // TODO: This isn't needed
@@ -2381,20 +2399,16 @@ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){
switch(chr) { switch(chr) {
case '&': case '&':
add_string_to_buf("If Valorim ..."); easter_egg(0);
print_buf();
break; break;
case '*': case '*':
add_string_to_buf("You want to save ..."); easter_egg(1);
print_buf();
break; break;
case '(': case '(':
add_string_to_buf("Back up your save files ..."); easter_egg(2);
print_buf();
break; break;
case ')': case ')':
add_string_to_buf("Burma Shave."); easter_egg(3);
print_buf();
break; break;
case '?': case '?':

View File

@@ -102,5 +102,6 @@ void show_item_info(short item_hit);
void close_map(bool record = false); void close_map(bool record = false);
void cancel_item_target(bool& did_something, bool& need_redraw, bool& need_reprint); void cancel_item_target(bool& did_something, bool& need_redraw, bool& need_reprint);
void update_item_stats_area(bool& need_reprint); void update_item_stats_area(bool& need_reprint);
void easter_egg(int idx);
#endif #endif

View File

@@ -640,6 +640,8 @@ void replay_action(Element& action) {
return; return;
}else if(t == "cancel_item_target"){ }else if(t == "cancel_item_target"){
cancel_item_target(did_something, need_redraw, need_reprint); cancel_item_target(did_something, need_redraw, need_reprint);
}else if(t == "easter_egg"){
easter_egg(boost::lexical_cast<int>(action.GetText()));
}else if(t == "advance_time"){ }else if(t == "advance_time"){
// This is bad regardless of strictness, because visual changes may have occurred which won't get redrawn/reprinted // This is bad regardless of strictness, because visual changes may have occurred which won't get redrawn/reprinted
throw std::string { "Replay system internal error! advance_time() was supposed to be called by the last action, but wasn't: " } + _last_action_type; throw std::string { "Replay system internal error! advance_time() was supposed to be called by the last action, but wasn't: " } + _last_action_type;