battle labels merge with master

This commit is contained in:
DizzyEggg
2018-02-09 00:43:07 +01:00
137 changed files with 40431 additions and 35066 deletions

View File

@@ -17,7 +17,7 @@
#include "strings.h"
#include "window.h"
#include "text_window.h"
#include "new_menu_helpers.h"
#include "menu.h"
#include "battle_setup.h"
struct BattleBackground

View File

@@ -12,6 +12,7 @@
#include "util.h"
#include "main.h"
#include "constants/songs.h"
#include "constants/trainers.h"
#include "sound.h"
#include "window.h"
#include "m4a.h"
@@ -33,7 +34,7 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct BattleMove gBattleMoves[];
extern const u8 gUnknown_0831F578[];
extern const u8 gFacilityClassToPicIndex[];
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
@@ -1256,17 +1257,17 @@ static void LinkOpponentHandleDrawTrainerPic(void)
|| (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN)
{
if (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender != 0)
trainerPicId = gUnknown_0831F578[0x4F];
trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_10];
else
trainerPicId = gUnknown_0831F578[0x4E];
trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_9];
}
else if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY
|| (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE)
{
if (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender != 0)
trainerPicId = gUnknown_0831F578[0x51];
trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_12];
else
trainerPicId = gUnknown_0831F578[0x50];
trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_11];
}
else
{
@@ -1285,17 +1286,17 @@ static void LinkOpponentHandleDrawTrainerPic(void)
|| (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_LEAF_GREEN)
{
if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0)
trainerPicId = gUnknown_0831F578[0x4F];
trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_10];
else
trainerPicId = gUnknown_0831F578[0x4E];
trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_9];
}
else if ((gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_RUBY
|| (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_SAPPHIRE)
{
if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0)
trainerPicId = gUnknown_0831F578[0x51];
trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_12];
else
trainerPicId = gUnknown_0831F578[0x50];
trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_11];
}
else
{

View File

@@ -19,7 +19,7 @@ extern const union AffineAnimCmd *const gUnknown_082FF694[];
extern const union AnimCmd *const gUnknown_082FF70C[];
extern const union AnimCmd *const *const gMonAnimationsSpriteAnimsPtrTable[NUM_SPECIES];
extern const union AnimCmd *const *const gUnknown_0830536C[];
extern const u8 gUnknown_0831F578[];
extern const u8 gFacilityClassToPicIndex[];
// Static type declarations
@@ -421,9 +421,9 @@ u8 sub_818D97C(u8 a0, u8 a1)
switch (a0)
{
default:
return gUnknown_0831F578[0x3F];
return gFacilityClassToPicIndex[0x3F];
case 0:
return gUnknown_0831F578[0x3C];
return gFacilityClassToPicIndex[0x3C];
}
}
return a0;

View File

@@ -2561,17 +2561,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

@@ -2425,7 +2425,7 @@ void BattleHandleAddTextPrinter(const u8 *text, u8 arg1)
textSubPrinter.letterSpacing = r8[(12 * arg1) + 4];
textSubPrinter.lineSpacing = r8[(12 * arg1) + 5];
textSubPrinter.fontColor_l = 0;
textSubPrinter.fontColor_h = r8[(12 * arg1) + 7];
textSubPrinter.fgColor = r8[(12 * arg1) + 7];
textSubPrinter.bgColor = r8[(12 * arg1) + 8];
textSubPrinter.shadowColor = r8[(12 * arg1) + 9];

View File

@@ -891,11 +891,11 @@ static const u16 sRarePickupItems[] =
ITEM_FULL_RESTORE,
ITEM_ETHER,
ITEM_WHITE_HERB,
ITEM_TM44,
ITEM_TM44_REST,
ITEM_ELIXIR,
ITEM_TM01,
ITEM_TM01_FOCUS_PUNCH,
ITEM_LEFTOVERS,
ITEM_TM26,
ITEM_TM26_EARTHQUAKE,
};
static const u8 sPickupProbabilities[] =
@@ -6667,7 +6667,7 @@ static void PutLevelAndGenderOnLvlUpBox(void)
subPrinter.letterSpacing = 0;
subPrinter.lineSpacing = 0;
subPrinter.fontColor_l = TEXT_COLOR_TRANSPARENT;
subPrinter.fontColor_h = TEXT_COLOR_WHITE;
subPrinter.fgColor = TEXT_COLOR_WHITE;
subPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
subPrinter.shadowColor = TEXT_COLOR_DARK_GREY;

View File

@@ -18,7 +18,6 @@
#include "event_data.h"
#include "main.h"
#include "link.h"
#include "new_menu_helpers.h"
#include "item_menu_icons.h"
#include "berry.h"
#include "item.h"
@@ -3489,7 +3488,7 @@ void ShowBerryBlenderRecordWindow(void)
winTemplate = sBlenderRecordWindowTemplate;
gResultsWindowId = AddWindow(&winTemplate);
sub_81973FC(gResultsWindowId, 0);
NewMenuHelpers_DrawStdWindowFrame(gResultsWindowId, 0);
FillWindowPixelBuffer(gResultsWindowId, 0x11);
xPos = GetStringCenterAlignXOffset(1, gText_BlenderMaxSpeedRecord, 0x90);
@@ -3574,35 +3573,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

