Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
AddPlayerHandsOffset.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "npc.h"
3
4API_CALLABLE(N(AddPlayerHandsOffset)) {
5 PlayerStatus* playerStatus = &gPlayerStatus;
6 Bytecode* args = script->ptrReadPos;
7 s32 xVar = *args++;
8 f32 x = (f32)evt_get_variable(script, xVar);
9 s32 yVar = *args++;
10 f32 y = (f32)evt_get_variable(script, yVar);
11 s32 zVar = *args++;
12 f32 z = (f32)evt_get_variable(script, zVar);
13 f32 cameraYaw;
14
15 cameraYaw = gCameras[gCurrentCameraID].curYaw;
16
17 if (playerStatus->spriteFacingAngle == 0.0f) {
18 cameraYaw -= 100.0f;
19 } else {
20 cameraYaw += 100.0f;
21 }
22 cameraYaw = clamp_angle(cameraYaw);
23
24 x += sin_deg(cameraYaw) * 15.0f;
25 y += playerStatus->colliderHeight * 0.5f;
26 z -= cos_deg(cameraYaw) * 15.0f;
27
28 evt_set_variable(script, xVar, x);
29 evt_set_variable(script, yVar, y);
30 evt_set_variable(script, zVar, z);
31
32 return ApiStatus_DONE2;
33}
#define sin_deg
#define clamp_angle
#define cos_deg
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1690
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
Definition evt.c:1847
Camera gCameras[4]
Definition cam_main.c:17
PlayerStatus gPlayerStatus
Definition 77480.c:39
s32 gCurrentCameraID
Definition cam_math.c:4