WIP new title screen code

All it does right now is play the title screen sound for 5 seconds
This commit is contained in:
jeffman 2019-09-11 23:21:54 -04:00
parent a2d7dcfbfa
commit c43b2d8f2d
7 changed files with 60 additions and 2 deletions

View File

@ -18,7 +18,8 @@ $input_c_files =
"src/c/fileselect.c",
"src/c/status.c",
"src/c/battle.c",
"src/c/psi.c"
"src/c/psi.c",
"src/c/title.c"
$base_c_address = 0x83755B8;
$scripttool_cmd = "bin/ScriptTool/ScriptTool.dll"

View File

@ -20,3 +20,5 @@ int __attribute__((naked)) m2_clearwindowtiles(WINDOW* window) {}
int __attribute__((naked)) customcodes_parse_generic(int code, char* parserAddress, WINDOW* window, int* dest) {}
void __attribute__((naked)) m2_printstr(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight) {}
void __attribute__((naked)) m2_setupbattlename(short value) {}
void __attribute__((naked)) m2_title_teardown() {}
void __attribute__((naked)) vblank() {}

View File

@ -27,3 +27,4 @@ int *m2_items_offsets = (int*) 0x8B1AF94;
byte *m2_items_strings = (byte*) 0x8B1A694;
unsigned short *name_header_tiles = (unsigned short*) 0x8B1B8B0;
PSIPrintInfo *psi_print_info = (PSIPrintInfo*) 0x8B2A9C0;
int *title_counter = (int*) 0x2011B60;

View File

@ -34,5 +34,6 @@ extern byte *m2_items_strings;
extern unsigned short *name_header_tiles;
extern byte *character_general_data;
extern PSIPrintInfo *psi_print_info;
extern int *title_counter;
#endif

32
src/c/title.c Normal file
View File

@ -0,0 +1,32 @@
#include "title.h"
#include "locs.h"
int title_frame_first()
{
if (*title_counter == 0)
{
m2_soundeffect(0xAF);
}
(*title_counter)++;
if (*title_counter == 5 * 60)
{
m2_title_teardown();
return -1;
}
return 0;
}
int title_frame_second()
{
vblank();
if (*title_counter == 5 * 60)
{
m2_title_teardown();
}
return 0;
}

10
src/c/title.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef HEADER_TITLE_INCLUDED
#define HEADER_TITLE_INCLUDED
int title_frame_first();
int title_frame_second();
extern void m2_title_teardown();
extern void m2_soundeffect(int index);
extern void vblank();
#endif

View File

@ -1542,6 +1542,10 @@ nop
dw 0x2011940
dw 0x2011960
// Expand the null area after the fifth palette buffer (gives us 0x2A0 bytes of nullspace
// starting at 0x2011B60)
.org 0x8011490 :: dw 0x85000128
// Define the proper expected uncompressed sizes
.org 0x801141E :: mov r5,4 :: neg r5,r5
.org 0x8011422 :: ldr r2,[r0,r5]
@ -1549,6 +1553,11 @@ nop
.org 0x8011436 :: ldr r2,[r0,r5]
.org 0x8011440 :: ldr r2,[r0,r5]
// Replace per-frame functions
.org 0x82D6B7C
dw title_frame_first + 1
dw title_frame_second + 1
// --- Animation 5 (quick title screen) ---
.org 0x82D6BD4 :: dh 0x008A // Enable 8-bit BG0
.org 0x82D6BE0 :: dh 0x1100 // Disable BG1
@ -1749,11 +1758,13 @@ dw 0x20 :: .incbin "data/m2-title-text-pal-static.c.bin"
.definelabel m2_sub_d6844 ,0x80D6844
.definelabel m2_setupbattlename ,0x80DCD00
.definelabel m2_stat_symb_checker ,0x8B0EDA4
.definelabel vblank ,0x80F47E4
.definelabel m2_div ,0x80F49D8
.definelabel m2_remainder ,0x80F4A70
.definelabel m2_items ,0x8B1D62C
.definelabel m2_default_names ,0x82B9330
.definelabel m2_psi_print_table ,0x8B2A9C0
.definelabel m2_title_teardown ,0x8000C28
//==============================================================================
// Code files