Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inn in Charlock #152

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions common/dwr.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,34 @@ static void randomize_shops(dw_rom *rom)
}
}

/**
* Promotes Cantlin's bottom-left NPC to Charlock innkeeper
*
* @param rom The rom struct
*/
static void inn_in_charlock(dw_rom *rom)
{
if (!INN_IN_CHARLOCK(rom))
return;

printf("Putting a bed & breakfast in Charlock...\n");

// Update the appropriate NPC tables locations
vpatch(rom, 0x1746, 1, 0x97ef + 3);
vpatch(rom, 0x175e, 1, 0x97f0 + 3);
vpatch(rom, 0x1748, 1, 0x97f4 + 3);
vpatch(rom, 0x1760, 1, 0x97f5 + 3);

// Update NPC data from Charlock basement to Cantlin.
// It would be more elegant to move rather than rewrite most of this,
// but I don't know of an easy way to do this.

// 011 for shopkeeper, 10101 for X, 011 for left-facing, 01000 for Y, 0x14 for inn dialogue
vpatch(rom, 0x17ee, 3, 0x75, 0x68, 0x14); // This is the guy.

vpatch(rom, 0x17ee + 3, 35, 0xff, 0xff, 0xa4, 0x24, 0x6c, 0xff, 0xff, 0xa4, 0x65, 0x6d, 0xff, 0x14, 0x4f, 0x4b, 0x45, 0x46, 0x60, 0x79, 0x51, 0x4c, 0xc4, 0x4e, 0x49, 0x76, 0x45, 0x03, 0xc9, 0x50, 0x4a, 0xae, 0x5c, 0x6b, 0x4f, 0x46, 0x48);
}

/**
* Randomizes the player's stat growth
*
Expand Down Expand Up @@ -2084,6 +2112,7 @@ uint64_t dwr_randomize(const char* input_file, uint64_t seed, char *flags,
randomize_zone_layout(&rom);
randomize_zones(&rom);
randomize_shops(&rom);
inn_in_charlock(&rom);
randomize_growth(&rom);
randomize_spells(&rom);
update_drops(&rom);
Expand Down
1 change: 1 addition & 0 deletions common/dwr.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#define ROTATE_DUNGEONS(x) (x->flags[10] & 0x0c)
#define NO_ARMOR_IN_CHARLOCK(x) (x->flags[10] & 0x30)
#define EASY_CHARLOCK(x) (x->flags[10] & 0xc0)
#define INN_IN_CHARLOCK(x) (1 > 0)

#define CURSED_PRINCESS(x) (x->flags[ 8] & 0x0c)
#define THREES_COMPANY(x) (x->flags[ 8] & 0x03)
Expand Down