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

Go to the source code of this file.

Enumerations

enum  {
  AIR_LIFT_NONE = 0 , AIR_LIFT_INIT = 40 , AIR_LIFT_DELAY = 41 , AIR_LIFT_BEGIN = 30 ,
  AIR_LIFT_GATHER = 31 , AIR_LIFT_PICKUP = 1 , AIR_LIFT_CARRY = 2 , AIR_LIFT_HOLD = 6 ,
  AIR_LIFT_JUMP = 20 , AIR_LIFT_DROP = 21 , AIR_LIFT_CANCEL = 22
}
 

Functions

void N init (Npc *parakarry)
 
void N try_cancel_tweester (Npc *parakarry)
 
HitIDupdate_current_floor (void)
 
void N pre_battle (Npc *parakarry)
 
void N post_battle (Npc *parakarry)
 

Variables

EvtScript EVS_WorldParakarry_TakeOut
 
EvtScript EVS_WorldParakarry_Update
 
EvtScript EVS_WorldParakarry_UseAbility
 
EvtScript EVS_WorldParakarry_PutAway
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
AIR_LIFT_NONE 
AIR_LIFT_INIT 
AIR_LIFT_DELAY 
AIR_LIFT_BEGIN 
AIR_LIFT_GATHER 
AIR_LIFT_PICKUP 
AIR_LIFT_CARRY 
AIR_LIFT_HOLD 
AIR_LIFT_JUMP 
AIR_LIFT_DROP 
AIR_LIFT_CANCEL 

Definition at line 16 of file parakarry.c.

16 {
17 AIR_LIFT_NONE = 0, // only used for initial value
18 // next two states lock input for a few frames, during which the ability can be canceled
19 AIR_LIFT_INIT = 40,
20 AIR_LIFT_DELAY = 41,
21 AIR_LIFT_BEGIN = 30,
22 AIR_LIFT_GATHER = 31,
23 AIR_LIFT_PICKUP = 1, // pick up the player and lift them into the air
24 AIR_LIFT_CARRY = 2, // carry the player through the air
25 AIR_LIFT_HOLD = 6, // remain in one position for a short period of time
26 AIR_LIFT_JUMP = 20, // player jumped off while being carried
27 AIR_LIFT_DROP = 21, // dropping the player
28 AIR_LIFT_CANCEL = 22,
29};
@ AIR_LIFT_HOLD
Definition parakarry.c:25
@ AIR_LIFT_GATHER
Definition parakarry.c:22
@ AIR_LIFT_DROP
Definition parakarry.c:27
@ AIR_LIFT_CANCEL
Definition parakarry.c:28
@ AIR_LIFT_INIT
Definition parakarry.c:19
@ AIR_LIFT_DELAY
Definition parakarry.c:20
@ AIR_LIFT_JUMP
Definition parakarry.c:26
@ AIR_LIFT_PICKUP
Definition parakarry.c:23
@ AIR_LIFT_CARRY
Definition parakarry.c:24
@ AIR_LIFT_BEGIN
Definition parakarry.c:21
@ AIR_LIFT_NONE
Definition parakarry.c:17

Function Documentation

◆ init()

void N init ( Npc * parakarry)

Definition at line 31 of file parakarry.c.

31 {
32 parakarry->collisionHeight = 37;
33 parakarry->collisionDiameter = 40;
34 N(UsingAbility) = FALSE;
35 N(AbilityState) = AIR_LIFT_NONE;
36 N(LockingPlayerInput) = FALSE;
37 N(PlayerCollisionDisabled) = FALSE;
38 N(PlayerWasFacingLeft) = FALSE;
39 N(AbilityStateTime) = 0;
40}
s16 collisionDiameter
s16 collisionHeight

◆ try_cancel_tweester()

void N try_cancel_tweester ( Npc * parakarry)

Definition at line 153 of file parakarry.c.

153 {
156 parakarry->flags = N(TweesterPhysicsPtr)->prevFlags;
157 N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT;
159 }
160}
@ TWEESTER_PARTNER_INIT
Definition enums.h:2475
void partner_clear_player_tracking(Npc *partner)
Definition partners.c:2436
s32 flags
Entity * TweesterTouchingPartner
Definition 7B440.c:5

◆ update_current_floor()

HitID N update_current_floor ( void )

Definition at line 162 of file parakarry.c.

