diff --git a/include/overlay016/ov16_0223DF00.h b/include/overlay016/ov16_0223DF00.h index 066e5f5265..621e383226 100644 --- a/include/overlay016/ov16_0223DF00.h +++ b/include/overlay016/ov16_0223DF00.h @@ -45,7 +45,15 @@ #define ENEMY_IN_SLOT_LEFT 2 BGL * BattleSystem_BGL(BattleSystem * param0); -Window * BattleSystem_Window(BattleSystem * param0, int param1); + +/** + * @brief Get one of the allocated windows for the battle display. + * + * @param battleSys + * @param idx + * @return + */ +Window* BattleSystem_Window(BattleSystem *battleSys, int idx); u32 BattleSystem_BattleType(BattleSystem * param0); BattleContext * BattleSystem_Context(BattleSystem * param0); BattlerData * BattleSystem_BattlerData(BattleSystem * param0, int param1); @@ -294,7 +302,17 @@ void ov16_0223F9A0(BattleSystem * param0, int param1); BOOL BattleSystem_CaughtSpecies(BattleSystem *battleSys, int species); void Battle_SetDefaultBlend(void); u8 ov16_0223F9FC(BattleSystem * param0, int param1, int param2, int param3, int param4); -u8 BattleMessage_Print(BattleSystem * param0, MessageLoader * param1, BattleMessage * param2, int param3); + +/** + * @brief Print a BattleMessage to the main text display window. + * + * @param battleSys + * @param msgLoader + * @param battleMsg + * @param renderDelay Delay in flames applied to rendering between each character of the string. + * @return + */ +u8 BattleMessage_Print(BattleSystem *battleSys, MessageLoader *msgLoader, BattleMessage *battleMsg, int renderDelay); u8 BattleMessage_PrintToWindow(BattleSystem * param0, Window * param1, MessageLoader * param2, BattleMessage * param3, int param4, int param5, int param6, int param7, int param8); #endif // POKEPLATINUM_OV16_0223DF00_H diff --git a/include/struct_defs/battle_system.h b/include/struct_defs/battle_system.h index c82451eb50..f07a41afba 100644 --- a/include/struct_defs/battle_system.h +++ b/include/struct_defs/battle_system.h @@ -46,7 +46,7 @@ struct BattleSystem { GenericPointerData * unk_00; BGL * unk_04; - Window * unk_08; + Window *windows; MessageLoader * unk_0C; MessageLoader * unk_10; UnkStruct_0200B358 *strFormatter; diff --git a/include/unk_0201D670.h b/include/unk_0201D670.h index cec8555a3d..7b43787527 100644 --- a/include/unk_0201D670.h +++ b/include/unk_0201D670.h @@ -12,7 +12,20 @@ void sub_0201D670(const UnkStruct_0201D670 * param0); void sub_0201D710(void); u8 Message_Printing(u8 param0); void sub_0201D730(u8 param0); -u8 PrintStringSimple(Window * param0, u32 param1, const Strbuf *param2, u32 param3, u32 param4, u32 param5, UnkFuncPtr_0201D834 param6); + +/** + * @brief Print a string into the target window. + * + * @param window The window which will display the printed string. + * @param fontID ID of the font to be used. + * @param strbuf String which will be printed. + * @param xOffset X-offset to apply to the left-edge of the cursor before printing. + * @param yOffset Y-offset to apply to the top-edge of the cursor before printing. + * @param renderDelay Delay in frames to apply between rendering each character of the string. + * @param callback Callback function when done printing. + * @return + */ +u8 PrintStringSimple(Window *window, u32 fontID, const Strbuf *strbuf, u32 xOffset, u32 yOffset, u32 renderDelay, UnkFuncPtr_0201D834 callback); u8 sub_0201D78C(Window * param0, u32 param1, const Strbuf *param2, u32 param3, u32 param4, u32 param5, u32 param6, UnkFuncPtr_0201D834 param7); u8 sub_0201D7E0(Window * param0, u32 param1, const Strbuf *param2, u32 param3, u32 param4, u32 param5, u32 param6, u32 param7, u32 param8, UnkFuncPtr_0201D834 param9); u8 sub_0201D834(const UnkStruct_0201D738 * param0, u32 param1, UnkFuncPtr_0201D834 param2); diff --git a/src/overlay016/ov16_0223B140.c b/src/overlay016/ov16_0223B140.c index 7b5eee8f63..6f7f4845a5 100644 --- a/src/overlay016/ov16_0223B140.c +++ b/src/overlay016/ov16_0223B140.c @@ -323,7 +323,7 @@ void ov16_0223B3E4 (BattleSystem * param0) { SetMainCallback(NULL, NULL); ov16_02268A14(param0->unk_198); - BGL_DeleteWindow(¶m0->unk_08[0]); + BGL_DeleteWindow(¶m0->windows[0]); ov16_0223C288(param0->unk_04); ov16_0223C2BC(param0); @@ -375,7 +375,7 @@ void ov16_0223B430 (BattleSystem * param0) void ov16_0223B53C (BattleSystem * param0) { - BGL_DeleteWindow(¶m0->unk_08[0]); + BGL_DeleteWindow(¶m0->windows[0]); GXLayers_EngineAToggleLayers(GX_PLANEMASK_BG0, 0); GXLayers_EngineAToggleLayers(GX_PLANEMASK_BG1, 0); sub_02019044(param0->unk_04, 1); @@ -478,9 +478,9 @@ void ov16_0223B578 (BattleSystem * param0) param0->unk_23FB_1 = 1; - BGL_AddWindow(param0->unk_04, param0->unk_08, 1, 0x2, 0x13, 27, 4, 0xb, (18 + 12) + 1); - BGL_FillWindow(param0->unk_08, 0xff); - sub_0200E060(¶m0->unk_08[0], 0, 1, 10); + BGL_AddWindow(param0->unk_04, param0->windows, 1, 0x2, 0x13, 27, 4, 0xb, (18 + 12) + 1); + BGL_FillWindow(param0->windows, 0xff); + sub_0200E060(¶m0->windows[0], 0, 1, 10); ov16_0223DD4C(param0); } @@ -559,7 +559,7 @@ static void ov16_0223B790 (UnkStruct_020067E8 * param0) sub_02002F70(v0->unk_28, 3, 0x200, 5); v0->unk_04 = sub_02018340(5); - v0->unk_08 = sub_0201A778(5, 3); + v0->windows = sub_0201A778(5, 3); for (v3 = 0; v3 < 4; v3++) { v0->unk_1CC[v3].unk_00 = Heap_AllocFromHeap(5, (32 * 10 * 10)); @@ -579,9 +579,9 @@ static void ov16_0223B790 (UnkStruct_020067E8 * param0) ov16_0223C004(v0, v0->unk_04); - BGL_AddWindow(v0->unk_04, &v0->unk_08[0], 1, 2, 0x13, 27, 4, 11, ((18 + 12) + 1)); - BGL_FillWindow(&v0->unk_08[0], 0xff); - sub_0200E060(&v0->unk_08[0], 0, 1, 10); + BGL_AddWindow(v0->unk_04, &v0->windows[0], 1, 2, 0x13, 27, 4, 11, ((18 + 12) + 1)); + BGL_FillWindow(&v0->windows[0], 0xff); + sub_0200E060(&v0->windows[0], 0, 1, 10); v0->unk_90 = sub_0200C6E4(5); @@ -791,7 +791,7 @@ static void ov16_0223BCB4 (UnkStruct_020067E8 * param0) sub_02002AC8(0); sub_02002AE4(0); sub_02002B20(0); - sub_0201A928(v0->unk_08, 3); + sub_0201A928(v0->windows, 3); Heap_FreeToHeap(v0->unk_04); Heap_FreeToHeap(v0->unk_21C); Heap_FreeToHeap(v0->unk_220); diff --git a/src/overlay016/ov16_0223DF00.c b/src/overlay016/ov16_0223DF00.c index ecfd230a4b..f34f705f4d 100644 --- a/src/overlay016/ov16_0223DF00.c +++ b/src/overlay016/ov16_0223DF00.c @@ -82,7 +82,6 @@ #include "overlay016/ov16_0226E148.h" BGL * BattleSystem_BGL(BattleSystem * param0); -Window * BattleSystem_Window(BattleSystem * param0, int param1); u32 BattleSystem_BattleType(BattleSystem * param0); BattleContext * BattleSystem_Context(BattleSystem * param0); BattlerData * BattleSystem_BattlerData(BattleSystem * param0, int param1); @@ -212,7 +211,6 @@ void ov16_0223F9A0(BattleSystem * param0, int param1); BOOL BattleSystem_CaughtSpecies(BattleSystem *battleSys, int species); void Battle_SetDefaultBlend(void); u8 ov16_0223F9FC(BattleSystem * param0, int param1, int param2, int param3, int param4); -u8 BattleMessage_Print(BattleSystem * param0, MessageLoader * param1, BattleMessage * param2, int param3); u8 BattleMessage_PrintToWindow(BattleSystem * param0, Window * param1, MessageLoader * param2, BattleMessage * param3, int param4, int param5, int param6, int param7, int param8); static void BattleMessage_CheckSide(BattleSystem *battleSys, BattleMessage *battleMsg); static void BattleMessage_FillFormatBuffers(BattleSystem *battleSys, BattleMessage *battleMsg); @@ -240,9 +238,9 @@ BGL * BattleSystem_BGL (BattleSystem * param0) return param0->unk_04; } -Window * BattleSystem_Window (BattleSystem * param0, int param1) +Window* BattleSystem_Window(BattleSystem *battleSys, int idx) { - return ¶m0->unk_08[param1]; + return &battleSys->windows[idx]; } u32 BattleSystem_BattleType (BattleSystem *battleSys) @@ -1797,17 +1795,17 @@ u8 ov16_0223F9FC (BattleSystem * param0, int param1, int param2, int param3, int return v1; } -u8 BattleMessage_Print (BattleSystem * param0, MessageLoader * param1, BattleMessage * param2, int param3) +u8 BattleMessage_Print(BattleSystem *battleSys, MessageLoader *msgLoader, BattleMessage *battleMsg, int renderDelay) { - Window * v0 = BattleSystem_Window(param0, 0); + Window *textWindow = BattleSystem_Window(battleSys, 0); - BattleMessage_CheckSide(param0, param2); - BattleMessage_FillFormatBuffers(param0, param2); - BattleMessage_Format(param0, param1, param2); + BattleMessage_CheckSide(battleSys, battleMsg); + BattleMessage_FillFormatBuffers(battleSys, battleMsg); + BattleMessage_Format(battleSys, msgLoader, battleMsg); - BGL_FillWindow(v0, 0xff); + BGL_FillWindow(textWindow, 0xFF); - return PrintStringSimple(v0, 1, param0->msgBuffer, 0, 0, param3, BattleMessage_Callback); + return PrintStringSimple(textWindow, 1, battleSys->msgBuffer, 0, 0, renderDelay, BattleMessage_Callback); } u8 BattleMessage_PrintToWindow (BattleSystem * param0, Window * param1, MessageLoader * param2, BattleMessage * param3, int param4, int param5, int param6, int param7, int param8) diff --git a/src/unk_0201D670.c b/src/unk_0201D670.c index ebcc19248a..94f6f97bc7 100644 --- a/src/unk_0201D670.c +++ b/src/unk_0201D670.c @@ -99,28 +99,28 @@ void sub_0201D730 (u8 param0) sub_0201D6B0(param0); } -u8 PrintStringSimple (Window * param0, u32 param1, const Strbuf *param2, u32 param3, u32 param4, u32 param5, UnkFuncPtr_0201D834 param6) +u8 PrintStringSimple (Window *window, u32 fontID, const Strbuf *strbuf, u32 xOffset, u32 yOffset, u32 renderDelay, UnkFuncPtr_0201D834 callback) { UnkStruct_0201D738 v0; - v0.unk_00_val2 = param2; - v0.unk_04 = param0; - v0.unk_09 = param1; - v0.unk_0A = param3; - v0.unk_0B = param4; - v0.unk_0C = param3; - v0.unk_0E = param4; - v0.unk_10 = Unk_02100840[param1].unk_02; - v0.unk_12 = Unk_02100840[param1].unk_03; - v0.unk_14 = Unk_02100840[param1].unk_04; - v0.unk_15 = Unk_02100840[param1].unk_05; - v0.unk_16 = Unk_02100840[param1].unk_06; - v0.unk_17 = Unk_02100840[param1].unk_07; + v0.unk_00_val2 = strbuf; + v0.unk_04 = window; + v0.unk_09 = fontID; + v0.unk_0A = xOffset; + v0.unk_0B = yOffset; + v0.unk_0C = xOffset; + v0.unk_0E = yOffset; + v0.unk_10 = Unk_02100840[fontID].unk_02; + v0.unk_12 = Unk_02100840[fontID].unk_03; + v0.unk_14 = Unk_02100840[fontID].unk_04; + v0.unk_15 = Unk_02100840[fontID].unk_05; + v0.unk_16 = Unk_02100840[fontID].unk_06; + v0.unk_17 = Unk_02100840[fontID].unk_07; v0.unk_18 = 0; v0.unk_1A = 0; v0.unk_1B = 0xFF; - return sub_0201D834(&v0, param5, param6); + return sub_0201D834(&v0, renderDelay, callback); } u8 sub_0201D78C (Window * param0, u32 param1, const Strbuf *param2, u32 param3, u32 param4, u32 param5, u32 param6, UnkFuncPtr_0201D834 param7)