diff --git a/src/c/custom_codes.c b/src/c/custom_codes.c index eb8285b..3804756 100644 --- a/src/c/custom_codes.c +++ b/src/c/custom_codes.c @@ -37,6 +37,29 @@ int load_The_user_target(byte* base_data_ptr) return val_to_store; } +int load_gender_user_target(byte* base_data_ptr) +{ + int val_to_store = 1; + short user; + + if((*(base_data_ptr + BATTLE_USER_INFO_BASE) == 1) || (*(base_data_ptr + BATTLE_USER_INFO_BASE + 1) != 0)) + { + user = *((short*)(base_data_ptr + BATTLE_USER_DATA_BASE)); + val_to_store = ((m2_enemy_attributes[user] >> 8) & 0xFF); + + if(user == KING) + val_to_store = NEUTRAL; + } + else + { + user = *((short*)(base_data_ptr + BATTLE_USER_DATA_BASE)); + if(user <= 3) + val_to_store = (*(base_data_ptr + BATTLE_USER_INFO_BASE + 2)) != PAULA ? MALE : FEMALE; //Only Paula is female + } + + return val_to_store; +} + int custom_codes_parse_generic(int code, char* parserAddress, WINDOW* window, byte* dest) { int addedSize = 0; @@ -88,6 +111,18 @@ int custom_codes_parse_generic(int code, char* parserAddress, WINDOW* window, by store = true; break; + case BATTLE_USER_GENDER: + // 5E FF 04 : Load user's gender into memory + val_to_store = load_gender_user_target(m2_btl_user_ptr); + store = true; + break; + + case BATTLE_TARGET_GENDER: + // 5E FF 05 : Load target's gender into memory - UNUSED but coded, just like in EB + val_to_store = load_gender_user_target(m2_btl_target_ptr); + store = true; + break; + default: break; } diff --git a/src/c/custom_codes.h b/src/c/custom_codes.h index e047a42..c245144 100644 --- a/src/c/custom_codes.h +++ b/src/c/custom_codes.h @@ -8,6 +8,11 @@ #define INV_WINDOW_VALUE 4 #define DIALOGUE_WINDOW_VALUE 2 +#define PAULA 1 +#define MALE 1 +#define FEMALE 2 +#define NEUTRAL 3 + #define BATTLE_USER_DATA_BASE 0x42 #define BATTLE_USER_INFO_BASE 0x5C #define BATTLE_USER_VAL_BASE 0x92 @@ -17,6 +22,8 @@ #define ENEMY_PLURALITY 1 #define BATTLE_USER_THE 2 #define BATTLE_TARGET_THE 3 +#define BATTLE_USER_GENDER 4 +#define BATTLE_TARGET_GENDER 5 #define RESET_STORED_GOODS 0x59 #define RESTORE_DIALOGUE 0x5A diff --git a/working/m12-strings-english.txt b/working/m12-strings-english.txt index c6368e2..7a7f6df 100644 --- a/working/m12-strings-english.txt +++ b/working/m12-strings-english.txt @@ -5217,13 +5217,13 @@ ^maam^ma'am[00 FF] ^heshe^[9A FF 02 00][81 FF _she_]he[00 FF] ^she^she[00 FF] -^userpersonal^[95 FF 03 _he_ _she_ _it_]^he^he[00 FF] +^userpersonal^[5E FF 04][95 FF 03 _he_ _she_ _it_]^he^he[00 FF] ^it^it[00 FF] -^userpersonalcapital^[95 FF 03 _hecapital_ _shecapital_ _itcapital_]^hecapital^He[00 FF] +^userpersonalcapital^[5E FF 04][95 FF 03 _hecapital_ _shecapital_ _itcapital_]^hecapital^He[00 FF] ^shecapital^She[00 FF] ^itcapital^It[00 FF] ^hisher^[9A FF 02 00][81 FF _her_]his[00 FF] -^userpossessive^[95 FF 03 _his_ _her_ _its_]^his^his[00 FF] +^userpossessive^[5E FF 04][95 FF 03 _his_ _her_ _its_]^his^his[00 FF] ^its^its[00 FF] ^himher^[9A FF 02 00][81 FF _her_]him[00 FF] ^her^her[00 FF]