Merge pull request #377 from DizzyEggg/render_text

Match Render text and attempt to clean up
This commit is contained in:
Diegoisawesome 2018-11-06 11:44:14 -06:00 committed by GitHub
commit 93ff71fcfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 927 additions and 1733 deletions

View File

@ -1180,7 +1180,7 @@ sub_81965D8: @ 81965D8
negs r0, r0
ands r0, r1
strb r0, [r2]
bl GetPlayerTextSpeed
bl GetPlayerTextSpeedDelay
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24

View File

@ -6485,7 +6485,7 @@ _080DEC80:
b _080DEC9C
.pool
_080DEC94:
bl GetPlayerTextSpeed
bl GetPlayerTextSpeedDelay
lsls r0, 24
lsrs r1, r0, 24
_080DEC9C:

View File

@ -6178,7 +6178,7 @@ sub_81B3300: @ 81B3300
movs r1, 0x1
orrs r0, r1
strb r0, [r2]
bl GetPlayerTextSpeed
bl GetPlayerTextSpeedDelay
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24

View File

@ -10440,7 +10440,7 @@ sub_81CC158: @ 81CC158
adds r1, 0xF
bl sub_81CAF78
adds r5, r0, 0
bl GetPlayerTextSpeed
bl GetPlayerTextSpeedDelay
lsls r0, 24
lsrs r0, 24
ldrb r2, [r4, 0x14]
@ -22957,7 +22957,7 @@ sub_81D2BF4: @ 81D2BF4
movs r1, 0x1
orrs r0, r1
strb r0, [r2]
bl GetPlayerTextSpeed
bl GetPlayerTextSpeedDelay
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24

View File

@ -1,165 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start GameClear
GameClear: @ 8137734
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x1C
bl HealPlayerParty
ldr r4, =0x00000864
adds r0, r4, 0
bl FlagGet
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0x1
bne _08137760
ldr r0, =gHasHallOfFameRecords
strb r1, [r0]
b _0813776C
.pool
_08137760:
ldr r1, =gHasHallOfFameRecords
movs r0, 0
strb r0, [r1]
adds r0, r4, 0
bl FlagSet
_0813776C:
movs r0, 0x1
bl GetGameStat
cmp r0, 0
bne _0813778E
ldr r0, =gSaveBlock2Ptr
ldr r2, [r0]
ldrh r1, [r2, 0xE]
lsls r1, 16
ldrb r0, [r2, 0x10]
lsls r0, 8
orrs r1, r0
ldrb r0, [r2, 0x11]
orrs r1, r0
movs r0, 0x1
bl SetGameStat
_0813778E:
bl sub_8076D48
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldrb r0, [r0, 0x8]
cmp r0, 0
bne _081377AC
movs r0, 0x1
bl sub_8084F6C
b _081377B2
.pool
_081377AC:
movs r0, 0x2
bl sub_8084F6C
_081377B2:
movs r7, 0
movs r6, 0
add r0, sp, 0x18
mov r8, r0
mov r5, sp
_081377BC:
movs r0, 0x64
adds r1, r6, 0
muls r1, r0
ldr r0, =gPlayerParty
adds r4, r1, r0
movs r0, 0
strb r6, [r5]
strb r0, [r5, 0x1]
adds r0, r4, 0
movs r1, 0x5
bl GetMonData
cmp r0, 0
beq _0813780A
adds r0, r4, 0
movs r1, 0x6
bl GetMonData
cmp r0, 0
bne _0813780A
adds r0, r4, 0
movs r1, 0x43
bl GetMonData
cmp r0, 0
bne _0813780A
movs r0, 0x1
mov r1, r8
strb r0, [r1]
adds r0, r4, 0
movs r1, 0x43
add r2, sp, 0x18
bl SetMonData
adds r0, r4, 0
bl GetRibbonCount
strb r0, [r5, 0x1]
movs r7, 0x1
_0813780A:
adds r5, 0x4
adds r6, 0x1
cmp r6, 0x5
ble _081377BC
cmp r7, 0x1
bne _0813785A
movs r0, 0x2A
bl IncrementGameStat
ldr r0, =0x0000089b
bl FlagSet
mov r3, sp
add r2, sp, 0x4
movs r6, 0x4
_08137828:
ldrb r1, [r3, 0x1]
ldrb r0, [r2, 0x1]
cmp r0, r1
bls _08137838
ldr r1, [sp]
ldr r0, [r2]
str r0, [sp]
str r1, [r2]
_08137838:
adds r2, 0x4
subs r6, 0x1
cmp r6, 0
bge _08137828
mov r0, sp
ldrb r0, [r0, 0x1]
cmp r0, 0x4
bls _0813785A
mov r0, sp
ldrb r1, [r0]
movs r0, 0x64
muls r0, r1
ldr r1, =gPlayerParty
adds r0, r1
movs r1, 0x43
bl sub_80EE4DC
_0813785A:
ldr r0, =CB2_DoHallOfFameScreen
bl SetMainCallback2
movs r0, 0
add sp, 0x1C
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
.pool
thumb_func_end GameClear
thumb_func_start sp0C8_whiteout_maybe
sp0C8_whiteout_maybe: @ 813787C
push {lr}
ldr r0, =CB2_WhiteOut
bl SetMainCallback2
movs r0, 0
pop {r1}
bx r1
.pool
thumb_func_end sp0C8_whiteout_maybe

View File

@ -1,8 +1,4 @@
gFonts
gUnknown_03002F84
gUnknown_03002F90
gUnknown_03002FB0
gUnknown_03002FD0
gUnknown_03002FF0
gGlyphDimensions
gTextFlags

View File

@ -17,7 +17,7 @@ void SetSaveBlocksPointers(u16 offset);
void MoveSaveBlocks_ResetHeap(void);
u32 GetSecretBase2Field_9(void);
void ClearSecretBase2Field_9(void);
void sub_8076D48(void);
void SetSecretBase2Field_9(void);
void sub_8076D5C(void);
void sav2_gender2_inplace_and_xFE(void);
void SavePlayerParty(void);

View File

@ -26,15 +26,15 @@ u16 RunTextPrintersAndIsPrinter0Active(void);
void sub_81973A4(void);
void NewMenuHelpers_DrawDialogueFrame(u8, u8);
void sub_819746C(u8 windowId, bool8 copyToVram);
u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 fgColor, u8 bgColor, u8 shadowColor);
u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 fgColor, u8 bgColor, u8 shadowColor);
void PrintPlayerNameOnWindow(u8, const u8*, u16, u16);
void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback);
void sub_8197434(u8 windowId, bool8 copyToVram);
void SetStandardWindowBorderStyle(u8 a0, u8 a1);
void sub_8197930(void);
u8 GetPlayerTextSpeed(void);
u8 GetPlayerTextSpeedDelay(void);
void sub_81978B0(u16 arg0);
void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextSubPrinter *, u16));
void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16));
void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str);
void sub_8198070(u8 windowId, bool8 copyToVram);
void SetWindowTemplateFields(struct WindowTemplate* template, u8 priority, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 palNum, u16 baseBlock);
@ -82,7 +82,7 @@ void sub_819A344(u8 a0, u8 *dest, u8 color);
void RemoveMapNamePopUpWindow(void);
u8 GetMapNamePopUpWindowId(void);
u8 AddMapNamePopUpWindow(void);
void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 letterSpacing, u8 lineSpacing);
void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 letterSpacing, u8 lineSpacing);
void sub_8199C30(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette);
void sub_8199D3C(void *ptr, int delta, int width, int height, bool32 is8BPP);
void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyToVram);

View File

@ -4,5 +4,6 @@
u16 sub_80F903C(void);
void ReducePlayerPartyToThree(void);
void HealPlayerParty(void);
#endif // GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H

View File

