Finish menu.s and eliminate TextColor

This commit is contained in:
Diegoisawesome
2018-02-06 20:37:54 -06:00
parent 97c9a4ec22
commit 18abda9dca
19 changed files with 194 additions and 292 deletions

View File

@@ -2565,17 +2565,17 @@ u8 GetHPBarLevel(s16 hp, s16 maxhp)
static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, u32 arg3, u32 *windowId)
{
u16 winId;
struct TextColor color;
u8 color[3];
struct WindowTemplate winTemplate = sHealthboxWindowTemplate;
winId = AddWindow(&winTemplate);
FillWindowPixelBuffer(winId, (arg3 << 4) | (arg3));
color.fgColor = arg3;
color.bgColor = 1;
color.shadowColor = 3;
color[0] = arg3;
color[1] = 1;
color[2] = 3;
AddTextPrinterParameterized2(winId, 0, x, y, 0, 0, &color, -1, str);
AddTextPrinterParameterized2(winId, 0, x, y, 0, 0, color, -1, str);
*windowId = winId;
return (u8*)(GetWindowAttribute(winId, WINDOW_TILE_DATA));

View File

@@ -3574,35 +3574,35 @@ static bool32 TryAddContestLinkTvShow(struct Pokeblock *pokeblock, struct TvBlen
static void Blender_AddTextPrinter(u8 windowId, const u8 *string, u8 x, u8 y, s32 speed, s32 caseId)
{
struct TextColor txtColor;
u8 txtColor[3];
u32 letterSpacing = 0;
switch (caseId)
{
case 0:
case 3:
txtColor.fgColor = 1;
txtColor.bgColor = 2;
txtColor.shadowColor = 3;
txtColor[0] = 1;
txtColor[1] = 2;
txtColor[2] = 3;
break;
case 1:
txtColor.fgColor = 0;
txtColor.bgColor = 2;
txtColor.shadowColor = 3;
txtColor[0] = 0;
txtColor[1] = 2;
txtColor[2] = 3;
break;
case 2:
txtColor.fgColor = 0;
txtColor.bgColor = 4;
txtColor.shadowColor = 5;
txtColor[0] = 0;
txtColor[1] = 4;
txtColor[2] = 5;
break;
}
if (caseId != 3)
{
FillWindowPixelBuffer(windowId, txtColor.fgColor | (txtColor.fgColor << 4));
FillWindowPixelBuffer(windowId, txtColor[0] | (txtColor[0] << 4));
}
AddTextPrinterParameterized2(windowId, 1, x, y, letterSpacing, 1, &txtColor, speed, string);
AddTextPrinterParameterized2(windowId, 1, x, y, letterSpacing, 1, txtColor, speed, string);
}
static bool32 Blender_PrintText(s16 *textState, const u8 *string, s32 textSpeed)

View File

@@ -17,7 +17,7 @@ extern int decompress_and_copy_tile_data_to_vram(u8 bg_id, void *src, int size,
extern bool8 free_temp_tile_data_buffers_if_possible(void);
extern void sub_80861E8(void); // rom4
extern bool16 sub_80C0944(void);
extern void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor *color, s8 speed, u8 *str);
extern void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, u8 *color, s8 speed, u8 *str);
extern u16 gUnknown_0860F074[];
@@ -208,12 +208,7 @@ static void InitDiplomaWindow(void)
static void PrintDiplomaText(u8 *text, u8 var1, u8 var2)
{
struct TextColor color =
{
.fgColor = 0,
.bgColor = 2,
.shadowColor = 3,
};
u8 color[3] = {0, 2, 3};
AddTextPrinterParameterized2(0, 1, var1, var2, 0, 0, &color, -1, text);
AddTextPrinterParameterized2(0, 1, var1, var2, 0, 0, color, -1, text);
}

View File

@@ -41,7 +41,7 @@ struct EggHatchData
u8 unused_9;
u8 unused_A;
u16 species;
struct TextColor textColor;
u8 textColor[3];
};
extern struct SpriteTemplate gUnknown_0202499C;
@@ -863,10 +863,10 @@ static void CreateEggShardSprite(u8 x, u8 y, s16 data1, s16 data2, s16 data3, u8
static void EggHatchPrintMessage(u8 windowId, u8* string, u8 x, u8 y, u8 speed)
{
FillWindowPixelBuffer(windowId, 0xFF);
sEggHatchData->textColor.fgColor = 0;
sEggHatchData->textColor.bgColor = 5;
sEggHatchData->textColor.shadowColor = 6;
AddTextPrinterParameterized2(windowId, 1, x, y, 0, 0, &sEggHatchData->textColor, speed, string);
sEggHatchData->textColor[0] = 0;
sEggHatchData->textColor[1] = 5;
sEggHatchData->textColor[2] = 6;
AddTextPrinterParameterized2(windowId, 1, x, y, 0, 0, sEggHatchData->textColor, speed, string);
}
u8 GetEggStepsToSubtract(void)

View File

@@ -13,6 +13,10 @@
#include "dma3.h"
#include "string_util.h"
#include "pokemon_icon.h"
#include "constants/flags.h"
#include "event_data.h"
#include "pokedex.h"
#include "region_map.h"
struct SomeUnkStruct
{
@@ -47,7 +51,7 @@ extern EWRAM_DATA u16 gUnknown_0203CDA8;
extern EWRAM_DATA void *gUnknown_0203CDAC[0x20];
const u16 gUnknown_0860F0B0[] = INCBIN_U16("graphics/interface/860F0B0.gbapal");
const struct TextColor gUnknown_0860F0D0[] = { 15, 1, 2 };
const u8 gUnknown_0860F0D0[] = { 15, 1, 2 };
const struct SomeUnkStruct gUnknown_0860F0D4[] =
{
{ 12, 12, 0x00 },
@@ -386,22 +390,22 @@ void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram)
void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyToVram)
{
struct TextColor color;
u8 color[3];
u16 width = 0;
if (gUnknown_0203CDA0 != 0xFF)
{
if (a3 != 0)
{
color.fgColor = 0;
color.bgColor = 1;
color.shadowColor = 2;
color[0] = 0;
color[1] = 1;
color[2] = 2;
}
else
{
color.fgColor = 15;
color.bgColor = 1;
color.shadowColor = 2;
color[0] = 15;
color[1] = 1;
color[2] = 2;
}
PutWindowTilemap(gUnknown_0203CDA0);
FillWindowPixelBuffer(gUnknown_0203CDA0, 0xFF);
@@ -412,11 +416,11 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo
0,
0xEC - (GetWindowAttribute(gUnknown_0203CDA0, WINDOW_TILEMAP_LEFT) * 8) - a4 - width,
1,
&color,
color,
0,
string2);
}
AddTextPrinterParameterized2(gUnknown_0203CDA0, 1, 4, 1, 0, 0, &color, 0, string);
AddTextPrinterParameterized2(gUnknown_0203CDA0, 1, 4, 1, 0, 0, color, 0, string);
if (copyToVram)
CopyWindowToVram(gUnknown_0203CDA0, 3);
}
@@ -1498,7 +1502,7 @@ void sub_8199DF0(u32 bg, u8 a1, int a2, int a3)
RequestDma3Fill(a1 << 24 | a1 << 16 | a1 << 8 | a1, addr + VRAM, a3 * temp, 1);
}
void box_print(u8 windowId, u8 fontId, u8 left, u8 top, const struct TextColor *color, s8 speed, const u8 *str)
void box_print(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str)
{
struct TextSubPrinter printer;
@@ -1512,14 +1516,14 @@ void box_print(u8 windowId, u8 fontId, u8 left, u8 top, const struct TextColor *
printer.letterSpacing = GetFontAttribute(fontId, 2);
printer.lineSpacing = GetFontAttribute(fontId, 3);
printer.fontColor_l = 0;
printer.fgColor = color->bgColor;
printer.bgColor = color->fgColor;
printer.shadowColor = color->shadowColor;
printer.fgColor = color[1];
printer.bgColor = color[0];
printer.shadowColor = color[2];
AddTextPrinter(&printer, speed, NULL);
}
void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineSpacing, const struct TextColor *color, s8 speed, const u8 *str)
void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineSpacing, const u8 *color, s8 speed, const u8 *str)
{
struct TextSubPrinter printer;
@@ -1533,9 +1537,9 @@ void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 left, u8 top, u8 le
printer.letterSpacing = letterSpacing;
printer.lineSpacing = lineSpacing;
printer.fontColor_l = 0;
printer.fgColor = color->bgColor;
printer.bgColor = color->fgColor;
printer.shadowColor = color->shadowColor;
printer.fgColor = color[1];
printer.bgColor = color[0];
printer.shadowColor = color[2];
AddTextPrinter(&printer, speed, NULL);
}
@@ -1874,3 +1878,49 @@ void blit_move_info_icon(u8 windowId, u8 iconId, u16 x, u16 y)
{
BlitBitmapRectToWindow(windowId, gFireRedMenuElements_Gfx + gUnknown_0860F0D4[iconId].unk3 * 32, 0, 0, 128, 128, x, y, gUnknown_0860F0D4[iconId].unk1, gUnknown_0860F0D4[iconId].unk2);
}
void sub_819A344(u8 a0, u8 *a1, u8 a2)
{
s32 curFlag;
s32 flagCount;
u8 *endOfString;
u8 *string = a1;
*(string++) = EXT_CTRL_CODE_BEGIN;
*(string++) = EXT_CTRL_CODE_COLOR;
*(string++) = a2;
*(string++) = EXT_CTRL_CODE_BEGIN;
*(string++) = EXT_CTRL_CODE_SHADOW;
*(string++) = a2 + 1;
switch (a0)
{
case 0:
StringCopy(string, gSaveBlock2Ptr->playerName);
break;
case 1:
if (IsNationalPokedexEnabled())
string = ConvertIntToDecimalStringN(string, pokedex_count(1), 0, 3);
else
string = ConvertIntToDecimalStringN(string, sub_80C0844(1), 0, 3);
*string = EOS;
break;
case 2:
string = ConvertIntToDecimalStringN(string, gSaveBlock2Ptr->playTimeHours, 0, 3);
*(string++) = CHAR_COLON;
ConvertIntToDecimalStringN(string, gSaveBlock2Ptr->playTimeMinutes, 2, 2);
break;
case 3:
sub_81245DC(string, gMapHeader.regionMapSectionId);
break;
case 4:
for (curFlag = FLAG_BADGE01_GET, flagCount = 0, endOfString = string + 1; curFlag <= FLAG_BADGE08_GET; curFlag++)
{
if (FlagGet(curFlag))
flagCount++;
}
*string = flagCount + CHAR_0;
*endOfString = EOS;
break;
}
}

