From bd0f77a17743875e83937e046fe7beb77d51c752 Mon Sep 17 00:00:00 2001 From: Xarnax42 Date: Sun, 7 Jun 2020 20:07:15 -0400 Subject: [PATCH 1/3] Added "Almost Vanilla" Flag option --- CHANGELOG.md | 22 +++++++++++++++++ common/build.h | 2 +- common/dwr.c | 60 ++++++++++++++++++++++++++++++++-------------- common/dwr.h | 3 +++ common/map.c | 3 +++ ui/main-window.cpp | 13 +++++----- 6 files changed, 78 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f70b095..4270333 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,28 @@ * The random sprite chosen will no longer depend on the seed number * Added a Ms. Pacman "Sue" sprite + # Build 479x + * Stat build modifier is not locked to 3 if Permanent Repel flag is selected. + * Added "Almost Vanilla" option to flags. + Almost Vanilla turns off all of these patches: + - open the Fairy Water shop in Breconnary + - have the old man take the Token along with Staff & Stones + - move the Golem encounter to Charlock + - make sure all forced encounters are never marked defeated + - changes the enemies summoned by the harp. + - sets the encounter rate of Zone 0 to be the same as other zones. + - set Death Necklace chance to 100% + - adjust MP requirements + - adjust enemy HP values (notable for Golem and Dragonlord) + - buff the HEAL spell + - buff the HURT spell + - lock the stat build modifier at 3 + - replace 7-13 GOLD chests with 500-755 + Additionally, when "Almost Vanilla" is on: + - GOLD chests are only updated to 500-755 if chests are shuffled + - the "Random Map" flag is disabled + + # 2.1.2 - Bug fixes # * Fixed the slime and red slime sprites diff --git a/common/build.h b/common/build.h index 0961762..e6b8084 100644 --- a/common/build.h +++ b/common/build.h @@ -1,2 +1,2 @@ /* This file is generated by git */ -#define BUILD "478" +#define BUILD "479x" diff --git a/common/dwr.c b/common/dwr.c index 0ca063a..f3c0a01 100644 --- a/common/dwr.c +++ b/common/dwr.c @@ -551,6 +551,10 @@ static inline BOOL is_static_chest(dw_chest *chest) */ static void no_chest_shuffle(dw_rom *rom) { + + if (VANILLA(rom)) + return; + size_t i; dw_chest *chest; uint8_t contents[] = { @@ -770,6 +774,9 @@ static inline void set_ow_zone(dw_rom *rom, uint8_t x, uint8_t y, uint8_t value) */ static void randomize_zone_layout(dw_rom *rom) { + if(VANILLA(rom)) + return; + int i; dw_warp *tantegel = &rom->map.warps_from[WARP_TANTEGEL]; @@ -1088,6 +1095,9 @@ static void update_drops(dw_rom *rom) */ static void update_mp_reqs(dw_rom *rom) { + if(VANILLA(rom)) + return; + int i; const uint8_t mp_reqs[10] = {3, 2, 2, 2, 2, 6, 8, 2, 8, 5}; @@ -1128,16 +1138,18 @@ static void lower_xp_reqs(dw_rom *rom) */ static void update_enemy_hp(dw_rom *rom) { - int i; - const uint8_t remake_hp[DRAGONLORD_2+1] = { - 2, 3, 5, 7, 12, 13, 13, 22, 23, 20, 16, 24, 28, - 18, 33, 39, 3, 33, 37, 35, 44, 37, 40, 40, 153, 35, - 47, 48, 38, 70, 72, 74, 65, 67, 98, 135, 99, 106, 100, 165 - }; - for (i=SLIME; i <= DRAGONLORD_2; i++) { - rom->enemies[i].hp = remake_hp[i]; + if(!VANILLA(rom)){ + int i; + const uint8_t remake_hp[DRAGONLORD_2+1] = { + 2, 3, 5, 7, 12, 13, 13, 22, 23, 20, 16, 24, 28, + 18, 33, 39, 3, 33, 37, 35, 44, 37, 40, 40, 153, 35, + 47, 48, 38, 70, 72, 74, 65, 67, 98, 135, 99, 106, 100, 165 + }; + for (i=SLIME; i <= DRAGONLORD_2; i++) { + rom->enemies[i].hp = remake_hp[i]; + } + rom->enemies[DRAGONLORD_2].hp -= mt_rand(0, 15); } - rom->enemies[DRAGONLORD_2].hp -= mt_rand(0, 15); } /** @@ -1256,6 +1268,7 @@ static void update_title_screen(dw_rom *rom) static void dwr_fighters_ring(dw_rom *rom) { + if(!VANILLA(rom)){ printf("Fixing the fighter's ring...\n"); /* fighter's ring fix */ vpatch(rom, 0xf0fc, 4, 0x20, 0x7d, 0xff, 0xea); @@ -1276,6 +1289,7 @@ static void dwr_fighters_ring(dw_rom *rom) 0xa5, 0xcf, /* LDA $00CF ; replaces code removed from $F00E */ 0x60 /* RTS */ ); + } } /** @@ -1452,14 +1466,12 @@ static void other_patches(dw_rom *rom) vpatch(rom, 0x03f9e, 2, 0x37, 0x32); vpatch(rom, 0x0af6c, 1, 0xef); + if(!VANILLA(rom)){ /* open the fairy water shop in breconnary */ vpatch(rom, 0x0074e, 1, 0x6f); vpatch(rom, 0x0076c, 1, 0x6f); vpatch(rom, 0x0077a, 1, 0x46); - /* make search actually open a chest */ - vpatch(rom, 0xe1dc, 2, 0xfd, 0xe1); - /* Have the jerk take the token along with staff & stones */ vpatch(rom, 0x0d383, 2, 0xca, 0xbf); /* jump to new code below */ vpatch(rom, 0x03fca, 8, @@ -1486,25 +1498,37 @@ static void other_patches(dw_rom *rom) 0xea, /* NOP ; */ 0xea /* NOP ; */ ); + + /* Sets the encounter rate of Zone 0 to be the same as other zones. */ + vpatch(rom, 0xcebf, 3, 0x4c, 0x04, 0xcf); /* skip over the zone 0 code */ + vpatch(rom, 0xe260, 1, 0); /* set death necklace chance to 100% */ + vpatch(rom, 0xe74d, 1, 9); /* buff the hurt spell */ + vpatch(rom, 0xdbc1, 1, 18); /* buff the heal spell */ + if(!PERMANENT_REPEL(rom)){ + vpatch(rom, 0xf131, 2, 0x69, 0x03); /* Lock the stat build modifier at 3 */ + } + + } + vpatch(rom, 0x42a, 1, 0x47); /* add new stairs to the throne room */ vpatch(rom, 0x2a9, 1, 0x45); /* add new stairs to the 1st floor */ vpatch(rom, 0x2c7, 1, 0x66); /* add a new exit to the first floor */ + + + /* make search actually open a chest */ + vpatch(rom, 0xe1dc, 2, 0xfd, 0xe1); + /* replace the usless grave warps with some for tantegel */ vpatch(rom, 0xf44f, 3, 5, 1, 8); vpatch(rom, 0xf4e8, 3, 4, 1, 7); vpatch(rom, 0x1288, 1, 0x22); /* remove the top set of stairs for the old warp in the grave */ - /* Sets the encounter rate of Zone 0 to be the same as other zones. */ - vpatch(rom, 0xcebf, 3, 0x4c, 0x04, 0xcf); /* skip over the zone 0 code */ - vpatch(rom, 0xe260, 1, 0); /* set death necklace chance to 100% */ - vpatch(rom, 0xe74d, 1, 9); /* buff the hurt spell */ - vpatch(rom, 0xdbc1, 1, 18); /* buff the heal spell */ + vpatch(rom, 0xea41, 5, 0xad, 0x07, 0x01, 0xea, 0xea); /* I forget what this does */ /* fixing some annoying roaming npcs */ vpatch(rom, 0x18ee, 1, 0xa7); /* move the stupid old man from the item shop */ vpatch(rom, 0x90f, 1, 0x6f); /* quit ignoring the customers */ vpatch(rom, 0x93c, 1, 0x6f); /* quit ignoring the customers */ vpatch(rom, 0x17a2, 3, 0, 0, 0); /* delete roaming throne room guard */ - vpatch(rom, 0xf131, 2, 0x69, 0x03); /* Lock the stat build modifier at 3 */ /* I always hated this wording */ dwr_str_replace(rom, "The spell will not work", "The spell had no effect"); diff --git a/common/dwr.h b/common/dwr.h index 3136e13..8462aba 100644 --- a/common/dwr.h +++ b/common/dwr.h @@ -21,6 +21,8 @@ #define DEFAULT_FLAGS "CDFGMPRSTWYZ" #define CHEST_COUNT 31 +#define VANILLA_FLAGS "" + /** 64 bit versions of the randomization flags */ #define FLAG_0 UINT64_C(0x0000000000000001) #define FLAG_1 UINT64_C(0x0000000000000002) @@ -104,6 +106,7 @@ #define SHORT_CHARLOCK(x) (x->flags & FLAG_s) #define FAST_TEXT(x) (x->flags & FLAG_t) #define NO_HURTMORE(x) (x->flags & FLAG_u) +#define VANILLA(x) (x->flags & FLAG_v) #define RANDOM_PRICES(x) (x->flags & FLAG_w) #define RANDOM_XP_REQS(x) (x->flags & FLAG_x) #define SHUFFLE_CHESTS(x) (x->flags & FLAG_C) diff --git a/common/map.c b/common/map.c index 1e2473b..ec46c5a 100644 --- a/common/map.c +++ b/common/map.c @@ -800,6 +800,9 @@ BOOL map_generate_terrain(dw_rom *rom) int i, j, x, y, lm_sizes[256]; int largest, next, total_area; + if (VANILLA(rom)) { + return map_encode(&rom->map); + } if (!RANDOM_MAP(rom)) { map_decode(&rom->map); diff --git a/ui/main-window.cpp b/ui/main-window.cpp index 61df650..e8a9d00 100644 --- a/ui/main-window.cpp +++ b/ui/main-window.cpp @@ -135,22 +135,23 @@ void MainWindow::layout() } /* Gameplay Options */ - this->addOption('C', "Shuffle Chests && Searches", GAMEPLAY, 0, 0); + this->addOption('C', "Shuffle Chests && Searches","", "v", GAMEPLAY, 0, 0); this->addOption('G', "Random Growth", GAMEPLAY, 1, 0); - this->addOption('M', "Random Map", GAMEPLAY, 2, 0); + this->addOption('M', "Random Map", "", "v", GAMEPLAY, 2, 0); this->addOption('S', "Random Spell Learning", GAMEPLAY, 3, 0); - this->addOption('Y', "Heal/Hurt before \"More\"", "S", "", GAMEPLAY, 4, 0); + this->addOption('Y', "Heal/Hurt Before \"More\"", "S", "", GAMEPLAY, 4, 0); this->addOption('W', "Random Weapon Shops", GAMEPLAY, 0, 1); this->addOption('w', "Random Weapon Prices", GAMEPLAY, 1, 1); this->addOption('x', "Random XP Requirements", GAMEPLAY, 2, 1); + this->addOption('v', "Almost Vanilla", GAMEPLAY, 3, 1); /* Features */ this->addOption('R', "Enable Menu Wrapping", FEATURES, 0, 0); this->addOption('D', "Enable Death Necklace", FEATURES, 1, 0); - this->addOption('T', "Enable Torches In Battle", FEATURES, 2, 0); + this->addOption('T', "Enable Torches in Battle", FEATURES, 2, 0); this->addOption('b', "Big Swamp", "M", "", FEATURES, 0, 1); - this->addOption('r', "Repel in dungeons", FEATURES, 1, 1); - this->addOption('p', "Permanent repel", FEATURES, 2, 1); + this->addOption('r', "Repel in Dungeons", FEATURES, 1, 1); + this->addOption('p', "Permanent Repel", FEATURES, 2, 1); /* Monster flags */ this->addOption('P', "Random Monster Abilities", MONSTERS, 0, 0); From 3acc7e90fb2764810f7a4e8a20c5fa1cab8ff731 Mon Sep 17 00:00:00 2001 From: Xarnax42 Date: Sun, 7 Jun 2020 20:11:57 -0400 Subject: [PATCH 2/3] logic fix --- ui/main-window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/main-window.cpp b/ui/main-window.cpp index e8a9d00..4ba5dd5 100644 --- a/ui/main-window.cpp +++ b/ui/main-window.cpp @@ -135,7 +135,7 @@ void MainWindow::layout() } /* Gameplay Options */ - this->addOption('C', "Shuffle Chests && Searches","", "v", GAMEPLAY, 0, 0); + this->addOption('C', "Shuffle Chests && Searches", GAMEPLAY, 0, 0); this->addOption('G', "Random Growth", GAMEPLAY, 1, 0); this->addOption('M', "Random Map", "", "v", GAMEPLAY, 2, 0); this->addOption('S', "Random Spell Learning", GAMEPLAY, 3, 0); From 68b9bc65c00ab6f735a79bf3dcb505d2f9182f1d Mon Sep 17 00:00:00 2001 From: Xarnax42 Date: Sun, 7 Jun 2020 20:15:51 -0400 Subject: [PATCH 3/3] Xarnax42 --- common/dwr.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/dwr.h b/common/dwr.h index 8462aba..aeff5f9 100644 --- a/common/dwr.h +++ b/common/dwr.h @@ -21,8 +21,6 @@ #define DEFAULT_FLAGS "CDFGMPRSTWYZ" #define CHEST_COUNT 31 -#define VANILLA_FLAGS "" - /** 64 bit versions of the randomization flags */ #define FLAG_0 UINT64_C(0x0000000000000001) #define FLAG_1 UINT64_C(0x0000000000000002)