@ -114,7 +114,7 @@ enum {
FONTATTR_MAX_LETTER_HEIGHT,
FONTATTR_LETTER_SPACING,
FONTATTR_LINE_SPACING,
FONTATTR_COLOR_LOWNIBBLE, // dunno what this is yet
FONTATTR_UNKNOWN, // dunno what this is yet
FONTATTR_COLOR_FOREGROUND,
FONTATTR_COLOR_BACKGROUND,
FONTATTR_COLOR_SHADOW
@ -122,23 +122,18 @@ enum {
struct TextPrinterSubStruct
{
u8 font_type:4; // 0x14
u8 font_type_upper:1;
u8 font_type_5:3;
u8 field_1:5;
u8 field_1_upmid:2;
u8 field_1_top:1;
u8 frames_visible_counter;
u8 field_3;
u8 field_4; // 0x18
u8 field_5;
u8 field_6;
u8 active;
u8 glyphId:4; // 0x14
bool8 hasPrintBeenSpedUp:1;
u8 unk:3;
u8 downArrowDelay:5;
u8 downArrowYPosIdx:2;
bool8 hasGlyphIdBeenSet:1;
u8 autoScrollDelay;
};
struct TextSubPrinter // TODO: Better name
struct TextPrinterTemplate
{
const u8* current_text_offset;
const u8* currentChar;
u8 windowId;
u8 fontId;
u8 x;
@ -147,7 +142,7 @@ struct TextSubPrinter // TODO: Better name
u8 currentY;
u8 letterSpacing;
u8 lineSpacing;
u8 fontColor_l:4; // 0xC
u8 unk:4; // 0xC
u8 fgColor:4;
u8 bgColor:4;
u8 shadowColor:4;
@ -155,18 +150,18 @@ struct TextSubPrinter // TODO: Better name
struct TextPrinter
{
struct TextSubPrinter subPrinter;
struct TextPrinterTemplate printerTemplate;
void (*callback)(struct TextSubPrinter *, u16); // 0x10
void (*callback)(struct TextPrinterTemplate *, u16); // 0x10
union {
union __attribute__((packed)) {
struct TextPrinterSubStruct sub;
u8 fields[7];
} subUnion;
u8 sub_fields[8];
} sub_union;
u8 active;
u8 state; // 0x1C
u8 text_speed;
u8 textSpeed;
u8 delayCounter;
u8 scrollDistance;
u8 minLetterSpacing; // 0x20
@ -180,7 +175,7 @@ struct FontInfo
u8 maxLetterHeight;
u8 letterSpacing;
u8 lineSpacing;
u8 fontColor_l:4;
u8 unk:4;
u8 fgColor:4;
u8 bgColor:4;
u8 shadowColor:4;
@ -190,24 +185,34 @@ extern const struct FontInfo *gFonts;
struct GlyphWidthFunc
{
u32 font_id;
u32 fontId;
u32 (*func)(u16 glyphId, bool32 isJapanese);
};
struct KeypadIcon
{
u16 tile_offset;
u16 tileOffset;
u8 width;
u8 height;
};
typedef struct {
u8 flag_0:1;
u8 flag_1:1;
u8 flag_2:1;
u8 flag_3:1;
bool8 canABSpeedUpPrint:1;
bool8 useAlternateDownArrow:1;
bool8 autoScroll:1;
bool8 forceMidTextSpeed:1;
} TextFlags;
struct Struct_03002F90
{
u8 unk0[0x20];
u8 unk20[0x20];
u8 unk40[0x20];
u8 unk60[0x20];
u8 unk80;
u8 unk81;
};
extern TextFlags gTextFlags;
extern u8 gStringVar1[];
@ -215,17 +220,13 @@ extern u8 gStringVar2[];
extern u8 gStringVar3[];
extern u8 gStringVar4[];
u8 gUnknown_03002F84;
u8 gUnknown_03002F90[0x20];
u8 gUnknown_03002FB0[0x20];
u8 gUnknown_03002FD0[0x20];
u8 gUnknown_03002FF0[0x20];
u8 gGlyphDimensions[0x2];
extern u8 gUnknown_03002F84;
extern struct Struct_03002F90 gUnknown_03002F90;
void SetFontsPointer(const struct FontInfo *fonts);
void DeactivateAllTextPrinters(void);
u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextSubPrinter *, u16));
bool16 AddTextPrinter(struct TextSubPrinter *textSubPrinter, u8 speed, void (*callback)(struct TextSubPrinter *, u16));
u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16));
bool16 AddTextPrinter(struct TextPrinterTemplate *template, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16));
void RunTextPrinters(void);
bool16 IsTextPrinterActive(u8 id);
u32 RenderFont(struct TextPrinter *textPrinter);

View File

