Skip to content

Commit

Permalink
SCRIPTENV_CAMERA_TARGET
Browse files Browse the repository at this point in the history
  • Loading branch information
red031000 committed May 15, 2023
1 parent 90026fd commit 76fac40
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions include/script.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ typedef struct ScriptEnvironment {
struct ListMenu2D *listMenu2D;
int facingDirection;
LocalMapObject *lastInteracted;
u32 cameraFocusObj;
u32 cameraTarget;
LocalMapObject *unk_34;
SCRIPTCONTEXT *scriptContexts[3];
MSGFMT *msgfmt;
Expand Down Expand Up @@ -88,7 +88,7 @@ typedef enum ScriptEnvField {
SCRIPTENV_ACTIVE_SCRIPT_NUMBER,
SCRIPTENV_FACING_DIRECTION,
SCRIPTENV_LAST_INTERACTED,
SCRIPTENV_CAMERA_FOCUS_OBJ = 11,
SCRIPTENV_CAMERA_TARGET,
SCRIPTENV_34 = 12,
SCRIPTENV_SCRCTX_0 = 13,
SCRIPTENV_SCRCTX_1 = 14,
Expand Down
4 changes: 2 additions & 2 deletions src/fieldmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ void *FieldSysGetAttrAddrInternal(ScriptEnvironment *environment, enum ScriptEnv
return &environment->facingDirection;
case SCRIPTENV_LAST_INTERACTED:
return &environment->lastInteracted;
case SCRIPTENV_CAMERA_FOCUS_OBJ:
return &environment->cameraFocusObj;
case SCRIPTENV_CAMERA_TARGET:
return &environment->cameraTarget;
case SCRIPTENV_34:
return &environment->unk_34;
case SCRIPTENV_SCRCTX_0:
Expand Down
10 changes: 5 additions & 5 deletions src/scrcmd_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,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_CAMERA_FOCUS_OBJ);
LocalMapObject **attr = FieldSysGetAttrAddr(fsys, SCRIPTENV_CAMERA_TARGET);
return *attr;
} else {
return GetMapObjectByID(fsys->mapObjectMan, person);
Expand Down Expand Up @@ -1418,7 +1418,7 @@ BOOL ScrCmd_HidePerson(SCRIPTCONTEXT *ctx) {
BOOL ScrCmd_102(SCRIPTCONTEXT *ctx) {
u16 x = ScriptGetVar(ctx);
u16 y = ScriptGetVar(ctx);
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fsys, SCRIPTENV_CAMERA_FOCUS_OBJ);
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fsys, SCRIPTENV_CAMERA_TARGET);
VecFx32 *pos;
*p_cameraObj = CreateSpecialFieldObject(ctx->fsys->mapObjectMan, x, y, 0, SPRITE_CAMERA_FOCUS, 0, ctx->fsys->location->mapId);
sub_02061070(*p_cameraObj);
Expand All @@ -1431,7 +1431,7 @@ BOOL ScrCmd_102(SCRIPTCONTEXT *ctx) {
}

BOOL ScrCmd_103(SCRIPTCONTEXT *ctx) {
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fsys, SCRIPTENV_CAMERA_FOCUS_OBJ);
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fsys, SCRIPTENV_CAMERA_TARGET);
VecFx32 *pos;
MapObject_Remove(*p_cameraObj);
pos = MapObject_GetPositionVecPtr(GetMapObjectByID(ctx->fsys->mapObjectMan, obj_player));
Expand All @@ -1443,7 +1443,7 @@ BOOL ScrCmd_103(SCRIPTCONTEXT *ctx) {
BOOL ScrCmd_678(SCRIPTCONTEXT *ctx) {
u16 x = ScriptGetVar(ctx);
u16 y = ScriptGetVar(ctx);
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fsys, SCRIPTENV_CAMERA_FOCUS_OBJ);
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fsys, SCRIPTENV_CAMERA_TARGET);
*p_cameraObj = CreateSpecialFieldObject(ctx->fsys->mapObjectMan, x, y, 0, SPRITE_CAMERA_FOCUS, 0, ctx->fsys->location->mapId);
sub_02061070(*p_cameraObj);
MapObject_SetFlag9(*p_cameraObj, TRUE);
Expand All @@ -1452,7 +1452,7 @@ BOOL ScrCmd_678(SCRIPTCONTEXT *ctx) {
}

BOOL ScrCmd_679(SCRIPTCONTEXT *ctx) {
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fsys, SCRIPTENV_CAMERA_FOCUS_OBJ);
LocalMapObject **p_cameraObj = FieldSysGetAttrAddr(ctx->fsys, SCRIPTENV_CAMERA_TARGET);
MapObject_Remove(*p_cameraObj);
return FALSE;
}
Expand Down

0 comments on commit 76fac40

Please sign in to comment.