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

Go to the source code of this file.

Enumerations

enum  {
  SHINING_STATE_INIT = 40 , SHINING_STATE_DELAY = 41 , SHINING_STATE_BEGIN = 20 , SHINING_STATE_GATHER = 21 ,
  SHINING_STATE_HOLDING = 1 , SHINING_STATE_RELEASE = 2
}
 

Functions

void force_player_anim (AnimID)
 
void N sync_held_position (void)
 
void N update_player_carry_anim (void)
 
void N create_static_effect (Npc *npc)
 
void N dispose_static_effect (void)
 
void N reset_static_effect (s32 type)
 
void N init (Npc *npc)
 
void N try_cancel_tweester (Npc *watt)
 
void N pre_battle (Npc *watt)
 
void N post_battle (Npc *watt)
 

Variables

EvtScript EVS_WorldWatt_TakeOut
 
EvtScript EVS_WorldWatt_Update
 
EvtScript EVS_WorldWatt_UseAbility
 
EvtScript EVS_WorldWatt_PutAway
 
EvtScript EVS_WorldWatt_EnterMap
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SHINING_STATE_INIT 
SHINING_STATE_DELAY 
SHINING_STATE_BEGIN 
SHINING_STATE_GATHER 
SHINING_STATE_HOLDING 
SHINING_STATE_RELEASE 

Definition at line 22 of file watt.c.

22 {
23 // next two states lock input for a few frames, during which the ability can be canceled
30};
@ SHINING_STATE_HOLDING
Definition watt.c:28
@ SHINING_STATE_BEGIN
Definition watt.c:26
@ SHINING_STATE_DELAY
Definition watt.c:25
@ SHINING_STATE_GATHER
Definition watt.c:27
@ SHINING_STATE_INIT
Definition watt.c:24
@ SHINING_STATE_RELEASE
Definition watt.c:29

Function Documentation

◆ force_player_anim()

void force_player_anim ( AnimID anim)

Definition at line 905 of file 77480.c.

905 {
906 PlayerStatus* playerStatus = &gPlayerStatus;
907
908 playerStatus->anim = anim;
909 playerStatus->animNotifyValue = 0;
910 playerStatus->flags &= ~PS_FLAG_FACE_FORWARD;
911}
PlayerStatus gPlayerStatus
Definition 77480.c:39

◆ sync_held_position()

void N sync_held_position ( void )

Definition at line 552 of file watt.c.

552 {
553 Npc* partnerNPC;
554 Npc* new_var2;
555 Camera* camera = gCameras;
556 PlayerStatus* playerStatus;
557 f32 offsetScale, angle;
558 f32 spriteFacingAngle;
559 s32 angleOffset;
560
562 spriteFacingAngle = gPlayerStatusPtr->spriteFacingAngle;
563 if ((spriteFacingAngle < 90.0f) || (spriteFacingAngle > 270.0f)) {
565 angleOffset = -5;
566 offsetScale = 0.6f;
567 } else {
568 angleOffset = 5;
569 offsetScale = 0.6f;
570 }
571 } else {
573 angleOffset = 5;
574 offsetScale = 0.6f;
575 } else {
576 angleOffset = -5;
577 offsetScale = 0.6f;
578 }
579 }
580
581 angle = DEG_TO_RAD(camera->curYaw + 270.0f - gPlayerStatusPtr->spriteFacingAngle + angleOffset);
582
583 playerStatus = gPlayerStatusPtr;
584 partnerNPC = wPartnerNpc;
585 partnerNPC->pos.x = playerStatus->pos.x + (sin_rad(angle) * gPlayerStatusPtr->colliderDiameter * offsetScale);
586
587 new_var2 = wPartnerNpc;
588 playerStatus = gPlayerStatusPtr;
589 partnerNPC = new_var2;
590 partnerNPC->pos.z = playerStatus->pos.z - (cos_rad(angle) * gPlayerStatusPtr->colliderDiameter * offsetScale);
591
594 }
595}
AnimID trueAnimation
Encoding back-facing sprite.
@ PARTNER_ACTION_NONE
Definition enums.h:2932
f32 cos_rad(f32 x)
Definition 43F0.c:717
f32 sin_rad(f32 x)
Definition 43F0.c:713
Npc * wPartnerNpc
Definition partners.c:43
#define DEG_TO_RAD(deg)
Definition macros.h:134
@ SPRITE_ID_BACK_FACING
Definition sprite.h:13
Vec3f pos
PlayerStatus * gPlayerStatusPtr
PartnerStatus gPartnerStatus
Definition partners.c:42
Camera gCameras[4]
Definition cam_main.c:17

◆ update_player_carry_anim()

void N update_player_carry_anim ( void )

Definition at line 537 of file watt.c.