@@ -133,7 +133,7 @@ extern const u8 gMultiBootProgram_BerryGlitchFix_End[];
// .text
void InitBerryFixProgram(void)
void CB2_InitBerryFixProgram(void)
{
DisableInterrupts(0xFFFF);
EnableInterrupts(0x0001);

View File

@@ -93,7 +93,7 @@ static const struct BgTemplate sBackgroundTemplates[] =
static const u16 sFontPalette[] = INCBIN_U16("graphics/interface/berry_tag_screen.gbapal");
static const struct TextColor sTextColors[] =
static const u8 sTextColors[2][3] =
{
{0, 2, 3},
{15, 14, 13}
@@ -343,7 +343,7 @@ static void HandleInitWindows(void)
static void PrintTextInBerryTagScreen(u8 windowId, const u8 *text, u8 x, u8 y, s32 speed, u8 colorStructId)
{
AddTextPrinterParameterized2(windowId, 1, x, y, 0, 0, &sTextColors[colorStructId], speed, text);
AddTextPrinterParameterized2(windowId, 1, x, y, 0, 0, sTextColors[colorStructId], speed, text);
}
static void AddBerryTagTextToBg0(void)

View File

@@ -4,7 +4,6 @@
#include "window.h"
#include "strings.h"
#include "string_util.h"
#include "new_menu_helpers.h"
#include "menu.h"
#include "international_string_util.h"

View File

@@ -43,7 +43,7 @@ extern u16 ItemIdToBattleMoveId(u16);
extern s32 ListMenuHandleInputGetItemId(u8);
extern void sub_81AE6C8(u8, u16*, u16*);
extern void sub_819746C(u8, bool8);
extern void sub_81973FC(u8, bool8);
extern void NewMenuHelpers_DrawStdWindowFrame(u8, bool8);
extern void sub_81B9328(void);
extern void sub_81AF078(u32, bool8, struct ListMenu *);
extern void c2_exit_to_overworld_2_switch(void);
@@ -413,7 +413,7 @@ static u16 GetEggSpecies(u16 species)
{
for (k = 0; k < EVOS_PER_MON; k++)
{
if (gEvolutionTable[j].evolutions[k].targetSpecies == species)
if (gEvolutionTable[j][k].targetSpecies == species)
{
species = j;
found = TRUE;
@@ -694,7 +694,7 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru
{
for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++)
{
if (sHatchedEggFatherMoves[i] == ItemIdToBattleMoveId(ITEM_TM01 + j) && CanMonLearnTMHM(egg, j))
if (sHatchedEggFatherMoves[i] == ItemIdToBattleMoveId(ITEM_TM01_FOCUS_PUNCH + j) && CanMonLearnTMHM(egg, j))
{
if (GiveMoveToMon(egg, sHatchedEggFatherMoves[i]) == 0xffff)
DeleteFirstMoveAndGiveMoveToMon(egg, sHatchedEggFatherMoves[i]);
@@ -1212,7 +1212,7 @@ static void DaycareAddTextPrinter(u8 windowId, const u8 *text, u32 x, u32 y)
gTextFlags.flag_1 = 0;
printer.letterSpacing = 0;
printer.lineSpacing = 1;
printer.fontColor_h = 2;
printer.fgColor = 2;
printer.bgColor = 1;
printer.shadowColor = 3;
@@ -1296,7 +1296,7 @@ void ShowDaycareLevelMenu(void)
u8 daycareMenuTaskId;
windowId = AddWindow(&sDaycareLevelMenuWindowTemplate);
sub_81973FC(windowId, FALSE);
NewMenuHelpers_DrawStdWindowFrame(windowId, FALSE);
menuTemplate = sDaycareListMenuLevelTemplate;
menuTemplate.unk_10 = windowId;

View File

@@ -20,7 +20,7 @@
#include "field_map_obj.h"
#include "list_menu.h"
#include "menu_helpers.h"
#include "new_menu_helpers.h"
#include "menu.h"
#include "menu_indicators.h"
#include "sound.h"
#include "event_scripts.h"
@@ -727,7 +727,7 @@ void sub_81271CC(u8 taskId)
{
sub_8126A58(1);
sub_8126A88();
sub_81973C4(0, 0);
NewMenuHelpers_DrawDialogueFrame(0, 0);
sub_8126C08();
gTasks[taskId].func = sub_8126B80;
}
@@ -2712,7 +2712,7 @@ void sub_812A334(void)
u8 taskId;
pal_fill_black();
sub_81973C4(0, 1);
NewMenuHelpers_DrawDialogueFrame(0, 1);
sub_8126ABC();
taskId = CreateTask(sub_812A2C4, 8);
gTasks[taskId].data[2] = 0;

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

@@ -204,7 +204,7 @@ s16 RequestDma3Fill(s32 value, void *dest, u16 size, u8 mode)
return -1; // no free DMA request was found
}
int CheckForSpaceForDma3Request(s16 index)
s16 CheckForSpaceForDma3Request(s16 index)
{
int i = 0;

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

@@ -573,16 +573,16 @@ static void CB2_TradeEvolutionSceneUpdate(void)
static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon)
{
u32 data = 0;
if (gEvolutionTable[preEvoSpecies].evolutions[0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < 6)
if (gEvolutionTable[preEvoSpecies][0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < 6)
{
s32 i;
struct Pokemon* Shedinja = &gPlayerParty[gPlayerPartyCount];
const struct EvolutionData* evoTable;
const struct EvolutionData* evos;
struct Pokemon* shedinja = &gPlayerParty[gPlayerPartyCount];
const struct Evolution *evos;
const struct Evolution *evos2;
CopyMon(&gPlayerParty[gPlayerPartyCount], mon, sizeof(struct Pokemon));
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, (&gEvolutionTable[preEvoSpecies].evolutions[1].targetSpecies));
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_NICKNAME, (gSpeciesNames[gEvolutionTable[preEvoSpecies].evolutions[1].targetSpecies]));
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, (&gEvolutionTable[preEvoSpecies][1].targetSpecies));
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_NICKNAME, (gSpeciesNames[gEvolutionTable[preEvoSpecies][1].targetSpecies]));
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_HELD_ITEM, (&data));
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, (&data));
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_10, (&data));
@@ -600,15 +600,16 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon)
CalculatePlayerPartyCount();
// can't match it otherwise, ehh
evoTable = gEvolutionTable;
evos = evoTable + preEvoSpecies;
GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos->evolutions[1].targetSpecies), FLAG_SET_SEEN);
GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos->evolutions[1].targetSpecies), FLAG_SET_CAUGHT);
evos2 = gEvolutionTable[0];
evos = evos2 + EVOS_PER_MON * preEvoSpecies;
if (GetMonData(Shedinja, MON_DATA_SPECIES) == SPECIES_SHEDINJA
&& GetMonData(Shedinja, MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE
GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos[1].targetSpecies), FLAG_SET_SEEN);
GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos[1].targetSpecies), FLAG_SET_CAUGHT);
if (GetMonData(shedinja, MON_DATA_SPECIES) == SPECIES_SHEDINJA
&& GetMonData(shedinja, MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE
&& GetMonData(mon, MON_DATA_SPECIES) == SPECIES_NINJASK)
SetMonData(Shedinja, MON_DATA_NICKNAME, Text_ShedinjaJapaneseName);
SetMonData(shedinja, MON_DATA_NICKNAME, Text_ShedinjaJapaneseName);
}
}

View File

@@ -1,9 +1,10 @@
#include "global.h"
#include "new_menu_helpers.h"
#include "menu.h"
#include "string.h"
#include "string_util.h"
#include "task.h"
#include "text.h"
#include "battle_frontier_1.h"
EWRAM_DATA u8 gUnknown_020375BC = 0;
@@ -30,7 +31,7 @@ void sub_8098154(u8 taskId)
task->data[0]++;
break;
case 1:
sub_81973C4(0, 1);
NewMenuHelpers_DrawDialogueFrame(0, 1);
task->data[0]++;
break;
case 2:
@@ -143,7 +144,7 @@ bool8 IsFieldMessageBoxHidden(void)
void sub_8098358(void)
{
task_del_textbox();
sub_81973FC(0, 1);
NewMenuHelpers_DrawStdWindowFrame(0, 1);
gUnknown_020375BC = 0;
}

View File

