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

Go to the source code of this file.

Data Structures

struct  PulseStoneData
 

Enumerations

enum  { PULSE_STONE_APPEAR = 0 , PULSE_STONE_OVERSHOOT = 1 , PULSE_STONE_HOLD = 2 }
 

Functions

 INCLUDE_IMG ("pulse_stone_icon.png", pulse_stone_icon_img)
 
 INCLUDE_PAL ("pulse_stone_icon.pal", pulse_stone_icon_1_pal)
 
 INCLUDE_PAL ("pulse_stone_icon.flash.pal", pulse_stone_icon_2_pal)
 
void pulse_stone_notification_update (void)
 
s32 should_cancel_pulse_stone (void)
 
s32 should_continue_pulse_stone (void)
 
void pulse_stone_notification_setup (void)
 
void appendGfx_pulse_stone_icon (void)
 

Variables

BSS PulseStoneData PulseStoneNotification
 
PulseStoneDataPulseStonePtr = &PulseStoneNotification
 

Data Structure Documentation

◆ PulseStoneData

struct PulseStoneData
Data Fields
Vec3f pos
f32 scale
char unk_10[0x8]
s32 appearDelay
char unk_1C[0x4]
s32 pingTime
s32 state

Enumeration Type Documentation

◆ anonymous enum

Enumerator
PULSE_STONE_APPEAR 
PULSE_STONE_OVERSHOOT 
PULSE_STONE_HOLD 

Definition at line 15 of file pulse_stone.c.

15 {
16 PULSE_STONE_APPEAR = 0, // icon appears
17 PULSE_STONE_OVERSHOOT = 1, // icon scale overshoots
18 PULSE_STONE_HOLD = 2, // icon reaches final size
19};
@ PULSE_STONE_HOLD
Definition pulse_stone.c:18
@ PULSE_STONE_OVERSHOOT
Definition pulse_stone.c:17
@ PULSE_STONE_APPEAR
Definition pulse_stone.c:16

Function Documentation

◆ INCLUDE_IMG()

INCLUDE_IMG ( "pulse_stone_icon.png" ,
pulse_stone_icon_img  )

◆ INCLUDE_PAL() [1/2]

INCLUDE_PAL ( "pulse_stone_icon.pal" ,
pulse_stone_icon_1_pal  )

◆ INCLUDE_PAL() [2/2]

INCLUDE_PAL ( "pulse_stone_icon.flash.pal" ,
pulse_stone_icon_2_pal  )

◆ pulse_stone_notification_update()

void pulse_stone_notification_update ( void )

Definition at line 155 of file pulse_stone.c.

155 {
157
159 ((playerStatus->pos.y + playerStatus->colliderHeight + 10.0f) - PulseStonePtr->pos.y) / 1.5f;
162
166 return;
167 }
168
169 switch (PulseStonePtr->state) {
171 if (PulseStonePtr->appearDelay++ < 6) {
172 break;
173 }
174 PulseStonePtr->scale = 0.36f;
176 break;
178 PulseStonePtr->scale = 0.57f;
180 break;
181 case PULSE_STONE_HOLD:
182 PulseStonePtr->scale = 0.53f;
184 break;
185 }
186}
BSS s32 PopupMenu_SelectedIndex
s32 should_continue_pulse_stone(void)
Definition pulse_stone.c:50
PulseStoneData * PulseStonePtr
Definition pulse_stone.c:28
void(* PulseStoneNotificationCallback)(void)
Definition 77480.c:33
PlayerStatus gPlayerStatus
Definition 77480.c:38

Referenced by pulse_stone_notification_setup().

◆ should_cancel_pulse_stone()

s32 should_cancel_pulse_stone ( void )

Definition at line 32 of file pulse_stone.c.

32 {
35 s8 actionState = playerStatus->actionState;
36
37 if (actionState == ACTION_STATE_USE_TWEESTER) {
38 return TRUE;
39 }
40
41 if (partnerStatus->partnerActionState == PARTNER_ACTION_USE
42 && (partnerStatus->actingPartner == PARTNER_BOW || partnerStatus->actingPartner == PARTNER_PARAKARRY)
43 ) {
44 return TRUE;
45 }
46
47 return FALSE;
48}
@ PARTNER_ACTION_USE
Definition enums.h:2933
@ PARTNER_BOW
Definition enums.h:2894
@ PARTNER_PARAKARRY
Definition enums.h:2889
@ ACTION_STATE_USE_TWEESTER
Definition enums.h:2459
PartnerStatus gPartnerStatus
Definition partners.c:42