@ -196,7 +196,7 @@ SECTIONS {
src/rom6.o(.text);
src/pokeblock.o(.text);
src/fldeff_flash.o(.text);
asm/post_battle_event_funcs.o(.text);
src/post_battle_event_funcs.o(.text);
src/time_events.o(.text);
src/birch_pc.o(.text);
src/hof_pc.o(.text);

View File

@ -4720,7 +4720,7 @@ static u8 sub_819221C(u8 taskId)
static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
{
struct TextSubPrinter textPrinter;
struct TextPrinterTemplate textPrinter;
s32 i, j, k;
s32 trainerId = 0;
u8 nature = 0;
@ -4792,7 +4792,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
textPrinter.currentY = textPrinter.y;
textPrinter.letterSpacing = 2;
textPrinter.lineSpacing = 0;
textPrinter.fontColor_l = 0;
textPrinter.unk = 0;
textPrinter.fgColor = 14;
textPrinter.bgColor = 0;
textPrinter.shadowColor = 13;
@ -4826,7 +4826,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
}
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, gStringVar1, 0xD0, textPrinter.letterSpacing);
textPrinter.current_text_offset = gStringVar1;
textPrinter.currentChar = gStringVar1;
textPrinter.windowId = windowId;
PutWindowTilemap(windowId);
CopyWindowToVram(windowId, 3);
@ -4837,11 +4837,11 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
{
textPrinter.currentY = gUnknown_0860D346[i];
if (trainerId == TRAINER_PLAYER)
textPrinter.current_text_offset = gSpeciesNames[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]];
textPrinter.currentChar = gSpeciesNames[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]];
else if (trainerId == TRAINER_FRONTIER_BRAIN)
textPrinter.current_text_offset = gSpeciesNames[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]];
textPrinter.currentChar = gSpeciesNames[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]];
else
textPrinter.current_text_offset = gSpeciesNames[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].species];
textPrinter.currentChar = gSpeciesNames[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].species];
textPrinter.windowId = 1 + i + windowId;
if (i == 1)
@ -4857,9 +4857,9 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
PutWindowTilemap(windowId + 4);
CopyWindowToVram(windowId + 4, 3);
if (trainerId == TRAINER_FRONTIER_BRAIN)
textPrinter.current_text_offset = gBattleDomePotentialPointers[16];
textPrinter.currentChar = gBattleDomePotentialPointers[16];
else
textPrinter.current_text_offset = gBattleDomePotentialPointers[trainerTournamentId];
textPrinter.currentChar = gBattleDomePotentialPointers[trainerTournamentId];
textPrinter.fontId = 1;
textPrinter.windowId = windowId + 4;
@ -4901,7 +4901,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
break;
}
textPrinter.current_text_offset = gBattleDomeOpponentStylePointers[i];
textPrinter.currentChar = gBattleDomeOpponentStylePointers[i];
textPrinter.y = 20;
textPrinter.currentY = 20;
AddTextPrinter(&textPrinter, 0, NULL);
@ -5073,7 +5073,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
else
i = 42;
textPrinter.current_text_offset = gBattleDomeOpponentStatsPointers[i];
textPrinter.currentChar = gBattleDomeOpponentStatsPointers[i];
textPrinter.y = 36;
textPrinter.currentY = 36;
AddTextPrinter(&textPrinter, 0, NULL);
@ -5144,7 +5144,7 @@ static s32 sub_8192F08(u8 arg0, u8 *arg1)
static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
{
struct TextSubPrinter textPrinter;
struct TextPrinterTemplate textPrinter;
s32 tournamentIds[2];
s32 trainerIds[2];
bool32 lost[2];
@ -5292,12 +5292,12 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
textPrinter.currentY = textPrinter.y;
textPrinter.letterSpacing = 0;
textPrinter.lineSpacing = 0;
textPrinter.fontColor_l = 0;
textPrinter.unk = 0;
textPrinter.fgColor = 14;
textPrinter.bgColor = 0;
textPrinter.shadowColor = 13;
StringExpandPlaceholders(gStringVar4, gBattleDomeWinStringsPointers[winStringId]);
textPrinter.current_text_offset = gStringVar4;
textPrinter.currentChar = gStringVar4;
textPrinter.windowId = windowId + 8;
textPrinter.fontId = 1;
PutWindowTilemap(windowId + 8);
@ -5316,9 +5316,9 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
textPrinter.fontId = 2;
textPrinter.letterSpacing = 2;
textPrinter.current_text_offset = gStringVar1;
textPrinter.currentChar = gStringVar1;
textPrinter.windowId = windowId + 6;
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.current_text_offset, 0x40, textPrinter.letterSpacing);
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x40, textPrinter.letterSpacing);
textPrinter.currentY = textPrinter.y = 2;
PutWindowTilemap(windowId + 6);
CopyWindowToVram(windowId + 6, 3);
@ -5332,9 +5332,9 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
else
CopyDomeTrainerName(gStringVar1, trainerIds[1]);
textPrinter.current_text_offset = gStringVar1;
textPrinter.currentChar = gStringVar1;
textPrinter.windowId = windowId + 7;
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.current_text_offset, 0x40, textPrinter.letterSpacing);
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x40, textPrinter.letterSpacing);
textPrinter.currentY = textPrinter.y = 2;
PutWindowTilemap(windowId + 7);
CopyWindowToVram(windowId + 7, 3);
@ -5342,9 +5342,9 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
// Print match number.
textPrinter.letterSpacing = 0;
textPrinter.current_text_offset = gBattleDomeMatchNumberPointers[matchNo];
textPrinter.currentChar = gBattleDomeMatchNumberPointers[matchNo];
textPrinter.windowId = windowId + 5;
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.current_text_offset, 0xA0, textPrinter.letterSpacing);
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0xA0, textPrinter.letterSpacing);
textPrinter.currentY = textPrinter.y = 2;
PutWindowTilemap(windowId + 5);
CopyWindowToVram(windowId + 5, 3);
@ -5663,7 +5663,7 @@ static u16 GetWinningMove(s32 winnerTournamentId, s32 loserTournamentId, u8 roun
static void sub_8194220(u8 taskId)
{
s32 i;
struct TextSubPrinter textPrinter;
struct TextPrinterTemplate textPrinter;
s32 r10 = gTasks[taskId].data[1];
s32 r4 = gTasks[taskId].data[2];
@ -5740,15 +5740,15 @@ static void sub_8194220(u8 taskId)
break;
case 4:
textPrinter.fontId = 2;
textPrinter.current_text_offset = gText_BattleTourney;
textPrinter.currentChar = gText_BattleTourney;
textPrinter.windowId = 2;
textPrinter.x = 0;
textPrinter.y = 0;
textPrinter.letterSpacing = 2;
textPrinter.lineSpacing = 0;
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.current_text_offset, 0x70, textPrinter.letterSpacing);
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x70, textPrinter.letterSpacing);
textPrinter.currentY = 1;
textPrinter.fontColor_l = 0;
textPrinter.unk = 0;
textPrinter.fgColor = 14;
textPrinter.bgColor = 0;
textPrinter.shadowColor = 13;
@ -5831,7 +5831,7 @@ static void sub_8194220(u8 taskId)
textPrinter.currentX = GetStringWidthDifference(textPrinter.fontId, gDisplayedStringBattle, 0x3D, textPrinter.letterSpacing);
else
textPrinter.currentX = 3;
textPrinter.current_text_offset = gDisplayedStringBattle;
textPrinter.currentChar = gDisplayedStringBattle;
textPrinter.windowId = gUnknown_0860D3F1[i][0];
textPrinter.currentY = gUnknown_0860D3F1[i][1];
AddTextPrinter(&textPrinter, 0, NULL);
@ -5899,7 +5899,7 @@ static void sub_81948EC(u8 tournamentId, u8 arg1)
static void sub_8194950(u8 taskId)
{
s32 i;
struct TextSubPrinter textPrinter;
struct TextPrinterTemplate textPrinter;
switch (gTasks[taskId].data[0])
{
@ -5917,7 +5917,7 @@ static void sub_8194950(u8 taskId)
textPrinter.y = 0;
textPrinter.letterSpacing = 2;
textPrinter.lineSpacing = 0;
textPrinter.fontColor_l = 0;
textPrinter.unk = 0;
textPrinter.fgColor = 11;
textPrinter.bgColor = 0;
textPrinter.shadowColor = 13;
@ -5932,7 +5932,7 @@ static void sub_8194950(u8 taskId)
else
textPrinter.currentX = 3;
textPrinter.current_text_offset = gDisplayedStringBattle;
textPrinter.currentChar = gDisplayedStringBattle;
textPrinter.windowId = gUnknown_0860D3F1[i][0];
textPrinter.currentY = gUnknown_0860D3F1[i][1];
AddTextPrinter(&textPrinter, 0, NULL);

View File

@ -2938,7 +2938,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId)
{
const struct BattleWindowText *textInfo = sBattleTextOnWindowsInfo[gBattleScripting.windowsType];
bool32 copyToVram;
struct TextSubPrinter textSubPrinter;
struct TextPrinterTemplate printerTemplate;
u8 speed;
if (windowId & 0x80)
@ -2952,36 +2952,36 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId)
copyToVram = TRUE;
}
textSubPrinter.current_text_offset = text;
textSubPrinter.windowId = windowId;
textSubPrinter.fontId = textInfo[windowId].fontId;
textSubPrinter.x = textInfo[windowId].x;
textSubPrinter.y = textInfo[windowId].y;
textSubPrinter.currentX = textSubPrinter.x;
textSubPrinter.currentY = textSubPrinter.y;
textSubPrinter.letterSpacing = textInfo[windowId].letterSpacing;
textSubPrinter.lineSpacing = textInfo[windowId].lineSpacing;
textSubPrinter.fontColor_l = 0;
textSubPrinter.fgColor = textInfo[windowId].fgColor;
textSubPrinter.bgColor = textInfo[windowId].bgColor;
textSubPrinter.shadowColor = textInfo[windowId].shadowColor;
printerTemplate.currentChar = text;
printerTemplate.windowId = windowId;
printerTemplate.fontId = textInfo[windowId].fontId;
printerTemplate.x = textInfo[windowId].x;
printerTemplate.y = textInfo[windowId].y;
printerTemplate.currentX = printerTemplate.x;
printerTemplate.currentY = printerTemplate.y;
printerTemplate.letterSpacing = textInfo[windowId].letterSpacing;
printerTemplate.lineSpacing = textInfo[windowId].lineSpacing;
printerTemplate.unk = 0;
printerTemplate.fgColor = textInfo[windowId].fgColor;
printerTemplate.bgColor = textInfo[windowId].bgColor;
printerTemplate.shadowColor = textInfo[windowId].shadowColor;
if (textSubPrinter.x == 0xFF)
if (printerTemplate.x == 0xFF)
{
u32 width = sub_80397C4(gBattleScripting.windowsType, windowId);
s32 alignX = GetStringCenterAlignXOffsetWithLetterSpacing(textSubPrinter.fontId, textSubPrinter.current_text_offset, width, textSubPrinter.letterSpacing);
textSubPrinter.x = textSubPrinter.currentX = alignX;
s32 alignX = GetStringCenterAlignXOffsetWithLetterSpacing(printerTemplate.fontId, printerTemplate.currentChar, width, printerTemplate.letterSpacing);
printerTemplate.x = printerTemplate.currentX = alignX;
}
if (windowId == 0x16)
gTextFlags.flag_1 = 0;
gTextFlags.useAlternateDownArrow = 0;
else
gTextFlags.flag_1 = 1;
gTextFlags.useAlternateDownArrow = 1;
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED))
gTextFlags.flag_2 = 1;
gTextFlags.autoScroll = 1;
else
gTextFlags.flag_2 = 0;
gTextFlags.autoScroll = 0;
if (windowId == 0 || windowId == 0x16)
{
@ -2990,17 +2990,17 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId)
else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
speed = sRecordedBattleTextSpeeds[GetTextSpeedInRecordedBattle()];
else
speed = GetPlayerTextSpeed();
speed = GetPlayerTextSpeedDelay();
gTextFlags.flag_0 = 1;
gTextFlags.canABSpeedUpPrint = 1;
}
else
{
speed = textInfo[windowId].speed;
gTextFlags.flag_0 = 0;
gTextFlags.canABSpeedUpPrint = 0;
}
AddTextPrinter(&textSubPrinter, speed, NULL);
AddTextPrinter(&printerTemplate, speed, NULL);
if (copyToVram)
{

View File

@ -1457,7 +1457,7 @@ static void sub_81C6DAC(u8 taskId, const struct YesNoFuncTable *yesNoTable)
void DisplayItemMessageInBattlePyramid(u8 taskId, const u8 *str, void (*callback)(u8 taskId))
{
FillWindowPixelBuffer(2, 0x11);
DisplayMessageAndContinueTask(taskId, 2, 0xA, 0xD, 1, GetPlayerTextSpeed(), str, callback);
DisplayMessageAndContinueTask(taskId, 2, 0xA, 0xD, 1, GetPlayerTextSpeedDelay(), str, callback);
schedule_bg_copy_tilemap_to_vram(1);
}

View File

@ -6380,7 +6380,7 @@ static void PutLevelAndGenderOnLvlUpBox(void)
{
u16 monLevel;
u8 monGender;
struct TextSubPrinter subPrinter;
struct TextPrinterTemplate printerTemplate;
u8 *txtPtr;
u32 var;
@ -6388,21 +6388,21 @@ static void PutLevelAndGenderOnLvlUpBox(void)
monGender = GetMonGender(&gPlayerParty[gBattleStruct->expGetterMonId]);
GetMonNickname(&gPlayerParty[gBattleStruct->expGetterMonId], gStringVar4);
subPrinter.current_text_offset = gStringVar4;
subPrinter.windowId = 14;
subPrinter.fontId = 0;
subPrinter.x = 32;
subPrinter.y = 0;
subPrinter.currentX = 32;
subPrinter.currentY = 0;
subPrinter.letterSpacing = 0;
subPrinter.lineSpacing = 0;
subPrinter.fontColor_l = TEXT_COLOR_TRANSPARENT;
subPrinter.fgColor = TEXT_COLOR_WHITE;
subPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
subPrinter.shadowColor = TEXT_COLOR_DARK_GREY;
printerTemplate.currentChar = gStringVar4;
printerTemplate.windowId = 14;
printerTemplate.fontId = 0;
printerTemplate.x = 32;
printerTemplate.y = 0;
printerTemplate.currentX = 32;
printerTemplate.currentY = 0;
printerTemplate.letterSpacing = 0;
printerTemplate.lineSpacing = 0;
printerTemplate.unk = 0;
printerTemplate.fgColor = TEXT_COLOR_WHITE;
printerTemplate.bgColor = TEXT_COLOR_TRANSPARENT;
printerTemplate.shadowColor = TEXT_COLOR_DARK_GREY;
AddTextPrinter(&subPrinter, 0xFF, NULL);
AddTextPrinter(&printerTemplate, 0xFF, NULL);
txtPtr = gStringVar4;
gStringVar4[0] = CHAR_SPECIAL_F9;
@ -6432,9 +6432,9 @@ static void PutLevelAndGenderOnLvlUpBox(void)
*(txtPtr++) = EOS;
}
subPrinter.y = 10;
subPrinter.currentY = 10;
AddTextPrinter(&subPrinter, 0xFF, NULL);
printerTemplate.y = 10;
printerTemplate.currentY = 10;
AddTextPrinter(&printerTemplate, 0xFF, NULL);
CopyWindowToVram(14, 2);
}