@@ -25,7 +25,7 @@
#include "random.h"
#include "event_data.h"
#include "overworld.h"
#include "new_menu_helpers.h"
#include "menu.h"
struct HallofFameMon
{
@@ -81,7 +81,7 @@ extern const u8 gText_MainMenuTime[];
extern const u8 gContestConfetti_Gfx[];
extern const u8 gContestConfetti_Pal[];
extern void sub_81973C4(u8, u8);
extern void NewMenuHelpers_DrawDialogueFrame(u8, u8);
extern void sub_8175620(void);
extern u8 TrySavingData(u8);
extern u8 sub_818D3E4(u16 species, u32 trainerId, u32 personality, u8 flags, s16 x, s16 y, u8, u16);
@@ -538,7 +538,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId)
}
*lastSavedTeam = *sHofMonPtr;
sub_81973C4(0, 0);
NewMenuHelpers_DrawDialogueFrame(0, 0);
AddTextPrinterParameterized(0, 1, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, 3);
gTasks[taskId].func = Task_Hof_TrySaveData;
@@ -745,7 +745,7 @@ static void Task_Hof_WaitAndPrintPlayerInfo(u8 taskId)
{
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20);
HallOfFame_PrintPlayerInfo(1, 2);
sub_81973C4(0, 0);
NewMenuHelpers_DrawDialogueFrame(0, 0);
AddTextPrinterParameterized(0, 1, gText_LeagueChamp, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, 3);
gTasks[taskId].func = Task_Hof_ExitOnKeyPressed;
@@ -1114,7 +1114,7 @@ static void Task_HofPC_HandleExit(u8 taskId)
static void Task_HofPC_PrintDataIsCorrupted(u8 taskId)
{
sub_8198180(gText_UnkCtrlF800Exit, 8, 1);
sub_81973C4(0, 0);
NewMenuHelpers_DrawDialogueFrame(0, 0);
AddTextPrinterParameterized(0, 1, gText_HOFCorrupted, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, 3);
gTasks[taskId].func = Task_HofPC_ExitOnButtonPress;

View File

@@ -780,7 +780,7 @@ void ItemUseOutOfBattle_RareCandy(u8 taskId)
void ItemUseOutOfBattle_TMHM(u8 taskId)
{
if (gSpecialVar_ItemId >= ITEM_HM01)
if (gSpecialVar_ItemId >= ITEM_HM01_CUT)
DisplayItemMessage(taskId, 1, gText_BootedUpHM, sub_80FDF90); // HM
else
DisplayItemMessage(taskId, 1, gText_BootedUpTM, sub_80FDF90); // TM

2414
src/menu.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,6 @@
#include "window.h"
#include "gpu_regs.h"
#include "text_window.h"
#include "new_menu_helpers.h"
#include "decompress.h"
// this file's functions
@@ -291,13 +290,13 @@ static void CB2_MysteryEventMenu(void)
static void PrintMysteryMenuText(u8 windowId, const u8 *text, u8 x, u8 y, s32 speed)
{
struct TextColor textColor;
u8 textColor[3];
u8 letterSpacing = 0;
u8 lineSpacing = 1;
textColor.fgColor = 1;
textColor.bgColor = 2;
textColor.shadowColor = 3;
textColor[0] = 1;
textColor[1] = 2;
textColor[2] = 3;
FillWindowPixelBuffer(windowId, (textColor.fgColor) | (textColor.fgColor << 4));
AddTextPrinterParameterized2(windowId, 1, x, y, letterSpacing, lineSpacing, &textColor, speed, text);
FillWindowPixelBuffer(windowId, (textColor[0]) | (textColor[0] << 4));
AddTextPrinterParameterized2(windowId, 1, x, y, letterSpacing, lineSpacing, textColor, speed, text);
}

View File

@@ -5,7 +5,6 @@
#include "task.h"
#include "sprite.h"
#include "string_util.h"
#include "new_menu_helpers.h"
#include "window.h"
#include "bg.h"
#include "gpu_regs.h"
@@ -530,7 +529,7 @@ static void DisplaySentToPCMessage(void)
stringToDisplay++;
StringExpandPlaceholders(gStringVar4, gUnknown_0858BDB8[stringToDisplay]);
sub_81973C4(0, 0);
NewMenuHelpers_DrawDialogueFrame(0, 0);
gTextFlags.flag_0 = TRUE;
AddTextPrinterParameterized(0, 1, gStringVar4, GetPlayerTextSpeed(), 0, 2, 1, 3);
CopyWindowToVram(0, 3);
@@ -1496,7 +1495,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 +1515,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 +1660,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 +1679,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 +1736,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

@@ -6,7 +6,6 @@
#include "menu.h"
#include "task.h"
#include "menu_helpers.h"
#include "new_menu_helpers.h"
#include "pokemon.h"
#include "graphics.h"
#include "malloc.h"
@@ -284,7 +283,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 +582,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

@@ -16,7 +16,6 @@
#include "event_data.h"
#include "strings.h"
#include "string_util.h"
#include "new_menu_helpers.h"
#include "party_menu.h"
#include "m4a.h"
#include "sound.h"

View File

@@ -2,7 +2,11 @@
#include "pokemon.h"
#include "random.h"
#include "main.h"
#include "constants/species.h"
#include "constants/abilities.h"
#include "constants/items.h"
#include "constants/trainers.h"
#include "constants/moves.h"
#include "string_util.h"
#include "text.h"
@@ -14,6 +18,68 @@
extern u8 sav1_map_get_name(void);
// EWRAM vars
EWRAM_DATA u8 sLearningMoveTableID = 0;
EWRAM_DATA u8 gPlayerPartyCount = 0;
EWRAM_DATA u8 gEnemyPartyCount = 0;
EWRAM_DATA struct Pokemon gPlayerParty[PARTY_SIZE] = {0};
EWRAM_DATA struct Pokemon gEnemyParty[PARTY_SIZE] = {0};
// const rom data
const u16 gSpeciesToHoennPokedexNum[] = {203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 156, 157, 112, 113, 227, 228, 229, 230, 231, 232, 233, 234, 153, 154, 138, 139, 63, 64, 88, 89, 90, 235, 236, 237, 238, 239, 240, 241, 242, 158, 159, 243, 244, 245, 246, 247, 248, 249, 39, 40, 41, 73, 74, 75, 250, 251, 252, 66, 67, 57, 58, 59, 253, 254, 255, 256, 82, 83, 257, 92, 93, 258, 259, 106, 107, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 84, 85, 270, 271, 272, 273, 274, 275, 276, 108, 109, 169, 170, 277, 278, 279, 184, 185, 50, 51, 143, 144, 280, 281, 282, 283, 284, 167, 285, 52, 53, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 65, 181, 182, 155, 324, 137, 325, 326, 162, 163, 327, 328, 329, 91, 55, 56, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 161, 164, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 168, 357, 358, 359, 103, 104, 360, 361, 180, 362, 363, 364, 365, 115, 366, 367, 186, 165, 166, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 42, 43, 44, 25, 26, 34, 35, 114, 27, 28, 32, 33, 99, 100, 61, 62, 145, 131, 132, 60, 105, 68, 127, 128, 183, 129, 130, 140, 141, 97, 98, 116, 117, 118, 48, 49, 78, 79, 101, 102, 173, 174, 175, 119, 120, 171, 172, 125, 126, 54, 110, 111, 80, 81, 69, 76, 77, 121, 122, 160, 148, 149, 94, 36, 37, 38, 95, 96, 150, 45, 46, 47, 176, 177, 178, 152, 146, 147, 124, 123, 179, 70, 71, 72, 142, 86, 87, 133, 134, 135, 136, 29, 30, 31, 187, 188, 189, 190, 191, 192, 193, 194, 195, 198, 199, 200, 196, 197, 201, 202, 151};
const u16 gSpeciesToNationalPokedexNum[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 290, 291, 292, 276, 277, 285, 286, 327, 278, 279, 283, 284, 320, 321, 300, 301, 352, 343, 344, 299, 324, 302, 339, 340, 370, 341, 342, 349, 350, 318, 319, 328, 329, 330, 296, 297, 309, 310, 322, 323, 363, 364, 365, 331, 332, 361, 362, 337, 338, 298, 325, 326, 311, 312, 303, 307, 308, 333, 334, 360, 355, 356, 315, 287, 288, 289, 316, 317, 357, 293, 294, 295, 366, 367, 368, 359, 353, 354, 336, 335, 369, 304, 305, 306, 351, 313, 314, 345, 346, 347, 348, 280, 281, 282, 371, 372, 373, 374, 375, 376, 377, 378, 379, 382, 383, 384, 380, 381, 385, 386, 358};
const u16 gHoennToNationalOrder[] = {252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 63, 64, 65, 290, 291, 292, 293, 294, 295, 296, 297, 118, 119, 129, 130, 298, 183, 184, 74, 75, 76, 299, 300, 301, 41, 42, 169, 72, 73, 302, 303, 304, 305, 306, 66, 67, 68, 307, 308, 309, 310, 311, 312, 81, 82, 100, 101, 313, 314, 43, 44, 45, 182, 84, 85, 315, 316, 317, 318, 319, 320, 321, 322, 323, 218, 219, 324, 88, 89, 109, 110, 325, 326, 27, 28, 327, 227, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 174, 39, 40, 349, 350, 351, 120, 121, 352, 353, 354, 355, 356, 357, 358, 359, 37, 38, 172, 25, 26, 54, 55, 360, 202, 177, 178, 203, 231, 232, 127, 214, 111, 112, 361, 362, 363, 364, 365, 366, 367, 368, 369, 222, 170, 171, 370, 116, 117, 230, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 29, 30, 31, 32, 33, 34, 35, 36, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 77, 78, 79, 80, 83, 86, 87, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 102, 103, 104, 105, 106, 107, 108, 113, 114, 115, 122, 123, 124, 125, 126, 128, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 173, 175, 176, 179, 180, 181, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 215, 216, 217, 220, 221, 223, 224, 225, 226, 228, 229, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411};
const struct SpindaSpot gSpindaSpotGraphics[] =
{
{16, 7, INCBIN_U16("graphics/spinda_spots/spot_0.bin")},
{40, 8, INCBIN_U16("graphics/spinda_spots/spot_1.bin")},
{22, 25, INCBIN_U16("graphics/spinda_spots/spot_2.bin")},
{34, 26, INCBIN_U16("graphics/spinda_spots/spot_3.bin")}
};
#include "data/pokemon/item_effects.h"
const s8 gNatureStatTable[][5] =
{
// Atk Def Spd Sp.Atk Sp.Def
{ 0, 0, 0, 0, 0}, // Hardy
{ +1, -1, 0, 0, 0}, // Lonely
{ +1, 0, -1, 0, 0}, // Brave
{ +1, 0, 0, -1, 0}, // Adamant
{ +1, 0, 0, 0, -1}, // Naughty
{ -1, +1, 0, 0, 0}, // Bold
{ 0, 0, 0, 0, 0}, // Docile
{ 0, +1, -1, 0, 0}, // Relaxed
{ 0, +1, 0, -1, 0}, // Impish
{ 0, +1, 0, 0, -1}, // Lax
{ -1, 0, +1, 0, 0}, // Timid
{ 0, -1, +1, 0, 0}, // Hasty
{ 0, 0, 0, 0, 0}, // Serious
{ 0, 0, +1, -1, 0}, // Jolly
{ 0, 0, +1, 0, -1}, // Naive
{ -1, 0, 0, +1, 0}, // Modest
{ 0, -1, 0, +1, 0}, // Mild
{ 0, 0, -1, +1, 0}, // Quiet
{ 0, 0, 0, 0, 0}, // Bashful
{ 0, 0, 0, +1, -1}, // Rash
{ -1, 0, 0, 0, +1}, // Calm
{ 0, -1, 0, 0, +1}, // Gentle
{ 0, 0, -1, 0, +1}, // Sassy
{ 0, 0, 0, -1, +1}, // Careful
{ 0, 0, 0, 0, 0}, // Quirky
};
#include "data/pokemon/tmhm_learnsets.h"
#include "data/pokemon/trainer_class_lookups.h"
#include "data/pokemon/cry_ids.h"
#include "data/pokemon/experience_tables.h"
#include "data/pokemon/base_stats.h"
#include "data/pokemon/level_up_learnsets.h"
#include "data/pokemon/evolution.h"
#include "data/pokemon/level_up_learnset_pointers.h"
// code
void ZeroBoxMonData(struct BoxPokemon *boxMon)
{
u8 *raw = (u8 *)boxMon;
@@ -43,14 +109,14 @@ void ZeroMonData(struct Pokemon *mon)
void ZeroPlayerPartyMons(void)
{
s32 i;
for (i = 0; i < 6; i++)
for (i = 0; i < PARTY_SIZE; i++)
ZeroMonData(&gPlayerParty[i]);
}
void ZeroEnemyPartyMons(void)
{
s32 i;
for (i = 0; i < 6; i++)
for (i = 0; i < PARTY_SIZE; i++)
ZeroMonData(&gEnemyParty[i]);
}

View File

@@ -332,7 +332,7 @@ u32 GetMonData(struct Pokemon *mon, s32 field, u8* data)
ret = mon->defense;
break;
case MON_DATA_SPEED:
ret = GetDeoxysStat(mon, STAT_SPD);
ret = GetDeoxysStat(mon, STAT_SPEED);
if (!ret)
ret = mon->speed;
break;
@@ -1222,20 +1222,20 @@ void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord)
}
}
extern const u8 gUnknown_0831F578[];
extern const u8 gTrainerClassToNameIndex[];
extern const u8 gFacilityClassToPicIndex[];
extern const u8 gFacilityClassToTrainerClass[];
extern const u8 gSecretBaseTrainerClasses[][5];
u8 GetSecretBaseTrainerPicIndex(void)
{
u8 trainerClass = gSecretBaseTrainerClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % 5];
return gUnknown_0831F578[trainerClass];
return gFacilityClassToPicIndex[trainerClass];
}
u8 GetSecretBaseTrainerNameIndex(void)
{
u8 trainerClass = gSecretBaseTrainerClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % 5];
return gTrainerClassToNameIndex[trainerClass];
return gFacilityClassToTrainerClass[trainerClass];
}
bool8 IsPlayerPartyAndPokemonStorageFull(void)

