Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
bow.c File Reference

Go to the source code of this file.

Macros

#define USE_STATE   functionTemp[0]
 

Functions

void N end_outta_sight_cleanup (Npc *partner)
 
s32 N check_for_treadmill_overlaps (void)
 
void N init (Npc *bow)
 
void N try_cancel_tweester (Npc *bow)
 
void N pre_battle (Npc *bow)
 

Variables

EvtScript EVS_WorldBow_TakeOut
 
EvtScript EVS_WorldBow_Update
 
EvtScript EVS_WorldBow_UseAbility
 
EvtScript EVS_WorldBow_PutAway
 

Macro Definition Documentation

◆ USE_STATE

#define USE_STATE   functionTemp[0]

Function Documentation

◆ end_outta_sight_cleanup()

void N end_outta_sight_cleanup ( Npc * partner)

Definition at line 366 of file bow.c.

366 {
367 PlayerStatus* playerStatus = &gPlayerStatus;
368 PartnerStatus* partnerStatus = &gPartnerStatus;
369 s32 actionState;
370
371 playerStatus->curAlpha = 255;
372 npc_set_imgfx_params(bow, IMGFX_CLEAR, 0, 0, 0, 0, 0);
373 bow->renderMode = RENDER_MODE_SURFACE_XLU_LAYER1;
374 get_shadow_by_index(bow->shadowIndex)->alpha = playerStatus->curAlpha / 2;
375
376 if (N(LockingPlayerInput)) {
378 }
379
382 N(LockingPlayerInput) = FALSE;
383 actionState = ACTION_STATE_IDLE;
384
385 if (playerStatus->flags & PS_FLAG_HIT_FIRE) {
386 actionState = ACTION_STATE_HIT_LAVA;
387 }
388
389 set_action_state(actionState);
390 partnerStatus->partnerActionState = 0;
391 partnerStatus->actingPartner = 0;
392 playerStatus->flags &= ~PS_FLAG_PAUSE_DISABLED;
394 N(IsHiding) = FALSE;
395}
@ IMGFX_CLEAR
Definition enums.h:5117
@ PS_FLAG_JUMPING
Definition enums.h:3035
@ PS_FLAG_HAZARD_INVINCIBILITY
Definition enums.h:3056
@ PS_FLAG_HIT_FIRE
Definition enums.h:3050
@ RENDER_MODE_SURFACE_XLU_LAYER1
Definition enums.h:3282
@ ACTION_STATE_HIT_LAVA
Definition enums.h:2451
@ ACTION_STATE_IDLE
Definition enums.h:2426
@ NPC_FLAG_IGNORE_WORLD_COLLISION
Definition enums.h:3004
@ NPC_FLAG_INVISIBLE
Definition enums.h:2999
void partner_clear_player_tracking(Npc *partner)
Definition partners.c:2436
Shadow * get_shadow_by_index(s32 index)
Definition entity.c:534
s32 enable_player_input(void)
Definition 77480.c:998
void set_action_state(s32 actionState)
Definition 7E9D0.c:209
void npc_set_imgfx_params(Npc *npc, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6)
Definition npc.c:2162
PartnerStatus gPartnerStatus
Definition partners.c:42
PlayerStatus gPlayerStatus
Definition 77480.c:39

◆ check_for_treadmill_overlaps()

s32 N check_for_treadmill_overlaps ( void )

Definition at line 144 of file bow.c.

144 {
145 PlayerStatus* playerStatus = &gPlayerStatus;
146 f32 x, y, z;
147 f32 yaw;
148
149 //TODO hardcoded map IDs
151 return NO_COLLIDER;
152 }
153
154 if (playerStatus->pushVel.x == 0.0f && playerStatus->pushVel.z == 0.0f) {
155 return NO_COLLIDER;
156 }
157
158 yaw = atan2(0.0f, 0.0f, playerStatus->pushVel.x, playerStatus->pushVel.z);
159 x = playerStatus->pos.x;
160 y = playerStatus->pos.y + (playerStatus->colliderHeight * 0.5f);
161 z = playerStatus->pos.z;
162
163 add_vec2D_polar(&x, &z, playerStatus->colliderDiameter * 0.5f, clamp_angle(yaw + 180.0f));
164 return player_test_lateral_overlap(PLAYER_COLLISION_0, playerStatus, &x, &y, &z, playerStatus->colliderDiameter, yaw);
165}
#define clamp_angle
#define atan2
@ PLAYER_COLLISION_0
Definition enums.h:4712
@ AREA_OMO
Definition enums.h:2976
s32 player_test_lateral_overlap(s32, PlayerStatus *, f32 *, f32 *, f32 *, f32, f32)
Definition 77480.c:370
void add_vec2D_polar(f32 *x, f32 *y, f32 r, f32 theta)
Definition 43F0.c:685
#define NO_COLLIDER
Definition macros.h:156
GameStatus * gGameStatusPtr
Definition main_loop.c:32

◆ init()

void N init ( Npc * bow)

Definition at line 19 of file bow.c.

19 {
20 bow->collisionHeight = 26;
21 bow->collisionDiameter = 24;
23 N(LockingPlayerInput) = FALSE;
24 N(IsHiding) = FALSE;
25}
s16 collisionDiameter
s8 renderMode
s16 collisionHeight

◆ try_cancel_tweester()

void N try_cancel_tweester ( Npc * bow)

Definition at line 134 of file bow.c.

134 {
135 if (TweesterTouchingPartner != NULL) {
137 bow->flags = N(TweesterPhysicsPtr)->prevFlags;
138 N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT;
140 }
141}
@ TWEESTER_PARTNER_INIT
Definition enums.h:2475
s32 flags
Entity * TweesterTouchingPartner
Definition 7B440.c:5

◆ pre_battle()

void N pre_battle ( Npc * bow)

Definition at line 421 of file bow.c.

421 {
422 PartnerStatus* partnerStatus = &gPartnerStatus;
423
424 if (N(IsHiding)) {
429 partnerStatus->actingPartner = PARTNER_NONE;
430 N(IsHiding) = FALSE;
431 bow->flags &= ~NPC_FLAG_INVISIBLE;
432 }
433}
@ PARTNER_ACTION_NONE
Definition enums.h:2932
@ PARTNER_NONE
Definition enums.h:2885

Variable Documentation

◆ EVS_WorldBow_TakeOut

EvtScript EVS_WorldBow_TakeOut
Initial value:
= {
Call(N(TakeOut))
}
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define Return
Kills the current EVT thread.
Definition macros.h:217

Definition at line 41 of file bow.c.

41 {
42 Call(N(TakeOut))
43 Return
44 End
45};

◆ EVS_WorldBow_Update

EvtScript EVS_WorldBow_Update
Initial value:
= {
Call(N(Update))
}

Definition at line 128 of file bow.c.

128 {
129 Call(N(Update))
130 Return
131 End
132};

◆ EVS_WorldBow_UseAbility

EvtScript EVS_WorldBow_UseAbility
Initial value:
= {
Call(N(UseAbility))
}

Definition at line 360 of file bow.c.

360 {
361 Call(N(UseAbility))
362 Return
363 End
364};

◆ EVS_WorldBow_PutAway

EvtScript EVS_WorldBow_PutAway
Initial value:
= {
Call(N(PutAway))
}

Definition at line 415 of file bow.c.

415 {
416 Call(N(PutAway))
417 Return
418 End
419};