View File

@ -1031,7 +1031,7 @@ static void sub_807FAC8(void)
sBerryBlenderData->mainState++;
break;
case 4:
if (Blender_PrintText(&sBerryBlenderData->textState, sText_BerryBlenderStart, GetPlayerTextSpeed()))
if (Blender_PrintText(&sBerryBlenderData->textState, sText_BerryBlenderStart, GetPlayerTextSpeedDelay()))
sBerryBlenderData->mainState++;
break;
case 5:
@ -2490,7 +2490,7 @@ static void CB2_HandleBlenderEndGame(void)
}
break;
case 7:
if (Blender_PrintText(&sBerryBlenderData->textState, sText_WouldLikeToBlendAnotherBerry, GetPlayerTextSpeed()))
if (Blender_PrintText(&sBerryBlenderData->textState, sText_WouldLikeToBlendAnotherBerry, GetPlayerTextSpeedDelay()))
sBerryBlenderData->gameEndState++;
break;
case 9:
@ -2572,7 +2572,7 @@ static void CB2_HandleBlenderEndGame(void)
sBerryBlenderData->gameEndState++;
break;
case 13:
if (Blender_PrintText(&sBerryBlenderData->textState, sText_CommunicationStandby, GetPlayerTextSpeed()))
if (Blender_PrintText(&sBerryBlenderData->textState, sText_CommunicationStandby, GetPlayerTextSpeedDelay()))
{
SetMainCallback2(CB2_HandlePlayerLinkPlayAgainChoice);
sBerryBlenderData->gameEndState = 0;
@ -2680,7 +2680,7 @@ static void CB2_HandlePlayerLinkPlayAgainChoice(void)
StringAppend(gStringVar4, sText_HasNoBerriesToPut);
break;
case 3:
if (Blender_PrintText(&sBerryBlenderData->textState, gStringVar4, GetPlayerTextSpeed()))
if (Blender_PrintText(&sBerryBlenderData->textState, gStringVar4, GetPlayerTextSpeedDelay()))
{
sBerryBlenderData->framesToWait = 0;
sBerryBlenderData->gameEndState++;
@ -2787,7 +2787,7 @@ static void CB2_HandlePlayerPlayAgainChoice(void)
StringCopy(gStringVar4, sText_RunOutOfBerriesForBlending);
break;
case 3:
if (Blender_PrintText(&sBerryBlenderData->textState, gStringVar4, GetPlayerTextSpeed()))
if (Blender_PrintText(&sBerryBlenderData->textState, gStringVar4, GetPlayerTextSpeedDelay()))
sBerryBlenderData->gameEndState = 9;
break;
case 9:
@ -3363,7 +3363,7 @@ static bool8 Blender_PrintBlendingResults(void)
sBerryBlenderData->mainState++;
break;
case 6:
if (Blender_PrintText(&sBerryBlenderData->textState, sBerryBlenderData->stringVar, GetPlayerTextSpeed()))
if (Blender_PrintText(&sBerryBlenderData->textState, sBerryBlenderData->stringVar, GetPlayerTextSpeedDelay()))
{
TryUpdateBerryBlenderRecord();
return TRUE;

View File

@ -316,11 +316,11 @@ void sub_80D77E4(void)
DeactivateAllTextPrinters();
if (gIsLinkContest & 1)
{
gTextFlags.flag_0 = FALSE;
gTextFlags.canABSpeedUpPrint = FALSE;
}
else
{
gTextFlags.flag_0 = TRUE;
gTextFlags.canABSpeedUpPrint = TRUE;
}
}

View File

@ -1206,17 +1206,17 @@ static void GetDaycareLevelMenuLevelText(struct DayCare *daycare, u8 *dest)
static void DaycareAddTextPrinter(u8 windowId, const u8 *text, u32 x, u32 y)
{
struct TextSubPrinter printer;
struct TextPrinterTemplate printer;
printer.current_text_offset = text;
printer.currentChar = text;
printer.windowId = windowId;
printer.fontId = 1;
printer.x = x;
printer.y = y;
printer.currentX = x;
printer.currentY = y;
printer.fontColor_l = 0;
gTextFlags.flag_1 = 0;
printer.unk = 0;
gTextFlags.useAlternateDownArrow = 0;
printer.letterSpacing = 0;
printer.lineSpacing = 1;
printer.fgColor = 2;

View File

@ -531,7 +531,7 @@ void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpri
gBattle_BG3_X = 256;
gBattle_BG3_Y = 0;
gTextFlags.flag_1 = 1;
gTextFlags.useAlternateDownArrow = 1;
SetVBlankCallback(VBlankCB_TradeEvolutionScene);
SetMainCallback2(CB2_TradeEvolutionSceneUpdate);
@ -1135,7 +1135,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
DestroyTask(taskID);
Free(sEvoStructPtr);
sEvoStructPtr = NULL;
gTextFlags.flag_1 = 0;
gTextFlags.useAlternateDownArrow = 0;
SetMainCallback2(gCB2_AfterEvolution);
}
break;

View File

@ -16,10 +16,10 @@ void textbox_auto_and_task_add(void);
void sub_8098128(void)
{
gUnknown_020375BC = 0;
gTextFlags.flag_0 = 0;
gTextFlags.flag_1 = 0;
gTextFlags.flag_2 = 0;
gTextFlags.flag_3 = 0;
gTextFlags.canABSpeedUpPrint = 0;
gTextFlags.useAlternateDownArrow = 0;
gTextFlags.autoScroll = 0;
gTextFlags.forceMidTextSpeed = 0;
}
void sub_8098154(u8 taskId)

View File

@ -1031,7 +1031,7 @@ void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, void ( *callback)(u
data[10] = AddItemMessageWindow(4);
FillWindowPixelBuffer(data[10], 17);
DisplayMessageAndContinueTask(taskId, data[10], 10, 13, fontId, GetPlayerTextSpeed(), str, callback);
DisplayMessageAndContinueTask(taskId, data[10], 10, 13, fontId, GetPlayerTextSpeedDelay(), str, callback);
schedule_bg_copy_tilemap_to_vram(1);
}

View File

@ -144,7 +144,7 @@ void ClearSecretBase2Field_9(void)
gSaveBlock2Ptr->specialSaveWarp &= ~1;
}
void sub_8076D48(void)
void SetSecretBase2Field_9(void)
{
gSaveBlock2Ptr->specialSaveWarp |= 1;
}

View File

@ -74,7 +74,7 @@ static void NewGameBirchSpeech_ShowDialogueWindow(u8, u8);
static void NewGameBirchSpeech_ClearWindow(u8);
static void Task_NewGameBirchSpeech_ThisIsAPokemon(u8);
static void Task_NewGameBirchSpeech_MainSpeech(u8);
static void NewGameBirchSpeech_ShowPokeBallPrinterCallback(struct TextSubPrinter *printer, u16 a);
static void NewGameBirchSpeech_ShowPokeBallPrinterCallback(struct TextPrinterTemplate *printer, u16 a);
static void Task_NewGameBirchSpeech_AndYouAre(u8);
static void Task_NewGameBirchSpeechSub_WaitForLotad(u8);
static void Task_NewGameBirchSpeech_StartBirchLotadPlatformFade(u8);
@ -2126,9 +2126,9 @@ static void NewGameBirchSpeech_ClearWindow(u8 windowId)
CopyWindowToVram(windowId, 2);
}
static void NewGameBirchSpeech_ShowPokeBallPrinterCallback(struct TextSubPrinter *printer, u16 a)
static void NewGameBirchSpeech_ShowPokeBallPrinterCallback(struct TextPrinterTemplate *printer, u16 a)
{
if (*(printer->current_text_offset - 2) == 8 && gUnknown_02022D04 == 0)
if (*(printer->currentChar - 2) == 8 && gUnknown_02022D04 == 0)
{
gUnknown_02022D04 = 1;
CreateTask(Task_NewGameBirchSpeechSub_InitPokeBall, 0);

View File

@ -430,7 +430,7 @@ static void sub_81206F0(void)
gUnknown_03002F84 = FALSE;
}
static void BardSong_TextSubPrinter(struct TextSubPrinter * printer, u16 a1)
static void BardSong_TextSubPrinter(struct TextPrinterTemplate * printer, u16 a1)
{
gUnknown_03002F84 = TRUE;
}

View File

@ -163,11 +163,11 @@ u16 RunTextPrintersAndIsPrinter0Active(void)
return IsTextPrinterActive(0);
}
u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 fgColor, u8 bgColor, u8 shadowColor)
u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 fgColor, u8 bgColor, u8 shadowColor)
{
struct TextSubPrinter printer;
struct TextPrinterTemplate printer;
printer.current_text_offset = str;
printer.currentChar = str;
printer.windowId = windowId;
printer.fontId = fontId;
printer.x = 0;
@ -176,31 +176,31 @@ u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed
printer.currentY = 1;
printer.letterSpacing = 0;
printer.lineSpacing = 0;
printer.fontColor_l = 0;
printer.unk = 0;
printer.fgColor = fgColor;
printer.bgColor = bgColor;
printer.shadowColor = shadowColor;
gTextFlags.flag_1 = 0;
gTextFlags.useAlternateDownArrow = 0;
return AddTextPrinter(&printer, speed, callback);
}
void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress)
{
void (*callback)(struct TextSubPrinter *, u16) = NULL;
gTextFlags.flag_0 = allowSkippingDelayWithButtonPress;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), callback, 2, 1, 3);
void (*callback)(struct TextPrinterTemplate *, u16) = NULL;
gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3);
}
void AddTextPrinterForMessage_2(bool8 allowSkippingDelayWithButtonPress)
{
gTextFlags.flag_0 = allowSkippingDelayWithButtonPress;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), NULL, 2, 1, 3);
gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), NULL, 2, 1, 3);
}
void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed)
{
gTextFlags.flag_0 = allowSkippingDelayWithButtonPress;
gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress;
AddTextPrinterParameterized2(0, 1, gStringVar4, speed, NULL, 2, 1, 3);
}
@ -454,7 +454,7 @@ u16 sub_81978D0(u8 colorNum)
void DisplayItemMessageOnField(u8 taskId, const u8 *string, TaskFunc callback)
{
sub_81973A4();
DisplayMessageAndContinueTask(taskId, 0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM, 1, GetPlayerTextSpeed(), string, callback);
DisplayMessageAndContinueTask(taskId, 0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM, 1, GetPlayerTextSpeedDelay(), string, callback);
CopyWindowToVram(0, 3);
}
@ -468,19 +468,19 @@ void sub_8197948(u8 initialCursorPos)
CreateYesNoMenu(&gUnknown_0860F0A8, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM, initialCursorPos);
}
u32 sub_8197964(void)
u32 GetPlayerTextSpeed(void)
{
if (gTextFlags.flag_3)
return 1;
if (gTextFlags.forceMidTextSpeed)
return OPTIONS_TEXT_SPEED_MID;
return gSaveBlock2Ptr->optionsTextSpeed;
}
u8 GetPlayerTextSpeed(void)
u8 GetPlayerTextSpeedDelay(void)
{
u32 speed;
if (gSaveBlock2Ptr->optionsTextSpeed > 2)
gSaveBlock2Ptr->optionsTextSpeed = 1;
speed = sub_8197964();
if (gSaveBlock2Ptr->optionsTextSpeed > OPTIONS_TEXT_SPEED_FAST)
gSaveBlock2Ptr->optionsTextSpeed = OPTIONS_TEXT_SPEED_MID;
speed = GetPlayerTextSpeed();
return gUnknown_0860F094[speed];
}
@ -536,10 +536,10 @@ void RemoveMapNamePopUpWindow(void)
}
}
void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextSubPrinter *, u16))
void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16))
{
gTextFlags.flag_0 = a1;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), callback, 2, 1, 3);
gTextFlags.canABSpeedUpPrint = a1;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3);
}
void sub_8197AE8(bool8 copyToVram)
@ -1116,14 +1116,14 @@ void sub_8198854(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const stru
void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a8)
{
u8 i;
struct TextSubPrinter printer;
struct TextPrinterTemplate printer;
printer.windowId = windowId;
printer.fontId = fontId;
printer.fgColor = GetFontAttribute(fontId, FONTATTR_COLOR_FOREGROUND);
printer.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW);
printer.fontColor_l = GetFontAttribute(fontId, FONTATTR_COLOR_LOWNIBBLE);
printer.unk = GetFontAttribute(fontId, FONTATTR_UNKNOWN);
printer.letterSpacing = letterSpacing;
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
printer.x = left;
@ -1131,7 +1131,7 @@ void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 l
for (i = 0; i < itemCount; i++)
{
printer.current_text_offset = strs[a8[i]].text;
printer.currentChar = strs[a8[i]].text;
printer.y = (lineHeight * i) + top;
printer.currentY = printer.y;
AddTextPrinter(&printer, 0xFF, NULL);
@ -1172,12 +1172,12 @@ u16 sub_8198AA4(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16
void sub_8198AF8(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top, u16 baseTileNum, u8 paletteNum, u8 initialCursorPos)
{
struct TextSubPrinter printer;
struct TextPrinterTemplate printer;
gUnknown_0203CD9F = AddWindow(window);
SetWindowBorderStyle(gUnknown_0203CD9F, TRUE, baseTileNum, paletteNum);
printer.current_text_offset = gText_YesNo;
printer.currentChar = gText_YesNo;
printer.windowId = gUnknown_0203CD9F;
printer.fontId = fontId;
printer.x = GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH) + left;
@ -1187,7 +1187,7 @@ void sub_8198AF8(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top
printer.fgColor = GetFontAttribute(fontId, FONTATTR_COLOR_FOREGROUND);
printer.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW);
printer.fontColor_l = GetFontAttribute(fontId, FONTATTR_COLOR_LOWNIBBLE);
printer.unk = GetFontAttribute(fontId, FONTATTR_UNKNOWN);
printer.letterSpacing = GetFontAttribute(fontId, FONTATTR_LETTER_SPACING);
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
@ -1238,22 +1238,22 @@ void sub_8198DBC(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 itemCount, u
{
u8 i;
u8 j;
struct TextSubPrinter printer;
struct TextPrinterTemplate printer;
printer.windowId = windowId;
printer.fontId = fontId;
printer.fgColor = GetFontAttribute(fontId, 5);
printer.bgColor = GetFontAttribute(fontId, 6);
printer.shadowColor = GetFontAttribute(fontId, 7);
printer.fontColor_l = GetFontAttribute(fontId, 4);
printer.letterSpacing = GetFontAttribute(fontId, 2);
printer.lineSpacing = GetFontAttribute(fontId, 3);
printer.fgColor = GetFontAttribute(fontId, FONTATTR_COLOR_FOREGROUND);
printer.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW);
printer.unk = GetFontAttribute(fontId, FONTATTR_UNKNOWN);
printer.letterSpacing = GetFontAttribute(fontId, FONTATTR_LETTER_SPACING);
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
for (i = 0; i < itemCount2; i++)
{
for (j = 0; j < itemCount; j++)
{
printer.current_text_offset = strs[a8[(itemCount * i) + j]].text;
printer.currentChar = strs[a8[(itemCount * i) + j]].text;
printer.x = (a4 * j) + left;
printer.y = (GetFontAttribute(fontId, 1) * i) + top;
printer.currentX = printer.x;
@ -1611,14 +1611,14 @@ void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs)
void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *strs, const u8 *a8)
{
u8 i;
struct TextSubPrinter printer;
struct TextPrinterTemplate printer;
printer.windowId = windowId;
printer.fontId = 1;
printer.fgColor = GetFontAttribute(1, 5);
printer.bgColor = GetFontAttribute(1, 6);
printer.shadowColor = GetFontAttribute(1, 7);
printer.fontColor_l = GetFontAttribute(1, 4);
printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND);
printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN);
printer.letterSpacing = 0;
printer.lineSpacing = 0;
printer.x = 8;
@ -1626,7 +1626,7 @@ void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *strs, const
for (i = 0; i < itemCount; i++)
{
printer.current_text_offset = strs[a8[i]].text;
printer.currentChar = strs[a8[i]].text;
printer.y = (i * 16) + 1;
printer.currentY = (i * 16) + 1;
AddTextPrinter(&printer, 0xFF, NULL);
@ -1637,22 +1637,22 @@ void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *strs, const
void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 paletteNum, u8 initialCursorPos)
{
struct TextSubPrinter printer;
struct TextPrinterTemplate printer;
gUnknown_0203CD9F = AddWindow(window);
SetWindowBorderStyle(gUnknown_0203CD9F, TRUE, baseTileNum, paletteNum);
printer.current_text_offset = gText_YesNo;
printer.currentChar = gText_YesNo;
printer.windowId = gUnknown_0203CD9F;
printer.fontId = 1;
printer.x = 8;
printer.y = 1;
printer.currentX = printer.x;
printer.currentY = printer.y;
printer.fgColor = GetFontAttribute(1, 5);
printer.bgColor = GetFontAttribute(1, 6);
printer.shadowColor = GetFontAttribute(1, 7);
printer.fontColor_l = GetFontAttribute(1, 4);
printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND);
printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN);
printer.letterSpacing = 0;
printer.lineSpacing = 0;
@ -1678,14 +1678,14 @@ void sub_819983C(u8 windowId, u8 a4, u8 itemCount, u8 itemCount2, const struct M
{
u8 i;
u8 j;
struct TextSubPrinter printer;
struct TextPrinterTemplate printer;
printer.windowId = windowId;
printer.fontId = 1;
printer.fgColor = GetFontAttribute(1, 5);
printer.bgColor = GetFontAttribute(1, 6);
printer.shadowColor = GetFontAttribute(1, 7);
printer.fontColor_l = GetFontAttribute(1, 4);
printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND);
printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN);
printer.letterSpacing = 0;
printer.lineSpacing = 0;
@ -1693,7 +1693,7 @@ void sub_819983C(u8 windowId, u8 a4, u8 itemCount, u8 itemCount2, const struct M
{
for (j = 0; j < itemCount; j++)
{
printer.current_text_offset = strs[a8[(itemCount * i) + j]].text;
printer.currentChar = strs[a8[(itemCount * i) + j]].text;
printer.x = (a4 * j) + 8;
printer.y = (16 * i) + 1;
printer.currentX = printer.x;
@ -1941,9 +1941,9 @@ void sub_8199DF0(u32 bg, u8 a1, int a2, int a3)
void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str)
{
struct TextSubPrinter printer;
struct TextPrinterTemplate printer;
printer.current_text_offset = str;
printer.currentChar = str;
printer.windowId = windowId;
printer.fontId = fontId;
printer.x = left;
@ -1952,7 +1952,7 @@ void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const
printer.currentY = printer.y;
printer.letterSpacing = GetFontAttribute(fontId, 2);
printer.lineSpacing = GetFontAttribute(fontId, 3);
printer.fontColor_l = 0;
printer.unk = 0;
printer.fgColor = color[1];
printer.bgColor = color[0];
printer.shadowColor = color[2];
@ -1962,9 +1962,9 @@ void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const
void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineSpacing, const u8 *color, s8 speed, const u8 *str)
{
struct TextSubPrinter printer;
struct TextPrinterTemplate printer;
printer.current_text_offset = str;
printer.currentChar = str;
printer.windowId = windowId;
printer.fontId = fontId;
printer.x = left;
@ -1973,7 +1973,7 @@ void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 left, u8 top, u8 le
printer.currentY = printer.y;
printer.letterSpacing = letterSpacing;
printer.lineSpacing = lineSpacing;
printer.fontColor_l = 0;
printer.unk = 0;
printer.fgColor = color[1];
printer.bgColor = color[0];
printer.shadowColor = color[2];
@ -1981,11 +1981,11 @@ void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 left, u8 top, u8 le
AddTextPrinter(&printer, speed, NULL);
}
void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 letterSpacing, u8 lineSpacing)
void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 letterSpacing, u8 lineSpacing)
{
struct TextSubPrinter printer;
struct TextPrinterTemplate printer;
printer.current_text_offset = str;
printer.currentChar = str;
printer.windowId = windowId;
printer.fontId = fontId;
printer.x = left;
@ -1994,7 +1994,7 @@ void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left
printer.currentY = top;
printer.letterSpacing = letterSpacing;
printer.lineSpacing = lineSpacing;
printer.fontColor_l = 0;
printer.unk = 0;
printer.fgColor = GetFontAttribute(fontId, 5);
printer.bgColor = GetFontAttribute(fontId, 6);

View File

@ -134,7 +134,7 @@ void DisplayMessageAndContinueTask(u8 taskId, u8 windowId, u16 arg2, u8 arg3, u8
if (string != gStringVar4)
StringExpandPlaceholders(gStringVar4, string);
gTextFlags.flag_0 = 1;
gTextFlags.canABSpeedUpPrint = 1;
AddTextPrinterParameterized2(windowId, fontId, gStringVar4, textSpeed, NULL, 2, 1, 3);
gUnknown_0300117C = taskFunc;
gTasks[taskId].func = Task_ContinueTaskAfterMessagePrints;

View File

@ -558,8 +558,8 @@ static void DisplaySentToPCMessage(void)
StringExpandPlaceholders(gStringVar4, gUnknown_0858BDB8[stringToDisplay]);
NewMenuHelpers_DrawDialogueFrame(0, 0);
gTextFlags.flag_0 = TRUE;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), 0, 2, 1, 3);
gTextFlags.canABSpeedUpPrint = TRUE;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), 0, 2, 1, 3);
CopyWindowToVram(0, 3);
}

