mirror of
https://github.com/pret/pokeheartgold.git
synced 2025-02-26 08:09:06 +00:00
decompile unk_020932A4
Functions: PhoneBookTrainerGetRematchInfo Had to modify TryGetRematchTrainerIdByBaseTrainerId's return type
This commit is contained in:
parent
b095fa8ad7
commit
e9df42e3a0
@ -1,43 +0,0 @@
|
||||
#include "constants/easy_chat.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/maps.h"
|
||||
#include "constants/moves.h"
|
||||
#include "constants/species.h"
|
||||
.include "asm/macros.inc"
|
||||
.include "unk_020932A4.inc"
|
||||
.include "global.inc"
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start PhoneBookTrainerGetRematchInfo
|
||||
PhoneBookTrainerGetRematchInfo: ; 0x020932A4
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
add r4, r1, #0
|
||||
add r5, r0, #0
|
||||
add r0, r4, #0
|
||||
add r6, r2, #0
|
||||
add r7, r3, #0
|
||||
bl SaveData_GetMomsSavingsAddr
|
||||
add r1, r5, #0
|
||||
bl PhoneRematches_IsSeeking
|
||||
cmp r0, #0
|
||||
bne _020932C2
|
||||
mov r0, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_020932C2:
|
||||
cmp r5, #0x10
|
||||
bne _020932CE
|
||||
cmp r7, #1
|
||||
beq _020932CE
|
||||
mov r0, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
_020932CE:
|
||||
mov r1, #0x14
|
||||
ldr r2, [r6, #4]
|
||||
mul r1, r5
|
||||
add r1, r2, r1
|
||||
ldrh r1, [r1, #4]
|
||||
add r0, r4, #0
|
||||
bl TryGetRematchTrainerIdByBaseTrainerId
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
thumb_func_end PhoneBookTrainerGetRematchInfo
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "script.h"
|
||||
|
||||
u32 TryGetRematchTrainerIdByBaseTrainerId(SAVEDATA* savedata, u16 trainer_no);
|
||||
u16 TryGetRematchTrainerIdByBaseTrainerId(SAVEDATA* savedata, u16 trainer_no);
|
||||
void ov26_022599D8(FieldSystem *fsys, LocalMapObject *lastTalked);
|
||||
|
||||
#endif //POKEHEARTGOLD_OVERLAY_26_H
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include "heap.h"
|
||||
|
||||
struct PhoneBookEntry;
|
||||
|
||||
struct PhoneBook *AllocAndReadPhoneBook(HeapID heapId);
|
||||
void FreePhoneBook(struct PhoneBook *phoneBook);
|
||||
u8 LoadPhoneBookEntryI(u16 idx, struct PhoneBookEntry *dest, HeapID heapId);
|
||||
|
2
main.lsf
2
main.lsf
@ -305,7 +305,7 @@ Static main
|
||||
Object asm/unk_02092BB8.o
|
||||
Object src/unk_02092BE8.o
|
||||
Object asm/unk_020931C4.o
|
||||
Object asm/unk_020932A4.o
|
||||
Object src/unk_020932A4.o
|
||||
Object asm/unk_020932E0.o
|
||||
Object asm/unk_020957B0.o
|
||||
Object asm/unk_02095DF4.o
|
||||
|
@ -75,7 +75,7 @@ static const u16 sTrainerRematchSets[][6] = {
|
||||
{ TRAINER_LEADER_BLUE_BLUE, TRAINER_LEADER_BLUE_BLUE, TRAINER_LEADER_BLUE_BLUE_2, TRAINER_NONE, TRAINER_NONE, TRAINER_NONE },
|
||||
};
|
||||
|
||||
u32 TryGetRematchTrainerIdByBaseTrainerId(SAVEDATA* savedata, u16 trainer_id) {
|
||||
u16 TryGetRematchTrainerIdByBaseTrainerId(SAVEDATA* savedata, u16 trainer_id) {
|
||||
u16 rematch_set_no = GetRematchIdByBaseTrainerId(trainer_id);
|
||||
if (rematch_set_no == 0xFF) {
|
||||
return 0;
|
||||
|
24
src/unk_020932A4.c
Normal file
24
src/unk_020932A4.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include "global.h"
|
||||
#include "unk_020932A4.h"
|
||||
#include "save_pokegear.h"
|
||||
#include "gear_phone.h"
|
||||
#include "overlay_26.h"
|
||||
|
||||
THUMB_FUNC u16 PhoneBookTrainerGetRematchInfo(u8 a0, SAVEDATA* saveData, struct PhoneBook* phoneBook, u8 timeOfDay) {
|
||||
MomsSavings* ms = SaveData_GetMomsSavingsAddr(saveData);
|
||||
BOOL b = PhoneRematches_IsSeeking(ms, a0);
|
||||
|
||||
if(!b)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if(a0 == 0x10 && timeOfDay != 1)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
struct PhoneBookEntry* entries = phoneBook->entries;
|
||||
u16 trainerId = entries[a0].trainerId;
|
||||
|
||||
return TryGetRematchTrainerIdByBaseTrainerId(saveData, trainerId);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user