mirror of
https://github.com/SAT-R/sa2.git
synced 2026-10-28 09:43:38 +00:00
Minor adjustments for stage select (#149)
* Minor adjustments for stage select * Document RenderText * Remove old, unused tilesets. Add debug_text tileset
This commit is contained in:
1 parent
0bf4474287
commit
cd970ffda0
20 files changed
+47
-316
No files matched your search
@@ -84,7 +84,7 @@ TOOLS = $(foreach tool,$(TOOLBASE),tools/$(tool)/$(tool)$(EXE))
|
||||
# -I sets an include path
|
||||
# -D defines a symbol
|
||||
CPPFLAGS ?= -iquote include -D $(GAME_REGION)
|
||||
CC1FLAGS ?= -Wimplicit -Wparentheses -Werror -Wno-parentheses-equality
|
||||
CC1FLAGS ?= -Wimplicit -Wparentheses -Werror
|
||||
|
||||
SDL_MINGW_PKG := ext/SDL2-2.30.3/i686-w64-mingw32
|
||||
SDL_MINGW_INCLUDE := $(SDL_MINGW_PKG)/include/SDL2
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 569 B |
@@ -1,259 +0,0 @@
|
||||
JASC-PAL
|
||||
0100
|
||||
256
|
||||
172 139 180
|
||||
222 255 0
|
||||
164 238 57
|
||||
90 197 0
|
||||
57 164 0
|
||||
57 123 0
|
||||
16 90 0
|
||||
41 74 0
|
||||
32 57 0
|
||||
197 255 0
|
||||
164 238 16
|
||||
131 213 32
|
||||
98 189 49
|
||||
65 164 74
|
||||
32 139 90
|
||||
0 115 106
|
||||
0 139 255
|
||||
255 222 148
|
||||
255 213 115
|
||||
246 205 65
|
||||
238 197 115
|
||||
255 189 0
|
||||
238 180 41
|
||||
205 148 16
|
||||
180 131 24
|
||||
189 139 74
|
||||
131 123 0
|
||||
123 106 8
|
||||
139 98 49
|
||||
90 90 0
|
||||
41 74 0
|
||||
32 57 0
|
||||
172 139 180
|
||||
255 49 0
|
||||
222 32 0
|
||||
156 16 0
|
||||
98 0 0
|
||||
255 255 255
|
||||
205 205 189
|
||||
115 115 115
|
||||
8 8 8
|
||||
49 172 255
|
||||
65 115 222
|
||||
65 82 172
|
||||
49 65 139
|
||||
255 238 0
|
||||
255 189 0
|
||||
255 139 0
|
||||
49 98 205
|
||||
131 131 131
|
||||
172 172 172
|
||||
213 213 213
|
||||
255 255 255
|
||||
180 8 0
|
||||
255 41 0
|
||||
255 123 0
|
||||
255 238 0
|
||||
49 98 205
|
||||
57 148 230
|
||||
74 197 255
|
||||
131 246 246
|
||||
57 123 0
|
||||
41 74 0
|
||||
32 57 0
|
||||
0 0 0
|
||||
255 238 0
|
||||
255 189 0
|
||||
238 123 0
|
||||
180 57 0
|
||||
164 238 57
|
||||
90 197 0
|
||||
57 123 0
|
||||
16 90 0
|
||||
49 98 205
|
||||
57 148 230
|
||||
74 197 255
|
||||
131 246 246
|
||||
255 106 180
|
||||
255 164 222
|
||||
255 222 255
|
||||
0 0 0
|
||||
246 197 74
|
||||
180 164 74
|
||||
123 123 65
|
||||
57 82 57
|
||||
0 49 57
|
||||
0 0 0
|
||||
0 0 0
|
||||
222 255 0
|
||||
164 238 57
|
||||
90 197 0
|
||||
57 164 0
|
||||
57 123 0
|
||||
16 90 0
|
||||
41 74 0
|
||||
32 57 0
|
||||
255 255 255
|
||||
115 8 0
|
||||
164 41 0
|
||||
213 65 0
|
||||
255 98 0
|
||||
255 123 0
|
||||
255 238 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
222 255 0
|
||||
164 238 57
|
||||
90 197 0
|
||||
57 164 0
|
||||
57 123 0
|
||||
16 90 0
|
||||
41 74 0
|
||||
32 57 0
|
||||
238 180 41
|
||||
255 213 115
|
||||
180 131 24
|
||||
123 106 8
|
||||
90 90 0
|
||||
205 148 16
|
||||
139 98 49
|
||||
0 0 0
|
||||
255 255 255
|
||||
255 246 82
|
||||
255 205 0
|
||||
255 189 0
|
||||
255 172 0
|
||||
57 57 57
|
||||
115 115 115
|
||||
172 172 172
|
||||
213 213 213
|
||||
255 255 255
|
||||
131 246 246
|
||||
74 197 255
|
||||
57 148 230
|
||||
49 98 205
|
||||
49 65 139
|
||||
0 0 0
|
||||
255 255 255
|
||||
131 246 246
|
||||
74 197 255
|
||||
57 148 230
|
||||
49 98 205
|
||||
57 57 57
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
131 246 246
|
||||
74 197 255
|
||||
57 148 230
|
||||
49 98 205
|
||||
0 0 0
|
||||
172 139 180
|
||||
222 255 0
|
||||
255 213 115
|
||||
230 172 0
|
||||
164 131 16
|
||||
115 106 0
|
||||
74 74 0
|
||||
41 74 0
|
||||
32 57 0
|
||||
197 255 0
|
||||
164 238 16
|
||||
131 213 32
|
||||
98 189 49
|
||||
65 164 74
|
||||
32 139 90
|
||||
0 115 106
|
||||
172 139 180
|
||||
164 238 16
|
||||
98 189 49
|
||||
65 164 74
|
||||
32 139 90
|
||||
0 115 106
|
||||
115 115 115
|
||||
8 8 8
|
||||
49 172 255
|
||||
65 115 222
|
||||
65 82 172
|
||||
49 65 139
|
||||
172 139 180
|
||||
172 139 180
|
||||
172 139 180
|
||||
255 0 180
|
||||
255 0 0
|
||||
131 164 255
|
||||
246 255 0
|
||||
230 238 32
|
||||
205 222 65
|
||||
172 205 106
|
||||
131 189 131
|
||||
65 164 164
|
||||
0 148 180
|
||||
0 0 0
|
||||
0 0 0
|
||||
246 255 156
|
||||
238 238 131
|
||||
189 205 172
|
||||
139 189 197
|
||||
82 164 222
|
||||
0 0 0
|
||||
255 255 255
|
||||
213 255 255
|
||||
164 255 255
|
||||
106 246 246
|
||||
57 230 246
|
||||
49 205 238
|
||||
41 189 238
|
||||
0 172 230
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
123 139 255
|
||||
131 164 255
|
||||
115 189 255
|
||||
131 205 255
|
||||
123 213 255
|
||||
131 222 255
|
||||
139 230 255
|
||||
148 230 255
|
||||
189 238 255
|
||||
213 238 255
|
||||
230 246 255
|
||||
238 246 255
|
||||
246 246 255
|
||||
255 255 255
|
||||
255 255 255
|
||||
0 0 0
|
||||
255 255 255
|
||||
255 115 82
|
||||
246 24 0
|
||||
189 16 0
|
||||
172 16 0
|
||||
57 57 57
|
||||
65 115 222
|
||||
0 205 255
|
||||
246 24 0
|
||||
255 189 0
|
||||
131 246 246
|
||||
74 197 255
|
||||
57 148 230
|
||||
49 98 205
|
||||
49 65 139
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -1,3 +0,0 @@
|
||||
Tilesets' layouts are stored as 4bpp data, but metatiles contain an index per tile, signifying which palette this tile is using.
|
||||
So the Tileset data (<stage>.png) is only stored with one palette, while <stage>.pal contains 16 palettes.
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
void UpdateBgAnimationTiles(Background *);
|
||||
|
||||
s32 sub_8004274(void *dest, const void *tilesSrc, u16 param2, u16 param3, u8 bgCtrlIndex,
|
||||
const u8 *tileOffsets, u8 param6);
|
||||
s32 RenderText(void *dest, const void *font, u16 x, u16 y, u8 bg, const char *text,
|
||||
u8 palette);
|
||||
|
||||
void numToTileIndices(u8 *digits, u16 number);
|
||||
void numToASCII(u8 digits[5], u16 number);
|
||||
|
||||
#endif // GUARD_ANIMATION_COMMANDS_EXTRA_H
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
void sub_8081200(void);
|
||||
void StartSinglePakConnect(void);
|
||||
void sub_8081C0C(void);
|
||||
void ShowSinglePakResults(void);
|
||||
|
||||
#endif // GUARD_MULTIPLAYER_SINGLEPAK_CONNECTION_H
|
||||
@@ -52,6 +52,7 @@ extern uint8_t VRAM[VRAM_SIZE];
|
||||
|
||||
#define BG_VRAM &VRAM[0]
|
||||
#define BG_CHAR_ADDR(n) (((u8*)BG_VRAM) + (0x4000 * (n)))
|
||||
#define BG_CHAR_ADDR_FROM_BGCNT(bg) (BG_VRAM + ((gBgCntRegs[bg] & BGCNT_CHARBASE(0x3)) << 12))
|
||||
#define BG_SCREEN_ADDR(n) (((u8*)BG_VRAM) + (0x800 * (n)))
|
||||
#define BG_TILE_ADDR(n) (((u8*)BG_VRAM) + (0x80 * (n)))
|
||||
|
||||
@@ -78,7 +79,8 @@ extern uint8_t VRAM[VRAM_SIZE];
|
||||
#define VRAM 0x6000000
|
||||
|
||||
#define BG_VRAM VRAM
|
||||
#define BG_CHAR_ADDR(n) (BG_VRAM + (0x4000 * (n)))
|
||||
#define BG_CHAR_ADDR(n) (BG_VRAM + ((n) << 14))
|
||||
#define BG_CHAR_ADDR_FROM_BGCNT(bg) (BG_VRAM + ((gBgCntRegs[bg] & BGCNT_CHARBASE(0x3)) << 12))
|
||||
// TODO: Maybe rename BG_SCREEN_ADDR
|
||||
#define BG_SCREEN_ADDR(n) (BG_VRAM + (0x800 * (n)))
|
||||
#define BG_TILE_ADDR(n) (BG_VRAM + (0x80 * (n)))
|
||||
|
||||
@@ -550,8 +550,11 @@ extern unsigned char REG_BASE[IO_SIZE];
|
||||
#define DISPSTAT_VCOUNT_INTR 0x0020 // V-Count interrupt enabled
|
||||
|
||||
// BGCNT
|
||||
#define BGCNT_PRIORITY(n) (n) // Values 0 - 3. Lower priority BGs will be drawn on top of higher priority BGs.
|
||||
#define BGCNT_CHARBASE(n) ((n) << 2) // Values 0 - 3. Base block for tile pixel data.
|
||||
// Values 0 - 3. Lower priority BGs will be drawn on top of higher priority BGs.
|
||||
#define BGCNT_PRIORITY(n) (n)
|
||||
// Values 0 - 3. Base block for tile pixel data.
|
||||
// Target pointer: BG_CHAR_ADDR(n)
|
||||
#define BGCNT_CHARBASE(n) ((n) << 2)
|
||||
#define BGCNT_MOSAIC 0x0040
|
||||
#define BGCNT_16COLOR 0x0000 // 4 bits per pixel
|
||||
#define BGCNT_256COLOR 0x0080 // 8 bits per pixel
|
||||
|
||||
+1
-1
@@ -560,7 +560,7 @@ SECTIONS
|
||||
src/data/sprite_oam_data.o(.rodata);
|
||||
data/sprite_animation_data.o(.rodata);
|
||||
|
||||
src/data/tileset_language.o(.rodata);
|
||||
src/data/tileset_debug_text.o(.rodata);
|
||||
src/data/tilemap_data.o(.rodata);
|
||||
|
||||
src/lib/m4a_tables.o(.rodata);
|
||||
|
||||
+15
-27
@@ -1219,44 +1219,32 @@ u32 sub_8004010(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Copies the given tileOffsets of the given tilesSrc into the
|
||||
// given dest.
|
||||
// Also sets some stuff in the vram blend regs
|
||||
// My guess is that this was designed for rendering text based tiles to the screen
|
||||
s32 sub_8004274(void *dest, const void *tilesSrc, u16 param2, u16 param3, u8 bgCtrlIndex,
|
||||
const u8 *tileOffsets, u8 param6)
|
||||
// Copies the font to VRAM and displays the input text by using it as tileset.
|
||||
s32 RenderText(void *dest, const void *font, u16 x, u16 y, u8 bg, const char *text,
|
||||
u8 palette)
|
||||
{
|
||||
u8 i = 0;
|
||||
|
||||
u16 tileBase = gBgCntRegs[bgCtrlIndex] & BGCNT_CHARBASE(0x3);
|
||||
void *vramTiles = (void *)(VRAM + (tileBase * 4096));
|
||||
u16 *vramTiles = (void *)BG_CHAR_ADDR_FROM_BGCNT(bg);
|
||||
|
||||
u16 blendTarget = (BLDCNT_TGT2_OBJ | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_BG2
|
||||
| BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG0)
|
||||
& gBgCntRegs[bgCtrlIndex];
|
||||
u16 *vramBlend
|
||||
= ({ (u16 *)(VRAM + (blendTarget * 8)); }) + param3 * TILE_SIZE_4BPP + param2;
|
||||
u16 layoutBase = (gBgCntRegs[bg] & BGCNT_SCREENBASE_MASK) << 3;
|
||||
u16 *vramLayout = ({ (u16 *)(VRAM + (layoutBase)); }) + y * 32 + x;
|
||||
|
||||
for (; tileOffsets[i] != 0; i++) {
|
||||
void *copyDest = dest + (i * TILE_SIZE_4BPP);
|
||||
u16 offset;
|
||||
for (; text[i] != 0; i++) {
|
||||
u16 *copyDest = dest + (i * TILE_SIZE_4BPP);
|
||||
u16 tile;
|
||||
u16 *addr;
|
||||
CpuFastCopy(tilesSrc + (tileOffsets[i] * TILE_SIZE_4BPP), copyDest,
|
||||
TILE_SIZE_4BPP);
|
||||
CpuFastCopy(font + (text[i] * TILE_SIZE_4BPP), copyDest, TILE_SIZE_4BPP);
|
||||
|
||||
tile = (copyDest - vramTiles) / 16u;
|
||||
#ifndef NON_MATCHING
|
||||
offset = (u16)((((u16 *)copyDest - (u16 *)vramTiles) << 12) >> 16);
|
||||
vramBlend++;
|
||||
vramBlend--;
|
||||
#else
|
||||
// divide by tilesize 4bpp
|
||||
offset = (u16)(copyDest - vramTiles) >> 5;
|
||||
vramLayout++;
|
||||
vramLayout--;
|
||||
#endif
|
||||
|
||||
addr = vramBlend;
|
||||
addr += i;
|
||||
addr = &vramLayout[i];
|
||||
|
||||
*addr = (param6 * 4096) | offset;
|
||||
*addr = (palette << 12) | tile;
|
||||
}
|
||||
|
||||
return i * TILE_SIZE_4BPP;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "global.h"
|
||||
#include "data/tileset_language.h"
|
||||
|
||||
// Tiles used for debug strings, like the unused (in the retail version) Stage Select.
|
||||
#if NON_MATCHING
|
||||
const u8 Tileset_Language[] = INCBIN_U8("graphics/tilesets/debug_ascii.4bpp");
|
||||
#else
|
||||
const u8 Tileset_Language[] = {};
|
||||
#endif
|
||||
@@ -1,6 +0,0 @@
|
||||
#include "data/tileset_language.h"
|
||||
|
||||
// NOTE(Ollie): I wonder if there is a missing set of language tiles which was
|
||||
// in the end not included in the rom
|
||||
|
||||
const u8 Tileset_Language[0] = {};
|
||||
+1
-2
@@ -75,8 +75,7 @@ void GameStart(void)
|
||||
|
||||
// This flag is only set in GameInit
|
||||
if (gFlags & FLAGS_200) {
|
||||
// Show singlepak results
|
||||
sub_8081C0C();
|
||||
ShowSinglePakResults();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -521,7 +521,7 @@ void sub_8081AD4(struct SinglePakConnectScreen *connectScreen)
|
||||
gFlags |= FLAGS_UPDATE_BACKGROUND_PALETTES;
|
||||
}
|
||||
|
||||
void sub_8081C0C(void)
|
||||
void ShowSinglePakResults(void)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i < MULTI_SIO_PLAYERS_MAX; i++) {
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
#include "constants/songs.h"
|
||||
|
||||
const char ALIGNED(4) gUnknown_080D5128[8] = "STAGE";
|
||||
|
||||
typedef struct {
|
||||
void *vram;
|
||||
u16 unk4;
|
||||
@@ -95,8 +93,8 @@ static void Task_Poll(void)
|
||||
levelSelect->levelId++;
|
||||
}
|
||||
|
||||
numToTileIndices(digits, levelSelect->levelId);
|
||||
sub_8004274(levelSelect->vram, Tileset_Language, 0xC, 0xE, 0, digits, 0);
|
||||
numToASCII(digits, levelSelect->levelId);
|
||||
RenderText(levelSelect->vram, Tileset_Language, 0xC, 0xE, 0, digits, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,8 +104,8 @@ static void Task_8009854(void)
|
||||
gBgPalette[1] = RGB_WHITE;
|
||||
gFlags |= 0x1;
|
||||
|
||||
levelSelect->vram += sub_8004274(levelSelect->vram, Tileset_Language, 0x6, 0xE, 0,
|
||||
(const u8 *)gUnknown_080D5128, 0);
|
||||
levelSelect->vram
|
||||
+= RenderText(levelSelect->vram, Tileset_Language, 0x6, 0xE, 0, "STAGE", 0);
|
||||
|
||||
gCurTask->main = Task_Poll;
|
||||
gCurTask->main();
|
||||
|
||||
@@ -35,8 +35,8 @@ void sub_800A43C(void)
|
||||
|
||||
void Task_800A4CC(void)
|
||||
{
|
||||
sub_8004274((void *)(VRAM + 1 * TILE_SIZE_4BPP), &Tileset_Language, 1, 10, 2,
|
||||
gUnknown_080D5130, 0);
|
||||
RenderText((void *)(VRAM + 1 * TILE_SIZE_4BPP), &Tileset_Language, 1, 10, 2,
|
||||
gUnknown_080D5130, 0);
|
||||
|
||||
if (gPressedKeys & A_BUTTON) {
|
||||
sub_800A510();
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ s16 sub_8004418(s16 x, s16 y)
|
||||
return result;
|
||||
}
|
||||
|
||||
void numToTileIndices(u8 *digits, u16 number)
|
||||
void numToASCII(u8 digits[5], u16 number)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
|
||||
Reference in new issue
Block a user