View File

@@ -1496,7 +1496,7 @@ static void TaskDummy3(void)
}
static const struct TextColor sGenderColors[2] =
static const u8 sGenderColors[2][3] =
{
{0, 9, 8},
{0, 5, 4}
@@ -1516,7 +1516,7 @@ static void sub_80E49BC(void)
StringCopy(genderSymbol, gText_FemaleSymbol);
isFemale = TRUE;
}
box_print(gNamingScreenData->windows[2], 1, 0x68, 1, &sGenderColors[isFemale], -1, genderSymbol);
box_print(gNamingScreenData->windows[2], 1, 0x68, 1, sGenderColors[isFemale], -1, genderSymbol);
}
}
@@ -1661,19 +1661,18 @@ static void sub_80E4D10(void)
PutWindowTilemap(gNamingScreenData->windows[2]);
}
static const struct AlignedTextColor sUnkColor1 =
struct TextColorThing // needed because of alignment... it's so stupid
{
13, 1, 2
u8 colors[3][4];
};
static const struct AlignedTextColor sUnkColor2 =
static const struct TextColorThing sUnkColorStruct =
{
14, 1, 2
};
static const struct AlignedTextColor sUnkColor3 =
{
15, 1, 2
{
{13, 1, 2},
{14, 1, 2},
{15, 1, 2}
}
};
static const u8 sFillValues[3] =
@@ -1681,11 +1680,11 @@ static const u8 sFillValues[3] =
0xEE, 0xDD, 0xFF
};
static const struct AlignedTextColor *const sUnkColors[3] =
static const u8 *const sUnkColors[3] =
{
&sUnkColor2,
&sUnkColor1,
&sUnkColor3
sUnkColorStruct.colors[1],
sUnkColorStruct.colors[0],
sUnkColorStruct.colors[2]
};
static void sub_80E4DE4(u8 window, u8 a1)
@@ -1738,7 +1737,7 @@ static void sub_80E4E5C(void)
static void sub_80E4EF0(void)
{
const struct TextColor color[] = { 15, 1, 2 };
const u8 color[3] = { 15, 1, 2 };
FillWindowPixelBuffer(gNamingScreenData->windows[4], 0xFF);
box_print(gNamingScreenData->windows[4], 0, 2, 1, color, 0, gText_MoveOkBack);

View File

@@ -284,7 +284,7 @@ static const struct SpriteTemplate sSpriteTemplate_PokeblockCase =
SpriteCallbackDummy
};
static const struct TextColor sTextColorInPokeblockMenu = {0, 2, 3};
static const u8 sTextColorInPokeblockMenu[3] = {0, 2, 3};
static const struct Pokeblock sFavoritePokeblocksTable[] =
{
@@ -583,7 +583,7 @@ static void HandleInitWindows(void)
static void PrintOnPokeblockWindow(u8 windowId, const u8 *string, s32 x)
{
AddTextPrinterParameterized2(windowId, 1, x, 1, 0, 0, &sTextColorInPokeblockMenu, 0, string);
AddTextPrinterParameterized2(windowId, 1, x, 1, 0, 0, sTextColorInPokeblockMenu, 0, string);
}
static void PutPokeblockInfoText(void)

View File

@@ -71,7 +71,7 @@ static const union AffineAnimCmd *const sSpriteAffineAnimTable_8571730[] =
sSpriteAffineAnim_8571720
};
const struct TextColor gUnknown_08571734[] = {4, 0xF, 0xE};
const u8 gUnknown_08571734[] = {4, 0xF, 0xE};
const u8 gUnknown_08571737[] = _("/30");
// code

