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

Go to the source code of this file.

Data Structures

struct  ISpyNotification
 

Enumerations

enum  { I_SPY_DELAY = 0 , I_SPY_APPEAR = 1 , I_SPY_OVERSHOOT = 2 , I_SPY_ANIMATE = 3 }
 

Functions

 INCLUDE_IMG ("ispy_icon.png", ispy_icon_img)
 
 INCLUDE_PAL ("ispy_icon.pal", ispy_icon_1_pal)
 
 INCLUDE_PAL ("ispy_icon.2.pal", ispy_icon_2_pal)
 
 INCLUDE_PAL ("ispy_icon.3.pal", ispy_icon_3_pal)
 
void ispy_notification_update (void)
 
void appendGfx_ispy_icon (void)
 
void ispy_notification_setup (void)
 

Variables

BSS ISpyNotification ISpyData
 
ISpyNotificationISpyPtr = &ISpyData
 

Data Structure Documentation

◆ ISpyNotification

struct ISpyNotification
Data Fields
Vec3f pos
f32 scale
char unk_10[8]
s32 time
char unk_1C[4]
s32 flashCount
s32 state
s32 alpha

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
I_SPY_DELAY 
I_SPY_APPEAR 
I_SPY_OVERSHOOT 
I_SPY_ANIMATE 

Definition at line 15 of file i_spy.c.

15 {
16 I_SPY_DELAY = 0, // icon waits to appear when entering map under certain conditions
17 I_SPY_APPEAR = 1, // icon appears
18 I_SPY_OVERSHOOT = 2, // icon scale overshoots before it begins animating
19 I_SPY_ANIMATE = 3, // icon blinks for a second and a half and then vanishes
20};
@ I_SPY_ANIMATE
Definition i_spy.c:19
@ I_SPY_DELAY
Definition i_spy.c:16
@ I_SPY_OVERSHOOT
Definition i_spy.c:18
@ I_SPY_APPEAR
Definition i_spy.c:17

Function Documentation

◆ INCLUDE_IMG()

INCLUDE_IMG ( "ispy_icon.png" ,
ispy_icon_img  )

◆ INCLUDE_PAL() [1/3]

INCLUDE_PAL ( "ispy_icon.pal" ,
ispy_icon_1_pal  )

◆ INCLUDE_PAL() [2/3]

INCLUDE_PAL ( "ispy_icon.2.pal" ,
ispy_icon_2_pal  )

◆ INCLUDE_PAL() [3/3]

INCLUDE_PAL ( "ispy_icon.3.pal" ,
ispy_icon_3_pal  )

◆ ispy_notification_update()

void ispy_notification_update ( void )

Definition at line 104 of file i_spy.c.

104 {
105 PlayerStatus* playerStatus = &gPlayerStatus;
106 PartnerStatus* partnerStatus = &gPartnerStatus;
107 s32 cond;
108
109 ISpyPtr->pos.y +=
110 (playerStatus->pos.y + playerStatus->colliderHeight + 10.0f - ISpyPtr->pos.y) / 1.5f;
111 ISpyPtr->pos.x = playerStatus->pos.x;
112 ISpyPtr->pos.z = playerStatus->pos.z;
113
114 switch (ISpyPtr->state) {
115 case I_SPY_DELAY:
116 if (partnerStatus->partnerActionState != PARTNER_ACTION_NONE
117 && partnerStatus->actingPartner == PARTNER_LAKILESTER
118 ) {
120 } else {
122 }
123
124 if (!cond) {
125 ISpyPtr->state++;
126 }
127 break;
128 case I_SPY_APPEAR:
129 if (playerStatus->flags & PS_FLAG_PAUSED) {
131 return;
132 }
133
134 if (ISpyPtr->time++ >= 16) {
135 ISpyPtr->scale = 0.36f;
136 ISpyPtr->state++;
137 }
138 break;
139 case I_SPY_OVERSHOOT:
140 ISpyPtr->scale = 0.57f;
141 ISpyPtr->state++;
143 break;
144 case I_SPY_ANIMATE:
145 ISpyPtr->scale = 0.53f;
146 if (ISpyPtr->time >= 47 || playerStatus->flags & PS_FLAG_PAUSED) {
147 ISpyPtr->alpha -= 64;
148 if (ISpyPtr->alpha < 0) {
149 ISpyPtr->alpha = 0;
150 ISpyPtr->time = 51;
151 }
152 }
153
154 if (ISpyPtr->time++ > 50) {
157 playerStatus->animFlags &= ~PA_FLAG_ISPY_VISIBLE;
158 }
159 break;
160 }
161}
b8 keepUsingPartnerOnMapChange
@ PS_FLAG_PAUSED
Definition enums.h:3040
@ PS_FLAG_NO_STATIC_COLLISION
Definition enums.h:3051
@ PS_FLAG_INPUT_DISABLED
Definition enums.h:3052
@ PARTNER_ACTION_NONE
Definition enums.h:2932
@ SOUND_ISPY
Definition enums.h:798
@ PARTNER_LAKILESTER
Definition enums.h:2893
@ SOUND_SPACE_DEFAULT
Definition enums.h:1737
Vec3f pos
Definition i_spy.c:5
ISpyNotification * ISpyPtr
Definition i_spy.c:30
void sfx_play_sound_at_player(s32 soundID, s32 arg1)
Definition sfx.c:521
PartnerStatus gPartnerStatus
Definition partners.c:42
GameStatus * gGameStatusPtr
Definition main_loop.c:32
PlayerStatus gPlayerStatus
Definition 77480.c:39
void(* ISpyNotificationCallback)(void)
Definition 77480.c:33
HiddenPanelsData gCurrentHiddenPanels
Definition entity.c:36