537 {
538 PlayerStatus* playerStatus = &gPlayerStatus;
539 f32 currentSpeed = playerStatus->curSpeed;
540 AnimID anim;
541
542 if (playerStatus->runSpeed <= currentSpeed) {
543 anim = ANIM_MarioW1_CarryRun;
544 } else if (playerStatus->walkSpeed <= currentSpeed) {
545 anim = ANIM_MarioW1_CarryWalk;
546 } else {
547 anim = ANIM_MarioW1_CarryIdle;
548 }
550}
u32 AnimID
void suggest_player_anim_allow_backward(AnimID anim)
Definition 77480.c:894
PlayerStatus gPlayerStatus
Definition 77480.c:39

◆ create_static_effect()

void N create_static_effect ( Npc * npc)

Definition at line 32 of file watt.c.

32 {
33 if (!(npc->flags & NPC_FLAG_INVISIBLE)) {
34 if (N(StaticEffect) == NULL) {
35 N(StaticEffect) = fx_static_status(0, npc->pos.x, npc->pos.y + 13.0f, npc->pos.z, 0.9f, 5, 0);
36 }
37 }
38}
@ NPC_FLAG_INVISIBLE
Definition enums.h:2999
s32 flags

Referenced by post_battle().

◆ dispose_static_effect()

void N dispose_static_effect ( void )

Definition at line 40 of file watt.c.

40 {
41 if (N(StaticEffect) != NULL) {
42 N(StaticEffect)->data.staticStatus->timeLeft = 1;
43 N(StaticEffect) = NULL;
44 }
45}

Referenced by pre_battle().

◆ reset_static_effect()

void N reset_static_effect ( s32 type)

Definition at line 49 of file watt.c.

49 {
50 EffectInstance* effect = N(StaticEffect);
51 StaticStatusFXData* part = effect->data.staticStatus;
52 f32 invisTime;
53 s32 count;
54 s32 i;
55
56 part->type = type;
57 invisTime = N(EffectAnimLengths)[type] * 0.5f;
58 count = effect->numParts - 1;
59
60 part++;
61 for (i = 1; i < count; i++, part++) {
62 part->frame = -1.0f - (invisTime * (i & 1));
63 }
64}
struct StaticStatusFXData * staticStatus
Definition effects.h:2579
EffectData data
Definition effects.h:2605

◆ init()

void N init ( Npc * npc)

Definition at line 66 of file watt.c.

66 {
67 npc->collisionHeight = 24;
68 npc->collisionDiameter = 24;
69 N(D_802BE308) = FALSE;
70 N(D_802BE300) = FALSE;
71 N(IsPlayerHolding) = FALSE;
72 N(AbilityState) = SHINING_STATE_BEGIN;
73 N(StaticEffect) = NULL;
74}
s16 collisionDiameter
s16 collisionHeight

◆ try_cancel_tweester()

void N try_cancel_tweester ( Npc * watt)

Definition at line 214 of file watt.c.

214 {
215 if (TweesterTouchingPartner != NULL) {
217 watt->flags = N(TweesterPhysicsPtr)->prevFlags;
218 N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT;
220 }
221}
@ TWEESTER_PARTNER_INIT
Definition enums.h:2475
void partner_clear_player_tracking(Npc *partner)
Definition partners.c:2436
Entity * TweesterTouchingPartner
Definition 7B440.c:5

◆ pre_battle()

void N pre_battle ( Npc * watt)

Definition at line 467 of file watt.c.

467 {
468 PartnerStatus* partnerStatus = &gPartnerStatus;
469
470 if (N(IsPlayerHolding)) {
471 partnerStatus->npc = *watt;
472 partnerStatus->shouldResumeAbility = TRUE;
474 }
475
477}
void N dispose_static_effect(void)
Definition watt.c:40

◆ post_battle()

void N post_battle ( Npc * watt)

Definition at line 479 of file watt.c.

479 {
480 PartnerStatus* partnerStatus = &gPartnerStatus;
481
482 if (partnerStatus->shouldResumeAbility) {
483 *watt = partnerStatus->npc;
485 N(create_static_effect)(watt);
486 }
487}
s32 partner_use_ability(void)
Definition partners.c:964
void N create_static_effect(Npc *npc)
Definition watt.c:32

Variable Documentation

◆ EVS_WorldWatt_TakeOut

EvtScript EVS_WorldWatt_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 90 of file watt.c.

90 {
91 Call(N(TakeOut))
92 Return
93 End
94};

◆ EVS_WorldWatt_Update

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

Definition at line 208 of file watt.c.

208 {
209 Call(N(Update))
210 Return
211 End
212};

◆ EVS_WorldWatt_UseAbility

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

Definition at line 433 of file watt.c.

433 {
434 Call(N(UseAbility))
435 Return
436 End
437};

◆ EVS_WorldWatt_PutAway

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

Definition at line 461 of file watt.c.

461 {
462 Call(N(PutAway))
463 Return
464 End
465};

◆ EVS_WorldWatt_EnterMap

EvtScript EVS_WorldWatt_EnterMap
Initial value:
= {
Call(N(EnterMap))
}

Definition at line 597 of file watt.c.

597 {
598 Call(N(EnterMap))
599 Return
600 End
601};