View File

@@ -54,7 +54,7 @@ extern u16 gSummaryScreenWindow_Tilemap[];
extern struct ContestMove gContestMoves[];
extern struct ContestEffect gContestEffects[];
extern struct WindowTemplate gUnknown_0861CC24;
extern struct TextColor gUnknown_0861CD2C[];
extern u8 gUnknown_0861CD2C[][3];
extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1];
extern u8 gText_MaleSymbol[];
extern u8 gText_FemaleSymbol[];
@@ -162,7 +162,7 @@ extern struct BattleMove gBattleMoves[];
extern u32 ChangeBgX(u8 bg, u32 value, u8 op);
extern void sub_8199C30(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f);
extern void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor* colors, s8 speed, u8 *str);
extern void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const u8* colors, s8 speed, u8 *str);
extern s32 GetStringCenterAlignXOffset(u8 fontId, u8 *str, s32 totalWidth);
extern s32 GetStringRightAlignXOffset(u8 fontId, u8 *str, s32 totalWidth);
extern bool8 sub_81A6BF4();
@@ -2557,7 +2557,7 @@ void sub_81C2554()
void sub_81C25A4(u8 a, u8 *b, u8 c, u8 d, u8 e, u8 f)
{
AddTextPrinterParameterized2(a, 1, c, d, 0, e, &gUnknown_0861CD2C[f], 0, b);
AddTextPrinterParameterized2(a, 1, c, d, 0, e, gUnknown_0861CD2C[f], 0, b);
}
void sub_81C25E8()

