add and use fixed room constants

This commit is contained in:
darsh 2025-10-01 15:50:46 -04:00
parent 9e9779d0c2
commit 08da5d5cf5
6 changed files with 107 additions and 13 deletions

View File

@ -0,0 +1,82 @@
#ifndef GUARD_CONSTANTS_FIXED_ROOMS_H
#define GUARD_CONSTANTS_FIXED_ROOMS_H
enum FixedRoomID
{
// floorwide fixed rooms
FIXED_ROOM_MT_STEEL_SKARMORY = 1,
FIXED_ROOM_SINISTER_WOODS_TEAM_MEANIES,
FIXED_ROOM_MT_THUNDER_PEAK_ZAPDOS,
FIXED_ROOM_MT_BLAZE_PEAK_MOLTRES,
FIXED_ROOM_FROSTY_GROTTO_ARTICUNO,
FIXED_ROOM_MT_FREEZE_PEAK_NINETALES,
FIXED_ROOM_MAGMA_CAVERN_PIT_GROUDON,
FIXED_ROOM_SKY_TOWER_SUMMIT_RAYQUAZA,
FIXED_ROOM_WESTERN_CAVE_MEWTWO,
FIXED_ROOM_WISH_CAVE_JIRACHI,
FIXED_ROOM_UPROAR_FOREST_MANKEY,
FIXED_ROOM_FIERY_FIELD_ENTEI,
FIXED_ROOM_LIGHTNING_FIELD_RAIKOU,
FIXED_ROOM_NORTHWIND_FIELD_SUICUNE,
FIXED_ROOM_MT_FARAWAY_HO_OH,
FIXED_ROOM_NORTHERN_RANGE_LATIOS,
FIXED_ROOM_BURIED_RELIC_REGIROCK,
FIXED_ROOM_BURIED_RELIC_REGICE,
FIXED_ROOM_BURIED_RELIC_REGISTEEL,
FIXED_ROOM_MAGMA_CAVERN_PIT_TYRANITAR_ALAKAZAM,
FIXED_ROOM_SILVER_TRENCH_LUGIA,
FIXED_ROOM_STORMY_SEA_KYOGRE,
FIXED_ROOM_METEOR_CAVE_DEOXYS,
FIXED_ROOM_HOWLING_FOREST_SMEARGLE,
FIXED_ROOM_PURITY_FOREST_CELEBI,
FIXED_ROOM_WISH_CAVE_MEDICHAM,
FIXED_ROOM_NORMAL_MAZE_BOSS,
FIXED_ROOM_FIRE_MAZE_BOSS,
FIXED_ROOM_WATER_MAZE_BOSS,
FIXED_ROOM_GRASS_MAZE_BOSS,
FIXED_ROOM_ELECTRIC_MAZE_BOSS,
FIXED_ROOM_ICE_MAZE_BOSS,
FIXED_ROOM_FIGHTING_MAZE_BOSS,
FIXED_ROOM_GROUND_MAZE_BOSS,
FIXED_ROOM_FLYING_MAZE_BOSS,
FIXED_ROOM_PSYCHIC_MAZE_BOSS,
FIXED_ROOM_POISON_MAZE_BOSS,
FIXED_ROOM_BUG_MAZE_BOSS,
FIXED_ROOM_ROCK_MAZE_BOSS,
FIXED_ROOM_GHOST_MAZE_BOSS,
FIXED_ROOM_DRAGON_MAZE_BOSS,
FIXED_ROOM_DARK_MAZE_BOSS,
FIXED_ROOM_STEEL_MAZE_BOSS,
FIXED_ROOM_TEAM_SHIFTY_BOSS,
FIXED_ROOM_TEAM_CONSTRICTOR_BOSS,
FIXED_ROOM_TEAM_HYDRO_BOSS,
FIXED_ROOM_TEAM_RUMBLEROCK_BOSS,
FIXED_ROOM_RESCUE_TEAM_2_BOSS,
FIXED_ROOM_RESCUE_TEAM_MAZE_BOSS,
// non-floorwide fixed rooms
FIXED_ROOM_WYVERN_HILL_HM_FLY,
FIXED_ROOM_SOLAR_CAVE_HM_DIVE,
FIXED_ROOM_SOLAR_CAVE_HM_WATERFALL,
FIXED_ROOM_SOLAR_CAVE_HM_SURF,
FIXED_ROOM_FAR_OFF_SEA_TM_WIDE_SLASH,
FIXED_ROOM_FAR_OFF_SEA_TM_VACUUM_CUT,
FIXED_ROOM_MT_FARAWAY_FRIEND_BOW,
FIXED_ROOM_WYVERN_HILL_SUN_RIBBON,
FIXED_ROOM_NORTHWIND_FIELD_LUNAR_RIBBON,
FIXED_ROOM_WESTERN_CAVE_BEAUTY_SCARF,
FIXED_ROOM_BURIED_RELIC_HM_CUT,
FIXED_ROOM_BURIED_RELIC_HM_STRENGTH,
FIXED_ROOM_BURIED_RELIC_HM_FLASH,
FIXED_ROOM_BURIED_RELIC_HM_ROCK_SMASH,
FIXED_ROOM_GRAND_SEA_DEEPSEASCALE,
FIXED_ROOM_WISH_CAVE_WISH_STONE,
FIXED_ROOM_GRAND_SEA_DEEPSEATOOTH
};
#define FIRST_DOJO_MAZE_BOSS_ROOM FIXED_ROOM_NORMAL_MAZE_BOSS
#define LAST_DOJO_MAZE_BOSS_ROOM FIXED_ROOM_RESCUE_TEAM_MAZE_BOSS
#define NUM_MAZE_BOSS_ROOMS LAST_DOJO_MAZE_BOSS_ROOM - FIRST_DOJO_MAZE_BOSS_ROOM
#define LAST_FLOORWIDE_FIXED_ROOM FIXED_ROOM_RESCUE_TEAM_MAZE_BOSS
#define FIRST_NON_FLOORWIDE_FIXED_ROOM LAST_FLOORWIDE_FIXED_ROOM + 1
#endif

