From e6e032124d94fa1e49a66c6c6db84a67bb7d86ed Mon Sep 17 00:00:00 2001 From: Seth Barberee Date: Sun, 10 Mar 2024 17:37:59 -0700 Subject: [PATCH] match remaining data, use defines and document IsNotValidDungeon --- data/data_8107010.s | 26 +--------------------- include/dungeon.h | 2 +- src/code_80958E8.c | 2 +- src/data/pokemon_3.h | 52 ++++++++++++++++++++++++++++++++++++++++++++ src/dungeon_2_1.c | 10 ++++----- src/pokemon_3.c | 2 +- 6 files changed, 61 insertions(+), 33 deletions(-) diff --git a/data/data_8107010.s b/data/data_8107010.s index de57e169b..a1a85cfd6 100644 --- a/data/data_8107010.s +++ b/data/data_8107010.s @@ -1890,29 +1890,5 @@ gFinalScenarioText: @ 8109CF4 @ 8109D30 #include "dungeon/dungeon_data.inc" -.global gUnknown_810A350 -gUnknown_810A350: @ 810A350 -@ replacing .incbin "baserom.gba", 0x0010a350, 0xb -.byte 0x18, 0x19, 0x1e, 0x27, 0x31, 0x32, 0x33, 0x36, 0x37, 0x3d, 0x3f +.align 2,0 -.global gInvalidItemIDs -gInvalidItemIDs: @ 810A35B (item related) -@ replacing .incbin "baserom.gba", 0x0010a35b, 0x10 -.byte 0xed, 0xee, 0xef, 0xb1, 0xe9, 0x24, 0xd8, 0xd2, 0xb0, 0xdc, 0x32, 0x33, 0x34, 0xc2, 0xec, 0xf0 - -.global gTacticsTargetLeader -gTacticsTargetLeader: @ 810A36B -@ replacing .incbin "baserom.gba", 0x0010a36b, 0xd -.byte 0x01 -.byte 0x00 -.byte 0x00 -.byte 0x00 -.byte 0x01 -.byte 0x01 -.byte 0x01 -.byte 0x01 -.byte 0x01 -.byte 0x00 -.byte 0x01 -.byte 0x00 -.byte 0x00 diff --git a/include/dungeon.h b/include/dungeon.h index 6b9177acc..b8d7ca0cc 100644 --- a/include/dungeon.h +++ b/include/dungeon.h @@ -47,6 +47,6 @@ void PrintDungeonLocationtoBuffer(u8 *buffer, DungeonLocation *dungeonLocation); u32 sub_80908D8(DungeonLocation *dungeon); u8 sub_8090910(DungeonLocation *dungeon, u32 param_2); -bool8 sub_809095C(u8 dungeon); +bool8 IsNotValidDungeon(u8 dungeon); #endif // GUARD_DUNGEON_H diff --git a/src/code_80958E8.c b/src/code_80958E8.c index b07f99369..c5ab16bbe 100644 --- a/src/code_80958E8.c +++ b/src/code_80958E8.c @@ -90,7 +90,7 @@ bool8 ValidateWonderMail(WonderMail *data) if(data->unk2 > 9) return FALSE; - if(sub_809095C(data->unk4.dungeon.id)) + if(IsNotValidDungeon(data->unk4.dungeon.id)) return FALSE; if(data->unk4.dungeon.floor >= GetDungeonFloorCount(data->unk4.dungeon.id)) return FALSE; diff --git a/src/data/pokemon_3.h b/src/data/pokemon_3.h index 6bd52d6a2..4bd1c9eff 100644 --- a/src/data/pokemon_3.h +++ b/src/data/pokemon_3.h @@ -1,3 +1,55 @@ +const u8 gInvalidDungeonIDs[11] = +{ + DUNGEON_BOSS_3, + DUNGEON_BOSS_4, + DUNGEON_BOSS_9, + DUNGEON_WONDROUS_SEA, + DUNGEON_AUTOPILOT, + DUNGEON_D50, + DUNGEON_D51, + DUNGEON_D54, + DUNGEON_POISON_MAZE, + DUNGEON_D61, + DUNGEON_OUT_ON_RESCUE +}; + +const u8 gInvalidItemIDs[0x10] = +{ + ITEM_G_MACHINE_6, + ITEM_G_MACHINE_7, + ITEM_G_MACHINE_8, + ITEM_TM_SPIN_SLASH, + ITEM_SWITCH_BOX, + ITEM_ALERT_SPECS, + ITEM_POSSESS_ORB, + ITEM_REVIVER_ORB, + ITEM_TM_EXCAVATE, + ITEM_TOSS_ORB, + ITEM_RING_D, + ITEM_RING_E, + ITEM_RING_F, + ITEM_OBSERVER_ORB, + ITEM_BEATUP_ORB, + NUMBER_OF_ITEM_IDS +}; + +const bool8 gTacticsTargetLeader[NUM_TACTICS] = +{ + [TACTIC_LETS_GO_TOGETHER] = TRUE, + [TACTIC_GO_THE_OTHER_WAY] = FALSE, + [TACTIC_GO_AFTER_FOES] = FALSE, + [TACTIC_AVOID_THE_FIRST_HIT] = FALSE, + [TACTIC_ALL_FOR_ONE] = TRUE, + [TACTIC_GROUP_SAFETY] = TRUE, + [TACTIC_AVOID_TROUBLE] = TRUE, + [TACTIC_BE_PATIENT] = TRUE, + [TACTIC_KEEP_YOUR_DISTANCE] = TRUE, + [TACTIC_WAIT_THERE] = FALSE, + [TACTIC_GET_AWAY] = TRUE, + [TACTIC_UNUSED] = FALSE +}; + + const s16 gReqTacticLvls[NUM_TACTICS] = { [TACTIC_LETS_GO_TOGETHER] = 1, diff --git a/src/dungeon_2_1.c b/src/dungeon_2_1.c index 2854ba394..68e03df1a 100644 --- a/src/dungeon_2_1.c +++ b/src/dungeon_2_1.c @@ -6,7 +6,7 @@ #include "random.h" #include "code_8092334.h" -extern u8 gUnknown_810A350[]; +extern u8 gInvalidDungeonIDs[]; extern u8 gDungeonFloorCount[]; extern u8 *gUnknown_8108084[]; @@ -97,7 +97,7 @@ u8 sub_8090910(DungeonLocation *dungeon, u32 param_2) } } -bool8 sub_809095C(u8 dungeon) +bool8 IsNotValidDungeon(u8 dungeon) { s32 counter; @@ -107,10 +107,10 @@ bool8 sub_809095C(u8 dungeon) else { counter = 0; - if (gUnknown_810A350[0] != DUNGEON_OUT_ON_RESCUE) { - for(; gUnknown_810A350[counter] != DUNGEON_OUT_ON_RESCUE; counter++) + if (gInvalidDungeonIDs[0] != DUNGEON_OUT_ON_RESCUE) { + for(; gInvalidDungeonIDs[counter] != DUNGEON_OUT_ON_RESCUE; counter++) { - if (gUnknown_810A350[counter] == dungeon) return TRUE; + if (gInvalidDungeonIDs[counter] == dungeon) return TRUE; } } return FALSE; diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 1af0c70e8..1746a9323 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -2,6 +2,7 @@ #include "pokemon.h" #include "pokemon_3.h" #include "random.h" +#include "constants/dungeon.h" #include "constants/evolve_type.h" #include "constants/evolution_status.h" #include "constants/iq_skill.h" @@ -17,7 +18,6 @@ extern u8 *gIQSkillNames[]; extern u8 *gIQSkillDescriptions[]; extern u8 *gTacticsDescriptions[]; extern u8 *gTactics[]; -extern bool8 gTacticsTargetLeader[]; extern u32 gIQSkillGroups[]; struct unkStruct_808E9EC