From 09c25824ce1b973e477c4f31fe149a1de8941be8 Mon Sep 17 00:00:00 2001 From: AliceLR Date: Sat, 2 Dec 2023 02:28:22 -0700 Subject: [PATCH] Add v1 effect durations tests, fix title board edge case. --- src/utils/downver.c | 8 +++++ src/world.c | 41 +++++++++++++++++-------- testworlds/1.00/006 firewalker_dur.mzx | Bin 0 -> 4918 bytes testworlds/1.00/006 firewalker_dur.txt | 3 ++ testworlds/1.00/007 wind_dur.mzx | Bin 0 -> 4969 bytes testworlds/1.00/007 wind_dur.txt | 3 ++ 6 files changed, 42 insertions(+), 13 deletions(-) create mode 100644 testworlds/1.00/006 firewalker_dur.mzx create mode 100644 testworlds/1.00/006 firewalker_dur.txt create mode 100644 testworlds/1.00/007 wind_dur.mzx create mode 100644 testworlds/1.00/007 wind_dur.txt diff --git a/src/utils/downver.c b/src/utils/downver.c index a213556f3..dad2ccbf0 100644 --- a/src/utils/downver.c +++ b/src/utils/downver.c @@ -270,6 +270,14 @@ static void convert_293_to_292_board_info(struct downver_state *dv, save_prop_s_to_asciiz(ident, BOARD_NAME_SIZE, &prop, dest); break; + case BPROP_BLIND_DUR: + case BPROP_FIREWALKER_DUR: + case BPROP_FREEZE_TIME_DUR: + case BPROP_SLOW_TIME_DUR: + case BPROP_WIND_DUR: + /* Added in 2.93 */ + break; + default: save_prop_p(ident, &prop, dest); break; diff --git a/src/world.c b/src/world.c index 410095850..75d56fcb8 100644 --- a/src/world.c +++ b/src/world.c @@ -2508,7 +2508,8 @@ static int load_world_zip(struct world *mzx_world, struct zip_archive *zp, // Hack- forward declaration since this should stay near change_board. -static void synchronize_current_board(struct world *mzx_world); +static void v1_store_globals_to_board(struct world *mzx_world); +static void v1_load_globals_from_board(struct world *mzx_world); int save_world(struct world *mzx_world, const char *file, boolean savegame, int world_version) @@ -2577,7 +2578,7 @@ int save_world(struct world *mzx_world, const char *file, boolean savegame, } // Synchronize global variables in the current board. - synchronize_current_board(mzx_world); + v1_store_globals_to_board(mzx_world); #ifdef CONFIG_EDITOR if(world_version == MZX_VERSION_PREV) @@ -2928,6 +2929,8 @@ static void load_world(struct world *mzx_world, struct zip_archive *zp, mzx_world->current_board = NULL; set_current_board_ext(mzx_world, mzx_world->board_list[mzx_world->current_board_id]); + // change_board expects this to have been done, if applicable. + v1_load_globals_from_board(mzx_world); } // If this is a pre-port world, limit the number of samples @@ -3169,7 +3172,7 @@ void try_load_world(struct world *mzx_world, struct zip_archive **zp, } -static void synchronize_current_board(struct world *mzx_world) +static void v1_store_globals_to_board(struct world *mzx_world) { struct board *cur_board = mzx_world->current_board; @@ -3185,12 +3188,28 @@ static void synchronize_current_board(struct world *mzx_world) } } +static void v1_load_globals_from_board(struct world *mzx_world) +{ + struct board *cur_board = mzx_world->current_board; + + // MegaZeux 1.x- status durations were board local, restore the saved copies. + if(mzx_world->version < V200 && cur_board) + { + mzx_world->blind_dur = cur_board->blind_dur_v1; + mzx_world->firewalker_dur = cur_board->firewalker_dur_v1; + mzx_world->freeze_time_dur = cur_board->freeze_time_dur_v1; + mzx_world->slow_time_dur = cur_board->slow_time_dur_v1; + mzx_world->wind_dur = cur_board->wind_dur_v1; + } +} + void change_board(struct world *mzx_world, int board_id) { // Set the current board during gameplay. struct board *cur_board = mzx_world->current_board; - synchronize_current_board(mzx_world); + // Save globals back to the current board. + v1_store_globals_to_board(mzx_world); // Is this board temporary? Clear it if(mzx_world->temporary_board) @@ -3219,15 +3238,8 @@ void change_board(struct world *mzx_world, int board_id) cur_board = dup_board; } - // MegaZeux 1.x- status durations were board local, restore the saved copies. - if(mzx_world->version < V200) - { - mzx_world->blind_dur = cur_board->blind_dur_v1; - mzx_world->firewalker_dur = cur_board->firewalker_dur_v1; - mzx_world->freeze_time_dur = cur_board->freeze_time_dur_v1; - mzx_world->slow_time_dur = cur_board->slow_time_dur_v1; - mzx_world->wind_dur = cur_board->wind_dur_v1; - } + // Load globals from the current board. + v1_load_globals_from_board(mzx_world); } void change_board_set_values(struct world *mzx_world) @@ -3423,6 +3435,9 @@ boolean reload_world(struct world *mzx_world, const char *file, boolean *faded) default_global_data(mzx_world); *faded = false; + // Hack: 1.x seems to not clear some things... + v1_load_globals_from_board(mzx_world); + // Now that the world's loaded, fix the save path. { char save_name[MAX_PATH]; diff --git a/testworlds/1.00/006 firewalker_dur.mzx b/testworlds/1.00/006 firewalker_dur.mzx new file mode 100644 index 0000000000000000000000000000000000000000..94080325445e45733630685b58f67ae778114911 GIT binary patch literal 4918 zcmcH-TWlLy^*T<*Njr(XXj{#0z0Fkckw$IfZ5P*chqy&eP?xq;ZML8i5~q%bq#5ie zal96c#)*XXYsD9Q><@n{B(z9vf{^HL7n6ojVckglL}49O)*=!fRT~K@b&)mZoOAEk zlWz9|363)}_dM=--h1v$1}A4yZ;csKsTuX`+{{>ZGLu$^QnOjcE?oOIdj_n9_ugAr zxbyCUg$%1+F4yaKx9Ws3W5;nEGZx}=LOsJxMA5XZtt~~-h^J^)y>7V}l7O$^vyQNJ z7gQo3g|V1n7%_MX&f~2oTTh4=J|4+`SgYkpO4D^+Qw}O&1?|UA#3PZ&^mc`Kg=8U_ zOnz@`vq-2?*0!`V*<)ismxS$43Di(K*fdK$`5U)@!mw$Kw z05S8E^l@;-jD>HT#Kl{^%maXExfaS2$ACa`@C0xzKptdA7LEa5i4-DDj1`MThi2ie z$8d}u7Yl`Av6yL^kpDuV(BI!54u{*@U9RT|dDg%*w+_*K$-^^1BV9mK6w_WVn$p|0 zDLh@aWhJ89Bo7sd(10Ntz@HNja<;B}bMIlB5H>Obhv6P zSZL+)44)Q?8Mf_!Q9^4_K@+YTVVb@SQ7r3xk5vs|=(cX>QZY*<9_^-X70>QOlKXRNkRK;~}?l=!tT?|72 zpgqkP#Q-z8FPKkz?SUzG;Y8v=9NYr%5;57Wie+8%c!tvu_$r_wtkDp+4(QsNV;TZ8 zV6T7+gkg#>MjoGIzXL^B7VAZ$g&c`+9!pS_B$~!F%7iQno*Ky;Tp?%UU2OhHBGIJb zC@-60=dem5k;gJ|uYqUU#iEE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2J literal 0 HcmV?d00001 diff --git a/testworlds/1.00/006 firewalker_dur.txt b/testworlds/1.00/006 firewalker_dur.txt new file mode 100644 index 000000000..ab7c8ae45 --- /dev/null +++ b/testworlds/1.00/006 firewalker_dur.txt @@ -0,0 +1,3 @@ +Title: Firewalker Duration Test +Author: Alice Rowan +Desc: Make sure the board firewalker duration value is loaded. diff --git a/testworlds/1.00/007 wind_dur.mzx b/testworlds/1.00/007 wind_dur.mzx new file mode 100644 index 0000000000000000000000000000000000000000..386063e919ddffa2185de0e86c318f3d71b76db2 GIT binary patch literal 4969 zcmb_gUrbxq89&Bw4ap6-Qxn}3H{3OQASekgG>%8Fa5535R7n~oG?_96CdPOCxw8=% z*W0eHVVe3>?P+`HOW&$V)g~n{OL5*;7>ikiIt}(GN{}WIXR@yMJAbZi zvi4!?K4YKro$ou}|MQ)DxjLR0Rr_YAM^fX-ggOwPNfGs0d^SVK`D@R9W0}I% z9f+hrR|p9kh7ranD37I}!{Ar?xjJiDYBh zSSk1A#zeqf4zB5oZmmxpsK-r5c(6iR_CtMKSHAoGHC! zo5Ip1TULU)&G?a#aC$wTPg4wWjw@!k<=qbKx+A9xsHf@{7T?uD+L>bYv8K=!90h2UI5}a~CGxClsA7Y#iVq2=v z!ckzhE7M_8;FFMv^$Ly7EJ>0x+!$t|YbKAfB7A3-ARH3s#NlCo42#lr>J!5tQ-%yz zjD}JKXuGLsZw^86#z^15CKi3X)b=5Hq zff+a}Fo9t-MAS#_pJTs`BrJ(~(O4k|gPca9EK3sGMl==)Sr#-km@&9OPNu)&@CT#O z>KdJ8WK*0RvJs7DXqvdypqX|qCwvG%xRG}`8O?ENVPiB(gsC6sdb1HosZd4i8U}vGb`3`Tg15{ z>uJ40q5e$;gn#~Eu!I1I0uaCeF4TBSwTZq9DoY^GAH|TtYPe~#ElK8ePMkct6tD7T zcr%4BEhToI*qOotaJEkAnA0OC`rCm$TVOq^+&R=kt0!p0eYV zO2y*##zrnTH%GqH-QDd9Aw-RCM5`FR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