merge master

This commit is contained in:
DizzyEggg 2024-11-21 08:59:33 +01:00
commit 12422602e3
44 changed files with 6724 additions and 14878 deletions

View File

@ -285,7 +285,7 @@ _08040370:
mov r7, r10
ands r7, r0
_08040378:
bl sub_8043D10
bl GetFloorType
lsls r0, 24
cmp r0, 0
bne _08040398
@ -498,7 +498,7 @@ _08040500:
ands r0, r1
cmp r0, 0
beq _08040548
bl sub_8043D10
bl GetFloorType
lsls r0, 24
movs r6, 0x5
cmp r0, 0
@ -513,7 +513,7 @@ _08040528:
ands r0, r1
cmp r0, 0
beq _08040548
bl sub_8043D10
bl GetFloorType
lsls r0, 24
movs r6, 0x5
cmp r0, 0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5979,7 +5979,7 @@ sub_80649A0:
bl sub_803ECB4
movs r0, 0
bl sub_80073B8
bl sub_8043D10
bl GetFloorType
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -6109,7 +6109,7 @@ _08064A58:
ldr r0, [sp, 0xE4]
movs r1, 0
bl sub_803ECB4
bl sub_8043D10
bl GetFloorType
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24

View File

@ -1081,7 +1081,7 @@ _0807DD94:
movs r3, 0
ldrsh r1, [r1, r3]
movs r2, 0x1
bl sub_8050C30
bl StairsAlwaysReachable
lsls r0, 24
cmp r0, 0
beq _0807DE02

View File

@ -2497,7 +2497,7 @@ _0807FA56:
movs r0, 0x11
mov r1, sp
movs r2, 0x2
bl sub_8045684
bl SpawnTrap
cmp r0, 0
beq _0807FA88
str r0, [r4, 0x14]
@ -2508,7 +2508,7 @@ _0807FA56:
_0807FA72:
mov r1, sp
movs r2, 0
bl sub_8045684
bl SpawnTrap
cmp r0, 0
beq _0807FA88
str r0, [r4, 0x14]

View File

@ -3,8 +3,8 @@
#include "structs/dungeon_entity.h"
Entity *sub_8045684(u8 trapID, DungeonPos *pos, u8 c);
Entity *SpawnTrap(u8 trapID, DungeonPos *pos, u8 c);
Entity *sub_8045708(DungeonPos *pos);
void sub_80457DC(Entity* ent);
#endif // GUARD_CODE_80227B8_H
#endif // GUARD_CODE_80227B8_H

View File

