Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
PlayLavaBubbleFlightSound.inc.c
Go to the documentation of this file.
1#include "common.h"
2
3API_CALLABLE(N(PlayLavaBubbleFlightSound)) {
4 Actor* actor = get_actor(script->owner1.actorID);
5 f32 distX;
6 f32 distY;
7 f32 distZ;
8 f32 dist;
9
10 if (isInitialCall) {
11 distX = actor->state.goalPos.x - actor->curPos.x;
12 distY = actor->state.goalPos.y - actor->curPos.y;
13 distZ = actor->state.goalPos.z - actor->curPos.z;
14 dist = sqrtf(SQ(distX) + SQ(distY) + SQ(distZ));
15 script->functionTemp[0] = ((dist / actor->state.speed) * 0.5f) + 1.0f;
17 }
18
19 if (script->functionTemp[0]-- > 0) {
20 return ApiStatus_BLOCK;
21 }
22
24 return ApiStatus_DONE2;
25}
ActorState state
Vec3f curPos
#define sfx_play_sound_at_position
#define sqrtf
@ SOUND_ID_TRIGGER_CHANGE_SOUND
Definition enums.h:532
@ SOUND_EMBER_FLY
Definition enums.h:1163
@ SOUND_SPACE_DEFAULT
Definition enums.h:1737
#define ApiStatus_DONE2
Definition evt.h:118
#define ApiStatus_BLOCK
Definition evt.h:116
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
#define SQ(x)
Definition macros.h:166