Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
pause_partners.c
Go to the documentation of this file.
1#include "pause_common.h"
2#include "message_ids.h"
3#include "hud_element.h"
4#include "sprite.h"
5#include "sprite/npc/WorldGoombario.h"
6#include "sprite/npc/WorldKooper.h"
7#include "sprite/npc/WorldBombette.h"
8#include "sprite/npc/WorldParakarry.h"
9#include "sprite/npc/WorldBow.h"
10#include "sprite/npc/WorldWatt.h"
11#include "sprite/npc/WorldSushie.h"
12#include "sprite/npc/WorldLakilester.h"
13
14extern s8 gPauseBufferPal1[512];
15extern s8 gPauseBufferImg1[15752];
16extern s8 gPauseBufferPal2[512];
17extern s8 gPauseBufferImg2[15752];
18
19void pause_partners_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening);
20void pause_partners_draw_title(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening);
21void pause_partners_draw_movelist(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening);
22void pause_partners_draw_movelist_title(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening);
23void pause_partners_draw_movelist_flower(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening);
28
29static s32 gPausePartnersIconIDs[8];
30static s32 gPausePartnersSpriteIDs[8];
31static s32 gPausePartnersPartnerIdx[8];
32static s32 gPausePartnersCurrentPartnerIdx;
33static s32 gPausePartnersSelectedMove;
34static f32 gPausePartnersRotAngle;
35static s32 gPausePartnersLevel;
36static s32 gPausePartnersNumPartners;
37
38#if VERSION_PAL
39extern HudScript HES_FPCost_de;
40extern HudScript HES_FPCost_fr;
41extern HudScript HES_FPCost_es;
42
43extern u8 D_PAL_80271B38[];
44extern u8 D_PAL_80271B3C[];
45extern u8 D_PAL_80271B40[];
46extern u8 D_PAL_80271B44[];
47extern u8 D_PAL_80271B48[];
48extern u8 D_PAL_80271B4C[];
49extern u8 D_PAL_80271B50[];
50#endif
51
72
74 .vp = {
75 .vscale = { 640, 480, 511, 0 },
76 .vtrans = { 640, 480, 511, 0 },
77 }
78};
79
81 {
82 ANIM_WorldGoombario_Still,
83 ANIM_WorldGoombario_Walk,
84 ANIM_WorldGoombario_Talk,
86 },
87 {
88 ANIM_WorldKooper_Still,
89 ANIM_WorldKooper_Walk,
90 ANIM_WorldKooper_Talk,
92 },
93 {
94 ANIM_WorldBombette_Still,
95 ANIM_WorldBombette_Walk,
96 ANIM_WorldBombette_Talk,
98 },
99 {
100 ANIM_WorldParakarry_Still,
101 ANIM_WorldParakarry_Walk,
102 ANIM_WorldParakarry_Talk,
104 },
105 {
106 ANIM_WorldBow_Still,
107 ANIM_WorldBow_Walk,
108 ANIM_WorldBow_Talk,
110 },
111 {
112 ANIM_WorldWatt_Still,
113 ANIM_WorldWatt_Walk,
114 ANIM_WorldWatt_Talk,
116 },
117 {
118 ANIM_WorldSushie_Still,
119 ANIM_WorldSushie_Walk,
120 ANIM_WorldSushie_Talk,
122 },
123 {
124 ANIM_WorldLakilester_Still,
125 ANIM_WorldLakilester_Walk,
126 ANIM_WorldLakilester_Talk,
128 }
129};
130
141
143 MSG_PartnerDesc_Goombario_Pause,
144 MSG_PartnerDesc_Kooper_Pause,
145 MSG_PartnerDesc_Bombette_Pause,
146 MSG_PartnerDesc_Parakarry_Pause,
147 MSG_PartnerDesc_Bow_Pause,
148 MSG_PartnerDesc_Watt_Pause,
149 MSG_PartnerDesc_Sushie_Pause,
150 MSG_PartnerDesc_Lakilester_Pause
151};
152
154 MOVE_HEADBONK1,
155 MOVE_SHELL_TOSS1,
156 MOVE_BODY_SLAM1,
157 MOVE_SKY_DIVE1,
158 MOVE_SMACK1,
159 MOVE_ELECTRO_DASH1,
160 MOVE_BELLY_FLOP1,
161 MOVE_SPINY_FLIP1
162};
163
165 4, 5, 6, 7,
166 0, 1, 2, 3
167};
168
170 "party_kurio",
171 "party_kameki",
172 "party_pinki",
173 "party_pareta",
174 "party_resa",
175 "party_akari",
176 "party_opuku",
177 "party_pokopi",
178 "letter_peach"
179};
180
185 gsDPPipeSync(),
186 gsSPTexture(-1, -1, 0, G_TX_RENDERTILE, G_ON),
187 gsDPSetCycleType(G_CYC_1CYCLE),
188 gsDPSetTexturePersp(G_TP_NONE),
189 gsDPSetTextureDetail(G_TD_CLAMP),
190 gsDPSetTextureLOD(G_TL_TILE),
191 gsDPSetTextureLUT(G_TT_RGBA16),
192 gsDPSetTextureFilter(G_TF_POINT),
193 gsDPSetTextureConvert(G_TC_FILT),
194 gsDPSetRenderMode(G_RM_OPA_SURF, G_RM_OPA_SURF2),
195 gsDPSetCombineMode(PM_CC_0F, PM_CC_0F),
196 gsSPClearGeometryMode(G_LIGHTING),
197 gsSPSetGeometryMode(G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH),
198 gsSPEndDisplayList()
199};
203 {
205 .unk_01 = 0,
206 .pos = { .x = 3, .y = 16 },
207 .width = 289,
208 .height = 154,
209 .priority = WINDOW_PRIORITY_1,
210 .fpDrawContents = &pause_partners_draw_contents,
211 .tab = NULL,
212 .parentID = WIN_PAUSE_MAIN,
213 .fpUpdate = { WINDOW_UPDATE_HIDE },
214 .extraFlags = 0,
215 .style = { .customStyle = &gPauseWS_20 }
216 }, {
217 .windowID = WIN_PAUSE_PARTNERS_TITLE,
218 .unk_01 = 0,
219 .pos = { .x = 8, .y = 103 },
220 .width = 112,
221 .height = 20,
222 .priority = WINDOW_PRIORITY_0,
223 .fpDrawContents = &pause_partners_draw_title,
224 .tab = NULL,
225 .parentID = WIN_PAUSE_PARTNERS,
226 .fpUpdate = { WINDOW_UPDATE_SHOW },
227 .extraFlags = 0,
228 .style = { .customStyle = &gPauseWS_22 }
229 }, {
230 .windowID = WIN_PAUSE_PARTNERS_MOVELIST,
231 .unk_01 = 0,
232 .pos = { .x = 133, .y = 36 },
233 .width = 140,
234 .height = 80,
235 .priority = WINDOW_PRIORITY_0,
236 .fpDrawContents = &pause_partners_draw_movelist,
237 .tab = NULL,
238 .parentID = WIN_PAUSE_PARTNERS,
239 .fpUpdate = { WINDOW_UPDATE_HIDE },
240 .extraFlags = 0,
241 .style = { -1 }
242 }, {
244 .unk_01 = 0,
245 .pos = { .x = 12, .y = -6 },
246 .width = 80,
247 .height = 16,
248 .priority = WINDOW_PRIORITY_0,
249 .fpDrawContents = &pause_partners_draw_movelist_title,
250 .tab = NULL,
251 .parentID = WIN_PAUSE_PARTNERS_MOVELIST,
252 .fpUpdate = { WINDOW_UPDATE_SHOW },
253 .extraFlags = 0,
254 .style = { -1 }
255 }, {
257 .unk_01 = 0,
258 .pos = { .x = 102, .y = -12 },
259 .width = 32,
260 .height = 32,
261 .priority = WINDOW_PRIORITY_0,
262 .fpDrawContents = &pause_partners_draw_movelist_flower,
263 .tab = NULL,
264 .parentID = WIN_PAUSE_PARTNERS_MOVELIST,
265 .fpUpdate = { WINDOW_UPDATE_SHOW },
266 .extraFlags = 0,
267 .style = { -1 }
268 }
269};
270u8 gPausePartnersPortraitScrollInterpTable[] = {0, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8 };
272 .initialized = FALSE,
273 .col = 0,
274 .row = 1,
275 .selected = 0,
276 .state = 0,
277 .numCols = 4,
278 .numRows = 2,
279 .numPages = 0,
280 .gridData = gPausePartnersGridData,
281 .fpInit = &pause_partners_init,
282 .fpHandleInput = &pause_partners_handle_input,
283 .fpUpdate = &pause_partners_update,
284 .fpCleanup = &pause_partners_cleanup
285};
286
287typedef struct PartnerPosition {
288 /* 0x00 */ f32 pos;
289 /* 0x04 */ s32 index;
290} PartnerPosition; // size = 0x8
291
293 s32 size;
294 void* asset;
295
296 if (gPausePartnersCurrentPortraitIndex != gPausePartnersPartnerIdx[index]) {
297 gPausePartnersCurrentPortraitIndex = gPausePartnersPartnerIdx[index];
300 general_heap_free(asset);
301 }
302
303 if (gPausePartnersNextPortraitIndex != gPausePartnersPartnerIdx[(index + 1) % gPausePartnersNumPartners]) {
304 gPausePartnersNextPortraitIndex = gPausePartnersPartnerIdx[(index + 1) % gPausePartnersNumPartners];
307 general_heap_free(asset);
308 }
309}
310
311void pause_partners_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
312 Matrix4f matrix;
313 Matrix4f matrix2;
314 PartnerPosition partnerPositions[8];
315 s32 i, j, k, index;
316 s32 x1, y1, x2, y2;
317 f32 currentPos, angle, scale;
318 f32 offsetX, offsetY, offsetZ;
319 s32 color;
320 s8 currentTab;
321 s32 portraitScrollPos;
322 s32 portraitScrollIndex;
323 s32 tileHeight;
324 s32 portraitOffsetX;
325 s32 portraitIndex;
326
327 gSPViewport(gMainGfxPos++, &gPausePartnersViewport);
328 guOrthoF(matrix, 0.0f, 320.0f, 240.0f, 0.0f, -100.0f, 100.0f, 1.0f);
330 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
331 guTranslateF(matrix, 0.0f, 0.0f, 0.0f);
333 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
334
335 for (i = 0; i < gPausePartnersNumPartners; i++) {
336 currentPos = cos_deg(i * 360 / gPausePartnersNumPartners - gPausePartnersRotAngle) * 20.0f + 0.0f;
337
338 for (j = 0; j < i; j++) {
339 if (currentPos < partnerPositions[j].pos) {
340 break;
341 }
342 }
343
344 for (k = gPausePartnersNumPartners - 1; k > j; k--) {
345 partnerPositions[k] = partnerPositions[k-1];
346 }
347
348 partnerPositions[j].index = i;
349 partnerPositions[j].pos = currentPos;
350 }
351
352 for (j = 0; j < gPausePartnersNumPartners; j++) {
353 portraitIndex = gPausePartnersNumPartners;
354 index = partnerPositions[j].index;
355 angle = index * 360 / gPausePartnersNumPartners - gPausePartnersRotAngle;
356 offsetX = gPausePartnersNumPartners * 3 + 17;
357 offsetX *= sin_deg(angle);
358 offsetX += 42.0f;
359 offsetZ = 30.0f - cos_deg(angle) * 30.0f;
360 offsetY = cos_deg(angle) * 20.0f + 0.0f;
361 scale = 30.0 / (offsetZ + 60.0f) + 0.5;
362
363 guTranslateF(matrix, baseX + 22 + offsetX, baseY + 81 + offsetY, -offsetZ);
364 guRotateF(matrix2, 180.0f, 0.0f, 0.0f, 1.0f);
365 guMtxCatF(matrix2, matrix, matrix);
366 guScaleF(matrix2, scale, scale, 1.0f);
367 guMtxCatF(matrix2, matrix, matrix);
368
369 if (offsetZ > 8.0f) {
370 color = 160;
371 } else {
372 color = 255.0f - offsetZ * 95.0f * 0.125f;
373 }
374 set_npc_imgfx_all(gPausePartnersSpriteIDs[gPausePartnersPartnerIdx[index]], IMGFX_SET_COLOR, color, color, color, 255, 64);
375 spr_draw_npc_sprite(gPausePartnersSpriteIDs[gPausePartnersPartnerIdx[index]], 0, 0, NULL, matrix);
376 }
377
378 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
379
380 currentTab = gPauseMenuCurrentTab;
381 if (currentTab == 4) {
382 if (gPausePartnersLevel == 0) {
383 pause_set_cursor_pos(WIN_PAUSE_PARTNERS, baseX + 42, baseY + 88);
384 }
385
386 if (gPauseMenuCurrentTab == currentTab && gPausePartnersLevel == 0) {
388 }
389 }
390
391 x1 = baseX + 130;
392 y1 = baseY + 24;
393 x2 = baseX + 280;
394 y2 = baseY + 129;
395
396 if (x1 <= 0) {
397 x1 = 1;
398 }
399 if (y1 <= 0) {
400 y1 = 1;
401 }
402
403 if (x2 <= 0 || y2 <= 0 || x1 >= SCREEN_WIDTH - 1 || y1 >= SCREEN_HEIGHT - 1) {
404 return;
405 }
406
407 if (x2 >= SCREEN_WIDTH - 1) {
408 x2 = SCREEN_WIDTH - 1;
409 }
410 if (y2 >= SCREEN_HEIGHT - 1) {
411 y2 = SCREEN_HEIGHT - 1;
412 }
413
414 portraitScrollPos = (gPausePartnersRotAngle + 360.0f) * 15000.0f * gPausePartnersNumPartners / 360.0f;
415 portraitScrollIndex = portraitScrollPos / 15000;
416 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, x1, y1, x2, y2);
417 portraitOffsetX = (portraitScrollIndex * 15000 - portraitScrollPos);
418 portraitOffsetX *= 0.01;
419 portraitIndex = portraitScrollIndex;
420 pause_partners_load_portrait(portraitIndex % gPausePartnersNumPartners);
421 for (i = 0; i < ARRAY_COUNT(gPausePartnersPaletteBuffers); portraitOffsetX += 150, i++) {
422 gSPDisplayList(gMainGfxPos++, &gPausePartnersDL);
423 gDPLoadTLUT_pal256(gMainGfxPos++, gPausePartnersPaletteBuffers[i]);
424
425 for (index = 0; index < 20; index++) {
426 if (12 * index + 12 <= 105) {
427 tileHeight = 12;
428 } else {
429 tileHeight = 106 - 12 * index;
430 }
431
432 gDPLoadTextureTile(gMainGfxPos++, gPausePartnersImageBuffers[i], G_IM_FMT_CI, G_IM_SIZ_8b, 150, 0,
433 0, 12 * index, 149, 12 * index + tileHeight - 1, 0,
434 G_TX_CLAMP, G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
435 pause_draw_rect((baseX + 130 + portraitOffsetX) * 4, (baseY + 24 + 12 * index) * 4, (baseX + 280 + portraitOffsetX) * 4, (baseY + 24 + 12 * index + tileHeight) * 4, 0, 0,
436 12 * index * 32, 0x400, 0x400);
437 gDPPipeSync(gMainGfxPos++);
438 if (12 * index + 12 >= 105) {
439 break;
440 }
441 }
442 }
443 {
444 s32 x1, y1, x2, y2;
445 x1 = baseX + 122;
446 y1 = baseY + 16;
447 x2 = baseX + 288;
448 y2 = baseY + 137;
449
450 if (x1 <= 0) {
451 x1 = 1;
452 }
453 if (y1 <= 0) {
454 y1 = 1;
455 }
456
457 if (x2 <= 0 || y2 <= 0 || x1 >= SCREEN_WIDTH - 1 || y1 >= SCREEN_HEIGHT - 1) {
458 return;
459 }
460
461 if (x2 >= SCREEN_WIDTH - 1) {
462 x2 = SCREEN_WIDTH - 1;
463 }
464 if (y2 >= SCREEN_HEIGHT - 1) {
465 y2 = SCREEN_HEIGHT - 1;
466 }
467
468 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, x1, y1, x2, y2);
469 }
470 draw_box(0, &gPauseWS_21, baseX + 122, baseY + 16, 0, 166, 121, opacity, darkening, 1.0f, 1.0f, 0, 0, 0, 0, 0, 0, width, height, 0);
471}
472
473void pause_partners_draw_title(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
474 s32 msgID = gPartnerPopupProperties[gPausePartnersPartnerIDs[gPausePartnersPartnerIdx[gPausePartnersCurrentPartnerIdx]]].nameMsg;
475 s32 level = gPlayerData.partners[gPausePartnersPartnerIDs[gPausePartnersPartnerIdx[gPausePartnersCurrentPartnerIdx]]].level;
476 s32 msgWidth = get_msg_width(msgID, 0);
477 s32 offset;
478
479 if (level == PARTNER_RANK_SUPER) {
480 offset = 16;
481 } else if (level == PARTNER_RANK_ULTRA) {
482 offset = 20;
483 } else {
484 offset = 0;
485 }
486
487 if (offset != 0) {
488 msgWidth += 4;
489 }
490
491 draw_msg(msgID, baseX + ((width - offset - msgWidth) >> 1), baseY + 1, 255, MSG_PAL_WHITE, 0);
492
493 if (level == 1) {
494 hud_element_set_render_pos(gPausePartnersIconIDs[2], baseX + 95, baseY + 10);
495 hud_element_draw_without_clipping(gPausePartnersIconIDs[2]);
496 } else if (level == 2) {
497 hud_element_set_render_pos(gPausePartnersIconIDs[2], baseX + 91, baseY + 10);
498 hud_element_draw_without_clipping(gPausePartnersIconIDs[2]);
499 hud_element_set_render_pos(gPausePartnersIconIDs[3], baseX + 101, baseY + 10);
500 hud_element_draw_without_clipping(gPausePartnersIconIDs[3]);
501 }
502}
503
504void pause_partners_draw_movelist(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
505 s32 i;
506 s32 moveNameID;
507 s32 costFP;
508 s32 msgX, msgY;
509 s32 style;
510 s32 level = gPlayerData.partners[gPausePartnersPartnerIDs[gPausePartnersPartnerIdx[gPausePartnersCurrentPartnerIdx]]].level;
511
512
513 if (level == PARTNER_RANK_ULTRA) {
514 level = 4;
515 } else if (level == PARTNER_RANK_SUPER) {
516 level = 3;
517 } else if (level == PARTNER_RANK_NORMAL) {
518 level = 2;
519 }
520 for (i = 0; i < 4; i++) {
521 msgX = baseX + 21;
522 msgY = baseY + 22 + i * 13;
523
524 if (i >= level) {
525 continue;
526 }
527
529
530 if (i == 0) {
531 moveNameID = gMoveTable[gPausePartnersMoveBase[gPausePartnersPartnerIdx[gPausePartnersCurrentPartnerIdx]]].nameMsg;
532 } else {
533 moveNameID = gMoveTable[gPausePartnersMoveBase[gPausePartnersPartnerIdx[gPausePartnersCurrentPartnerIdx]] + 2 + i].nameMsg;
534 }
535
536 if (i > 0) {
537 costFP = gMoveTable[gPausePartnersMoveBase[gPausePartnersPartnerIdx[gPausePartnersCurrentPartnerIdx]] + 2 + i].costFP;
538 } else {
539 costFP = 0;
540 }
541
542 draw_msg(moveNameID, msgX, msgY, 255, MSG_PAL_STANDARD, style);
543 hud_element_set_scale(gPausePartnersIconIDs[i + 4], 0.5f);
544 //TODO find better match
545 hud_element_set_render_pos(gPausePartnersIconIDs[i + 4], 12 - (-baseX), baseY + 28 + i * 13);
546 hud_element_draw_without_clipping(gPausePartnersIconIDs[i + 4]);
547
548 if (costFP != 0) {
549 s32 xOffset = 125;
550
551#if VERSION_PAL
552 xOffset = D_PAL_80271B44[gCurrentLanguage];
553#endif
554
555 draw_number(costFP, baseX + xOffset, baseY + 22 + i * 13, style, MSG_PAL_STANDARD, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT);
556 if (costFP > 0) {
557#if VERSION_PAL
558 hud_element_set_render_pos(gPausePartnersIconIDs[0], baseX + D_PAL_80271B44[gCurrentLanguage] + 9, baseY + 29 + i * 13);
559#else
560 hud_element_set_render_pos(gPausePartnersIconIDs[0], baseX + 134, baseY + 29 + i * 13);
561#endif
562 hud_element_draw_without_clipping(gPausePartnersIconIDs[0]);
563 }
564 }
565 }
566
567 if (gPauseMenuCurrentTab == 4 && gPausePartnersLevel == 1) {
568 pause_set_cursor_pos(WIN_PAUSE_PARTNERS_MOVELIST, baseX - 2, baseY + 28 + gPausePartnersSelectedMove * 13);
569 }
570}
571
572void pause_partners_draw_movelist_title(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
574 s32 xOffset;
575
576#if VERSION_PAL
577 xOffset = D_PAL_80271B38[gCurrentLanguage];
578#else
579 xOffset = 12;
580#endif
581
582 draw_msg(msgID, baseX + xOffset, baseY + 1, 255, -1, DRAW_MSG_STYLE_MENU);
583}
584
585void pause_partners_draw_movelist_flower(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
586 hud_element_set_render_pos(gPausePartnersIconIDs[1], baseX + 17, baseY + 16);
587 hud_element_draw_without_clipping(gPausePartnersIconIDs[1]);
588}
589
591 s32 i;
592
593 gPausePartnersNumPartners = 0;
594 for (i = 0; i < ARRAY_COUNT(gPausePartnersPartnerIDs); i++) {
596 gPausePartnersPartnerIdx[gPausePartnersNumPartners] = i;
597 gPausePartnersNumPartners++;
598 }
599 }
600
601 if (gPausePartnersNumPartners == 0) {
603 panel->initialized = FALSE;
604 return;
605 }
606
607 for (i = 0; i < ARRAY_COUNT(gPausePartnersSpriteAnims); i++) {
608 gPausePartnersSpriteIDs[i] = spr_load_npc_sprite(gPausePartnersSpriteAnims[i][0], gPausePartnersSpriteAnims[i]);
609 }
610
611 for (i = 0; i < ARRAY_COUNT(gPausePartnersIconScripts[0]); i++) {
612 gPausePartnersIconIDs[i] = hud_element_create(gPausePartnersIconScripts[gCurrentLanguage][i]);
613 hud_element_set_flags(gPausePartnersIconIDs[i], HUD_ELEMENT_FLAG_80);
614 }
615
616 for (i = 0; i < ARRAY_COUNT(gPausePartnersWindowBPs); i++) {
617 gPausePartnersWindowBPs[i].tab = panel;
618 }
620
621#if VERSION_PAL
627#endif
628
629 gPausePartnersCurrentPartnerIdx = 0;
630 for (i = 0; i < gPausePartnersNumPartners; i++) {
631 if (gPlayerData.curPartner == gPausePartnersPartnerIDs[gPausePartnersPartnerIdx[i]]) {
632 gPausePartnersCurrentPartnerIdx = i;
633 break;
634 }
635 }
636
637 gPausePartnersSelectedMove = 0;
638 gPausePartnersLevel = 0;
639 gPausePartnersRotAngle = gPausePartnersCurrentPartnerIdx * 360 / gPausePartnersNumPartners;
641 panel->initialized = TRUE;
642}
643
645 s32 delta;
646 s32 level, level2;
647 s32 partnerID;
648 s32 oldPos;
649
650 if (gPausePartnersNumPartners >= 2 && (gPausePartnersLevel == 0 || (gPauseHeldButtons & (BUTTON_Z | BUTTON_R)))) {
651 delta = 0;
652
654 delta = -1;
655 }
656
658 delta++;
659 }
660
662 delta--;
663 }
664
666 delta++;
667 }
668
669 if (delta) {
671 gPausePartnersCurrentPartnerIdx += delta;
672
673 if (gPausePartnersCurrentPartnerIdx < 0) {
674 gPausePartnersCurrentPartnerIdx = gPausePartnersNumPartners - 1;
675 if (gPausePartnersRotAngle < 360.0f) {
676 gPausePartnersRotAngle += 360.0f;
677 }
678 } else if (gPausePartnersCurrentPartnerIdx >= gPausePartnersNumPartners) {
679 gPausePartnersCurrentPartnerIdx = 0;
680 if (gPausePartnersRotAngle > 0.0f) {
681 gPausePartnersRotAngle -= 360.0f;
682 }
683 }
684
685 gPausePartnersSelectedMove = 0;
686 }
687 }
688
689 level = gPlayerData.partners[gPausePartnersPartnerIDs[gPausePartnersPartnerIdx[gPausePartnersCurrentPartnerIdx]]].level;
690 if (level == PARTNER_RANK_ULTRA) {
691 level = 4;
692 } else if (level == PARTNER_RANK_SUPER) {
693 level = 3;
694 } else if (level == PARTNER_RANK_NORMAL) {
695 level = 2;
696 }
697
699
700 if (gPausePartnersLevel == 1) {
701 oldPos = gPausePartnersSelectedMove;
702
703 level2 = gPlayerData.partners[gPausePartnersPartnerIDs[gPausePartnersPartnerIdx[gPausePartnersCurrentPartnerIdx]]].level;
704 if (level2 == 2) {
705 level2 = 4;
706 } else if (level2 == 1) {
707 level2 = 3;
708 } else if (level2 == 0) {
709 level2 = 2;
710 }
711
713 gPausePartnersSelectedMove--;
714 }
716 gPausePartnersSelectedMove++;
717 }
718
719 if (gPausePartnersSelectedMove < 0) {
720 gPausePartnersSelectedMove = level2 - 1;
721 } else if (gPausePartnersSelectedMove >= level2) {
722 gPausePartnersSelectedMove = 0;
723 }
724
725 if (gPausePartnersSelectedMove != oldPos) {
727 }
728 }
729
730 if ((gPausePressedButtons & BUTTON_A) && gPausePartnersLevel == 0) {
731 gPausePartnersLevel = 1;
734 return;
735 }
736
738 if (gPausePartnersLevel == 0) {
741 return;
742 } else {
743 gPausePartnersLevel = 0;
746 return;
747 }
748 }
749
751
752 if (gPausePartnersLevel == 0) {
753 gPauseCurrentDescMsg = gPausePartnersMessages[gPausePartnersPartnerIdx[gPausePartnersCurrentPartnerIdx]];
754 } else if (gPausePartnersSelectedMove == 0) {
755 gPauseCurrentDescMsg = gMoveTable[gPausePartnersMoveBase[gPausePartnersPartnerIdx[gPausePartnersCurrentPartnerIdx]]].fullDescMsg;
756 } else {
757 gPauseCurrentDescMsg = gMoveTable[gPausePartnersMoveBase[gPausePartnersPartnerIdx[gPausePartnersCurrentPartnerIdx]] + 2 + gPausePartnersSelectedMove].fullDescMsg;
758 }
759}
760
762 s32 i;
763 f32 delta;
764 s32 absValue;
765 f32 deltaBefore;
766 s32 sgn;
767
768 deltaBefore = gPausePartnersCurrentPartnerIdx * 360 / gPausePartnersNumPartners - gPausePartnersRotAngle;
769 absValue = abs(deltaBefore);
770 sgn = sign(deltaBefore);
771
772 if (absValue >= 16) {
773 delta = deltaBefore * 0.3;
774 } else {
775 delta = sgn * gPausePartnersPortraitScrollInterpTable[absValue];
776 gPausePartnersRotAngle = (int)gPausePartnersRotAngle;
777 }
778 gPausePartnersRotAngle += delta;
779
780 for (i = 0; i < gPausePartnersNumPartners; i++) {
781 if (i == gPausePartnersCurrentPartnerIdx) {
782 spr_update_sprite(gPausePartnersSpriteIDs[gPausePartnersPartnerIdx[i]], gPausePartnersSpriteAnims[gPausePartnersPartnerIdx[i]][1], 1.0f);
783 } else {
784 spr_update_sprite(gPausePartnersSpriteIDs[gPausePartnersPartnerIdx[i]], gPausePartnersSpriteAnims[gPausePartnersPartnerIdx[i]][0], 1.0f);
785 }
786 }
787}
788
790 s32 i;
791
792 for (i = 0; i < ARRAY_COUNT(gPausePartnersIconIDs); i++) {
793 hud_element_free(gPausePartnersIconIDs[i]);
794 }
795
796 for (i = 0; i < ARRAY_COUNT(gPausePartnersSpriteIDs); i++) {
797 spr_free_sprite(gPausePartnersSpriteIDs[i]);
798 }
799}
PartnerPopupProperties gPartnerPopupProperties[]
Definition 5B320.c:331
HudScript HES_MoveBlueOrb
HudScript HES_MoveDiamond
HudScript HES_FPCost
HudScript HES_MoveGreenOrb
HudScript HES_MoveRedOrb
PartnerData partners[12]
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
Vec3s pos
Definition demo_api.c:17
#define guRotateF
#define guOrthoF
#define get_msg_width
#define guMtxF2L
#define sin_deg
#define guTranslateF
#define guMtxCatF
#define cos_deg
#define draw_msg
#define draw_box
#define guScaleF
@ DRAW_MSG_STYLE_MENU
Definition enums.h:5385
@ DRAW_NUMBER_STYLE_ALIGN_RIGHT
drawn to the left of posX
Definition enums.h:5393
@ DRAW_NUMBER_STYLE_MONOSPACE
Definition enums.h:5394
@ BUTTON_A
Definition enums.h:2790
@ BUTTON_R
Definition enums.h:2781
@ BUTTON_STICK_UP
Definition enums.h:2791
@ BUTTON_STICK_DOWN
Definition enums.h:2792
@ BUTTON_STICK_LEFT
Definition enums.h:2793
@ BUTTON_STICK_RIGHT
Definition enums.h:2794
@ BUTTON_B
Definition enums.h:2789
@ BUTTON_Z
Definition enums.h:2788
@ IMGFX_SET_COLOR
Definition enums.h:5123
@ LANGUAGE_DE
Definition enums.h:6401
@ LANGUAGE_ES
Definition enums.h:6403
@ LANGUAGE_FR
Definition enums.h:6402
@ WINDOW_PRIORITY_1
Definition enums.h:3183
@ WINDOW_PRIORITY_0
Definition enums.h:3182
@ MSG_PAL_WHITE
Definition enums.h:5405
@ MSG_PAL_STANDARD
Definition enums.h:5415
@ WINDOW_UPDATE_SHOW
Definition enums.h:5311
@ WINDOW_UPDATE_HIDE
Definition enums.h:5312
@ DRAW_NUMBER_CHARSET_THIN
Definition enums.h:5401
#define LANGUAGE_DEFAULT
Definition enums.h:6398
@ PARTNER_RANK_NORMAL
Definition enums.h:2018
@ PARTNER_RANK_SUPER
Definition enums.h:2019
@ PARTNER_RANK_ULTRA
Definition enums.h:2020
@ SOUND_MENU_BACK
Definition enums.h:701
@ SOUND_MENU_CHANGE_SELECTION
Definition enums.h:698
@ SOUND_MENU_NEXT
Definition enums.h:700
@ PARTNER_BOMBETTE
Definition enums.h:2888
@ PARTNER_LAKILESTER
Definition enums.h:2893
@ PARTNER_WATT
Definition enums.h:2891
@ PARTNER_BOW
Definition enums.h:2894
@ PARTNER_SUSHIE
Definition enums.h:2892
@ PARTNER_PARAKARRY
Definition enums.h:2889
@ PARTNER_KOOPER
Definition enums.h:2887
@ PARTNER_GOOMBARIO
Definition enums.h:2886
@ WIN_PAUSE_PARTNERS
Definition enums.h:5277
@ WIN_PAUSE_PARTNERS_TITLE
Definition enums.h:5278
@ WIN_PAUSE_MAIN
Definition enums.h:5263
@ WIN_PAUSE_PARTNERS_MOVELIST_TITLE
Definition enums.h:5280
@ WIN_PAUSE_PARTNERS_MOVELIST_FLOWER
Definition enums.h:5281
@ WIN_PAUSE_PARTNERS_MOVELIST
Definition enums.h:5279
s32 sign(s32 value)
Definition 43F0.c:376
void set_window_update(s32 panelID, s32)
Definition windows.c:434
void * load_asset_by_name(const char *assetName, u32 *decompressedSize)
Definition world.c:251
void setup_pause_menu_tab(MenuWindowBP *bpArray, s32 arraySize)
Definition windows.c:461
s32 general_heap_free(void *data)
Definition heap.c:18
void decode_yay0(void *src, void *dst)
void draw_number(s32 value, s32 x, s32 y, s32 variableWidthChars, s32 palette, s32 opacity, u16 style)
Definition msg.c:2223
void hud_element_set_scale(s32 index, f32 scale)
void hud_element_draw_without_clipping(s32 id)
void hud_element_set_render_pos(s32 id, s32 x, s32 y)
s32 hud_element_create(HudScript *anim)
Creates a new HUD element and returns its ID.
void hud_element_set_flags(s32 id, s32 flags)
Turns on the given flags.
void hud_element_free(s32 id)
@ HUD_ELEMENT_FLAG_80
Definition hud_element.h:80
s32 HudScript[]
Definition hud_element.h:9
HudScript HES_PartnerRank
HudScript HES_StatFp_1
s32 gPausePressedButtons
Definition pause_main.c:24
HudScript * gPauseCurrentDescIconScript
Definition pause_main.c:26
WindowStyleCustom gPauseWS_21
WindowStyleCustom gPauseWS_20
WindowStyleCustom gPauseWS_22
s32 pause_get_menu_msg(s32 index)
Definition pause_gfx.c:583
@ PAUSE_MSG_PARTNER_ABILITIES
s32 gPauseHeldButtons
Definition pause_main.c:23
s8 gPauseMenuCurrentTab
Definition pause_main.c:28
void pause_draw_menu_label(s32 index, s32 x, s32 y)
Definition pause_gfx.c:587
void pause_set_cursor_pos(s32 windowID, s32 posX, s32 posY)
Definition pause_main.c:228
void pause_draw_rect(s32 ulx, s32 uly, s32 lrx, s32 lry, s32 tileIdx, s32 uls, s32 ult, s32 dsdx, s32 dtdy)
Definition pause_main.c:841
@ PAUSE_LBL_ABILITIES
s32 gPauseCurrentDescMsg
Definition pause_main.c:25
s32 gPausePartnersNextPortraitIndex
void pause_partners_init(MenuPanel *panel)
s32 gPausePartnersCurrentPortraitIndex
Gfx gPausePartnersDL[]
Vp gPausePartnersViewport
void pause_partners_cleanup(MenuPanel *panel)
void pause_partners_draw_title(MenuPanel *menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening)
MenuWindowBP gPausePartnersWindowBPs[]
void pause_partners_load_portrait(s32 index)
void pause_partners_draw_movelist_title(MenuPanel *menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening)
s32 gPausePartnersPartnerIDs[]
s32 gPausePartnersSpriteAnims[][4]
s8 * gPausePartnersImageBuffers[]
HudScript * gPausePartnersIconScripts[][8]
void pause_partners_draw_movelist(MenuPanel *menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening)
s8 gPausePartnersGridData[]
void pause_partners_handle_input(MenuPanel *panel)
char * gPausePartnersAssetNames[]
s32 gPausePartnersMoveBase[]
s8 gPauseBufferPal1[512]
Definition pause_gfx.c:618
void pause_partners_draw_contents(MenuPanel *menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening)
s32 D_8024F74C
s8 gPauseBufferImg2[15752]
Definition pause_gfx.c:621
void pause_partners_update(MenuPanel *panel)
MenuPanel gPausePanelPartners
u8 gPausePartnersPortraitScrollInterpTable[]
s8 * gPausePartnersPaletteBuffers[]
s8 gPauseBufferPal2[512]
Definition pause_gfx.c:620
s8 gPauseBufferImg1[15752]
Definition pause_gfx.c:619
void pause_partners_draw_movelist_flower(MenuPanel *menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening)
s32 gPausePartnersMessages[]
void sfx_play_sound(s32 soundID)
Definition sfx.c:517
#define SCREEN_WIDTH
Definition macros.h:105
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define SCREEN_HEIGHT
Definition macros.h:106
#define PM_CC_0F
Definition macros.h:292
s32 spr_draw_npc_sprite(s32 spriteInstanceID, s32 yaw, s32 arg2, PAL_PTR *paletteList, Matrix4f mtx)
Definition sprite.c:1106
s32 spr_update_sprite(s32 spriteInstanceID, s32 animID, f32 timeScale)
Definition sprite.c:1072
s32 spr_free_sprite(s32 spriteInstanceID)
Definition sprite.c:1178
void set_npc_imgfx_all(s32 spriteIdx, ImgFXType imgfxType, s32 imgfxArg1, s32 imgfxArg2, s32 imgfxArg3, s32 imgfxArg4, s32 imgfxArg5)
Definition sprite.c:1254
s32 spr_load_npc_sprite(s32 animID, u32 *extraAnimList)
Definition sprite.c:1026
MenuPanel * tab
#define ANIM_LIST_END
Terminates an extraAnimationList.
Definition types.h:22
#define gCurrentLanguage
Definition variables.h:115
Gfx * gMainGfxPos
Definition cam_main.c:15
PlayerData gPlayerData
Definition 77480.c:40
u16 gMatrixListPos
Definition main_loop.c:45
MoveData gMoveTable[]
Window gWindows[64]
Definition windows.c:23
DisplayContext * gDisplayContext
Definition cam_main.c:16