View File

@ -1,6 +1,7 @@
#include "global.h"
#include "globaldata.h"
#include "constants/dungeon_exit.h"
#include "constants/fixed_rooms.h"
#include "constants/type.h"
#include "structs/str_pokemon.h"
#include "dungeon_main.h"
@ -44,12 +45,18 @@ bool8 TryRecruitMonster(Entity *attacker, Entity *target)
s32 foundIndex = -1;
s32 size = GetBodySize(targetInfo->apparentID);
if (gDungeon->fixedRoomNumber != 5 && gDungeon->fixedRoomNumber != 4 && gDungeon->fixedRoomNumber != 9 && gDungeon->fixedRoomNumber != 0xf) {
if ((gDungeon->fixedRoomNumber >= 0x2c && gDungeon->fixedRoomNumber <= 0x30)) {
if (gDungeon->fixedRoomNumber != FIXED_ROOM_FROSTY_GROTTO_ARTICUNO
&& gDungeon->fixedRoomNumber != FIXED_ROOM_MT_BLAZE_PEAK_MOLTRES
&& gDungeon->fixedRoomNumber != FIXED_ROOM_WESTERN_CAVE_MEWTWO
&& gDungeon->fixedRoomNumber != FIXED_ROOM_MT_FARAWAY_HO_OH
) {
if (gDungeon->fixedRoomNumber >= FIXED_ROOM_TEAM_SHIFTY_BOSS
&& gDungeon->fixedRoomNumber <= FIXED_ROOM_RESCUE_TEAM_2_BOSS
) {
if (gDungeon->unk644.unk18 == 0)
return FALSE;
}
else if (gDungeon->fixedRoomNumber == 0x31) {
else if (gDungeon->fixedRoomNumber == FIXED_ROOM_RESCUE_TEAM_MAZE_BOSS) {
if (gDungeon->unk644.unk15 == 0)
return FALSE;
if (!sub_8097900(MONSTER_DEOXYS_NORMAL))

View File

@ -1,11 +1,12 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_cutscene.h"
#include "constants/weather.h"
#include "constants/dungeon.h"
#include "constants/direction.h"
#include "constants/dungeon.h"
#include "constants/dungeon_exit.h"
#include "constants/fixed_rooms.h"
#include "constants/weather.h"
#include "structs/str_dungeon.h"
#include "structs/sprite_oam.h"
#include "dungeon_cutscenes.h"
@ -133,8 +134,9 @@ void sub_80847D4(void)
UpdateMinimap();
for(index = 0; index < 0x3e7 && gUnknown_8107234[index].unk0 != 0; index++) {
fixedRoomNumber = gDungeon->fixedRoomNumber;
if (fixedRoomNumber - 0x1c < 0x16) {
fixedRoomNumber = 0x1b;
// Dojo maze bosses all use the same cutscene data
if (fixedRoomNumber - (FIRST_DOJO_MAZE_BOSS_ROOM+1) < NUM_MAZE_BOSS_ROOMS) {
fixedRoomNumber = FIRST_DOJO_MAZE_BOSS_ROOM;
}
if (fixedRoomNumber == gUnknown_8107234[index].unk0)
{

View File

@ -10,6 +10,7 @@
#include "items.h"
#include "pokemon.h"
#include "constants/direction.h"
#include "constants/fixed_rooms.h"
#include "constants/item.h"
#include "constants/monster.h"
#include "structs/str_dungeon.h"
@ -1038,7 +1039,7 @@ static bool8 ProcessFixedRoom(s32 fixedRoomNumber, FloorProperties *floorProps)
GenerateOneRoomMonsterHouseFloor();
return FALSE;
}
else if (fixedRoomNumber < 50) {
else if (fixedRoomNumber < FIRST_NON_FLOORWIDE_FIXED_ROOM) {
sub_8051288(fixedRoomNumber);
return TRUE;
}
@ -5925,7 +5926,7 @@ static void sub_8051288(s32 fixedRoomNumber)
}
}
if (fixedRoomNumber == 4) {
if (fixedRoomNumber == FIXED_ROOM_MT_BLAZE_PEAK_MOLTRES) {
for (y = 5; y < 17; y++) {
for (x = 2; x < 5; x++) {
Tile *tile = GetTileMut(x, y);

View File

@ -19,12 +19,13 @@
#include "dungeon_message.h"
#include "dungeon_message_log.h"
#include "dungeon_logic.h"
#include "constants/dungeon.h"
#include "constants/friend_area.h"
#include "constants/status.h"
#include "constants/ability.h"
#include "constants/dungeon.h"
#include "constants/dungeon_exit.h"
#include "constants/fixed_rooms.h"
#include "constants/friend_area.h"
#include "constants/iq_skill.h"
#include "constants/status.h"
#include "constants/type.h"
#include "constants/weather.h"
#include "code_806CD90.h"
@ -115,7 +116,7 @@ void LoadDungeonPokemonSprites(void)
if(PokemonFlag2Struct2(ptr))
LoadPokemonSprite(ptr->speciesNum, FALSE);
}
if(gDungeon->fixedRoomNumber == 0x31)
if(gDungeon->fixedRoomNumber == FIXED_ROOM_RESCUE_TEAM_MAZE_BOSS)
{
for(index = 0; index < MAX_TEAM_MEMBERS; index++)
{

View File

@ -3,6 +3,7 @@
#include "run_dungeon.h"
#include "constants/dungeon.h"
#include "constants/dungeon_exit.h"
#include "constants/fixed_rooms.h"
#include "constants/monster.h"
#include "constants/trap.h"
#include "structs/rgb.h"
@ -907,7 +908,7 @@ void EnforceMaxItemsAndMoney(void)
bool8 IsBossFight(void)
{
if (gDungeon->fixedRoomNumber != 0 && gDungeon->fixedRoomNumber <= 0x31)
if (gDungeon->fixedRoomNumber != 0 && gDungeon->fixedRoomNumber <= LAST_FLOORWIDE_FIXED_ROOM)
{
return TRUE;
}