Through ScrCmd_679

This commit is contained in:
PikalaxALT 2022-04-06 20:50:13 -04:00
parent 8518b6b756
commit 3d4d0237a1
12 changed files with 124 additions and 301 deletions

View File

@ -320,8 +320,8 @@ CreateSpecialFieldObjectEx: ; 0x0205E2B4
pop {r3, r4, r5, r6, r7, pc}
thumb_func_end CreateSpecialFieldObjectEx
thumb_func_start sub_0205E34C
sub_0205E34C: ; 0x0205E34C
thumb_func_start CreateMapObjectFromTemplate
CreateMapObjectFromTemplate: ; 0x0205E34C
push {r3, r4, r5, r6, r7, lr}
add r5, r0, #0
add r0, r1, #0
@ -350,7 +350,7 @@ sub_0205E34C: ; 0x0205E34C
_0205E388:
add r0, r6, #0
pop {r3, r4, r5, r6, r7, pc}
thumb_func_end sub_0205E34C
thumb_func_end CreateMapObjectFromTemplate
thumb_func_start sub_0205E38C
sub_0205E38C: ; 0x0205E38C

View File

@ -519,7 +519,7 @@ ov01_022074A8: ; 0x022074A8
.short SPRITE_LADDERHERO, MMODEL_LADDERHERO, 0x120 | (12 << 10)
.short SPRITE_LADDERHEROINE, MMODEL_LADDERHEROINE, 0x120 | (12 << 10)
.short SPRITE_DELIVERY, MMODEL_DELIVERY, 0x000 | (0 << 10)
.short SPRITE_BABYBOY1_14, MMODEL_BABYBOY1, 0x003 | (63 << 10)
.short SPRITE_CAMERA_FOCUS, MMODEL_BABYBOY1, 0x003 | (63 << 10)
.short SPRITE_POKEHERO, MMODEL_POKEHERO, 0x160 | (15 << 10)
.short SPRITE_POKEHEROINE, MMODEL_POKEHEROINE, 0x160 | (15 << 10)
.short SPRITE_SAVEHERO, MMODEL_SAVEHERO, 0x0A0 | (16 << 10)

View File

