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
4
API_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
}
PlayerStatus::spriteFacingAngle
f32 spriteFacingAngle
Definition
common_structs.h:2016
PlayerStatus::colliderHeight
s16 colliderHeight
Definition
common_structs.h:2018
PlayerStatus
Definition
common_structs.h:1979
sin_deg
#define sin_deg
Definition
effect_shims.h:55
clamp_angle
#define clamp_angle
Definition
effect_shims.h:54
cos_deg
#define cos_deg
Definition
effect_shims.h:56
ApiStatus_DONE2
#define ApiStatus_DONE2
Definition
evt.h:118
Bytecode
s32 Bytecode
Definition
evt.h:7
evt_get_variable
s32 evt_get_variable(Evt *script, Bytecode var)
Definition
evt.c:1690
evt_set_variable
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
Definition
evt.c:1847
npc.h
Camera::curYaw
f32 curYaw
Definition
common_structs.h:800
gCameras
Camera gCameras[4]
Definition
cam_main.c:17
gPlayerStatus
PlayerStatus gPlayerStatus
Definition
77480.c:39
gCurrentCameraID
s32 gCurrentCameraID
Definition
cam_math.c:4
src
world
common
todo
AddPlayerHandsOffset.inc.c
Generated by
1.10.0