Add an FMV test to level select much like the sound test

This commit is contained in:
Lucas S. Vieira 2024-12-12 23:17:09 -03:00 committed by Lucas Vieira
parent 6fdd779162
commit 2ed44c4d04
6 changed files with 57 additions and 23 deletions

View file

@ -7,9 +7,9 @@
#define BLOCK_SIZE 16
typedef struct {
uint16_t width, height;
uint32_t bs_data[0x2000]; // Bitstream data read from the disc
uint32_t mdec_data[0x8000]; // Decompressed data to be fed to the MDEC
uint16_t width, height;
uint32_t bs_data[0x2000]; // Bitstream data read from the disc
uint32_t mdec_data[0x8000]; // Decompressed data to be fed to the MDEC
} StreamBuffer;
typedef struct {

View file

@ -3,12 +3,18 @@
#include "screen.h"
typedef enum {
FMV_SONICTEAM = 0,
FMV_PS30YRS = 1,
FMV_NUM_VIDEOS = FMV_PS30YRS + 1,
} FMVOption;
void screen_fmv_load();
void screen_fmv_unload(void *);
void screen_fmv_update(void *);
void screen_fmv_draw(void *);
void screen_fmv_set_next(ScreenIndex next);
void screen_fmv_enqueue(const char *filepath);
void screen_fmv_enqueue(FMVOption);
#endif

15
iso.xml
View file

@ -351,13 +351,14 @@
source="${PROJECT_SOURCE_DIR}/assets/bgm/EVENT001.XA" />
</dir>
<dummy sectors="1024"/>
<file name="SONICT.STR"
type="mixed"
source="${PROJECT_SOURCE_DIR}/assets/fmv/SONICT.STR" />
<file name="PS30YRS.STR"
type="mixed"
source="${PROJECT_SOURCE_DIR}/assets/fmv/PS30YRS.STR" />
<dir name="FMV">
<file name="SONICT.STR"
type="mixed"
source="${PROJECT_SOURCE_DIR}/assets/fmv/SONICT.STR" />
<file name="PS30YRS.STR"
type="mixed"
source="${PROJECT_SOURCE_DIR}/assets/fmv/PS30YRS.STR" />
</dir>
<dummy sectors="1024"/>
</directory_tree>

View file

@ -54,7 +54,7 @@ screen_disclaimer_update(void *d)
} else {
// Prepare intro, but also prepare level
screen_fmv_set_next(SCREEN_TITLE);
screen_fmv_enqueue("\\PS30YRS.STR;1");
screen_fmv_enqueue(FMV_PS30YRS);
scene_change(SCREEN_FMV);
}
}

View file

@ -11,7 +11,7 @@
// Can't wait for hackers using ACE to manipulate this someday :)
static ScreenIndex next_screen = SCREEN_LEVELSELECT;
static const char *fmv_queue[FMV_QUEUE_MAX];
static FMVOption fmv_queue[FMV_QUEUE_MAX];
static uint8_t fmv_count = 0;
void screen_fmv_load() {}
@ -28,8 +28,17 @@ screen_fmv_unload(void *)
void
screen_fmv_update(void *)
{
for(uint8_t i = 0; i < fmv_count; i++)
mdec_play(fmv_queue[i]);
for(uint8_t i = 0; i < fmv_count; i++) {
const char *fmvpath = NULL;
switch(fmv_queue[i]) {
case FMV_SONICTEAM: fmvpath = "\\FMV\\SONICT.STR;1"; break;
case FMV_PS30YRS: fmvpath = "\\FMV\\PS30YRS.STR;1"; break;
default: break;
}
if(fmvpath) mdec_play(fmvpath);
}
scene_change(next_screen);
}
@ -43,10 +52,10 @@ screen_fmv_set_next(ScreenIndex next)
}
void
screen_fmv_enqueue(const char *filepath)
screen_fmv_enqueue(FMVOption option)
{
if(fmv_count < FMV_QUEUE_MAX) {
fmv_queue[fmv_count] = filepath;
fmv_queue[fmv_count] = option;
fmv_count++;
}
}

