SpawnNonEnemies

This commit is contained in:
DizzyEggg 2024-11-12 17:41:53 +01:00
parent a71b26de35
commit cb5242ba6c
14 changed files with 725 additions and 1080 deletions

View File

@ -5,679 +5,6 @@
.text
thumb_func_start sub_804FF08
sub_804FF08:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
ldr r4, _08050234
add sp, r4
mov r10, r0
lsls r1, 24
lsrs r1, 24
movs r0, 0xE0
lsls r0, 5
add r0, sp
str r1, [r0]
ldr r0, _08050238
ldr r0, [r0]
mov r9, r0
ldr r0, _0805023C
add r0, r9
movs r1, 0
ldrsh r0, [r0, r1]
movs r1, 0x1
negs r1, r1
cmp r0, r1
beq _0804FF46
ldr r0, _08050240
add r0, r9
movs r2, 0
ldrsh r0, [r0, r2]
cmp r0, r1
bne _08050038
_0804FF46:
movs r0, 0
mov r8, r0
movs r6, 0
_0804FF4C:
movs r5, 0
mov r1, r8
lsls r0, r1, 2
mov r2, sp
adds r4, r0, r2
_0804FF56:
adds r0, r6, 0
adds r1, r5, 0
bl GetTile
adds r1, r0, 0
ldrh r2, [r1]
movs r0, 0x3
ands r0, r2
cmp r0, 0x1
bne _0804FFAA
ldrb r0, [r1, 0x9]
cmp r0, 0xFF
beq _0804FFAA
movs r0, 0x20
ands r0, r2
cmp r0, 0
bne _0804FFAA
ldrh r1, [r1, 0x4]
movs r3, 0x8
adds r0, r3, 0
ands r0, r1
cmp r0, 0
bne _0804FFAA
movs r0, 0x10
ands r0, r1
cmp r0, 0
bne _0804FFAA
adds r0, r3, 0
ands r0, r2
cmp r0, 0
bne _0804FFAA
movs r1, 0x80
lsls r1, 1
adds r0, r1, 0
ands r0, r2
cmp r0, 0
bne _0804FFAA
strb r6, [r4]
strb r5, [r4, 0x1]
adds r4, 0x4
movs r2, 0x1
add r8, r2
_0804FFAA:
adds r5, 0x1
cmp r5, 0x1F
ble _0804FF56
adds r6, 0x1
cmp r6, 0x37
ble _0804FF4C
mov r0, r8
cmp r0, 0
beq _08050038
bl DungeonRandInt
lsls r0, 2
mov r1, sp
adds r4, r1, r0
ldrb r0, [r4]
ldrb r1, [r4, 0x1]
bl GetTileSafe
adds r5, r0, 0
ldrh r1, [r5, 0x4]
movs r0, 0x1
orrs r0, r1
ldr r1, _08050244
ands r0, r1
strh r0, [r5, 0x4]
ldr r1, _08050248
ldrb r0, [r5, 0x9]
strb r0, [r1]
ldrb r1, [r4]
ldr r0, _0805023C
add r0, r9
strh r1, [r0]
ldrb r1, [r4, 0x1]
ldr r0, _08050240
add r0, r9
strh r1, [r0]
bl GetFloorType
lsls r0, 24
lsrs r0, 24
cmp r0, 0x2
bne _08050038
ldrb r4, [r5, 0x9]
movs r6, 0
_08050002:
movs r5, 0
_08050004:
adds r0, r6, 0
adds r1, r5, 0
bl GetTileSafe
adds r1, r0, 0
ldrh r2, [r1]
movs r0, 0x3
ands r0, r2
cmp r0, 0x1
bne _0805002C
ldrb r0, [r1, 0x9]
cmp r0, r4
bne _0805002C
movs r0, 0x40
orrs r0, r2
strh r0, [r1]
ldrb r1, [r1, 0x9]
ldr r0, _0805024C
add r0, r9
strb r1, [r0]
_0805002C:
adds r5, 0x1
cmp r5, 0x1F
ble _08050004
adds r6, 0x1
cmp r6, 0x37
ble _08050002
_08050038:
movs r2, 0
mov r8, r2
movs r6, 0
_0805003E:
movs r5, 0
adds r7, r6, 0x1
mov r1, r8
lsls r0, r1, 2
mov r2, sp
adds r4, r0, r2
_0805004A:
adds r0, r6, 0
adds r1, r5, 0
bl GetTile
adds r1, r0, 0
ldrh r2, [r1]
movs r0, 0x3
ands r0, r2
cmp r0, 0x1
bne _08050092
ldrb r0, [r1, 0x9]
cmp r0, 0xFF
beq _08050092
movs r0, 0x20
ands r0, r2
cmp r0, 0
bne _08050092
movs r0, 0x40
ands r0, r2
cmp r0, 0
bne _08050092
movs r0, 0x8
ands r0, r2
cmp r0, 0
bne _08050092
movs r1, 0x80
lsls r1, 1
adds r0, r1, 0
ands r0, r2
cmp r0, 0
bne _08050092
strb r6, [r4]
strb r5, [r4, 0x1]
adds r4, 0x4
movs r2, 0x1
add r8, r2
_08050092:
adds r5, 0x1
cmp r5, 0x1F
ble _0805004A
adds r6, r7, 0
cmp r6, 0x37
ble _0805003E
mov r0, r8
cmp r0, 0
beq _080500FA
mov r1, r10
ldrb r4, [r1, 0xF]
cmp r4, 0
beq _080500FA
subs r0, r4, 0x2
adds r1, r4, 0x2
bl DungeonRandRange
adds r4, r0, 0
cmp r4, 0
bgt _080500BC
movs r4, 0x1
_080500BC:
mov r0, sp
mov r1, r8
bl sub_804FED0
mov r0, r8
bl DungeonRandInt
adds r5, r0, 0
cmp r4, 0
ble _080500FA
adds r6, r4, 0
lsls r0, r5, 2
mov r2, sp
adds r4, r0, r2
_080500D8:
ldrb r0, [r4]
ldrb r1, [r4, 0x1]
bl GetTileSafe
ldrh r2, [r0, 0x4]
movs r1, 0x2
orrs r1, r2
strh r1, [r0, 0x4]
adds r4, 0x4
adds r5, 0x1
cmp r5, r8
bne _080500F4
mov r4, sp
movs r5, 0
_080500F4:
subs r6, 0x1
cmp r6, 0
bne _080500D8
_080500FA:
movs r0, 0
mov r8, r0
movs r6, 0
_08050100:
movs r5, 0
adds r7, r6, 0x1
mov r1, r8
lsls r0, r1, 2
mov r2, sp
adds r4, r0, r2
_0805010C:
adds r0, r6, 0
adds r1, r5, 0
bl GetTile
ldrh r1, [r0]
movs r0, 0x3
ands r0, r1
cmp r0, 0
bne _08050128
strb r6, [r4]
strb r5, [r4, 0x1]
adds r4, 0x4
movs r0, 0x1
add r8, r0
_08050128:
adds r5, 0x1
cmp r5, 0x1F
ble _0805010C
adds r6, r7, 0
cmp r6, 0x37
ble _08050100
mov r1, r8
cmp r1, 0
beq _0805018E
mov r2, r10
ldrb r4, [r2, 0x14]
cmp r4, 0
beq _0805018E
subs r0, r4, 0x2
adds r1, r4, 0x2
bl DungeonRandRange
adds r4, r0, 0
cmp r4, 0
ble _0805018E
mov r0, sp
mov r1, r8
bl sub_804FED0
mov r0, r8
bl DungeonRandInt
adds r5, r0, 0
cmp r4, 0
ble _0805018E
adds r6, r4, 0
lsls r0, r5, 2
mov r1, sp
adds r4, r0, r1
_0805016C:
ldrb r0, [r4]
ldrb r1, [r4, 0x1]
bl GetTileSafe
ldrh r2, [r0, 0x4]
movs r1, 0x2
orrs r1, r2
strh r1, [r0, 0x4]
adds r4, 0x4
adds r5, 0x1
cmp r5, r8
bne _08050188
mov r4, sp
movs r5, 0
_08050188:
subs r6, 0x1
cmp r6, 0
bne _0805016C
_0805018E:
movs r2, 0
mov r8, r2
movs r0, 0xE0
lsls r0, 5
add r0, sp
ldr r0, [r0]
cmp r0, 0
bne _080501E4
movs r6, 0
_080501A0:
movs r5, 0
adds r7, r6, 0x1
mov r1, r8
lsls r0, r1, 2
mov r2, sp
adds r4, r0, r2
_080501AC:
adds r0, r6, 0
adds r1, r5, 0
bl GetTile
ldrh r1, [r0]
movs r0, 0x20
ands r0, r1
cmp r0, 0
bne _080501D8
movs r0, 0x40
ands r0, r1
cmp r0, 0
beq _080501D8
movs r0, 0x8
ands r0, r1
cmp r0, 0
bne _080501D8
strb r6, [r4]
strb r5, [r4, 0x1]
adds r4, 0x4
movs r0, 0x1
add r8, r0
_080501D8:
adds r5, 0x1
cmp r5, 0x1F
ble _080501AC
adds r6, r7, 0
cmp r6, 0x37
ble _080501A0
_080501E4:
mov r1, r8
cmp r1, 0
beq _08050294
lsrs r4, r1, 31
add r4, r8
asrs r4, 1
lsls r0, r1, 3
movs r1, 0xA
bl __divsi3
adds r1, r0, 0
adds r0, r4, 0
bl DungeonRandRange
adds r4, r0, 0
cmp r4, 0x5
bgt _08050208
movs r4, 0x6
_08050208:
ldr r0, _08050250
movs r2, 0
ldrsh r0, [r0, r2]
cmp r4, r0
blt _08050214
adds r4, r0, 0
_08050214:
mov r0, sp
mov r1, r8
bl sub_804FED0
mov r0, r8
bl DungeonRandInt
adds r5, r0, 0
cmp r4, 0
ble _08050294
adds r6, r4, 0
lsls r0, r5, 2
mov r1, sp
adds r7, r0, r1
_08050230:
ldrb r0, [r7]
b _08050254
.align 2, 0
_08050234: .4byte 0xffffe3fc
_08050238: .4byte gDungeon
_0805023C: .4byte 0x0000e21c
_08050240: .4byte 0x0000e21e
_08050244: .4byte 0x0000fffd
_08050248: .4byte gUnknown_202F1B4
_0805024C: .4byte 0x00003a0c
_08050250: .4byte gUnknown_80F4DA0
_08050254:
ldrb r1, [r7, 0x1]
bl GetTileSafe
adds r4, r0, 0
movs r0, 0x2
bl DungeonRandInt
cmp r0, 0
beq _0805026C
ldrh r0, [r4, 0x4]
movs r1, 0x2
b _0805027E
_0805026C:
ldr r0, _08050424
ldr r0, [r0]
ldr r2, _08050428
adds r0, r2
ldrb r0, [r0]
cmp r0, 0
beq _08050282
ldrh r0, [r4, 0x4]
movs r1, 0x4
_0805027E:
orrs r0, r1
strh r0, [r4, 0x4]
_08050282:
adds r7, 0x4
adds r5, 0x1
cmp r5, r8
bne _0805028E
mov r7, sp
movs r5, 0
_0805028E:
subs r6, 0x1
cmp r6, 0
bne _08050230
_08050294:
movs r0, 0
mov r8, r0
movs r6, 0
_0805029A:
movs r5, 0
adds r7, r6, 0x1
mov r1, r8
lsls r0, r1, 2
mov r2, sp
adds r4, r0, r2
_080502A6:
adds r0, r6, 0
adds r1, r5, 0
bl GetTile
adds r1, r0, 0
ldrh r2, [r1]
movs r0, 0x3
ands r0, r2
cmp r0, 0x1
bne _080502F0
ldrb r0, [r1, 0x9]
cmp r0, 0xFF
beq _080502F0
movs r0, 0x20
ands r0, r2
cmp r0, 0
bne _080502F0
ldrh r1, [r1, 0x4]
movs r0, 0x2
ands r0, r1
cmp r0, 0
bne _080502F0
movs r0, 0x8
ands r0, r2
cmp r0, 0
bne _080502F0
movs r1, 0x80
lsls r1, 1
adds r0, r1, 0
ands r0, r2
cmp r0, 0
bne _080502F0
strb r6, [r4]
strb r5, [r4, 0x1]
adds r4, 0x4
movs r2, 0x1
add r8, r2
_080502F0:
adds r5, 0x1
cmp r5, 0x1F
ble _080502A6
adds r6, r7, 0
cmp r6, 0x37
ble _0805029A
mov r0, r8
cmp r0, 0
beq _08050356
mov r2, r10
ldrb r1, [r2, 0x10]
lsrs r0, r1, 1
bl DungeonRandRange
adds r4, r0, 0
cmp r4, 0
ble _08050356
cmp r4, 0x37
ble _08050318
movs r4, 0x38
_08050318:
mov r0, sp
mov r1, r8
bl sub_804FED0
mov r0, r8
bl DungeonRandInt
adds r5, r0, 0
cmp r4, 0
ble _08050356
adds r6, r4, 0
lsls r0, r5, 2
mov r1, sp
adds r4, r0, r1
_08050334:
ldrb r0, [r4]
ldrb r1, [r4, 0x1]
bl GetTileSafe
ldrh r2, [r0, 0x4]
movs r1, 0x4
orrs r1, r2
strh r1, [r0, 0x4]
adds r4, 0x4
adds r5, 0x1
cmp r5, r8
bne _08050350
mov r4, sp
movs r5, 0
_08050350:
subs r6, 0x1
cmp r6, 0
bne _08050334
_08050356:
ldr r0, _0805042C
add r0, r9
movs r2, 0
ldrsh r0, [r0, r2]
movs r1, 0x1
negs r1, r1
cmp r0, r1
beq _08050372
ldr r0, _08050430
add r0, r9
movs r2, 0
ldrsh r0, [r0, r2]
cmp r0, r1
bne _08050410
_08050372:
movs r0, 0
mov r8, r0
movs r6, 0
_08050378:
movs r5, 0
adds r7, r6, 0x1
mov r1, r8
lsls r0, r1, 2
mov r2, sp
adds r4, r0, r2
_08050384:
adds r0, r6, 0
adds r1, r5, 0
bl GetTile
adds r2, r0, 0
ldrh r1, [r2]
movs r0, 0x3
ands r0, r1
cmp r0, 0x1
bne _080503E2
ldrb r0, [r2, 0x9]
cmp r0, 0xFF
beq _080503E2
movs r0, 0x20
ands r0, r1
cmp r0, 0
bne _080503E2
movs r3, 0x8
adds r0, r3, 0
ands r0, r1
cmp r0, 0
bne _080503E2
movs r0, 0x80
lsls r0, 1
mov r10, r0
mov r0, r10
ands r0, r1
cmp r0, 0
bne _080503E2
ldrh r1, [r2, 0x4]
movs r0, 0x2
ands r0, r1
cmp r0, 0
bne _080503E2
adds r0, r3, 0
ands r0, r1
cmp r0, 0
bne _080503E2
movs r0, 0x4
ands r0, r1
cmp r0, 0
bne _080503E2
strb r6, [r4]
strb r5, [r4, 0x1]
adds r4, 0x4
movs r1, 0x1
add r8, r1
_080503E2:
adds r5, 0x1
cmp r5, 0x1F
ble _08050384
adds r6, r7, 0
cmp r6, 0x37
ble _08050378
mov r2, r8
cmp r2, 0
beq _08050410
mov r0, r8
bl DungeonRandInt
lsls r0, 2
mov r1, sp
adds r2, r1, r0
ldrb r1, [r2]
ldr r0, _0805042C
add r0, r9
strh r1, [r0]
ldrb r1, [r2, 0x1]
ldr r0, _08050430
add r0, r9
strh r1, [r0]
_08050410:
ldr r3, _08050434
add sp, r3
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_08050424: .4byte gDungeon
_08050428: .4byte 0x0000065c
_0805042C: .4byte 0x0000e218
_08050430: .4byte 0x0000e21a
_08050434: .4byte 0x00001c04
thumb_func_end sub_804FF08
thumb_func_start sub_8050438
sub_8050438:
push {r4-r7,lr}
@ -801,7 +128,7 @@ _0805051C:
beq _0805055E
mov r0, sp
mov r1, r8
bl sub_804FED0
bl ShuffleSpawnPositions
mov r0, r8
bl DungeonRandInt
adds r5, r0, 0
@ -956,7 +283,7 @@ _0805063E:
_0805064E:
mov r0, sp
mov r1, r8
bl sub_804FED0
bl ShuffleSpawnPositions
mov r0, r8
bl DungeonRandInt
adds r5, r0, 0
@ -3169,7 +2496,7 @@ _080516E4:
str r0, [r6]
b _08051724
.align 2, 0
_080516EC: .4byte gUnknown_202F1B8
_080516EC: .4byte sKecleonShopPosition
_080516F0: .4byte 0x0000ffdf
_080516F4:
ldr r0, [r6, 0x8]
@ -3248,7 +2575,7 @@ _0805177C:
str r0, [r6, 0x4]
b _080517BC
.align 2, 0
_08051784: .4byte gUnknown_202F1B8
_08051784: .4byte sKecleonShopPosition
_08051788: .4byte 0x0000ffdf
_0805178C:
ldr r0, [r6, 0xC]
@ -3432,7 +2759,7 @@ _080518D2:
pop {r0}
bx r0
.align 2, 0
_080518E4: .4byte gUnknown_202F1B8
_080518E4: .4byte sKecleonShopPosition
_080518E8: .4byte 0x0000ffdf
_080518EC: .4byte gUnknown_80F57D4
thumb_func_end sub_8051654
@ -3448,7 +2775,7 @@ _080518F8:
movs r1, 0x1
bl GetTileSafe
adds r4, r0, 0
bl sub_804FD10
bl ResetTile
cmp r5, 0
beq _0805190E
cmp r5, 0x37
@ -3462,7 +2789,7 @@ _08051914:
movs r1, 0x1E
bl GetTileSafe
adds r4, r0, 0
bl sub_804FD10
bl ResetTile
cmp r5, 0
beq _0805192A
cmp r5, 0x37

