Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
speech_bubble.c
Go to the documentation of this file.
1#include "common.h"
2#include "include_asset.h"
3
4#define NAMESPACE speech_bubble
5
6enum {
11};
12
13#include "speech_bubble.png.h"
14INCLUDE_IMG("speech_bubble.png", speech_bubble_img);
15INCLUDE_PAL("speech_bubble.pal", speech_bubble_pal);
16#include "speech_bubble.gfx.inc.c"
17
20
22
23void interact_speech_update(void);
24
47
49 ImgFXTexture ifxImg;
50 Matrix4f mtxTemp, mtxTransform;
51
54 guRotateF(mtxTransform, SpeechBubblePtr->yaw - gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
55 guMtxCatF(mtxTemp, mtxTransform, mtxTemp);
57 guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
59
61 G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
62 gSPDisplayList(gMainGfxPos++, &speech_bubble_gfx);
63
64 ifxImg.raster = speech_bubble_img;
65 ifxImg.palette = speech_bubble_pal;
66 ifxImg.width = speech_bubble_img_width;
67 ifxImg.height = speech_bubble_img_height;
68 ifxImg.xOffset = -16;
69 ifxImg.yOffset = 26;
70 ifxImg.alpha = 255;
74 imgfx_appendGfx_component(0, &ifxImg, IMGFX_FLAG_40, mtxTransform);
75
76 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
77 }
78}
79
81 PlayerStatus* playerStatus = &gPlayerStatus;
82 s32 brightness = 255;
83 f32 yaw;
84 Npc* npc;
85
89 || playerStatus->animFlags & PA_FLAG_USING_WATT
90 || playerStatus->inputDisabledCount != 0
91 || playerStatus->animFlags & PA_FLAG_SPINNING
92 ) {
94 }
95
96 switch (SpeechBubblePtr->state) {
98 SpeechBubblePtr->yaw = 0.0f;
99 SpeechBubblePtr->scale += 0.05;
100 if (SpeechBubblePtr->scale >= 0.55) {
101 SpeechBubblePtr->scale = 0.55f;
104 }
105 break;
107 SpeechBubblePtr->yaw = 0.0f;
109 if (SpeechBubblePtr->holdTime <= 0) {
111 }
112 break;
114 yaw = SpeechBubblePtr->yaw;
115 yaw += 10.0f;
116 if (yaw >= 360.0f) {
117 yaw -= 360.0f;
118 }
119 SpeechBubblePtr->yaw = yaw;
120 brightness = N(GetIconBrightnessForAngle)(yaw);
121 break;
123 yaw = SpeechBubblePtr->yaw;
124 yaw += 25.0f;
125 if (yaw >= 360.0f) {
126 yaw -= 360.0f;
127 }
128 SpeechBubblePtr->yaw = yaw;
129 if ((yaw >= 70.0f && yaw <= 110.0f) || (yaw >= 250.0f && yaw <= 290.0f)) {
130 // only dimiss when the icon is rotated away from view
132 playerStatus->encounteredNPC = NULL;
133 playerStatus->animFlags &= ~PA_FLAG_SPEECH_PROMPT_AVAILABLE;
134 return;
135 }
136 brightness = N(GetIconBrightnessForAngle)(yaw);
137 break;
138 }
139
140 SpeechBubblePtr->brightness = brightness;
141 if (playerStatus->encounteredNPC != NULL) {
142 if (playerStatus->encounteredNPC != SpeechBubblePtr->encounteredNPC) {
144 }
145 }
146
149 SpeechBubblePtr->pos.x = npc->pos.x;
150 SpeechBubblePtr->pos.z = npc->pos.z;
151}
s32 N GetIconBrightnessForAngle(f32 angle)
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define mem_clear
#define guScaleF
@ IMGFX_SET_COLOR
Definition enums.h:5123
@ IMGFX_CLEAR
Definition enums.h:5117
@ PS_FLAG_PAUSED
Definition enums.h:3040
@ PS_FLAG_ENTERING_BATTLE
Definition enums.h:3061
@ PS_FLAG_HAS_CONVERSATION_NPC
Definition enums.h:3074
@ PA_FLAG_SPEECH_PROMPT_AVAILABLE
(...) prompt
Definition enums.h:3096
@ PA_FLAG_SPINNING
Definition enums.h:3107
@ PA_FLAG_USING_WATT
Definition enums.h:3090
@ ENCOUNTER_STATE_CONVERSATION
Definition enums.h:6298
@ IMGFX_FLAG_40
Definition enums.h:5099
@ IMGFX_FLAG_400
Definition enums.h:5103
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
#define INCLUDE_PAL(FILENAME, SYMBOLNAME)
#define INCLUDE_IMG(FILENAME, SYMBOLNAME)
#define BSS
Definition macros.h:7
void interact_speech_update(void)
@ SPEECH_BUBBLE_HOLD
@ SPEECH_BUBBLE_APPEAR
@ SPEECH_BUBBLE_VANISH
@ SPEECH_BUBBLE_IDLE
void appendGfx_speech_bubble(void)
void interact_speech_setup(void)
SpeechBubbleData * SpeechBubblePtr
BSS SpeechBubbleData SpeechBubble
s16 collisionHeight
Vec3f pos
void(* TalkNotificationCallback)(void)
Definition 77480.c:35
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
s32 gEncounterState
Definition encounter.c:174
DisplayContext * gDisplayContext
Definition cam_main.c:16