Break out some credit text stuff into a C file (#157)

* Break out some credit text stuff into a C file

Signed-off-by: Taggerung <tyler.taggerung@gmail.com>

* Add some comments for better clarity

Also delete the asm file for a function that was matched in the
 previous commit

Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
This commit is contained in:
Tyler McGavran
2022-02-03 23:06:30 -05:00
committed by GitHub
parent 2f6c87f14f
commit 64e8934b30
8 changed files with 994 additions and 979 deletions
+7 -5
View File
@@ -3,6 +3,7 @@
#include <defines.h>
#include "code_80091750.h"
#include "code_800AF9B0.h"
#include "credits_01.h"
#include "variables.h"
// TODO: Move gGfxPool out of main.h
// Unfortunately that's not a small effort due to weird import structure in this project
@@ -794,18 +795,19 @@ s32 char_to_glyph_index(char *character) {
index = -1;
// Interpreting characters as signed numbers, so check if the character is "negative"
} else if (*character < 0) {
// Handling katakana characters
switch (*character) { /* switch 1 */
case -92: /* switch 1 */
case 0xA4: /* switch 1 */
// WARNING: Not sure about the arguments to the following 3 functions, its not clear
// what they exepct
index = func_80092E1C(character + 1);
break;
case -91: /* switch 1 */
case 0xA5: /* switch 1 */
index = func_80092DF8(character + 1);
break;
case -85: /* switch 1 */
case -93: /* switch 1 */
case -95: /* switch 1 */
case 0xAB: /* switch 1 */
case 0xA3: /* switch 1 */
case 0xA1: /* switch 1 */
index = func_80092EE4(character);
break;
}
-17
View File
@@ -44,21 +44,6 @@ typedef struct {
/* 0x04 */ s32 offset;
} struct_8018E118_entry; // size = 0x08
// In some way dictates how the text is written during the credit sequence
typedef struct {
// Scaling factor that affects the x/y scaling and tracking of printed text
/* 0x00 */ f32 textScaling;
// Column to start sliding in from
/* 0x04 */ s16 startingColumn;
/* 0x06 */ s16 row;
// Extra distance added to the destination column
/* 0x08 */ s16 columnExtra;
/* 0x0A */ s16 unknown; // No idea what this is for, has a value but never seems to be read
/* 0x0C */ s8 slideDirection; // 0 for slide right, 1 for slide left. May have other uses/effects
/* 0x0D */ s8 textColor;
/* 0x0E */ s16 padding; // Always seems to be 0, never read (that I can see)
} struct_802850C0_entry; // size = 0x10
/* Function Prototypes */
f64 exponent_by_squaring(f64, s32);
@@ -185,7 +170,6 @@ void func_80057CE4();
#define D_8018D9E0_SIZE 0x20
#define D_8018DEE0_SIZE 0x10
#define D_8018E118_SIZE 0xC8
#define D_802850C0_SIZE 0x3F
/* This is where I'd put my static data, if I had any */
@@ -250,7 +234,6 @@ extern struct_8018DEE0_entry D_8018DEE0[D_8018DEE0_SIZE]; // D_8018DEE0
extern s32 gD_8018E118TotalSize; // D_8018E110
extern struct_8018E118_entry D_8018E118[D_8018E118_SIZE]; // D_8018E118
extern s32 gNumD_8018E118Entries; // D_8018E758
extern struct_802850C0_entry D_802850C0[D_802850C0_SIZE]; // D_802850C0
extern s8 gTextColor; // D_8018E860
extern s8 D_8018ED91;
extern s32 D_8018E850;
+27
View File
@@ -0,0 +1,27 @@
#ifndef CREDIT_01_H
#define CREDIT_01_H
#include "PR/ultratypes.h"
#define SLIDE_RIGHT 0
#define SLIDE_LEFT 1
// In some way dictates how the text is written during the credit sequence
typedef struct {
// Scaling factor that affects the x/y scaling and tracking of printed text
/* 0x00 */ f32 textScaling;
// Column to start sliding in from
/* 0x04 */ s16 startingColumn;
/* 0x06 */ s16 row;
// Extra distance added to the destination column
/* 0x08 */ s16 columnExtra;
/* 0x0A */ s16 unknown; // No idea what this is for, has a value but never seems to be read
/* 0x0C */ s8 slideDirection; // 0 for slide right, 1 for slide left. May have other uses/effects
/* 0x0D */ s8 textColor;
/* 0x0E */ s16 padding; // Always seems to be 0, never read (that I can see)
} struct_802850C0_entry; // size = 0x10
extern struct_802850C0_entry D_802850C0[]; // D_802850C0
extern char *D_802854B0[];
#endif
+109
View File
@@ -0,0 +1,109 @@
#include "credits_01.h"
#include "defines.h"
struct_802850C0_entry D_802850C0[] = {
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.90f, 520, 200, 160, 200, SLIDE_LEFT, TEXT_BLUE, 0},
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.90f, 520, 200, 160, 200, SLIDE_LEFT, TEXT_YELLOW, 0},
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.90f, 520, 200, 160, 200, SLIDE_LEFT, TEXT_RED, 0},
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.90f, 520, 200, 160, 200, SLIDE_LEFT, TEXT_GREEN, 0},
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.80f, 520, 175, 160, 175, SLIDE_LEFT, TEXT_BLUE, 0},
{0.80f, 620, 195, 160, 195, SLIDE_LEFT, TEXT_YELLOW, 0},
{0.80f, 720, 215, 160, 215, SLIDE_LEFT, TEXT_RED, 0},
{0.80f, 520, 175, 160, 175, SLIDE_LEFT, TEXT_GREEN, 0},
{0.80f, 620, 195, 160, 195, SLIDE_LEFT, TEXT_BLUE, 0},
{0.80f, 720, 215, 160, 215, SLIDE_LEFT, TEXT_YELLOW, 0},
{0.80f, -200, 38, 152, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.90f, 520, 180, 160, 180, SLIDE_LEFT, TEXT_RED, 0},
{0.90f, 620, 210, 160, 210, SLIDE_LEFT, TEXT_GREEN, 0},
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.90f, 520, 200, 160, 200, SLIDE_LEFT, TEXT_BLUE, 0},
{0.80f, -200, 38, 152, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.80f, 520, 175, 160, 175, SLIDE_LEFT, TEXT_YELLOW, 0},
{0.80f, 620, 195, 160, 195, SLIDE_LEFT, TEXT_RED, 0},
{0.80f, 720, 215, 160, 215, SLIDE_LEFT, TEXT_GREEN, 0},
{0.80f, 520, 175, 160, 175, SLIDE_LEFT, TEXT_BLUE, 0},
{0.80f, 620, 195, 160, 195, SLIDE_LEFT, TEXT_YELLOW, 0},
{0.80f, 720, 215, 160, 215, SLIDE_LEFT, TEXT_RED, 0},
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.80f, 520, 175, 160, 175, SLIDE_LEFT, TEXT_GREEN, 0},
{0.80f, 620, 195, 160, 195, SLIDE_LEFT, TEXT_BLUE, 0},
{0.80f, 720, 215, 160, 215, SLIDE_LEFT, TEXT_YELLOW, 0},
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.90f, 520, 200, 160, 200, SLIDE_LEFT, TEXT_RED, 0},
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.90f, 520, 180, 160, 180, SLIDE_LEFT, TEXT_GREEN, 0},
{0.90f, 620, 210, 160, 210, SLIDE_LEFT, TEXT_BLUE, 0},
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.80f, 520, 175, 160, 175, SLIDE_LEFT, TEXT_GREEN, 0},
{0.80f, 620, 195, 160, 195, SLIDE_LEFT, TEXT_BLUE, 0},
{0.80f, 720, 215, 160, 215, SLIDE_LEFT, TEXT_YELLOW, 0},
{0.65f, 820, 195, 220, 195, SLIDE_LEFT, TEXT_BLUE, 0},
{0.65f, 720, 215, 100, 215, SLIDE_LEFT, TEXT_BLUE, 0},
{0.65f, 920, 215, 220, 215, SLIDE_LEFT, TEXT_RED, 0},
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.80f, 520, 175, 160, 175, SLIDE_LEFT, TEXT_GREEN, 0},
{0.80f, 620, 195, 160, 195, SLIDE_LEFT, TEXT_BLUE, 0},
{0.80f, 720, 215, 160, 215, SLIDE_LEFT, TEXT_YELLOW, 0},
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.90f, 520, 180, 160, 180, SLIDE_LEFT, TEXT_RED, 0},
{0.90f, 620, 210, 160, 210, SLIDE_LEFT, TEXT_GREEN, 0},
{0.80f, -200, 38, 160, 30, SLIDE_RIGHT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.70f, 520, 70, 160, 70, SLIDE_LEFT, TEXT_BLUE, 0},
{0.70f, 520, 90, 160, 90, SLIDE_LEFT, TEXT_YELLOW, 0},
{0.70f, 520, 110, 160, 110, SLIDE_LEFT, TEXT_RED, 0},
{0.70f, 520, 130, 160, 130, SLIDE_LEFT, TEXT_GREEN, 0},
{0.70f, 520, 150, 160, 150, SLIDE_LEFT, TEXT_BLUE, 0},
{0.70f, 520, 170, 160, 170, SLIDE_LEFT, TEXT_YELLOW, 0},
{0.70f, 520, 190, 160, 190, SLIDE_LEFT, TEXT_RED, 0},
{0.45f, 520, 207, 160, 207, SLIDE_LEFT, TEXT_GREEN, 0},
{2.00f, 2925, 210, 150, 210, SLIDE_LEFT, TEXT_BLUE_GREEN_RED_CYCLE_1, 0},
{0.90f, 520, 130, 160, 130, SLIDE_LEFT, TEXT_YELLOW, 0},
};
// These are pointers to the actual credit text after its been copied out of
// the cartridge ROM
// It would be nice to find a way to instantiate this array that didn't involve
// a bunch of type-casting
char *D_802854B0[] = {
// English Credits
(char*) 0x80286BB0, (char*) 0x80286BC4, (char*) 0x80286BD8, (char*) 0x80286BE4,
(char*) 0x80286BF8, (char*) 0x80286C04, (char*) 0x80286C14, (char*) 0x80286C28,
(char*) 0x80286C38, (char*) 0x80286C44, (char*) 0x80286C54, (char*) 0x80286C64,
(char*) 0x80286C78, (char*) 0x80286C88, (char*) 0x80286C98, (char*) 0x80286CAC,
(char*) 0x80286CC8, (char*) 0x80286CCC, (char*) 0x80286CDC, (char*) 0x80286CEC,
(char*) 0x80286CFC, (char*) 0x80286D10, (char*) 0x80286D28, (char*) 0x80286D2C,
(char*) 0x80286D3C, (char*) 0x80286D50, (char*) 0x80286D60, (char*) 0x80286D70,
(char*) 0x80286D80, (char*) 0x80286D90, (char*) 0x80286DA4, (char*) 0x80286DB4,
(char*) 0x80286DC0, (char*) 0x80286DD4, (char*) 0x80286DE4, (char*) 0x80286DF4,
(char*) 0x80286E08, (char*) 0x80286E14, (char*) 0x80286E24, (char*) 0x80286E34,
(char*) 0x80286E48, (char*) 0x80286E54, (char*) 0x80286E64, (char*) 0x80286E68,
(char*) 0x80286E6C, (char*) 0x80286E70, (char*) 0x80286E84, (char*) 0x80286E94,
(char*) 0x80286EA8, (char*) 0x80286EB8, (char*) 0x80286ECC, (char*) 0x80286EDC,
(char*) 0x80286EE8, (char*) 0x80286EF8, (char*) 0x80286F08, (char*) 0x80286F1C,
(char*) 0x80286F2C, (char*) 0x80286F3C, (char*) 0x80286F50, (char*) 0x80286F60,
(char*) 0x80286F74, (char*) 0x80286FAC, (char*) 0x80286FB4,
// Japanese Credits
(char*) 0x80286FC8, (char*) 0x80286FE8, (char*) 0x80286FF8, (char*) 0x80287008,
(char*) 0x80287018, (char*) 0x80287028, (char*) 0x80287038, (char*) 0x80287054,
(char*) 0x80287068, (char*) 0x80287078, (char*) 0x80287088, (char*) 0x80287098,
(char*) 0x802870AC, (char*) 0x802870BC, (char*) 0x802870CC, (char*) 0x802870E0,
(char*) 0x80287100, (char*) 0x80287104, (char*) 0x80287114, (char*) 0x80287124,
(char*) 0x8028713C, (char*) 0x8028714C, (char*) 0x80287168, (char*) 0x8028716C,
(char*) 0x80287180, (char*) 0x80287194, (char*) 0x802871A4, (char*) 0x802871B4,
(char*) 0x802871C8, (char*) 0x802871D8, (char*) 0x802871F0, (char*) 0x80287200,
(char*) 0x8028720C, (char*) 0x80287220, (char*) 0x8028723C, (char*) 0x8028724C,
(char*) 0x80287264, (char*) 0x80287274, (char*) 0x80287284, (char*) 0x8028729C,
(char*) 0x802872AC, (char*) 0x802872BC, (char*) 0x802872D4, (char*) 0x802872EC,
(char*) 0x80287300, (char*) 0x80287314, (char*) 0x80287328, (char*) 0x80287338,
(char*) 0x80287348, (char*) 0x80287358, (char*) 0x80287374, (char*) 0x80287384,
(char*) 0x80287394, (char*) 0x802873A8, (char*) 0x802873B8, (char*) 0x802873CC,
(char*) 0x802873DC, (char*) 0x802873EC, (char*) 0x802873FC, (char*) 0x80287414,
(char*) 0x8028742C, (char*) 0x8028743C, (char*) 0x80287448,
};