@ -2,6 +2,7 @@
#define GUARD_CONSTANTS_DIRECTION_H
#define DIRECTION_MASK 7
#define DIRECTION_MASK_CARDINAL 6 // Only South, East, North and West
enum Direction
{

View File

@ -0,0 +1,63 @@
#ifndef GUARD_DUNGEON_GENERATION_H
#define GUARD_DUNGEON_GENERATION_H
/*
* Defines key constant values for floor generation, providing a way
* to modify these constants if desired.
*/
#define GENERATION_CONSTANT_MERGE_ROOMS_CHANCE 5 // (0 to 100) probability to merge two rooms together
#define GENERATION_CONSTANT_NO_IMPERFECTIONS_CHANCE 60 // (0 to 100) probability that a room will not have imperfections, if it was already flagged for them
#define GENERATION_CONSTANT_SECONDARY_STRUCTURE_FLAG_CHANCE 80 // (0 to 100) probability that a room will be flagged to have a secondary structure.
enum FloorLayout {
LAYOUT_LARGE,
LAYOUT_SMALL,
LAYOUT_ONE_ROOM_MONSTER_HOUSE,
LAYOUT_OUTER_RING,
LAYOUT_CROSSROADS,
LAYOUT_TWO_ROOMS_WITH_MONSTER_HOUSE,
LAYOUT_LINE,
LAYOUT_CROSS,
LAYOUT_LARGE_0x8,
LAYOUT_BEETLE,
LAYOUT_OUTER_ROOMS,
LAYOUT_MEDIUM,
LAYOUT_UNUSED_0xC,
LAYOUT_UNUSED_0xD,
LAYOUT_UNUSED_0xE,
LAYOUT_UNUSED_0xF,
NUM_FLOOR_LAYOUTS
};
enum FloorSize {
FLOOR_SIZE_LARGE,
FLOOR_SIZE_SMALL,
FLOOR_SIZE_MEDIUM,
};
enum FloorType {
FLOOR_TYPE_NORMAL,
FLOOR_TYPE_FIXED, // Fixed room
FLOOR_TYPE_RESCUE, // Rescuing another player
};
// Helper type used to make explicit the possible secondary structures which can be randomly rolled to generate in the dungeon algorithm.
enum SecondaryStructureType {
SECONDARY_STRUCTURE_NONE, // No secondary structure will be generated.
SECONDARY_STRUCTURE_MAZE_PLUS_DOT, // One of 3 secondary structures depending on the dimensions of the room. If the room has odd dimensions, the result is a maze room. Otherwise, if the room has dimensions of at least `5x5`, a cross or plus pattern is made instead. If both fail, a single tile of secondary terrain will be placed in the center of the room.
SECONDARY_STRUCTURE_CHECKERBOARD, // If the room has odd dimensions, a checkerboard pattern made of randomly placed diagonal stripes of secondary terrain will be generated. If not, no secondary structure will be generated.
SECONDARY_STRUCTURE_POOL, // If the room has dimensions of at least `5x5`, a rectangular pool of secondary terrain will be generated. If not, no secondary structure will be generated.
SECONDARY_STRUCTURE_ISLAND, // If the room has dimensions of at least `6x6`, an island of items and a warp tile surrounded by secondary terrain will be generated. If not, no secondary structure will be generated.
SECONDARY_STRUCTURE_DIVIDER, // A "divider" of secondary terrain will split the room in half randomly either horizontally or vertically.
};
void GenerateFloor(void);
bool8 StairsAlwaysReachable(s32 stairsX, s32 stairsY, bool8 markUnreachable);
void sub_804EB30(void);
void sub_8051E3C(void);
#include "structs/dungeon_entity.h"
void sub_8051E7C(Entity *pokemon);
#endif

View File

@ -39,4 +39,14 @@
#define ARRAY_COUNT(array) (sizeof(array) / sizeof((array)[0]))
#define SWAP(a, b, temp) \
{ \
temp = a; \
a = b; \
b = temp; \
}
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
#endif // GUARD_GLOBAL_H

View File

@ -102,6 +102,11 @@ static inline bool8 PokemonFlag1(PokemonStruct1 *mon)
return (mon->unk0 >> (FLAG_UNK_1 - 1)) & 1;
}
static inline bool8 PokemonFlag1Struct2(PokemonStruct2 *mon)
{
return (mon->unk0 >> (FLAG_UNK_1 - 1)) & 1;
}
static inline bool8 PokemonFlag2(PokemonStruct1 *mon)
{
return (mon->unk0 >> (FLAG_ON_TEAM - 1)) & 1;

View File

@ -5,22 +5,26 @@
#include "structs/str_position.h"
#define MAX_ROOM_COUNT 32 // Empirical max, not sure if the code supports any more.
#define ROOM_0xFE 0xFE // Anchor?
#define CORRIDOR_ROOM 0xFF
enum TerrainType
{
TERRAIN_TYPE_WALL = 0, // x0 When neither TERRAIN_TYPE_NORMAL nor TERRAIN_TYPE_SECONDARY are set
TERRAIN_TYPE_NORMAL = 1 << 0, // x1
TERRAIN_TYPE_SECONDARY = 1 << 1, // Water or lava depending on the dungeon. x2
TERRAIN_TYPE_UNK_2 = 1 << 2, // x4
TERRAIN_TYPE_CORNER_CUTTABLE = 1 << 2, // x4 This tile can be corner-cut when walking. Seemingly only used during dungeon generation.
TERRAIN_TYPE_NATURAL_JUNCTION = 1 << 3, // x8
TERRAIN_TYPE_IMPASSABLE_WALL = 1 << 4, // x10
TERRAIN_TYPE_SHOP = 1 << 5, // x20
TERRAIN_TYPE_IN_MONSTER_HOUSE = 1 << 6, // x40
TERRAIN_TYPE_UNK_8 = 1 << 8, // x100
TERRAIN_TYPE_UNK_7 = 1 << 7, // x80
TERRAIN_TYPE_UNBREAKABLE = 1 << 8, // x100 // Cannot be broken by Absolute Mover. Set naturally on key doors.
TERRAIN_TYPE_STAIRS = 1 << 9, // x200
TERRAIN_TYPE_UNK_x400 = 1 << 10,
TERRAIN_TYPE_UNK_x800 = 1 << 11,
TERRAIN_TYPE_UNK_x1000 = 1 << 12,
TERRAIN_TYPE_UNREACHABLE_FROM_STAIRS = 1 << 15, // 0x8000
};
enum CrossableTerrain
@ -32,13 +36,25 @@ enum CrossableTerrain
NUM_CROSSABLE_TERRAIN
};
enum SpawnFlags
{
SPAWN_FLAG_STAIRS = 1 << 0, // x1 - This tile has the stairs.
SPAWN_FLAG_ITEM = 1 << 1, // x2 - This tile has an item on it.
SPAWN_FLAG_TRAP = 1 << 2, // x4 - This tile has a trap on it.
SPAWN_FLAG_MONSTER = 1 << 3, // x8 - This tile has a monster on it.
SPAWN_FLAG_SPECIAL_TILE = 1 << 4, // x10 - This is a special tile, such as for Kecleon Shops, items, and traps.
SPAWN_FLAG_UNK5 = 1 << 5, // 0x20 - Not fully understood field relating to Secondary Structures. Set to true for all tiles in secondary structure rooms except for Cross or Dot rooms.
SPAWN_FLAG_UNK6 = 1 << 6, // 0x40 - Not fully understood field. In the dungeon algorithm, it is set to true on a Warp tile.
SPAWN_FLAG_UNK7 = 1 << 7, // 0x80 - Not fully understood field. In the dungeon algorithm, it is set to true for all tiles in a Divider secondary structure room.
};
// size: 0x18
typedef struct Tile
{
// Uses the TerrainType bit flags.
/* 0x0 */ u16 terrainType;
u8 fill2[0x4 - 0x2];
u16 unk4;
u16 spawnOrVisibilityFlags; // Tracks the kinds of entities which should be spawned on this tile. See: SpawnFlags
u16 unk6;
u8 unk8;
/* 0x9 */ u8 room;

View File

@ -0,0 +1,18 @@
#ifndef GUARD_STR_806B7F8_H
#define GUARD_STR_806B7F8_H
#include "structs/dungeon_entity.h"
struct unkStruct_806B7F8
{
s16 species;
u8 unk2;
u32 unk4;
u16 level;
DungeonPos pos;
u8 unk10;
};
Entity* sub_806B7F8(struct unkStruct_806B7F8 *, bool8);
#endif

View File

@ -116,37 +116,41 @@ typedef struct UnkDungeonGlobal_unk181E8_sub
s16 unk42; // x42
} UnkDungeonGlobal_unk181E8_sub; // x44
#define ROOM_FLAG_ALLOW_SECONDARY_TERRAIN 0x1
#define ROOM_FLAG_ALLOW_IMPERFECTIONS 0x4
// Sizeof: 0x1C
typedef struct UnkDungeonGlobal_unk1C574
// Defines many of the key properties for dungeon generation, such as the type of layout, base number of rooms, and floor connectivity.
typedef struct FloorProperties
{
u8 unk0;
u8 unk1;
u8 layout;
s8 roomDensity;
u8 unk2;
u8 unk3;
u8 unk4;
u8 unk5;
u8 unk6;
u8 unk7;
u8 unk8;
u8 unk9;
u8 floorConnectivity;
u8 enemyDensity;
u8 kecleonShopChance; // Percentage chance 0-100%
u8 monsterHouseChance; // Percentage chance 0-100%
u8 mazeRoomChance; // Percentage chance 0-100%
u8 unkA;
u8 unkB;
u8 unkC;
u8 unkD;
bool8 allowDeadEnds;
u8 secondaryStructuresBudget; // Maximum number of secondary structures that can be generated
u8 roomFlags; // See ROOM_FLAG_
u8 unkE;
u8 unkF;
u8 unk10;
u8 itemDensity;
u8 trapDensity;
u8 unk11;
u8 unk12;
u8 unk13;
u8 unk14;
u8 numExtraHallways;
u8 buriedItemDensity; // Density of buried items (in walls)
u8 unk15;
u8 unk16;
u8 unk17;
u8 unk18;
u8 unk19;
u8 itemlessMonsterHouseChance; // Chance that a monster house will be itemless
u8 unk1A;
} UnkDungeonGlobal_unk1C574;
} FloorProperties;
typedef struct UnkDungeonGlobal_unk1C590
{
@ -234,6 +238,15 @@ struct MessageLogString
u8 str[MESSAGE_LOG_BUFFER_SIZE];
};
#define DEFAULT_MAX_POSITION 9999
struct MinMaxPosition
{
s32 minX;
s32 minY;
s32 maxX;
s32 maxY;
};
// size: 0x58
typedef struct unkDungeon644
{
@ -277,6 +290,7 @@ typedef struct unkDungeon644
/* 0x42 */ s16 unk42;
/* 0x44 */ s16 unk44;
/* 0x46 */ u8 unk46;
/* 0x47 */ u8 unk47;
/* 0x48 */ s32 unk48;
/* 0x4C */ s32 unk4C;
/* 0x50 */ s32 unk50;
@ -284,15 +298,6 @@ typedef struct unkDungeon644
/* 0x55 */ u8 unk55;
} unkDungeon644;
// size: 0x10
typedef struct unkDungeonE240
{
/* 0x0 */ u32 unk0;
/* 0x4 */ u32 unk4;
/* 0x8 */ u32 unk8;
/* 0xC */ u32 unkC;
} unkDungeonE240;
// size: 0x4
typedef struct unkDungeonE260
{
@ -329,7 +334,7 @@ typedef struct Dungeon
Entity *unkBC;
u8 fillC0[0x134 - 0xC0];
struct unkStruct_Dungeon134_sub unk134;
RGB colorRamp[0x100];
/* 0x47C */ RGB colorRamp[0x100];
/* 0x57C */ u8 fill57C[0x5C0 - 0x57c];
/* 0x5C0 */ s32 unk5C0;
/* 0x5C4 */ struct unkStruct_Dungeon5C4_sub unk5C4[3];
@ -356,30 +361,30 @@ typedef struct Dungeon
// dungeon_serializer.c refers to this as a u16 but elsewhere it's handled as a s16
/* 0x3800 */ s16 deoxysForm;
Item unk3804[DUNGEON_MAX_ITEMS];
/* 0x3904 */ s16 unk3904;
/* 0x3904 */ s16 numItems;
Trap unk3908[DUNGEON_MAX_TRAPS];
/* 0x3A08 */ bool8 unk3A08;
/* 0x3A08 */ bool8 forceMonsterHouse; // Forces the current floor to have monster house
/* 0x3A09 */ bool8 unk3A09;
/* 0x3A0A */ bool8 unk3A0A;
/* 0x3A0B */ bool8 unk3A0B;
u8 unk3A0C;
/* 0x3A0C */ u8 monsterHouseRoom; // room index of monster house
/* 0x3A0D */ u8 unk3A0D;
/* 0x3A0E */ s16 tileset;
/* 0x3A10 */ s16 unk3A10;
/* 0x3A12 */ s16 unk3A12;
/* 0x3A14 */ s16 bossBattleIndex;
/* 0x3A14 */ s16 fixedRoomNumber;
/* 0x3A16 */ s16 unk3A16;
/* 0x3A18 */ Tile tiles[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X];
DungeonPos unkE218;
DungeonPos unkE21C; // stair location?
/* 0xEA18 */ DungeonPos playerSpawn;
/* 0xEA1C */ DungeonPos stairsSpawn; // stairs location
DungeonPos unkE220[8];
unkDungeonE240 unkE240;
unkDungeonE240 unkE250;
/* 0xEA24 */ struct MinMaxPosition kecleonShopPos;
struct MinMaxPosition unkE250;
unkDungeonE260 unkE260;
/* 0xE264 */ Weather weather; // Uses the weather constants in weather.h.
/* 0xE27C */ Tile unkE27C[8][8];
/* 0xE87C */ u8 unkE87C[8][8];
u32 fillE8BC;
/* 0xE8BC */ u8 unkE8BC; // Seems to be some tile's room index;
/* 0xE8C0 */ Tile *tilePointers[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X];
u8 unk104C0;
/* 0x104C4 */ RoomData roomData[MAX_ROOM_COUNT];
@ -393,7 +398,8 @@ typedef struct Dungeon
u16 unk12BEC[9];
u16 unk12BFE[19];
u8 unk12C24[0x930];
u16 unk13554[12];
u16 unk13554[10];
OpenedFile *unk13568;
u8 unk1356C;
u8 fill1356D[0x13570 - 0x1356D];
/* 0x13570 */ u8 unk13570;
@ -422,9 +428,9 @@ typedef struct Dungeon
/* 0x181E8 */ UnkDungeonGlobal_unk181E8_sub unk181e8;
u8 fill18220[0x1BDD4 - 0x1822C];
struct UnkStructDungeon1BDD4 unk1BDD4;
struct MessageLogString messageLogStrings[MESSAGE_LOG_STRINGS_COUNT];
/* 0x1BE14 */ struct MessageLogString messageLogStrings[MESSAGE_LOG_STRINGS_COUNT];
/* 0x1C570 */ DungeonLocation unk1C570;
/* 0x1C574 */ UnkDungeonGlobal_unk1C574 unk1C574;
/* 0x1C574 */ FloorProperties unk1C574;
/* 0x1C590 */ UnkDungeonGlobal_unk1C590 unk1C590[4];
u16 unk1CD70[20];
UnkDungeonGlobal_unk1CD98 unk1CD98[32];

View File

@ -226,9 +226,7 @@ SECTIONS {
src/dungeon_ai_item_weight.o(.text);
src/dungeon_map_access.o(.text);
src/tile_types.o(.text);
asm/code_804AFAC.o(.text);
src/code_804AFAC.o(.text);
asm/code_804FD30.o(.text);
src/dungeon_generation.o(.text);
src/dungeon_message.o(.text);
src/dungeon_move.o(.text);
src/move_actions.o(.text);

View File

@ -17,7 +17,7 @@ extern s16 ExtractSpeciesIndex(UnkDungeonGlobal_unk1CD98 *r0);
extern u32 ExtractLevel(UnkDungeonGlobal_unk1CD98 *r0);
extern void sub_808E9C4(UnkDungeonGlobal_unk1CD98 *r0, s16 r1);
extern bool8 sub_80848EC(void);
extern u8 sub_8043D10(void);
extern u8 GetFloorType(void);
extern const u8 *GetDungeonName2(u8 dungeon);
extern void sub_8008DC8(s32 r0, s32 r1, u16 r2, u16 r3);
@ -53,7 +53,7 @@ struct UnkDungeonFileData
struct UnkDataFileStruct
{
struct UnkDungeonFileData **unk0;
UnkDungeonGlobal_unk1C574 *unk4;
FloorProperties *unk4;
u16 **unk8;
UnkDungeonGlobal_unk1CD98 **unkC;
u16 **unk10;
@ -1065,7 +1065,7 @@ void sub_803E13C(void)
void sub_803E178(void)
{
s32 val = sub_8043D10();
s32 val = GetFloorType();
if (val == 0) {
if (gDungeon->unk644.dungeonLocation.id == DUNGEON_METEOR_CAVE && !gDungeon->deoxysDefeat) {

View File

@ -26,7 +26,6 @@ extern const char *gUnknown_80FD040; // It became brighter on the floor
// Luminous Orb???
void HandleLuminousOrbAction(Entity *pokemon)
{
Tile *mapTile;
int XCoord;
int YCoord;
@ -36,8 +35,8 @@ void HandleLuminousOrbAction(Entity *pokemon)
{
for(XCoord = 0; XCoord < DUNGEON_MAX_SIZE_X; XCoord++)
{
mapTile = GetTileMut(XCoord, YCoord);
mapTile->unk4 = mapTile->unk4 | 1;
Tile *mapTile = GetTileMut(XCoord, YCoord);
mapTile->spawnOrVisibilityFlags |= 1;
}
}
sub_803F580(0);

View File

@ -28,7 +28,7 @@ extern void sub_80429A0(Entity *);
extern void sub_8042B34(u32, u32, u32);
extern bool8 sub_8042CC0(void);
extern void sub_8042D7C(void);
extern u8 sub_8043D10(void);
extern u8 GetFloorType(void);
extern bool8 sub_8045888(Entity *);
// This func plays the appropriate ascend/descend SFX for stairs depending on the direction
@ -38,7 +38,7 @@ void PlayStairsSound(void)
songIndex = 997;
switch (sub_8043D10()) {
switch (GetFloorType()) {
case 0:
default:
songIndex = IsStairDirectionUp(gDungeon->unk644.dungeonLocation.id) ? 340 : 341;

View File

@ -8,6 +8,7 @@
#include "code_800E9A8.h"
#include "dungeon_util.h"
#include "dungeon_message.h"
#include "dungeon_generation.h"
#include "bg_control.h"
#include "random.h"
#include "file_system.h"
@ -310,7 +311,6 @@ extern void sub_803DF60(void);
extern void sub_803E02C(void);
extern void sub_8049840(void);
extern void sub_80847D4(void);
extern void sub_804AFAC(void);
extern void sub_8043D60(void);
extern void sub_806890C(void);
extern void sub_8068614(void);
@ -387,7 +387,7 @@ extern Entity *gLeaderPointer;
void EnforceMaxItemsAndMoney(void);
void sub_8043FD0(void);
void sub_806B404(void);
u8 sub_8043D10(void);
u8 GetFloorType(void);
extern const u8 *gUnknown_80FEC48;
extern const u8 *gUnknown_80FEC7C;
@ -606,7 +606,7 @@ void xxx_dungeon_8042F6C(struct UnkStruct_xxx_dungeon_8042F6C *r8)
gDungeon->weather.weather = 0;
gDungeon->tileset = gDungeon->unk1C574.unk2;
gDungeon->unk3A10 = gDungeon->unk1C574.unk3;
gDungeon->bossBattleIndex = gDungeon->unk1C574.unk12;
gDungeon->fixedRoomNumber = gDungeon->unk1C574.unk12;
sub_807E5E4(0);
sub_80842F0();
}
@ -636,7 +636,7 @@ void xxx_dungeon_8042F6C(struct UnkStruct_xxx_dungeon_8042F6C *r8)
ShowDungeonNameBanner();
if (!r6) {
sub_804AFAC();
GenerateFloor();
gDungeon->unk644.windTurns = GetTurnLimit(gDungeon->unk644.dungeonLocation.id);
gDungeon->unk644.unk36 = 0;
}
@ -747,7 +747,7 @@ void xxx_dungeon_8042F6C(struct UnkStruct_xxx_dungeon_8042F6C *r8)
}
else {
sub_80427AC();
sub_8075900(GetLeader(), gDungeon->unk3A08);
sub_8075900(GetLeader(), gDungeon->forceMonsterHouse);
sub_807EAA0(1, 0);
}
@ -868,7 +868,7 @@ void xxx_dungeon_8042F6C(struct UnkStruct_xxx_dungeon_8042F6C *r8)
sub_8083AB0(var, NULL, GetLeader());
check = TRUE;
}
else if (gDungeon->unk644.unk34 == 1 && sub_8043D10() == 2 && gDungeon->unk644.unk10 == 2) {
else if (gDungeon->unk644.unk34 == 1 && GetFloorType() == FLOOR_TYPE_RESCUE && gDungeon->unk644.unk10 == 2) {
sub_8083AB0(0x228, NULL, GetLeader());
if (gDungeon->unk644.unk2A != 0) {
IncrementThievingSuccesses();
@ -990,14 +990,14 @@ bool8 sub_8043CE4(s32 dungeonId)
return (gDungeonWaterType[dungeonId] == 2);
}
u8 sub_8043D10(void)
u8 GetFloorType(void)
{
if (gDungeon->unk644.unk34 == 1 && gDungeon->unk644.unk8.unk1 == gDungeon->unk644.dungeonLocation.floor)
return 2;
return FLOOR_TYPE_RESCUE;
else if (IsBossFight())
return 1;
return FLOOR_TYPE_FIXED;
else
return 0;
return FLOOR_TYPE_NORMAL;
}
void sub_8043D50(s32 *a0, s32 *a1)

View File

@ -25,17 +25,14 @@ EWRAM_DATA unkStruct_202EE44 gUnknown_202EE44[10] = {0};
extern s32 gUnknown_202EE6C;
extern const ItemText gActions[];
extern u16 gUnknown_80F6964[NUM_ITEM_CATEGORIES];
extern u8 gUnknown_80F697C[];
extern u8 *gUnknown_80F7C50[10];
extern const unkStr_80F7C54 gUnknown_80F7C54[65];
extern u8 *gUnknown_80F91EC[];
extern u8 sub_8043D10(void);
extern bool8 sub_8045888(Entity *);
extern u8 GetFloorType(void);
void sub_80460F8(DungeonPos *, Item *, u32);
bool8 sub_80461C8(DungeonPos *, u32);
@ -169,7 +166,7 @@ u8 *sub_8044EC8(s32 param_1)
uVar1 = gUnknown_202EE44[param_1].unk0;
if ((uVar1 == 0x26) && (sub_8043D10() == 2)) {
if ((uVar1 == 0x26) && (GetFloorType() == 2)) {
return *gUnknown_80F91EC;
}
else {

View File

@ -524,7 +524,7 @@ Entity *sub_804550C(s16 a)
);
}
Entity *sub_8045684(u8 trapID, DungeonPos *pos, u8 c)
Entity *SpawnTrap(u8 trapID, DungeonPos *pos, u8 c)
{
Entity *entity;
s32 i;

View File

@ -140,7 +140,7 @@ void sub_8045CB0(void)
x = DungeonRandInt(DUNGEON_MAX_SIZE_X);
y = DungeonRandInt(DUNGEON_MAX_SIZE_Y);
gDungeon->unk3904 = 0;
gDungeon->numItems = 0;
for(yCounter = 0; yCounter < DUNGEON_MAX_SIZE_Y; yCounter++)
{
y++;
@ -157,7 +157,7 @@ void sub_8045CB0(void)
}
tile = GetTile(x,y);
if (((tile->terrainType & TERRAIN_TYPE_STAIRS) == 0) && ((tile->unk4 & 2) != 0)) {
if (((tile->terrainType & TERRAIN_TYPE_STAIRS) == 0) && ((tile->spawnOrVisibilityFlags & 2) != 0)) {
shopFlag = FALSE;
pos.x = x;
pos.y = y;

View File

@ -1,152 +0,0 @@
#include "global.h"
#include "dungeon_map_access.h"
#include "dungeon_random.h"
#include "structs/str_dungeon.h"
void sub_804FBE8(void)
{
Tile *tile;
int y;
int x;
for(x = 0; x < DUNGEON_MAX_SIZE_X; x++)
{
for(y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
{
tile = GetTileMut(x,y);
if ((tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) != TERRAIN_TYPE_NORMAL) {
if ((tile->terrainType & (TERRAIN_TYPE_UNK_8 | TERRAIN_TYPE_IMPASSABLE_WALL)) != 0) {
tile->unk4 &= 0xfffd;
}
tile->unk4 &= 0xfffb;
}
if ((tile->unk4 & 1) != 0) {
tile->terrainType |= TERRAIN_TYPE_STAIRS;
tile->unk4 &= 0xfffb;
}
if ((tile->unk4 & 2) != 0) {
tile->unk4 &= 0xfffb;
}
}
}
}
void sub_804FC74(void)
{
Tile *tile;
int y;
int x;
for(x = 0; x < DUNGEON_MAX_SIZE_X; x++)
{
for(y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
{
if ((GetTile(x, y)->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) == TERRAIN_TYPE_SECONDARY) {
tile = GetTileMut(x,y);
tile->terrainType &= ~(TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
tile->terrainType |= (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
}
}
}
}
void sub_804FCCC(void)
{
Tile *tile;
int y;
int x;
for(x = 0; x < DUNGEON_MAX_SIZE_X; x++)
{
for(y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
{
if ((GetTile(x, y)->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL) != 0) {
tile = GetTileMut(x,y);
tile->terrainType &= ~(TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
}
}
}
}
void sub_804FD10(Tile *tile)
{
tile->terrainType = 0;
tile->unk4 = 0;
tile->room = -1;
tile->unk8 = 0;
tile->walkableNeighborFlags[CROSSABLE_TERRAIN_REGULAR] = 0;
tile->walkableNeighborFlags[CROSSABLE_TERRAIN_LIQUID] = 0;
tile->walkableNeighborFlags[CROSSABLE_TERRAIN_CREVICE] = 0;
tile->walkableNeighborFlags[CROSSABLE_TERRAIN_WALL] = 0;
tile->unkE = 0;
tile->monster = NULL;
tile->object = NULL;
}
bool8 static inline boundsCheck(int x, int y)
{
if (x < 0 || (y < 0)) return TRUE;
if (DUNGEON_MAX_SIZE_X <= x) return TRUE;
if (DUNGEON_MAX_SIZE_Y <= y) return TRUE;
return FALSE;
}
void sub_804FD30(void)
{
int x;
int y;
for(x = 0; x < DUNGEON_MAX_SIZE_X; x++)
{
for(y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
{
sub_804FD10(GetTileMut(x,y));
if ((boundsCheck(x, y - 1)) ||
(boundsCheck(x + 1, y - 1)) ||
(boundsCheck(x + 1, y - 1)) ||
(boundsCheck(x + 1, y + 1)) ||
(boundsCheck(x, y + 1)) ||
(boundsCheck(x - 1, y + 1)) ||
(boundsCheck(x - 1, y)) ||
(boundsCheck(x - 1, y - 1)))
{
GetTileMut(x,y)->terrainType |= TERRAIN_TYPE_IMPASSABLE_WALL;
}
}
}
gDungeon->unkE21C.x = -1;
gDungeon->unkE21C.y = -1;
for(x = 0; x < 8; x++)
{
for(y = 0; y < 8; y++)
{
sub_804FD10(&gDungeon->unkE27C[x][y]);
}
}
gDungeon->unk3904 = 0;
for(x = 0; x < 0x40; x++)
{
gDungeon->traps[x]->type = 0;
}
}
void sub_804FED0(s32 *param_1, s32 param_2)
{
int idx1;
int idx2;
s32 temp;
int counter;
for (counter = 0; counter < param_2 << 1; counter++) {
idx1 = DungeonRandInt(param_2);
idx2 = DungeonRandInt(param_2);
temp = param_1[idx1];
param_1[idx1] = param_1[idx2];
param_1[idx2] = temp;
}
}

View File

@ -182,7 +182,7 @@ void HandleGiveItemAction(Entity *param_1)
if (!info2->isTeamLeader) {
info2->flags = info2->flags | MOVEMENT_FLAG_UNK_14;
}
sub_807AB38(param_1,gDungeon->unk3A08);
sub_807AB38(param_1,gDungeon->forceMonsterHouse);
}
}
@ -223,7 +223,7 @@ void HandleTakeItemAction(Entity *param_1)
if (!info->isTeamLeader) {
info->flags |= MOVEMENT_FLAG_UNK_14;
}
sub_807AB38(param_1,gDungeon->unk3A08);
sub_807AB38(param_1,gDungeon->forceMonsterHouse);
}
}
}
@ -267,7 +267,7 @@ void sub_8066BD4(Entity *param_1)
if (!info->isTeamLeader) {
info->flags = info->flags | MOVEMENT_FLAG_UNK_14;
}
sub_807AB38(param_1,gDungeon->unk3A08);
sub_807AB38(param_1,gDungeon->forceMonsterHouse);
}
}
@ -325,7 +325,7 @@ void HandlePlaceItemAction(Entity *param_1)
PlaySoundEffect(0x14d);
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0);
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8E28);
sub_807AB38(entity,gDungeon->unk3A08);
sub_807AB38(entity,gDungeon->forceMonsterHouse);
}
}
else

View File

@ -590,7 +590,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc
if (arg8 != 0 && sub_8045888(target)) {
unkTile = GetTileAtEntitySafe(target);
sub_803E708(0x14, 0x18);
unkTile->unk4 |= 4;
unkTile->spawnOrVisibilityFlags |= 4;
sub_8049ED4();
}
if (targetData->unk152 == 0) {
@ -687,7 +687,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc
if (unkTile != NULL)
{
unkTile->unk4 &= ~(0x4);
unkTile->spawnOrVisibilityFlags &= ~(0x4);
sub_8049ED4();
}
return FALSE;
@ -702,7 +702,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc
sub_803E708(0x14, 0x18);
target->unk22 = 2;
sub_803E708(0xA, 0x18);
unkTile->unk4 &= ~(0x4);
unkTile->spawnOrVisibilityFlags &= ~(0x4);
sub_8049ED4();
}
else if (var_24) {

View File

@ -196,13 +196,13 @@ bool8 sub_806F660(Entity *pokemon,Entity *target)
targetInfo = target->info;
iVar8 = -1;
size = GetBodySize(targetInfo->apparentID);
if ((1 < ((u16)(gDungeon->bossBattleIndex - 4))) && (gDungeon->bossBattleIndex != 9) && (gDungeon->bossBattleIndex != 0xf)) {
if ((u16)(gDungeon->bossBattleIndex - 0x2cU) < 5) {
if ((1 < ((u16)(gDungeon->fixedRoomNumber - 4))) && (gDungeon->fixedRoomNumber != 9) && (gDungeon->fixedRoomNumber != 0xf)) {
if ((u16)(gDungeon->fixedRoomNumber - 0x2cU) < 5) {
if (gDungeon->unk644.unk18 == 0) {
return FALSE;
}
}
else if (gDungeon->bossBattleIndex == 0x31) {
else if (gDungeon->fixedRoomNumber == 0x31) {
if (gDungeon->unk644.unk15 == 0) {
return FALSE;
}

View File

@ -16,17 +16,7 @@
#include "pokemon_3.h"
#include "status_checks_1.h"
#include "code_805D8C8.h"
struct unkStruct_806B7F8
{
s16 species;
u8 unk2;
u32 unk4;
u16 level;
u8 fillA[2];
DungeonPos pos;
u8 unk10;
};
#include "structs/str_806B7F8.h"
EWRAM_DATA s32 gUnknown_202F31C[2] = {0, 0};
EWRAM_DATA s32 gUnknown_202F324[2] = {0, 0};
@ -61,7 +51,6 @@ bool8 sub_80723D0(Entity *, Entity *, u8, u8);
void sub_807218C(Entity *);
void sub_806A2BC(Entity *, u32);
void sub_806A3D4(u8 *, s32, s32, s32);
extern Entity* sub_806B7F8(struct unkStruct_806B7F8 *, bool8);
extern void sub_8042920(struct Entity *r0);
extern s16 sub_803D970(u32);
extern s32 sub_803DA20(s32 param_1);
@ -123,7 +112,7 @@ void sub_8071B48(void)
}
}
if (dungeon->unk644.unk2A == 0) {
if (gDungeon->unk3A0C == 0xff) {
if (gDungeon->monsterHouseRoom == 0xff) {
if (counter >= gUnknown_80F4DA6) {
return;
}

View File

@ -13,21 +13,10 @@
#include "structs/dungeon_entity.h"
#include "structs/map.h"
#include "structs/str_pokemon.h"
#include "structs/str_806B7F8.h"
extern u8 *gUnknown_80FE2EC[];
struct unkStruct_806B7F8
{
u16 species;
u8 unk2;
u32 unk4;
u16 level;
u8 fillA[0xC - 0xA];
DungeonPos pos;
u8 unk10;
};
extern Entity* sub_806B7F8(struct unkStruct_806B7F8 *, bool8);
extern void sub_806BFC0(EntityInfo *, u32);
void sub_8069E0C(Entity *pokemon);
void sub_8042A44(Entity *r0);

View File

@ -1019,7 +1019,7 @@ bool8 UseAttack(Entity *a0)
sub_8071DA4(mon);
sub_8046D20();
sub_8075900(mon, gDungeon->unk3A08);
sub_8075900(mon, gDungeon->forceMonsterHouse);
}
if (!EntityExists(mon))
continue;

View File

@ -157,7 +157,7 @@ void sub_807CD9C(Entity *pokemon, Entity *target, u32 direction)
sub_807EC28(FALSE);
}
sub_806A5B8(target);
sub_8075900(target,gDungeon->unk3A08);
sub_8075900(target,gDungeon->forceMonsterHouse);
}
}
}
@ -215,13 +215,11 @@ _0807D11E:
sub_803E46C(0x1a);
}
void sub_807D148(Entity *pokemon, Entity *target, u32 param_3,
DungeonPos *pos)
void sub_807D148(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos)
{
EntityInfo *info;
u32 direction;
DungeonPos local_2c;
DungeonPos pos2;
bool8 flag;
info = GetEntInfo(target);
@ -238,8 +236,8 @@ void sub_807D148(Entity *pokemon, Entity *target, u32 param_3,
}
if (param_3 == 1)
{
pos2 = gDungeon->unkE21C;
if(pos2.x == target->pos.x && pos2.y == target->pos.y) {
DungeonPos stairsPosition = gDungeon->stairsSpawn;
if(stairsPosition.x == target->pos.x && stairsPosition.y == target->pos.y) {
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC9A0); // It's already on the stairs!
PetrifiedStatusTarget(pokemon,target);
return;
@ -274,7 +272,7 @@ void sub_807D148(Entity *pokemon, Entity *target, u32 param_3,
}
break;
case 1:
if (!sub_808384C(&local_2c,&gDungeon->unkE21C)) {
if (!sub_808384C(&local_2c,&gDungeon->stairsSpawn)) {
local_2c = target->pos;
flag = TRUE;
}
@ -323,7 +321,7 @@ void sub_807D148(Entity *pokemon, Entity *target, u32 param_3,
sub_807EC28(0);
}
sub_806A5B8(target);
sub_8075900(target,gDungeon->unk3A08);
sub_8075900(target,gDungeon->forceMonsterHouse);
}
void sub_807D3CC(Entity *param_1)

View File

@ -101,7 +101,7 @@ void sub_807E254(Entity *pokemon,Entity *target)
sub_807EC28(FALSE);
}
sub_806A5B8(pokemon);
sub_8075900(pokemon,gDungeon->unk3A08);
sub_8075900(pokemon,gDungeon->forceMonsterHouse);
}
if (EntityExists(target)) {
@ -110,7 +110,7 @@ void sub_807E254(Entity *pokemon,Entity *target)
sub_807EC28(FALSE);
}
sub_806A5B8(target);
sub_8075900(target,gDungeon->unk3A08);
sub_8075900(target,gDungeon->forceMonsterHouse);
}
}
}

View File

@ -20,18 +20,18 @@ void sub_8084854(struct unkData_8107234 *);
void sub_80847D4(void)
{
u32 bossBattleIndex;
u32 fixedRoomNumber;
s32 index;
gDungeon->unk3A0D = 0;
gDungeon->unk1356C = 0;
sub_8040A84();
for(index = 0; index < 0x3e7 && gUnknown_8107234[index].unk0[0] != 0; index++) {
bossBattleIndex = gDungeon->bossBattleIndex;
if (bossBattleIndex - 0x1c < 0x16) {
bossBattleIndex = 0x1b;
fixedRoomNumber = gDungeon->fixedRoomNumber;
if (fixedRoomNumber - 0x1c < 0x16) {
fixedRoomNumber = 0x1b;
}
if (bossBattleIndex == gUnknown_8107234[index].unk0[0])
if (fixedRoomNumber == gUnknown_8107234[index].unk0[0])
{
sub_8084854(&gUnknown_8107234[index]);
break;

View File

@ -27,7 +27,7 @@ extern const ItemText gActions[];
extern void sub_8071B48(void);
extern void sub_8043ED0(u32);
extern u8 sub_8043D10(void);
extern u8 GetFloorType(void);
extern bool8 sub_8044B28(void);
extern void sub_8086AC0(void);
extern void sub_8043ED0(u32);
@ -199,7 +199,7 @@ u8 *sub_8044BA8(u16 param_1, u8 id)
u32 uVar3;
u32 uVar4;
if ((param_1 == 0x26) && (sub_8043D10() == 2)) {
if ((param_1 == 0x26) && (GetFloorType() == 2)) {
return *gUnknown_80F91EC;
}
else {

View File

@ -1065,7 +1065,7 @@ void HandleUseOrbAction(Entity *pokemon)
}
sub_806A5B8(pokemon);
sub_8075900(pokemon, gDungeon->unk3A08);
sub_8075900(pokemon, gDungeon->forceMonsterHouse);
}
else if (r4)
sub_8044D40(&act, 0);

View File

@ -34,7 +34,7 @@ static bool8 xxx_dungeon_80442D0(bool8);
bool8 IsBossFight()
{
if (gDungeon->bossBattleIndex != 0 && gDungeon->bossBattleIndex <= 0x31)
if (gDungeon->fixedRoomNumber != 0 && gDungeon->fixedRoomNumber <= 0x31)
{
return TRUE;
}

6448
src/dungeon_generation.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -479,7 +479,7 @@ void sub_8049ED4(void)
else if (hallucinating) {
src = &dungeon->unk11884[tile->unk8][r7];
}
else if (tile->unk4 & 4) {
else if (tile->spawnOrVisibilityFlags & 4) {
src = &dungeon->unk12BFE[r7];
}
else
@ -524,7 +524,7 @@ void sub_8049ED4(void)
else if (hallucinating) {
src = &dungeon->unk11884[tile->unk8][r7];
}
else if (tile->unk4 & 4) {
else if (tile->spawnOrVisibilityFlags & 4) {
src = &dungeon->unk12BFE[r7];
}
else
@ -912,7 +912,7 @@ void sub_804AAAC(void)
for(x = 0; x < DUNGEON_MAX_SIZE_X; x++)
{
tile = GetTileMut(x,y);
tile->unk4 = 0;
tile->spawnOrVisibilityFlags = 0;
}
}
}
@ -1024,7 +1024,7 @@ void sub_804AC20(DungeonPos *pos)
for (y = yMin; y <= yMax; y++) {
for (x = xMin; x <= xMax; x++) {
tile = GetTileMut(x,y);
tile->unk4 = tile->unk4 | 3;
tile->spawnOrVisibilityFlags |= 3;
sub_80402AC(x,y);
}
}

View File

@ -39,7 +39,7 @@ static void ReadDungeonMonsters(DataSerializer *seri);
static void ReadDungeonMusic(DataSerializer *seri);
static void ReadDungeonTraps(DataSerializer *seri);
static void ReadDungeonUnk644(DataSerializer *seri);
static void ReadDungeonUnkE240(DataSerializer *seri, unkDungeonE240 *dst);
static void ReadDungeonkecleonShopPos(DataSerializer *seri, struct MinMaxPosition *dst);
static void ReadDungeonUnkE260(DataSerializer *seri, unkDungeonE260 *dst);
static void ReadDungeonVisibility(DataSerializer *seri);
static void ReadBlinkerClassStatus(DataSerializer *seri, BlinkerClassStatus *dst);
@ -92,7 +92,7 @@ static void WriteDungeonMonsters(DataSerializer *seri);
static void WriteDungeonMusic(DataSerializer *seri);
static void WriteDungeonTraps(DataSerializer *seri);
static void WriteDungeonUnk644(DataSerializer *seri);
static void WriteDungeonUnkE240(DataSerializer *seri, unkDungeonE240 *src);
static void WriteDungeonkecleonShopPos(DataSerializer *seri, struct MinMaxPosition *src);
static void WriteDungeonUnkE260(DataSerializer *seri, unkDungeonE260 *src);
static void WriteDungeonVisibility(DataSerializer *seri);
static void WriteBlinkerClassStatus(DataSerializer *seri, BlinkerClassStatus *src);
@ -405,16 +405,16 @@ static void WriteDungeonFloor(DataSerializer *seri)
s32 i;
WriteBlame(seri, sMisakiSan);
WriteBool8(seri, gDungeon->unk3A08);
WriteBool8(seri, gDungeon->forceMonsterHouse);
WriteBool8(seri, gDungeon->unk3A09);
WriteBool8(seri, gDungeon->unk3A0A);
WriteBool8(seri, gDungeon->unk3A0B);
WriteU8(seri, gDungeon->unk3A0C);
WriteU8(seri, gDungeon->monsterHouseRoom);
WriteU8(seri, gDungeon->unk3A0D);
WriteS16(seri, gDungeon->tileset);
WriteS16(seri,gDungeon->unk3A10);
WriteS16(seri, gDungeon->unk3A12);
WriteS16(seri, gDungeon->bossBattleIndex);
WriteS16(seri, gDungeon->fixedRoomNumber);
WriteS16(seri, gDungeon->unk3A16);
for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++) {
@ -423,14 +423,14 @@ static void WriteDungeonFloor(DataSerializer *seri)
}
}
WriteTilePos(seri, &gDungeon->unkE218);
WriteTilePos(seri, &gDungeon->unkE21C);
WriteTilePos(seri, &gDungeon->playerSpawn);
WriteTilePos(seri, &gDungeon->stairsSpawn);
for (i = 0; i < 8; i++)
WriteTilePos(seri, &gDungeon->unkE220[i]);
WriteDungeonUnkE240(seri, &gDungeon->unkE240);
WriteDungeonUnkE240(seri, &gDungeon->unkE250);
WriteDungeonkecleonShopPos(seri, &gDungeon->kecleonShopPos);
WriteDungeonkecleonShopPos(seri, &gDungeon->unkE250);
WriteDungeonUnkE260(seri, &gDungeon->unkE260);
for (y = 0; y < 8; y++) {
@ -693,7 +693,7 @@ static void WriteIQSkills(DataSerializer *seri, u8 *src)
static void WriteTile(DataSerializer *seri, Tile *src)
{
WriteU16(seri, src->terrainType);
WriteU16(seri, src->unk4);
WriteU16(seri, src->spawnOrVisibilityFlags);
WriteBytes(seri, &src->room, 1);
WriteBytes(seri, &src->unkE, 1);
}
@ -767,16 +767,16 @@ static void ReadDungeonFloor(DataSerializer *seri)
ReadBlame(seri, sMisakiSan);
gDungeon->unk3A08 = ReadBool8(seri);
gDungeon->forceMonsterHouse = ReadBool8(seri);
gDungeon->unk3A09 = ReadBool8(seri);
gDungeon->unk3A0A = ReadBool8(seri);
gDungeon->unk3A0B = ReadBool8(seri);
gDungeon->unk3A0C = ReadU8(seri);
gDungeon->monsterHouseRoom = ReadU8(seri);
gDungeon->unk3A0D = ReadU8(seri);
gDungeon->tileset = ReadS16(seri);
gDungeon->unk3A10 = ReadS16(seri);
gDungeon->unk3A12 = ReadS16(seri);
gDungeon->bossBattleIndex = ReadS16(seri);
gDungeon->fixedRoomNumber = ReadS16(seri);
gDungeon->unk3A16 = ReadS16(seri);
for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++) {
@ -785,14 +785,14 @@ static void ReadDungeonFloor(DataSerializer *seri)
}
}
ReadTilePos(seri, &gDungeon->unkE218);
ReadTilePos(seri, &gDungeon->unkE21C);
ReadTilePos(seri, &gDungeon->playerSpawn);
ReadTilePos(seri, &gDungeon->stairsSpawn);
for (i = 0; i < 8; i++)
ReadTilePos(seri, &gDungeon->unkE220[i]);
ReadDungeonUnkE240(seri, &gDungeon->unkE240);
ReadDungeonUnkE240(seri, &gDungeon->unkE250);
ReadDungeonkecleonShopPos(seri, &gDungeon->kecleonShopPos);
ReadDungeonkecleonShopPos(seri, &gDungeon->unkE250);
ReadDungeonUnkE260(seri, &gDungeon->unkE260);
for (y = 0; y < 8; y++) {
@ -810,7 +810,7 @@ static void ReadTile(DataSerializer *seri, Tile *dst)
memset(dst, 0, sizeof(Tile));
dst->terrainType = ReadU16(seri);
dst->unk4 = ReadU16(seri);
dst->spawnOrVisibilityFlags = ReadU16(seri);
ReadBytes(seri, &dst->room, 1);
ReadBytes(seri, &dst->unkE, 1);
@ -911,7 +911,7 @@ static void ReadDungeonTraps(DataSerializer *seri)
if (trapID != 0xFF) {
tile = GetTileMut(pos.x, pos.y);
entity = sub_8045684(trapID, &pos, unk1);
entity = SpawnTrap(trapID, &pos, unk1);
if (entity) {
tile->object = entity;
entity->isVisible = isVisible;
@ -1633,12 +1633,12 @@ static void WriteTilePos(DataSerializer *seri, DungeonPos *src)
WriteBytes(seri, &src->y, 1);
}
static void WriteDungeonUnkE240(DataSerializer *seri, unkDungeonE240 *src)
static void WriteDungeonkecleonShopPos(DataSerializer *seri, struct MinMaxPosition *src)
{
WriteBytes(seri, &src->unk0, 1);
WriteBytes(seri, &src->unk4, 1);
WriteBytes(seri, &src->unk8, 1);
WriteBytes(seri, &src->unkC, 1);
WriteBytes(seri, &src->minX, 1);
WriteBytes(seri, &src->minY, 1);
WriteBytes(seri, &src->maxX, 1);
WriteBytes(seri, &src->maxY, 1);
}
static void WriteDungeonUnkE260(DataSerializer *seri, unkDungeonE260 *src)
@ -1716,16 +1716,16 @@ static void ReadTilePos(DataSerializer *seri, DungeonPos *dst)
ReadBytes(seri, &dst->y, 1);
}
static void ReadDungeonUnkE240(DataSerializer *seri, unkDungeonE240 *dst)
static void ReadDungeonkecleonShopPos(DataSerializer *seri, struct MinMaxPosition *dst)
{
dst->unk0 = 0;
dst->unk4 = 0;
dst->unk8 = 0;
dst->unkC = 0;
ReadBytes(seri, &dst->unk0, 1);
ReadBytes(seri, &dst->unk4, 1);
ReadBytes(seri, &dst->unk8, 1);
ReadBytes(seri, &dst->unkC, 1);
dst->minX = 0;
dst->minY = 0;
dst->maxX = 0;
dst->maxY = 0;
ReadBytes(seri, &dst->minX, 1);
ReadBytes(seri, &dst->minY, 1);
ReadBytes(seri, &dst->maxX, 1);
ReadBytes(seri, &dst->maxY, 1);
}
static void ReadDungeonUnkE260(DataSerializer *seri, unkDungeonE260 *dst)

View File

@ -167,7 +167,7 @@ void sub_804522C(void) {
}
}
for(index = 0; index < gDungeon->unk3904; index++)
for(index = 0; index < gDungeon->numItems; index++)
{
sub_80462AC(gDungeon->items[index], crossEyed, 1, 0xFF, 0);
}

View File

@ -2751,7 +2751,7 @@ _0805AA5E:
sub_807EC28(FALSE);
}
sub_806A5B8(target);
sub_8075900(target,gDungeon->unk3A08);
sub_8075900(target,gDungeon->forceMonsterHouse);
}
}
return TRUE;

View File

@ -141,7 +141,7 @@ extern void sub_804178C(u32);
extern void sub_8041D5C(Entity *);
extern void sub_8041D48(Entity *);
extern void sub_8041D38(Entity * pokemon);
extern u8 sub_8043D10(void);
extern u8 GetFloorType(void);
extern void sub_8041CDC(Entity *pokemon);
extern void sub_8041CEC(Entity *pokemon);
extern void nullsub_73(Entity *);
@ -741,7 +741,7 @@ void HandleScannerOrb(Entity* pokemon, Entity* target)
void HandleStairsOrb(Entity* pokemon, Entity* target)
{
if (EntityExists(target)) {
if(sub_8043D10())
if(GetFloorType())
{
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FAF3C);
}

View File

@ -127,7 +127,7 @@ bool8 sub_804AD34(DungeonPos *pos)
iVar8 = 0;
tile = GetTileMut(pos->x,pos->y);
if (!(tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)))
if(!(tile->terrainType & (TERRAIN_TYPE_UNK_8 | TERRAIN_TYPE_IMPASSABLE_WALL))){
if(!(tile->terrainType & (TERRAIN_TYPE_UNBREAKABLE | TERRAIN_TYPE_IMPASSABLE_WALL))){
iVar8 = 1;
tile->terrainType = (tile->terrainType & ~(TERRAIN_TYPE_SECONDARY | TERRAIN_TYPE_NORMAL)) | TERRAIN_TYPE_NORMAL;
@ -166,10 +166,10 @@ bool8 sub_804AE08(DungeonPos *pos)
tile = GetTileMut(pos->x,pos->y);
if (!(tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)))
if(!(tile->terrainType & (TERRAIN_TYPE_UNK_8 | TERRAIN_TYPE_IMPASSABLE_WALL))) {
if(!(tile->terrainType & (TERRAIN_TYPE_UNBREAKABLE | TERRAIN_TYPE_IMPASSABLE_WALL))) {
uVar6 = TRUE;
tile->terrainType = (tile->terrainType & ~(TERRAIN_TYPE_SECONDARY | TERRAIN_TYPE_NORMAL)) | TERRAIN_TYPE_NORMAL;
tile->unk4 = tile->unk4 | 0x10;
tile->spawnOrVisibilityFlags = tile->spawnOrVisibilityFlags | 0x10;
for(y = -1; y < 2; y++)
{
@ -191,8 +191,8 @@ void sub_804AE84(DungeonPos *pos)
s32 y;
tile = GetTileMut(pos->x,pos->y);
if ((tile->unk4 & 0x10) != 0) {
tile->unk4 = tile->unk4 & 0xffef;
if ((tile->spawnOrVisibilityFlags & 0x10) != 0) {
tile->spawnOrVisibilityFlags &= 0xffef;
for(y = -1; y < 2; y++)
{

View File

@ -24,6 +24,7 @@
#include "status.h"
#include "structs/map.h"
#include "structs/str_dungeon.h"
#include "structs/str_806B7F8.h"
extern u8 *gTrapNames[];
extern u8 *gUnknown_80FC5FC[];
@ -57,18 +58,6 @@ extern u32 gUnknown_8106A4C;
extern u32 gUnknown_8106A50;
extern s16 gUnknown_80F4F8A;
struct unkStruct_806B7F8
{
s16 species;
u8 unk2;
u32 unk4;
u16 level;
u8 fillA[2];
DungeonPos pos;
u8 unk10;
};
extern Entity* sub_806B7F8(struct unkStruct_806B7F8 *, bool8);
void sub_806A9B4(Entity *, u32);
s16 sub_803D970(u32);
@ -76,7 +65,7 @@ bool8 sub_806AA0C(s32, s32);
void sub_80421EC(DungeonPos *, u32);
bool8 sub_8045888(Entity *);
u8 sub_8043D10(void);
u8 GetFloorType(void);
void sub_8068FE0(Entity *, u32, Entity *);
void sub_8045C28(Item *, u8 , u8);
void sub_8045BF8(u8 *, Item *);
@ -149,7 +138,7 @@ bool8 LayTrap(DungeonPos *pos, u8 trapID, u8 param_3)
tile->object->isVisible = TRUE;
}
else {
entity = sub_8045684(trapID,pos,param_3);
entity = SpawnTrap(trapID,pos,param_3);
if (entity == NULL)
_0807FD6E:
return FALSE;
@ -551,7 +540,7 @@ void HandlePitfallTrap(Entity *pokemon, Entity *target, Tile *tile)
sub_803E708(0x1e,0x48);
}
if (info->isTeamLeader) {
if (sub_8043D10() != 2) {
if (GetFloorType() != 2) {
info->unk15C = 1;
info->unk15E = 1;
sub_803E708(0x28,0x4b);

View File

@ -274,47 +274,7 @@ gUnknown_202EE76: /* 202EE76 (sub_804513C - sub_8082A08) */
.space 0x10
.include "src/dungeon_map_access.o"
gUnknown_202F1A8: /* 202F1A8 (sub_8043CE4 - sub_8051A74) */
.space 0x1
gUnknown_202F1A9: /* 202F1A9 (sub_804AFAC) */
.space 0x1
gUnknown_202F1AA: /* 202F1AA (sub_804AFAC - sub_804EEE4) */
.space 0x1
gUnknown_202F1AB: /* 202F1AB (sub_804AFAC - sub_804EEE4) */
.space 0x1
gUnknown_202F1AC: /* 202F1AC (sub_804AFAC - sub_804F278) */
.space 0x1
gUnknown_202F1AD: /* 202F1AD (sub_804AFAC - sub_804D154) */
.space 0x1
gUnknown_202F1AE: /* 202F1AE (sub_804AFAC - sub_804D084) */
.space 0x2
gUnknown_202F1B0: /* 202F1B0 (sub_804AFAC - sub_804C53C) */
.space 0x2
gUnknown_202F1B2: /* 202F1B2 (sub_804AFAC - sub_804C53C) */
.space 0x2
gUnknown_202F1B4: /* 202F1B4 (sub_804AFAC - sub_804FF08) */
.space 0x4
gUnknown_202F1B8: /* 202F1B8 (sub_804AFAC - sub_8051654) */
.space 0x10
gUnknown_202F1C8: /* 202F1C8 (sub_804AFAC - sub_804F694) */
.space 0x4
gUnknown_202F1CC: /* 202F1CC (sub_804D154) */
.space 0x4
gUnknown_202F1D0: /* 202F1D0 (sub_804AFAC) */
.space 0x4
gUnknown_202F1D4: /* 202F1D4 (sub_8050C30) */
.space 0x4
gUnknown_202F1D8: /* 202F1D8 (sub_804AFAC - sub_804EBC8) */
.space 0x4
gUnknown_202F1DC: /* 202F1DC (sub_80511F0 - sub_8051438) */
.space 0x4
gUnknown_202F1E0: /* 202F1E0 (sub_80511F0) */
.space 0x1
gUnknown_202F1E1: /* 202F1E1 (sub_80511F0 - sub_8051438) */
.space 0x7
.include "src/dungeon_generation.o"
.include "src/dungeon_message.o"
.include "src/dungeon_move.o"
.include "src/code_805D8C8_1.o"