Add gender control code

This commit is contained in:
Lorenzo Carletti 2020-12-22 07:08:07 +01:00
parent f021d67881
commit d74f53cd6e
3 changed files with 45 additions and 3 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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]