View File

@ -1179,7 +1179,7 @@ static void PokeblockAction_Toss(u8 taskId)
sub_8198070(data[1], FALSE);
StringCopy(gStringVar1, gPokeblockNames[gSaveBlock1Ptr->pokeblocks[gSpecialVar_ItemId].color]);
StringExpandPlaceholders(gStringVar4, gText_ThrowAwayVar1);
DisplayMessageAndContinueTask(taskId, 10, 10, 13, 1, GetPlayerTextSpeed(), gStringVar4, CreateTossPokeblockYesNoMenu);
DisplayMessageAndContinueTask(taskId, 10, 10, 13, 1, GetPlayerTextSpeedDelay(), gStringVar4, CreateTossPokeblockYesNoMenu);
}
static void CreateTossPokeblockYesNoMenu(u8 taskId)
@ -1190,7 +1190,7 @@ static void CreateTossPokeblockYesNoMenu(u8 taskId)
static void TossPokeblockChoice_Yes(u8 taskId)
{
StringExpandPlaceholders(gStringVar4, gText_Var1ThrownAway);
DisplayMessageAndContinueTask(taskId, 10, 10, 13, 1, GetPlayerTextSpeed(), gStringVar4, HandleErasePokeblock);
DisplayMessageAndContinueTask(taskId, 10, 10, 13, 1, GetPlayerTextSpeedDelay(), gStringVar4, HandleErasePokeblock);
}
static void HandleErasePokeblock(u8 taskId)

