From 3ede7c2facbae5ee30dd538f948ad975c3147485 Mon Sep 17 00:00:00 2001 From: DylanDoesProgramming664 Date: Wed, 25 Dec 2024 20:17:39 -0500 Subject: [PATCH 1/2] first mod doc --- docs/index.md | 4 ++++ docs/mods/fast_guage.md | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 docs/mods/fast_guage.md diff --git a/docs/index.md b/docs/index.md index f098ee72ed..c981ba9316 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,3 +11,7 @@ For more detailed information about the project as a whole, please refer to its - [2D Graphics](2d_rendering.md) - [3D Graphics](3d_rendering.md) + +## Mods + +- [Fast Guage](mods/fast_guage.md) \ No newline at end of file diff --git a/docs/mods/fast_guage.md b/docs/mods/fast_guage.md new file mode 100644 index 0000000000..1e66f2c65a --- /dev/null +++ b/docs/mods/fast_guage.md @@ -0,0 +1,18 @@ +# Fast Guage + +This is a quick tutorial on how to modify the guage of exp and health bars of Plat so that the bar visually updates in subpixels per second instead of points per second. + +This mod is a backport of the healthbar fix made by the contributors of [pret/pokeheartgold](https://github.com/pret/pokeheartgold) for the heartgold/soulsilver decomp. + +Fixes are written in the `diff` format, as mentioned in [Bugs and Glitches](../bugs_and_glitches.md). + +## Edit + +1. Go to [/src/battle/healthbar.c](/src/battle/healthbar.c) +2. Go to the ``UpdateGuage`` function. +3. Edit the function like so: +```diff +if (max < corrected) { +- ratio = max * 0x100 / corrected; ++ ratio = (max >> 8) / corrected; +``` \ No newline at end of file From b36df89104a9db48382bdd166f91281e7f533dc6 Mon Sep 17 00:00:00 2001 From: DylanDoesProgramming <120761889+DylanDoesProgramming664@users.noreply.github.com> Date: Thu, 16 Jan 2025 15:46:21 +0000 Subject: [PATCH 2/2] MON_NAME_LENGTH & TRTRAINENAME_LENGTH discoverie --- docs/index.md | 4 ---- docs/mods/fast_guage.md | 18 ------------------ src/overlay006/ov6_022489E4.c | 2 +- src/overlay013/ov13_02227288.c | 2 +- src/overlay043/ov43_02256544.c | 2 +- src/overlay062/ov62_02248408.c | 6 +++--- src/unk_020298BC.c | 2 +- src/unk_0202DF8C.c | 6 +++--- src/unk_0204AEE8.c | 2 +- 9 files changed, 11 insertions(+), 33 deletions(-) delete mode 100644 docs/mods/fast_guage.md diff --git a/docs/index.md b/docs/index.md index c981ba9316..f098ee72ed 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,3 @@ For more detailed information about the project as a whole, please refer to its - [2D Graphics](2d_rendering.md) - [3D Graphics](3d_rendering.md) - -## Mods - -- [Fast Guage](mods/fast_guage.md) \ No newline at end of file diff --git a/docs/mods/fast_guage.md b/docs/mods/fast_guage.md deleted file mode 100644 index 1e66f2c65a..0000000000 --- a/docs/mods/fast_guage.md +++ /dev/null @@ -1,18 +0,0 @@ -# Fast Guage - -This is a quick tutorial on how to modify the guage of exp and health bars of Plat so that the bar visually updates in subpixels per second instead of points per second. - -This mod is a backport of the healthbar fix made by the contributors of [pret/pokeheartgold](https://github.com/pret/pokeheartgold) for the heartgold/soulsilver decomp. - -Fixes are written in the `diff` format, as mentioned in [Bugs and Glitches](../bugs_and_glitches.md). - -## Edit - -1. Go to [/src/battle/healthbar.c](/src/battle/healthbar.c) -2. Go to the ``UpdateGuage`` function. -3. Edit the function like so: -```diff -if (max < corrected) { -- ratio = max * 0x100 / corrected; -+ ratio = (max >> 8) / corrected; -``` \ No newline at end of file diff --git a/src/overlay006/ov6_022489E4.c b/src/overlay006/ov6_022489E4.c index 5eb305bb24..1c4995ab95 100644 --- a/src/overlay006/ov6_022489E4.c +++ b/src/overlay006/ov6_022489E4.c @@ -269,7 +269,7 @@ BOOL ov6_02248CE8(UnkStruct_02095C48 *param0, int param1, const Strbuf *param2) v0 = 8 * sizeof(u16); v1 = 4; - Strbuf_ToChars(param2, v4, 8); + Strbuf_ToChars(param2, v4, 8); // Possibly TRAINER_NAME_LEN + 1 v2 = Heap_AllocFromHeap(20, v0 + v1); MI_CpuCopy8(v4, &v2[v1], v0); diff --git a/src/overlay013/ov13_02227288.c b/src/overlay013/ov13_02227288.c index e6fb68d539..0f1db70654 100644 --- a/src/overlay013/ov13_02227288.c +++ b/src/overlay013/ov13_02227288.c @@ -168,7 +168,7 @@ static void ov13_022273CC(UnkStruct_ov13_02227244 *param0) ov13_02227374(param0, 3, 6, FONT_SUBSCREEN, 8, TEXT_COLOR(3, 2, 1)); if (param0->unk_00->unk_20 != 0) { - Strbuf *v1 = MessageLoader_GetNewStrbuf(param0->unk_10, 8); + Strbuf *v1 = MessageLoader_GetNewStrbuf(param0->unk_10, 8); // Possibly TRAINER_NAME_LEN + 1 Text_AddPrinterWithParamsAndColor(¶m0->unk_2C[4], FONT_SUBSCREEN, v1, 0, 6, TEXT_SPEED_NO_TRANSFER, TEXT_COLOR(3, 2, 1), NULL); Strbuf_Free(v1); diff --git a/src/overlay043/ov43_02256544.c b/src/overlay043/ov43_02256544.c index f116997f48..d23d664f6d 100644 --- a/src/overlay043/ov43_02256544.c +++ b/src/overlay043/ov43_02256544.c @@ -68,7 +68,7 @@ BOOL ov43_02256544(UnkStruct_ov43_02256544 **param0, const UnkStruct_ov43_022565 v0->unk_30 = ov25_02254664(); v0->unk_B4 = MessageLoader_Init(1, 26, 624, 8); v0->unk_B8 = MessageLoader_Init(1, 26, 456, 8); - v0->unk_BC = Strbuf_Init(128, 8); + v0->unk_BC = Strbuf_Init(128, 8); // Possibly TRAINER_NAME_LEN + 1 ov43_022565B4(v0); *param0 = v0; diff --git a/src/overlay062/ov62_02248408.c b/src/overlay062/ov62_02248408.c index 000c2dadd0..f509e41a88 100644 --- a/src/overlay062/ov62_02248408.c +++ b/src/overlay062/ov62_02248408.c @@ -42,7 +42,7 @@ void ov62_02248408(BattleRecording *param0, FieldBattleDTO *param1, int param2) v8 = Heap_AllocFromHeap(param2, sizeof(u16) * v9); for (v4 = 0; v4 < v2; v4++) { - for (v10 = 8 - 1; v10 > -1; v10--) { + for (v10 = TRAINER_NAME_LEN; v10 > -1; v10--) { if (param1->trainerData[v4].name[v10] == 0xffff) { break; } @@ -50,7 +50,7 @@ void ov62_02248408(BattleRecording *param0, FieldBattleDTO *param1, int param2) if (v10 == -1) { ov62_0224856C(v7, param2); - Strbuf_ToChars(v7, param1->trainerData[v4].name, 8); + Strbuf_ToChars(v7, param1->trainerData[v4].name, TRAINER_NAME_LEN + 1); continue; } @@ -59,7 +59,7 @@ void ov62_02248408(BattleRecording *param0, FieldBattleDTO *param1, int param2) if (Font_AreAllCharsValid(FONT_SYSTEM, v6, v7) == 0) { ov62_0224856C(v7, param2); - Strbuf_ToChars(v7, param1->trainerData[v4].name, 8); + Strbuf_ToChars(v7, param1->trainerData[v4].name, TRAINER_NAME_LEN + 1); continue; } } diff --git a/src/unk_020298BC.c b/src/unk_020298BC.c index ed6aabb2ca..73431f932c 100644 --- a/src/unk_020298BC.c +++ b/src/unk_020298BC.c @@ -144,7 +144,7 @@ static void sub_02029990(UnkStruct_0202A138 *param0, Pokemon *param1, UnkStruct_ static void sub_020299C0(UnkStruct_0202A138 *param0, const Strbuf *param1, int param2) { - Strbuf_ToChars(param1, param0->unk_20, 8); + Strbuf_ToChars(param1, param0->unk_20, 8); // Possibly TRAINER_NAME_LEN + 1 param0->unk_34 = param2; } diff --git a/src/unk_0202DF8C.c b/src/unk_0202DF8C.c index 48ac9eaebe..a9237af2a3 100644 --- a/src/unk_0202DF8C.c +++ b/src/unk_0202DF8C.c @@ -44,7 +44,7 @@ void sub_0202DFA8(HallOfFame *param0, const Party *param1, const RTCDate *param2 v0 = ¶m0->unk_00[param0->unk_2AA8]; v3 = Party_GetCurrentCount(param1); - v2 = Strbuf_Init(11, 0); + v2 = Strbuf_Init(MON_NAME_LEN + 1, 0); MI_CpuClear16(v0->unk_00, sizeof(UnkStruct_0202E1F4) * 6); @@ -65,10 +65,10 @@ void sub_0202DFA8(HallOfFame *param0, const Party *param1, const RTCDate *param2 if (v2) { Pokemon_GetValue(v1, MON_DATA_NICKNAME_STRBUF, v2); - Strbuf_ToChars(v2, v0->unk_00[v5].unk_0C, 11); + Strbuf_ToChars(v2, v0->unk_00[v5].unk_0C, MON_NAME_LEN + 1); Pokemon_GetValue(v1, MON_DATA_OTNAME_STRBUF, v2); - Strbuf_ToChars(v2, v0->unk_00[v5].unk_22, 8); + Strbuf_ToChars(v2, v0->unk_00[v5].unk_22, TRAINER_NAME_LEN + 1); } else { v0->unk_00[v5].unk_0C[0] = 0xffff; v0->unk_00[v5].unk_22[0] = 0xffff; diff --git a/src/unk_0204AEE8.c b/src/unk_0204AEE8.c index a92dd87db8..7f25938b6b 100644 --- a/src/unk_0204AEE8.c +++ b/src/unk_0204AEE8.c @@ -292,7 +292,7 @@ static UnkStruct_0204B184 *sub_0204B184(UnkStruct_ov104_0223A348 *param0, u16 pa v2 = MessageLoader_GetNewStrbuf(v1, param1); - Strbuf_ToChars(v2, ¶m0->unk_00.unk_08[0], 8); + Strbuf_ToChars(v2, ¶m0->unk_00.unk_08[0], 8); // Possibly TRAINER_NAME_LEN + 1 Strbuf_Free(v2); MessageLoader_Free(v1);