162 {
163 f32 x, y, z, length, hitRx, hitRz, hitDirX, hitDirZ;
164 f32 colliderBaseHeight = gPlayerStatus.colliderHeight;
165 HitID hitID;
166 s32 surfaceType;
167
168 x = gPlayerStatus.pos.x;
169 y = gPlayerStatus.pos.y + (colliderBaseHeight * 0.5);
170 z = gPlayerStatus.pos.z;
171 length = colliderBaseHeight / 2.0f;
172
173 hitID = player_raycast_below_cam_relative(&gPlayerStatus, &x, &y, &z, &length, &hitRx,
174 &hitRz, &hitDirX, &hitDirZ);
175
177 if (surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA) {
180 N(AbilityState) = AIR_LIFT_DROP;
181 }
182
183 return hitID;
184}
s32 HitID
@ SURFACE_TYPE_LAVA
Definition enums.h:4673
@ SURFACE_TYPE_SPIKES
Definition enums.h:4672
@ PS_FLAG_HIT_FIRE
Definition enums.h:3050
@ COLLIDER_FLAGS_SURFACE_TYPE_MASK
Definition enums.h:4693
@ HAZARD_TYPE_SPIKES
Definition enums.h:3501
HitID player_raycast_below_cam_relative(PlayerStatus *playerStatus, f32 *outX, f32 *outY, f32 *outZ, f32 *outLength, f32 *hitRx, f32 *hitRz, f32 *hitDirX, f32 *hitDirZ)
Definition 77480.c:193
s32 get_collider_flags(s32 colliderID)
Definition collision.c:481
PlayerStatus gPlayerStatus
Definition 77480.c:39

◆ pre_battle()

void N pre_battle ( Npc * parakarry)

Definition at line 639 of file parakarry.c.

639 {
640 PartnerStatus* partnerStatus = &gPartnerStatus;
641
642 if (N(UsingAbility)) {
643 if (N(PlayerCollisionDisabled)) {
645 }
646
647 if (N(LockingPlayerInput)) {
649 }
650
652 partnerStatus->npc = *parakarry;
653 partnerStatus->shouldResumeAbility = TRUE;
655 }
656
657 partnerStatus->actingPartner = PARTNER_PARAKARRY;
658}
@ PARTNER_PARAKARRY
Definition enums.h:2889
@ ACTION_STATE_IDLE
Definition enums.h:2426
s32 enable_player_input(void)
Definition 77480.c:998
void set_action_state(s32 actionState)
Definition 7E9D0.c:209
s32 enable_player_static_collisions(void)
Definition 77480.c:980
PartnerStatus gPartnerStatus
Definition partners.c:42

◆ post_battle()

void N post_battle ( Npc * parakarry)

Definition at line 660 of file parakarry.c.

660 {
661 PartnerStatus* partnerStatus = &gPartnerStatus;
662
663 if (partnerStatus->shouldResumeAbility) {
664 if (N(PlayerCollisionDisabled)) {
666 }
667 if (N(LockingPlayerInput)) {
669 }
670
672 *parakarry = partnerStatus->npc;
673 partnerStatus->actingPartner = PARTNER_NONE;
677 }
678}
s32 partner_use_ability(void)
Definition partners.c:964
@ PARTNER_ACTION_NONE
Definition enums.h:2932
@ PARTNER_NONE
Definition enums.h:2885
@ ACTION_STATE_RIDE
Definition enums.h:2461
s32 disable_player_input(void)
Definition 77480.c:990
s32 disable_player_static_collisions(void)
Definition 77480.c:972

Variable Documentation

◆ EVS_WorldParakarry_TakeOut

EvtScript EVS_WorldParakarry_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 56 of file parakarry.c.

56 {
57 Call(N(TakeOut))
58 Return
59 End
60};

◆ EVS_WorldParakarry_Update

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

Definition at line 147 of file parakarry.c.

147 {
148 Call(N(Update))
149 Return
150 End
151};

◆ EVS_WorldParakarry_UseAbility

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

Definition at line 613 of file parakarry.c.

613 {
614 Call(N(UseAbility))
615 Return
616 End
617};

◆ EVS_WorldParakarry_PutAway

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

Definition at line 633 of file parakarry.c.

633 {
634 Call(N(PutAway))
635 Return
636 End
637};