Referenced by should_continue_pulse_stone().

◆ should_continue_pulse_stone()

s32 should_continue_pulse_stone ( void )

Definition at line 50 of file pulse_stone.c.

50 {
52
54 && !(playerStatus->flags & PS_FLAG_PAUSED)
57 && !func_800E06D8()
58 ) {
59 // hardcoded map IDs assuming first 49 maps (in sbk) are a 7x7 grid
60 s32 dx = abs((gGameStatusPtr->mapID % 7) - 2);
61 s32 dy = gGameStatusPtr->mapID / 7;
62
63 if ((dx + dy) < 6) {
65 return TRUE;
66 }
67 }
68 }
69 return FALSE;
70}
@ PS_FLAG_PAUSED
Definition enums.h:3040
@ PA_FLAG_USING_PULSE_STONE
Definition enums.h:3098
s32 has_valid_conversation_npc(void)
Definition 77480.c:1110
s32 is_starting_conversation(void)
Definition encounter.c:2816
s32 func_800E06D8(void)
Definition 77480.c:1163
s32 should_cancel_pulse_stone(void)
Definition pulse_stone.c:32
GameStatus * gGameStatusPtr
Definition main_loop.c:31

Referenced by pulse_stone_notification_update().

◆ pulse_stone_notification_setup()

void pulse_stone_notification_setup ( void )

Definition at line 72 of file pulse_stone.c.

72 {
74
77 PulseStonePtr->pos.y = playerStatus->pos.y + playerStatus->colliderHeight + 8.0f;
81}
#define mem_clear
@ PA_FLAG_PULSE_STONE_VISIBLE
The pulse stone icon is being shown.
Definition enums.h:3097
void pulse_stone_notification_update(void)

Referenced by check_for_pulse_stone().

◆ appendGfx_pulse_stone_icon()

void appendGfx_pulse_stone_icon ( void )

Definition at line 83 of file pulse_stone.c.

83 {
87 s32 pingDelay;
88 s32 dx, dy;
89
92 guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
97
101
102 dx = abs((gGameStatusPtr->mapID % 7) - 2);
103 dy = gGameStatusPtr->mapID / 7;
104
105 switch (dx + dy) {
106 case 0:
107 pingDelay = 4;
108 break;
109 case 1:
110 pingDelay = 8;
111 break;
112 case 2:
113 pingDelay = 16;
114 break;
115 case 3:
116 pingDelay = 32;
117 break;
118 case 4:
119 pingDelay = 64;
120 break;
121 case 5:
122 pingDelay = 128;
123 break;
124 default:
125 pingDelay = -1;
127 break;
128 }
129
131 if (pingDelay >= 0) {
133 if (PulseStonePtr->pingTime >= pingDelay + 2) {
136 }
137 if (PulseStonePtr->pingTime < 2) {
139 } else {
141 }
142 }
143
147 ifxImg.xOffset = -28;
148 ifxImg.yOffset = 46;
149 ifxImg.alpha = 255;
152 }
153}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
@ SOUND_PULSE_STONE
Definition enums.h:646
@ SOUND_SPACE_DEFAULT
Definition enums.h:1737
s32 imgfx_appendGfx_component(s32, ImgFXTexture *, u32, Matrix4f)
Definition imgfx.c:703
void sfx_play_sound_at_player(s32 soundID, s32 arg1)
Definition sfx.c:521
Camera gCameras[4]
Definition cam_main.c:16
Gfx * gMainGfxPos
Definition cam_main.c:14
u16 gMatrixListPos
Definition main_loop.c:44
s32 gCurrentCameraID
Definition cam_math.c:5
DisplayContext * gDisplayContext
Definition cam_main.c:15

Referenced by render_pulse_stone_icon().

Variable Documentation

◆ PulseStoneNotification

BSS PulseStoneData PulseStoneNotification

Definition at line 27 of file pulse_stone.c.

◆ PulseStonePtr