From 5a8973b2c379a43ab29cef7f2eff26b32101ae05 Mon Sep 17 00:00:00 2001 From: AliceLR Date: Sun, 17 Dec 2023 04:58:55 -0700 Subject: [PATCH] Fix dragon random movement and 1.x slime speeds. --- docs/changelog.txt | 2 ++ src/game_update_board.c | 28 +++++++++++++++++--------- src/legacy_rasm.c | 4 ++-- testworlds/1.00/008 slimeblob.mzx | Bin 0 -> 7399 bytes testworlds/1.00/008 slimeblob.txt | 3 +++ testworlds/2.51/013 slimeblob.mzx | Bin 0 -> 8081 bytes testworlds/2.51/013 slimeblob.txt | 3 +++ testworlds/2.93/008 Dragon Random.mzx | Bin 0 -> 4325 bytes 8 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 testworlds/1.00/008 slimeblob.mzx create mode 100644 testworlds/1.00/008 slimeblob.txt create mode 100644 testworlds/2.51/013 slimeblob.mzx create mode 100644 testworlds/2.51/013 slimeblob.txt create mode 100644 testworlds/2.93/008 Dragon Random.mzx diff --git a/docs/changelog.txt b/docs/changelog.txt index a59db93ff..15798ee67 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -275,6 +275,8 @@ USERS FWRITE_APPEND) is now stored in save files. This fixes a bug where the output file would be reopened in the wrong mode (ab) when reloading a saved game. ++ Fixed dragon random movement behavior. A compatibility check + has been added for 2.80 to 2.92 non-random dragon movement. + save_slots is now enabled by default for consoles. (Spectere) + editor_show_thing_toggles is now enabled by default. - board_editor_hide_help and robot_editor_hide_help are no diff --git a/src/game_update_board.c b/src/game_update_board.c index 9bea7e6f9..75eb1a2dc 100644 --- a/src/game_update_board.c +++ b/src/game_update_board.c @@ -31,6 +31,7 @@ #include "idarray.h" #include "idput.h" #include "robot.h" +#include "world.h" #include "util.h" #include "audio/sfx.h" @@ -468,7 +469,6 @@ void update_board(context *ctx) } break; } - // Cw/Ccw case CW_ROTATE: case CCW_ROTATE: @@ -787,21 +787,25 @@ void update_board(context *ctx) { if(!slow_down) { - // This is pretty weird, but I have to go by the ASM for now int spread_speed = current_param & 0x03; - int current_cycle = (current_param & 0x3C) >> 2; - - spread_speed |= spread_speed << 1; + int current_cycle = (current_param & 0x3C) >> 2; + + // This was changed from speed*5 some time between 2.04 and 2.07. + // Despite MegaZeux 2.x having changed the speed setting range + // from 1-4 to 1-8, this setting has always been two bits. + // BUG: The newer behavior seems to be a broken attempt at speed*3. + if(mzx_world->version >= V251) + spread_speed |= spread_speed << 1; + else + spread_speed |= spread_speed << 2; if(spread_speed == current_cycle) { int new_x, new_y; current_color = level_color[level_offset]; // Clear cycle - // BUG: This leaves the lowest cycle count bit set, which can't - // be fixed right now (compatibility). Seems like Alexis planned - // to extend the speed range in 2.00 but didn't fully implement - // it; the param dialog has the "wrong" bound too... + // BUG: This leaves the lowest cycle count bit set. + // This bug exists even in MegaZeux 1.x. current_param &= 0xC7; // Put slimes all around @@ -838,6 +842,7 @@ void update_board(context *ctx) else { // Increase cycle + // BUG: corrupting overflow. level_param[level_offset] = current_param + 4; } } @@ -951,6 +956,9 @@ void update_board(context *ctx) level_param[level_offset] = current_param & 0xE7; // One out of 8 moves is random + // This was broken in the port for a long time. + if(mzx_world->version < VERSION_PORT || mzx_world->version >= V293) + rval = Random(8); if(!(rval & 0x07)) { @@ -1496,7 +1504,7 @@ void update_board(context *ctx) level_param[level_offset] = 0x20; } - level_id[level_offset] = 38; + level_id[level_offset] = (char)EXPLOSION; play_sfx(mzx_world, SFX_EXPLOSION); } else diff --git a/src/legacy_rasm.c b/src/legacy_rasm.c index 1fdef036d..fd17e0df5 100644 --- a/src/legacy_rasm.c +++ b/src/legacy_rasm.c @@ -2968,10 +2968,10 @@ boolean legacy_convert_v1_program(char **_dest, int *_dest_len, if(!dest) return false; + dest[0] = 0xff; + dest[1] = 0; *_dest = dest; *_dest_len = 2; - *_dest[0] = 0xff; - *_dest[1] = 0; *_cur_prog_line = 0; return true; } diff --git a/testworlds/1.00/008 slimeblob.mzx b/testworlds/1.00/008 slimeblob.mzx new file mode 100644 index 0000000000000000000000000000000000000000..d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