mirror of
https://github.com/luksamuk/engine-psx.git
synced 2025-04-28 13:28:02 +03:00
Add slideshow screen and replace FMVs
This commit is contained in:
parent
33198ffb99
commit
d7f00e80d3
15 changed files with 218 additions and 121 deletions
BIN
assets/misc/PS30YRS.TIM
Normal file
BIN
assets/misc/PS30YRS.TIM
Normal file
Binary file not shown.
BIN
assets/misc/PS30YRS.png
Normal file
BIN
assets/misc/PS30YRS.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
assets/misc/SEGALOGO.TIM
Normal file
BIN
assets/misc/SEGALOGO.TIM
Normal file
Binary file not shown.
BIN
assets/misc/SEGALOGO.png
Normal file
BIN
assets/misc/SEGALOGO.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
|
@ -10,7 +10,7 @@ typedef enum {
|
|||
SCREEN_FMV,
|
||||
SCREEN_TITLE,
|
||||
SCREEN_MODELTEST,
|
||||
SCREEN_COMINGSOON,
|
||||
SCREEN_SLIDE,
|
||||
SCREEN_CREDITS,
|
||||
} ScreenIndex;
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef SCREENS_COMINGSOON_H
|
||||
#define SCREENS_COMINGSOON_H
|
||||
|
||||
void screen_comingsoon_load();
|
||||
void screen_comingsoon_unload(void *);
|
||||
void screen_comingsoon_update(void *);
|
||||
void screen_comingsoon_draw(void *);
|
||||
|
||||
#endif
|
18
include/screens/slide.h
Normal file
18
include/screens/slide.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef SCREENS_SLIDE_H
|
||||
#define SCREENS_SLIDE_H
|
||||
|
||||
typedef enum {
|
||||
SLIDE_COMINGSOON = 0,
|
||||
SLIDE_PS30YRS = 1,
|
||||
SLIDE_SEGALOGO = 2,
|
||||
|
||||
SLIDE_NUM_SLIDES = (SLIDE_SEGALOGO + 1),
|
||||
} SlideOption;
|
||||
|
||||
void screen_slide_load();
|
||||
void screen_slide_unload(void *);
|
||||
void screen_slide_update(void *);
|
||||
void screen_slide_draw(void *);
|
||||
|
||||
void screen_slide_set_next(SlideOption);
|
||||
#endif
|
6
iso.xml
6
iso.xml
|
@ -256,6 +256,12 @@
|
|||
<file name="SOON.TIM"
|
||||
type="data"
|
||||
source="${PROJECT_SOURCE_DIR}/assets/misc/SOON.TIM" />
|
||||
<file name="PS30YRS.TIM"
|
||||
type="data"
|
||||
source="${PROJECT_SOURCE_DIR}/assets/misc/PS30YRS.TIM" />
|
||||
<file name="SEGALOGO.TIM"
|
||||
type="data"
|
||||
source="${PROJECT_SOURCE_DIR}/assets/misc/SEGALOGO.TIM" />
|
||||
<file name="LVLSEL.TIM"
|
||||
type="data"
|
||||
source="${PROJECT_SOURCE_DIR}/assets/misc/LVLSEL.TIM" />
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "screen.h"
|
||||
#include "screens/level.h"
|
||||
#include "screens/slide.h"
|
||||
|
||||
#define ANIM_WALKING 0x0854020e
|
||||
|
||||
|
@ -276,7 +277,8 @@ _goal_sign_update(ObjectState *state, ObjectTableEntry *, VECTOR *pos)
|
|||
} else screen_level_setlevel(lvl + 1);
|
||||
scene_change(SCREEN_LEVEL);
|
||||
} else {
|
||||
scene_change(SCREEN_COMINGSOON);
|
||||
screen_slide_set_next(SLIDE_COMINGSOON);
|
||||
scene_change(SCREEN_SLIDE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
14
src/screen.c
14
src/screen.c
|
@ -15,7 +15,7 @@
|
|||
#include "screens/fmv.h"
|
||||
#include "screens/title.h"
|
||||
#include "screens/modeltest.h"
|
||||
#include "screens/comingsoon.h"
|
||||
#include "screens/slide.h"
|
||||
#include "screens/credits.h"
|
||||
|
||||
// Start with 64k until we make the actual level scene
|
||||
|
@ -58,7 +58,9 @@ void
|
|||
scene_change(ScreenIndex scr)
|
||||
{
|
||||
printf("Change scene: %d -> %d\n", current_scene, scr);
|
||||
render_loading_logo();
|
||||
|
||||
if(!(scr == SCREEN_SLIDE && current_scene == SCREEN_SLIDE))
|
||||
render_loading_logo();
|
||||
|
||||
if(current_scene >= 0)
|
||||
scene_unload();
|
||||
|
@ -76,7 +78,7 @@ scene_load()
|
|||
case SCREEN_FMV: screen_fmv_load(); break;
|
||||
case SCREEN_TITLE: screen_title_load(); break;
|
||||
case SCREEN_MODELTEST: screen_modeltest_load(); break;
|
||||
case SCREEN_COMINGSOON: screen_comingsoon_load(); break;
|
||||
case SCREEN_SLIDE: screen_slide_load(); break;
|
||||
case SCREEN_CREDITS: screen_credits_load(); break;
|
||||
default: break; // Unknown scene???
|
||||
}
|
||||
|
@ -92,7 +94,7 @@ scene_unload()
|
|||
case SCREEN_FMV: screen_fmv_unload(scene_data); break;
|
||||
case SCREEN_TITLE: screen_title_unload(scene_data); break;
|
||||
case SCREEN_MODELTEST: screen_modeltest_unload(scene_data); break;
|
||||
case SCREEN_COMINGSOON: screen_comingsoon_unload(scene_data); break;
|
||||
case SCREEN_SLIDE: screen_slide_unload(scene_data); break;
|
||||
case SCREEN_CREDITS: screen_credits_unload(scene_data); break;
|
||||
default: break; // Unknown scene???
|
||||
}
|
||||
|
@ -108,7 +110,7 @@ scene_update()
|
|||
case SCREEN_FMV: screen_fmv_update(scene_data); break;
|
||||
case SCREEN_TITLE: screen_title_update(scene_data); break;
|
||||
case SCREEN_MODELTEST: screen_modeltest_update(scene_data); break;
|
||||
case SCREEN_COMINGSOON: screen_comingsoon_update(scene_data); break;
|
||||
case SCREEN_SLIDE: screen_slide_update(scene_data); break;
|
||||
case SCREEN_CREDITS: screen_credits_update(scene_data); break;
|
||||
default: break; // Unknown scene???
|
||||
}
|
||||
|
@ -125,7 +127,7 @@ scene_draw()
|
|||
case SCREEN_FMV: screen_fmv_draw(scene_data); break;
|
||||
case SCREEN_TITLE: screen_title_draw(scene_data); break;
|
||||
case SCREEN_MODELTEST: screen_modeltest_draw(scene_data); break;
|
||||
case SCREEN_COMINGSOON: screen_comingsoon_draw(scene_data); break;
|
||||
case SCREEN_SLIDE: screen_slide_draw(scene_data); break;
|
||||
case SCREEN_CREDITS: screen_credits_draw(scene_data); break;
|
||||
default: break; // Unknown scene???
|
||||
}
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "screen.h"
|
||||
#include "screens/comingsoon.h"
|
||||
#include "render.h"
|
||||
#include "util.h"
|
||||
#include "input.h"
|
||||
#include "sound.h"
|
||||
|
||||
typedef struct {
|
||||
int32_t prectx;
|
||||
int32_t precty;
|
||||
uint8_t mode;
|
||||
uint8_t fade;
|
||||
int16_t counter;
|
||||
uint8_t state;
|
||||
} screen_comingsoon_data;
|
||||
|
||||
void
|
||||
screen_comingsoon_load()
|
||||
{
|
||||
screen_comingsoon_data *data = screen_alloc(sizeof(screen_comingsoon_data));
|
||||
|
||||
uint32_t length;
|
||||
TIM_IMAGE img;
|
||||
uint8_t *bin = file_read("\\MISC\\SOON.TIM;1", &length);
|
||||
load_texture(bin, &img);
|
||||
data->mode = img.mode;
|
||||
data->prectx = img.prect->x;
|
||||
data->precty = img.prect->y;
|
||||
free(bin);
|
||||
|
||||
data->fade = 0;
|
||||
data->counter = 0;
|
||||
data->state = 0;
|
||||
|
||||
sound_bgm_play(BGM_TITLESCREEN);
|
||||
}
|
||||
|
||||
void
|
||||
screen_comingsoon_unload(void *)
|
||||
{
|
||||
sound_stop_xa();
|
||||
screen_free();
|
||||
}
|
||||
|
||||
void
|
||||
screen_comingsoon_update(void *d)
|
||||
{
|
||||
sound_bgm_check_stop(BGM_TITLESCREEN);
|
||||
|
||||
screen_comingsoon_data *data = (screen_comingsoon_data *)d;
|
||||
if(data->state == 0) {
|
||||
if(data->fade < 128) {
|
||||
data->fade += 2;
|
||||
} else {
|
||||
data->state = 1;
|
||||
data->counter = 1500; // 25 seconds
|
||||
}
|
||||
} else if(data->state == 1) {
|
||||
data->counter--;
|
||||
|
||||
if(pad_pressed(PAD_START) || pad_pressed(PAD_CROSS)) {
|
||||
data->counter = 0;
|
||||
}
|
||||
|
||||
if(data->counter <= 0) {
|
||||
data->state = 2;
|
||||
}
|
||||
} else {
|
||||
if(data->fade > 0) data->fade -= 2;
|
||||
else scene_change(SCREEN_CREDITS);
|
||||
}
|
||||
}
|
||||
|
||||
void screen_comingsoon_draw(void *d)
|
||||
{
|
||||
screen_comingsoon_data *data = (screen_comingsoon_data *)d;
|
||||
POLY_FT4 *poly = (POLY_FT4 *)get_next_prim();
|
||||
increment_prim(sizeof(POLY_FT4));
|
||||
setPolyFT4(poly);
|
||||
setRGB0(poly, data->fade, data->fade, data->fade);
|
||||
poly->tpage = getTPage(data->mode & 0x3,
|
||||
0,
|
||||
data->prectx,
|
||||
data->precty);
|
||||
poly->clut = 0;
|
||||
setXYWH(poly, 32, 0, 255, 240);
|
||||
setUVWH(poly, 0, 0, 255, 239);
|
||||
sort_prim(poly, OTZ_LAYER_TOPMOST);
|
||||
}
|
|
@ -7,7 +7,8 @@
|
|||
#include "screen.h"
|
||||
#include "render.h"
|
||||
|
||||
#include "screens/fmv.h"
|
||||
//#include "screens/fmv.h"
|
||||
#include "screens/slide.h"
|
||||
#include "screens/level.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -52,10 +53,11 @@ screen_disclaimer_update(void *d)
|
|||
// Change to level select
|
||||
scene_change(SCREEN_LEVELSELECT);
|
||||
} else {
|
||||
// Prepare intro, but also prepare level
|
||||
screen_fmv_set_next(SCREEN_TITLE);
|
||||
screen_fmv_enqueue(FMV_PS30YRS);
|
||||
scene_change(SCREEN_FMV);
|
||||
//screen_fmv_set_next(SCREEN_TITLE);
|
||||
//screen_fmv_enqueue(FMV_PS30YRS);
|
||||
//scene_change(SCREEN_FMV);
|
||||
screen_slide_set_next(SLIDE_SEGALOGO);
|
||||
scene_change(SCREEN_SLIDE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#include "basic_font.h"
|
||||
#include "demo.h"
|
||||
|
||||
#include "screens/fmv.h"
|
||||
|
||||
extern int debug_mode;
|
||||
extern PlayerConstants CNST_DEFAULT;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "render.h"
|
||||
#include "screens/level.h"
|
||||
#include "screens/fmv.h"
|
||||
#include "screens/slide.h"
|
||||
#include "sound.h"
|
||||
#include "util.h"
|
||||
#include "timer.h"
|
||||
|
@ -16,9 +17,9 @@
|
|||
|
||||
#define CHOICE_SOUNDTEST 19
|
||||
#define CHOICE_MDEC 20
|
||||
#define CHOICE_MODELTEST 21
|
||||
#define CHOICE_TITLE 22
|
||||
#define CHOICE_SOON 23
|
||||
#define CHOICE_SLIDE 21
|
||||
#define CHOICE_MODELTEST 22
|
||||
#define CHOICE_TITLE 23
|
||||
#define CHOICE_CREDITS 24
|
||||
#define MAX_LEVELS (CHOICE_CREDITS + 1)
|
||||
#define MAX_COLUMN_CHOICES 15
|
||||
|
@ -37,6 +38,7 @@ typedef struct {
|
|||
uint8_t music_selected;
|
||||
uint8_t soundtest_selection;
|
||||
uint8_t mdectest_selection;
|
||||
uint8_t slidetest_selection;
|
||||
} screen_levelselect_data;
|
||||
|
||||
extern int debug_mode;
|
||||
|
@ -64,11 +66,11 @@ static const char *menutext[] = {
|
|||
"\n",
|
||||
"SOUND TEST *??*",
|
||||
"MDEC TEST *??*",
|
||||
"SLIDE TEST *??*",
|
||||
"\n",
|
||||
"\n",
|
||||
"MODELTEST",
|
||||
"TITLESCREEN",
|
||||
"COMINGSOON",
|
||||
"CREDITS",
|
||||
NULL,
|
||||
};
|
||||
|
@ -100,6 +102,7 @@ screen_levelselect_load()
|
|||
data->music_selected = 0;
|
||||
data->soundtest_selection = 0x00;
|
||||
data->mdectest_selection = 0x00;
|
||||
data->slidetest_selection = 0x00;
|
||||
|
||||
// Regardless of the level, reset score.
|
||||
// You're already cheating, I'm not going to allow you
|
||||
|
@ -176,6 +179,16 @@ screen_levelselect_update(void *d)
|
|||
data->mdectest_selection = 0;
|
||||
else data->mdectest_selection++;
|
||||
}
|
||||
} else if(data->menu_choice == CHOICE_SLIDE) {
|
||||
if(pad_pressed(PAD_LEFT)) {
|
||||
if(data->slidetest_selection == 0)
|
||||
data->slidetest_selection = SLIDE_NUM_SLIDES - 1;
|
||||
else data->slidetest_selection--;
|
||||
} else if(pad_pressed(PAD_RIGHT)) {
|
||||
if(data->slidetest_selection == SLIDE_NUM_SLIDES - 1)
|
||||
data->slidetest_selection = 0;
|
||||
else data->slidetest_selection++;
|
||||
}
|
||||
}
|
||||
|
||||
if(pad_pressed(PAD_DOWN))
|
||||
|
@ -186,6 +199,7 @@ screen_levelselect_update(void *d)
|
|||
} else if(
|
||||
(data->menu_choice != CHOICE_SOUNDTEST)
|
||||
&& (data->menu_choice != CHOICE_MDEC)
|
||||
&& (data->menu_choice != CHOICE_SLIDE)
|
||||
&& (pad_pressed(PAD_LEFT) || pad_pressed(PAD_RIGHT))) {
|
||||
if(data->menu_choice < MAX_COLUMN_CHOICES - 1) {
|
||||
data->menu_choice += MAX_COLUMN_CHOICES - 1;
|
||||
|
@ -205,8 +219,9 @@ screen_levelselect_update(void *d)
|
|||
scene_change(SCREEN_FMV);
|
||||
} else if(data->menu_choice == CHOICE_MODELTEST) {
|
||||
scene_change(SCREEN_MODELTEST);
|
||||
} else if(data->menu_choice == CHOICE_SOON) {
|
||||
scene_change(SCREEN_COMINGSOON);
|
||||
} else if(data->menu_choice == CHOICE_SLIDE) {
|
||||
screen_slide_set_next(data->slidetest_selection);
|
||||
scene_change(SCREEN_SLIDE);
|
||||
} else if(data->menu_choice == CHOICE_CREDITS) {
|
||||
scene_change(SCREEN_CREDITS);
|
||||
} else if(data->menu_choice == CHOICE_SOUNDTEST) {
|
||||
|
@ -293,6 +308,11 @@ screen_levelselect_draw(void *d)
|
|||
snprintf(buffer, 80, "MDEC TEST *%02X*",
|
||||
data->mdectest_selection);
|
||||
font_draw_sm(buffer, vx, vy);
|
||||
} else if(cursel == CHOICE_SLIDE) {
|
||||
char buffer[80];
|
||||
snprintf(buffer, 80, "SLIDE TEST *%02X*",
|
||||
data->slidetest_selection);
|
||||
font_draw_sm(buffer, vx, vy);
|
||||
} else font_draw_sm(*txt, vx, vy);
|
||||
|
||||
if(data->menu_choice == cursel) font_reset_color();
|
||||
|
|
149
src/screen_slide.c
Normal file
149
src/screen_slide.c
Normal file
|
@ -0,0 +1,149 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "screen.h"
|
||||
#include "screens/slide.h"
|
||||
#include "render.h"
|
||||
#include "util.h"
|
||||
#include "input.h"
|
||||
#include "sound.h"
|
||||
|
||||
static SlideOption next_slide = -1;
|
||||
|
||||
static volatile const struct {
|
||||
const char *image;
|
||||
BGMOption bgm;
|
||||
ScreenIndex next;
|
||||
SlideOption next_slide;
|
||||
int16_t duration; // In frames (1 second = 60 frames)
|
||||
} slide_table[] = {
|
||||
// Put TIM images at 320x0 (no CLUT):
|
||||
// $ img2tim -usealpha -org 320 0 -bpp 16 -o IMAGE.TIM IMAGE.png
|
||||
// I recommend images to be 255x240.
|
||||
{
|
||||
.image = "\\MISC\\SOON.TIM;1",
|
||||
.bgm = BGM_TITLESCREEN,
|
||||
.next = SCREEN_CREDITS,
|
||||
.next_slide = 0xff,
|
||||
.duration = 1500
|
||||
},
|
||||
{
|
||||
.image = "\\MISC\\PS30YRS.TIM;1",
|
||||
.bgm = 0xff,
|
||||
.next = SCREEN_TITLE,
|
||||
.next_slide = 0xff,
|
||||
.duration = 180
|
||||
},
|
||||
{
|
||||
.image = "\\MISC\\SEGALOGO.TIM;1",
|
||||
.bgm = 0xff,
|
||||
.next = SCREEN_SLIDE,
|
||||
.next_slide = SLIDE_PS30YRS,
|
||||
.duration = 180
|
||||
},
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
SlideOption current;
|
||||
int32_t prectx;
|
||||
int32_t precty;
|
||||
uint8_t mode;
|
||||
uint8_t fade;
|
||||
uint8_t state;
|
||||
int16_t counter;
|
||||
BGMOption bgm;
|
||||
ScreenIndex next;
|
||||
} screen_slide_data;
|
||||
|
||||
void
|
||||
screen_slide_load()
|
||||
{
|
||||
screen_slide_data *data = screen_alloc(sizeof(screen_slide_data));
|
||||
data->current = next_slide; next_slide = -1;
|
||||
|
||||
// Prepare for next screen
|
||||
const char *slide_image_path = slide_table[data->current].image;
|
||||
data->next = slide_table[data->current].next;
|
||||
data->bgm = slide_table[data->current].bgm;
|
||||
data->counter = slide_table[data->current].duration;
|
||||
|
||||
// Load image data
|
||||
uint32_t length;
|
||||
TIM_IMAGE img;
|
||||
uint8_t *bin = file_read(slide_image_path, &length);
|
||||
load_texture(bin, &img);
|
||||
data->mode = img.mode;
|
||||
data->prectx = img.prect->x;
|
||||
data->precty = img.prect->y;
|
||||
free(bin);
|
||||
|
||||
// Initialize counters
|
||||
data->fade = 0;
|
||||
data->state = 0;
|
||||
|
||||
// Play BGM if needed
|
||||
if(data->bgm != 0xff) sound_bgm_play(data->bgm);
|
||||
}
|
||||
|
||||
void
|
||||
screen_slide_unload(void *d)
|
||||
{
|
||||
screen_slide_data *data = (screen_slide_data *)d;
|
||||
|
||||
if(data->bgm != 0xff) sound_stop_xa();
|
||||
screen_free();
|
||||
}
|
||||
|
||||
void
|
||||
screen_slide_update(void *d)
|
||||
{
|
||||
screen_slide_data *data = (screen_slide_data *)d;
|
||||
|
||||
if(data->bgm != 0xff) sound_bgm_check_stop(data->bgm);
|
||||
|
||||
if(data->state == 0) {
|
||||
if(data->fade < 128) data->fade += 2;
|
||||
else data->state = 1;
|
||||
} else if(data->state == 1) {
|
||||
data->counter--;
|
||||
|
||||
if(pad_pressed(PAD_START) || pad_pressed(PAD_CROSS)) {
|
||||
data->counter = 0;
|
||||
}
|
||||
|
||||
if(data->counter <= 0) data->state = 2;
|
||||
} else {
|
||||
if(data->fade > 0) data->fade -= 2;
|
||||
else {
|
||||
if(data->next == SCREEN_SLIDE) {
|
||||
next_slide = slide_table[data->current].next_slide;
|
||||
}
|
||||
scene_change(data->next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
screen_slide_draw(void *d)
|
||||
{
|
||||
screen_slide_data *data = (screen_slide_data *)d;
|
||||
POLY_FT4 *poly = (POLY_FT4 *)get_next_prim();
|
||||
increment_prim(sizeof(POLY_FT4));
|
||||
setPolyFT4(poly);
|
||||
setRGB0(poly, data->fade, data->fade, data->fade);
|
||||
poly->tpage = getTPage(data->mode & 0x3,
|
||||
0,
|
||||
data->prectx,
|
||||
data->precty);
|
||||
poly->clut = 0;
|
||||
setXYWH(poly, 32, 0, 255, 240);
|
||||
setUVWH(poly, 0, 0, 255, 239);
|
||||
sort_prim(poly, OTZ_LAYER_TOPMOST);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
screen_slide_set_next(SlideOption opt)
|
||||
{
|
||||
next_slide = opt;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue