mirror of
https://github.com/pret/pokeheartgold.git
synced 2026-06-02 21:54:45 -05:00
through sub_0206A860
This commit is contained in:
parent
11b14c467f
commit
ea2d7b49ee
|
|
@ -12,142 +12,6 @@
|
|||
|
||||
.text
|
||||
|
||||
thumb_func_start FieldSystem_TakePhoto
|
||||
FieldSystem_TakePhoto: ; 0x0206A798
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
sub sp, #0x28
|
||||
add r5, r0, #0
|
||||
add r6, r1, #0
|
||||
mov r0, #0xb
|
||||
mov r1, #0xdc
|
||||
bl AllocFromHeapAtEnd
|
||||
mov r1, #0
|
||||
mov r2, #0xdc
|
||||
add r4, r0, #0
|
||||
bl MI_CpuFill8
|
||||
mov r0, #0
|
||||
strb r0, [r4, #0x14]
|
||||
strb r0, [r4, #0x15]
|
||||
strb r0, [r4, #0x17]
|
||||
ldr r0, [r5, #0x40]
|
||||
bl GetPlayerXCoord
|
||||
strh r0, [r4, #0x30]
|
||||
ldr r0, [r5, #0x40]
|
||||
bl GetPlayerYCoord
|
||||
strh r0, [r4, #0x32]
|
||||
ldr r0, [r5, #0x40]
|
||||
bl PlayerAvatar_GetFacingDirection
|
||||
strh r0, [r4, #0x34]
|
||||
ldr r0, [r5, #0x20]
|
||||
ldr r0, [r0]
|
||||
strh r0, [r4, #0x36]
|
||||
add r0, r5, #0
|
||||
bl FollowMon_IsActive
|
||||
cmp r0, #0
|
||||
beq _0206A7FE
|
||||
add r0, r5, #0
|
||||
bl FollowMon_GetMapObject
|
||||
add r1, r4, #0
|
||||
add r7, r0, #0
|
||||
add r1, #0xcc
|
||||
bl MapObject_GetPositionVec
|
||||
add r0, r7, #0
|
||||
bl MapObject_GetFacingDirection
|
||||
add r1, r4, #0
|
||||
add r1, #0xd8
|
||||
strb r0, [r1]
|
||||
_0206A7FE:
|
||||
add r0, r5, #0
|
||||
bl FieldSystem_GetSaveData
|
||||
bl Save_PhotoAlbum_Get
|
||||
bl PhotoAlbum_GetIndexOfFirstEmptySlot
|
||||
cmp r0, #0xff
|
||||
beq _0206A858
|
||||
mov r1, #1 // (a/2/5/4) >> 8
|
||||
add r0, sp, #0x18
|
||||
lsl r1, r1, #8
|
||||
add r2, r6, #0
|
||||
bl ReadWholeNarcMemberByIdPair
|
||||
add r3, sp, #0x18
|
||||
ldrh r0, [r3, #4]
|
||||
add r1, r5, #0
|
||||
str r0, [sp]
|
||||
ldrh r0, [r3, #6]
|
||||
str r0, [sp, #4]
|
||||
ldrh r0, [r3, #0xc]
|
||||
str r0, [sp, #8]
|
||||
ldrh r0, [r3, #0xe]
|
||||
str r0, [sp, #0xc]
|
||||
ldrb r0, [r3, #9]
|
||||
str r0, [sp, #0x10]
|
||||
ldrh r0, [r3, #0xa]
|
||||
str r0, [sp, #0x14]
|
||||
ldrh r2, [r3, #2]
|
||||
add r0, r4, #0
|
||||
ldrh r3, [r3]
|
||||
lsl r2, r2, #0x18
|
||||
add r0, #0x44
|
||||
lsr r2, r2, #0x18
|
||||
bl sub_0206B014
|
||||
add r0, r4, #0
|
||||
add r0, #0x44
|
||||
str r0, [r4, #0x40]
|
||||
ldr r0, [r5, #0x10]
|
||||
ldr r1, _0206A85C ; =sub_0206B270
|
||||
add r2, r4, #0
|
||||
bl TaskManager_Call
|
||||
_0206A858:
|
||||
add sp, #0x28
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
.balign 4, 0
|
||||
_0206A85C: .word sub_0206B270
|
||||
thumb_func_end FieldSystem_TakePhoto
|
||||
|
||||
thumb_func_start sub_0206A860
|
||||
sub_0206A860: ; 0x0206A860
|
||||
push {r3, r4, r5, lr}
|
||||
add r5, r0, #0
|
||||
mov r0, #0xb
|
||||
mov r1, #0xbc
|
||||
bl AllocFromHeapAtEnd
|
||||
mov r1, #0
|
||||
mov r2, #0xbc
|
||||
add r4, r0, #0
|
||||
bl MI_CpuFill8
|
||||
ldr r0, [r5, #0x40]
|
||||
bl GetPlayerXCoord
|
||||
add r1, r4, #0
|
||||
add r1, #0x94
|
||||
strh r0, [r1]
|
||||
ldr r0, [r5, #0x40]
|
||||
bl GetPlayerYCoord
|
||||
add r1, r4, #0
|
||||
add r1, #0x96
|
||||
strh r0, [r1]
|
||||
ldr r0, [r5, #0x40]
|
||||
bl PlayerAvatar_GetFacingDirection
|
||||
add r1, r4, #0
|
||||
add r1, #0x98
|
||||
strh r0, [r1]
|
||||
ldr r0, [r5, #0x20]
|
||||
ldr r1, [r0]
|
||||
add r0, r4, #0
|
||||
add r0, #0x9a
|
||||
strh r1, [r0]
|
||||
ldr r0, [r5, #0xc]
|
||||
bl Save_PhotoAlbum_Get
|
||||
add r1, r4, #0
|
||||
add r1, #0xb8
|
||||
str r0, [r1]
|
||||
ldr r0, [r5, #0x10]
|
||||
ldr r1, _0206A8BC ; =sub_0206A8E4
|
||||
add r2, r4, #0
|
||||
bl TaskManager_Call
|
||||
pop {r3, r4, r5, pc}
|
||||
.balign 4, 0
|
||||
_0206A8BC: .word sub_0206A8E4
|
||||
thumb_func_end sub_0206A860
|
||||
|
||||
thumb_func_start sub_0206A8C0
|
||||
sub_0206A8C0: ; 0x0206A8C0
|
||||
push {r4, lr}
|
||||
|
|
@ -2,6 +2,51 @@
|
|||
#define POKEHEARTGOLD_FIELD_TAKE_PHOTO_H
|
||||
|
||||
#include "script.h"
|
||||
#include "photo_album.h"
|
||||
|
||||
typedef struct PhotoArcData {
|
||||
u16 unk_0;
|
||||
u16 unk_2;
|
||||
u16 unk_4;
|
||||
u16 unk_6;
|
||||
u8 unk_8;
|
||||
u8 unk_9;
|
||||
u16 unk_A;
|
||||
u16 unk_C;
|
||||
u16 unk_E;
|
||||
} PhotoArcData;
|
||||
|
||||
typedef struct FieldTakePhoto_Sub44 {
|
||||
u8 filler_00[0x88];
|
||||
} FieldTakePhoto_Sub44;
|
||||
|
||||
typedef struct FieldTakePhoto {
|
||||
u8 filler_00[0x14];
|
||||
u8 unk_14;
|
||||
u8 unk_15;
|
||||
u8 unk_16;
|
||||
u8 unk_17;
|
||||
u8 filler_18[0x18];
|
||||
u16 unk_30;
|
||||
u16 unk_32;
|
||||
u16 unk_34;
|
||||
u16 unk_36;
|
||||
u8 filler_38[0x8];
|
||||
FieldTakePhoto_Sub44 *unk_40;
|
||||
FieldTakePhoto_Sub44 unk_44;
|
||||
VecFx32 unk_CC;
|
||||
u8 unk_D8;
|
||||
} FieldTakePhoto;
|
||||
|
||||
typedef struct FieldTakePhoto2 {
|
||||
u8 filler_00[0x94];
|
||||
u16 unk_94;
|
||||
u16 unk_96;
|
||||
u16 unk_98;
|
||||
u16 unk_9A;
|
||||
u8 filler_9C[0x1C];
|
||||
PHOTO_ALBUM *unk_B8;
|
||||
} FieldTakePhoto2;
|
||||
|
||||
void FieldSystem_TakePhoto(FieldSystem *fieldSystem, u16 photo_id);
|
||||
void sub_0206A860(FieldSystem *fieldSystem);
|
||||
|
|
|
|||
3
main.lsf
3
main.lsf
|
|
@ -247,7 +247,8 @@ Static main
|
|||
Object asm/unk_0206979C.o
|
||||
Object src/follow_mon.o
|
||||
Object src/map_preview_graphic.o
|
||||
Object asm/field_take_photo.o
|
||||
Object src/field_take_photo.o
|
||||
Object asm/field_take_photo_s.o
|
||||
Object src/unk_0206B910.o
|
||||
Object src/alph_checks.o
|
||||
Object src/get_egg.o
|
||||
|
|
|
|||
44
src/field_take_photo.c
Normal file
44
src/field_take_photo.c
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#include "global.h"
|
||||
#include "field_take_photo.h"
|
||||
#include "follow_mon.h"
|
||||
#include "photo_album.h"
|
||||
#include "task.h"
|
||||
|
||||
BOOL sub_0206A8E4(TaskManager *taskManager);
|
||||
void sub_0206B014(FieldTakePhoto_Sub44 *photo, FieldSystem *fieldSystem, u8 a2, u16 a3, u16 a4, u16 a5, u16 a6, u16 a7, u8 a8, u16 a9);
|
||||
BOOL sub_0206B270(TaskManager *taskManager);
|
||||
|
||||
void FieldSystem_TakePhoto(FieldSystem *fieldSystem, u16 photo_id) {
|
||||
FieldTakePhoto *photo = AllocFromHeapAtEnd(HEAP_ID_FIELD, sizeof(FieldTakePhoto));
|
||||
MI_CpuFill8(photo, 0, sizeof(FieldTakePhoto));
|
||||
photo->unk_14 = 0;
|
||||
photo->unk_15 = 0;
|
||||
photo->unk_17 = 0;
|
||||
photo->unk_30 = GetPlayerXCoord(fieldSystem->playerAvatar);
|
||||
photo->unk_32 = GetPlayerYCoord(fieldSystem->playerAvatar);
|
||||
photo->unk_34 = PlayerAvatar_GetFacingDirection(fieldSystem->playerAvatar);
|
||||
photo->unk_36 = fieldSystem->location->mapId;
|
||||
if (FollowMon_IsActive(fieldSystem)) {
|
||||
LocalMapObject *followMonObj = FollowMon_GetMapObject(fieldSystem);
|
||||
MapObject_GetPositionVec(followMonObj, &photo->unk_CC);
|
||||
photo->unk_D8 = MapObject_GetFacingDirection(followMonObj);
|
||||
}
|
||||
if (PhotoAlbum_GetIndexOfFirstEmptySlot(Save_PhotoAlbum_Get(FieldSystem_GetSaveData(fieldSystem))) != 0xFF) {
|
||||
PhotoArcData sp18;
|
||||
ReadWholeNarcMemberByIdPair(&sp18, NARC_a_2_5_4, photo_id);
|
||||
sub_0206B014(&photo->unk_44, fieldSystem, sp18.unk_2, sp18.unk_0, sp18.unk_4, sp18.unk_6, sp18.unk_C, sp18.unk_E, sp18.unk_9, sp18.unk_A);
|
||||
photo->unk_40 = &photo->unk_44;
|
||||
TaskManager_Call(fieldSystem->taskman, sub_0206B270, photo);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0206A860(FieldSystem *fieldSystem) {
|
||||
FieldTakePhoto2 *photo = AllocFromHeapAtEnd(HEAP_ID_FIELD, sizeof(FieldTakePhoto2));
|
||||
MI_CpuFill8(photo, 0, sizeof(FieldTakePhoto2));
|
||||
photo->unk_94 = GetPlayerXCoord(fieldSystem->playerAvatar);
|
||||
photo->unk_96 = GetPlayerYCoord(fieldSystem->playerAvatar);
|
||||
photo->unk_98 = PlayerAvatar_GetFacingDirection(fieldSystem->playerAvatar);
|
||||
photo->unk_9A = fieldSystem->location->mapId;
|
||||
photo->unk_B8 = Save_PhotoAlbum_Get(fieldSystem->saveData);
|
||||
TaskManager_Call(fieldSystem->taskman, sub_0206A8E4, photo);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user