View File

@@ -301,56 +301,56 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
for (i = 0; i < 5; i++)
{
switch (gEvolutionTable[species].evolutions[i].method)
switch (gEvolutionTable[species][i].method)
{
case EVO_FRIENDSHIP:
if (friendship >= 220)
targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies;
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_FRIENDSHIP_DAY:
RtcCalcLocalTime();
if (gLocalTime.hours >= 12 && gLocalTime.hours < 24 && friendship >= 220)
targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies;
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_FRIENDSHIP_NIGHT:
RtcCalcLocalTime();
if (gLocalTime.hours >= 0 && gLocalTime.hours < 12 && friendship >= 220)
targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies;
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_LEVEL:
if (gEvolutionTable[species].evolutions[i].param <= level)
targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies;
if (gEvolutionTable[species][i].param <= level)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_LEVEL_ATK_GT_DEF:
if (gEvolutionTable[species].evolutions[i].param <= level)
if (gEvolutionTable[species][i].param <= level)
if (GetMonData(mon, MON_DATA_ATK, 0) > GetMonData(mon, MON_DATA_DEF, 0))
targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies;
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_LEVEL_ATK_EQ_DEF:
if (gEvolutionTable[species].evolutions[i].param <= level)
if (gEvolutionTable[species][i].param <= level)
if (GetMonData(mon, MON_DATA_ATK, 0) == GetMonData(mon, MON_DATA_DEF, 0))
targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies;
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_LEVEL_ATK_LT_DEF:
if (gEvolutionTable[species].evolutions[i].param <= level)
if (gEvolutionTable[species][i].param <= level)
if (GetMonData(mon, MON_DATA_ATK, 0) < GetMonData(mon, MON_DATA_DEF, 0))
targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies;
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_LEVEL_SILCOON:
if (gEvolutionTable[species].evolutions[i].param <= level && (upperPersonality % 10) <= 4)
targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies;
if (gEvolutionTable[species][i].param <= level && (upperPersonality % 10) <= 4)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_LEVEL_CASCOON:
if (gEvolutionTable[species].evolutions[i].param <= level && (upperPersonality % 10) > 4)
targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies;
if (gEvolutionTable[species][i].param <= level && (upperPersonality % 10) > 4)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_LEVEL_NINJASK:
if (gEvolutionTable[species].evolutions[i].param <= level)
targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies;
if (gEvolutionTable[species][i].param <= level)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_BEAUTY:
if (gEvolutionTable[species].evolutions[i].param <= beauty)
targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies;
if (gEvolutionTable[species][i].param <= beauty)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
}
}
@@ -358,17 +358,17 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
case 1:
for (i = 0; i < 5; i++)
{
switch (gEvolutionTable[species].evolutions[i].method)
switch (gEvolutionTable[species][i].method)
{
case EVO_TRADE:
targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies;
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_TRADE_ITEM:
if (gEvolutionTable[species].evolutions[i].param == heldItem)
if (gEvolutionTable[species][i].param == heldItem)
{
heldItem = 0;
SetMonData(mon, MON_DATA_HELD_ITEM, (u8 *)&heldItem);
targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies;
targetSpecies = gEvolutionTable[species][i].targetSpecies;
}
break;
}
@@ -378,10 +378,10 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
case 3:
for (i = 0; i < 5; i++)
{
if (gEvolutionTable[species].evolutions[i].method == EVO_ITEM
&& gEvolutionTable[species].evolutions[i].param == evolutionItem)
if (gEvolutionTable[species][i].method == EVO_ITEM
&& gEvolutionTable[species][i].param == evolutionItem)
{
targetSpecies = gEvolutionTable[species].evolutions[i].targetSpecies;
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
}
}
@@ -1652,11 +1652,11 @@ u8 sub_806EF84(u8 arg0, u8 arg1)
return i;
}
extern const u8 gUnknown_0831F578[];
extern const u8 gFacilityClassToPicIndex[];
u16 sub_806EFF0(u16 arg0)
{
return gUnknown_0831F578[arg0];
return gFacilityClassToPicIndex[arg0];
}
u16 PlayerGenderToFrontTrainerPicId(u8 playerGender)

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

@@ -52,7 +52,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[];
@@ -160,7 +160,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();
@@ -2555,7 +2555,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