View file

@ -15,9 +15,9 @@
#include "basic_font.h"
#define CHOICE_SOUNDTEST 19
#define CHOICE_MODELTEST 20
#define CHOICE_TITLE 21
#define CHOICE_SONICT 22
#define CHOICE_MDEC 20
#define CHOICE_MODELTEST 21
#define CHOICE_TITLE 22
#define CHOICE_SOON 23
#define CHOICE_CREDITS 24
#define MAX_LEVELS (CHOICE_CREDITS + 1)
@ -36,6 +36,7 @@ typedef struct {
uint16_t bg_timer;
uint8_t music_selected;
uint8_t soundtest_selection;
uint8_t mdectest_selection;
} screen_levelselect_data;
extern int debug_mode;
@ -62,11 +63,11 @@ static const char *menutext[] = {
" 3",
"\n",
"SOUND TEST *??*",
"MDEC TEST *??*",
"\n",
"\n",
"MODELTEST",
"TITLESCREEN",
"SONICTEAM",
"COMINGSOON",
"CREDITS",
NULL,
@ -98,6 +99,7 @@ screen_levelselect_load()
data->music_selected = 0;
data->soundtest_selection = 0x00;
data->mdectest_selection = 0x00;
// Regardless of the level, reset score.
// You're already cheating, I'm not going to allow you
@ -164,6 +166,16 @@ screen_levelselect_update(void *d)
data->soundtest_selection = 0;
else data->soundtest_selection++;
}
} else if(data->menu_choice == CHOICE_MDEC) {
if(pad_pressed(PAD_LEFT)) {
if(data->mdectest_selection == 0)
data->mdectest_selection = FMV_NUM_VIDEOS - 1;
else data->mdectest_selection--;
} else if(pad_pressed(PAD_RIGHT)) {
if(data->mdectest_selection == FMV_NUM_VIDEOS - 1)
data->mdectest_selection = 0;
else data->mdectest_selection++;
}
}
if(pad_pressed(PAD_DOWN))
@ -173,6 +185,7 @@ screen_levelselect_update(void *d)
else data->menu_choice--;
} else if(
(data->menu_choice != CHOICE_SOUNDTEST)
&& (data->menu_choice != CHOICE_MDEC)
&& (pad_pressed(PAD_LEFT) || pad_pressed(PAD_RIGHT))) {
if(data->menu_choice < MAX_COLUMN_CHOICES - 1) {
data->menu_choice += MAX_COLUMN_CHOICES - 1;
@ -186,9 +199,9 @@ screen_levelselect_update(void *d)
if(pad_pressed(PAD_START) || pad_pressed(PAD_CROSS)) {
if(data->menu_choice == CHOICE_TITLE) {
scene_change(SCREEN_TITLE);
} else if(data->menu_choice == CHOICE_SONICT) {
} else if(data->menu_choice == CHOICE_MDEC) {
screen_fmv_set_next(SCREEN_LEVELSELECT);
screen_fmv_enqueue("\\SONICT.STR;1");
screen_fmv_enqueue(data->mdectest_selection);
scene_change(SCREEN_FMV);
} else if(data->menu_choice == CHOICE_MODELTEST) {
scene_change(SCREEN_MODELTEST);
@ -275,6 +288,11 @@ screen_levelselect_draw(void *d)
snprintf(buffer, 80, "SOUND TEST *%02X*",
data->soundtest_selection);
font_draw_sm(buffer, vx, vy);
} else if(cursel == CHOICE_MDEC) {
char buffer[80];
snprintf(buffer, 80, "MDEC TEST *%02X*",
data->mdectest_selection);
font_draw_sm(buffer, vx, vy);
} else font_draw_sm(*txt, vx, vy);
if(data->menu_choice == cursel) font_reset_color();