View File

@ -785,8 +785,8 @@ static void Task_HandleMonAtePokeblock(u8 taskId)
else
StringExpandPlaceholders(gStringVar4, gText_Var1DisdainfullyAteVar2);
gTextFlags.flag_0 = 1;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), NULL, 2, 1, 3);
gTextFlags.canABSpeedUpPrint = 1;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), NULL, 2, 1, 3);
gTasks[taskId].func = Task_WaitForAtePokeblockText;
}

View File

@ -0,0 +1,94 @@
#include "global.h"
#include "main.h"
#include "credits.h"
#include "event_data.h"
#include "hall_of_fame.h"
#include "load_save.h"
#include "overworld.h"
#include "script_pokemon_util_80F87D8.h"
#include "tv.h"
#include "constants/heal_locations.h"
#include "constants/flags.h"
int GameClear(void)
{
int i;
bool32 ribbonGet;
struct RibbonCounter {
u8 partyIndex;
u8 count;
} ribbonCounts[6];
s8 val;
HealPlayerParty();
if (FlagGet(FLAG_SYS_GAME_CLEAR) == TRUE)
{
gHasHallOfFameRecords = TRUE;
}
else
{
gHasHallOfFameRecords = FALSE;
FlagSet(FLAG_SYS_GAME_CLEAR);
}
if (GetGameStat(GAME_STAT_FIRST_HOF_PLAY_TIME) == 0)
SetGameStat(GAME_STAT_FIRST_HOF_PLAY_TIME, (gSaveBlock2Ptr->playTimeHours << 16) | (gSaveBlock2Ptr->playTimeMinutes << 8) | gSaveBlock2Ptr->playTimeSeconds);
SetSecretBase2Field_9();
if (gSaveBlock2Ptr->playerGender == MALE)
sub_8084F6C(HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F);
else
sub_8084F6C(HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE_2F);
ribbonGet = FALSE;
for (i = 0; i < 6; i++)
{
struct Pokemon *mon = &gPlayerParty[i];
ribbonCounts[i].partyIndex = i;
ribbonCounts[i].count = 0;
if (GetMonData(mon, MON_DATA_SANITY_BIT2)
&& !GetMonData(mon, MON_DATA_SANITY_BIT3)
&& !GetMonData(mon, MON_DATA_CHAMPION_RIBBON))
{
u8 val[1] = {TRUE};
SetMonData(mon, MON_DATA_CHAMPION_RIBBON, val);
ribbonCounts[i].count = GetRibbonCount(mon);
ribbonGet = TRUE;
}
}
if (ribbonGet == TRUE)
{
IncrementGameStat(GAME_STAT_RECEIVED_RIBBONS);
FlagSet(FLAG_SYS_RIBBON_GET);
for (i = 1; i < 6; i++)
{
if (ribbonCounts[i].count > ribbonCounts[0].count)
{
struct RibbonCounter prevBest = ribbonCounts[0];
ribbonCounts[0] = ribbonCounts[i];
ribbonCounts[i] = prevBest;
}
}
if (ribbonCounts[0].count > 4)
{
sub_80EE4DC(&gPlayerParty[ribbonCounts[0].partyIndex], MON_DATA_CHAMPION_RIBBON);
}
}
SetMainCallback2(CB2_DoHallOfFameScreen);
return 0;
}
bool8 sp0C8_whiteout_maybe(void)
{
SetMainCallback2(CB2_WhiteOut);
return FALSE;
}