@@ -17,7 +17,6 @@
#include "bg.h"
#include "window.h"
#include "gpu_regs.h"
#include "new_menu_helpers.h"
struct ResetRtcStruct
{

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

@@ -29,7 +29,6 @@
#include "menu.h"
#include "money.h"
#include "mystery_event_script.h"
#include "new_menu_helpers.h"
#include "palette.h"
#include "party_menu.h"
#include "pokemon_3.h"
@@ -1306,7 +1305,7 @@ bool8 ScrCmd_cmdDB(struct ScriptContext *ctx)
if (msg == NULL)
msg = (const u8 *)ctx->data[0];
sub_81973A4();
sub_81973C4(0, 1);
NewMenuHelpers_DrawDialogueFrame(0, 1);
PrintTextOnWindow(0, 1, msg, 0, 1, 0, 0);
return FALSE;
}
@@ -1523,7 +1522,7 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx)
template2 = template1;
gUnknown_03000F30 = AddWindow(&template2);
sub_809882C(gUnknown_03000F30, 0x214, 0xE0);
sub_81973FC(gUnknown_03000F30, 0);
NewMenuHelpers_DrawStdWindowFrame(gUnknown_03000F30, 0);
PutWindowTilemap(gUnknown_03000F30);
FillWindowPixelBuffer(gUnknown_03000F30, 0x11);
PrintTextOnWindow(gUnknown_03000F30, 6, gStringVar4, temp1, temp2, 0xFF, 0x0);
@@ -1644,7 +1643,7 @@ _0809AEC6:\n\
bl sub_809882C\n\
ldrb r0, [r5]\n\
mov r1, #0\n\
bl sub_81973FC\n\
bl NewMenuHelpers_DrawStdWindowFrame\n\
ldrb r0, [r5]\n\
bl PutWindowTilemap\n\
ldrb r0, [r5]\n\

View File

@@ -9,7 +9,6 @@
#include "window.h"
#include "menu.h"
#include "menu_helpers.h"
#include "new_menu_helpers.h"
#include "menu_indicators.h"
#include "constants/maps.h"
#include "constants/songs.h"
@@ -33,6 +32,7 @@
#include "international_string_util.h"
#include "event_data.h"
#include "battle.h"
#include "battle_setup.h"
#include "rom6.h"
#include "decoration.h"
#include "link.h"

View File

