Skip to content

Commit

Permalink
Flags stuff (HarbourMasters#3014)
Browse files Browse the repository at this point in the history
* Manual adjustments to flags

* Script run to adjust flags
  • Loading branch information
garrettjoecox authored Jun 20, 2023
1 parent 83ebaa2 commit 7c5efb2
Show file tree
Hide file tree
Showing 142 changed files with 1,324 additions and 1,234 deletions.
9 changes: 9 additions & 0 deletions soh/include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -553,10 +553,19 @@ Actor* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3,
void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2);
s32 Flags_GetEventChkInf(s32 flag);
void Flags_SetEventChkInf(s32 flag);
void Flags_UnsetEventChkInf(s32 flag);
s32 Flags_GetItemGetInf(s32 flag);
void Flags_SetItemGetInf(s32 flag);
void Flags_UnsetItemGetInf(s32 flag);
s32 Flags_GetInfTable(s32 flag);
void Flags_SetInfTable(s32 flag);
void Flags_UnsetInfTable(s32 flag);
s32 Flags_GetEventInf(s32 flag);
void Flags_SetEventInf(s32 flag);
void Flags_UnsetEventInf(s32 flag);
s32 Flags_GetRandomizerInf(RandomizerInf flag);
void Flags_SetRandomizerInf(RandomizerInf flag);
void Flags_UnsetRandomizerInf(RandomizerInf flag);
u16 func_80037C30(PlayState* play, s16 arg1);
s32 func_80037D98(PlayState* play, Actor* actor, s16 arg2, s32* arg3);
s32 func_80038290(PlayState* play, Actor* actor, Vec3s* arg2, Vec3s* arg3, Vec3f arg4);
Expand Down
1 change: 1 addition & 0 deletions soh/include/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@

#define GET_ITEMGETINF(flag) (gSaveContext.itemGetInf[(flag) >> 4] & (1 << ((flag) & 0xF)))
#define SET_ITEMGETINF(flag) (gSaveContext.itemGetInf[(flag) >> 4] |= (1 << ((flag) & 0xF)))
#define CLEAR_ITEMGETINF(flag) (gSaveContext.itemGetInf[(flag) >> 4] &= ~(1 << ((flag) & 0xF)))

#define GET_INFTABLE(flag) (gSaveContext.infTable[(flag) >> 4] & (1 << ((flag) & 0xF)))
#define SET_INFTABLE(flag) (gSaveContext.infTable[(flag) >> 4] |= (1 << ((flag) & 0xF)))
Expand Down
3 changes: 3 additions & 0 deletions soh/include/z64player.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ typedef enum {
FLAG_SCENE_CLEAR,
FLAG_SCENE_COLLECTIBLE,
FLAG_EVENT_CHECK_INF,
FLAG_ITEM_GET_INF,
FLAG_INF_TABLE,
FLAG_EVENT_INF,
FLAG_RANDOMIZER_INF
} FlagType;