View File

@@ -168,12 +168,12 @@ static bool8 WipeSectors(u32);
// although this is a general text printer, it's only used in this file.
static void SaveFailedScreenTextPrint(u8 *text, u8 var1, u8 var2)
{
struct TextColor color;
u8 color[3];
color.fgColor = 0;
color.bgColor = 15;
color.shadowColor = 3;
AddTextPrinterParameterized2(gSaveFailedWindowIds[TEXT_WIN_ID], 1, var1 * 8, var2 * 8 + 1, 0, 0, &color, 0, text);
color[0] = 0;
color[1] = 15;
color[2] = 3;
AddTextPrinterParameterized2(gSaveFailedWindowIds[TEXT_WIN_ID], 1, var1 * 8, var2 * 8 + 1, 0, 0, color, 0, text);
}
void DoSaveFailedScreen(u8 saveType)

View File

@@ -403,7 +403,7 @@ void PutWindowRectTilemap(u8 windowId, u8 x, u8 y, u8 width, u8 height)
}
}
void BlitBitmapToWindow(u8 windowId, u8 *pixels, u16 x, u16 y, u16 width, u16 height)
void BlitBitmapToWindow(u8 windowId, const u8 *pixels, u16 x, u16 y, u16 width, u16 height)
{
BlitBitmapRectToWindow(windowId, pixels, 0, 0, width, height, x, y, width, height);
}