Skip to content

Commit

Permalink
- Improved intro logos and splash screens
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemioUrbina committed Dec 18, 2024
1 parent 14a4c15 commit 5551da3
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 30 deletions.
2 changes: 1 addition & 1 deletion 240psuite/N64/240pSuite.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ void drawHardwareTestsMenu() {
void drawIntro() {
int cancel = 0;

//cancel = drawMCSScreen(100, 0);
cancel = drawMCSScreen(100, 0);
cancel = drawSplash("rom:/libdragon.sprite", cancel ? 0 : LOGO_HOLD, 16);
cancel = drawSplash("rom:/tiny3d.sprite", cancel ? 0: LOGO_HOLD, 16);
}
Expand Down
15 changes: 13 additions & 2 deletions 240psuite/N64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ ASSETS_WAV_CONV = $(addprefix $(FILESYSTEM_DIR)/,$(notdir $(ASSETS_WAV:%.wav=%.w
ASSETS_GLTF = $(wildcard $(ASSETS_DIR)/*.glb)
ASSETS_GLTF_CONV = $(addprefix $(FILESYSTEM_DIR)/,$(notdir $(ASSETS_GLTF:%.glb=%.t3dm)))

ASSETS_TTF = $(wildcard $(ASSETS_DIR)/*.ttf)
ASSETS_TTF_CONV = $(addprefix $(FILESYSTEM_DIR)/,$(notdir $(ASSETS_TTF:%.ttf=%.font64)))

ASSETS_HELP = $(wildcard $(FILESYSTEM_DIR)/help/*.txt)

#AUDIOCONV_FLAGS ?= --wav-compress 0
Expand All @@ -51,6 +54,11 @@ $(FILESYSTEM_DIR)/%.t3dm: $(ASSETS_DIR)/%.glb
@echo " [T3D-MODEL] $@"
@$(T3D_GLTF_TO_3D) "$<" $@
@$(N64_BINDIR)/mkasset -o $(FILESYSTEM_DIR) $@

$(FILESYSTEM_DIR)/%.font64: $(ASSETS_DIR)/%.ttf
@mkdir -p $(dir $@)
@echo " [FONT] $@"
$(N64_MKFONT) $(MKFONT_FLAGS) -o $(FILESYSTEM_DIR) "$<"

#AUDIO

Expand All @@ -59,6 +67,7 @@ $(FILESYSTEM_DIR)/beep.wav64: AUDIOCONV_FLAGS=--wav-compress 0
$(FILESYSTEM_DIR)/mdfourier-dac-44100.wav64: AUDIOCONV_FLAGS=--wav-compress 0

#compression level 1
$(FILESYSTEM_DIR)/neko_loop.wav64: AUDIOCONV_FLAGS=--wav-compress 1
$(FILESYSTEM_DIR)/sound_test_left.wav64: AUDIOCONV_FLAGS=--wav-compress 1
$(FILESYSTEM_DIR)/sound_test_right.wav64: AUDIOCONV_FLAGS=--wav-compress 1
$(FILESYSTEM_DIR)/sound_test_center.wav64: AUDIOCONV_FLAGS=--wav-compress 1
Expand Down Expand Up @@ -125,7 +134,9 @@ $(FILESYSTEM_DIR)/convergence-05-colorsbl.sprite: MKSPRITE_FLAGS=$(MKSPRITE_EXTR
$(FILESYSTEM_DIR)/rectangle_short.sprite: MKSPRITE_FLAGS=$(MKSPRITE_EXTRA_FLAGS) --format CI4
$(FILESYSTEM_DIR)/rectangle_long.sprite: MKSPRITE_FLAGS=$(MKSPRITE_EXTRA_FLAGS) --format CI4

$(BUILD_DIR)/$(PROJECT_NAME).dfs: $(ASSETS_PNG_CONV) $(ASSETS_WAV_CONV) $(ASSETS_HELP) $(ASSETS_GLTF_CONV)
$(FILESYSTEM_DIR)/BebasNeue-Regular.font64: MKFONT_FLAGS+=--size 19

$(BUILD_DIR)/$(PROJECT_NAME).dfs: $(ASSETS_PNG_CONV) $(ASSETS_WAV_CONV) $(ASSETS_HELP) $(ASSETS_GLTF_CONV) $(ASSETS_TTF_CONV)
$(BUILD_DIR)/$(PROJECT_NAME).elf: $(src:%.c=$(BUILD_DIR)/%.o)

$(PROJECT_NAME).z64: N64_ROM_TITLE = "240p Test Suite"
Expand All @@ -146,7 +157,7 @@ all: $(PROJECT_NAME).z64


clean: # NOTE: DO NOT CLEAN $(ASSETS_HELP), they are stored in the filesystem.
@rm -rf $(ASSETS_PNG_CONV) $(ASSETS_WAV_CONV) $(ASSETS_GLTF_CONV)
@rm -rf $(ASSETS_PNG_CONV) $(ASSETS_WAV_CONV) $(ASSETS_GLTF_CONV) $(ASSETS_TTF_CONV)
@rm -rf $(BUILD_DIR) $(OUTPUT_DIR) $(PROJECT_NAME).z64
.PHONY: clean

Expand Down
Binary file added 240psuite/N64/assets/BebasNeue-Regular.ttf
Binary file not shown.
Binary file added 240psuite/N64/assets/neko_loop.wav
Binary file not shown.
1 change: 0 additions & 1 deletion 240psuite/N64/controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "controller.h"
#include "video.h"

#define JOYTHSHLD 15 // min value for joystick to be a read
#define MINFRAMES 5 // Frames to count joystick held as pad

int JoyCountX = 0;
Expand Down
2 changes: 2 additions & 0 deletions 240psuite/N64/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@

#include <libdragon.h>

#define JOYTHSHLD 15 // min value for joystick to be a read

joypad_buttons_t controllerButtonsDown();
joypad_buttons_t controllerButtonsHeld();
110 changes: 90 additions & 20 deletions 240psuite/N64/mcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,22 @@
#include "controller.h"
#include "video.h"

#define BGCOLOR 0xBB
#define AMBIENT 135
#define BGCOLOR 0xbb
#define FADE_FRAMES 30
#define DISTANCE 300.0f

#define ZOOMIN_3D 0
#define ROTATE_3D 1
#define FADE_3D 2
#define HOLD_3D 2
#define FADE_3D 3

#define MCS_FONT 1

// #8969FF
#define FONT_R 0x89
#define FONT_G 0x69
#define FONT_B 0xFF

typedef struct scenaData_st {
surface_t depthBuffer;
Expand All @@ -52,8 +61,11 @@ typedef struct scenaData_st {
T3DVec3 camTarget;
uint8_t colorAmbient[4];
uint8_t colorDir[4];
uint8_t colorBG;
T3DVec3 lightDirVec;
T3DModel *modelMCS;
rdpq_font_t *font;
uint8_t colorFont[4];
float rotAngle;
} SceneData;

Expand All @@ -70,6 +82,12 @@ void freeSceneData(SceneData *scene) {
t3d_model_free(scene->modelMCS);
scene->modelMCS = NULL;
}

if(scene->font) {
rdpq_text_unregister_font(MCS_FONT);
rdpq_font_free(scene->font);
scene->font = NULL;
}
}

int load3DScene(SceneData *scene) {
Expand Down Expand Up @@ -97,9 +115,9 @@ int load3DScene(SceneData *scene) {
scene->camTarget.v[1] = 0.0f;
scene->camTarget.v[2] = 0.0f;

scene->colorAmbient[0] = 135;
scene->colorAmbient[1] = 135;
scene->colorAmbient[2] = 135;
scene->colorAmbient[0] = 0;
scene->colorAmbient[1] = 0;
scene->colorAmbient[2] = 0;
scene->colorAmbient[3] = 0xff;

scene->colorDir[0] = 0xAA;
Expand All @@ -111,6 +129,8 @@ int load3DScene(SceneData *scene) {
scene->lightDirVec.v[1] = 1.0f;
scene->lightDirVec.v[2] = 1.0f;

scene->colorBG = 0;

t3d_vec3_norm(&scene->lightDirVec);

// Load a model-file, this contains the geometry and some metadata
Expand All @@ -120,6 +140,23 @@ int load3DScene(SceneData *scene) {
return 0;
}

scene->font = rdpq_font_load("rom:/BebasNeue-Regular.font64");
if(!scene->font) {
freeSceneData(scene);
return 0;
}

scene->colorFont[0] = FONT_R;
scene->colorFont[1] = FONT_G;
scene->colorFont[2] = FONT_B;
scene->colorFont[3] = 0;

rdpq_text_register_font(MCS_FONT, scene->font);

rdpq_font_style(scene->font, 0, &(rdpq_fontstyle_t){
.color = RGBA32(scene->colorFont[0], scene->colorFont[1], scene->colorFont[2], scene->colorFont[3]),
});

return 1;
}

Expand All @@ -130,14 +167,14 @@ void fadeColor(uint8_t *color, uint8_t thrshld) {
*color = 0;
}

void raiseColor(uint8_t *color, uint8_t thrshld) {
if(*color < 0xff)
void raiseColor(uint8_t *color, uint8_t thrshld, uint8_t limit) {
if(*color < limit - thrshld)
*color += thrshld;
else
*color = 0xff;
*color = limit;
}

int draw3DScene(SceneData *scene, int frames, uint8_t color, int type, int controls) {
int draw3DScene(SceneData *scene, int frames, int type, int controls) {
int cancel = 0, origFrames = frames;
float modelScale = 0.08f, step = 0;
float rotX = 0.0f, rotZ = 0.0f;
Expand All @@ -156,19 +193,28 @@ int draw3DScene(SceneData *scene, int frames, uint8_t color, int type, int contr
switch(type) {
case ZOOMIN_3D:
scene->camPos.v[2] -= step;
raiseColor(&scene->colorBG, ceil(BGCOLOR/frames), BGCOLOR);
raiseColor(&scene->colorAmbient[0], ceil(AMBIENT/frames), AMBIENT);
raiseColor(&scene->colorAmbient[1], ceil(AMBIENT/frames), AMBIENT);
raiseColor(&scene->colorAmbient[2], ceil(AMBIENT/frames), AMBIENT);
break;
case ROTATE_3D:
if(!controls)
if(!controls) {
scene->rotAngle -= 0.03f;
raiseColor(&scene->colorFont[3], ceil(0xff/frames), 0xff);
}
break;
case FADE_3D:
scene->camPos.v[2] += step;
fadeColor(&color, 5);
fadeColor(&scene->colorAmbient[0], 15);
fadeColor(&scene->colorAmbient[1], 15);
fadeColor(&scene->colorAmbient[2], 15);
fadeColor(&scene->colorBG, ceil(BGCOLOR/frames));
fadeColor(&scene->colorAmbient[0], ceil(AMBIENT/frames));
fadeColor(&scene->colorAmbient[1], ceil(AMBIENT/frames));
fadeColor(&scene->colorAmbient[2], ceil(AMBIENT/frames));
fadeColor(&scene->colorFont[3], ceil(0xff/frames));
scene->rotAngle -= 0.05f;
break;
case HOLD_3D:
break;
default:
break;
}
Expand All @@ -189,7 +235,7 @@ int draw3DScene(SceneData *scene, int frames, uint8_t color, int type, int contr
t3d_frame_start();
t3d_viewport_attach(&scene->viewport);

t3d_screen_clear_color(RGBA32(color, color, color, 0xFF));
t3d_screen_clear_color(RGBA32(scene->colorBG, scene->colorBG, scene->colorBG, 0xFF));
t3d_screen_clear_depth();

t3d_light_set_ambient(scene->colorAmbient);
Expand All @@ -199,7 +245,23 @@ int draw3DScene(SceneData *scene, int frames, uint8_t color, int type, int contr
t3d_matrix_push(scene->modelMatFP);
t3d_model_draw(scene->modelMCS);
t3d_matrix_pop(1);


if(!controls) {
rdpq_font_style(scene->font, 0, &(rdpq_fontstyle_t){
.color = RGBA32(scene->colorFont[0], scene->colorFont[1], scene->colorFont[2], scene->colorFont[3]),
});
rdpq_text_printf(&(rdpq_textparms_t){
.width = 300,
.height = 100,
.align = ALIGN_CENTER,
}, MCS_FONT, 10, 10, "Mega Cat Studios");
rdpq_text_printf(&(rdpq_textparms_t){
.width = 300,
.height = 100,
.align = ALIGN_CENTER,
}, MCS_FONT, 10, 210, "Proud to contribute to the community we love");
}

rdpq_detach_show();
frames --;

Expand Down Expand Up @@ -252,12 +314,18 @@ int draw3DScene(SceneData *scene, int frames, uint8_t color, int type, int contr
}
}

if(cancel) {
scene->colorBG = BGCOLOR;
scene->colorAmbient[0] = AMBIENT;
scene->colorAmbient[1] = AMBIENT;
scene->colorAmbient[2] = AMBIENT;
scene->colorFont[3] = 0xff;
}
return cancel;
}

int drawMCSScreen(int frames, int controls) {
int cancel = 0;

SceneData scene;

if(!load3DScene(&scene))
Expand All @@ -266,12 +334,14 @@ int drawMCSScreen(int frames, int controls) {
t3d_init((T3DInitParams){});

// Zoom in
cancel = draw3DScene(&scene, FADE_FRAMES, BGCOLOR, ZOOMIN_3D, controls);
cancel = draw3DScene(&scene, FADE_FRAMES, ZOOMIN_3D, controls);
// Regular scene
if(!cancel)
cancel = draw3DScene(&scene, frames, BGCOLOR, ROTATE_3D, controls);
cancel = draw3DScene(&scene, frames+4, ROTATE_3D, controls);
if(draw3DScene(&scene, !cancel ? ceil(frames/2) : ceil(frames/8), HOLD_3D, controls))
cancel = true;
// Fade and zoom out
(void)draw3DScene(&scene, FADE_FRAMES, BGCOLOR, FADE_3D, controls);
(void)draw3DScene(&scene, FADE_FRAMES, FADE_3D, controls);

setClearScreen();
waitVsync();
Expand Down
11 changes: 6 additions & 5 deletions 240psuite/N64/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ void drawCredits(int usebuffer) {
qr = loadImage("rom:/qr.sprite");

while(!done) {
int x = 28, y = 40, x2 = 158, y2 = 0;
int x = 28, y = 40, x2 = 164, y2 = 0;

getDisplay();

Expand All @@ -285,7 +285,6 @@ void drawCredits(int usebuffer) {
if(counter == 60*8)
counter = 0;

drawStringS(x, y, 0x00, 0xff, 0x00, "Support & suggestions:"); y += fh;
drawStringS(x+5, y, 0xff, 0xff, 0xff, data); y += fh;

drawStringS(x, y, 0x00, 0xff, 0x00, "SDK:"); y += fh;
Expand All @@ -297,12 +296,14 @@ void drawCredits(int usebuffer) {
drawStringS(x+5, y, 0xff, 0xff, 0xff, "Jose Salot\n(@pepe_salot)"); y += 2*fh;
drawStringS(x2, y2, 0x00, 0xff, 0x00, "Menu Pixel Art:"); y2 += fh;
drawStringS(x2+5, y2, 0xff, 0xff, 0xff, "Asher"); y2 += fh;
drawStringS(x, y, 0x00, 0xff, 0x00, "Puiblished by:"); y += fh;
drawStringS(x+5, y, 0xff, 0xff, 0xff, "Mega Cat Studios"); y += fh;
drawStringS(x, y, 0x00, 0xff, 0x00, "Advisor:"); y += fh;
drawStringS(x+5, y, 0xff, 0xff, 0xff, "Fudoh"); y += fh;
drawStringS(x, y, 0x00, 0xff, 0x00, "Collaboration:"); y += fh;
drawStringS(x+5, y, 0xff, 0xff, 0xff, "shmups regulars"); y += fh+5;
drawStringS(x2, y2, 0x00, 0xff, 0x00, "Music for PLII:"); y2 += fh;
drawStringS(x2+5, y2, 0xff, 0xff, 0xff, "NekoMilkshake"); y2 += fh;
y = y2+fh;

drawStringS(x, y, 0x00, 0xff, 0x00, "Info on using this suite:"); y += fh;
drawStringS(x+5, y, 0xff, 0xff, 0xff, "#Yhttp://junkerhq.net/240p/#Y"); y += fh+5;

Expand Down
2 changes: 1 addition & 1 deletion 240psuite/N64/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void initN64() {
/* Initialize peripherals */
detectConsoleType();

dfs_init(DFS_DEFAULT_LOCATION);
assertf(dfs_init(DFS_DEFAULT_LOCATION) == DFS_ESUCCESS, "dfs_init(): failed");
loadFont();

initVideo();
Expand Down

0 comments on commit 5551da3

Please sign in to comment.