Expand Down
131 changes: 67 additions & 64 deletions soh/include/z64save.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,15 +389,15 @@ typedef enum {
*/

#define EVENTCHKINF_FIRST_SPOKE_TO_MIDO 0x02
#define EVENTCHKINF_03 0x03
#define EVENTCHKINF_COMPLAINED_ABOUT_MIDO 0x03
#define EVENTCHKINF_SHOWED_MIDO_SWORD_SHIELD 0x04
#define EVENTCHKINF_DEKU_TREE_OPENED_MOUTH 0x05
#define EVENTCHKINF_OBTAINED_KOKIRI_EMERALD_DEKU_TREE_DEAD 0x07
#define EVENTCHKINF_09 0x09
#define EVENTCHKINF_0A 0x0A
#define EVENTCHKINF_USED_DEKU_TREE_BLUE_WARP 0x09
#define EVENTCHKINF_PLAYED_SARIAS_SONG_FOR_MIDO_AS_ADULT 0x0A
#define EVENTCHKINF_0B 0x0B
#define EVENTCHKINF_MET_DEKU_TREE 0x0C
#define EVENTCHKINF_0F 0x0F
#define EVENTCHKINF_SPOKE_TO_MIDO_ABOUT_SARIA 0x0F
#define EVENTCHKINF_SPOKE_TO_CHILD_MALON_AT_CASTLE_OR_MARKET 0x10
#define EVENTCHKINF_SPOKE_TO_INGO_AT_RANCH_BEFORE_TALON_RETURNS 0x11
#define EVENTCHKINF_OBTAINED_POCKET_EGG 0x12
Expand All @@ -406,30 +406,31 @@ typedef enum {
#define EVENTCHKINF_SPOKE_TO_CHILD_MALON_AT_RANCH 0x15
#define EVENTCHKINF_INVITED_TO_SING_WITH_CHILD_MALON 0x16
#define EVENTCHKINF_EPONA_OBTAINED 0x18
#define EVENTCHKINF_OBTAINED_KOKIRI_EMERALD 0x19
#define EVENTCHKINF_RENTED_HORSE_FROM_INGO 0x1B
#define EVENTCHKINF_SPOKE_TO_MIDO_AFTER_DEKU_TREES_DEATH 0x1C
#define EVENTCHKINF_1D 0x1D
#define EVENTCHKINF_1E 0x1E
#define EVENTCHKINF_DESTROYED_ROYAL_FAMILY_TOMB 0x1D
#define EVENTCHKINF_WON_COW_IN_MALONS_RACE 0x1E
#define EVENTCHKINF_20 0x20
#define EVENTCHKINF_21 0x21
#define EVENTCHKINF_22 0x22
#define EVENTCHKINF_23 0x23
#define EVENTCHKINF_25 0x25
#define EVENTCHKINF_BOMBED_DODONGOS_CAVERN_ENTRANCE 0x23
#define EVENTCHKINF_USED_DODONGOS_CAVERN_BLUE_WARP 0x25
#define EVENTCHKINF_2A 0x2A
#define EVENTCHKINF_2B 0x2B
#define EVENTCHKINF_2C 0x2C
#define EVENTCHKINF_2D 0x2D
#define EVENTCHKINF_DEATH_MOUNTAIN_ERUPTED 0x2F
#define EVENTCHKINF_30 0x30
#define EVENTCHKINF_31 0x31
#define EVENTCHKINF_SPOKE_TO_A_ZORA 0x30
#define EVENTCHKINF_OBTAINED_RUTOS_LETTER 0x31
#define EVENTCHKINF_32 0x32
#define EVENTCHKINF_33 0x33
#define EVENTCHKINF_37 0x37
#define EVENTCHKINF_38 0x38
#define EVENTCHKINF_39 0x39
#define EVENTCHKINF_3A 0x3A
#define EVENTCHKINF_KING_ZORA_MOVED 0x33
#define EVENTCHKINF_USED_JABU_JABUS_BELLY_BLUE_WARP 0x37
#define EVENTCHKINF_OBTAINED_SILVER_SCALE 0x38
#define EVENTCHKINF_OPENED_ZORAS_DOMAIN 0x39
#define EVENTCHKINF_OFFERED_FISH_TO_JABU_JABU 0x3A
#define EVENTCHKINF_BEGAN_NABOORU_BATTLE 0x3B
#define EVENTCHKINF_3C 0x3C
#define EVENTCHKINF_FINISHED_NABOORU_BATTLE 0x3C

// 0x40
#define EVENTCHKINF_40_INDEX 4
Expand All @@ -439,28 +440,29 @@ typedef enum {

#define EVENTCHKINF_41 0x41
#define EVENTCHKINF_42 0x42
#define EVENTCHKINF_43 0x43
#define EVENTCHKINF_OBTAINED_OCARINA_OF_TIME 0x43
#define EVENTCHKINF_PULLED_MASTER_SWORD_FROM_PEDESTAL 0x45
#define EVENTCHKINF_48 0x48
#define EVENTCHKINF_49 0x49
#define EVENTCHKINF_4A 0x4A
#define EVENTCHKINF_USED_FOREST_TEMPLE_BLUE_WARP 0x48
#define EVENTCHKINF_USED_FIRE_TEMPLE_BLUE_WARP 0x49
#define EVENTCHKINF_USED_WATER_TEMPLE_BLUE_WARP 0x4A
#define EVENTCHKINF_OPENED_THE_DOOR_OF_TIME 0x4B
#define EVENTCHKINF_4C 0x4C
#define EVENTCHKINF_4D 0x4D
#define EVENTCHKINF_4E 0x4E
#define EVENTCHKINF_RAINBOW_BRIDGE_BUILT 0x4D
#define EVENTCHKINF_CAUGHT_BY_CASTLE_GUARDS 0x4E
#define EVENTCHKINF_ENTERED_MASTER_SWORD_CHAMBER 0x4F
#define EVENTCHKINF_50 0x50
#define EVENTCHKINF_51 0x51
#define EVENTCHKINF_52 0x52
#define EVENTCHKINF_54 0x54
#define EVENTCHKINF_55 0x55
#define EVENTCHKINF_LEARNED_MINUET_OF_FOREST 0x50
#define EVENTCHKINF_LEARNED_BOLERO_OF_FIRE 0x51
#define EVENTCHKINF_LEARNED_SERENADE_OF_WATER 0x52
#define EVENTCHKINF_LEARNED_NOCTURNE_OF_SHADOW 0x54
#define EVENTCHKINF_LEARNED_PRELUDE_OF_LIGHT 0x55
#define EVENTCHKINF_LEARNED_SARIAS_SONG 0x57
#define EVENTCHKINF_LEARNED_ZELDAS_LULLABY 0x59
#define EVENTCHKINF_5A 0x5A
#define EVENTCHKINF_5B 0x5B
#define EVENTCHKINF_LEARNED_SUNS_SONG 0x5A
#define EVENTCHKINF_LEARNED_SONG_OF_STORMS 0x5B
#define EVENTCHKINF_5C 0x5C
#define EVENTCHKINF_65 0x65
#define EVENTCHKINF_67 0x67
#define EVENTCHKINF_68 0x68
#define EVENTCHKINF_PLAYED_SONG_OF_STORMS_IN_WINDMILL 0x65
#define EVENTCHKINF_DRAINED_WELL_IN_KAKARIKO 0x67
#define EVENTCHKINF_PLAYED_HORSEBACK_ARCHERY 0x68
#define EVENTCHKINF_RAISED_LAKE_HYLIA_WATER 0x69
#define EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO 0x6A

Expand All @@ -471,7 +473,7 @@ typedef enum {
#define EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO ((EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_INDEX << 4) | EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_SHIFT)

#define EVENTCHKINF_6E 0x6E
#define EVENTCHKINF_6F 0x6F
#define EVENTCHKINF_SPOKE_TO_KAEPORA_BY_LOST_WOODS 0x6F
#define EVENTCHKINF_BEGAN_GOHMA_BATTLE 0x70
#define EVENTCHKINF_BEGAN_KING_DODONGO_BATTLE 0x71
#define EVENTCHKINF_BEGAN_PHANTOM_GANON_BATTLE 0x72
Expand All @@ -481,11 +483,11 @@ typedef enum {
#define EVENTCHKINF_BEGAN_BARINA_BATTLE 0x76
#define EVENTCHKINF_BEGAN_BONGO_BONGO_BATTLE 0x77
#define EVENTCHKINF_BEGAN_GANONDORF_BATTLE 0x78
#define EVENTCHKINF_80 0x80
#define EVENTCHKINF_82 0x82
#define EVENTCHKINF_8C 0x8C
#define EVENTCHKINF_8D 0x8D
#define EVENTCHKINF_8E 0x8E
#define EVENTCHKINF_ZELDA_FLED_HYRULE_CASTLE 0x80
#define EVENTCHKINF_DRAWBRIDGE_OPENED_AFTER_ZELDA_FLED 0x82
#define EVENTCHKINF_PAID_BACK_KEATON_MASK_FEE 0x8C
#define EVENTCHKINF_PAID_BACK_SKULL_MASK_FEE 0x8D
#define EVENTCHKINF_PAID_BACK_SPOOKY_MASK_FEE 0x8E
#define EVENTCHKINF_PAID_BACK_BUNNY_HOOD_FEE 0x8F

// 0x90-0x93
Expand All @@ -503,9 +505,9 @@ typedef enum {
CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_CARPENTERS_FREE_INDEX], EVENTCHKINF_CARPENTERS_FREE_MASK_ALL)

#define EVENTCHKINF_SPOKE_TO_NABOORU_IN_SPIRIT_TEMPLE 0x94
#define EVENTCHKINF_95 0x95
#define EVENTCHKINF_96 0x96
#define EVENTCHKINF_9C 0x9C
#define EVENTCHKINF_NABOORU_CAPTURED_BY_TWINROVA 0x95
#define EVENTCHKINF_SPOKE_TO_CURSED_MAN_IN_SKULL_HOUSE 0x96
#define EVENTCHKINF_PLAYED_SONG_FOR_SCARECROW_AS_ADULT 0x9C
#define EVENTCHKINF_ENTERED_HYRULE_FIELD 0xA0
#define EVENTCHKINF_ENTERED_DEATH_MOUNTAIN_TRAIL 0xA1
#define EVENTCHKINF_ENTERED_KAKARIKO_VILLAGE 0xA3
Expand All @@ -514,10 +516,10 @@ typedef enum {
#define EVENTCHKINF_ENTERED_GORON_CITY 0xA6
#define EVENTCHKINF_ENTERED_TEMPLE_OF_TIME 0xA7
#define EVENTCHKINF_ENTERED_DEKU_TREE 0xA8
#define EVENTCHKINF_A9 0xA9
#define EVENTCHKINF_AA 0xAA
#define EVENTCHKINF_AC 0xAC
#define EVENTCHKINF_AD 0xAD
#define EVENTCHKINF_LEARNED_SONG_OF_TIME 0xA9
#define EVENTCHKINF_BONGO_BONGO_ESCAPED_FROM_WELL 0xAA
#define EVENTCHKINF_LEARNED_REQUIEM_OF_SPIRIT 0xAC
#define EVENTCHKINF_COMPLETED_SPIRIT_TRIAL 0xAD
#define EVENTCHKINF_ENTERED_DODONGOS_CAVERN 0xB0
#define EVENTCHKINF_ENTERED_LAKE_HYLIA 0xB1
#define EVENTCHKINF_ENTERED_GERUDO_VALLEY 0xB2
Expand All @@ -529,20 +531,20 @@ typedef enum {
#define EVENTCHKINF_ENTERED_DESERT_COLOSSUS 0xB8
#define EVENTCHKINF_ENTERED_DEATH_MOUNTAIN_CRATER 0xB9
#define EVENTCHKINF_ENTERED_GANONS_CASTLE_EXTERIOR 0xBA
#define EVENTCHKINF_BB 0xBB
#define EVENTCHKINF_BC 0xBC
#define EVENTCHKINF_BD 0xBD
#define EVENTCHKINF_BE 0xBE
#define EVENTCHKINF_BF 0xBF
#define EVENTCHKINF_COMPLETED_FOREST_TRIAL 0xBB
#define EVENTCHKINF_COMPLETED_WATER_TRIAL 0xBC
#define EVENTCHKINF_COMPLETED_SHADOW_TRIAL 0xBD
#define EVENTCHKINF_COMPLETED_FIRE_TRIAL 0xBE
#define EVENTCHKINF_COMPLETED_LIGHT_TRIAL 0xBF
#define EVENTCHKINF_NABOORU_ORDERED_TO_FIGHT_BY_TWINROVA 0xC0
#define EVENTCHKINF_C1 0xC1
#define EVENTCHKINF_C3 0xC3
#define EVENTCHKINF_SPOKE_TO_SARIA_ON_BRIDGE 0xC1
#define EVENTCHKINF_DISPELLED_GANONS_TOWER_BARRIER 0xC3
#define EVENTCHKINF_RETURNED_TO_TEMPLE_OF_TIME_WITH_ALL_MEDALLIONS 0xC4
#define EVENTCHKINF_SHEIK_SPAWNED_AT_MASTER_SWORD_PEDESTAL 0xC5
#define EVENTCHKINF_C6 0xC6
#define EVENTCHKINF_SPOKE_TO_DEKU_TREE_SPROUT 0xC6
#define EVENTCHKINF_WATCHED_GANONS_CASTLE_COLLAPSE_CAUGHT_BY_GERUDO 0xC7
#define EVENTCHKINF_C8 0xC8
#define EVENTCHKINF_C9 0xC9
#define EVENTCHKINF_OBTAINED_SPIRIT_MEDALLION 0xC8
#define EVENTCHKINF_TIME_TRAVELED_TO_ADULT 0xC9

// 0xD0-0xD6
#define EVENTCHKINF_SONGS_FOR_FROGS_INDEX 13
Expand All @@ -569,12 +571,12 @@ typedef enum {
#define EVENTCHKINF_SONGS_FOR_FROGS_STORMS ((EVENTCHKINF_SONGS_FOR_FROGS_INDEX << 4) | EVENTCHKINF_SONGS_FOR_FROGS_STORMS_SHIFT)

// 0xDA-0xDE
#define EVENTCHKINF_DA_DB_DC_DD_DE_INDEX 13
#define EVENTCHKINF_DA_MASK (1 << 10)
#define EVENTCHKINF_DB_MASK (1 << 11)
#define EVENTCHKINF_DC_MASK (1 << 12)
#define EVENTCHKINF_DD_MASK (1 << 13)
#define EVENTCHKINF_DE_MASK (1 << 14)
#define EVENTCHKINF_SKULLTULA_REWARD_INDEX 13
#define EVENTCHKINF_SKULLTULA_REWARD_10_MASK (1 << 10)
#define EVENTCHKINF_SKULLTULA_REWARD_20_MASK (1 << 11)
#define EVENTCHKINF_SKULLTULA_REWARD_30_MASK (1 << 12)
#define EVENTCHKINF_SKULLTULA_REWARD_40_MASK (1 << 13)
#define EVENTCHKINF_SKULLTULA_REWARD_50_MASK (1 << 14)


/*
Expand Down Expand Up @@ -618,8 +620,8 @@ typedef enum {
#define ITEMGETINF_1B 0x1B
#define ITEMGETINF_1C 0x1C
#define ITEMGETINF_1D 0x1D
#define ITEMGETINF_1E 0x1E
#define ITEMGETINF_1F 0x1F
#define ITEMGETINF_OBTAINED_STICK_UPGRADE_FROM_STAGE 0x1E
#define ITEMGETINF_OBTAINED_NUT_UPGRADE_FROM_STAGE 0x1F
#define ITEMGETINF_23 0x23
#define ITEMGETINF_24 0x24
#define ITEMGETINF_25 0x25
Expand Down Expand Up @@ -794,6 +796,7 @@ typedef enum {

// 0x1D0-0x1DF
#define INFTABLE_1DX_INDEX 29
#define INFTABLE_SWORDLESS 0x1D0


/*
Expand Down Expand Up @@ -856,7 +859,7 @@ typedef enum {
(gSaveContext.eventInf[EVENTINF_HORSES_INDEX] & ~EVENTINF_HORSES_0F_MASK) | ((v) << EVENTINF_HORSES_0F_SHIFT)


#define EVENTINF_10 0x10
#define EVENTINF_MARATHON_ACTIVE 0x10

// 0x20-0x24
#define EVENTINF_20_21_22_23_24_INDEX 2
Expand Down
6 changes: 3 additions & 3 deletions soh/soh/Enhancements/randomizer/randomizer_entrance.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ void Entrance_OverrideWeatherState() {
return;
}
// Lon Lon Ranch (No Epona)
if (!Flags_GetEventChkInf(0x18)){ // if you don't have Epona
if (!Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED)){ // if you don't have Epona
switch (gSaveContext.entranceIndex) {
case 0x0157: // Lon Lon Ranch from HF
case 0x01F9: // Hyrule Field from LLR
Expand All @@ -596,7 +596,7 @@ void Entrance_OverrideWeatherState() {
}
}
// Water Temple
if (!(gSaveContext.eventChkInf[4] & 0x0400)) { // have not beaten Water Temple
if (!Flags_GetEventChkInf(EVENTCHKINF_USED_WATER_TEMPLE_BLUE_WARP)) { // have not beaten Water Temple
switch (gSaveContext.entranceIndex) {
case 0x019D: // Zora River from behind waterfall
case 0x01DD: // Zora River from LW water shortcut
Expand Down Expand Up @@ -630,7 +630,7 @@ void Entrance_OverrideWeatherState() {
}
}
// Death Mountain Cloudy
if (!(gSaveContext.eventChkInf[4] & 0x0200)) { // have not beaten Fire Temple
if (!Flags_GetEventChkInf(EVENTCHKINF_USED_FIRE_TEMPLE_BLUE_WARP)) { // have not beaten Fire Temple
if (gPlayState->nextEntranceIndex == 0x04D6) { // Lost Woods Goron City Shortcut
gWeatherMode = 2;
return;
Expand Down
Loading

0 comments on commit 7c5efb2

Please sign in to comment.