diff --git a/asm/overlay_29_022E37DC.s b/asm/overlay_29_022E37DC.s index 0bf55b0c..7c117624 100644 --- a/asm/overlay_29_022E37DC.s +++ b/asm/overlay_29_022E37DC.s @@ -5652,37 +5652,3 @@ ov29_022E7CFC: ; 0x022E7CFC .align 2, 0 _022E7D48: .word DUNGEON_PTR arm_func_end ov29_022E7CFC - - arm_func_start IsOnMonsterSpawnList -IsOnMonsterSpawnList: ; 0x022E7D4C - stmdb sp!, {r4, r5, r6, lr} - mov r6, r0 - mov r5, #0 - ldr r4, _022E7D9C ; =DUNGEON_PTR - b _022E7D8C -_022E7D60: - ldr r0, [r4] -#ifdef JAPAN - add r0, r0, #0x8c0 - add r0, r0, #0x2c000 -#else - add r0, r0, #0x164 - add r0, r0, #0x2c800 -#endif - add r0, r0, r5, lsl #3 - bl GetMonsterIdFromSpawnEntry - cmp r0, #0 - beq _022E7D94 - cmp r0, r6 - moveq r0, #1 - ldmeqia sp!, {r4, r5, r6, pc} - add r5, r5, #1 -_022E7D8C: - cmp r5, #0x10 - blt _022E7D60 -_022E7D94: - mov r0, #0 - ldmia sp!, {r4, r5, r6, pc} - .align 2, 0 -_022E7D9C: .word DUNGEON_PTR - arm_func_end IsOnMonsterSpawnList diff --git a/include/dungeon_mode.h b/include/dungeon_mode.h index 963aa0f7..2dd65c2f 100644 --- a/include/dungeon_mode.h +++ b/include/dungeon_mode.h @@ -905,8 +905,8 @@ struct floor_properties { // 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 + s16 enemy_iq; // 0x1C: IQ stat of enemies + s16 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 diff --git a/include/spawn.h b/include/spawn.h index 64c11a13..bcf3ee28 100644 --- a/include/spawn.h +++ b/include/spawn.h @@ -5,5 +5,6 @@ // Returns a monster ID. s32 GetMonsterIdToSpawn(s32 weight_type_idx); s32 GetMonsterLevelToSpawn(s32 monster_id); +s32 IsOnMonsterSpawnList(s32 monster_id); #endif //PMDSKY_SPAWN_H diff --git a/src/spawn.c b/src/spawn.c index a0ba8ba2..fa293a17 100644 --- a/src/spawn.c +++ b/src/spawn.c @@ -6,6 +6,22 @@ extern s32 GetMonsterIdFromSpawnEntry(struct monster_spawn_entry *); extern s32 GetMonsterLevelFromSpawnEntry(struct monster_spawn_entry *); +s32 IsOnMonsterSpawnList(s32 monster_id) { + for(s32 i = 0; i < 16; i++) { + s32 entity_monster_id = GetMonsterIdFromSpawnEntry( + &DUNGEON_PTR[0]->spawn_entries_master[i]); + + if(entity_monster_id == 0) { + break; + } + + if(entity_monster_id == monster_id) { + return TRUE; + } + } + return FALSE; +} + s32 GetMonsterIdToSpawn(s32 weight_type_idx) { s32 rand = DungeonRandInt(10000);