Referenced by ispy_notification_setup().

◆ appendGfx_ispy_icon()

void appendGfx_ispy_icon ( void )

Definition at line 34 of file i_spy.c.

34 {
35 Matrix4f matrix1;
36 Matrix4f matrix2;
37 ImgFXTexture ifxImg;
38 s32 flashPhase;
39
42 guRotateF(matrix2, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
43 guMtxCatF(matrix1, matrix2, matrix1);
45 guMtxCatF(matrix1, matrix2, matrix2);
47
49 gSPDisplayList(gMainGfxPos++, ispy_icon_gfx);
50
51 if (ISpyPtr->time < 47) {
53 }
54
55 flashPhase = ISpyPtr->flashCount;
56 flashPhase = flashPhase % 12;
57 switch (flashPhase) {
58 case 0:
59 case 1:
60 case 2:
61 case 3:
62 ifxImg.palette = ispy_icon_1_pal;
63 break;
64 case 4:
65 case 5:
66 case 6:
67 case 7:
68 ifxImg.palette = ispy_icon_2_pal;
69 break;
70 case 8:
71 case 9:
72 case 10:
73 case 11:
74 ifxImg.palette = ispy_icon_3_pal;
75 break;
76 }
77 imgfx_update(0, IMGFX_SET_ALPHA, 255, 255, 255, ISpyPtr->alpha, 0);
78
79 ifxImg.raster = ispy_icon_img;
80 ifxImg.width = ispy_icon_img_width;
81 ifxImg.height = ispy_icon_img_height;
82 ifxImg.xOffset = -28;
83 ifxImg.yOffset = 46;
84 ifxImg.alpha = 255;
85
86 imgfx_appendGfx_component(0, &ifxImg, 0, matrix2);
87 gSPPopMatrix(gMainGfxPos++, 0);
88 }
89}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
@ IMGFX_SET_ALPHA
Definition enums.h:5124
@ PA_FLAG_ISPY_VISIBLE
The I Spy icon is being shown.
Definition enums.h:3099
s32 imgfx_appendGfx_component(s32, ImgFXTexture *, u32, Matrix4f)
Definition imgfx.c:704
void imgfx_update(u32, ImgFXType, s32, s32, s32, s32, s32)
Definition imgfx.c:487
Camera gCameras[4]
Definition cam_main.c:17
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
s32 gCurrentCameraID
Definition cam_math.c:4
DisplayContext * gDisplayContext
Definition cam_main.c:16

Referenced by render_ispy_icon().

◆ ispy_notification_setup()

void ispy_notification_setup ( void )

Definition at line 91 of file i_spy.c.

91 {
92 mem_clear(ISpyPtr, sizeof(*ISpyPtr));
93
97
98 ISpyPtr->alpha = 255;
99
102}
#define mem_clear
void ispy_notification_update(void)
Definition i_spy.c:104

Referenced by check_for_ispy().

Variable Documentation

◆ ISpyData

Definition at line 29 of file i_spy.c.

◆ ISpyPtr