Add Miles to sprite test

This commit is contained in:
Lucas S. Vieira 2025-04-07 21:39:55 -03:00
parent 896f75820e
commit 25f42259e4
3 changed files with 31 additions and 2 deletions

View file

@ -1,9 +1,13 @@
#ifndef SCREEN_SPRITE_TEST_H #ifndef SCREEN_SPRITE_TEST_H
#define SCREEN_SPRITE_TEST_H #define SCREEN_SPRITE_TEST_H
#include "player.h"
void screen_sprite_test_load(); void screen_sprite_test_load();
void screen_sprite_test_unload(void *); void screen_sprite_test_unload(void *);
void screen_sprite_test_update(void *); void screen_sprite_test_update(void *);
void screen_sprite_test_draw(void *); void screen_sprite_test_draw(void *);
void screen_sprite_test_setcharacter(PlayerCharacter character);
#endif #endif

View file

@ -14,6 +14,7 @@
#include "timer.h" #include "timer.h"
#include "basic_font.h" #include "basic_font.h"
#include "player.h" #include "player.h"
#include "screens/sprite_test.h"
#define CHOICE_SOUNDTEST 20 #define CHOICE_SOUNDTEST 20
#define CHOICE_SLIDE 21 #define CHOICE_SLIDE 21
@ -234,6 +235,8 @@ screen_levelselect_update(void *d)
data->music_selected = data->soundtest_selection - 1; data->music_selected = data->soundtest_selection - 1;
} }
} else if(data->menu_choice == CHOICE_SPRITETEST) { } else if(data->menu_choice == CHOICE_SPRITETEST) {
screen_level_setcharacter(data->character_selection);
screen_sprite_test_setcharacter(data->character_selection);
scene_change(SCREEN_SPRITETEST); scene_change(SCREEN_SPRITETEST);
} else { } else {
screen_level_setlevel(data->menu_choice); screen_level_setlevel(data->menu_choice);

View file

@ -8,10 +8,13 @@
#include "timer.h" #include "timer.h"
#include "basic_font.h" #include "basic_font.h"
#include "screens/sprite_test.h" #include "screens/sprite_test.h"
#include "player.h"
extern uint8_t level_fade; extern uint8_t level_fade;
extern uint8_t frame_debug; extern uint8_t frame_debug;
static PlayerCharacter spritetest_character = CHARA_SONIC;
typedef struct { typedef struct {
Chara chara; Chara chara;
int16_t frame; int16_t frame;
@ -27,13 +30,26 @@ screen_sprite_test_load()
uint32_t filelength; uint32_t filelength;
TIM_IMAGE tim; TIM_IMAGE tim;
uint8_t *timfile = file_read("\\SPRITES\\SONIC.TIM;1", &filelength);
const char *chara_file = "\\SPRITES\\SONIC.CHARA;1";
const char *tim_file = "\\SPRITES\\SONIC.TIM;1";
switch(spritetest_character) {
case CHARA_MILES:
chara_file = "\\SPRITES\\MILES.CHARA;1";
tim_file = "\\SPRITES\\MILES.TIM;1";
break;
case CHARA_SONIC:
default: break;
}
uint8_t *timfile = file_read(tim_file, &filelength);
if(timfile) { if(timfile) {
load_texture(timfile, &tim); load_texture(timfile, &tim);
free(timfile); free(timfile);
} }
load_chara(&data->chara, "\\SPRITES\\SONIC.CHARA;1", &tim); load_chara(&data->chara, chara_file, &tim);
data->frame = 0; data->frame = 0;
data->play_frames = 0; data->play_frames = 0;
@ -131,3 +147,9 @@ screen_sprite_test_draw(void *d)
data->flipx, data->flipx,
data->angle); data->angle);
} }
void
screen_sprite_test_setcharacter(PlayerCharacter character)
{
spritetest_character = character;
}