4#include "sprite/npc/WorldBow.h"
5#include "sprite/player.h"
7#define NAMESPACE world_bow
10BSS b32 N(LockingPlayerInput);
12BSS s32 N(OuttaSightPosX);
13BSS s32 N(OuttaSightPosY);
14BSS s32 N(OuttaSightPosZ);
20 bow->collisionHeight = 26;
21 bow->collisionDiameter = 24;
23 N(LockingPlayerInput) = FALSE;
27API_CALLABLE(N(TakeOut)) {
28 Npc* bow = script->owner2.npc;
49API_CALLABLE(N(Update)) {
51 Npc* bow = script->owner2.npc;
52 f32 sinAngle, cosAngle, liftoffVelocity;
70 switch (N(TweesterPhysicsPtr)->state){
72 N(TweesterPhysicsPtr)->state++;
73 N(TweesterPhysicsPtr)->prevFlags = bow->
flags;
76 N(TweesterPhysicsPtr)->angularVel = 6.0f;
77 N(TweesterPhysicsPtr)->liftoffVelPhase = 50.0f;
78 N(TweesterPhysicsPtr)->countdown = 120;
80 bow->
flags &= ~NPC_FLAG_GRAVITY;
83 bow->
pos.
x = entity->
pos.
x + (sinAngle * N(TweesterPhysicsPtr)->radius);
84 bow->
pos.
z = entity->
pos.
z - (cosAngle * N(TweesterPhysicsPtr)->radius);
85 N(TweesterPhysicsPtr)->angle =
clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVel);
86 if (N(TweesterPhysicsPtr)->radius > 20.0f) {
87 N(TweesterPhysicsPtr)->radius -= 1.0f;
88 }
else if (N(TweesterPhysicsPtr)->radius < 19.0f) {
89 N(TweesterPhysicsPtr)->radius++;
92 liftoffVelocity =
sin_rad(
DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelPhase)) * 3.0f;
93 N(TweesterPhysicsPtr)->liftoffVelPhase += 3.0f;
95 if (N(TweesterPhysicsPtr)->liftoffVelPhase > 150.0f) {
96 N(TweesterPhysicsPtr)->liftoffVelPhase = 150.0f;
99 bow->
pos.
y += liftoffVelocity;
101 N(TweesterPhysicsPtr)->angularVel += 0.8;
103 if (N(TweesterPhysicsPtr)->angularVel > 40.0f) {
104 N(TweesterPhysicsPtr)->angularVel = 40.0f;
106 if (--N(TweesterPhysicsPtr)->countdown == 0) {
107 N(TweesterPhysicsPtr)->state++;
111 bow->
flags = N(TweesterPhysicsPtr)->prevFlags;
112 N(TweesterPhysicsPtr)->countdown = 30;
113 N(TweesterPhysicsPtr)->state++;
119 if (--N(TweesterPhysicsPtr)->countdown == 0) {
137 bow->
flags = N(TweesterPhysicsPtr)->prevFlags;
159 x = playerStatus->
pos.
x;
161 z = playerStatus->
pos.
z;
167API_CALLABLE(N(UseAbility)) {
171 Npc* bow = script->owner2.npc;
174 #define USE_STATE functionTemp[0]
177 OUTTA_SIGHT_INIT = 40,
178 OUTTA_SIGHT_DELAY = 41,
179 OUTTA_SIGHT_BEGIN = 20,
180 OUTTA_SIGHT_GATHER = 21,
181 OUTTA_SIGHT_VANISH = 1,
182 OUTTA_SIGHT_IDLE = 2,
183 OUTTA_SIGHT_REAPPEAR = 3,
192 playerStatus->
animFlags &= ~PA_FLAG_PARTNER_USAGE_FORCED;
194 N(LockingPlayerInput) = TRUE;
195 script->USE_STATE = OUTTA_SIGHT_BEGIN;
197 script->USE_STATE = OUTTA_SIGHT_INIT;
201 switch (script->USE_STATE) {
202 case OUTTA_SIGHT_INIT:
208 script->functionTemp[1] = 3;
210 N(LockingPlayerInput) = TRUE;
213 case OUTTA_SIGHT_DELAY:
216 && N(LockingPlayerInput)
219 N(LockingPlayerInput) = FALSE;
220 playerStatus->
flags &= ~PS_FLAG_PAUSE_DISABLED;
223 script->functionTemp[1]--;
224 if (script->functionTemp[1] == 0) {
226 if (N(LockingPlayerInput)) {
228 N(LockingPlayerInput) = FALSE;
230 playerStatus->
flags &= ~PS_FLAG_PAUSE_DISABLED;
233 script->USE_STATE = OUTTA_SIGHT_BEGIN;
238 switch (script->USE_STATE) {
239 case OUTTA_SIGHT_BEGIN:
241 playerStatus->
flags &= ~PS_FLAG_PAUSE_DISABLED;
242 if (N(LockingPlayerInput)) {
244 N(LockingPlayerInput) = FALSE;
248 if (script->functionTemp[2] != 0) {
249 N(LockingPlayerInput) = TRUE;
261 bow->
curAnim = ANIM_WorldBow_Walk;
272 case OUTTA_SIGHT_GATHER:
280 N(OuttaSightPosX) = playerStatus->
pos.
x - bow->
pos.
x;
281 N(OuttaSightPosY) = playerStatus->
pos.
y - bow->
pos.
y;
282 N(OuttaSightPosZ) = playerStatus->
pos.
z - bow->
pos.
z;
289 script->USE_STATE = OUTTA_SIGHT_VANISH;
296 case OUTTA_SIGHT_VANISH:
297 if (collisionStatus->
curFloor >= 0) {
299 if (playerStatus->
curAlpha <= 128) {
303 playerStatus->
flags &= ~PS_FLAG_PAUSE_DISABLED;
309 bow->
pos.
x = playerStatus->
pos.
x - N(OuttaSightPosX);
310 bow->
pos.
y = playerStatus->
pos.
y - N(OuttaSightPosY);
311 bow->
pos.
z = playerStatus->
pos.
z - N(OuttaSightPosZ);
317 case OUTTA_SIGHT_IDLE:
323 bow->
pos.
x = playerStatus->
pos.
x - N(OuttaSightPosX);
324 bow->
pos.
y = playerStatus->
pos.
y - N(OuttaSightPosY);
325 bow->
pos.
z = playerStatus->
pos.
z - N(OuttaSightPosZ);
329 || stickInputMag > 10.0f
336 script->functionTemp[1] = 3;
342 case OUTTA_SIGHT_REAPPEAR:
343 if (script->functionTemp[1] == 0) {
345 script->USE_STATE = OUTTA_SIGHT_IDLE;
349 script->functionTemp[1]--;
376 if (N(LockingPlayerInput)) {
382 N(LockingPlayerInput) = FALSE;
392 playerStatus->
flags &= ~PS_FLAG_PAUSE_DISABLED;
397API_CALLABLE(N(PutAway)) {
398 Npc* bow = script->owner2.npc;
431 bow->
flags &= ~NPC_FLAG_INVISIBLE;
@ TWEESTER_PARTNER_ATTRACT
@ TWEESTER_PARTNER_RELEASE
@ PS_FLAG_HAZARD_INVINCIBILITY
@ PA_FLAG_PARTNER_USAGE_FORCED
@ RENDER_MODE_SURFACE_XLU_LAYER2
@ RENDER_MODE_SURFACE_XLU_LAYER1
@ NPC_FLAG_IGNORE_WORLD_COLLISION
@ NPC_FLAG_IGNORE_PLAYER_COLLISION
@ NPC_FLAG_IGNORE_CAMERA_FOR_YAW
void suggest_player_anim_always_forward(AnimID anim)
void partner_clear_player_tracking(Npc *partner)
void partner_flying_update_player_tracking(Npc *partner)
s32 disable_player_input(void)
Shadow * get_shadow_by_index(s32 index)
s32 enable_player_input(void)
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
s32 player_test_lateral_overlap(s32, PlayerStatus *, f32 *, f32 *, f32 *, f32, f32)
s32 is_starting_conversation(void)
void set_action_state(s32 actionState)
void suggest_player_anim_allow_backward(AnimID anim)
void partner_flying_update_motion(Npc *partner)
void partner_flying_enable(Npc *partner, s32 val)
void sin_cos_rad(f32 rad, f32 *outSinTheta, f32 *outCosTheta)
void add_vec2D_polar(f32 *x, f32 *y, f32 r, f32 theta)
void npc_set_imgfx_params(Npc *npc, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6)
s32 func_800EA52C(s32 partnerID)
s32 partner_init_get_out(Npc *npc)
s32 partner_init_put_away(Npc *partner)
s32 partner_put_away(Npc *partner)
s32 partner_force_player_flip_done(void)
s32 partner_get_out(Npc *partner)
void sfx_play_sound_at_npc(s32 soundID, s32 arg1, s32 npcID)
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
#define Return
Kills the current EVT thread.
Entity * TweesterTouchingPartner
CollisionStatus gCollisionStatus
PartnerStatus gPartnerStatus
GameStatus * gGameStatusPtr
PlayerStatus gPlayerStatus
void N pre_battle(Npc *bow)
void N end_outta_sight_cleanup(Npc *partner)
EvtScript EVS_WorldBow_Update
EvtScript EVS_WorldBow_PutAway
EvtScript EVS_WorldBow_TakeOut
EvtScript EVS_WorldBow_UseAbility
s32 N check_for_treadmill_overlaps(void)
void N try_cancel_tweester(Npc *bow)