@ -912,294 +912,6 @@ _021D4168:
.public sub_020418B4
.public _WaitMovementPauseBeforeMsg
thumb_func_start ScrCmd_ReleaseAll
ScrCmd_ReleaseAll: ; 0x02041F50
push {r3, lr}
add r0, #0x80
ldr r0, [r0]
ldr r0, [r0, #0x3c]
bl MapObjectMan_UnpauseAllMovement
mov r0, #1
pop {r3, pc}
thumb_func_end ScrCmd_ReleaseAll
thumb_func_start ScrCmd_098
ScrCmd_098: ; 0x02041F60
push {r3, r4, r5, lr}
add r1, r0, #0
add r1, #0x80
ldr r5, [r1]
bl ScriptReadHalfword
add r4, r0, #0
ldr r0, [r5, #0x3c]
add r1, r4, #0
bl GetMapObjectByID
cmp r0, #0
beq _02041F80
bl MapObject_PauseMovement
b _02041F88
_02041F80:
cmp r4, #0xfd
beq _02041F88
bl GF_AssertFail
_02041F88:
mov r0, #0
pop {r3, r4, r5, pc}
thumb_func_end ScrCmd_098
thumb_func_start ScrCmd_099
ScrCmd_099: ; 0x02041F8C
push {r3, r4, r5, lr}
add r1, r0, #0
add r1, #0x80
ldr r5, [r1]
bl ScriptReadHalfword
add r4, r0, #0
ldr r0, [r5, #0x3c]
add r1, r4, #0
bl GetMapObjectByID
cmp r0, #0
beq _02041FAC
bl MapObject_UnpauseMovement
b _02041FB4
_02041FAC:
cmp r4, #0xfd
beq _02041FB4
bl GF_AssertFail
_02041FB4:
mov r0, #0
pop {r3, r4, r5, pc}
thumb_func_end ScrCmd_099
thumb_func_start ScrCmd_ShowPerson
ScrCmd_ShowPerson: ; 0x02041FB8
push {r3, r4, r5, r6, lr}
sub sp, #4
add r4, r0, #0
add r1, r4, #0
add r1, #0x80
ldr r5, [r1]
bl ScriptReadHalfword
add r4, #0x80
add r1, r0, #0
ldr r0, [r4]
bl VarGet
add r4, r0, #0
add r0, r5, #0
bl Field_GetNumObjectEvents
add r6, r0, #0
add r0, r5, #0
bl Field_GetObjectEvents
str r0, [sp]
ldr r3, [r5, #0x20]
ldr r0, [r5, #0x3c]
ldr r3, [r3]
add r1, r4, #0
add r2, r6, #0
bl sub_0205E34C
cmp r0, #0
bne _02041FFA
bl GF_AssertFail
_02041FFA:
mov r0, #0
add sp, #4
pop {r3, r4, r5, r6, pc}
thumb_func_end ScrCmd_ShowPerson
thumb_func_start ScrCmd_HidePerson
ScrCmd_HidePerson: ; 0x02042000
push {r3, r4, r5, lr}
add r4, r0, #0
add r1, r4, #0
add r1, #0x80
ldr r5, [r1]
bl ScriptReadHalfword
add r4, #0x80
add r1, r0, #0
ldr r0, [r4]
bl VarGet
add r1, r0, #0
ldr r0, [r5, #0x3c]
bl GetMapObjectByID
cmp r0, #0
bne _0204202A
bl GF_AssertFail
b _0204202E
_0204202A:
bl DeleteMapObject
_0204202E:
mov r0, #0
pop {r3, r4, r5, pc}
.balign 4, 0
thumb_func_end ScrCmd_HidePerson
thumb_func_start ScrCmd_102
ScrCmd_102: ; 0x02042034
push {r4, r5, r6, r7, lr}
sub sp, #0xc
add r5, r0, #0
bl ScriptReadHalfword
add r1, r0, #0
add r0, r5, #0
add r0, #0x80
ldr r0, [r0]
bl VarGet
add r6, r0, #0
add r0, r5, #0
bl ScriptReadHalfword
add r1, r0, #0
add r0, r5, #0
add r0, #0x80
ldr r0, [r0]
bl VarGet
add r7, r0, #0
add r0, r5, #0
add r0, #0x80
ldr r0, [r0]
mov r1, #0xb
bl FieldSysGetAttrAddr
add r4, r0, #0
add r0, r5, #0
add r0, #0x80
mov r1, #2
ldr r0, [r0]
lsl r1, r1, #0xc
str r1, [sp]
mov r3, #0
str r3, [sp, #4]
ldr r1, [r0, #0x20]
add r2, r7, #0
ldr r1, [r1]
str r1, [sp, #8]
ldr r0, [r0, #0x3c]
add r1, r6, #0
bl CreateSpecialFieldObject
str r0, [r4]
bl sub_02061070
ldr r0, [r4]
mov r1, #1
bl sub_0205F690
ldr r0, [r4]
mov r1, #0
bl sub_0205F6AC
ldr r0, [r4]
bl MapObject_GetPositionVecPtr
add r1, r5, #0
add r1, #0x80
ldr r1, [r1]
add r4, r0, #0
ldr r1, [r1, #0x2c]
bl ov01_021F62E8
add r5, #0x80
ldr r1, [r5]
add r0, r4, #0
ldr r1, [r1, #0x24]
bl sub_02023214
mov r0, #0
add sp, #0xc
pop {r4, r5, r6, r7, pc}
.balign 4, 0
thumb_func_end ScrCmd_102
thumb_func_start ScrCmd_103
ScrCmd_103: ; 0x020420CC
push {r3, r4, r5, lr}
add r5, r0, #0
add r0, #0x80
ldr r0, [r0]
mov r1, #0xb
bl FieldSysGetAttrAddr
ldr r0, [r0]
bl MapObject_Remove
add r0, r5, #0
add r0, #0x80
ldr r0, [r0]
mov r1, #0xff
ldr r0, [r0, #0x3c]
bl GetMapObjectByID
bl MapObject_GetPositionVecPtr
add r1, r5, #0
add r1, #0x80
ldr r1, [r1]
add r4, r0, #0
ldr r1, [r1, #0x2c]
bl ov01_021F62E8
add r5, #0x80
ldr r1, [r5]
add r0, r4, #0
ldr r1, [r1, #0x24]
bl sub_02023214
mov r0, #0
pop {r3, r4, r5, pc}
thumb_func_end ScrCmd_103
thumb_func_start ScrCmd_678
ScrCmd_678: ; 0x02042110
push {r4, r5, r6, r7, lr}
sub sp, #0xc
add r5, r0, #0
bl ScriptReadHalfword
add r1, r0, #0
add r0, r5, #0
add r0, #0x80
ldr r0, [r0]
bl VarGet
add r6, r0, #0
add r0, r5, #0
bl ScriptReadHalfword
add r1, r0, #0
add r0, r5, #0
add r0, #0x80
ldr r0, [r0]
bl VarGet
add r7, r0, #0
add r0, r5, #0
add r0, #0x80
ldr r0, [r0]
mov r1, #0xb
bl FieldSysGetAttrAddr
mov r1, #2
add r5, #0x80
add r4, r0, #0
ldr r0, [r5]
lsl r1, r1, #0xc
str r1, [sp]
mov r3, #0
str r3, [sp, #4]
ldr r1, [r0, #0x20]
add r2, r7, #0
ldr r1, [r1]
str r1, [sp, #8]
ldr r0, [r0, #0x3c]
add r1, r6, #0
bl CreateSpecialFieldObject
str r0, [r4]
bl sub_02061070
ldr r0, [r4]
mov r1, #1
bl sub_0205F690
ldr r0, [r4]
mov r1, #0
bl sub_0205F6AC
mov r0, #0
add sp, #0xc
pop {r4, r5, r6, r7, pc}
thumb_func_end ScrCmd_678
thumb_func_start ScrCmd_679
ScrCmd_679: ; 0x02042184
push {r3, lr}
add r0, #0x80
ldr r0, [r0]
mov r1, #0xb
bl FieldSysGetAttrAddr
ldr r0, [r0]
bl MapObject_Remove
mov r0, #0
pop {r3, pc}
.balign 4, 0
thumb_func_end ScrCmd_679
thumb_func_start ScrCmd_FacePlayer
ScrCmd_FacePlayer: ; 0x0204219C
push {r4, r5, r6, r7, lr}

View File

@ -29382,7 +29382,7 @@
.public sub_0205E0BC
.public sub_0205E0E8
.public sub_0205E104
.public sub_0205E34C
.public CreateMapObjectFromTemplate
.public sub_0205E38C
.public sub_0205E3AC
.public sub_0205E420

View File

@ -901,7 +901,7 @@
#define SPRITE_TSURE_POKE_STATIC_MEGANIUM 1047
#define SPRITE_TSURE_POKE_STATIC_TYPHLOSION 1048
#define SPRITE_TSURE_POKE_STATIC_FERALIGATR 1049
#define SPRITE_BABYBOY1_14 8192
#define SPRITE_CAMERA_FOCUS 8192
#define SPRITE_VAR_0 100
#define SPRITE_VAR_1 101

View File

@ -103,5 +103,8 @@ void MapObjectMan_UnpauseAllMovement(MapObjectMan *man);
void InitMapObjectsFromEventTemplates(MapObjectMan* man, int mapId, u32 nObjs, OBJECT_EVENT* dest);
int MapObject_GetCurrentX(LocalMapObject *object);
int MapObject_GetCurrentY(LocalMapObject *object);
BOOL CreateMapObjectFromTemplate(MapObjectMan *mapObjectMan, u16 objectId, u32 numObjects, u32 mapId, const OBJECT_EVENT *templates);
VecFx32 *MapObject_GetPositionVecPtr(LocalMapObject *object);
void MapObject_Remove(LocalMapObject *object);
#endif //POKEHEARTGOLD_FIELD_MAP_OBJECT_H

View File

@ -64,5 +64,6 @@ void ov01_021EF018(struct UnkStruct_ov01_021EDC28 *menu, u8 a1);
void ov01_021EF034(struct UnkStruct_ov01_021EDC28 *menu, u8 a1);
void MoveTutorMenu_SetListItem(struct UnkStruct_ov01_021EDC28 *menu, u8 a1, u8 a2, u8 a3);
void ov01_021F7704(LocalMapObject *object);
void ov01_021F62E8(VecFx32 *vec, FsysUnkSub2C *a1);
#endif //POKEHEARTGOLD_OVERLAY_01_H

View File

@ -15,6 +15,7 @@
#include "unk_0200E320.h"
#include "list_menu_2.h"
#include "unk_0200E398.h"
#include "unk_02022D74.h"
#define SCRIPT_MODE_STOPPED 0
#define SCRIPT_MODE_BYTECODE 1
@ -42,6 +43,7 @@ typedef struct EngagedTrainer {
} EngagedTrainer;
typedef struct _NPC_TRADE_WORK NPC_TRADE_WORK;
typedef struct FsysUnkSub2C FsysUnkSub2C;
typedef struct ScriptEnvironment {
u32 check;
@ -58,8 +60,8 @@ typedef struct ScriptEnvironment {
struct ListMenu2 *listMenu;
int facingDirection;
LocalMapObject* lastTalked;
u32 unk_30;
void* unk_34;
u32 cameraFocusObj;
LocalMapObject* unk_34;
SCRIPTCONTEXT* scriptContexts[3];
MSGFMT* msgfmt;
STRING* strbuf1;
@ -89,7 +91,7 @@ enum ScriptEnvField {
SCRIPTENV_SCRIPT = 8,
SCRIPTENV_FACING_DIRECTION = 9,
SCRIPTENV_LAST_TALKED = 10,
SCRIPTENV_30 = 11,
SCRIPTENV_CAMERA_FOCUS_OBJ = 11,
SCRIPTENV_34 = 12,
SCRIPTENV_SCRCTX_0 = 13,
SCRIPTENV_SCRCTX_1 = 14,
@ -237,7 +239,9 @@ struct FieldSystem {
int unk18;
int unk1C;
Location* location;
u8 filler24[0xC];
GF_Camera *camera;
u8 filler28[0x4];
FsysUnkSub2C *unk2C;
MAPMATRIX* map_matrix;
u8 filler34[0x8];
MapObjectMan* mapObjectMan;

View File

@ -28,5 +28,6 @@ VecFx32 *GF_Camera_GetBindTarget(GF_Camera *camera);
void GF_Camera_SetAngle(GF_CameraAngle *angle, GF_Camera *camera);
void GF_Camera_SetPerspectiveAngle(u16 a0, GF_Camera *a1);
void GF_Camera_SetDistance(fx32 a0, GF_Camera *a1);
void sub_02023214(VecFx32 *vec, GF_Camera *a1);
#endif //POKEHEARTGOLD_UNK_02022D74_H

8
include/unk_0205FD20.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef POKEHEARTGOLD_UNK_0205FD20_H
#define POKEHEARTGOLD_UNK_0205FD20_H
#include "field_map_object.h"
void sub_02061070(LocalMapObject *object);
#endif //POKEHEARTGOLD_UNK_0205FD20_H

View File

@ -240,8 +240,8 @@ void *FieldSysGetAttrAddrInternal(ScriptEnvironment *unk, enum ScriptEnvField fi
return &unk->facingDirection;
case SCRIPTENV_LAST_TALKED:
return &unk->lastTalked;
case SCRIPTENV_30:
return &unk->unk_30;
case SCRIPTENV_CAMERA_FOCUS_OBJ:
return &unk->cameraFocusObj;
case SCRIPTENV_34:
return &unk->unk_34;
case SCRIPTENV_SCRCTX_0:

View File

@ -13,6 +13,8 @@
#include "unk_02062108.h"
#include "field_map_object.h"
#include "field_follow_poke.h"
#include "map_events.h"
#include "unk_0205FD20.h"
BOOL sub_020416E4(SCRIPTCONTEXT *ctx);
LocalMapObject *sub_02041C70(FieldSystem *fsys, u16 person);
@ -1094,7 +1096,7 @@ LocalMapObject *sub_02041C70(FieldSystem *fsys, u16 person) {
if (person == 0xF2) {
return sub_0205EEB4(fsys->mapObjectMan, 0x30);
} else if (person == 0xF1) {
LocalMapObject **attr = FieldSysGetAttrAddr(fsys, SCRIPTENV_30);
LocalMapObject **attr = FieldSysGetAttrAddr(fsys, SCRIPTENV_CAMERA_FOCUS_OBJ);
return *attr;
} else {
return GetMapObjectByID(fsys->mapObjectMan, person);
@ -1277,3 +1279,95 @@ BOOL ScrCmd_LockLastTalked(SCRIPTCONTEXT *ctx) {
SetupNativeScript(ctx, _WaitMovementPauseBeforeMsg);
return TRUE;
}
BOOL ScrCmd_ReleaseAll(SCRIPTCONTEXT *ctx) {
MapObjectMan_UnpauseAllMovement(ctx->fsys->mapObjectMan);
return TRUE;
}
BOOL ScrCmd_098(SCRIPTCONTEXT *ctx) {
FieldSystem *fsys = ctx->fsys;
u16 objectId = ScriptReadHalfword(ctx);
LocalMapObject *object = GetMapObjectByID(fsys->mapObjectMan, objectId);
if (object != NULL) {
MapObject_PauseMovement(object);
} else {
GF_ASSERT(objectId == obj_partner_poke);
}
return FALSE;
}
BOOL ScrCmd_099(SCRIPTCONTEXT *ctx) {
FieldSystem *fsys = ctx->fsys;
u16 objectId = ScriptReadHalfword(ctx);
LocalMapObject *object = GetMapObjectByID(fsys->mapObjectMan, objectId);
if (object != NULL) {
MapObject_UnpauseMovement(object);
} else {
GF_ASSERT(objectId == obj_partner_poke);
}
return FALSE;
}
BOOL ScrCmd_ShowPerson(SCRIPTCONTEXT *ctx) {
FieldSystem *fsys = ctx->fsys;
u16 objectId = ScriptGetVar(ctx);
u32 nobjs = Field_GetNumObjectEvents(fsys);
const OBJECT_EVENT *objectEvents = Field_GetObjectEvents(fsys);
GF_ASSERT(CreateMapObjectFromTemplate(fsys->mapObjectMan, objectId, nobjs, fsys->location->mapId, objectEvents));
return FALSE;
}
BOOL ScrCmd_HidePerson(SCRIPTCONTEXT *ctx) {
FieldSystem *fsys = ctx->fsys;
u16 objectId = ScriptGetVar(ctx);
LocalMapObject *object = GetMapObjectByID(fsys->mapObjectMan, objectId);
if (object == NULL) {
GF_ASSERT(0);
} else {
DeleteMapObject(object);
}
return FALSE;
}
BOOL ScrCmd_102(SCRIPTCONTEXT *ctx) {
u16 x = ScriptGetVar(ctx);
u16 y = ScriptGetVar(ctx);
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fsys, SCRIPTENV_CAMERA_FOCUS_OBJ);
VecFx32 *pos;
*p_cameraObj = CreateSpecialFieldObject(ctx->fsys->mapObjectMan, x, y, 0, SPRITE_CAMERA_FOCUS, 0, ctx->fsys->location->mapId);
sub_02061070(*p_cameraObj);
sub_0205F690(*p_cameraObj, TRUE);
sub_0205F6AC(*p_cameraObj, FALSE);
pos = MapObject_GetPositionVecPtr(*p_cameraObj);
ov01_021F62E8(pos, ctx->fsys->unk2C);
sub_02023214(pos, ctx->fsys->camera);
return FALSE;
}
BOOL ScrCmd_103(SCRIPTCONTEXT *ctx) {
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fsys, SCRIPTENV_CAMERA_FOCUS_OBJ);
VecFx32 *pos;
MapObject_Remove(*p_cameraObj);
pos = MapObject_GetPositionVecPtr(GetMapObjectByID(ctx->fsys->mapObjectMan, obj_player));
ov01_021F62E8(pos, ctx->fsys->unk2C);
sub_02023214(pos, ctx->fsys->camera);
return FALSE;
}
BOOL ScrCmd_678(SCRIPTCONTEXT *ctx) {
u16 x = ScriptGetVar(ctx);
u16 y = ScriptGetVar(ctx);
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fsys, SCRIPTENV_CAMERA_FOCUS_OBJ);
*p_cameraObj = CreateSpecialFieldObject(ctx->fsys->mapObjectMan, x, y, 0, SPRITE_CAMERA_FOCUS, 0, ctx->fsys->location->mapId);
sub_02061070(*p_cameraObj);
sub_0205F690(*p_cameraObj, TRUE);
sub_0205F6AC(*p_cameraObj, FALSE);
return FALSE;
}
BOOL ScrCmd_679(SCRIPTCONTEXT *ctx) {
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fsys, SCRIPTENV_CAMERA_FOCUS_OBJ);
MapObject_Remove(*p_cameraObj);
return FALSE;
}