View File

@ -9,6 +9,12 @@
#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 FloorSize {
FLOOR_SIZE_LARGE,
FLOOR_SIZE_SMALL,
FLOOR_SIZE_MEDIUM,
};
enum FloorType {
FLOOR_TYPE_NORMAL,
FLOOR_TYPE_FIXED, // Fixed room

View File

@ -19,7 +19,7 @@ enum TerrainType
TERRAIN_TYPE_SHOP = 1 << 5, // x20
TERRAIN_TYPE_IN_MONSTER_HOUSE = 1 << 6, // x40
TERRAIN_TYPE_UNK_7 = 1 << 7, // x80
TERRAIN_TYPE_UNK_8 = 1 << 8, // x100
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,

View File

@ -113,30 +113,33 @@ 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
{
u8 unk0;
s8 unk1;
s8 roomDensity;
u8 unk2;
u8 unk3;
u8 unk4;
u8 unk5;
u8 floorConnectivity;
u8 unk6;
u8 unk7;
u8 unk8;
u8 unk9;
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;
@ -342,13 +345,13 @@ typedef struct Dungeon
/* 0x37FE */ u8 unk37FF;
s16 unk3800;
u8 fill3802[0x3904 - 0x3802];
/* 0x3904 */ s16 unk3904;
/* 0x3904 */ s16 numItems;
u8 fill3906[0x3A08 - 0x3906];
/* 0x3A08 */ u8 unk3A08;
/* 0x3A09 */ u8 unk3A09;
/* 0x3A0A */ u8 unk3A0A;
/* 0x3A0B */ u8 unk3A0B;
u8 unk3A0C;
/* 0x3A0C */ u8 monsterHouseRoom; // room index of monster house
/* 0x3A0D */ u8 unk3A0D;
/* 0x3A0E */ s16 tileset;
/* 0x3A10 */ s16 unk3A10;
@ -356,8 +359,8 @@ typedef struct Dungeon
/* 0x3A14 */ s16 bossBattleIndex;
/* 0x3A16 */ s16 unk3A16;
/* 0x3A18 */ Tile tiles[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X];
Position unkE218;
Position unkE21C; // stair location?
/* 0xEA18 */ Position playerSpawn;
Position stairsSpawn; // stairs location
Position unkE220[8];
struct MinMaxPosition kecleonShopPos;
u32 unkE250;

View File

@ -229,7 +229,6 @@ SECTIONS {
src/dungeon_map_access.o(.text);
src/tile_types.o(.text);
src/dungeon_generation.o(.text);
src/code_804AFAC.o(.text);
asm/code_804FD30.o(.text);
src/dungeon_message.o(.text);
src/dungeon_move.o(.text);

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++;

View File

@ -1,126 +0,0 @@
#include "global.h"
#include "dungeon_map_access.h"
#include "dungeon_random.h"
#include "structs/str_dungeon.h"
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 = GetTileSafe(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 = GetTileSafe(x,y);
tile->terrainType &= ~(TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
}
}
}
}
void sub_804FD10(Tile *tile)
{
tile->terrainType = 0;
tile->spawnOrVisibilityFlags = 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(GetTileSafe(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)))
{
GetTileSafe(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

@ -118,7 +118,7 @@ void sub_8071B48(void)
}
}
if (dungeon->unk66E == 0) {
if (gDungeon->unk3A0C == 0xff) {
if (gDungeon->monsterHouseRoom == 0xff) {
if (counter >= gUnknown_80F4DA6) {
return;
}

View File

@ -220,7 +220,6 @@ void sub_807D148(Entity *pokemon, Entity *target, u32 param_3, Position *pos)
EntityInfo *info;
u32 direction;
Position local_2c;
Position pos2;
bool8 flag;
info = GetEntInfo(target);
@ -237,8 +236,8 @@ void sub_807D148(Entity *pokemon, Entity *target, u32 param_3, Position *pos)
}
if (param_3 == 1)
{
pos2 = gDungeon->unkE21C;
if(pos2.x == target->pos.x && pos2.y == target->pos.y) {
Position 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;
@ -273,7 +272,7 @@ void sub_807D148(Entity *pokemon, Entity *target, u32 param_3, Position *pos)
}
break;
case 1:
if (!sub_808384C(&local_2c,&gDungeon->unkE21C)) {
if (!sub_808384C(&local_2c,&gDungeon->stairsSpawn)) {
local_2c = target->pos;
flag = TRUE;
}

File diff suppressed because it is too large Load Diff

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

@ -128,7 +128,7 @@ bool8 sub_804AD34(Position *pos)
iVar8 = 0;
tile = GetTileSafe(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;
@ -167,7 +167,7 @@ bool8 sub_804AE08(Position *pos)
tile = GetTileSafe(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->spawnOrVisibilityFlags = tile->spawnOrVisibilityFlags | 0x10;

View File

@ -487,7 +487,7 @@ void sub_8081454(unkStruct_8094924 *param_1)
sub_80830B4(param_1, gDungeon->unk3A09);
sub_80830B4(param_1, gDungeon->unk3A0A);
sub_80830B4(param_1, gDungeon->unk3A0B);
sub_8083060(param_1, gDungeon->unk3A0C);
sub_8083060(param_1, gDungeon->monsterHouseRoom);
sub_8083060(param_1, gDungeon->unk3A0D);
sub_8083048(param_1, gDungeon->tileset);
sub_8083048(param_1,gDungeon->unk3A10);
@ -504,8 +504,8 @@ void sub_8081454(unkStruct_8094924 *param_1)
}
SavePosition(param_1,&gDungeon->unkE218);
SavePosition(param_1,&gDungeon->unkE21C);
SavePosition(param_1,&gDungeon->playerSpawn);
SavePosition(param_1,&gDungeon->stairsSpawn);
@ -824,7 +824,7 @@ void sub_8081C7C(unkStruct_8094924 *r0)
gDungeon->unk3A09 = sub_80831DC(r0);
gDungeon->unk3A0A = sub_80831DC(r0);
gDungeon->unk3A0B = sub_80831DC(r0);
gDungeon->unk3A0C = sub_8083188(r0);
gDungeon->monsterHouseRoom = sub_8083188(r0);
gDungeon->unk3A0D = sub_8083188(r0);
gDungeon->tileset = sub_8083170(r0);
gDungeon->unk3A10 = sub_8083170(r0);
@ -839,8 +839,8 @@ void sub_8081C7C(unkStruct_8094924 *r0)
RestoreTile(r0,&gDungeon->tiles[y][x]);
}
}
sub_80831F8(r0,&gDungeon->unkE218);
sub_80831F8(r0,&gDungeon->unkE21C);
sub_80831F8(r0,&gDungeon->playerSpawn);
sub_80831F8(r0,&gDungeon->stairsSpawn);
for(iVar7 = 0; iVar7 < 8; iVar7++)
{

View File

@ -274,35 +274,8 @@ gUnknown_202EE76: /* 202EE76 (sub_804513C - sub_8082A08) */
.space 0x10
.include "src/dungeon_map_access.o"
.include "src/dungeon_generation.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) */