@@ -32,7 +32,7 @@ extern bool32 InUnionRoom(void);
extern bool8 InBattlePike(void);
extern bool8 InBattlePyramid(void);
extern bool8 InMultiBattleRoom(void);
extern void sub_81973FC(u8 windowId, u8 a1);
extern void NewMenuHelpers_DrawStdWindowFrame(u8 windowId, u8 a1);
extern void sub_8198070(u8 windowId, u8 a1);
// this file's functions
@@ -236,7 +236,7 @@ void DisplaySafariBallsWindow(void)
{
sSafariBallsWindowId = AddWindow(&gSafariBallsWindowTemplate);
PutWindowTilemap(sSafariBallsWindowId);
sub_81973FC(sSafariBallsWindowId, 0);
NewMenuHelpers_DrawStdWindowFrame(sSafariBallsWindowId, 0);
ConvertIntToDecimalStringN(gStringVar1, gNumSafariBalls, STR_CONV_MODE_RIGHT_ALIGN, 2);
StringExpandPlaceholders(gStringVar4, gText_SafariBallStock);
PrintTextOnWindow(sSafariBallsWindowId, 1, gStringVar4, 0, 1, 0xFF, NULL);
@@ -251,7 +251,7 @@ void DisplayPyramidFloorWindow(void)
else
sBattlePyramidFloorWindowId = AddWindow(&gPyramidFloorWindowTemplate_2);
PutWindowTilemap(sBattlePyramidFloorWindowId);
sub_81973FC(sBattlePyramidFloorWindowId, 0);
NewMenuHelpers_DrawStdWindowFrame(sBattlePyramidFloorWindowId, 0);
StringCopy(gStringVar1, sPyramindFloorNames[gSaveBlock2Ptr->field_CAA[4]]);
StringExpandPlaceholders(gStringVar4, gText_BattlePyramidFloor);
PrintTextOnWindow(sBattlePyramidFloorWindowId, 1, gStringVar4, 0, 1, 0xFF, NULL);

View File

@@ -164,7 +164,7 @@ u16 PrintTextOnWindow(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 spee
subPrinter.letterSpacing = gFonts[fontId].letterSpacing;
subPrinter.lineSpacing = gFonts[fontId].lineSpacing;
subPrinter.fontColor_l = gFonts[fontId].fontColor_l;
subPrinter.fontColor_h = gFonts[fontId].fontColor_h;
subPrinter.fgColor = gFonts[fontId].fgColor;
subPrinter.bgColor = gFonts[fontId].bgColor;
subPrinter.shadowColor = gFonts[fontId].shadowColor;
return AddTextPrinter(&subPrinter, speed, callback);
@@ -194,7 +194,7 @@ bool16 AddTextPrinter(struct TextSubPrinter *textSubPrinter, u8 speed, void (*ca
gTempTextPrinter.minLetterSpacing = 0;
gTempTextPrinter.japanese = 0;
GenerateFontHalfRowLookupTable(textSubPrinter->fontColor_h, textSubPrinter->bgColor, textSubPrinter->shadowColor);
GenerateFontHalfRowLookupTable(textSubPrinter->fgColor, textSubPrinter->bgColor, textSubPrinter->shadowColor);
if (speed != TEXT_SPEED_FF && speed != 0x0)
{
--gTempTextPrinter.text_speed;
@@ -3518,7 +3518,7 @@ u8 GetFontAttribute(u8 fontId, u8 attributeId)
result = gFontInfos[fontId].fontColor_l;
break;
case 5:
result = gFontInfos[fontId].fontColor_h;
result = gFontInfos[fontId].fgColor;
break;
case 6:
result = gFontInfos[fontId].bgColor;

783
src/title_screen.c Normal file
View File

@@ -0,0 +1,783 @@
#include "global.h"
#include "title_screen.h"
#include "sprite.h"
#include "gba/m4a_internal.h"
#include "clear_save_data_menu.h"
#include "decompress.h"
#include "event_data.h"
#include "intro.h"
#include "m4a.h"
#include "main.h"
#include "main_menu.h"
#include "palette.h"
#include "reset_rtc_screen.h"
#include "berry_fix_program.h"
#include "sound.h"
#include "sprite.h"
#include "task.h"
#include "scanline_effect.h"
#include "gpu_regs.h"
#include "trig.h"
#include "constants/rgb.h"
#define VERSION_BANNER_SHAPE 1
#define VERSION_BANNER_RIGHT_TILEOFFSET 64
#define VERSION_BANNER_BYTES 0x1000
#define VERSION_BANNER_LEFT_X 98
#define VERSION_BANNER_RIGHT_X 162
#define VERSION_BANNER_Y 2
#define VERSION_BANNER_Y_GOAL 66
#define START_BANNER_X 128
#define CLEAR_SAVE_BUTTON_COMBO (B_BUTTON | SELECT_BUTTON | DPAD_UP)
#define RESET_RTC_BUTTON_COMBO (B_BUTTON | SELECT_BUTTON | DPAD_LEFT)
#define BERRY_UPDATE_BUTTON_COMBO (B_BUTTON | SELECT_BUTTON)
#define A_B_START_SELECT (A_BUTTON | B_BUTTON | START_BUTTON | SELECT_BUTTON)
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern u16 gBattle_BG1_X;
extern u16 gBattle_BG1_Y;
extern const u8 gTitleScreenEmeraldVersionGfx[];
extern const u8 gTitleScreenPressStartGfx[];
extern const u8 gTitleScreenPokemonLogoGfx[];
extern const u8 gUnknown_08DE0644[];
extern const u8 gUnknown_08DDE458[];
extern const u16 gTitleScreenBgPalettes[];
extern const u16 gTitleScreenPressStartPal[];
extern const u16 gTitleScreenEmeraldVersionPal[];
// this file's functions
static void MainCB2(void);
static void Task_TitleScreenPhase1(u8);
static void Task_TitleScreenPhase2(u8);
static void Task_TitleScreenPhase3(u8);
static void CB2_GoToMainMenu(void);
static void CB2_GoToClearSaveDataScreen(void);
static void CB2_GoToResetRtcScreen(void);
static void CB2_GoToBerryFixScreen(void);
static void CB2_GoToCopyrightScreen(void);
static void UpdateLegendaryMarkingColor(u8);
static void SpriteCB_VersionBannerLeft(struct Sprite *sprite);
static void SpriteCB_VersionBannerRight(struct Sprite *sprite);
static void SpriteCB_PressStartCopyrightBanner(struct Sprite *sprite);
static void SpriteCB_PokemonLogoShine(struct Sprite *sprite);
// const rom data
static const u16 sUnusedUnknownPal[] = INCBIN_U16("graphics/title_screen/unk_853EF78.gbapal");
static const u8 sTitleScreenRayquazaGfx[] = INCBIN_U8("graphics/title_screen/rayquaza.4bpp.lz");
static const u8 sTitleScreenRayquazaTilemap[] = INCBIN_U8("graphics/title_screen/rayquaza.bin.lz");
static const u8 sTitleScreenLogoShineGfx[] = INCBIN_U8("graphics/title_screen/logo_shine.4bpp.lz");
static const u8 sTitleScreenCloudsGfx[] = INCBIN_U8("graphics/title_screen/clouds.4bpp.lz");
const u16 gUnknown_0853FF70[] =
{
0x0010, 0x0110, 0x0210, 0x0310, 0x0410, 0x0510, 0x0610, 0x0710,
0x0810, 0x0910, 0x0a10, 0x0b10, 0x0c10, 0x0d10, 0x0e10, 0x0f10,
0x100f, 0x100e, 0x100d, 0x100c, 0x100b, 0x100a, 0x1009, 0x1008,
0x1007, 0x1006, 0x1005, 0x1004, 0x1003, 0x1002, 0x1001, 0x1000,
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
};
static const struct OamData sVersionBannerLeftOamData =
{
.y = 160,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 1,
.shape = VERSION_BANNER_SHAPE,
.x = 0,
.matrixNum = 0,
.size = 3,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const struct OamData sVersionBannerRightOamData =
{
.y = 160,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 1,
.shape = VERSION_BANNER_SHAPE,
.x = 0,
.matrixNum = 0,
.size = 3,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd sVersionBannerLeftAnimSequence[] =
{
ANIMCMD_FRAME(0, 30),
ANIMCMD_END,
};
static const union AnimCmd sVersionBannerRightAnimSequence[] =
{
ANIMCMD_FRAME(VERSION_BANNER_RIGHT_TILEOFFSET, 30),
ANIMCMD_END,
};
static const union AnimCmd *const sVersionBannerLeftAnimTable[] =
{
sVersionBannerLeftAnimSequence,
};
static const union AnimCmd *const sVersionBannerRightAnimTable[] =
{
sVersionBannerRightAnimSequence,
};
static const struct SpriteTemplate sVersionBannerLeftSpriteTemplate =
{
.tileTag = 1000,
.paletteTag = 1000,
.oam = &sVersionBannerLeftOamData,
.anims = sVersionBannerLeftAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_VersionBannerLeft,
};
static const struct SpriteTemplate sVersionBannerRightSpriteTemplate =
{
.tileTag = 1000,
.paletteTag = 1000,
.oam = &sVersionBannerRightOamData,
.anims = sVersionBannerRightAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_VersionBannerRight,
};
static const struct CompressedSpriteSheet sSpriteSheet_EmeraldVersion[] =
{
{gTitleScreenEmeraldVersionGfx, VERSION_BANNER_BYTES, 1000},
{NULL},
};
static const struct OamData sOamData_CopyrightBanner =
{
.y = 160,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 1,
.x = 0,
.matrixNum = 0,
.size = 1,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd sCopyrightBannerAnim0[] =
{
ANIMCMD_FRAME(1, 4),
ANIMCMD_END,
};
static const union AnimCmd sCopyrightBannerAnim1[] =
{
ANIMCMD_FRAME(5, 4),
ANIMCMD_END,
};
static const union AnimCmd sCopyrightBannerAnim2[] =
{
ANIMCMD_FRAME(9, 4),
ANIMCMD_END,
};
static const union AnimCmd sCopyrightBannerAnim3[] =
{
ANIMCMD_FRAME(13, 4),
ANIMCMD_END,
};
static const union AnimCmd sCopyrightBannerAnim4[] =
{
ANIMCMD_FRAME(17, 4),
ANIMCMD_END,
};
static const union AnimCmd sCopyrightBannerAnim5[] =
{
ANIMCMD_FRAME(21, 4),
ANIMCMD_END,
};
static const union AnimCmd sCopyrightBannerAnim6[] =
{
ANIMCMD_FRAME(25, 4),
ANIMCMD_END,
};
static const union AnimCmd sCopyrightBannerAnim7[] =
{
ANIMCMD_FRAME(29, 4),
ANIMCMD_END,
};
static const union AnimCmd sCopyrightBannerAnim8[] =
{
ANIMCMD_FRAME(33, 4),
ANIMCMD_END,
};
static const union AnimCmd sCopyrightBannerAnim9[] =
{
ANIMCMD_FRAME(37, 4),
ANIMCMD_END,
};
static const union AnimCmd *const sStartCopyrightBannerAnimTable[] =
{
sCopyrightBannerAnim0,
sCopyrightBannerAnim1,
sCopyrightBannerAnim2,
sCopyrightBannerAnim3,
sCopyrightBannerAnim4,
sCopyrightBannerAnim5,
sCopyrightBannerAnim6,
sCopyrightBannerAnim7,
sCopyrightBannerAnim8,
sCopyrightBannerAnim9,
};
static const struct SpriteTemplate sStartCopyrightBannerSpriteTemplate =
{
.tileTag = 1001,
.paletteTag = 1001,
.oam = &sOamData_CopyrightBanner,
.anims = sStartCopyrightBannerAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_PressStartCopyrightBanner,
};
static const struct CompressedSpriteSheet sSpriteSheet_PressStart[] =
{
{gTitleScreenPressStartGfx, 0x520, 1001},
{NULL},
};
static const struct SpritePalette sSpritePalette_PressStart[] =
{
{gTitleScreenPressStartPal, 1001},
{NULL},
};
static const struct OamData sPokemonLogoShineOamData =
{
.y = 160,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 3,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd sPokemonLogoShineAnimSequence[] =
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_END,
};
static const union AnimCmd *const sPokemonLogoShineAnimTable[] =
{
sPokemonLogoShineAnimSequence,
};
static const struct SpriteTemplate sPokemonLogoShineSpriteTemplate =
{
.tileTag = 1002,
.paletteTag = 1001,
.oam = &sPokemonLogoShineOamData,
.anims = sPokemonLogoShineAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_PokemonLogoShine,
};
static const struct CompressedSpriteSheet sPokemonLogoShineSpriteSheet[] =
{
{sTitleScreenLogoShineGfx, 0x800, 1002},
{NULL},
};
// code
static void SpriteCB_VersionBannerLeft(struct Sprite *sprite)
{
if (gTasks[sprite->data[1]].data[1] != 0)
{
sprite->oam.objMode = 0;
sprite->pos1.y = VERSION_BANNER_Y_GOAL;
}
else
{
if (sprite->pos1.y != VERSION_BANNER_Y_GOAL)
sprite->pos1.y++;
if (sprite->data[0] != 0)
sprite->data[0]--;
SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[sprite->data[0]]);
}
}
static void SpriteCB_VersionBannerRight(struct Sprite *sprite)
{
if (gTasks[sprite->data[1]].data[1] != 0)
{
sprite->oam.objMode = 0;
sprite->pos1.y = VERSION_BANNER_Y_GOAL;
}
else
{
if (sprite->pos1.y != VERSION_BANNER_Y_GOAL)
sprite->pos1.y++;
}
}
static void SpriteCB_PressStartCopyrightBanner(struct Sprite *sprite)
{
if (sprite->data[0] == 1)
{
sprite->data[1]++;
// Alternate between hidden and shown every 16th frame
if (sprite->data[1] & 0x10)
sprite->invisible = FALSE;
else
sprite->invisible = TRUE;
}
else
{
sprite->invisible = FALSE;
}
}
static void CreatePressStartBanner(s16 x, s16 y)
{
u8 i;
u8 spriteId;
x -= 64;
for (i = 0; i < 5; i++, x += 32)
{
spriteId = CreateSprite(&sStartCopyrightBannerSpriteTemplate, x, y, 0);
StartSpriteAnim(&gSprites[spriteId], i);
gSprites[spriteId].data[0] = 1;
}
}
static void CreateCopyrightBanner(s16 x, s16 y)
{
u8 i;
u8 spriteId;
x -= 64;
for (i = 0; i < 5; i++, x += 32)
{
spriteId = CreateSprite(&sStartCopyrightBannerSpriteTemplate, x, y, 0);
StartSpriteAnim(&gSprites[spriteId], i + 5);
}
}
static void SpriteCB_PokemonLogoShine(struct Sprite *sprite)
{
if (sprite->pos1.x < 272)
{
if (sprite->data[0]) // Flash background
{
u16 backgroundColor;
if (sprite->pos1.x < DISPLAY_WIDTH / 2)
{
// Brighten background color
if (sprite->data[1] < 31)
sprite->data[1]++;
if (sprite->data[1] < 31)
sprite->data[1]++;
}
else
{
// Darken background color
if (sprite->data[1] != 0)
sprite->data[1]--;
if (sprite->data[1] != 0)
sprite->data[1]--;
}
backgroundColor = _RGB(sprite->data[1], sprite->data[1], sprite->data[1]);
if (sprite->pos1.x == DISPLAY_WIDTH / 2 + 12
|| sprite->pos1.x == DISPLAY_WIDTH / 2 + 16
|| sprite->pos1.x == DISPLAY_WIDTH / 2 + 20
|| sprite->pos1.x == DISPLAY_WIDTH / 2 + 24)
gPlttBufferFaded[0] = RGB(24, 31, 12);
else
gPlttBufferFaded[0] = backgroundColor;
}
sprite->pos1.x += 4;
}
else
{
gPlttBufferFaded[0] = RGB_BLACK;
DestroySprite(sprite);
}
}
static void SpriteCB_PokemonLogoShine2(struct Sprite *sprite)
{
if (sprite->pos1.x < 272)
sprite->pos1.x += 8;
else
DestroySprite(sprite);
}
static void StartPokemonLogoShine(u8 flashBg)
{
u8 spriteId;
switch (flashBg)
{
case 0:
case 2:
spriteId = CreateSprite(&sPokemonLogoShineSpriteTemplate, 0, 68, 0);
gSprites[spriteId].oam.objMode = 2;
gSprites[spriteId].data[0] = flashBg;
break;
case 1:
spriteId = CreateSprite(&sPokemonLogoShineSpriteTemplate, 0, 68, 0);
gSprites[spriteId].oam.objMode = 2;
gSprites[spriteId].data[0] = flashBg;
gSprites[spriteId].invisible = TRUE;
spriteId = CreateSprite(&sPokemonLogoShineSpriteTemplate, 0, 68, 0);
gSprites[spriteId].callback = SpriteCB_PokemonLogoShine2;
gSprites[spriteId].oam.objMode = 2;
spriteId = CreateSprite(&sPokemonLogoShineSpriteTemplate, -80, 68, 0);
gSprites[spriteId].callback = SpriteCB_PokemonLogoShine2;
gSprites[spriteId].oam.objMode = 2;
break;
}
}
static void VBlankCB(void)
{
ScanlineEffect_InitHBlankDmaTransfer();
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
}
#define tCounter data[0]
#define tSkipToNext data[1]
void CB2_InitTitleScreen(void)
{
switch (gMain.state)
{
default:
case 0:
SetVBlankCallback(NULL);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
*((u16 *)PLTT) = RGB_WHITE;
SetGpuReg(REG_OFFSET_DISPCNT, 0);
SetGpuReg(REG_OFFSET_BG2CNT, 0);
SetGpuReg(REG_OFFSET_BG1CNT, 0);
SetGpuReg(REG_OFFSET_BG0CNT, 0);
SetGpuReg(REG_OFFSET_BG2HOFS, 0);
SetGpuReg(REG_OFFSET_BG2VOFS, 0);
SetGpuReg(REG_OFFSET_BG1HOFS, 0);
SetGpuReg(REG_OFFSET_BG1VOFS, 0);
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
DmaFill16(3, 0, (void *)VRAM, VRAM_SIZE);
DmaFill32(3, 0, (void *)OAM, OAM_SIZE);
DmaFill16(3, 0, (void *)(PLTT + 2), PLTT_SIZE - 2);
ResetPaletteFade();
gMain.state = 1;
break;
case 1:
LZ77UnCompVram(gTitleScreenPokemonLogoGfx, (void *)VRAM);
LZ77UnCompVram(gUnknown_08DE0644, (void *)(VRAM + 0x4800));
LoadPalette(gTitleScreenBgPalettes, 0, 0x1E0);
LZ77UnCompVram(sTitleScreenRayquazaGfx, (void *)(VRAM + 0x8000));
LZ77UnCompVram(sTitleScreenRayquazaTilemap, (void *)(VRAM + 0xD000));
LZ77UnCompVram(sTitleScreenCloudsGfx, (void *)(VRAM + 0xC000));
LZ77UnCompVram(gUnknown_08DDE458, (void *)(VRAM + 0xD800));
ScanlineEffect_Stop();
ResetTasks();
ResetSpriteData();
FreeAllSpritePalettes();
gReservedSpritePaletteCount = 9;
LoadCompressedObjectPic(&sSpriteSheet_EmeraldVersion[0]);
LoadCompressedObjectPic(&sSpriteSheet_PressStart[0]);
LoadCompressedObjectPic(&sPokemonLogoShineSpriteSheet[0]);
LoadPalette(gTitleScreenEmeraldVersionPal, 0x100, 0x20);
LoadSpritePalette(&sSpritePalette_PressStart[0]);
gMain.state = 2;
break;
case 2:
{
u8 taskId = CreateTask(Task_TitleScreenPhase1, 0);
gTasks[taskId].tCounter = 256;
gTasks[taskId].tSkipToNext = FALSE;
gTasks[taskId].data[2] = -16;
gTasks[taskId].data[3] = -32;
gMain.state = 3;
break;
}
case 3:
BeginNormalPaletteFade(-1, 1, 0x10, 0, 0xFFFF);
SetVBlankCallback(VBlankCB);
gMain.state = 4;
break;
case 4:
sub_816F2A8(0x78, 0x50, 0x100, 0);
SetGpuReg(REG_OFFSET_BG2X_L, -29 * 256);
SetGpuReg(REG_OFFSET_BG2X_H, -1);
SetGpuReg(REG_OFFSET_BG2Y_L, -32 * 256);
SetGpuReg(REG_OFFSET_BG2Y_H, -1);
SetGpuReg(REG_OFFSET_WIN0H, 0);
SetGpuReg(REG_OFFSET_WIN0V, 0);
SetGpuReg(REG_OFFSET_WIN1H, 0);
SetGpuReg(REG_OFFSET_WIN1V, 0);
SetGpuReg(REG_OFFSET_WININ, 0x1F1F);
SetGpuReg(REG_OFFSET_WINOUT, 0x3F1F);
SetGpuReg(REG_OFFSET_BLDCNT, 0x84);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0xC);
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(3) | BGCNT_CHARBASE(2) | BGCNT_SCREENBASE(26) | BGCNT_16COLOR | BGCNT_TXT256x256);
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(2) | BGCNT_CHARBASE(3) | BGCNT_SCREENBASE(27) | BGCNT_16COLOR | BGCNT_TXT256x256);
SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(9) | BGCNT_256COLOR | BGCNT_AFF256x256);
EnableInterrupts(INTR_FLAG_VBLANK);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1
| DISPCNT_OBJ_1D_MAP
| DISPCNT_BG2_ON
| DISPCNT_OBJ_ON
| DISPCNT_WIN0_ON
| DISPCNT_OBJWIN_ON);
m4aSongNumStart(0x19D);
gMain.state = 5;
break;
case 5:
if (!UpdatePaletteFade())
{
StartPokemonLogoShine(0);
ScanlineEffect_InitWave(0, DISPLAY_HEIGHT, 4, 4, 0, SCANLINE_EFFECT_REG_BG1HOFS, TRUE);
SetMainCallback2(MainCB2);
}
break;
}
}
static void MainCB2(void)
{
RunTasks();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
}
// Shine the Pokemon logo two more times, and fade in the version banner
static void Task_TitleScreenPhase1(u8 taskId)
{
// Skip to next phase when A, B, Start, or Select is pressed
if ((gMain.newKeys & A_B_START_SELECT) || gTasks[taskId].data[1] != 0)
{
gTasks[taskId].tSkipToNext = TRUE;
gTasks[taskId].tCounter = 0;
}
if (gTasks[taskId].tCounter != 0)
{
u16 frameNum = gTasks[taskId].tCounter;
if (frameNum == 176)
StartPokemonLogoShine(1);
else if (frameNum == 64)
StartPokemonLogoShine(2);
gTasks[taskId].tCounter--;
}
else
{
u8 spriteId;
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG2_ON | DISPCNT_OBJ_ON);
SetGpuReg(REG_OFFSET_WININ, 0);
SetGpuReg(REG_OFFSET_WINOUT, 0);
SetGpuReg(REG_OFFSET_BLDCNT, 0x3F50);
SetGpuReg(REG_OFFSET_BLDALPHA, 0x10);
SetGpuReg(REG_OFFSET_BLDY, 0);
// Create left side of version banner
spriteId = CreateSprite(&sVersionBannerLeftSpriteTemplate, VERSION_BANNER_LEFT_X, VERSION_BANNER_Y, 0);
gSprites[spriteId].data[0] = 64;
gSprites[spriteId].data[1] = taskId;
// Create right side of version banner
spriteId = CreateSprite(&sVersionBannerRightSpriteTemplate, VERSION_BANNER_RIGHT_X, VERSION_BANNER_Y, 0);
gSprites[spriteId].data[1] = taskId;
gTasks[taskId].tCounter = 144;
gTasks[taskId].func = Task_TitleScreenPhase2;
}
}
// Create "Press Start" and copyright banners, and slide Pokemon logo up
static void Task_TitleScreenPhase2(u8 taskId)
{
u32 yPos;
// Skip to next phase when A, B, Start, or Select is pressed
if ((gMain.newKeys & A_B_START_SELECT) || gTasks[taskId].tSkipToNext)
{
gTasks[taskId].tSkipToNext = TRUE;
gTasks[taskId].tCounter = 0;
}
if (gTasks[taskId].tCounter != 0)
{
gTasks[taskId].tCounter--;
}
else
{
gTasks[taskId].tSkipToNext = TRUE;
SetGpuReg(REG_OFFSET_BLDCNT, 0x2142);
SetGpuReg(REG_OFFSET_BLDALPHA, 0xF06);
SetGpuReg(REG_OFFSET_BLDY, 0);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1
| DISPCNT_OBJ_1D_MAP
| DISPCNT_BG0_ON
| DISPCNT_BG1_ON
| DISPCNT_BG2_ON
| DISPCNT_OBJ_ON);
CreatePressStartBanner(START_BANNER_X, 108);
CreateCopyrightBanner(START_BANNER_X, 148);
gTasks[taskId].data[4] = 0;
gTasks[taskId].func = Task_TitleScreenPhase3;
}
if (!(gTasks[taskId].tCounter & 3) && gTasks[taskId].data[2] != 0)
gTasks[taskId].data[2]++;
if (!(gTasks[taskId].tCounter & 1) && gTasks[taskId].data[3] != 0)
gTasks[taskId].data[3]++;
// Slide Pokemon logo up
yPos = gTasks[taskId].data[3] * 256;
SetGpuReg(REG_OFFSET_BG2Y_L, yPos);
SetGpuReg(REG_OFFSET_BG2Y_H, yPos / 0x10000);
gTasks[taskId].data[5] = 15;
gTasks[taskId].data[6] = 6;
}
// Show Rayquaza silhouette and process main title screen input
static void Task_TitleScreenPhase3(u8 taskId)
{
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & START_BUTTON))
{
FadeOutBGM(4);
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0xFFFF);
SetMainCallback2(CB2_GoToMainMenu);
}
else if ((gMain.heldKeys & CLEAR_SAVE_BUTTON_COMBO) == CLEAR_SAVE_BUTTON_COMBO)
{
SetMainCallback2(CB2_GoToClearSaveDataScreen);
}
else if ((gMain.heldKeys & RESET_RTC_BUTTON_COMBO) == RESET_RTC_BUTTON_COMBO
&& CanResetRTC() == TRUE)
{
FadeOutBGM(4);
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
SetMainCallback2(CB2_GoToResetRtcScreen);
}
else if ((gMain.heldKeys & BERRY_UPDATE_BUTTON_COMBO) == BERRY_UPDATE_BUTTON_COMBO)
{
FadeOutBGM(4);
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
SetMainCallback2(CB2_GoToBerryFixScreen);
}
else
{
SetGpuReg(REG_OFFSET_BG2Y_L, 0);
SetGpuReg(REG_OFFSET_BG2Y_H, 0);
gTasks[taskId].tCounter++;
if (gTasks[taskId].tCounter & 1)
{
gTasks[taskId].data[4]++;
gBattle_BG1_Y = gTasks[taskId].data[4] / 2;
gBattle_BG1_X = 0;
}
UpdateLegendaryMarkingColor(gTasks[taskId].tCounter);
if ((gMPlayInfo_BGM.status & 0xFFFF) == 0)
{
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0xFFFF);
SetMainCallback2(CB2_GoToCopyrightScreen);
}
}
}
static void CB2_GoToMainMenu(void)
{
if (!UpdatePaletteFade())
SetMainCallback2(CB2_InitMainMenu);
}
static void CB2_GoToCopyrightScreen(void)
{
if (!UpdatePaletteFade())
SetMainCallback2(CB2_InitCopyrightScreenAfterTitleScreen);
}
static void CB2_GoToClearSaveDataScreen(void)
{
if (!UpdatePaletteFade())
SetMainCallback2(CB2_InitClearSaveDataScreen);
}
static void CB2_GoToResetRtcScreen(void)
{
if (!UpdatePaletteFade())
SetMainCallback2(CB2_InitResetRtcScreen);
}
static void CB2_GoToBerryFixScreen(void)
{
if (!UpdatePaletteFade())
{
m4aMPlayAllStop();
SetMainCallback2(CB2_InitBerryFixProgram);
}
}
static void UpdateLegendaryMarkingColor(u8 frameNum)
{
if ((frameNum % 4) == 0) // Change color every 4th frame
{
s32 intensity = Cos(frameNum, 128) + 128;
s32 r = 31 - ((intensity * 32 - intensity) / 256);
s32 g = 31 - (intensity * 22 / 256);
s32 b = 12;
u16 color = RGB(r, g, b);
LoadPalette(&color, 0xEF, sizeof(color));
}
}

View File

@@ -57,24 +57,24 @@ u16 Font6Func(struct TextPrinter *textPrinter)
switch (char_)
{
case 1:
textPrinter->subPrinter.fontColor_h = *textPrinter->subPrinter.current_text_offset ++;
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
textPrinter->subPrinter.fgColor = *textPrinter->subPrinter.current_text_offset ++;
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
return 2;
case 2:
textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset ++;
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
return 2;
case 3:
textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset ++;
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
return 2;
case 4:
textPrinter->subPrinter.fontColor_h = *textPrinter->subPrinter.current_text_offset;
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 ++;
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
return 2;
case 5:
textPrinter->subPrinter.current_text_offset ++;

File diff suppressed because it is too large Load Diff

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);
}