View File

@ -1295,8 +1295,8 @@ bool8 ScrCmd_messageautoscroll(struct ScriptContext *ctx)
if (msg == NULL)
msg = (const u8 *)ctx->data[0];
gTextFlags.flag_2 = TRUE;
gTextFlags.flag_3 = TRUE;
gTextFlags.autoScroll = TRUE;
gTextFlags.forceMidTextSpeed = TRUE;
ShowFieldAutoScrollMessage(msg);
return FALSE;
}

View File

@ -694,7 +694,7 @@ static void BuyMenuPrint(u8 windowId, const u8 *text, u8 x, u8 y, s8 speed, u8 c
static void BuyMenuDisplayMessage(u8 taskId, const u8 *text, TaskFunc callback)
{
DisplayMessageAndContinueTask(taskId, 5, 10, 14, 1, GetPlayerTextSpeed(), text, callback);
DisplayMessageAndContinueTask(taskId, 5, 10, 14, 1, GetPlayerTextSpeedDelay(), text, callback);
schedule_bg_copy_tilemap_to_vram(0);
}

1857
src/text.c

File diff suppressed because it is too large Load Diff

View File

@ -15,86 +15,86 @@ u16 Font6Func(struct TextPrinter *textPrinter)
u16 char_;
struct TextPrinterSubStruct *sub;
sub = &textPrinter->sub_union.sub;
sub = &textPrinter->subUnion.sub;
switch (textPrinter->state)
{
case 0:
if (gMain.heldKeys & (A_BUTTON | B_BUTTON) && sub->font_type_upper)
if (gMain.heldKeys & (A_BUTTON | B_BUTTON) && sub->hasPrintBeenSpedUp)
{
textPrinter->delayCounter = 0;
}
if (textPrinter->delayCounter && textPrinter->text_speed)
if (textPrinter->delayCounter && textPrinter->textSpeed)
{
textPrinter->delayCounter --;
if (gTextFlags.flag_0 && gMain.newKeys & (A_BUTTON | B_BUTTON))
if (gTextFlags.canABSpeedUpPrint && gMain.newKeys & (A_BUTTON | B_BUTTON))
{
sub->font_type_upper = TRUE;
sub->hasPrintBeenSpedUp = TRUE;
textPrinter->delayCounter = 0;
}
return 3;
}
if (gTextFlags.flag_2)
if (gTextFlags.autoScroll)
{
textPrinter->delayCounter = 3;
}
else
{
textPrinter->delayCounter = textPrinter->text_speed;
textPrinter->delayCounter = textPrinter->textSpeed;
}
char_ = *textPrinter->subPrinter.current_text_offset ++;
char_ = *textPrinter->printerTemplate.currentChar++;
switch (char_)
{
case EOS:
return 1;
case CHAR_NEWLINE:
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
textPrinter->subPrinter.currentY += gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing;
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
textPrinter->printerTemplate.currentY += gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing;
return 2;
case PLACEHOLDER_BEGIN:
textPrinter->subPrinter.current_text_offset ++;
textPrinter->printerTemplate.currentChar++;
return 2;
case EXT_CTRL_CODE_BEGIN:
char_ = *textPrinter->subPrinter.current_text_offset ++;
char_ = *textPrinter->printerTemplate.currentChar++;
switch (char_)
{
case 1:
textPrinter->subPrinter.fgColor = *textPrinter->subPrinter.current_text_offset ++;
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar++;
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
return 2;
case 2:
textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset ++;
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
textPrinter->printerTemplate.bgColor = *textPrinter->printerTemplate.currentChar++;
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
return 2;
case 3:
textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset ++;
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
textPrinter->printerTemplate.shadowColor = *textPrinter->printerTemplate.currentChar++;
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
return 2;
case 4:
textPrinter->subPrinter.fgColor = *textPrinter->subPrinter.current_text_offset;
textPrinter->subPrinter.bgColor = *++ textPrinter->subPrinter.current_text_offset;
textPrinter->subPrinter.shadowColor = *++ textPrinter->subPrinter.current_text_offset;
textPrinter->subPrinter.current_text_offset ++;
textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar;
textPrinter->printerTemplate.bgColor = *++textPrinter->printerTemplate.currentChar;
textPrinter->printerTemplate.shadowColor = *++textPrinter->printerTemplate.currentChar;
textPrinter->printerTemplate.currentChar++;
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
return 2;
case 5:
textPrinter->subPrinter.current_text_offset ++;
textPrinter->printerTemplate.currentChar++;
return 2;
case 6:
sub->font_type = *textPrinter->subPrinter.current_text_offset;
textPrinter->subPrinter.current_text_offset ++;
sub->glyphId = *textPrinter->printerTemplate.currentChar;
textPrinter->printerTemplate.currentChar++;
return 2;
case 7:
return 2;
case 8:
textPrinter->delayCounter = *textPrinter->subPrinter.current_text_offset ++;
textPrinter->delayCounter = *textPrinter->printerTemplate.currentChar++;
textPrinter->state = 6;
return 2;
case 9:
textPrinter->state = 1;
if (gTextFlags.flag_2)
if (gTextFlags.autoScroll)
{
sub->frames_visible_counter = 0;
sub->autoScrollDelay = 0;
}
return 3;
case 10:
@ -102,19 +102,19 @@ u16 Font6Func(struct TextPrinter *textPrinter)
return 3;
case 11:
case 16:
textPrinter->subPrinter.current_text_offset += 2;
textPrinter->printerTemplate.currentChar += 2;
return 2;
case 12:
char_ = *++textPrinter->subPrinter.current_text_offset;
char_ = *++textPrinter->printerTemplate.currentChar;
break;
case 13:
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x + *textPrinter->subPrinter.current_text_offset ++;
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x + *textPrinter->printerTemplate.currentChar++;
return 2;
case 14:
textPrinter->subPrinter.currentY = textPrinter->subPrinter.y + *textPrinter->subPrinter.current_text_offset ++;
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y + *textPrinter->printerTemplate.currentChar++;
return 2;
case 15:
FillWindowPixelBuffer(textPrinter->subPrinter.windowId, textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4));
FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4));
return 2;
}
break;
@ -127,15 +127,15 @@ u16 Font6Func(struct TextPrinter *textPrinter)
TextPrinterInitDownArrowCounters(textPrinter);
return 3;
case 0xF9:
char_ = *textPrinter->subPrinter.current_text_offset ++ | 0x100;
char_ = *textPrinter->printerTemplate.currentChar++| 0x100;
break;
case 0xF8:
textPrinter->subPrinter.current_text_offset ++;
textPrinter->printerTemplate.currentChar++;
return 0;
}
DecompressGlyphFont6(char_);
CopyGlyphToWindow(textPrinter);
textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80] + textPrinter->subPrinter.letterSpacing;
textPrinter->printerTemplate.currentX += gUnknown_03002F90.unk80 + textPrinter->printerTemplate.letterSpacing;
return 0;
case 1:
if (TextPrinterWait(textPrinter))
@ -146,9 +146,9 @@ u16 Font6Func(struct TextPrinter *textPrinter)
case 2:
if (TextPrinterWaitWithDownArrow(textPrinter))
{
FillWindowPixelBuffer(textPrinter->subPrinter.windowId, textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4));
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
textPrinter->subPrinter.currentY = textPrinter->subPrinter.y;
FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4));
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y;
textPrinter->state = 0;
}
return 3;
@ -156,8 +156,8 @@ u16 Font6Func(struct TextPrinter *textPrinter)
if (TextPrinterWaitWithDownArrow(textPrinter))
{
TextPrinterClearDownArrow(textPrinter);
textPrinter->scrollDistance = gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing;
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
textPrinter->scrollDistance = gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing;
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
textPrinter->state = 4;
}
return 3;
@ -166,15 +166,15 @@ u16 Font6Func(struct TextPrinter *textPrinter)
{
if (textPrinter->scrollDistance < sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed])
{
ScrollWindow(textPrinter->subPrinter.windowId, 0, textPrinter->scrollDistance, textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4));
ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4));
textPrinter->scrollDistance = 0;
}
else
{
ScrollWindow(textPrinter->subPrinter.windowId, 0, sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed], textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4));
ScrollWindow(textPrinter->printerTemplate.windowId, 0, sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed], textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4));
textPrinter->scrollDistance -= sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed];
}
CopyWindowToVram(textPrinter->subPrinter.windowId, 2);
CopyWindowToVram(textPrinter->printerTemplate.windowId, 2);
}
else
{
@ -206,12 +206,12 @@ static void DecompressGlyphFont6(u16 glyph)
const u16 *glyphs;
glyphs = sFont6BrailleGlyphs + 0x100 * (glyph / 8) + 0x10 * (glyph % 8);
DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90);
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90 + 0x20));
DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90 + 0x40));
DecompressGlyphTile(glyphs + 0x88, (u16 *)(gUnknown_03002F90 + 0x60));
gUnknown_03002F90[0x80] = 0x10;
gUnknown_03002F90[0x81] = 0x10;
DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90.unk20));
DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90.unk40));
DecompressGlyphTile(glyphs + 0x88, (u16 *)(gUnknown_03002F90.unk60));
gUnknown_03002F90.unk80 = 0x10;
gUnknown_03002F90.unk81 = 0x10;
}
u8 GetGlyphWidthFont6(void)