mirror of
https://github.com/pret/pmd-sky.git
synced 2026-03-21 17:25:15 -05:00
Decomped GetTreatmentBetweenMonstersIgnoreStatus
This commit is contained in:
parent
0323ac4109
commit
70cc523b7b
|
|
@ -1,6 +1,5 @@
|
|||
#pragma once
|
||||
.public DefenderAbilityIsActive__02301A0C
|
||||
.public GetApparentWeather
|
||||
.public IsExperienceLocked
|
||||
.public LogMessageByIdWithPopupCheckUserTarget
|
||||
.public SubstitutePlaceholderStringTags
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
.public ov29_022E4E74
|
||||
.public ov29_022E4F1C
|
||||
.public ov29_022E53EC
|
||||
.public ov29_023018AC
|
||||
.public GetTreatmentBetweenMonstersIgnoreStatus
|
||||
.public ov29_02304A48
|
||||
.public ov29_02304A84
|
||||
.public SafeguardIsActive
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
.public ov29_022E51B0
|
||||
.public ov29_022E5258
|
||||
.public ov29_022E52F8
|
||||
.public ov29_023018AC
|
||||
.public GetTreatmentBetweenMonstersIgnoreStatus
|
||||
.public PlayExclamationPointEffect__022E5D4C
|
||||
.public PrepareItemForPrinting__02345728
|
||||
.public SafeguardIsActive
|
||||
|
|
|
|||
|
|
@ -1,56 +1,8 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "overlay_29_023018AC.inc"
|
||||
.include "overlay_29_02301940.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start ov29_023018AC
|
||||
ov29_023018AC: ; 0x023018AC
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
ldr r4, [r0, #0xb4]
|
||||
ldr r5, [r1, #0xb4]
|
||||
ldrb r0, [r4, #0xbc]
|
||||
cmp r0, #7
|
||||
moveq r0, #2
|
||||
ldmeqia sp!, {r3, r4, r5, pc}
|
||||
mov r0, r4
|
||||
bl IsExperienceLocked
|
||||
cmp r0, #0
|
||||
movne r0, #2
|
||||
ldmneia sp!, {r3, r4, r5, pc}
|
||||
ldrb r0, [r4, #9]
|
||||
cmp r0, #0
|
||||
#ifndef JAPAN
|
||||
cmpne r0, #3
|
||||
#endif
|
||||
movne r0, #2
|
||||
ldmneia sp!, {r3, r4, r5, pc}
|
||||
ldrb r0, [r5, #0xbc]
|
||||
cmp r0, #7
|
||||
moveq r0, #2
|
||||
ldmeqia sp!, {r3, r4, r5, pc}
|
||||
mov r0, r5
|
||||
bl IsExperienceLocked
|
||||
cmp r0, #0
|
||||
movne r0, #2
|
||||
ldmneia sp!, {r3, r4, r5, pc}
|
||||
ldrb r0, [r5, #9]
|
||||
cmp r0, #0
|
||||
#ifndef JAPAN
|
||||
cmpne r0, #3
|
||||
#endif
|
||||
movne r0, #2
|
||||
ldmneia sp!, {r3, r4, r5, pc}
|
||||
ldrb r1, [r4, #6]
|
||||
ldrb r0, [r5, #6]
|
||||
cmp r1, r0
|
||||
movne r0, #1
|
||||
moveq r0, #0
|
||||
#ifdef JAPAN
|
||||
and r0, r0, #0xff
|
||||
#endif
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end ov29_023018AC
|
||||
|
||||
arm_func_start SafeguardIsActive
|
||||
SafeguardIsActive: ; 0x02301940
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
|
|
@ -749,7 +749,7 @@ _02312534:
|
|||
_023125AC:
|
||||
mov r0, sb
|
||||
mov r1, r6
|
||||
bl ov29_023018AC
|
||||
bl GetTreatmentBetweenMonstersIgnoreStatus
|
||||
cmp r0, #1
|
||||
bne _023125DC
|
||||
mov r2, #0
|
||||
|
|
@ -995,7 +995,7 @@ _02312868:
|
|||
_023128E0:
|
||||
mov r0, sb
|
||||
mov r1, r6
|
||||
bl ov29_023018AC
|
||||
bl GetTreatmentBetweenMonstersIgnoreStatus
|
||||
cmp r0, #1
|
||||
bne _02312908
|
||||
mov r0, sl
|
||||
|
|
@ -1195,7 +1195,7 @@ _02312B24:
|
|||
_02312B9C:
|
||||
mov r0, sb
|
||||
mov r1, r6
|
||||
bl ov29_023018AC
|
||||
bl GetTreatmentBetweenMonstersIgnoreStatus
|
||||
cmp r0, #1
|
||||
bne _02312BC4
|
||||
mov r0, sl
|
||||
|
|
|
|||
|
|
@ -803,7 +803,7 @@ _02314718:
|
|||
_02314790:
|
||||
mov r0, sb
|
||||
mov r1, r6
|
||||
bl ov29_023018AC
|
||||
bl GetTreatmentBetweenMonstersIgnoreStatus
|
||||
cmp r0, #1
|
||||
bne _023147B8
|
||||
mov r0, sl
|
||||
|
|
|
|||
9
include/overlay_29_023018AC.h
Normal file
9
include/overlay_29_023018AC.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef PMDSKY_OVERLAY_29_023018AC_H
|
||||
#define PMDSKY_OVERLAY_29_023018AC_H
|
||||
|
||||
#include "dungeon_mode.h"
|
||||
#include "targeting.h"
|
||||
|
||||
enum monster_treatment GetTreatmentBetweenMonstersIgnoreStatus(struct entity *entity1, struct entity *entity2);
|
||||
|
||||
#endif //PMDSKY_OVERLAY_29_023018AC_H
|
||||
3
main.lsf
3
main.lsf
|
|
@ -466,7 +466,8 @@ Overlay OVY_29
|
|||
Object asm/overlay_29_023016D8.o
|
||||
Object src/dungeon_ai_targeting_1.o
|
||||
Object asm/overlay_29_rodata_023527C0.o
|
||||
Object asm/overlay_29_023018AC.o
|
||||
Object src/overlay_29_023018AC.o
|
||||
Object asm/overlay_29_02301940.o
|
||||
Object src/overlay_29_02301A60.o
|
||||
Object asm/overlay_29_02301A84.o
|
||||
Object src/dungeon_pokemon_attributes.o
|
||||
|
|
|
|||
|
|
@ -3,22 +3,26 @@
|
|||
#include "dungeon_map_access.h"
|
||||
#include "math.h"
|
||||
#include "overlay_29_022F7364.h"
|
||||
#include "overlay_29_023018AC.h"
|
||||
#include "overlay_29_02336428.h"
|
||||
|
||||
extern s32 GetChebyshevDistance(struct position *position_a, struct position *position_b);
|
||||
extern s32 ov29_023018AC(struct entity*, struct entity*);
|
||||
|
||||
bool8 ShouldMonsterHeadToStairs(struct entity *entity)
|
||||
{
|
||||
u8 stairs_room = GetStairsRoom();
|
||||
if (stairs_room == GetTile(entity->pos.x, entity->pos.y)->room) {
|
||||
if (stairs_room == GetTile(entity->pos.x, entity->pos.y)->room)
|
||||
{
|
||||
s32 stairs_distance = GetChebyshevDistance(&entity->pos, &DUNGEON_PTR[0]->gen_info.stairs_pos);
|
||||
s32 min_stairs_distance = INFINITY_3;
|
||||
|
||||
for (s32 i = 0; i < DUNGEON_MAX_POKEMON; i++)
|
||||
{
|
||||
struct entity *other_monster = DUNGEON_PTR[0]->active_monster_ptrs[i];
|
||||
if (EntityIsValid__022F7364(other_monster) && ov29_023018AC(entity, other_monster) == 1 && stairs_room == GetTile(other_monster->pos.x, other_monster->pos.y)->room) {
|
||||
if (EntityIsValid__022F7364(other_monster) &&
|
||||
GetTreatmentBetweenMonstersIgnoreStatus(entity, other_monster) == TREATMENT_TREAT_AS_ENEMY &&
|
||||
stairs_room == GetTile(other_monster->pos.x, other_monster->pos.y)->room)
|
||||
{
|
||||
s32 other_stairs_distance = GetChebyshevDistance(&other_monster->pos, &DUNGEON_PTR[0]->gen_info.stairs_pos);
|
||||
if (other_stairs_distance < min_stairs_distance)
|
||||
min_stairs_distance = other_stairs_distance;
|
||||
|
|
|
|||
42
src/overlay_29_023018AC.c
Normal file
42
src/overlay_29_023018AC.c
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#include "overlay_29_023018AC.h"
|
||||
#include "dungeon_util_static.h"
|
||||
#include "joined_at_checks.h"
|
||||
|
||||
enum monster_treatment GetTreatmentBetweenMonstersIgnoreStatus(struct entity *entity1, struct entity *entity2)
|
||||
{
|
||||
struct monster* monster1 = GetEntInfo(entity1);
|
||||
struct monster* monster2 = GetEntInfo(entity2);
|
||||
if (monster1->monster_behavior == BEHAVIOR_RESCUE_TARGET)
|
||||
return TREATMENT_IGNORE;
|
||||
|
||||
if (IsExperienceLocked(monster1))
|
||||
return TREATMENT_IGNORE;
|
||||
|
||||
#ifdef JAPAN
|
||||
if (monster1->shopkeeper != SHOPKEEPER_MODE_NORMAL)
|
||||
#else
|
||||
if (monster1->shopkeeper != SHOPKEEPER_MODE_NORMAL && monster1->shopkeeper != SHOPKEEPER_MODE_ATTACK_TEAM)
|
||||
#endif
|
||||
return TREATMENT_IGNORE;
|
||||
|
||||
if (monster2->monster_behavior == BEHAVIOR_RESCUE_TARGET)
|
||||
return TREATMENT_IGNORE;
|
||||
|
||||
if (IsExperienceLocked(monster2))
|
||||
return TREATMENT_IGNORE;
|
||||
|
||||
#ifdef JAPAN
|
||||
if (monster2->shopkeeper != SHOPKEEPER_MODE_NORMAL)
|
||||
#else
|
||||
if (monster2->shopkeeper != SHOPKEEPER_MODE_NORMAL && monster2->shopkeeper != SHOPKEEPER_MODE_ATTACK_TEAM)
|
||||
#endif
|
||||
return TREATMENT_IGNORE;
|
||||
|
||||
#ifdef JAPAN
|
||||
return (enum monster_treatment) (monster1->is_not_team_member != monster2->is_not_team_member);
|
||||
#else
|
||||
if (monster1->is_not_team_member != monster2->is_not_team_member)
|
||||
return TREATMENT_TREAT_AS_ENEMY;
|
||||
return TREATMENT_TREAT_AS_ALLY;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -281,6 +281,8 @@ def sync_xmap_symbol(address: int, symbol: SymbolDetails, language: str, section
|
|||
symbol_header = symbol_header.replace('s32', 'int')
|
||||
symbol_header = symbol_header.replace('s16', 'int16_t')
|
||||
symbol_header = symbol_header.replace('s8', 'int8_t')
|
||||
symbol_header = symbol_header.replace('bool8', 'bool')
|
||||
symbol_header = symbol_header.replace(' *', '* ')
|
||||
else:
|
||||
symbol_header = f'void {base_symbol_name}(void);\n'
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user