Mortal Kombat Plus
Documentação gerada automaticamente com Doxygen
Carregando...
Procurando...
Nenhuma entrada encontrado
char_select_room.c
Ir para a documentação desse arquivo.
1#include <genesis.h>
2
3#include "char_select_room.h"
4#include "input_system.h"
5#include "stages.h"
6#include "sprites.h"
7#include "audio.h"
8#include "game_vars.h"
9#include "fighters.h"
10#include "anima_system.h"
11
12#define TILEMAP_WIDTH 40
13#define TILEMAP_HEIGHT 28
14#define SCREEN_WIDTH 320
15#define SCREEN_HEIGHT 224
16#define LINE_HEIGHT 2 // Altura da linha em pixels
17#define PLAYER_1_POS_X 10
18#define PLAYER_1_POS_Y 104
19#define PLAYER_2_POS_X 182
20#define PLAYER_2_POS_Y 104
21#define CURSOR_P1 0
22#define CURSOR_P2 1
23
24void updateSelector(int ind);
25void playerSelected(int ind);
26void playerSelectBlinkEffect(int ind, u8 selectorBlinkTimer[2]);
27void initScrollLine(s16 *scrollLine);
28void drawBackground();
29void revealBackground(s16 *scrollLine);
30void initPlayer();
32void playCursor();
33void playMusic();
34void freeScrollLine(s16 *scrollLine);
35void exit();
36
37// Seguir sempre a ordem do Enum
38// CAGE 20, 44
39// KANO 76, 44
40// RAIDEN 76, 108
41// LIU KANG 132, 108
42// SUBZERO 188, 44
43// SCORPION 188, 108
44// SONYA 244, 44
45const u8 OPTIONS_X[7] = {20, 76, 76, 132, 188, 188, 244};
46const u8 OPTIONS_Y[7] = {44, 44, 108, 108, 44, 108, 44};
47
48typedef struct
49{
50 const u8 *locutor;
51 int size;
52 u8 x, y;
54
55// TODO: acertar isso pois não dá para pegar o tamanho dinamicamente.
56static const CharSelectData charData[7] = {
57 {loc_jc, 13056, OPTIONS_X[JOHNNY_CAGE], OPTIONS_Y[JOHNNY_CAGE]},
58 {loc_kano, 8448, OPTIONS_X[KANO], OPTIONS_Y[KANO]},
59 {loc_raiden, 7680, OPTIONS_X[RAIDEN], OPTIONS_Y[RAIDEN]},
60 {loc_liu_kang, 13056, OPTIONS_X[LIU_KANG], OPTIONS_Y[LIU_KANG]},
61 {loc_suzero, 15872, OPTIONS_X[SUBZERO], OPTIONS_Y[SUBZERO]},
62 {loc_scorpion, 13568, OPTIONS_X[SCORPION], OPTIONS_Y[SCORPION]},
63 {loc_sonya, 11264, OPTIONS_X[SONYA], OPTIONS_Y[SONYA]},
64};
65
66void exit()
67{
68 SPR_clear();
69 // VDP_resetSprites();
70
71 if (GE[1].sprite)
72 {
73 SPR_releaseSprite(GE[1].sprite);
74 GE[1].sprite = NULL;
75 }
76 if (GE[2].sprite)
77 {
78 SPR_releaseSprite(GE[2].sprite);
79 GE[2].sprite = NULL;
80 }
81 if (GE[3].sprite)
82 {
83 SPR_releaseSprite(GE[3].sprite);
84 GE[3].sprite = NULL;
85 }
86 if (GE[4].sprite)
87 {
88 SPR_releaseSprite(GE[4].sprite);
89 GE[4].sprite = NULL;
90 }
91 VDP_releaseAllSprites();
92 gFrames = 0;
93 gRoom = TELA_DEMO_INTRO;
94 // VDP_resetScreen();
95 VDP_setBackgroundColor(0); // Define preto
96 gInd_tileset = TILE_USER_INDEX;
97
98 waitMs(1000);
99 VDP_waitVSync();
100 SYS_enableInts();
101}
102
104{
105 bool sair = FALSE;
106 u8 selectorBlinkTimer[2] = {0, 0};
107
108 s16 countDown = -1;
109
110 while (!sair)
111 {
112 inputSystem();
113
114 gFrames++;
115
116 // desabilita interações, ajusta planos e modo de scrolling
117 if (gFrames == 1)
118 {
119 SYS_disableInts();
120 gPodeMover = FALSE;
121 VDP_setPlaneSize(128, 64, TRUE);
122 VDP_setScrollingMode(HSCROLL_LINE, VSCROLL_PLANE);
123 }
124
125 // toca o gongo e inicia o efeito persinana revelando a tela de fundo
126 if (gFrames == 20)
127 {
128 s16 *scrollLine = (s16 *)malloc(SCREEN_HEIGHT * sizeof(s16));
129
130 XGM2_playPCMEx(snd_gongo, sizeof(snd_gongo), SOUND_PCM_CH2, 0, FALSE, 0);
131
132 initScrollLine(scrollLine);
133
135
136 revealBackground(scrollLine);
137 }
138
139 // toca música, inicia o player, sprites ...
140 if (gFrames == 40)
141 {
142 playMusic();
143
144 initPlayer();
145
147
148 VDP_waitVSync();
149 gPodeMover = TRUE; // previnir bug de sprite aparecer errado se ficar movendo o dpad
150 }
151
152 // permite interações
153 if (gFrames > 100)
154 {
155 SYS_enableInts();
156 }
157
158 for (int ind = 0; ind < 2; ind++) // para cada jogador
159 {
160 updateSelector(ind);
161
162 playerSelected(ind);
163
164 playerSelectBlinkEffect(ind, selectorBlinkTimer);
165 }
166
167 // TODO: repensar uma forma melhor
168 if (player[0].selecionado && player[1].selecionado)
169 {
170 if (countDown == -1)
171 {
172 countDown = 150;
173 }
174 else if (countDown == 0)
175 {
176 sair = TRUE;
177 }
178 else if (countDown == 50)
179 {
180 SYS_disableInts();
181 PAL_fadeOutAll(18, FALSE);
182 XGM2_stop();
183 VDP_clearPlane(BG_A, TRUE);
184 VDP_clearPlane(BG_B, TRUE);
185 }
186 countDown--;
187 }
188
189 // Mostra os IDs dos personagens
190 if (debugEnabled)
191 {
192 static char stri[64];
193 sprintf(stri, "p1: %d", player[0].id);
194 VDP_drawText(stri, 1, 1);
195 sprintf(stri, "p2: %d", player[1].id);
196 VDP_drawText(stri, 1, 2);
197 sprintf(stri, "gframes: %ld", gFrames);
198 VDP_drawText(stri, 1, 3);
199 }
200
201 SPR_update();
202 SYS_doVBlankProcess();
203 }
204
205 exit();
206}
207
208// faz o efeito de piscar o retrato ao selecionar o personagem
209void playerSelectBlinkEffect(int ind, u8 selectorBlinkTimer[2])
210{
211 // Se o sprite P&B da foto do personagem estiver visível..
212 if (SPR_isVisible(GE[ind + 2].sprite, TRUE))
213 {
214 // para piscar novamente caso selecionem o mesmo personagem
215 if ((player[0].selecionado && player[1].selecionado))
216 {
217 if (player[0].id == player[1].id)
218 {
219 SPR_setDepth(GE[ind + 2].sprite, SPR_MIN_DEPTH);
220 SPR_setAnim(GE[ind + 2].sprite, player[ind].id);
221 }
222 }
223
224 selectorBlinkTimer[ind]++;
225 // se divisível por 5 ...
226 if (selectorBlinkTimer[ind] % 5 == 0)
227 {
228 SPR_nextFrame(GE[ind + 2].sprite);
229 }
230 // para a animação
231 if (selectorBlinkTimer[ind] > 30)
232 {
233 SPR_setAnimationLoop(GE[ind + 2].sprite, FALSE);
234 }
235 }
236}
237
238/**
239 * @brief Atualiza a posição do cursor de seleção de acordo com o ID
240 *
241 * @param ind indice usado pelo GraphicElements
242 */
243void updateSelector(int ind)
244{
245 if (GE[ind].sprite->visibility == HIDDEN) // se o seletor estiver invisível não permitir mover o cursor.
246 return;
247
248 int prevId = player[ind].id; // guarda personagem anterior
249
250 switch (player[ind].id)
251 {
252 case KANO:
253
254 if (player[ind].key_JOY_LEFT_status == 1) // se apertar para esquerda, seleciona CAGE
255 {
256 playCursor();
257 SPR_setPosition(GE[ind].sprite, OPTIONS_X[JOHNNY_CAGE], OPTIONS_Y[JOHNNY_CAGE]);
258 player[ind].id = JOHNNY_CAGE;
259 }
260 else if (player[ind].key_JOY_RIGHT_status == 1) // se apertar para direita, Subzero
261 {
262 playCursor();
263 SPR_setPosition(GE[ind].sprite, OPTIONS_X[SUBZERO], OPTIONS_Y[SUBZERO]);
264 player[ind].id = SUBZERO;
265 }
266 else if (player[ind].key_JOY_DOWN_status == 1) // se apertar para baixo, Raiden
267 {
268 playCursor();
269 SPR_setPosition(GE[ind].sprite, OPTIONS_X[RAIDEN], OPTIONS_Y[RAIDEN]);
270 player[ind].id = RAIDEN;
271 }
272 break;
273
274 case JOHNNY_CAGE:
275
276 if (player[ind].key_JOY_RIGHT_status == 1)
277 {
278 playCursor();
279 SPR_setPosition(GE[ind].sprite, OPTIONS_X[KANO], OPTIONS_Y[KANO]);
280 player[ind].id = KANO;
281 }
282 else if (player[ind].key_JOY_LEFT_status == 1)
283 {
284 playCursor();
285 SPR_setPosition(GE[ind].sprite, OPTIONS_X[SONYA], OPTIONS_Y[SONYA]);
286 player[ind].id = SONYA;
287 }
288 break;
289
290 case SUBZERO:
291
292 if (player[ind].key_JOY_LEFT_status == 1)
293 {
294 playCursor();
295 SPR_setPosition(GE[ind].sprite, OPTIONS_X[KANO], OPTIONS_Y[KANO]);
296 player[ind].id = KANO;
297 }
298 else if (player[ind].key_JOY_RIGHT_status == 1)
299 {
300 playCursor();
301 SPR_setPosition(GE[ind].sprite, OPTIONS_X[SONYA], OPTIONS_Y[SONYA]);
302 player[ind].id = SONYA;
303 }
304 else if (player[ind].key_JOY_DOWN_status == 1)
305 {
306 playCursor();
307 SPR_setPosition(GE[ind].sprite, OPTIONS_X[SCORPION], OPTIONS_Y[SCORPION]);
308 player[ind].id = SCORPION;
309 }
310 break;
311
312 case SONYA:
313
314 if (player[ind].key_JOY_LEFT_status == 1)
315 {
316 playCursor();
317 SPR_setPosition(GE[ind].sprite, OPTIONS_X[SUBZERO], OPTIONS_Y[SUBZERO]);
318 player[ind].id = SUBZERO;
319 }
320 else if (player[ind].key_JOY_RIGHT_status == 1)
321 {
322 playCursor();
323 SPR_setPosition(GE[ind].sprite, OPTIONS_X[JOHNNY_CAGE], OPTIONS_Y[JOHNNY_CAGE]);
324 player[ind].id = JOHNNY_CAGE;
325 }
326 break;
327
328 case SCORPION:
329
330 if (player[ind].key_JOY_LEFT_status == 1)
331 {
332 playCursor();
333 SPR_setPosition(GE[ind].sprite, OPTIONS_X[LIU_KANG], OPTIONS_Y[LIU_KANG]);
334 player[ind].id = LIU_KANG;
335 }
336 else if (player[ind].key_JOY_UP_status == 1)
337 {
338 playCursor();
339 SPR_setPosition(GE[ind].sprite, OPTIONS_X[SUBZERO], OPTIONS_Y[SUBZERO]);
340 player[ind].id = SUBZERO;
341 }
342 break;
343
344 case LIU_KANG:
345
346 if (player[ind].key_JOY_RIGHT_status == 1)
347 {
348 playCursor();
349 SPR_setPosition(GE[ind].sprite, OPTIONS_X[SCORPION], OPTIONS_Y[SCORPION]);
350 player[ind].id = SCORPION;
351 }
352 else if (player[ind].key_JOY_LEFT_status == 1)
353 {
354 playCursor();
355 SPR_setPosition(GE[ind].sprite, OPTIONS_X[RAIDEN], OPTIONS_Y[RAIDEN]);
356 player[ind].id = RAIDEN;
357 }
358 break;
359
360 case RAIDEN:
361
362 if (player[ind].key_JOY_RIGHT_status == 1)
363 {
364 playCursor();
365 SPR_setPosition(GE[ind].sprite, OPTIONS_X[LIU_KANG], OPTIONS_Y[LIU_KANG]);
366 player[ind].id = LIU_KANG;
367 }
368 else if (player[ind].key_JOY_UP_status == 1)
369 {
370 playCursor();
371 SPR_setPosition(GE[ind].sprite, OPTIONS_X[KANO], OPTIONS_Y[KANO]);
372 player[ind].id = KANO;
373 }
374 break;
375
376 default:
377 break;
378 }
379
380 // se o ID mudou, troca o sprite do personagem
381 if (prevId != player[ind].id)
382 {
383 playerState(ind, PARADO);
384 }
385}
386
387// TODO: ver o que fazer quando ambos selecionam ao mesmo tempo
388// Verifica se o jogador selecionou um personagem
389void playerSelected(int ind)
390{
391 if (GE[ind].sprite->visibility == HIDDEN)
392 return;
393 if (player[ind].key_JOY_START_status == 0)
394 return;
395
396 const CharSelectData *d = &charData[player[ind].id];
397 XGM2_playPCMEx(d->locutor, d->size, SOUND_PCM_CH_AUTO, 0, FALSE, FALSE);
398 GE[ind + 2].sprite = SPR_addSprite(&spPortrait, d->x + 4, d->y + 4, TILE_ATTR(PAL0, FALSE, FALSE, FALSE));
399 SPR_setAnim(GE[ind + 2].sprite, player[ind].id);
400 SPR_setDepth(GE[ind + 2].sprite, 2);
401 GE[ind].sprite->visibility = HIDDEN;
402 player[ind].selecionado = TRUE;
403}
404
405/**
406 * @brief move a tela para fora da parte visível a esquerda
407 * para iniciar o efeito de Persiana.
408 */
409void initScrollLine(s16 *scrollLine)
410{
411 // Aloca dinamicamente memória
412 // scrollLine = (s16 *)malloc(SCREEN_HEIGHT * sizeof(s16));
413 if (!scrollLine) // Verifica se a alocação foi bem-sucedida
414 {
415 // Falha na alocação
416 return;
417 }
418
419 for (int x = 0; x < SCREEN_HEIGHT; x++)
420 {
421 scrollLine[x] = -SCREEN_WIDTH; // inicia as linhas com 320px
422 }
423 VDP_setHorizontalScrollLine(BG_A, 0, scrollLine, SCREEN_HEIGHT, DMA);
424 VDP_setHorizontalScrollLine(BG_B, 0, scrollLine, SCREEN_HEIGHT, DMA);
425}
426
427/**
428 * @brief Carrega as informações dos backgrounds
429 */
431{
432 // BACKGROUND A
433 VDP_loadTileSet(stage_char_select_a.tileset, gInd_tileset, DMA);
434 VDP_setTileMapEx(BG_A, stage_char_select_a.tilemap,
435 TILE_ATTR_FULL(PAL0, FALSE, FALSE, FALSE, gInd_tileset),
436 0, 0,
437 0, 0,
439 PAL_setPalette(PAL0, char_select_a_pal.data, DMA);
440 gInd_tileset += stage_char_select_a.tileset->numTile;
441
442 // BACKGROUND B
443 VDP_loadTileSet(stage_char_select_b.tileset, gInd_tileset, DMA);
444 VDP_setTileMapEx(BG_B, stage_char_select_b.tilemap,
445 TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, gInd_tileset),
446 0, 0,
447 0, 0,
449 PAL_setPalette(PAL1, char_select_b_pal.data, DMA);
450 gInd_tileset += stage_char_select_b.tileset->numTile;
451}
452
453/**
454 * @brief Revela a tela fazendo o efeito de persiana.
455 */
456void revealBackground(s16 *scrollLine)
457{
458 struct VenetianBlindsEffect
459 {
460 u16 startLine; // linha onde começa o efeito
461 u16 nextLine; // linha onde deve começar o próximo efeito
462 u16 endLine; // linha onde termina o efeito
463 u16 currentLine; // linha atual da iteração
464 };
465
466 struct VenetianBlindsEffect persiana[7] = {
467 {0, 13, 31, 0},
468 {32, 43, 63, 0},
469 {64, 73, 95, 0},
470 {96, 105, 127, 0},
471 {128, 137, 159, 0},
472 {160, 167, 191, 0},
473 {192, 0, 223, 0},
474 };
475
476 for (int y = 0; y < SCREEN_HEIGHT / 2; y += 1)
477 {
478 // 0
479 if (y >= persiana[0].startLine && y <= persiana[0].endLine)
480 {
481 persiana[0].currentLine = y;
482 scrollLine[persiana[0].currentLine] = 0;
483 scrollLine[persiana[0].currentLine + 1] = 0;
484 VDP_setHorizontalScrollLine(BG_A, y, &scrollLine[persiana[0].currentLine], LINE_HEIGHT, DMA);
485 VDP_setHorizontalScrollLine(BG_B, y, &scrollLine[persiana[0].currentLine], LINE_HEIGHT, DMA);
486 }
487 // 1
488 if (y >= persiana[0].nextLine && persiana[1].currentLine <= persiana[1].endLine)
489 {
490 if (persiana[0].nextLine == y)
491 persiana[1].currentLine = persiana[1].startLine;
492 else
493 persiana[1].currentLine += 1;
494 scrollLine[persiana[1].currentLine] = 0;
495 scrollLine[persiana[1].currentLine + 1] = 0;
496 VDP_setHorizontalScrollLine(BG_A, persiana[1].currentLine, &scrollLine[persiana[1].currentLine], LINE_HEIGHT, DMA);
497 VDP_setHorizontalScrollLine(BG_B, persiana[1].currentLine, &scrollLine[persiana[1].currentLine], LINE_HEIGHT, DMA);
498 }
499 // 2
500 if (persiana[1].currentLine >= persiana[1].nextLine && persiana[2].currentLine <= persiana[2].endLine)
501 {
502 if (persiana[1].nextLine == persiana[1].currentLine)
503 persiana[2].currentLine = persiana[2].startLine;
504 else
505 persiana[2].currentLine += 1;
506 scrollLine[persiana[2].currentLine] = 0;
507 scrollLine[persiana[2].currentLine + 1] = 0;
508 VDP_setHorizontalScrollLine(BG_A, persiana[2].currentLine, &scrollLine[persiana[2].currentLine], LINE_HEIGHT, DMA);
509 VDP_setHorizontalScrollLine(BG_B, persiana[2].currentLine, &scrollLine[persiana[2].currentLine], LINE_HEIGHT, DMA);
510 }
511 // 3
512 if (persiana[2].currentLine >= persiana[2].nextLine && persiana[3].currentLine <= persiana[3].endLine)
513 {
514 if (persiana[2].nextLine == persiana[2].currentLine)
515 persiana[3].currentLine = persiana[3].startLine;
516 else
517 persiana[3].currentLine += 1;
518 scrollLine[persiana[3].currentLine] = 0;
519 scrollLine[persiana[3].currentLine + 1] = 0;
520 VDP_setHorizontalScrollLine(BG_A, persiana[3].currentLine, &scrollLine[persiana[3].currentLine], LINE_HEIGHT, DMA);
521 VDP_setHorizontalScrollLine(BG_B, persiana[3].currentLine, &scrollLine[persiana[3].currentLine], LINE_HEIGHT, DMA);
522 }
523 // 4
524 if (persiana[3].currentLine >= persiana[3].nextLine && persiana[4].currentLine <= persiana[4].endLine)
525 {
526 if (persiana[3].nextLine == persiana[3].currentLine)
527 persiana[4].currentLine = persiana[4].startLine;
528 else
529 persiana[4].currentLine += 1;
530 scrollLine[persiana[4].currentLine] = 0;
531 scrollLine[persiana[4].currentLine + 1] = 0;
532 VDP_setHorizontalScrollLine(BG_A, persiana[4].currentLine, &scrollLine[persiana[4].currentLine], LINE_HEIGHT, DMA);
533 VDP_setHorizontalScrollLine(BG_B, persiana[4].currentLine, &scrollLine[persiana[4].currentLine], LINE_HEIGHT, DMA);
534 }
535 // 5
536 if (persiana[4].currentLine >= persiana[4].nextLine && persiana[5].currentLine <= persiana[5].endLine)
537 {
538 if (persiana[4].nextLine == persiana[4].currentLine)
539 persiana[5].currentLine = persiana[5].startLine;
540 else
541 persiana[5].currentLine += 1;
542 scrollLine[persiana[5].currentLine] = 0;
543 scrollLine[persiana[5].currentLine + 1] = 0;
544 VDP_setHorizontalScrollLine(BG_A, persiana[5].currentLine, &scrollLine[persiana[5].currentLine], LINE_HEIGHT, DMA);
545 VDP_setHorizontalScrollLine(BG_B, persiana[5].currentLine, &scrollLine[persiana[5].currentLine], LINE_HEIGHT, DMA);
546 }
547 // 6
548 if (persiana[5].currentLine >= persiana[5].nextLine && persiana[6].currentLine <= persiana[6].endLine)
549 {
550 if (persiana[5].nextLine == persiana[5].currentLine)
551 persiana[6].currentLine = persiana[6].startLine;
552 else
553 persiana[6].currentLine += 1;
554 scrollLine[persiana[6].currentLine] = 0;
555 scrollLine[persiana[6].currentLine + 1] = 0;
556 VDP_setHorizontalScrollLine(BG_A, persiana[6].currentLine, &scrollLine[persiana[6].currentLine], LINE_HEIGHT, DMA);
557 VDP_setHorizontalScrollLine(BG_B, persiana[6].currentLine, &scrollLine[persiana[6].currentLine], LINE_HEIGHT, DMA);
558 }
559
560 SYS_doVBlankProcess();
561 }
562
563 freeScrollLine(scrollLine);
564}
565
567{
568 // for (int ind = 0; ind < 2; ind++)
569 // {
570 // player[ind].key_JOY_countdown[2] = 0;
571 // player[ind].key_JOY_countdown[4] = 0;
572 // player[ind].key_JOY_countdown[6] = 0;
573 // player[ind].key_JOY_countdown[8] = 0;
574 // }
576 player[0].id = KANO;
577 player[0].state = PARADO;
578 player[0].paleta = PAL2;
579 player[0].direcao = 1;
580 player[0].x = PLAYER_1_POS_X;
581 player[0].y = PLAYER_1_POS_Y;
582 player[0].selecionado = FALSE;
583
584 player[1].id = SUBZERO;
585 player[1].state = PARADO;
586 player[1].paleta = PAL3;
587 player[1].direcao = -1;
588 player[1].x = PLAYER_2_POS_X;
589 player[1].y = PLAYER_2_POS_Y;
590 player[1].selecionado = FALSE;
591
592 playerState(0, PARADO);
593 playerState(1, PARADO);
594
595 memset(player[0].key_JOY_countdown, 0, sizeof(player[0].key_JOY_countdown));
596 memset(player[1].key_JOY_countdown, 0, sizeof(player[1].key_JOY_countdown));
597
598 // player[0].key_JOY_countdown[2] = 0;
599 // player[0].key_JOY_countdown[4] = 0;
600 // player[0].key_JOY_countdown[6] = 0;
601 // player[0].key_JOY_countdown[8] = 0;
602
603 // player[1].key_JOY_countdown[2] = 0;
604 // player[1].key_JOY_countdown[4] = 0;
605 // player[1].key_JOY_countdown[6] = 0;
606 // player[1].key_JOY_countdown[8] = 0;
607}
608
610{
611 // indice 0 e 1 do GE serão usados para carregar o gráfico do seletor
612 GE[0].sprite = SPR_addSpriteSafe(&player_seletor,
613 OPTIONS_X[KANO], OPTIONS_Y[KANO],
614 TILE_ATTR(PAL1, FALSE, FALSE, FALSE));
615 SPR_setAnim(GE[0].sprite, CURSOR_P1); // animação P1
616 SPR_setDepth(GE[0].sprite, SPR_MIN_DEPTH);
617
618 GE[1].sprite = SPR_addSpriteSafe(&player_seletor,
619 OPTIONS_X[SUBZERO], OPTIONS_Y[SUBZERO],
620 TILE_ATTR(PAL1, FALSE, FALSE, FALSE));
621 SPR_setAnim(GE[1].sprite, CURSOR_P2); // animação P2
622 SPR_setDepth(GE[1].sprite, 1); // profundidade menor que o seletor do P1
623 // inicia a animação dos sprites
624 SPR_setAnimationLoop(GE[0].sprite, TRUE);
625 SPR_setAnimationLoop(GE[1].sprite, TRUE);
626}
627
628/**
629 * @brief Executa o áudio do cursor */
631{
632 XGM2_playPCMEx(snd_cursor, sizeof(snd_cursor), SOUND_PCM_CH_AUTO, 0, FALSE, 0);
633}
634
636{
637 XGM2_play(mus_select_player);
638}
639
640void freeScrollLine(s16 *scrollLine)
641{
642 if (scrollLine)
643 {
644 free(scrollLine); // Libera a memória alocada dinamicamente
645 scrollLine = NULL;
646 }
647}
void playerState(int ind, u16 state)
Definição anima_system.c:17
#define CURSOR_P2
void revealBackground(s16 *scrollLine)
Revela a tela fazendo o efeito de persiana.
void initSelectorSprite()
void playerSelected(int ind)
void initPlayer()
const u8 OPTIONS_X[7]
#define SCREEN_WIDTH
#define TILEMAP_WIDTH
void exit()
void playCursor()
Executa o áudio do cursor.
const u8 OPTIONS_Y[7]
#define PLAYER_2_POS_X
void freeScrollLine(s16 *scrollLine)
void playMusic()
#define TILEMAP_HEIGHT
void processSelecaoPersonagens()
#define SCREEN_HEIGHT
void updateSelector(int ind)
Atualiza a posição do cursor de seleção de acordo com o ID.
#define LINE_HEIGHT
#define PLAYER_1_POS_Y
#define CURSOR_P1
#define PLAYER_2_POS_Y
void drawBackground()
Carrega as informações dos backgrounds.
void initScrollLine(s16 *scrollLine)
move a tela para fora da parte visível a esquerda para iniciar o efeito de Persiana.
#define PLAYER_1_POS_X
void playerSelectBlinkEffect(int ind, u8 selectorBlinkTimer[2])
Player player[2]
Definição game_vars.c:24
u8 gRoom
Definição game_vars.c:10
bool gPodeMover
Definição game_vars.c:9
u32 gFrames
Definição game_vars.c:16
GraphicElement GE[25]
Definição game_vars.c:23
u16 gInd_tileset
Definição game_vars.c:12
bool debugEnabled
Definição game_vars.c:8
u8 gAlturaDoPiso
Definição game_vars.c:11
void inputSystem()
Definição input_system.c:4
const u8 * locutor