Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
i_spy.c
Go to the documentation of this file.
1#include "common.h"
2#include "include_asset.h"
3
4typedef struct ISpyNotification {
5 /* 0x00 */ Vec3f pos;
6 /* 0x0C */ f32 scale;
7 /* 0x10 */ char unk_10[8];
8 /* 0x18 */ s32 time;
9 /* 0x1C */ char unk_1C[4];
10 /* 0x20 */ s32 flashCount;
11 /* 0x24 */ s32 state;
12 /* 0x28 */ s32 alpha;
14
15enum {
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};
21
22#include "ispy_icon.png.h"
23INCLUDE_IMG("ispy_icon.png", ispy_icon_img);
24INCLUDE_PAL("ispy_icon.pal", ispy_icon_1_pal);
25INCLUDE_PAL("ispy_icon.2.pal", ispy_icon_2_pal);
26INCLUDE_PAL("ispy_icon.3.pal", ispy_icon_3_pal);
27#include "ispy_icon.gfx.inc.c"
28
31
33
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}
90
103
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}
162
163
b8 keepUsingPartnerOnMapChange
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define mem_clear
#define guScaleF
@ IMGFX_SET_ALPHA
Definition enums.h:5124
@ 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
@ PA_FLAG_ISPY_VISIBLE
The I Spy icon is being shown.
Definition enums.h:3099
@ SOUND_ISPY
Definition enums.h:798
@ PARTNER_LAKILESTER
Definition enums.h:2893
@ SOUND_SPACE_DEFAULT
Definition enums.h:1737
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
char unk_1C[4]
Definition i_spy.c:9
Vec3f pos
Definition i_spy.c:5
void appendGfx_ispy_icon(void)
Definition i_spy.c:34
void ispy_notification_update(void)
Definition i_spy.c:104
@ 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
char unk_10[8]
Definition i_spy.c:7
BSS ISpyNotification ISpyData
Definition i_spy.c:29
ISpyNotification * ISpyPtr
Definition i_spy.c:30
void ispy_notification_setup(void)
Definition i_spy.c:91
#define INCLUDE_PAL(FILENAME, SYMBOLNAME)
#define INCLUDE_IMG(FILENAME, SYMBOLNAME)
void sfx_play_sound_at_player(s32 soundID, s32 arg1)
Definition sfx.c:521
#define BSS
Definition macros.h:7
PartnerStatus gPartnerStatus
Definition partners.c:42
GameStatus * gGameStatusPtr
Definition main_loop.c:32
Camera gCameras[4]
Definition cam_main.c:17
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
PlayerStatus gPlayerStatus
Definition 77480.c:39
s32 gCurrentCameraID
Definition cam_math.c:4
void(* ISpyNotificationCallback)(void)
Definition 77480.c:33
DisplayContext * gDisplayContext
Definition cam_main.c:16
HiddenPanelsData gCurrentHiddenPanels
Definition entity.c:36