Decomp MonsterSpawnListPartialCopy

This commit is contained in:
slaw-22
2026-05-19 20:23:58 +00:00
parent 6b29ad6aff
commit c2cf2f2e4a
6 changed files with 49 additions and 94 deletions

View File

@@ -3,6 +3,7 @@
.public ChangeGiratinaFormIfSkyDungeon
.public ClearHiddenStairs
.public CloseFixedBin
.public CopySpawnEntriesOnce
.public CountItemsOnFloorForAcuteSniffer
.public Debug_Print0
.public DeleteAllMonsterSpriteFiles

View File

@@ -7,8 +7,8 @@
.public CheckActiveChallengeRequest
.public CheckSpawnThreshold
.public DIRECTIONS_XY
.public DisplayAnimatedNumbers
.public DUNGEON_PTR
.public DisplayAnimatedNumbers
.public DungeonFloorToGroupFloor
.public DungeonGetTotalSpriteFileSize
.public DungeonGoesUp
@@ -29,7 +29,6 @@
.public GetNbRecruited
.public GetSecondFormIfValid
.public GetSpriteFileSize
.public GetSpriteSize
.public HandleSir0Translation
.public IsBossFight
.public IsCurrentFixedRoomBossFight
@@ -47,6 +46,28 @@
.public MemFree
.public MonsterIsType
.public NeedsItemToSpawn
.public PlayEffectAnimationEntity
.public PlaySeByIdIfNotSilence
.public RandIntSafe
.public STATUS_ICON_ARRAY_BIDE
.public STATUS_ICON_ARRAY_BLINDED
.public STATUS_ICON_ARRAY_BURN
.public STATUS_ICON_ARRAY_CRINGE
.public STATUS_ICON_ARRAY_CURSE
.public STATUS_ICON_ARRAY_FREEZE
.public STATUS_ICON_ARRAY_INVISIBLE
.public STATUS_ICON_ARRAY_LEECH_SEED
.public STATUS_ICON_ARRAY_LONG_TOSS
.public STATUS_ICON_ARRAY_MAGNET_RISE
.public STATUS_ICON_ARRAY_MIRACLE_EYE
.public STATUS_ICON_ARRAY_MUZZLED
.public STATUS_ICON_ARRAY_REFLECT
.public STATUS_ICON_ARRAY_SLEEP
.public STATUS_ICON_ARRAY_SURE_SHOT
.public SetMonsterId
.public ShouldDisplayEntityWrapper
.public SubstitutePlaceholderStringTags
.public UnloadFile
.public ov10_022BDC68
.public ov10_022BDE50
.public ov10_022BEC08
@@ -81,28 +102,6 @@
.public ov29_023515B0
.public ov29_023515CC
.public ov29_0235354C
.public PlayEffectAnimationEntity
.public PlaySeByIdIfNotSilence
.public RandIntSafe
.public SetMonsterId
.public ShouldDisplayEntityWrapper
.public STATUS_ICON_ARRAY_BIDE
.public STATUS_ICON_ARRAY_BLINDED
.public STATUS_ICON_ARRAY_BURN
.public STATUS_ICON_ARRAY_CRINGE
.public STATUS_ICON_ARRAY_CURSE
.public STATUS_ICON_ARRAY_FREEZE
.public STATUS_ICON_ARRAY_INVISIBLE
.public STATUS_ICON_ARRAY_LEECH_SEED
.public STATUS_ICON_ARRAY_LONG_TOSS
.public STATUS_ICON_ARRAY_MAGNET_RISE
.public STATUS_ICON_ARRAY_MIRACLE_EYE
.public STATUS_ICON_ARRAY_MUZZLED
.public STATUS_ICON_ARRAY_REFLECT
.public STATUS_ICON_ARRAY_SLEEP
.public STATUS_ICON_ARRAY_SURE_SHOT
.public sub_0201C000
.public sub_0201CF90
.public sub_0201D034
.public SubstitutePlaceholderStringTags
.public UnloadFile

View File

