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

Go to the source code of this file.

Enumerations

enum  { SPEECH_BUBBLE_APPEAR = 0 , SPEECH_BUBBLE_HOLD = 1 , SPEECH_BUBBLE_IDLE = 2 , SPEECH_BUBBLE_VANISH = 3 }
 

Functions

 INCLUDE_IMG ("speech_bubble.png", speech_bubble_img)
 
 INCLUDE_PAL ("speech_bubble.pal", speech_bubble_pal)
 
void interact_speech_update (void)
 
void interact_speech_setup (void)
 
void appendGfx_speech_bubble (void)
 

Variables

BSS SpeechBubbleData SpeechBubble
 
SpeechBubbleDataSpeechBubblePtr = &SpeechBubble
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SPEECH_BUBBLE_APPEAR 
SPEECH_BUBBLE_HOLD 
SPEECH_BUBBLE_IDLE 
SPEECH_BUBBLE_VANISH 

Definition at line 6 of file speech_bubble.c.

6 {
11};
@ SPEECH_BUBBLE_HOLD
@ SPEECH_BUBBLE_APPEAR
@ SPEECH_BUBBLE_VANISH
@ SPEECH_BUBBLE_IDLE

Function Documentation

◆ INCLUDE_IMG()

INCLUDE_IMG ( "speech_bubble.png" ,
speech_bubble_img  )

◆ INCLUDE_PAL()

INCLUDE_PAL ( "speech_bubble.pal" ,
speech_bubble_pal  )

◆ interact_speech_update()

void interact_speech_update ( void )

Definition at line 80 of file speech_bubble.c.

80 {
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)
@ 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_SPINNING
Definition enums.h:3107
@ PA_FLAG_USING_WATT
Definition enums.h:3090
@ ENCOUNTER_STATE_CONVERSATION
Definition enums.h:6298
SpeechBubbleData * SpeechBubblePtr
s16 collisionHeight
Vec3f pos
void(* TalkNotificationCallback)(void)
Definition 77480.c:35
PlayerStatus gPlayerStatus
Definition 77480.c:39
s32 gEncounterState
Definition encounter.c:174

Referenced by interact_speech_setup().

◆ interact_speech_setup()

void interact_speech_setup ( void )

Definition at line 25 of file speech_bubble.c.

25 {
26 PlayerStatus* playerStatus = &gPlayerStatus;
27 SpeechBubbleData* temp;
28 Npc* npc;
29
31 npc = playerStatus->encounteredNPC;
34 SpeechBubblePtr->pos.x = npc->pos.x;
35 SpeechBubblePtr->pos.z = npc->pos.z;
38 SpeechBubblePtr->scale = 0.1f;
41 temp = SpeechBubblePtr;
42 temp->state = 0;
43 temp->scale = 0.4f;
46}
#define mem_clear
@ PA_FLAG_SPEECH_PROMPT_AVAILABLE
(...) prompt
Definition enums.h:3096
void interact_speech_update(void)
Camera gCameras[4]
Definition cam_main.c:17
s32 gCurrentCameraID
Definition cam_math.c:4

Referenced by check_for_conversation_prompt().

◆ appendGfx_speech_bubble()

void appendGfx_speech_bubble ( void )

Definition at line 48 of file speech_bubble.c.

48 {
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}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
@ IMGFX_SET_COLOR
Definition enums.h:5123
@ IMGFX_CLEAR
Definition enums.h:5117
@ 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
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
DisplayContext * gDisplayContext
Definition cam_main.c:16

Referenced by render_conversation_prompt().

Variable Documentation

◆ SpeechBubble

BSS SpeechBubbleData SpeechBubble

Definition at line 18 of file speech_bubble.c.

◆ SpeechBubblePtr