diff --git a/include/dungeon.h b/include/dungeon.h new file mode 100644 index 00000000..8179d9ca --- /dev/null +++ b/include/dungeon.h @@ -0,0 +1,1743 @@ +#ifndef HEADERS_TYPES_DUNGEON_MODE_DUNGEON_H_ +#define HEADERS_TYPES_DUNGEON_MODE_DUNGEON_H_ + +#include "enums.h" + +// Dungeon state +struct dungeon { + undefined field_0x0; // 0x0: Initialized to 0x0. + // 0x1: Set to true with mission_destination_info::target_enemy_is_defeated. Used to ensure + // the mission complete message only shows once (ie: "Yes! Knocked out challenger + // [string:1]!". Set to false after the message is shown. + bool target_enemy_defeated_message; + // 0x2: Set to true when the hidden outlaw mission item is dropped. Appears to be used to check + // if the message "Huh?[K] [item:] was dropped![P]Yes![K][string:1] was the outlaw!" should + // be shown when target_enemy_defeated_message is true. + bool hidden_outlaw_defeated_message; + // 0x3: If true and there's an active mission on the floor, the message + // "You've reached a destination floor! But where is the target pokémon..." will be displayed. + bool target_monster_not_found_flag; + undefined field_0x4; + bool stepped_on_stairs; // 0x5: True if the leader just stepped on the stairs. + // 0x6: If equal to 1 or 2, the floor will be advanced at the end of the turn, + // unless the leader fainted. 2 is used for the leader falling through a pitfall + // trap. + u8 end_floor_flag; + // 0x7: If set in tandem with either end_floor_flag or end_floor_no_death_check_flag, + // a quicksave will occur instead of a floor advance. + bool quicksave_flag; + // 0x8: The floor will be advanced at the end of the turn. Set when quicksaving. + bool end_floor_no_death_check_flag; + // 0x9: If this is 0x0 (maybe false), appears to not initialize certain parts of the dungeon. + // Possibly a boolean for when loading from a quicksave or resuming after being rescued? + undefined field_0x9; + undefined field_0xa; + undefined field_0xb; + undefined field_0xc; // 0xC: Initialized to 0x0 + undefined field_0xd; // 0xD: Initialized to 0x0 + // 0xE: If true, artificial weather abilities will be activated on this turn. + // Set to false by TryActivateArtificialWeatherAbilities + bool activate_artificial_weather_flag; + // 0xF: True if an enemy has defeated an ally on this turn and should evolve as a result + // May also have a niche usage if an enemy gets enough experience to level up through + // something like the Joy Ribbon? + bool should_enemy_evolve; + undefined field_0x10; // 0x10: Initialized to 0x0. + // 0x11: True if the leader isn't doing anything right now. False if it's currently performing + // an action (such as walking or attacking) + bool no_action_in_progress; + bool iq_disabled; // 0x12: IQ skills won't work in the dungeon. + bool regular_attack_reveal_traps; // 0x13: Regular attacks will reveal traps. + // 0x14: If > 0, you get kicked out of the dungeon, usually because an important team member + // (such as your client) fainted. + enum forced_loss_reason forced_loss_reason; + // 0x18: Appears to be set to 1 when using the escape orb and set to 2 when completing + // a mission. dungeon::end_floor_no_death_check_flag gets set whenever this is changed. + u32 successful_exit_tracker; + // 0x1C: Increased once per frame until 0x64. Resets to 0 when the leader acts. + undefined field_0x1c; + undefined field_0x1d; + // 0x1E: Number of floors completed? (Guess). Initialized to 0. + // If this is a floor tracker, odd it is not a u16 like the others. + u8 number_completed_floors; + // 0x1F: Turn counter, Speed Boost triggers every 250 turns, then the counter is reset. + u8 speed_boost_counter; + // 0x20: Total amount of floors summed by all the previous dungeons in its group + u16 number_preceding_floors; + // 0x22: Total amount of floors passed including those in its group? (Guess) + // Set to dungeon::number_preceding_floors + dungeon::number_completed_floors + u16 total_floors_completed; + undefined field_0x24; + undefined field_0x25; + undefined field_0x26; + undefined field_0x27; + undefined field_0x28; + undefined field_0x29; + undefined field_0x2a; + undefined field_0x2b; + undefined field_0x2c; + undefined field_0x2d; + undefined field_0x2e; + undefined field_0x2f; + undefined field_0x30; + undefined field_0x31; + undefined field_0x32; + undefined field_0x33; + undefined field_0x34; + undefined field_0x35; + undefined field_0x36; + undefined field_0x37; + undefined field_0x38; + undefined field_0x39; + undefined field_0x3a; + undefined field_0x3b; + undefined field_0x3c; + undefined field_0x3d; + undefined field_0x3e; + undefined field_0x3f; + undefined field_0x40; + undefined field_0x41; + undefined field_0x42; + undefined field_0x43; + undefined field_0x44; + undefined field_0x45; + undefined field_0x46; + undefined field_0x47; + undefined field_0x48; + undefined field_0x49; + undefined field_0x4a; + undefined field_0x4b; + undefined field_0x4c; + undefined field_0x4d; + undefined field_0x4e; + undefined field_0x4f; + undefined field_0x50; + undefined field_0x51; + undefined field_0x52; + undefined field_0x53; + undefined field_0x54; + undefined field_0x55; + undefined field_0x56; + undefined field_0x57; + undefined field_0x58; + undefined field_0x59; + undefined field_0x5a; + undefined field_0x5b; + undefined field_0x5c; + undefined field_0x5d; + undefined field_0x5e; + undefined field_0x5f; + undefined field_0x60; + undefined field_0x61; + undefined field_0x62; + undefined field_0x63; + undefined field_0x64; + undefined field_0x65; + undefined field_0x66; + undefined field_0x67; + undefined field_0x68; + undefined field_0x69; + undefined field_0x6a; + undefined field_0x6b; + undefined field_0x6c; + undefined field_0x6d; + undefined field_0x6e; + undefined field_0x6f; + undefined field_0x70; + undefined field_0x71; + undefined field_0x72; + undefined field_0x73; + undefined field_0x74; + undefined field_0x75; + undefined field_0x76; + undefined field_0x77; + undefined field_0x78; + undefined field_0x79; + undefined field_0x7a; + undefined field_0x7b; + undefined field_0x7c; + undefined field_0x7d; + undefined field_0x7e; + undefined field_0x7f; + undefined field_0x80; + undefined field_0x81; + undefined field_0x82; + undefined field_0x83; + undefined field_0x84; + undefined field_0x85; + undefined field_0x86; + undefined field_0x87; + undefined field_0x88; + undefined field_0x89; + undefined field_0x8a; + undefined field_0x8b; + undefined field_0x8c; + undefined field_0x8d; + undefined field_0x8e; + undefined field_0x8f; + undefined field_0x90; + undefined field_0x91; + undefined field_0x92; + undefined field_0x93; + undefined field_0x94; + undefined field_0x95; + undefined field_0x96; + undefined field_0x97; + undefined field_0x98; + undefined field_0x99; + undefined field_0x9a; + undefined field_0x9b; + undefined field_0x9c; + undefined field_0x9d; + undefined field_0x9e; + undefined field_0x9f; + undefined field_0xa0; + undefined field_0xa1; + undefined field_0xa2; + undefined field_0xa3; + undefined field_0xa4; + undefined field_0xa5; + undefined field_0xa6; + undefined field_0xa7; + undefined field_0xa8; + undefined field_0xa9; + undefined field_0xaa; + undefined field_0xab; + undefined field_0xac; + undefined field_0xad; + undefined field_0xae; + undefined field_0xaf; + undefined field_0xb0; + undefined field_0xb1; + undefined field_0xb2; + undefined field_0xb3; + undefined field_0xb4; + undefined field_0xb5; + undefined field_0xb6; + undefined field_0xb7; + undefined field_0xb8; + undefined field_0xb9; + undefined field_0xba; + undefined field_0xbb; + undefined field_0xbc; + undefined field_0xbd; + undefined field_0xbe; + undefined field_0xbf; + undefined field_0xc0; + undefined field_0xc1; + undefined field_0xc2; + undefined field_0xc3; + // 0xC4: Pointer to the entity that is taking its turn right now + struct entity* current_active_entity; + // 0xC8: Pointer to the monster that will become the leader of the team after changing leaders + struct entity* new_leader; + // 0xCC: Entity struct of the item that was just thrown or dropped + struct entity thrown_item; + // 0x184: Info about the most recent damage calculation. Reset with each call to CalcDamage + struct damage_calc_diag last_damage_calc; + // 0x1D8: Somehow related to executing a monster's actions (including leader). + // Initialized to 0xFFFF + undefined2 field_0x1d8; + // 0x1DA: Somehow related to executing the leader's actions. Also maybe when leader opens + // some menus? Initialized to 0xFFFF + undefined2 field_0x1da; + undefined2 field_0x1dc; // 0x1DC: Initialized to 0xFFFF + undefined2 field_0x1de; // 0x1DE: Initialized to 0xFFFF + // 0x1E0: Color table. Used to apply a tint to the colors shown on screen. + // Changes depending on the current weather. + struct rgba color_table[256]; + // 0x5E0: Data for Kecleon shopkeeper spawns. It's weird that there's room for more than one; + // it seems like only the first entry should ever be filled + struct spawned_shopkeeper_data shopkeeper_spawns[8]; + // 0x610: Number of valid shopkeeper spawns + int shopkeeper_spawn_count; + undefined4 field_0x614; + // 0x618: Something related to animiations? Could be ID? + undefined4 unk1_animation1_value; + undefined4 unk2_animation1_value; + undefined4 unk3_animation1_value; + struct entity* animation1_entity; // 0x624: Monster pointer for the animation? + // 0x628: Something related to animiations? Could be ID? + undefined4 unk1_animation2_value; + undefined4 unk2_animation2_value; + undefined4 unk3_animation2_value; + struct entity* animation2_entity; // 0x634: Monster pointer for the animation? + // 0x638: Something related to animiations? Could be ID? + undefined4 unk1_animation3_value; + undefined4 unk2_animation3_value; + undefined4 unk3_animation3_value; + struct entity* animation3_entity; // 0x644: Monster pointer for the animation? + // 0x648: Some type of monster name related to fainting. Used for the partner, escort or + // accompanying monster, but may be be changed when any monster faints (but might not be + // used for them). + char unk_fainted_monster_name[10]; + undefined field_0x652; + undefined field_0x653; + undefined field_0x654; + undefined field_0x655; + undefined field_0x656; + undefined field_0x657; + undefined field_0x658; + undefined field_0x659; + undefined field_0x65a; + undefined field_0x65b; + undefined field_0x65c; + undefined field_0x65d; + undefined field_0x65e; + undefined field_0x65f; + undefined field_0x660; + undefined field_0x661; + undefined field_0x662; + undefined field_0x663; + undefined field_0x664; + undefined field_0x665; + undefined field_0x666; + undefined field_0x667; + undefined field_0x668; + undefined field_0x669; + undefined field_0x66a; + undefined field_0x66b; + undefined field_0x66c; + undefined field_0x66d; + undefined field_0x66e; + undefined field_0x66f; + undefined field_0x670; + undefined field_0x671; + undefined field_0x672; + undefined field_0x673; + undefined field_0x674; + undefined field_0x675; + undefined field_0x676; + undefined field_0x677; + undefined field_0x678; + undefined field_0x679; + undefined field_0x67a; + undefined field_0x67b; + undefined field_0x67c; + undefined field_0x67d; + undefined field_0x67e; + undefined field_0x67f; + undefined field_0x680; + undefined field_0x681; + undefined field_0x682; + undefined field_0x683; + undefined field_0x684; + undefined field_0x685; + undefined field_0x686; + undefined field_0x687; + undefined field_0x688; + undefined field_0x689; + undefined field_0x68a; + undefined field_0x68b; + undefined field_0x68c; + undefined field_0x68d; + undefined field_0x68e; + undefined field_0x68f; + undefined field_0x690; + undefined field_0x691; + undefined field_0x692; + undefined field_0x693; + undefined field_0x694; + undefined field_0x695; + undefined field_0x696; + undefined field_0x697; + undefined field_0x698; + undefined field_0x699; + undefined field_0x69a; + undefined field_0x69b; + undefined field_0x69c; + undefined field_0x69d; + undefined field_0x69e; + undefined field_0x69f; + undefined field_0x6a0; + undefined field_0x6a1; + undefined field_0x6a2; + undefined field_0x6a3; + undefined field_0x6a4; + undefined field_0x6a5; + undefined field_0x6a6; + undefined field_0x6a7; + undefined field_0x6a8; + undefined field_0x6a9; + undefined field_0x6aa; + undefined field_0x6ab; + undefined field_0x6ac; + undefined field_0x6ad; + undefined field_0x6ae; + undefined field_0x6af; + undefined field_0x6b0; + undefined field_0x6b1; + undefined field_0x6b2; + undefined field_0x6b3; + undefined field_0x6b4; + undefined field_0x6b5; + undefined field_0x6b6; + undefined field_0x6b7; + undefined field_0x6b8; + undefined field_0x6b9; + undefined field_0x6ba; + undefined field_0x6bb; + undefined field_0x6bc; + undefined field_0x6bd; + undefined field_0x6be; + undefined field_0x6bf; + undefined field_0x6c0; + undefined field_0x6c1; + undefined field_0x6c2; + undefined field_0x6c3; + undefined field_0x6c4; + undefined field_0x6c5; + undefined field_0x6c6; + undefined field_0x6c7; + undefined field_0x6c8; + undefined field_0x6c9; + undefined field_0x6ca; + undefined field_0x6cb; + undefined field_0x6cc; + undefined field_0x6cd; + undefined field_0x6ce; + undefined field_0x6cf; + undefined field_0x6d0; + undefined field_0x6d1; + undefined field_0x6d2; + undefined field_0x6d3; + undefined field_0x6d4; + undefined field_0x6d5; + undefined field_0x6d6; + undefined field_0x6d7; + undefined field_0x6d8; + undefined field_0x6d9; + undefined field_0x6da; + undefined field_0x6db; + undefined field_0x6dc; + undefined field_0x6dd; + undefined field_0x6de; + undefined field_0x6df; + undefined field_0x6e0; + undefined field_0x6e1; + undefined field_0x6e2; + undefined field_0x6e3; + undefined field_0x6e4; + undefined field_0x6e5; + undefined field_0x6e6; + undefined field_0x6e7; + undefined field_0x6e8; + undefined field_0x6e9; + undefined field_0x6ea; + undefined field_0x6eb; + undefined field_0x6ec; + undefined field_0x6ed; + undefined field_0x6ee; + undefined field_0x6ef; + undefined field_0x6f0; + undefined field_0x6f1; + undefined field_0x6f2; + undefined field_0x6f3; + undefined field_0x6f4; + undefined field_0x6f5; + undefined field_0x6f6; + undefined field_0x6f7; + undefined field_0x6f8; + undefined field_0x6f9; + undefined field_0x6fa; + undefined field_0x6fb; + undefined field_0x6fc; + undefined field_0x6fd; + undefined field_0x6fe; + undefined field_0x6ff; + undefined field_0x700; + undefined field_0x701; + undefined field_0x702; + undefined field_0x703; + undefined field_0x704; + undefined field_0x705; + undefined field_0x706; + undefined field_0x707; + undefined field_0x708; + undefined field_0x709; + undefined field_0x70a; + undefined field_0x70b; + undefined field_0x70c; + undefined field_0x70d; + undefined field_0x70e; + undefined field_0x70f; + undefined field_0x710; + undefined field_0x711; + undefined field_0x712; + undefined field_0x713; + undefined field_0x714; + undefined field_0x715; + undefined field_0x716; + undefined field_0x717; + undefined field_0x718; + undefined field_0x719; + undefined field_0x71a; + undefined field_0x71b; + undefined field_0x71c; + undefined field_0x71d; + undefined field_0x71e; + undefined field_0x71f; + undefined field_0x720; + undefined field_0x721; + undefined field_0x722; + undefined field_0x723; + undefined field_0x724; + undefined field_0x725; + undefined field_0x726; + undefined field_0x727; + undefined field_0x728; + undefined field_0x729; + undefined field_0x72a; + undefined field_0x72b; + undefined field_0x72c; + undefined field_0x72d; + undefined field_0x72e; + undefined field_0x72f; + undefined field_0x730; + undefined field_0x731; + undefined field_0x732; + undefined field_0x733; + undefined field_0x734; + undefined field_0x735; + undefined field_0x736; + undefined field_0x737; + undefined field_0x738; + undefined field_0x739; + undefined field_0x73a; + undefined field_0x73b; + undefined field_0x73c; + undefined field_0x73d; + undefined field_0x73e; + undefined field_0x73f; + undefined field_0x740; + undefined field_0x741; + undefined field_0x742; + undefined field_0x743; + undefined field_0x744; + undefined field_0x745; + undefined field_0x746; + undefined field_0x747; + // 0x748: Current dungeon ID. Is actually a dungeon_floor_pair struct that also contains + // the floor number. + enum dungeon_id id; + u8 floor; // 0x749: Current floor number + enum dungeon_group_id group_id; // 0x74A: Same for different segments of a dungeon + undefined field_0x74b; + // 0x74C: Used as an input to GetDungeonMode, and uses output to determine if the + // override fixed room should be loaded? + undefined2 field_0x74c; + undefined field_0x74e; + undefined field_0x74f; + // 0x750: A ldr instruction is used at this address? Maybe used for something else before + // the rescue floor number is set? + undefined field_0x750; + u8 rescue_floor; // 0x751: Floor number where the rescue point is, if applicable + undefined field_0x752; + undefined field_0x753; + // 0x754: Should also be prng_pressed_23_bit? dungeon_init::prng_preseed_23_bit gets copied + // here, but might not be used? + u32 prng_preseed_23_bit; + // 0x758: Whether the current floor should continue or end and why + enum floor_loop_status floor_loop_status; + bool recruiting_enabled; // 0x759: Recruitment is allowed in this dungeon + // 0x75A: If this is 0, the game wont use GetMonsterEvoStatus when gathering information for + // the monster's summary (in stuff like the team menu). + undefined field_0x75a; + // 0x75B: When the dungeon is initialized this value gets forced to true. Likely because this + // effect seems incomplete. When false the game will stop items from being added to the bag + // but monsters are still alloweed to hold onto items normally. However, it does not seem to + // properly add items picked up by team members to the treasure bag (making it impossible to + // remove through the item menu). Additionally, items already in the bag can be used normally? + bool bag_enabled; + bool nonstory_flag; // 0x75C: Allows leader changing and continuing without the partner + bool send_home_disabled; // 0x75D: Sending teammates home is not allowed in this dungeon + // 0x75E: Disables sending home/leader changing, lose if partner faints. Set for dungeons + // between DUNGEON_HIDDEN_LAND and DUNGEON_TEMPORAL_PINNACLE. + bool hidden_land_flag; + // 0x75F: If true, the message log won't be shown and the yellow beam animation won't + // appear over team members after the leader faints. It's enabled for dungeons where you don't + // get penalized for fainting, but it's not used to perform that check. + bool skip_faint_animation_flag; + // 0x760: Info about the next mission destination floor, if applicable + struct mission_destination_info mission_destination; + undefined field_0x77c; + undefined field_0x77d; + // 0x77E: Appears to track if the player has already been healed by Mime Jr. to change + // the dialogue. Initialized to 0 using MemZero? + bool bazaar_mime_jr_heal; + undefined field_0x77f; + // 0x780: Controls when a monster at a certain speed stage is able to act. + // Increased by 1-4 each turn, depending on the team leader's speed level: + // At normal speed, this will tick up by 4 each turn (can act when x % 4 == 3) + // At +1 speed, ticks up by 2 each turn (can act when x % 2 == 1) + // At +2 speed, ticks up by 1 or 2 each turn (can act when x % 4 != 0) + // At +3 speed, ticks up by 1 each turn (an act every tick) + // The counter is increased modulo 24, goes from 0x00 to 0x17 then starts over + u16 fractional_turn; + u16 enemy_spawn_counter; // 0x782: Counts from 0-35, spawns happen at 0 + s16 wind_turns; // 0x784: Countdown to the wind blowing you out of the dungeon + u16 enemy_density; // 0x786: If 0, prevents the enemy_spawn_counter for increasing + // 0x788: The genid of the next monster to be spawned. Ticks up with each spawn. + u16 next_spawn_genid; + undefined field_0x78a; // 0x78A: Initialized to 0x0. + // 0x78B: True if the leader is running. Causes the leader's action for the next turn + // to be set to action::ACTION_WALK until it hits an obstacle. + bool leader_running; + // 0x78C: Likely related to the actions of the leader because it is set to 0 in + // SetLeaderAction and this value gets bitwise or'd with 0x78B and then saved back to here. + undefined field_0x78c; + // 0x78D: This flag is set by the move 0x189 ("HP Gauge") which is the + // effect of the Identify Orb. If true, monsters not in the team that are + // holding an item will be marked by a blue exclamation mark icon. + bool identify_orb_flag; + bool pass_turn; // 0x78E: True if the leader has chosen to pass its turn + bool drought_orb_flag; // 0x78F: True if a drought orb has been used. + bool thief_alert; // 0x790: If you've stolen from Kecleon (actual dungeon state) + // 0x791: If you've stolen from Kecleon (triggers music and other events?) + bool thief_alert_event; + // 0x792: Can only be 0,1,2,3,4. Controls when to play certain special music tracks 0x7C + // (1), 0x7D (2), 0xA8 (3), 0xA9 (4). Used by the Gone Pebbble to play track 0xA8, + // challenge letter missions to play track 0x7C and dungeon failure to play 0xA9? + u8 unk_music_flag; + bool monster_house_triggered; // 0x793: You Entered a Monster House (actual dungeon state) + // 0x794: You entered a Monster House (triggers music and other events?) + bool monster_house_triggered_event; + undefined field_0x795; + // 0x796: Seems to often be 0x3E7 (999)? Somehow related to controlling or managing the + // playing music? + undefined2 field_0x796; + enum dungeon_objective dungeon_objective; // 0x798: Objective of the current dungeon + // 0x799: Determines which message to display when the leader's belly reaches 0. Goes up + // to 0x9 (9), but only displays a unique message for 0x1, 0x2, and 0x3. + u8 leader_hunger_message_tracker; + // 0x79A: Keeps track of which animation/message to display as the turn limit ticks down. This + // ensures that even if the number of turns given to a player is less than the number where an + // animation would play, it will still play. + u8 turn_limit_warning_tracker; + // 0x79B: Number of times you can be rescued in this dungeon + s8 rescue_attempts_left; + u32 prng_seed; // 0x79C: The dungeon PRNG seed, if set + u32 rescue_prng_preseed_23_bit; // 0x7A0: The 23 bit dungeon PRNG preseed for rescues? + undefined2 field_0x7a4; // 0x7A4: Initialized to 0x63. + undefined2 field_0x7a6; // 0x7A6: Initialized to 0x63. + // 0x7A8: Holds some data for a monster id to loads its sprite. If this value is non-zero, + // it gets loaded after loading the dungeon floor monster spawn entries. Maybe for monsters + // that need a specific item to spawn? + enum monster_id some_monster_sprite_to_load; + u8 some_monster_level; // 0x7AA: The level for dungeon::some_monster_sprite_to_load? + undefined field_0x7ab; + // 0x7AC: Second number in the default LCG sequence, used for computing the actual dungeon PRNG + // seed + u32 prng_preseed; + undefined field_0x7b0; + undefined field_0x7b1; + undefined field_0x7b2; + undefined field_0x7b3; + undefined field_0x7b4; + undefined field_0x7b5; + undefined field_0x7b6; + undefined field_0x7b7; + undefined field_0x7b8; + undefined field_0x7b9; + undefined field_0x7ba; + undefined field_0x7bb; + // 0x7BC: The amount of poke the items being bought are worth (By the player)? + u32 poke_buy_kecleon_shop; + // 0x7C0: The amount of poke the items being sold are worth (By the player)? + u32 poke_sold_kecleon_shop; + // 0x7C4: Uncertain what this tracks? This is definitely related to + // dungeon::poke_buy_kecleon_shop. Sometimes subtract dungeon::poke_buy_kecleon_shop from + // this, set this to dungeon::poke_buy_kecleon_shop, and sometimes compared to + // dungeon::poke_buy_kecleon_shop. + u32 unk_poke_kecleon_shop_tracker; + // 0x7C8: Leader standing on a Kecleon shop tile? + bool leader_standing_in_kecleon_shop; + // 0x7C9: You entered a Kecleon Shop (triggers music and maybe more?) + bool standing_in_kecleon_shop; + undefined field_0x7ca; + undefined field_0x7cb; + // 0x7CC: Controls which mappa file (Time/Darkness/Sky) to load for a dungeon. When time and + // darkness are selected their respective mappa files are loaded, the hidden stairs type + // will always return 0, treasure boxes will generate with only exclusive items that exist + // in time/darkness, use a multiple of 0x28 (40) for poke. If sky is selected, causes + // waza_p2.bin to be loaded over waza_p.bin. Because waza_p.bin is initally loaded into + // the move table and the check to load waza_p2.bin is later, waza_p2.bin can be deleted + // without causing the game to crash as the data from waza_p.bin is still loaded because + // it's not overwritten by loading waza_p2.bin + enum game_id dungeon_game_version_id; + // 0x7D0: Maybe a pointer to a spawn list or related to a spawn list? + // Possibly a 0x8 long array of a struct-like object? Each entry is 4 bytes, but maybe the + // last byte is unused?? + undefined field_0x7d0; + undefined field_0x7d1; + undefined field_0x7d2; + undefined field_0x7d3; + undefined field_0x7d4; + undefined field_0x7d5; + undefined field_0x7d6; + undefined field_0x7d7; + undefined field_0x7d8; + undefined field_0x7d9; + undefined field_0x7da; + undefined field_0x7db; + undefined field_0x7dc; + undefined field_0x7dd; + undefined field_0x7de; + undefined field_0x7df; + undefined field_0x7e0; + undefined field_0x7e1; + undefined field_0x7e2; + undefined field_0x7e3; + undefined field_0x7e4; + undefined field_0x7e5; + undefined field_0x7e6; + undefined field_0x7e7; + undefined field_0x7e8; + undefined field_0x7e9; + undefined field_0x7ea; + undefined field_0x7eb; + undefined field_0x7ec; + undefined field_0x7ed; + undefined field_0x7ee; + undefined field_0x7ef; + // 0x7F0: Somehow related to dungeon::0x7D0? + undefined2 field_0x7f0; + // 0x7F2: May always just be a copy of dungeon::some_monster_sprite_to_load, but may also + // have another purpose. + enum monster_id some_monster_sprite; + struct monster monsters[20]; // 0x7F4: Info for all the monsters currently in the dungeon + // 0x34F4: Array that contains the spawn stats for enemies, which are only calculated + // once at the start of the floor. + // Since the enemy spawn list of a floor can only have a maximum of 16 entries, + // the remaining 48 are unused. + struct enemy_spawn_stats enemy_spawn_stats[64]; + // 0x3974: Monsters that can be spawned on the floor. + // Read when spawning enemies, at initialization the one at 0x2C964 is used. + // The number of valid entries is stored in monster_spawn_table_length. + // The last 2 entries of the table are always Kecleon (0x17F) and the dummy (0x229). + struct monster_spawn_entry spawn_entries[16]; + undefined field_0x39f4; + undefined field_0x39f5; + undefined field_0x39f6; + undefined field_0x39f7; + undefined field_0x39f8; + undefined field_0x39f9; + undefined field_0x39fa; + undefined field_0x39fb; + undefined field_0x39fc; + undefined field_0x39fd; + undefined field_0x39fe; + undefined field_0x39ff; + undefined field_0x3a00; + undefined field_0x3a01; + undefined field_0x3a02; + undefined field_0x3a03; + undefined field_0x3a04; + undefined field_0x3a05; + undefined field_0x3a06; + undefined field_0x3a07; + undefined field_0x3a08; + undefined field_0x3a09; + undefined field_0x3a0a; + undefined field_0x3a0b; + undefined field_0x3a0c; + undefined field_0x3a0d; + undefined field_0x3a0e; + undefined field_0x3a0f; + undefined field_0x3a10; + undefined field_0x3a11; + undefined field_0x3a12; + undefined field_0x3a13; + undefined field_0x3a14; + undefined field_0x3a15; + undefined field_0x3a16; + undefined field_0x3a17; + undefined field_0x3a18; + undefined field_0x3a19; + undefined field_0x3a1a; + undefined field_0x3a1b; + undefined field_0x3a1c; + undefined field_0x3a1d; + undefined field_0x3a1e; + undefined field_0x3a1f; + undefined field_0x3a20; + undefined field_0x3a21; + undefined field_0x3a22; + undefined field_0x3a23; + undefined field_0x3a24; + undefined field_0x3a25; + undefined field_0x3a26; + undefined field_0x3a27; + undefined field_0x3a28; + undefined field_0x3a29; + undefined field_0x3a2a; + undefined field_0x3a2b; + undefined field_0x3a2c; + undefined field_0x3a2d; + undefined field_0x3a2e; + undefined field_0x3a2f; + undefined field_0x3a30; + undefined field_0x3a31; + undefined field_0x3a32; + undefined field_0x3a33; + undefined field_0x3a34; + undefined field_0x3a35; + undefined field_0x3a36; + undefined field_0x3a37; + undefined field_0x3a38; + undefined field_0x3a39; + undefined field_0x3a3a; + undefined field_0x3a3b; + undefined field_0x3a3c; + undefined field_0x3a3d; + undefined field_0x3a3e; + undefined field_0x3a3f; + undefined field_0x3a40; + undefined field_0x3a41; + undefined field_0x3a42; + undefined field_0x3a43; + undefined field_0x3a44; + undefined field_0x3a45; + undefined field_0x3a46; + undefined field_0x3a47; + undefined field_0x3a48; + undefined field_0x3a49; + undefined field_0x3a4a; + undefined field_0x3a4b; + undefined field_0x3a4c; + undefined field_0x3a4d; + undefined field_0x3a4e; + undefined field_0x3a4f; + undefined field_0x3a50; + undefined field_0x3a51; + undefined field_0x3a52; + undefined field_0x3a53; + undefined field_0x3a54; + undefined field_0x3a55; + undefined field_0x3a56; + undefined field_0x3a57; + undefined field_0x3a58; + undefined field_0x3a59; + undefined field_0x3a5a; + undefined field_0x3a5b; + undefined field_0x3a5c; + undefined field_0x3a5d; + undefined field_0x3a5e; + undefined field_0x3a5f; + undefined field_0x3a60; + undefined field_0x3a61; + undefined field_0x3a62; + undefined field_0x3a63; + undefined field_0x3a64; + undefined field_0x3a65; + undefined field_0x3a66; + undefined field_0x3a67; + undefined field_0x3a68; + undefined field_0x3a69; + undefined field_0x3a6a; + undefined field_0x3a6b; + undefined field_0x3a6c; + undefined field_0x3a6d; + undefined field_0x3a6e; + undefined field_0x3a6f; + undefined field_0x3a70; + undefined field_0x3a71; + undefined field_0x3a72; + undefined field_0x3a73; + undefined field_0x3a74; + undefined field_0x3a75; + undefined field_0x3a76; + undefined field_0x3a77; + undefined field_0x3a78; + undefined field_0x3a79; + undefined field_0x3a7a; + undefined field_0x3a7b; + undefined field_0x3a7c; + undefined field_0x3a7d; + undefined field_0x3a7e; + undefined field_0x3a7f; + undefined field_0x3a80; + undefined field_0x3a81; + undefined field_0x3a82; + undefined field_0x3a83; + undefined field_0x3a84; + undefined field_0x3a85; + undefined field_0x3a86; + undefined field_0x3a87; + undefined field_0x3a88; + undefined field_0x3a89; + undefined field_0x3a8a; + undefined field_0x3a8b; + undefined field_0x3a8c; + undefined field_0x3a8d; + undefined field_0x3a8e; + undefined field_0x3a8f; + undefined field_0x3a90; + undefined field_0x3a91; + undefined field_0x3a92; + undefined field_0x3a93; + undefined field_0x3a94; + undefined field_0x3a95; + undefined field_0x3a96; + undefined field_0x3a97; + undefined field_0x3a98; + undefined field_0x3a99; + undefined field_0x3a9a; + undefined field_0x3a9b; + undefined field_0x3a9c; + undefined field_0x3a9d; + undefined field_0x3a9e; + undefined field_0x3a9f; + undefined field_0x3aa0; + undefined field_0x3aa1; + undefined field_0x3aa2; + undefined field_0x3aa3; + undefined field_0x3aa4; + undefined field_0x3aa5; + undefined field_0x3aa6; + undefined field_0x3aa7; + undefined field_0x3aa8; + undefined field_0x3aa9; + undefined field_0x3aaa; + undefined field_0x3aab; + undefined field_0x3aac; + undefined field_0x3aad; + undefined field_0x3aae; + undefined field_0x3aaf; + undefined field_0x3ab0; + undefined field_0x3ab1; + undefined field_0x3ab2; + undefined field_0x3ab3; + undefined field_0x3ab4; + undefined field_0x3ab5; + undefined field_0x3ab6; + undefined field_0x3ab7; + undefined field_0x3ab8; + undefined field_0x3ab9; + undefined field_0x3aba; + undefined field_0x3abb; + undefined field_0x3abc; + undefined field_0x3abd; + undefined field_0x3abe; + undefined field_0x3abf; + undefined field_0x3ac0; + undefined field_0x3ac1; + undefined field_0x3ac2; + undefined field_0x3ac3; + undefined field_0x3ac4; + undefined field_0x3ac5; + undefined field_0x3ac6; + undefined field_0x3ac7; + undefined field_0x3ac8; + undefined field_0x3ac9; + undefined field_0x3aca; + undefined field_0x3acb; + undefined field_0x3acc; + undefined field_0x3acd; + undefined field_0x3ace; + undefined field_0x3acf; + undefined field_0x3ad0; + undefined field_0x3ad1; + undefined field_0x3ad2; + undefined field_0x3ad3; + undefined field_0x3ad4; + undefined field_0x3ad5; + undefined field_0x3ad6; + undefined field_0x3ad7; + undefined field_0x3ad8; + undefined field_0x3ad9; + undefined field_0x3ada; + undefined field_0x3adb; + undefined field_0x3adc; + undefined field_0x3add; + undefined field_0x3ade; + undefined field_0x3adf; + undefined field_0x3ae0; + undefined field_0x3ae1; + undefined field_0x3ae2; + undefined field_0x3ae3; + undefined field_0x3ae4; + undefined field_0x3ae5; + undefined field_0x3ae6; + undefined field_0x3ae7; + undefined field_0x3ae8; + undefined field_0x3ae9; + undefined field_0x3aea; + undefined field_0x3aeb; + undefined field_0x3aec; + undefined field_0x3aed; + undefined field_0x3aee; + undefined field_0x3aef; + undefined field_0x3af0; + undefined field_0x3af1; + undefined field_0x3af2; + undefined field_0x3af3; + undefined field_0x3af4; + undefined field_0x3af5; + undefined field_0x3af6; + undefined field_0x3af7; + undefined field_0x3af8; + undefined field_0x3af9; + undefined field_0x3afa; + undefined field_0x3afb; + undefined field_0x3afc; + undefined field_0x3afd; + undefined field_0x3afe; + undefined field_0x3aff; + undefined field_0x3b00; + undefined field_0x3b01; + undefined field_0x3b02; + undefined field_0x3b03; + undefined field_0x3b04; + undefined field_0x3b05; + undefined field_0x3b06; + undefined field_0x3b07; + undefined field_0x3b08; + undefined field_0x3b09; + undefined field_0x3b0a; + undefined field_0x3b0b; + undefined field_0x3b0c; + undefined field_0x3b0d; + undefined field_0x3b0e; + undefined field_0x3b0f; + undefined field_0x3b10; + undefined field_0x3b11; + undefined field_0x3b12; + undefined field_0x3b13; + undefined field_0x3b14; + undefined field_0x3b15; + undefined field_0x3b16; + undefined field_0x3b17; + undefined field_0x3b18; + undefined field_0x3b19; + undefined field_0x3b1a; + undefined field_0x3b1b; + undefined field_0x3b1c; + undefined field_0x3b1d; + undefined field_0x3b1e; + undefined field_0x3b1f; + undefined field_0x3b20; + undefined field_0x3b21; + undefined field_0x3b22; + undefined field_0x3b23; + undefined field_0x3b24; + undefined field_0x3b25; + undefined field_0x3b26; + undefined field_0x3b27; + undefined field_0x3b28; + undefined field_0x3b29; + undefined field_0x3b2a; + undefined field_0x3b2b; + undefined field_0x3b2c; + undefined field_0x3b2d; + undefined field_0x3b2e; + undefined field_0x3b2f; + undefined field_0x3b30; + undefined field_0x3b31; + undefined field_0x3b32; + undefined field_0x3b33; + undefined field_0x3b34; + undefined field_0x3b35; + undefined field_0x3b36; + undefined field_0x3b37; + undefined field_0x3b38; + undefined field_0x3b39; + undefined field_0x3b3a; + undefined field_0x3b3b; + undefined field_0x3b3c; + undefined field_0x3b3d; + undefined field_0x3b3e; + undefined field_0x3b3f; + undefined field_0x3b40; + undefined field_0x3b41; + undefined field_0x3b42; + undefined field_0x3b43; + undefined field_0x3b44; + undefined field_0x3b45; + undefined field_0x3b46; + undefined field_0x3b47; + undefined field_0x3b48; + undefined field_0x3b49; + undefined field_0x3b4a; + undefined field_0x3b4b; + undefined field_0x3b4c; + undefined field_0x3b4d; + undefined field_0x3b4e; + undefined field_0x3b4f; + undefined field_0x3b50; + undefined field_0x3b51; + undefined field_0x3b52; + undefined field_0x3b53; + undefined field_0x3b54; + undefined field_0x3b55; + undefined field_0x3b56; + undefined field_0x3b57; + undefined field_0x3b58; + undefined field_0x3b59; + undefined field_0x3b5a; + undefined field_0x3b5b; + undefined field_0x3b5c; + undefined field_0x3b5d; + undefined field_0x3b5e; + undefined field_0x3b5f; + undefined field_0x3b60; + undefined field_0x3b61; + undefined field_0x3b62; + undefined field_0x3b63; + undefined field_0x3b64; + undefined field_0x3b65; + undefined field_0x3b66; + undefined field_0x3b67; + undefined field_0x3b68; + undefined field_0x3b69; + undefined field_0x3b6a; + undefined field_0x3b6b; + undefined field_0x3b6c; + undefined field_0x3b6d; + undefined field_0x3b6e; + undefined field_0x3b6f; + undefined field_0x3b70; + undefined field_0x3b71; + undefined field_0x3b72; + undefined field_0x3b73; + // 0x3B74: Unknown array, likely one entry per monster species. This might be related to + // the IQ skill Exp. Go-Getter so the AI knows which monsters to prioritize. + u8 unknown_array_0x3B74[600]; + // 0x3DCC: Appears to be a table that holds the statuses::statuses_unique_id value for + // the monsters. Maybe just for convenience to avoid loading it from every monster? + u32 monster_unique_id[20]; + // 0x3E1C: Appears to be be an index inside or length for + // dungeon::active_monsters_unique_statuses_ids. + u32 unique_id_index; + // 0x3E20: Number of valid monster spawn entries (see spawn_entries). + int monster_spawn_entries_length; + undefined field_0x3e24; + undefined field_0x3e25; + undefined field_0x3e26; + undefined field_0x3e27; + // 0x3E28: Related in some way to the spawn entries on the floor. Does something about them + // if false, then set to true. + bool unk_spawn_entry_id_check; + undefined field_0x3e29; + undefined field_0x3e2a; + undefined field_0x3e2b; + // 0x3E2C: Appears to be a counter that is saved into statuses::unique_id so that every + // monster has a different id for tracking statuses such as Leech Seed and Destiny Bond, and the + // abilities Storm Drain and Lightning Rod. Initialized to 0x400 (1024) + u32 monster_unique_id_counter; + // 0x3E30: Appears to to be a counter that is used for both attacker and defender to figure + // out which pair of wrapper and wrapped are connected. This number is saved into + // statuses::wrap_pair_unique_id. Initialized to 0xA (10) + u32 monster_unique_wrap_counter; + bool plus_is_active[2]; // 0x3E34: A monster on the {enemy, team} side has the ability Plus + bool minus_is_active[2]; // 0x3E36: A monster on the {enemy, team} side has the ability Minus + // 0x3E38: If true, a monster on the floor is a decoy. + bool decoy_is_active; + // 0x3E39: If true, a monster with id 0x97 (Mew) cannot be spawned on the floor. + bool mew_cannot_spawn; + // 0x3E3A: Holds the monster ID for the Deoxys form randomly selected for this floor. + enum monster_id deoxys_floor_id; + // 0x3E3C: Gets set to true in ChangeShayminForme. Seems to also control which sprite to + // load for a Shaymin on the team? + bool shaymin_sky_form_loaded; + undefined field_0x3e3d; + undefined field_0x3e3e; + undefined field_0x3e3f; + struct item items[64]; // 0x3E40: Info for all the items on the ground + u16 n_items; // 0x3FC0: Number of active items in the above items array + undefined field_0x3fc2; + undefined field_0x3fc3; + struct trap traps[64]; // 0x3FC4: Info for all the traps on the floor + struct dungeon_generation_info gen_info; // 0x40C4: Stuff involved with dungeon generation + undefined field_0xccfc; + undefined field_0xccfd; + undefined field_0xccfe; + undefined field_0xccff; + undefined field_0xcd00; + undefined field_0xcd01; + undefined field_0xcd02; + undefined field_0xcd03; + undefined field_0xcd04; + undefined field_0xcd05; + undefined field_0xcd06; + undefined field_0xcd07; + undefined field_0xcd08; + undefined field_0xcd09; + undefined field_0xcd0a; + undefined field_0xcd0b; + // 0xCD0C: Appears to be an array for the team. Likely only the first 4 entries are used. + // Possibly related to dungeon_generation_info::individual_team_spawn_positions? Possibly the + // direction to spawn each team member in? + enum direction_id unk_team_direction_array[8]; + // Min x of the generated Kecleon shop, if it exists. This reflects the original generation, and + // is not updated if some shop tiles are deleted by later steps in floor generation + int kecleon_shop_min_x; // 0xCD14: inclusive + int kecleon_shop_min_y; // 0xCD18: inclusive + int kecleon_shop_max_x; // 0xCD1C: inclusive + int kecleon_shop_max_y; // 0xCD20: inclusive + // Coordinates for a non full floor fixed room? Uncertain if max values are inclusive. + int fixed_room_min_x; // 0xCD24: inclusive + int fixed_room_min_y; // 0xCD28: inclusive + int fixed_room_max_x; // 0xCD2C: inclusive? + int fixed_room_max_y; // 0xCD30: inclusive? + // 0xCD34: Width of the generated fixed room? + u16 fixed_room_width; + // 0xCD36: Height of the generated fixed room? + u16 fixed_room_height; + enum weather_id weather; // 0xCD38: current weather + // 0xCD39: Default weather on the floor that will be reverted to if the current weather is + // artificial and ends + enum weather_id natural_weather; + // 0xCD3A: Turns left for each weather type in enum weather_id (except WEATHER_RANDOM). If + // multiple of these are nonzero, the one with the highest number of turns left is chosen. + // Ties are broken in enum order + u16 weather_turns[8]; + // 0xCD4A: Turns left for artificial permaweather from weather-setting abilities like Drought, + // Sand Stream, Drizzle, and Snow Warning; one counter for each weather type in enum weather_id + // (except WEATHER_RANDOM). Any nonzero value triggers that weather condition (it's usually set + // to 1 or 0). If the weather's source is removed, this value becomes the normal number of turns + // left for that weather condition. Priority in the event of multiple nonzero counters is the + // same as with weather_turns. + u16 artificial_permaweather_turns[8]; + // 0xCD5A: For damaging weather conditions like sandstorm. Counts down from 9-0, damage on 9 + u8 weather_damage_counter; + u8 mud_sport_turns; // 0xCD5B: Number of turns left for the Mud Sport condition + u8 water_sport_turns; // 0xCD5C: Number of turns left for the Water Sport condition + bool nullify_weather; // 0xCD5D: Cloud Nine/Air Lock is in effect + undefined field_0xcd5e; + undefined field_0xcd5f; + // 0xCD60: Seems to be tile data for tiles within fixed rooms + struct tile fixed_room_tiles[8][8]; + undefined field_0xd260; + undefined field_0xd261; + undefined field_0xd262; + undefined field_0xd263; + undefined field_0xd264; + undefined field_0xd265; + undefined field_0xd266; + undefined field_0xd267; + undefined field_0xd268; + undefined field_0xd269; + undefined field_0xd26a; + undefined field_0xd26b; + undefined field_0xd26c; + undefined field_0xd26d; + undefined field_0xd26e; + undefined field_0xd26f; + undefined field_0xd270; + undefined field_0xd271; + undefined field_0xd272; + undefined field_0xd273; + undefined field_0xd274; + undefined field_0xd275; + undefined field_0xd276; + undefined field_0xd277; + undefined field_0xd278; + undefined field_0xd279; + undefined field_0xd27a; + undefined field_0xd27b; + undefined field_0xd27c; + undefined field_0xd27d; + undefined field_0xd27e; + undefined field_0xd27f; + undefined field_0xd280; + undefined field_0xd281; + undefined field_0xd282; + undefined field_0xd283; + undefined field_0xd284; + undefined field_0xd285; + undefined field_0xd286; + undefined field_0xd287; + undefined field_0xd288; + undefined field_0xd289; + undefined field_0xd28a; + undefined field_0xd28b; + undefined field_0xd28c; + undefined field_0xd28d; + undefined field_0xd28e; + undefined field_0xd28f; + undefined field_0xd290; + undefined field_0xd291; + undefined field_0xd292; + undefined field_0xd293; + undefined field_0xd294; + undefined field_0xd295; + undefined field_0xd296; + undefined field_0xd297; + undefined field_0xd298; + undefined field_0xd299; + undefined field_0xd29a; + undefined field_0xd29b; + undefined field_0xd29c; + undefined field_0xd29d; + undefined field_0xd29e; + undefined field_0xd29f; + undefined field_0xd2a0; + undefined field_0xd2a1; + undefined field_0xd2a2; + undefined field_0xd2a3; + undefined field_0xd2a4; + undefined field_0xd2a5; + undefined field_0xd2a6; + undefined field_0xd2a7; + undefined field_0xd2a8; + undefined field_0xd2a9; + undefined field_0xd2aa; + undefined field_0xd2ab; + undefined field_0xd2ac; + undefined field_0xd2ad; + undefined field_0xd2ae; + undefined field_0xd2af; + undefined field_0xd2b0; + undefined field_0xd2b1; + undefined field_0xd2b2; + undefined field_0xd2b3; + undefined field_0xd2b4; + undefined field_0xd2b5; + undefined field_0xd2b6; + undefined field_0xd2b7; + undefined field_0xd2b8; + undefined field_0xd2b9; + undefined field_0xd2ba; + undefined field_0xd2bb; + undefined field_0xd2bc; + undefined field_0xd2bd; + undefined field_0xd2be; + undefined field_0xd2bf; + undefined field_0xd2c0; + undefined field_0xd2c1; + undefined field_0xd2c2; + undefined field_0xd2c3; + undefined field_0xd2c4; + undefined field_0xd2c5; + undefined field_0xd2c6; + undefined field_0xd2c7; + undefined field_0xd2c8; + undefined field_0xd2c9; + undefined field_0xd2ca; + undefined field_0xd2cb; + undefined field_0xd2cc; + undefined field_0xd2cd; + undefined field_0xd2ce; + undefined field_0xd2cf; + undefined field_0xd2d0; + undefined field_0xd2d1; + undefined field_0xd2d2; + undefined field_0xd2d3; + undefined field_0xd2d4; + undefined field_0xd2d5; + undefined field_0xd2d6; + undefined field_0xd2d7; + undefined field_0xd2d8; + undefined field_0xd2d9; + undefined field_0xd2da; + undefined field_0xd2db; + undefined field_0xd2dc; + undefined field_0xd2dd; + undefined field_0xd2de; + undefined field_0xd2df; + // 0xD2E0: Appears to keep track of what tiles are the fixed room tiles when generating + // a fixed room that isn't the whole floor. + u8 fixed_room_room_index; + undefined field_0xd2e1; + undefined field_0xd2e2; + undefined field_0xd2e3; + // 0xD2E4: This is an array of pointers that point to the actual tile structs within the + // dungeon struct + struct tile* tile_ptrs[32][56]; + u8 n_rooms; // 0xEEE4: Number of rooms on the current floor + undefined field_0xeee5; // Uninitialized, likely padding + undefined field_0xeee6; // Uninitialized, likely padding + undefined field_0xeee7; // Uninitialized, likely padding + // 0xEEE8: Array of structs that contain data about the rooms on the current floor + struct room_data room_data[32]; + // 0xF268: Array that counts the amount of elements on each row of natural_junction_list + u16 natural_junction_list_counts[32]; + // 0xF2A8: Matrix that stores the positions of up to 32 natural junctions + // for each room on the floor. Each row represents a room. + struct position natural_junction_list[32][32]; + // 0x102A8: Buffer to store some file after being decompressed. + // The file that gets loaded depends on the tileset ID of the dungeon. + u8 unknown_file_buffer_0x102A8[7200]; + // 0x11EC8: Matrix related to tile graphics. + // Skipping the code that initializes it at the start of the dungeon causes all tiles + // to be shown as black squares. + u16 unknown_tile_matrix[9][34]; + // 0x1212C: Unknown matrix, probably related to unknown_tile_matrix + // since they get initialized together. + u16 unknown_matrix_0x1212C[9][3]; + // 0x12162: Buffer to store some AT4PX file after being decompressed + // This is somehow related to tile::texture_id and tile variations? + u8 unknown_file_buffer_0x12162[2352]; + // 0x12A92: Unknown array, probably related to unknown_tile_matrix + // since they get initialized together. + u16 unknown_array_0x12A92[9]; + // 0x12AA4: Pointer to data about the fixed room such as width and height. Gets set after + // loading the data for a fixed room when generating a floor. Gets set back to null when + // done generating a floor. + undefined* unk_fixed_room_pointer; + // 0x12AA8: This flag is set by the move 0x191 ("Trapper") which is the effect + // of the Trapper Orb. If true, the game will try to spawn a trap. + bool trapper_orb_flag; + undefined field_0x12aa9; // Likely padding + // 0x12AAA: Location to spawn the trap by trapper_orb_flag. + struct position trapper_orb_trap_pos; + // 0x12AAE: Trap ID to spawn the trap by trapper_orb_flag. Notably, the game + // will always set this to 0x19, but could work with other values. + enum trap_id traper_orb_trap_id; + // 0x12AAF: Alignment to spawn the trap by trapper_orb_flag. + u8 trapper_orb_trap_team; + undefined field_0x12ab0; + undefined field_0x12ab1; + undefined field_0x12ab2; + undefined field_0x12ab3; + undefined field_0x12ab4; + undefined field_0x12ab5; + undefined field_0x12ab6; + undefined field_0x12ab7; + undefined field_0x12ab8; + undefined field_0x12ab9; + undefined field_0x12aba; + undefined field_0x12abb; + undefined field_0x12abc; + undefined field_0x12abd; + undefined field_0x12abe; + undefined field_0x12abf; + undefined field_0x12ac0; + undefined field_0x12ac1; + undefined field_0x12ac2; + undefined field_0x12ac3; + undefined field_0x12ac4; + undefined field_0x12ac5; + undefined field_0x12ac6; + undefined field_0x12ac7; + undefined field_0x12ac8; + undefined field_0x12ac9; + undefined field_0x12aca; + undefined field_0x12acb; + undefined field_0x12acc; + undefined field_0x12acd; + undefined field_0x12ace; + undefined field_0x12acf; + undefined field_0x12ad0; + undefined field_0x12ad1; + undefined field_0x12ad2; + undefined field_0x12ad3; + undefined field_0x12ad4; + undefined field_0x12ad5; + undefined field_0x12ad6; + undefined field_0x12ad7; + undefined field_0x12ad8; + undefined field_0x12ad9; + undefined field_0x12ada; + undefined field_0x12adb; + undefined field_0x12adc; + undefined field_0x12add; + undefined field_0x12ade; + undefined field_0x12adf; + undefined field_0x12ae0; + undefined field_0x12ae1; + undefined field_0x12ae2; + undefined field_0x12ae3; + undefined field_0x12ae4; + undefined field_0x12ae5; + undefined field_0x12ae6; + undefined field_0x12ae7; + undefined field_0x12ae8; + undefined field_0x12ae9; + undefined field_0x12aea; + undefined field_0x12aeb; + undefined field_0x12aec; + undefined field_0x12aed; + undefined field_0x12aee; + undefined field_0x12aef; + undefined field_0x12af0; + undefined field_0x12af1; + undefined field_0x12af2; + undefined field_0x12af3; + undefined field_0x12af4; + undefined field_0x12af5; + undefined field_0x12af6; + undefined field_0x12af7; + // 0x12AF8: The amount of items "sniffed" by the Acute Sniffer iq skill when a floor starts. + u16 acute_sniffer_item_count; + // 0x12AFA: Number of normal item spawns. Does not include monster held items and additional + // items in walls or Monster Houses + u16 n_normal_item_spawns; + bool gravity; // 0x12AFC: Gravity is in effect + undefined field_0x12afd; + // 0x12AFE: Victories on one floor counter. + s16 victory_counter; + undefined field_0x12b00; + undefined field_0x12b01; + undefined field_0x12b02; + undefined field_0x12b03; + undefined field_0x12b04; + undefined field_0x12b05; + undefined field_0x12b06; + undefined field_0x12b07; + undefined field_0x12b08; + undefined field_0x12b09; + undefined field_0x12b0a; + undefined field_0x12b0b; + undefined field_0x12b0c; + undefined field_0x12b0d; + undefined field_0x12b0e; + undefined field_0x12b0f; + undefined field_0x12b10; + undefined field_0x12b11; + undefined field_0x12b12; + undefined field_0x12b13; + undefined field_0x12b14; + undefined field_0x12b15; + undefined field_0x12b16; + undefined field_0x12b17; + undefined field_0x12b18; + undefined field_0x12b19; + undefined field_0x12b1a; + undefined field_0x12b1b; + undefined field_0x12b1c; + undefined field_0x12b1d; + undefined field_0x12b1e; + undefined field_0x12b1f; + // 0x12B20: Probably counts how many sprites or monster entries the fixed room wants + // loaded. + u32 fixed_room_monster_sprite_counter; + // 0x12B24: Whether or not the kecleon shop spawn chance be boosted for the floor + bool boost_kecleon_shop_spawn_chance; + // 0x12B25: Whether or not the hidden stairs spawn chance be boosted for the floor + // (by 20%; see HIDDEN_STAIRS_SPAWN_CHANCE_MULTIPLIER) + bool boost_hidden_stairs_spawn_chance; + undefined field_0x12b26; + undefined field_0x12b27; + + //struct entity_table entity_table; // 0x12B28: Table of all entities in the dungeon + // The pointers point into the entities array + // 0x12B28 / 0x0: A list of all monster pointers, whether they're used or not + union { + struct entity* party_members[4]; + struct entity* monster_slot_ptrs[20]; + }; + // 0x12B78 / 0x50: Null-terminated array of pointers to actually active monsters + struct entity* active_monster_ptrs[20]; + struct entity* item_ptrs[64]; // 0x12BC8 / 0xA0 + struct entity* trap_ptrs[64]; // 0x12CC8 / 0x1A0 + struct entity* hidden_stairs_ptr; // 0x12DC8 / 0x2A0 + struct entity entities[149]; // 0x12DCC / 0x2A4 : All the entities in a dungeon + + // 0x198E4: An ally monster related to storm drain/lightning rod and maybe other checks? + struct entity* unk_ally_monster1; + u32 unk_ally_monster_unique_id1; // 0x198E8: statuses::unique_id from that monster? + // 0x198EC: An ally monster related to storm drain/lightning rod and maybe other checks? + struct entity* unk_ally_monster2; + u32 unk_ally_monster_unique_id2; // 0x198F0: statuses::unique_id from that monster? + // 0x198F4: An enemy monster related to storm drain/lightning rod and maybe other checks? + struct entity* unk_enemy_monster1; + u32 unk_enemy_monster_unique_id1; // 0x198F8: statuses::unique_id from that monster? + // 0x198FC: An enemy monster related to storm drain/lightning rod and maybe other checks? + struct entity* unk_enemy_monster2; + u32 unk_enemy_monster_unique_id2; // 0x19900: statuses::unique_id from that monster? + // 0x19904: Pointer to the monster that will snatch the effect of a move. + struct entity* snatch_monster; + // 0x19908: Pointer to the entity to be spawned by the effect of Illuminate + struct entity* illuminate_spawn_entity; + // 0x1990C: Stores statuses::unique_id for the monster pointed to by dungeon::snatch_monster. + u32 snatch_status_unique_id; + // 0x19910: Spawn genid of the monster to be spawned by the effect of Illuminate + u16 illuminate_spawn_genid; + undefined field_0x19912; + undefined field_0x19913; + // 0x19914: List that matches monster IDs with their sprite index on this floor + enum monster_id sprite_indexes[1155]; + undefined field_0x1a21a; + undefined field_0x1a21b; + // 0x1A21C: Data about the map, the camera and the touchscreen numbers + struct display_data display_data; + struct minimap_display_data minimap_display_data; // 0x1A264: Data used to display the minimap + // 0x286B0: Initialized to 0xFF, then set to a copy of dungeon::group_id + enum dungeon_group_id group_id_copy; + // 0x286B1: Initialized to 0xFF, then set to a copy of dungeon::0x74B + undefined field_0x286b1; + struct floor_properties floor_properties; // 0x286B2: Properties about the current floor + // 0x286D2: Maybe a 0x10 long array? + undefined2 field_0x286d2; + undefined2 field_0x286d4; + undefined2 field_0x286d6; + undefined2 field_0x286d8; + undefined2 field_0x286da; + undefined2 field_0x286dc; + undefined2 field_0x286de; + undefined2 field_0x286e0; + undefined2 field_0x286e2; + undefined2 field_0x286e4; + undefined2 field_0x286e6; + undefined2 field_0x286e8; + undefined2 field_0x286ea; + undefined2 field_0x286ec; + undefined2 field_0x286ee; + undefined2 field_0x286f0; + // 0x286F2: Spawn weights for regular items. It's the unrolled form of this floor's regular + // item spawn list. + // It has enough space to hold 1416 entries (1400 items + 16 categories), but only the + // first 0x16C slots are used since spawn lists can't encode item IDs larger than that. + u16 regular_item_weights[1416]; + // 0x29202: Spawn weights for Kecleon shop items. Same format as regular_item_weights. + u16 kecleon_item_weights[1416]; + // 0x29D12: Spawn weights for monster house items. Same format as regular_item_weights. + u16 monster_house_item_weights[1416]; + // 0x2A822: Spawn weights for buried items. Same format as regular_item_weights. + u16 buried_item_weights[1416]; + // 0x2B332: Spawn weights for bazaar grab bag items. Same format as regular_item_weights. + u16 grab_bag_item_weights[1416]; + // 0x2BE42: Spawn weights for secret room items in treasure boxes. + // Same format as regular_item_weights? For some reason the weights for the secret rooms + // are of a different length than the other item weight lists before it. The trap weights + // appear to overlap what would be entries 1400-1415. + u16 secret_room_item_weights[1400]; + // 0x2C932: Spawn weights for traps. + u16 trap_weights[25]; + // 0x2C964: List of spawn entries on this floor + // This is used during initialization, enemies are spawned using the copy at 0x3974 + struct monster_spawn_entry spawn_entries_master[16]; + // 0x2C9E4: The total number of spawn entries loaded or to be loaded? + u16 number_sprites_loaded; + // 0x2C9E6: Highest level among all the enemies that spawn on this floor + u16 highest_enemy_level; + // 0x2C9E8: ID of an item guaranteed to spawn on the floor, if applicable + // (e.g., certain mission types) + enum item_id guaranteed_item_id; + // 0x2C9EA: List of the indices in the complete monster spawn table for this floor that were + // chosen to spawn on it. It gets rerandomized at the start of each new floor. + u16 spawn_table_entries_chosen[16]; + undefined field_0x2ca0a; + undefined field_0x2ca0b; + // 0x2CA0C: Holds the name for the entity that caused the faint. The exact size is a guess. + // Likely larger because of entities like the Explosion Trap. + char fainted_monster_cause_entity_name[10]; + undefined field_0x2ca16; + undefined field_0x2ca17; + undefined field_0x2ca18; + undefined field_0x2ca19; + undefined field_0x2ca1a; + undefined field_0x2ca1b; + undefined field_0x2ca1c; + undefined field_0x2ca1d; + undefined field_0x2ca1e; + undefined field_0x2ca1f; + undefined field_0x2ca20; + undefined field_0x2ca21; + undefined field_0x2ca22; + undefined field_0x2ca23; + undefined field_0x2ca24; + undefined field_0x2ca25; + undefined field_0x2ca26; + undefined field_0x2ca27; + undefined field_0x2ca28; + undefined field_0x2ca29; + // 0x2CA2A: Holds the name for the monster that fainted. The exact size is a guess. + char fainted_monster_name[10]; + undefined field_0x2ca34; + undefined field_0x2ca35; + undefined field_0x2ca36; + undefined field_0x2ca37; + undefined field_0x2ca38; + undefined field_0x2ca39; + undefined field_0x2ca3a; + undefined field_0x2ca3b; + undefined field_0x2ca3c; + undefined field_0x2ca3d; + undefined field_0x2ca3e; + undefined field_0x2ca3f; + undefined field_0x2ca40; + undefined field_0x2ca41; + undefined field_0x2ca42; + undefined field_0x2ca43; + undefined field_0x2ca44; + undefined field_0x2ca45; + undefined field_0x2ca46; + undefined field_0x2ca47; + // 0x2CA48: A monster name that is copied from dungeon::unk_fainted_monster_name. Maybe for + // situations where the player loses because the partner, escort, or accompanying monster + // fainted? Another poossible use is when leaving a dungeon after a mission? Exact size is + // a guess. + char loss_related_monster_name[10]; + undefined field_0x2ca52; + undefined field_0x2ca53; + undefined field_0x2ca54; + undefined field_0x2ca55; + undefined field_0x2ca56; + undefined field_0x2ca57; + undefined field_0x2ca58; + undefined field_0x2ca59; + undefined field_0x2ca5a; + undefined field_0x2ca5b; + undefined field_0x2ca5c; + undefined field_0x2ca5d; + undefined field_0x2ca5e; + undefined field_0x2ca5f; + undefined field_0x2ca60; + undefined field_0x2ca61; + undefined field_0x2ca62; + undefined field_0x2ca63; + undefined field_0x2ca64; + undefined field_0x2ca65; + // 0x02CA66: The cause of the mission over. Identical to the damage source in HandleFaint, + // but can be set to some non-damage related reasons manually by the game. IE: "cleared the + // dungeon." and "succeeded in the rescue mission." + union damage_source fainted_monster_dungeon_end_reason; + enum dungeon_id fainted_id; // 0x2CA68: Copied from dungeon::id, upon fainting. + u8 fainted_floor; // 0x2CA69: Copied from dungeon::floor, upon fainting. + // 0x2CA6A: Copy of the fainted monster's held item. + struct item fainted_monster_held_item; + int fainted_monster_exp; // 0x2CA70: Copy of fainted monster's experience. + // 0x2CA74: Copy of the fainted monster's ACTUAL max hp (monster::max_hp_stat + + // monster::max_hp_boost) + s16 fainted_monster_max_hp; + // 0x2CA76: Copy of the fainted monster's offensive stats. + u8 fainted_monster_offensive_stats[2]; + // 0x2CA78: Copy of the fainted monster's defenive stats. + u8 fainted_monster_defensive_stats[2]; + u8 fainted_monster_level; // 0x2CA7A: Copy of fainted monster's level. + undefined field_0x2ca7b; + // 0x2CA7C: This is a monster summary related to the menu when leaving a dungeon. When + // succesfully exiting a dungeon it is the leader. May be other allies when they faint? + struct monster_summary getout_monster_summary; + // 0x2CAF4: One more than the maximum number of floors in the current dungeon + u8 n_floors_plus_one; + undefined field_0x2caf5; + undefined field_0x2caf6; + undefined field_0x2caf7; + // 0x2CAF8: Related to playing dungeon music? Initialized to 0x4. + undefined4 field_0x2caf8; + // Related to playing dungeon music? + undefined field_0x2cafc; + undefined field_0x2cafd; + undefined field_0x2cafe; + undefined field_0x2caff; + // Related to playing dungeon music? + undefined2 field_0x2cb00; + // Related to playing dungeon music? + undefined2 field_0x2cb02; + // 0x2CB04: Related to playing dungeon music? + undefined2 field_0x2cb04; + // 0x2CB06: Current Dunegon Music ID + enum music_id dungeon_music_playing_id; + undefined field_0x2cb08; + undefined field_0x2cb09; + undefined field_0x2cb0a; + undefined field_0x2cb0b; + undefined field_0x2cb0c; + undefined field_0x2cb0d; + undefined field_0x2cb0e; + undefined field_0x2cb0f; + // 0x2CB10: Somehow related to display_data::hallucinating and seems to maybe control + // the sleeping animations when the camera is pointed away from a hallucinating monster? + // Initialized to 0x1. + bool unk_camera_tracker; + undefined field_0x2cb11; + undefined field_0x2cb12; + undefined field_0x2cb13; +}; + + +#endif diff --git a/include/dungeon_mode.h b/include/dungeon_mode.h index 86052ae7..563aa816 100644 --- a/include/dungeon_mode.h +++ b/include/dungeon_mode.h @@ -20,17 +20,17 @@ struct pixel_position { }; // Dungeon data -struct dungeon { - u8 PAD1[1864]; - u8 dungeon; // 0x748 - u8 floor; // 0x749 - u8 PAD2[74554]; -#ifndef JAPAN - u8 PAD3[164]; -#endif - struct entity* party_members[4]; // 0x12B28 - // Possibly more stuff -}; +/* struct dungeon { */ +/* u8 PAD1[1864]; */ +/* u8 dungeon; // 0x748 */ +/* u8 floor; // 0x749 */ +/* u8 PAD2[74554]; */ +/* #ifndef JAPAN */ +/* u8 PAD3[164]; */ +/* #endif */ +/* struct entity* party_members[4]; // 0x12B28 */ +/* // Possibly more stuff */ +/* }; */ // Item info struct item { @@ -932,5 +932,554 @@ struct monster_summary { undefined2 _padding_0x76; }; +// Info about a mission destination floor +struct mission_destination_info { + bool is_destination_floor; // 0x0: Whether or not the current floor is a mission destination + enum mission_type type; // 0x1: + // 0x2: The meaning of this field depends on the type field; see union mission_subtype. + u8 subtype; + // 0x3: The index of the mission in the job list? + u8 mission_job_list_idx; + // 0x4: Item to retrieve, if this is an item-retrieval mission + enum item_id item_to_retrieve; + enum item_id item_to_deliver; // 0x6: Item to deliver to the client, if relevant + enum item_id special_target_item; // 0x8: For Sealed Chamber and Treasure Memo missions + enum monster_id client; // 0xA: The client on the mission listing + enum monster_id rescue_target; // 0xC: The monster to be rescued + // 0xE: Usually just the target to defeat. If an outlaw has minions, the monster IDs will be + // listed in subsequent entries. Note that there can be multiple minions of the same species, + // which is not reflected here. + enum monster_id enemy_species[3]; + u8 n_enemy_species; // 0x14: Length of the preceding array + undefined field_0x15; + // 0x16: Fixed room ID of the destination floor, if relevant + // (e.g., Chambers, Challenge Letters, etc.) + enum fixed_room_id fixed_room_id; + // 0x17: Related to missions where you have to obtain an item? Possibly related to the item + // being picked up and/or destroyed? + bool unk_mission_item_tracker1; + undefined field_0x18; + undefined field_0x19; + // 0x1A: Related to missions where you have to obtain an item? Possibly related to the item + // being picked up and/or destroyed? + bool unk_mission_item_tracker2; + // 0x1B: Will be set after the target enemy has been defeated. + // If there are minions, this flag applies just to the main outlaw. + bool target_enemy_is_defeated; +}; + +// Contains data about a monster that spawns in a dungeon +struct monster_spawn_entry { + u16 level_mult_512; // 0x0: Spawn level << 9 + // 0x2: Incremental spawn weight of this entry for normal spawns + u16 incremental_spawn_weight; + // 0x4: Incremental spawn weight of this entry for monster house spawns + u16 incremental_spawn_weight_monster_house; + // 0x6: Monster id. Depending on where this struct is used, it can have values above 600 + // to list secondary gender entries. + enum monster_id id; +}; + +// Dungeon floor properties +struct floor_properties { + enum floor_layout layout; // 0x0 + // 0x1: Affects the number of rooms to be generated. If it's positive, a slight random variation + // (between -2 and +1) is applied to the value (the final value must be at least 1). If it's + // negative, its absolute value is used without adding a random variation. + s8 room_density; + u8 tileset; // 0x2 + // 0x3: Indexes into the music ID table in overlay 10 to determine the floor's music track. + // See the relevant descriptions in the overlay 10 symbols for more information. + u8 music_table_idx; + enum weather_id weather; // 0x4 + // 0x5: Controls how many connections will be made between grid cells + u8 floor_connectivity; + // 0x6: Controls how many enemies will be spawned. If 0, no enemies will spawn, even as the + // player walks. + // The final value will be 0 in the special case that density is 0. Otherwise, the final value + // will be randomized between density / 2 and density - 1, but no lower than 1. + // The code seems to imply that the value was meant to be signed, since it contains a section + // that takes the absolute value of the density while skipping the random variation, similar to + // room_density. + u8 enemy_density; + u8 kecleon_shop_spawn_chance; // 0x7: Percentage chance from 0-100 + u8 monster_house_spawn_chance; // 0x8: Percentage chance from 0-100 + u8 maze_room_chance; // 0x9: Percentage chance from 0-100 + u8 sticky_item_chance; // 0xA + // 0xB: Whether or not dead ends are allowed in the floor layout. If false, dead ends will be + // corrected during floor generation (or rather, they should be, but the implementation is + // buggy) + bool allow_dead_ends; + // 0xC: Maximum number of secondary structures that can be generated on the floor + u8 max_secondary_structures; + // 0xD: room_flags: 1-byte bitfield + bool f_secondary_structures : 1; // Whether secondary structures are allowed + u8 room_flags_unk1 : 1; + bool f_room_imperfections : 1; // Whether room imperfections are allowed + u8 room_flags_unk3 : 5; + + undefined field_0xe; + u8 item_density; // 0xF: Controls how many items will be spawned + u8 trap_density; // 0x10: Controls how many traps will be spawned + u8 floor_number; // 0x11: The current floor number within the overall dungeon + enum fixed_room_id fixed_room_id; // 0x12 + u8 extra_hallways; // 0x13: Number of extra hallways to generate + u8 buried_item_density; // 0x14: Controls how many buried items (in walls) will be spawned + // 0x15: Controls how much secondary terrain (water, lava, and this actually applies to chasms + // too) will be spawned + u8 secondary_terrain_density; + // 0x16: Vision range (in tiles) when standing on a hallway. + // A value of 0 means no limit, a value > 0 enables darkness on the floor. + u8 visibility_range; + u8 max_money_amount_div_5; // 0x17: 1/5 the maximum amount for Poké spawns + // 0x18: Chance of an item spawning on each tile in a Kecleon shop + enum shop_item_positions shop_item_positions; + // 0x19: Chance that a Monster House will be an itemless one + u8 itemless_monster_house_chance; + // 0x1A: Values are shifted relative to enum hidden_stairs_type. + // 0 means HIDDEN_STAIRS_SECRET_BAZAAR, 1 means HIDDEN_STAIRS_SECRET_ROOM, and + // 255 still means HIDDEN_STAIRS_RANDOM_SECRET_BAZAAR_OR_SECRET_ROOM. + u8 hidden_stairs_type; + u8 hidden_stairs_spawn_chance; // 0x1B + u8 enemy_iq; // 0x1C: IQ stat of enemies + u8 iq_booster_value; // 0x1E: IQ increase from the IQ booster item upon entering the floor +}; + +// Contains the data required to display a tile on the minimap +struct minimap_display_tile { + undefined4 field_0x0; + undefined4 field_0x4; + undefined4 field_0x8; + undefined4 field_0x0C; + undefined4 field_0x10; + undefined4 field_0x14; + undefined4 field_0x18; + undefined4 field_0x1C; + undefined4 field_0x20; + undefined4 field_0x24; + undefined4 field_0x28; + undefined4 field_0x2C; + undefined4 field_0x30; + undefined4 field_0x34; + undefined4 field_0x38; + undefined4 field_0x3C; +}; + +// Contains the graphical representation of minimap tiles +struct minimap_display_data { + // 0x0: Matrix that contains tile display data. Each chunk of 4x4 tiles shares + // a single entry in this matrix. (To calculate which entry corresponds to a + // given (x,y) coordinate, simply divide both x and y by 2 and drop decimals) + struct minimap_display_tile tile_matrix_1[16][28]; + // 0x7000: Another matrix just like the first one + struct minimap_display_tile tile_matrix_2[16][28]; + // 0xE000: Weird byte matrix. + // The code that initializes this matrix fills 56 bytes + // per row, which seems like an oversight. + // On top of that, starting at 0xE1C0 there's a pointer table that gets overwritten every time + // this matrix is rebuilt, only to be restored later. There's probably + // an union involved somewhere, but right now there's not enough information + // to know where exactly. + undefined field_0xE000[32][28]; + undefined overwritten_extra_bytes[28]; // 0xE380 + undefined4 field_0xE39C[41]; // 0xE39C: Array of pointers + undefined4 field_0xE440; + undefined field_0xE444; + undefined field_0xE445; + undefined field_0xE446; + undefined field_0xE447; + undefined field_0xE448; + // Padding? + undefined field_0xE449; + undefined field_0xE44A; + undefined field_0xE44B; +}; + +// Struct that seems to hold data related to the map, the camera and the touchscreen numbers +struct display_data { + struct position camera_pos; // 0x0: Position of the tile the camera is currently pointing to + // 0x4: Copy of 0x0. Used to detect changes in the camera's position. + struct position camera_pos_mirror; + // 0x8: Pixel position of the tile the camera is currently pointing to + struct position camera_pixel_pos; + struct position camera_pixel_pos_mirror; // 0xC: Mirror of 0x8 + // 0x10: Entity currently being pointed by the camera, mostly used to + // control rendering of the dungeon, GUI, minimap, etc. + struct entity* camera_target; + // 0x14: Appears to be used to determine the offset to render the screen from normal when + // shaking. + u32 screen_shake_offset; + // 0x18: Appears to be the intensity value for when the screen shakes. Decremented by + // 0x1 until 0x0. + u32 screen_shake_intensity; + // 0x1C: Appears to be the value to set to display_data::screen_shake_intensity when it + // reaches 0x0. (This number is usually 0x0 so the screen stops shaking after.) + u32 screen_shake_intensity_reset; + undefined field_0x20; // 0x20: Initialized to 0x3. + // 0x21: Same as floor_properties::visibility_range + // Affects the number of map tiles around the player's position that get marked as + // "visited" while exploring, as well as how far away you can see enemies under non-illuminated + // conditions (outside of this range, enemies will not be visible on screen). + u8 visibility_range; + // 0x22: True if the pokémon currently pointed by the camera has + // the status_id::STATUS_BLINKER effect + bool blinded; + // 0x23: True after using a Luminous Orb or in floors where darkness is forcefully disabled + bool luminous; + // 0x24: If false and luminous is false as well, darkness will be displayed graphically. + // This is set in dungeons that aren't naturally dark, and also in some fixed room floors. + bool natural_lighting; + // 0x25: True if the pokémon currently pointed by the camera has the Map Surveyor IQ skill + // active + bool map_surveyor; + // 0x26: True if enemies should be shown on the map. + // Seems to be a dependent property computed as + // (leader has Power Ears status OR leader has X-Ray Specs equipped). + // This is NOT affected by the luminous flag. + bool can_see_enemies; + // 0x27: True if items are being shown on the map. Similar to can_see_enemies. + bool can_see_items; + // 0x28: True if traps are being shown on the map. Similar to can_see_enemies. + bool can_see_traps; + // 0x29: True if the pokémon currently pointed by the camera has the + // status_id::STATUS_CROSS_EYED effect. + // Causes all entities to be displayed as green circles on the map. + bool hallucinating; + bool can_see_stairs; // 0x2A: True if stairs are being shown on the map + undefined field_0x2B; // 0x2B: Initialized to 0 + undefined field_0x2C; + bool darkness; // 0x2D: True if there's darkness on the floor + undefined field_0x2E; // 0x2E: Initialized to 1 + // 0x2F: True if the leader is being pointed by the camera right now. If false, UI digits will + // be displayed in green. + bool leader_pointed; + undefined field_0x30; // 0x30: Initialized to 1 + // 0x31: Set to 1 when losing in a dungeon. Seems to cause display_data::0x38 to + // display_data::leader_max_hp_touch_screen to become 0xFFFF (-1). + bool unk_fade_to_black_tracker; + undefined field_0x32; // 0x32: Initialized to 0 + undefined field_0x33; // 0x33: Initialized to 0 + undefined field_0x34; // 0x34: Is used, related to lighting? + bool team_menu_or_grid; // 0x35: True when the team menu is opened or while Y is being held + // Derived from internal direction in leader info block + enum direction_id leader_target_direction; // 0x36 + enum direction_id leader_target_direction_mirror; // 0x37 + undefined2 field_0x38; // 0x38: Initialized to 0xFFFF (-1). + undefined2 field_0x3A; // 0x3A: Initialized to 0xFFFF (-1). + s16 floor_touch_screen; // 0x3C: Floor number displayed on the touch screen + s16 leader_level_touch_screen; // 0x3E: Leader's level displayed on the touch screen + s16 leader_hp_touch_screen; // 0x40: Leader's current HP displayed on the touch screen + s16 leader_max_hp_touch_screen; // 0x42: Leader's max HP displayed on the touch screen + undefined2 field_0x44; + // Padding? + undefined field_0x46; + undefined field_0x47; +}; + +// Used during floor generation to keep track of what entities should be spawned where +struct spawn_flags { + u16 flags; + //bool f_stairs : 1; + //bool f_item : 1; + //bool f_trap : 1; + //bool f_monster : 1; + //u16 spawn_flags_unk4 : 12; +}; + +// Used during dungeon play to record the visibility of a tile. +struct visibility_flags { + u16 flags; + // If f_revealed == true and f_visited == false, the tile will appear as gray on the map. + // This happens, e.g., when a Luminous Orb is used. + //bool f_revealed : 1; // Revealed on the map. + //bool f_visited : 1; // Visited by the player + //u16 visibility_flags_unk2 : 14; +}; + +// These flags seem to occupy the same memory location, so the meaning is context-dependent. +union spawn_or_visibility_flags { + struct spawn_flags spawn; + struct visibility_flags visibility; +}; + +// Information about the rooms on the current floor +struct room_data { + u8 room_id; + undefined field_0x1; // Initialized to 0 + struct position bottom_right_corner; // 0x2 + struct position top_left_corner; // 0x6 + undefined field_0xa; // Doesn't get initialized, likely padding + undefined field_0xb; // Doesn't get initialized, likely padding + undefined4 field_0xc; // Initialized to (bottom_right_corner.x - 1) * 0x1C + undefined4 field_0x10; // Initialized to (bottom_right_corner.y - 1) * 0x1C + undefined4 field_0x14; // Initialized to (top_left_corner.x + 1) * 0x1C + undefined4 field_0x18; // Initialized to (top_left_corner.y + 1) * 0x1C +}; + +// Tile data +struct tile { + // 0x0: terrain_flags: 2-byte bitfield + u16 terrain_flags; + //enum terrain_type terrain_type : 2; + // This tile can be corner-cut when walking. Seemingly only used during dungeon generation. + //bool f_corner_cuttable : 1; + // Includes room tiles right next to a hallway, and branching points within corridors. + // Only applies to natural halls, not ones made by Absolute Mover, not "hallways" made of + // secondary terrain, etc. Used by the AI for navigation. + //bool f_natural_junction : 1; + // This tile is impassable, even with Absolute Mover/Mobile Scarf. Used for the map border, + // key chamber walls, walls in boss battle rooms, etc. + //bool f_impassable_wall : 1; + //bool f_in_kecleon_shop : 1; // In a Kecleon Shop + //bool f_in_monster_house : 1; // In a Monster House + //uint16_t terrain_flags_unk7 : 1; + // Cannot be broken by Absolute Mover. Set naturally on key doors. + //bool f_unbreakable : 1; + // Tile is any type of "stairs" (normal stairs, Hidden Stairs, Warp Zone) + //bool f_stairs : 1; + //uint16_t terrain_flags_unk10 : 1; + //bool f_key_door : 1; // Tile is a key door + //bool f_key_door_key_locked : 1; // Key door is locked and requires a Key to open + // Key door is locked and requires an escort to open (for Sealed Chamber missions) + //bool f_key_door_escort_locked : 1; + //uint16_t terrain_flags_unk14 : 1; + // Tile is open terrain but unreachable from the stairs spawn point. Only set during dungeon + // generation. + //bool f_unreachable_from_stairs : 1; + + // 0x2: Seems to be used for spawning entities during dungeon generation, and for visibility + // during dungeon play + union spawn_or_visibility_flags spawn_or_visibility_flags; + u16 texture_id; // 0x4: Maybe? Changing this causes the tile texture to change + undefined field_0x6; + // 0x7: Room index. 0xFF if not in a room, 0xFE on junctions during map generation (it gets set + // to 0xFF later). + u8 room; + // 0x8: Where a monster standing on this tile is allowed to move. + // Each element is a bitflag that corresponds to one of the first four values of + // enum mobility_type. Each bit in the bitflag corresponds to the values of enum direction, + // where 1 means a monster with that mobility type is allowed to walk in that direction. + u8 walkable_neighbor_flags[4]; + struct entity* monster; // 0xC: Pointer to a monster on this tile, if any + // 0x10: Pointer to an entity other than a monster on this tile (item/trap) + struct entity* object; +}; + +// Data related to dungeon generation +struct dungeon_generation_info { + // 0x0: Set if the floor layout is guaranteed to be a Monster House, or the dungeon generation + // algorithm fails + bool force_create_monster_house; + // 0x1: Set if the locked door on the floor has already been opened. + bool locked_door_opened; + // 0x2: Set if a kecleon shop was properly spawned. + bool kecleon_shop_spawned; + // 0x3: When a non-zero value, the one-room orb will fail. + undefined unk_one_room_flag; + bool dough_seed_extra_poke_flag; + // 0x5: Room index of Monster House on the floor. 0xFF if there's no Monster House + u8 monster_house_room; + // 0x6: Related to when a monster from a fixed room faints. Maybe to check if the floor + // should be over after knocking them out? + undefined unk_fixed_room_static_monster_tracker; + undefined field_0x7; + // 0x8: The type of the hidden stairs on the current floor. + enum hidden_stairs_type hidden_stairs_type; + // 0xC: Used to check to load the corresponding hidden fixed room and information for + // the corresponding type of hidden floor. + enum hidden_stairs_type hidden_floor_type; + s16 tileset_id; // 0x10 + // 0x12: Music table index (see the same field in struct floor_properties) + u16 music_table_idx; + // 0x14: Controls which trap graphics to use for the staircase. Usually 0x2B (27) and + // 0x2C (28) for down and up respectively. + u16 staircase_visual_idx; + enum fixed_room_id fixed_room_id; // 0x16 + undefined field_0x17; + undefined field_0x18; + undefined field_0x19; + u16 floor_generation_attempts; // 0x1A: Number of attempts at floor layout generation + struct tile tiles[32][56]; // 0x1C + struct position team_spawn_pos; // 0x8C1C: Position of the team spawn + struct position stairs_pos; // 0x8C20: Position of the stairs spawn + // 0x8C24: Position of the Hidden Stairs spawn, or (-1, -1) if no Hidden Stairs + struct position hidden_stairs_pos; + // 0x8C28: Spawn position of each of the team members + struct position individual_team_spawn_positions[4]; + // There's another 6 words that look like spawn positions right after these 4 +}; + +// Trap info +struct trap { + enum trap_id id; + // If 0 or 2, the trap will activate only when a team member steps on it. If 1, the trap will + // activate only when an enemy steps on it. Naturally, this seems to be 0 for traps and 2 for + // Wonder Tiles + u8 team; + + // 0x2: flags: 1-byte bitfield + u8 flags; + //bool f_unbreakable : 1; // If true, the trap can't be broken (for example, using a Trapbust Orb) + //u8 flags_unk1 : 7; + + undefined field_0x3; +}; + +// Struct that contains some data used when spawning new enemies +struct enemy_spawn_stats { + enum monster_id id; // 0x0 + u16 level; // 0x2 + // 0x4: Spawn moves. Useless since each individual enemy gets its own when spawning. + enum move_id moves[4]; + u16 max_hp; // 0xC + u8 atk; // 0xE + u8 def; // 0xF + u8 sp_atk; // 0x10 + u8 sp_def; // 0x11 +}; + +// Contains the necessary information to spawn a Kecleon shopkeeper. +struct spawned_shopkeeper_data { + enum monster_id monster_id; // 0x0: The id of the monster to spawn + enum monster_behavior behavior; // 0x2: NPC behavior of the monster + bool valid; // 0x3: Indicates that this spawn data is valid + u8 pos_x; // 0x4 + u8 pos_y; // 0x5 +}; + +// Appears to contain diagnostic information related to the damage calculation routines. +struct damage_calc_diag { + enum type_id move_type; // 0x0: The type of the last move used + undefined field_0x1; + undefined field_0x2; + undefined field_0x3; + enum move_category move_category; // 0x4: The category of the last move used + // 0x8: The type matchup of the last move used against the individual types of the defender + enum type_matchup move_indiv_type_matchups[2]; + // 0xA: The modified offensive stat stage of the attacker for the last move used + u8 offensive_stat_stage; + // 0xB: The modified defensive stat stage of the defender for the last move used + u8 defensive_stat_stage; + // 0xC: The base offensive stat of the attacker for the last move used + u16 offensive_stat; + // 0xE: The base defensive stat of the defender for the last move used + u16 defensive_stat; + // 0x10: The Flash Fire boost of the attacker when a Fire move was last used + u16 flash_fire_boost; + // 0x12: The modified offense value calculated for the attacker for the last move used, + // prior to being clamped between 0 and 999 + u16 offense_calc; + // 0x14: The modified defense value calculated for the defender for the last move used + u16 defense_calc; + u16 attacker_level; // 0x16: The level of the attacker for the last move used + // 0x18: The intermediate quantity in the damage calculation called "AT" in debug logging, + // which corresponds to: round[ min(max(offense_calc, 0), 999) + power_calc ], + // where power_calc is a modified move power calculated as (intermediate rounding omitted): + // GetMovePower(...) * (offensive stat stage multipliers) * (offensive multipliers) + u16 damage_calc_at; + // 0x1A: An identical copy of defense_calc. This is probably a relic of development, + // when the final defense contribution to the damage formula might have been a different + // quantity computed from defense_calc, like how damage_calc_at is computed + // from offense_calc + u16 damage_calc_def; + // 0x1C: The intermediate quantity in the damage calculation called "FLV" in debug logging + // (effective level?), which corresponds to: round[ (offense_calc - defense_calc)/8 + level ] + u16 damage_calc_flv; + undefined field_0x1e; + undefined field_0x1f; + // 0x20: The result of the damage calculation after multiplying the base value by multipliers, + // but before applying random variation. There are also a couple stray multipliers applied + // after this result, including multipliers specific to the projectile move (the static 50%, + // and the Power Pitcher multiplier) and the Air Blade multiplier. + int damage_calc; + // 0x24: The intermediate quantity in the damage calculation resulting from the "base" damage + // calculation: the sum of the power, attack, defense, and level terms, modified by the + // non-team-member multiplier if relevant, and clamped between 1 and 999. + int damage_calc_base; + // 0x28: The random multiplier applied to the result of the damage calculation, as a + // percentage (so the actual factor, multiplied by 100), rounded to an integer. + int damage_calc_random_mult_pct; + // 0x2C: The calculated "static" damage multiplier applied to the output of the base damage + // calculation. "Static" in the sense that this part of the multiplier doesn't depend on + // variables like type-based effects, critical hits, and Reflect/Light Screen. Factors in + // the static damage multiplier include the argument to CalcDamage, the multiplier due to + // monster::me_first_flag, Reckless, and Iron Fist. + int static_damage_mult; + // 0x30: The net number of attack boosts to an attacker due to a Power Band or Munch Belt. + // It seems like there's a bug in the code; aura bows do not contribute to this field. + s8 item_atk_modifier; + // 0x31: The net number of special attack boosts to an attacker due to a Special Band, + // Munch Belt, or aura bow. It seems like there's a bug in the code; physical attack boosts + // from aura bows also contribute to this field. + s8 item_sp_atk_modifier; + // 0x32: The net number of offense boosts to an attacker due to Download, Rivalry, + // Flower Gift, and Solar Power + s8 ability_offense_modifier; + // 0x33: The net number of defense boosts to a defender due to Flower Gift + s8 ability_defense_modifier; + // 0x34: The net number of offense boosts to an attacker due to Aggressor, Defender, and + // Practice Swinger + s8 iq_skill_offense_modifier; + // 0x35: The net number of defense boosts to a defender due to Counter Basher, Aggressor, and + // Defender + s8 iq_skill_defense_modifier; + // 0x36: The net number of defense boosts to a defender due to a Def Scarf or aura bow. + // It seems like there's a bug in the code; special defense boosts from aura bows also + // contribute to this field. + s8 item_def_modifier; + // 0x37: The net number of special defense boosts to a defender due to a Zinc Band. + // It seems like there's a bug in the code; aura bows do not contribute to this field. + s8 item_sp_def_modifier; + // 0x38: Whether or not Scope Lens or Sharpshooter boosted the critical hit rate of a move + bool scope_lens_or_sharpshooter_activated; + // 0x39: Whether or not the Patsy Band boosted the critical hit rate of a move + bool patsy_band_activated; + // 0x3A: Whether or not Reflect or the Time Shield halved the damage from a physical move + bool half_physical_damage_activated; + // 0x3B: Whether or not Light Screen or the Aqua Mantle halved the damage from a special move + bool half_special_damage_activated; + // 0x3C: Whether or not the Enhanced critical-hit rate status maxed out the critical hit rate + // of a move + bool focus_energy_activated; + // 0x3D: Whether or not Type-Advantage Master boosted the critical hit rate of a move + bool type_advantage_master_activated; + // 0x3E: Whether or not a non-Normal-type move was dampened by Cloudy weather + bool cloudy_drop_activated; + // 0x3F: Whether or not a Fire or Water move was affected by Rainy weather + bool rain_multiplier_activated; + // 0x40: Whether or not a Fire or Water move was affected by Sunny weather + bool sunny_multiplier_activated; + // 0x41: Whether or a Fire move was dampened by Thick Fat or Heatproof + bool fire_move_ability_drop_activated; + // 0x42: Whether or not Flash Fire was activated at some point for Fire immunity + bool flash_fire_activated; + // 0x43: Whether or not Levitate was activated at some point for Ground immunity + bool levitate_activated; + bool torrent_boost_activated; // 0x44: Whether or not a Water move was boosted by Torrent + bool overgrow_boost_activated; // 0x45: Whether or not a Grass move was boosted by Overgrow + bool swarm_boost_activated; // 0x46: Whether or not a Bug move was boosted by Swarm + // 0x47: Whether or not a Fire move was boosted by either Blaze or Dry Skin + bool fire_move_ability_boost_activated; + // 0x48: Whether or not Scrappy was activated at some point to bypass immunity + bool scrappy_activated; + // 0x49: Whether or not Super Luck boosted the critical hit rate for a move + bool super_luck_activated; + // 0x4A: Whether or not Sniper boosted the critical hit damage multiplier for a move + bool sniper_activated; + bool stab_boost_activated; // 0x4B: Whether or not STAB was activated for a move + // 0x4C: Whether or not an Electric move was dampened by either Mud Sport or Fog + bool electric_move_dampened; + // 0x4D: Whether or not Water Sport was activated by a Fire move + bool water_sport_drop_activated; + bool charge_boost_activated; // 0x4E: Whether or not Charge was activated by an Electric move + undefined field_0x4f; + // 0x50: Whether or not a Ghost type's immunity to Normal/Fighting was activated at some point + bool ghost_immunity_activated; + // 0x51: Whether or not a defender took less damage due to the Charging Skull Bash status + bool skull_bash_defense_boost_activated; + undefined field_0x52; + undefined field_0x53; +}; + #endif //PMDSKY_DUNGEON_MODE_H diff --git a/include/enums.h b/include/enums.h index ca1cf24a..12b467a2 100644 --- a/include/enums.h +++ b/include/enums.h @@ -2012,6 +2012,50 @@ enum move_id { MOVE_TAG_0x22E = 558, }; +// Affects the chance of items spawning on each tile in a Kecleon Shop +// The chances (in %) of each tile (in a 3x3 area at the center of the shop) +// having an item are listed below. +enum shop_item_positions { + // 30 30 30 + // 100 100 30 + // 30 30 30 + SHOP_POSITION_0 = 0, + // 30 30 30 + // 100 30 30 + // 30 100 30 + SHOP_POSITION_1 = 1, + // 30 30 30 + // 100 30 30 + // 30 30 100 + SHOP_POSITION_2 = 2, + // 100 30 30 + // 30 30 100 + // 30 30 30 + SHOP_POSITION_3 = 3, + // 100 30 100 + // 30 30 30 + // 30 30 30 + SHOP_POSITION_4 = 4, + // 30 30 30 + // 30 30 100 + // 100 30 30 + SHOP_POSITION_5 = 5, + // 30 30 30 + // 100 30 100 + // 30 30 30 + // The rest of the entries all have the same layout + SHOP_POSITION_6 = 6, + SHOP_POSITION_7 = 7, + SHOP_POSITION_8 = 8, + SHOP_POSITION_9 = 9, + SHOP_POSITION_A = 10, + SHOP_POSITION_B = 11, + SHOP_POSITION_C = 12, + SHOP_POSITION_D = 13, + SHOP_POSITION_E = 14, + SHOP_POSITION_F = 15, +}; + // Ability ID enum ability_id { ABILITY_UNKNOWN = 0, @@ -2402,6 +2446,120 @@ enum dungeon_id { DUNGEON_DUMMY_0xFF = 255, }; +// Dungeon group ID. +// This is more in line with what we would think of as a "whole dungeon". +// A single dungeon group might encompass multiple dungeon IDs. +enum dungeon_group_id { + DGROUP_TEST_DUNGEON = 0, + DGROUP_BEACH_CAVE = 1, + DGROUP_DRENCHED_BLUFF = 2, + DGROUP_MT_BRISTLE = 3, + DGROUP_WATERFALL_CAVE = 4, + DGROUP_APPLE_WOODS = 5, + DGROUP_CRAGGY_COAST = 6, + DGROUP_SIDE_PATH = 7, + DGROUP_MT_HORN = 8, + DGROUP_ROCK_PATH = 9, + DGROUP_FOGGY_FOREST = 10, + DGROUP_FOREST_PATH = 11, + DGROUP_STEAM_CAVE = 12, + DGROUP_AMP_PLAINS = 13, + DGROUP_NORTHERN_DESERT = 14, + DGROUP_QUICKSAND_CAVE = 15, + DGROUP_CRYSTAL_CAVE = 16, + DGROUP_CRYSTAL_CROSSING = 17, + DGROUP_CHASM_CAVE = 18, + DGROUP_DARK_HILL = 19, + DGROUP_SEALED_RUIN = 20, + DGROUP_DUSK_FOREST = 21, + DGROUP_DEEP_DUSK_FOREST = 22, + DGROUP_TREESHROUD_FOREST = 23, + DGROUP_BRINE_CAVE = 24, + DGROUP_HIDDEN_LAND = 25, + DGROUP_TEMPORAL_TOWER = 26, + DGROUP_MYSTIFYING_FOREST = 27, + DGROUP_MIDNIGHT_FOREST = 28, + DGROUP_LAKE_AFAR = 29, + DGROUP_MT_MISTRAL = 30, + DGROUP_SHIMMER_HILL = 31, + DGROUP_BOTTOMLESS_SEA = 32, + DGROUP_SURROUNDED_SEA = 33, + DGROUP_MIRACLE_SEA = 34, + DGROUP_CONCEALED_RUINS = 35, + DGROUP_LOST_WILDERNESS = 36, + DGROUP_MYSTERY_JUNGLE = 37, + DGROUP_HAPPY_OUTLOOK = 38, + DGROUP_SERENITY_RIVER = 39, + DGROUP_LANDSLIDE_CAVE = 40, + DGROUP_BLIZZARD_ISLAND = 41, + DGROUP_SHIMMER_DESERT = 42, + DGROUP_CREVICE_CAVE = 43, + DGROUP_MT_AVALANCHE = 44, + DGROUP_GIANT_VOLCANO = 45, + DGROUP_WORLD_ABYSS = 46, + DGROUP_LUSH_PRAIRIE = 47, + DGROUP_TINY_MEADOW = 48, + DGROUP_LABYRINTH_CAVE = 49, + DGROUP_ORAN_FOREST = 50, + DGROUP_SKY_STAIRWAY = 51, + DGROUP_AEGIS_CAVE = 52, + DGROUP_MAROWAK_DOJO = 53, + DGROUP_DARK_CRATER = 54, + DGROUP_MARINE_RESORT = 55, + DGROUP_MT_TRAVAIL = 56, + DGROUP_THE_NIGHTMARE = 57, + DGROUP_SPACIAL_RIFT = 58, + DGROUP_ZERO_ISLE_NORTH = 59, + DGROUP_ZERO_ISLE_WEST = 60, + DGROUP_ZERO_ISLE_EAST = 61, + DGROUP_ZERO_ISLE_SOUTH = 62, + DGROUP_RESCUE = 63, + DGROUP_ZERO_ISLE_CENTER = 64, + DGROUP_DESTINY_TOWER = 65, + DGROUP_DUMMY_0x42 = 66, + DGROUP_DUMMY_0x43 = 67, + DGROUP_OBLIVION_FOREST = 68, + DGROUP_TREACHEROUS_WATERS = 69, + DGROUP_SOUTHEASTERN_ISLANDS = 70, + DGROUP_INFERNO_CAVE = 71, + DGROUP_SKY_PEAK = 72, + DGROUP_STAR_CAVE_SE1 = 73, + DGROUP_MURKY_FOREST = 74, + DGROUP_EASTERN_CAVE = 75, + DGROUP_FORTUNE_RAVINE = 76, + DGROUP_BARREN_VALLEY = 77, + DGROUP_DARK_WASTELAND = 78, + DGROUP_TEMPORAL_TOWER_SE5 = 79, + DGROUP_DUSK_FOREST_SE5 = 80, + DGROUP_SPACIAL_CLIFFS = 81, + DGROUP_DARK_ICE_MOUNTAIN = 82, + DGROUP_ICICLE_FOREST = 83, + DGROUP_VAST_ICE_MOUNTAIN = 84, + DGROUP_SOUTHERN_JUNGLE = 85, + DGROUP_BOULDER_QUARRY = 86, + DGROUP_RIGHT_CAVE_PATH = 87, + DGROUP_LEFT_CAVE_PATH = 88, + DGROUP_LIMESTONE_CAVERN = 89, + DGROUP_SPRING_CAVE = 90, + DGROUP_STAR_CAVE = 91, + DGROUP_LITTLE_PLAINS = 92, + DGROUP_MT_CLEAR = 93, + DGROUP_CHALLENGE_RIVER = 94, + DGROUP_TRIAL_FOREST = 95, + DGROUP_GUIDING_SEA = 96, + DGROUP_HIDDEN_SHOPKEEPER_VILLAGE = 97, + DGROUP_DUMMY_0x62 = 98, + DGROUP_DUMMY_0x63 = 99, +}; + +// Controls whether the loop that runs until the current floor ends should continue +// iterating or not and why +enum floor_loop_status { + FLOOR_LOOP_CONTINUE = 0, // The floor loop keeps executing as normal + FLOOR_LOOP_LEADER_FAINTED = 1, // The floor loop exits because the leader fainted + FLOOR_LOOP_NEXT_FLOOR = 2, // The floor loop exits because the floor is over +}; + // Type IDx enum type_id { TYPE_NONE = 0, @@ -3459,6 +3617,500 @@ enum status_id { STATUS_STAIR_SPOTTER = 101, // Can locate stairs }; +// Mission type on a floor +enum mission_type { + MISSION_RESCUE_CLIENT = 0, + MISSION_RESCUE_TARGET = 1, + MISSION_ESCORT_TO_TARGET = 2, + MISSION_EXPLORE_WITH_CLIENT = 3, + MISSION_PROSPECT_WITH_CLIENT = 4, + MISSION_GUIDE_CLIENT = 5, + MISSION_FIND_ITEM = 6, + MISSION_DELIVER_ITEM = 7, + MISSION_SEARCH_FOR_TARGET = 8, + MISSION_TAKE_ITEM_FROM_OUTLAW = 9, + MISSION_ARREST_OUTLAW = 10, + MISSION_CHALLENGE_REQUEST = 11, + MISSION_TREASURE_MEMO = 12, + MISSION_TYPE_UNK_0xD = 13, + MISSION_SPECIAL_EPISODE = 14, +}; + +// Fixed room ID. Fixed rooms can be full floor layouts, like most end-of-dungeon boss chambers, +// multi-room layouts in the case of Treasure Memos, or single rooms within a larger floor layout +// like with key chambers. +enum fixed_room_id { + FIXED_NONE = 0, + FIXED_BEACH_CAVE_PIT = 1, + FIXED_MT_BRISTLE_PEAK = 2, + FIXED_STEAM_CAVE_PEAK = 3, + FIXED_AMP_CLEARING = 4, + FIXED_UNDERGROUND_LAKE = 5, + FIXED_CRYSTAL_LAKE = 6, + FIXED_SEALED_RUIN_PIT = 7, + FIXED_BRINE_CAVE_PIT = 8, + FIXED_OLD_RUINS = 9, + FIXED_TEMPORAL_PINNACLE = 10, + FIXED_MYSTIFYING_FOREST_CLEARING = 11, + FIXED_CREVICE_CAVE_PIT = 12, + FIXED_MIRACLE_SEABED = 13, + FIXED_REGICE_CHAMBER = 14, + FIXED_REGIROCK_CHAMBER = 15, + FIXED_REGISTEEL_CHAMBER = 16, + FIXED_REGIGIGAS_CHAMBER = 17, + FIXED_SPACIAL_RIFT_BOTTOM = 18, + FIXED_DARK_CRATER_PIT = 19, + FIXED_GIANT_VOLCANO_PEAK = 20, + FIXED_SHIMMER_DESERT_PIT = 21, + FIXED_MT_AVALANCHE_PEAK = 22, + FIXED_BOTTOMLESS_SEA_DEPTHS = 23, + FIXED_WORLD_ABYSS_PIT = 24, + FIXED_DEEP_MYSTERY_JUNGLE = 25, + FIXED_SKY_STAIRWAY_APEX = 26, + FIXED_EMPTY_OCTAGON = 27, + FIXED_SKY_PEAK_5TH_STATION_CLEARING = 28, + FIXED_SKY_PEAK_SUMMIT = 29, + FIXED_DEEP_STAR_CAVE_SE1 = 30, + FIXED_STAR_CAVE_PIT_SE1 = 31, + FIXED_FORTUNE_RAVINE_PIT = 32, + FIXED_BARREN_VALLEY_CLEARING = 33, + FIXED_BLACK_SWAMP = 34, + FIXED_DARK_ICE_MOUNTAIN_PINNACLE = 35, + FIXED_VAST_ICE_MOUNTAIN_PINNACLE = 36, + FIXED_BOULDER_QUARRY_CLEARING = 37, + FIXED_LIMESTONE_CAVERN_DEPTHS = 38, + FIXED_UPPER_SPRING_CAVE = 39, + FIXED_MIDDLE_SPRING_CAVE = 40, + FIXED_SPRING_CAVE_PIT = 41, + FIXED_DEEP_STAR_CAVE = 42, + FIXED_BARREN_VALLEY_CLEARING_REVISIT = 43, + FIXED_UNUSED_0x2C = 44, + FIXED_UNUSED_0x2D = 45, + FIXED_UNUSED_0x2E = 46, + FIXED_UNUSED_0x2F = 47, + FIXED_UNUSED_0x30 = 48, + FIXED_UNUSED_0x31 = 49, + FIXED_UNUSED_0x32 = 50, + FIXED_UNUSED_0x33 = 51, + FIXED_UNUSED_0x34 = 52, + FIXED_UNUSED_0x35 = 53, + FIXED_UNUSED_0x36 = 54, + FIXED_UNUSED_0x37 = 55, + FIXED_UNUSED_0x38 = 56, + FIXED_UNUSED_0x39 = 57, + FIXED_UNUSED_0x3A = 58, + FIXED_UNUSED_0x3B = 59, + FIXED_UNUSED_0x3C = 60, + FIXED_UNUSED_0x3D = 61, + FIXED_UNUSED_0x3E = 62, + FIXED_TEST = 63, + FIXED_EMPTY_RECTANGLE = 64, + FIXED_BEACH_CAVE_PIT_REVISIT = 65, + FIXED_MT_BRISTLE_PEAK_REVISIT = 66, + FIXED_STEAM_CAVE_PEAK_REVISIT = 67, + FIXED_AMP_CLEARING_REVISIT = 68, + FIXED_UNDERGROUND_LAKE_REVISIT = 69, + FIXED_CRYSTAL_LAKE_REVISIT = 70, + FIXED_SEALED_RUIN_PIT_REVISIT = 71, + FIXED_BRINE_CAVE_PIT_REVISIT = 72, + FIXED_OLD_RUINS_REVISIT = 73, + FIXED_TEMPORAL_PINNACLE_REVISIT = 74, + FIXED_REGIGIGAS_CHAMBER_REVISIT = 75, + FIXED_SPACIAL_RIFT_BOTTOM_REVISIT = 76, + FIXED_DARK_CRATER_PIT_REVISIT = 77, + FIXED_UNUSED_0x4E = 78, + FIXED_UNUSED_0x4F = 79, + FIXED_LABYRINTH_CAVE = 80, + FIXED_ZERO_ISLE_NORTH = 81, + FIXED_ZERO_ISLE_EAST = 82, + FIXED_ZERO_ISLE_WEST = 83, + FIXED_ZERO_ISLE_SOUTH = 84, + FIXED_ORAN_FOREST = 85, + FIXED_MARINE_RESORT = 86, + FIXED_SERENITY_RIVER = 87, + FIXED_LANDSLIDE_CAVE = 88, + FIXED_LUSH_PRAIRIE = 89, + FIXED_TINY_MEADOW = 90, + FIXED_SURROUNDED_SEA = 91, + FIXED_CONCEALED_RUINS = 92, + FIXED_LAKE_AFAR = 93, + FIXED_HAPPY_OUTLOOK = 94, + FIXED_MT_MISTRAL = 95, + FIXED_SHIMMER_HILL = 96, + FIXED_LOST_WILDERNESS = 97, + FIXED_MIDNIGHT_FOREST = 98, + FIXED_ZERO_ISLE_CENTER = 99, + FIXED_OBLIVION_FOREST = 100, + FIXED_TREACHEROUS_WATERS = 101, + FIXED_SOUTHEASTERN_ISLANDS = 102, + FIXED_INFERNO_CAVE = 103, + FIXED_MIDNIGHT_FOREST_COPY = 104, + FIXED_UNUSED_0x69 = 105, + FIXED_UNUSED_0x6A = 106, + FIXED_UNUSED_0x6B = 107, + FIXED_UNUSED_0x6C = 108, + FIXED_UNUSED_0x6D = 109, + FIXED_SUBSTITUTE_ROOM = 110, + FIXED_GOLDEN_CHAMBER = 111, + FIXED_SECRET_BAZAAR = 112, + FIXED_SECRET_ROOM = 113, + FIXED_TREASURE_MEMO_0 = 114, + FIXED_TREASURE_MEMO_1 = 115, + FIXED_TREASURE_MEMO_2 = 116, + FIXED_TREASURE_MEMO_3 = 117, + FIXED_TREASURE_MEMO_4 = 118, + FIXED_TREASURE_MEMO_5 = 119, + FIXED_TREASURE_MEMO_6 = 120, + FIXED_TREASURE_MEMO_7 = 121, + FIXED_TREASURE_MEMO_8 = 122, + FIXED_TREASURE_MEMO_9 = 123, + FIXED_TREASURE_MEMO_10 = 124, + FIXED_TREASURE_MEMO_11 = 125, + FIXED_TREASURE_MEMO_12 = 126, + FIXED_TREASURE_MEMO_13 = 127, + FIXED_TREASURE_MEMO_14 = 128, + FIXED_TREASURE_MEMO_15 = 129, + FIXED_TREASURE_MEMO_16 = 130, + FIXED_TREASURE_MEMO_17 = 131, + FIXED_TREASURE_MEMO_18 = 132, + FIXED_TREASURE_MEMO_19 = 133, + FIXED_TREASURE_MEMO_20 = 134, + FIXED_TREASURE_MEMO_21 = 135, + FIXED_TREASURE_MEMO_22 = 136, + FIXED_TREASURE_MEMO_23 = 137, + FIXED_TREASURE_MEMO_24 = 138, + FIXED_TREASURE_MEMO_25 = 139, + FIXED_TREASURE_MEMO_26 = 140, + FIXED_TREASURE_MEMO_27 = 141, + FIXED_TREASURE_MEMO_28 = 142, + FIXED_TREASURE_MEMO_29 = 143, + FIXED_TREASURE_MEMO_30 = 144, + FIXED_MEWTWO_CHALLENGE_FLOOR = 145, + FIXED_ENTEI_CHALLENGE_FLOOR = 146, + FIXED_RAIKOU_CHALLENGE_FLOOR = 147, + FIXED_SUICUNE_CHALLENGE_FLOOR = 148, + FIXED_STAR_CAVE_PIT = 149, + FIXED_CHALLENGE_LETTER_FLOOR_1 = 150, + FIXED_CHALLENGE_LETTER_FLOOR_2 = 151, + FIXED_CHALLENGE_LETTER_FLOOR_3 = 152, + FIXED_CHALLENGE_LETTER_FLOOR_4 = 153, + FIXED_CHALLENGE_LETTER_FLOOR_5 = 154, + FIXED_UNUSED_0x9B = 155, + FIXED_UNUSED_0x9C = 156, + FIXED_UNUSED_0x9D = 157, + FIXED_UNUSED_0x9E = 158, + FIXED_UNUSED_0x9F = 159, + FIXED_OUTLAW_TEAM_FLOOR_1 = 160, + FIXED_OUTLAW_TEAM_FLOOR_2 = 161, + FIXED_OUTLAW_TEAM_FLOOR_3 = 162, + FIXED_OUTLAW_TEAM_FLOOR_4 = 163, + FIXED_OUTLAW_TEAM_FLOOR_5 = 164, + FIXED_SEALED_CHAMBER = 165, + FIXED_UNUSED_0xA6 = 166, + FIXED_UNUSED_0xA7 = 167, + FIXED_UNUSED_0xA8 = 168, + FIXED_UNUSED_0xA9 = 169, + FIXED_CLEAR_SILK_CHAMBER = 170, + FIXED_ORANGE_SILK_CHAMBER = 171, + FIXED_GREEN_SILK_CHAMBER = 172, + FIXED_IRON_SILK_CHAMBER = 173, + FIXED_JOY_SEED_CHAMBER_6X = 174, + FIXED_FRIEND_BOW_CHAMBER = 175, + FIXED_PINK_SILK_CHAMBER = 176, + FIXED_GRAY_SILK_CHAMBER = 177, + FIXED_PURPLE_SILK_CHAMBER = 178, + FIXED_JOY_SEED_CHAMBER_1X = 179, + FIXED_ROYAL_SILK_CHAMBER = 180, + FIXED_MIRACLE_CHEST_CHAMBER = 181, + FIXED_BROWN_SILK_CHAMBER = 182, + FIXED_SKY_SILK_CHAMBER = 183, + FIXED_GOLD_SILK_CHAMBER = 184, + FIXED_BLACK_SILK_CHAMBER = 185, + FIXED_JOY_SEED_CHAMBER_2X = 186, + FIXED_WONDER_GUMMI_CHAMBER = 187, + FIXED_ITEM_CHAMBER_1 = 188, + FIXED_ITEM_CHAMBER_2 = 189, + FIXED_WONDER_CHEST_CHAMBER = 190, + FIXED_RED_SILK_CHAMBER = 191, + FIXED_BLUE_SILK_CHAMBER = 192, + FIXED_GRASS_SILK_CHAMBER = 193, + FIXED_YELLOW_SILK_CHAMBER = 194, + FIXED_REVIVER_SEED_CHAMBER_1 = 195, + FIXED_REVIVER_SEED_CHAMBER_2 = 196, + FIXED_EMPTY_SEALED_CHAMBER = 197, + FIXED_UNUSED_0xC6 = 198, + FIXED_UNUSED_0xC7 = 199, + FIXED_UNUSED_0xC8 = 200, + FIXED_UNUSED_0xC9 = 201, + FIXED_UNUSED_0xCA = 202, + FIXED_UNUSED_0xCB = 203, + FIXED_UNUSED_0xCC = 204, + FIXED_UNUSED_0xCD = 205, + FIXED_UNUSED_0xCE = 206, + FIXED_UNUSED_0xCF = 207, + FIXED_UNUSED_0xD0 = 208, + FIXED_UNUSED_0xD1 = 209, + FIXED_UNUSED_0xD2 = 210, + FIXED_UNUSED_0xD3 = 211, + FIXED_UNUSED_0xD4 = 212, + FIXED_UNUSED_0xD5 = 213, + FIXED_UNUSED_0xD6 = 214, + FIXED_UNUSED_0xD7 = 215, + FIXED_UNUSED_0xD8 = 216, + FIXED_UNUSED_0xD9 = 217, + FIXED_UNUSED_0xDA = 218, + FIXED_UNUSED_0xDB = 219, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_1 = 220, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_2 = 221, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_3 = 222, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_4 = 223, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_5 = 224, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_6 = 225, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_7 = 226, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_8 = 227, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_9 = 228, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_10 = 229, + FIXED_UNUSED_0xE6 = 230, + FIXED_UNUSED_0xE7 = 231, + FIXED_UNUSED_0xE8 = 232, + FIXED_UNUSED_0xE9 = 233, + FIXED_UNUSED_0xEA = 234, + FIXED_UNUSED_0xEB = 235, + FIXED_UNUSED_0xEC = 236, + FIXED_UNUSED_0xED = 237, + FIXED_UNUSED_0xEE = 238, + FIXED_UNUSED_0xEF = 239, + FIXED_UNUSED_0xF0 = 240, + FIXED_UNUSED_0xF1 = 241, + FIXED_UNUSED_0xF2 = 242, + FIXED_UNUSED_0xF3 = 243, + FIXED_UNUSED_0xF4 = 244, + FIXED_UNUSED_0xF5 = 245, + FIXED_UNUSED_0xF6 = 246, + FIXED_UNUSED_0xF7 = 247, + FIXED_UNUSED_0xF8 = 248, + FIXED_UNUSED_0xF9 = 249, + FIXED_UNUSED_0xFA = 250, + FIXED_UNUSED_0xFB = 251, + FIXED_UNUSED_0xFC = 252, + FIXED_UNUSED_0xFD = 253, + FIXED_UNUSED_0xFE = 254, + FIXED_UNUSED_0xFF = 255, +}; + +// The cause of a monster taking damage, not including the move case. +// These codes should all be greater than any move ID. +// Some of the values are used as faint reasons or on the "The Last Outing" screen +// rather than as damage sources. +enum damage_source_non_move { + DAMAGE_SOURCE_TRANSFORM_FRIEND = 563, // "was transformed into a friend" + DAMAGE_SOURCE_NOT_BEFRIENDED = 564, // "left without being befriended" + DAMAGE_SOURCE_DEBUG_ATTACK = 565, + DAMAGE_SOURCE_JUMP_KICK = 566, + DAMAGE_SOURCE_HI_JUMP_KICK = 567, + DAMAGE_SOURCE_DESTINY_BOND = 568, + DAMAGE_SOURCE_SLUDGE = 569, + DAMAGE_SOURCE_POWERFUL_MOVE_1 = 570, + DAMAGE_SOURCE_POWERFUL_MOVE_2 = 571, + DAMAGE_SOURCE_RECOIL = 572, + DAMAGE_SOURCE_SPLASH = 573, + DAMAGE_SOURCE_ENERGY = 574, // "an enemy's pent-up energy" + DAMAGE_SOURCE_POWERFUL_MOVE_3 = 575, + DAMAGE_SOURCE_POWERFUL_MOVE_4 = 576, + DAMAGE_SOURCE_POWERFUL_MOVE_5 = 577, + DAMAGE_SOURCE_POWERFUL_MOVE_6 = 578, + DAMAGE_SOURCE_POWERFUL_MOVE_7 = 579, + DAMAGE_SOURCE_POWERFUL_MOVE_8 = 580, + DAMAGE_SOURCE_SPIKES = 581, + DAMAGE_SOURCE_DEBUG_DAMAGE = 582, + DAMAGE_SOURCE_BURN = 583, + DAMAGE_SOURCE_CONSTRICTION = 584, + DAMAGE_SOURCE_POISON = 585, + DAMAGE_SOURCE_WRAP = 586, + DAMAGE_SOURCE_CURSE = 587, + DAMAGE_SOURCE_LEECH_SEED = 588, + DAMAGE_SOURCE_PERISH_SONG = 589, + DAMAGE_SOURCE_NIGHTMARE = 590, + DAMAGE_SOURCE_THROWN_ROCK = 591, + DAMAGE_SOURCE_HUNGER = 592, + DAMAGE_SOURCE_EXPLODED = 593, // I think this one is only used for the monster that explodes. + // Other monsters that are hit by the explosion use + // DAMAGE_SOURCE_EXPLOSION. + DAMAGE_SOURCE_CHESTNUT_TRAP = 594, + DAMAGE_SOURCE_TRAP = 595, + DAMAGE_SOURCE_PITFALL_TRAP = 596, + DAMAGE_SOURCE_BLAST_SEED = 597, + DAMAGE_SOURCE_THROWN_ITEM = 598, + DAMAGE_SOURCE_TRANSFORM_ITEM = 599, + DAMAGE_SOURCE_KNOCKED_FLYING = 600, + DAMAGE_SOURCE_FLYING_MONSTER = 601, + DAMAGE_SOURCE_GAVE_UP = 602, // "gave up the exploration" + DAMAGE_SOURCE_DELETED = 603, // "was deleted for the sake of an event" + DAMAGE_SOURCE_WENT_AWAY = 604, // "went away" + DAMAGE_SOURCE_UNSEEN_FORCE = 605, + DAMAGE_SOURCE_PARTNER_FAINTED = 606, // "returned with the fallen partner" + DAMAGE_SOURCE_WEATHER = 607, + DAMAGE_SOURCE_POSSESS = 608, + DAMAGE_SOURCE_CLIENT_FAINTED = 609, // "failed to protect the client Pokémon" + DAMAGE_SOURCE_ITEM_ORB = 610, + DAMAGE_SOURCE_ITEM_NON_ORB = 611, + DAMAGE_SOURCE_UNK612 = 612, // "-" + DAMAGE_SOURCE_ESCORT_FAINTED = 613, // "failed to escort the client Pokémon" + DAMAGE_SOURCE_OTHER_MONSTER_FAINTED = 614, // "returned with the fallen [string:2]" + DAMAGE_SOURCE_BIDOOF_FAINTED = 615, + DAMAGE_SOURCE_GROVYLE_FAINTED = 616, + DAMAGE_SOURCE_CELEBI_FAINTED = 617, + DAMAGE_SOURCE_CHATOT_FAINTED = 618, + DAMAGE_SOURCE_CRESSELIA_FAINTED = 619, + DAMAGE_SOURCE_TOXIC_SPIKES = 620, + DAMAGE_SOURCE_STEALTH_ROCK = 621, + DAMAGE_SOURCE_BAD_DREAMS = 622, + DAMAGE_SOURCE_EXPLOSION = 623, + DAMAGE_SOURCE_OREN_BERRY = 624, + DAMAGE_SOURCE_DUMMY_625 = 625, + DAMAGE_SOURCE_DUMMY_626 = 626, + DAMAGE_SOURCE_DUMMY_627 = 627, + DAMAGE_SOURCE_DUMMY_628 = 628, + DAMAGE_SOURCE_DUMMY_629 = 629, + DAMAGE_SOURCE_DUMMY_630 = 630, + DAMAGE_SOURCE_DUMMY_631 = 631, + DAMAGE_SOURCE_DUMMY_632 = 632, + DAMAGE_SOURCE_ESCAPE = 633, // "Escaped in the middle of exploration" + DAMAGE_SOURCE_DUNGEON_CLEAR = 634, // "cleared the dungeon" + DAMAGE_SOURCE_RESCUE_SUCCESS = 635, // "succeeded in the rescue mission" + DAMAGE_SOURCE_MISSION_COMPLETE = 636, // "completed a mission! Impressive!" + DAMAGE_SOURCE_BEFRIEND_MEW = 637, // "befriended [CS:N]Mew[CR]!" +}; + +union damage_source { + enum move_id move; + enum damage_source_non_move other; +}; + +// Weather ID +enum weather_id { + WEATHER_CLEAR = 0, + WEATHER_SUNNY = 1, + WEATHER_SANDSTORM = 2, + WEATHER_CLOUDY = 3, + WEATHER_RAIN = 4, + WEATHER_HAIL = 5, + WEATHER_FOG = 6, + WEATHER_SNOW = 7, + WEATHER_RANDOM = 8, +}; + +// Floor layout type during floor generation +enum floor_layout { + LAYOUT_LARGE = 0, + LAYOUT_SMALL = 1, + LAYOUT_ONE_ROOM_MONSTER_HOUSE = 2, + LAYOUT_OUTER_RING = 3, + LAYOUT_CROSSROADS = 4, + LAYOUT_TWO_ROOMS_WITH_MONSTER_HOUSE = 5, + LAYOUT_LINE = 6, + LAYOUT_CROSS = 7, + LAYOUT_LARGE_0x8 = 8, + LAYOUT_BEETLE = 9, + LAYOUT_OUTER_ROOMS = 10, + LAYOUT_MEDIUM = 11, + LAYOUT_UNUSED_0xC = 12, + LAYOUT_UNUSED_0xD = 13, + LAYOUT_UNUSED_0xE = 14, + LAYOUT_UNUSED_0xF = 15, +}; + +// Trap ID +enum trap_id { + TRAP_NULL_TRAP = 0, + TRAP_MUD_TRAP = 1, + TRAP_STICKY_TRAP = 2, + TRAP_GRIMY_TRAP = 3, + TRAP_SUMMON_TRAP = 4, + TRAP_PITFALL_TRAP = 5, + TRAP_WARP_TRAP = 6, + TRAP_GUST_TRAP = 7, + TRAP_SPIN_TRAP = 8, + TRAP_SLUMBER_TRAP = 9, + TRAP_SLOW_TRAP = 10, + TRAP_SEAL_TRAP = 11, + TRAP_POISON_TRAP = 12, + TRAP_SELFDESTRUCT_TRAP = 13, + TRAP_EXPLOSION_TRAP = 14, + TRAP_PP_ZERO_TRAP = 15, + TRAP_CHESTNUT_TRAP = 16, + TRAP_WONDER_TILE = 17, + TRAP_POKEMON_TRAP = 18, + TRAP_SPIKED_TILE = 19, + TRAP_STEALTH_ROCK = 20, + TRAP_TOXIC_SPIKES = 21, + TRAP_TRIP_TRAP = 22, + TRAP_RANDOM_TRAP = 23, + TRAP_GRUDGE_TRAP = 24, + // Used in fixed room data to indicate that a trap shouldn't be placed on the current tile + // Also used to indicate a random non-wonder tile trap should be selected instead during play + TRAP_NONE = 25, + TRAP_0x1A = 26, + TRAP_0x1B = 27, + TRAP_0x1C = 28, + TRAP_0x1D = 29, + TRAP_0x1E = 30, + TRAP_0x1F = 31, + // Behaves identically to a normal pitfall trap, but uses the sprite where the grate is + // already broken. TRAP_PITFALL_TRAP becomes this one when something falls through. + TRAP_BROKEN_PITFALL_TRAP = 32, +}; + +// The type of hidden stairs (i.e. where it leads), if present +enum hidden_stairs_type { + HIDDEN_STAIRS_NONE = 0, + HIDDEN_STAIRS_SECRET_BAZAAR = 1, + HIDDEN_STAIRS_SECRET_ROOM = 2, + HIDDEN_STAIRS_RANDOM_SECRET_BAZAAR_OR_SECRET_ROOM = 255, + HIDDEN_STAIRS_PADDING = 0xffffffff, +}; + +// Used to determine which version of a dungeon to load. +enum game_id { + GAME_SKY = 0, + GAME_TIME = 1, + GAME_DARKNESS = 2, + GAME_PADDING = 0xffffffff, +}; + +// Objective while in a dungeon +enum dungeon_objective { + OBJECTIVE_STORY = 0, // This dungeon visit is part of the story + OBJECTIVE_NORMAL = 1, + OBJECTIVE_RESCUE = 2, // Rescuing another player + OBJECTIVE_UNK_GAME_MODE_5 = 3, // $GAME_MODE == 5 when entering the dungeon +}; + +// Move category +enum move_category { + CATEGORY_PHYSICAL = 0, + CATEGORY_SPECIAL = 1, + CATEGORY_STATUS = 2, + CATEGORY_NONE = 3, // this is a guess +}; + +enum type_matchup { + MATCHUP_IMMUNE = 0, + MATCHUP_NOT_VERY_EFFECTIVE = 1, + MATCHUP_NEUTRAL = 2, + MATCHUP_SUPER_EFFECTIVE = 3, +}; + +// List of reasons why you can get forcefully kicked out of a dungeon +enum forced_loss_reason { + FORCED_LOSS_NONE = 0, // You don't have to get kicked out of the dungeon + FORCED_LOSS_PARTNER_FAINTED = 1, // Your partner fainted (before postgame) + FORCED_LOSS_CLIENT_FAINTED = 2, // Your client fainted + FORCED_LOSS_ESCORT_FAINTED = 3, // The client you had to escort fainted + // "Your client [name:0] couldn't join you. Let's return to Treasure Town." + FORCED_LOSS_CLIENT_CANT_JOIN = 4, + FORCED_LOSS_PADDING = 0xffffffff, +}; #endif //PMDSKY_ENUMS_H diff --git a/src/overlay_3102382820.c b/src/overlay_3102382820.c index e96316ad..a96cab41 100644 --- a/src/overlay_3102382820.c +++ b/src/overlay_3102382820.c @@ -148,7 +148,7 @@ void DrawDungeonMenuStatusWindow(struct Window* window) void DungeonMenuSwitch(struct Window* window) { struct PPStrValues str_values; - str_values.dungeon_0 = DUNGEON_PTR->dungeon | 0x40000; + str_values.dungeon_0 = DUNGEON_PTR->id | 0x40000; str_values.digits_0 = DUNGEON_PTR->floor; u8* str_buff = sub_02025888(); PreprocessString(str_buff, 0x400, DUNGEON_MENU_SWITCH_STR1, 0, &str_values);