@@ -5550,72 +5550,3 @@ _022E7C54:
.align 2, 0
_022E7C5C: .word DUNGEON_PTR
arm_func_end CopySpawnEntriesMaster
arm_func_start MonsterSpawnListPartialCopy
MonsterSpawnListPartialCopy: ; 0x022E7C60
stmdb sp!, {r4, r5, r6, lr}
mov r6, r0
mov r5, r1
mov r4, #0
b _022E7CE4
_022E7C74:
ldr r0, _022E7CF4 ; =DUNGEON_PTR
ldr r0, [r0]
#ifdef JAPAN
add r0, r0, #0x8c0
add r0, r0, #0x2c000
#else
add r0, r0, #0x164
add r0, r0, #0x2c800
#endif
add r0, r0, r4, lsl #3
bl GetMonsterIdFromSpawnEntry
cmp r0, #0
beq _022E7CEC
bl GetSpriteSize
cmp r0, #6
bhi _022E7CE0
#ifdef JAPAN
ldr r0, _022E7CF4 ; =DUNGEON_PTR
ldr r0, [r0]
add r1, r0, r4, lsl #3
add r0, r1, #0x2c800
ldrsh r0, [r0, #0xc2]
cmp r0, #0
beq _022E7CE0
add r0, r1, #0x8c0
add r3, r0, #0x2c000
#else
ldr r1, _022E7CF4 ; =DUNGEON_PTR
ldr r0, _022E7CF8 ; =0x0002C966
ldr r1, [r1]
add r1, r1, r4, lsl #3
ldrsh r0, [r1, r0]
cmp r0, #0
beq _022E7CE0
add r0, r1, #0x164
add r3, r0, #0x2c800
#endif
add r2, r6, r5, lsl #3
mov r1, #4
_022E7CCC:
ldrh r0, [r3], #2
subs r1, r1, #1
strh r0, [r2], #2
bne _022E7CCC
add r5, r5, #1
_022E7CE0:
add r4, r4, #1
_022E7CE4:
cmp r4, #0x10
blt _022E7C74
_022E7CEC:
mov r0, r5
ldmia sp!, {r4, r5, r6, pc}
.align 2, 0
_022E7CF4: .word DUNGEON_PTR
#ifndef JAPAN
_022E7CF8: .word 0x0002C966
#endif
arm_func_end MonsterSpawnListPartialCopy

View File

@@ -837,7 +837,7 @@ struct monster_spawn_entry {
u16 level_mult_512; // 0x0: Spawn level << 9
// 0x2: Incremental spawn weights for this entry.
// [0] = normal spawn weight, [1] = monster house spawn weight
u16 incremental_spawn_weight[2];
s16 incremental_spawn_weight[2];
// 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;

View File

@@ -1,6 +1,7 @@
#ifndef PMDSKY_SPAWN_1_H
#define PMDSKY_SPAWN_1_H
s32 MonsterSpawnListPartialCopy(struct monster_spawn_entry entry_out[], s32 idx_out);
void CopySpawnEntriesOnce();
#endif //PMDSKY_SPAWN_1_H

View File

@@ -2,8 +2,31 @@
#include "spawn_1.h"
extern s32 CopySpawnEntriesMaster(struct monster_spawn_entry[], s32);
extern s32 GetMonsterIdFromSpawnEntry(struct monster_spawn_entry*);
extern u32 GetSpriteSize(s32);
extern struct dungeon *DUNGEON_PTR;
s32 MonsterSpawnListPartialCopy(struct monster_spawn_entry entry_out[], s32 idx_out) {
for(s32 i = 0; i < 16; i++) {
s32 monster_id = GetMonsterIdFromSpawnEntry(&(DUNGEON_PTR->spawn_entries_master[i]));
if(monster_id == 0) {
break;
}
if(GetSpriteSize(monster_id) > 6) {
continue;
}
if(DUNGEON_PTR->spawn_entries_master[i].incremental_spawn_weight[0] == 0) {
continue;
}
entry_out[idx_out] = DUNGEON_PTR->spawn_entries_master[i];
idx_out++;
}
return idx_out;
}
void CopySpawnEntriesOnce() {
if (DUNGEON_PTR->spawn_entries_copied != FALSE) {
return;