From 637102683c6e4d0535966ab9b213b8c93c97945c Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Tue, 12 Sep 2017 16:59:12 -0500 Subject: rename rom_4.c to overworld.c --- src/script_pokemon_util_80F99CC.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/script_pokemon_util_80F99CC.c') diff --git a/src/script_pokemon_util_80F99CC.c b/src/script_pokemon_util_80F99CC.c index 2b48cc0d8..04418b31b 100644 --- a/src/script_pokemon_util_80F99CC.c +++ b/src/script_pokemon_util_80F99CC.c @@ -9,7 +9,7 @@ #include "party_menu.h" #include "pokemon.h" #include "pokemon_summary_screen.h" -#include "rom4.h" +#include "overworld.h" #include "script.h" #include "script_pokemon_80F9.h" #include "sound.h" -- cgit v1.2.3 From 270bd98d41a19c516a4be95f522deb26cc4300a9 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Wed, 13 Sep 2017 00:03:22 -0500 Subject: more labeling --- src/script_pokemon_util_80F99CC.c | 63 +++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 32 deletions(-) (limited to 'src/script_pokemon_util_80F99CC.c') diff --git a/src/script_pokemon_util_80F99CC.c b/src/script_pokemon_util_80F99CC.c index 04418b31b..f930df8e2 100644 --- a/src/script_pokemon_util_80F99CC.c +++ b/src/script_pokemon_util_80F99CC.c @@ -12,13 +12,12 @@ #include "overworld.h" #include "script.h" #include "script_pokemon_80F9.h" +#include "songs.h" #include "sound.h" #include "string_util.h" #include "task.h" #include "text.h" - - extern u8 gPlayerPartyCount; extern u16 gSpecialVar_0x8004; extern u16 gSpecialVar_0x8005; @@ -59,7 +58,7 @@ void sub_80F9A4C(void) void sub_80F9A8C(u8 taskId) { - if(!gPaletteFade.active) + if (!gPaletteFade.active) { gPaletteFade.bufferTransferDisabled = 1; OpenPartyMenu((u8) gTasks[taskId].data[0], 0); @@ -69,10 +68,10 @@ void sub_80F9A8C(u8 taskId) bool8 sub_80F9ACC(void) { - switch(EWRAM_1B000.unk264) + switch (EWRAM_1B000.unk264) { case 0: - if(EWRAM_1B000.unk266 < gPlayerPartyCount) + if (EWRAM_1B000.unk266 < gPlayerPartyCount) { TryCreatePartyMenuMonIcon(EWRAM_1B000.unk260, EWRAM_1B000.unk266, &gPlayerParty[EWRAM_1B000.unk266]); EWRAM_1B000.unk266++; @@ -92,7 +91,7 @@ bool8 sub_80F9ACC(void) EWRAM_1B000.unk264++; break; case 3: - if(sub_806BD58(EWRAM_1B000.unk260, EWRAM_1B000.unk266) != 1) + if (sub_806BD58(EWRAM_1B000.unk260, EWRAM_1B000.unk266) != 1) { EWRAM_1B000.unk266++; break; @@ -116,7 +115,7 @@ bool8 sub_80F9ACC(void) EWRAM_1B000.unk264++; break; case 7: // the only case that can return true. - if(sub_806B58C(EWRAM_1B000.unk266) != 1) + if (sub_806B58C(EWRAM_1B000.unk266) != 1) { EWRAM_1B000.unk266++; break; @@ -135,9 +134,9 @@ void sub_80F9C00(void) { u8 i; - for(i = 0; i < gPlayerPartyCount; i++) + for (i = 0; i < gPlayerPartyCount; i++) { - switch(sub_80AE47C(&gPlayerParty[i])) + switch (sub_80AE47C(&gPlayerParty[i])) { case 0: case 3: @@ -154,18 +153,18 @@ void sub_80F9C00(void) void sub_80F9C6C(u8 var) { - if(!gPaletteFade.active) + if (!gPaletteFade.active) { - switch(sub_806BD80(var)) + switch (sub_806BD80(var)) { case 1: - PlaySE(5); + PlaySE(SE_SELECT); gUnknown_02038694 = sub_806CA38(var); gSpecialVar_0x8004 = gUnknown_02038694; sub_8123138(var); break; case 2: - PlaySE(5); + PlaySE(SE_SELECT); gUnknown_02038694 = 0xFF; gSpecialVar_0x8004 = 0xFF; sub_8123138(var); @@ -176,10 +175,10 @@ void sub_80F9C6C(u8 var) bool8 sub_80F9CE8(void) // this is the same function as sub_80F9ACC except case 6 calls a different function. why { - switch(EWRAM_1B000.unk264) + switch (EWRAM_1B000.unk264) { case 0: - if(EWRAM_1B000.unk266 < gPlayerPartyCount) + if (EWRAM_1B000.unk266 < gPlayerPartyCount) { TryCreatePartyMenuMonIcon(EWRAM_1B000.unk260, EWRAM_1B000.unk266, &gPlayerParty[EWRAM_1B000.unk266]); EWRAM_1B000.unk266++; @@ -199,7 +198,7 @@ bool8 sub_80F9CE8(void) // this is the same function as sub_80F9ACC except case EWRAM_1B000.unk264++; break; case 3: - if(sub_806BD58(EWRAM_1B000.unk260, EWRAM_1B000.unk266) != 1) + if (sub_806BD58(EWRAM_1B000.unk260, EWRAM_1B000.unk266) != 1) { EWRAM_1B000.unk266++; break; @@ -223,7 +222,7 @@ bool8 sub_80F9CE8(void) // this is the same function as sub_80F9ACC except case EWRAM_1B000.unk264++; break; case 7: // the only case that can return true. - if(sub_806B58C(EWRAM_1B000.unk266) != 1) + if (sub_806B58C(EWRAM_1B000.unk266) != 1) { EWRAM_1B000.unk266++; break; @@ -242,9 +241,9 @@ void sub_80F9E1C(void) { u8 i; - for(i = 0; i < gPlayerPartyCount; i++) + for (i = 0; i < gPlayerPartyCount; i++) { - if(!sub_8040574(&gPlayerParty[i])) + if (!sub_8040574(&gPlayerParty[i])) sub_806BC3C(i, 0x9A); else sub_806BC3C(i, 0x8C); @@ -253,18 +252,18 @@ void sub_80F9E1C(void) void sub_80F9E64(u8 var) { - if(!gPaletteFade.active) + if (!gPaletteFade.active) { - switch(sub_806BD80(var)) + switch (sub_806BD80(var)) { case 1: - PlaySE(5); + PlaySE(SE_SELECT); gSpecialVar_0x8004 = sub_806CA38(var); gSpecialVar_0x8005 = sub_8040574(&gPlayerParty[gSpecialVar_0x8004]); sub_8123138(var); break; case 2: - PlaySE(5); + PlaySE(SE_SELECT); gSpecialVar_0x8004 = 0xFF; sub_8123138(var); } @@ -278,23 +277,23 @@ void sub_80F9EEC(void) gFieldCallback = sub_8080990; } -void sub_80F9F3C(void) // count pokemon moves +void ScrSpecial_CountPokemonMoves(void) // count pokemon moves { u8 i; gScriptResult = 0; - for(i = 0; i < 4; i++) // checks MOVE1-MOVE4 - if(GetMonData(&gPlayerParty[gSpecialVar_0x8004], i + 13)) + for (i = 0; i < 4; i++) // checks MOVE1-MOVE4 + if (GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_MOVE1 + i)) gScriptResult++; } -void sub_80F9F84(void) +void ScrSpecial_GetPokemonNicknameAndMoveName(void) { - struct Pokemon *party = &gPlayerParty[gSpecialVar_0x8004]; - u16 data = GetMonData(party, gSpecialVar_0x8005 + 13); + struct Pokemon *pkmn = &gPlayerParty[gSpecialVar_0x8004]; + u16 data = GetMonData(pkmn, MON_DATA_MOVE1 + gSpecialVar_0x8005); - GetMonNickname(party, gStringVar1); + GetMonNickname(pkmn, gStringVar1); StringCopy(gStringVar2, gMoveNames[data]); } @@ -431,7 +430,7 @@ void sub_80FA0DC(void) SetMonMoveSlot(&gPlayerParty[gSpecialVar_0x8004], 0, gSpecialVar_0x8005); RemoveMonPPBonus(&gPlayerParty[gSpecialVar_0x8004], gSpecialVar_0x8005); - for(i = gSpecialVar_0x8005; i < 3; i++) + for (i = gSpecialVar_0x8005; i < 3; i++) sub_80F9FDC(&gPlayerParty[gSpecialVar_0x8004], i, i + 1); } @@ -440,6 +439,6 @@ void sub_80FA148(void) struct Pokemon *party = &gPlayerParty[gSpecialVar_0x8004]; gScriptResult = 0; - if(GetMonData(party, MON_DATA_IS_EGG)) + if (GetMonData(party, MON_DATA_IS_EGG)) gScriptResult = 1; } -- cgit v1.2.3 From 1c16828c55265e9b68b55778c3ff320b3e975965 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Mon, 9 Oct 2017 18:43:44 -0700 Subject: Document party menu handlers, text oam, and menu types --- src/script_pokemon_util_80F99CC.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/script_pokemon_util_80F99CC.c') diff --git a/src/script_pokemon_util_80F99CC.c b/src/script_pokemon_util_80F99CC.c index f930df8e2..73fafa184 100644 --- a/src/script_pokemon_util_80F99CC.c +++ b/src/script_pokemon_util_80F99CC.c @@ -31,8 +31,8 @@ void sub_80F99CC(void) u8 taskId; ScriptContext2_Enable(); - taskId = CreateTask((void *)sub_80F9A8C, 0xA); - gTasks[taskId].data[0] = 2; + taskId = CreateTask((void *)OpenPartyMenuFromScriptContext, 0xA); + gTasks[taskId].data[0] = PARTY_MENU_TYPE_CONTEST; BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); } @@ -41,8 +41,8 @@ void sub_80F9A0C(void) u8 taskId; ScriptContext2_Enable(); - taskId = CreateTask((void *)sub_80F9A8C, 0xA); - gTasks[taskId].data[0] = 3; + taskId = CreateTask((void *)OpenPartyMenuFromScriptContext, 0xA); + gTasks[taskId].data[0] = PARTY_MENU_TYPE_IN_GAME_TRADE; BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); } @@ -51,12 +51,12 @@ void sub_80F9A4C(void) u8 taskId; ScriptContext2_Enable(); - taskId = CreateTask((void *)sub_80F9A8C, 0xA); - gTasks[taskId].data[0] = 7; + taskId = CreateTask((void *)OpenPartyMenuFromScriptContext, 0xA); + gTasks[taskId].data[0] = PARTY_MENU_TYPE_MOVE_TUTOR; BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); } -void sub_80F9A8C(u8 taskId) +void OpenPartyMenuFromScriptContext(u8 taskId) { if (!gPaletteFade.active) { @@ -66,7 +66,7 @@ void sub_80F9A8C(u8 taskId) } } -bool8 sub_80F9ACC(void) +bool8 SetupContestPartyMenu(void) { switch (EWRAM_1B000.unk264) { @@ -151,7 +151,7 @@ void sub_80F9C00(void) } } -void sub_80F9C6C(u8 var) +void HandleSelectPartyMenu(u8 var) { if (!gPaletteFade.active) { @@ -173,7 +173,7 @@ void sub_80F9C6C(u8 var) } } -bool8 sub_80F9CE8(void) // this is the same function as sub_80F9ACC except case 6 calls a different function. why +bool8 SetupMoveTutorPartyMenu(void) { switch (EWRAM_1B000.unk264) { @@ -250,7 +250,7 @@ void sub_80F9E1C(void) } } -void sub_80F9E64(u8 var) +void HandleMoveTutorPartyMenu(u8 var) { if (!gPaletteFade.active) { -- cgit v1.2.3 From c5687e5324c243e5043b040bf9920ea39481adc3 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Mon, 9 Oct 2017 23:37:32 -0700 Subject: Document part of menu setup struct and accompanying functions --- src/script_pokemon_util_80F99CC.c | 80 +++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'src/script_pokemon_util_80F99CC.c') diff --git a/src/script_pokemon_util_80F99CC.c b/src/script_pokemon_util_80F99CC.c index 73fafa184..57b670de3 100644 --- a/src/script_pokemon_util_80F99CC.c +++ b/src/script_pokemon_util_80F99CC.c @@ -68,62 +68,62 @@ void OpenPartyMenuFromScriptContext(u8 taskId) bool8 SetupContestPartyMenu(void) { - switch (EWRAM_1B000.unk264) + switch (EWRAM_1B000.setupState) { case 0: - if (EWRAM_1B000.unk266 < gPlayerPartyCount) + if (EWRAM_1B000.monIndex < gPlayerPartyCount) { - TryCreatePartyMenuMonIcon(EWRAM_1B000.unk260, EWRAM_1B000.unk266, &gPlayerParty[EWRAM_1B000.unk266]); - EWRAM_1B000.unk266++; + TryCreatePartyMenuMonIcon(EWRAM_1B000.menuHandlerTaskId, EWRAM_1B000.monIndex, &gPlayerParty[EWRAM_1B000.monIndex]); + EWRAM_1B000.monIndex++; } else { - EWRAM_1B000.unk266 = 0; - EWRAM_1B000.unk264++; + EWRAM_1B000.monIndex = 0; + EWRAM_1B000.setupState++; } break; case 1: LoadHeldItemIconGraphics(); - EWRAM_1B000.unk264++; + EWRAM_1B000.setupState++; break; case 2: - CreateHeldItemIcons_806DC34(EWRAM_1B000.unk260); - EWRAM_1B000.unk264++; + CreateHeldItemIcons_806DC34(EWRAM_1B000.menuHandlerTaskId); + EWRAM_1B000.setupState++; break; case 3: - if (sub_806BD58(EWRAM_1B000.unk260, EWRAM_1B000.unk266) != 1) + if (sub_806BD58(EWRAM_1B000.menuHandlerTaskId, EWRAM_1B000.monIndex) != 1) { - EWRAM_1B000.unk266++; + EWRAM_1B000.monIndex++; break; } else { - EWRAM_1B000.unk266 = 0; - EWRAM_1B000.unk264++; + EWRAM_1B000.monIndex = 0; + EWRAM_1B000.setupState++; break; } case 4: PartyMenuPrintMonsLevelOrStatus(); - EWRAM_1B000.unk264++; + EWRAM_1B000.setupState++; break; case 5: PrintPartyMenuMonNicknames(); - EWRAM_1B000.unk264++; + EWRAM_1B000.setupState++; break; case 6: sub_80F9C00(); - EWRAM_1B000.unk264++; + EWRAM_1B000.setupState++; break; case 7: // the only case that can return true. - if (sub_806B58C(EWRAM_1B000.unk266) != 1) + if (sub_806B58C(EWRAM_1B000.monIndex) != 1) { - EWRAM_1B000.unk266++; + EWRAM_1B000.monIndex++; break; } else { - EWRAM_1B000.unk266 = 0; - EWRAM_1B000.unk264 = 0; + EWRAM_1B000.monIndex = 0; + EWRAM_1B000.setupState = 0; return TRUE; } } @@ -175,62 +175,62 @@ void HandleSelectPartyMenu(u8 var) bool8 SetupMoveTutorPartyMenu(void) { - switch (EWRAM_1B000.unk264) + switch (EWRAM_1B000.setupState) { case 0: - if (EWRAM_1B000.unk266 < gPlayerPartyCount) + if (EWRAM_1B000.monIndex < gPlayerPartyCount) { - TryCreatePartyMenuMonIcon(EWRAM_1B000.unk260, EWRAM_1B000.unk266, &gPlayerParty[EWRAM_1B000.unk266]); - EWRAM_1B000.unk266++; + TryCreatePartyMenuMonIcon(EWRAM_1B000.menuHandlerTaskId, EWRAM_1B000.monIndex, &gPlayerParty[EWRAM_1B000.monIndex]); + EWRAM_1B000.monIndex++; } else { - EWRAM_1B000.unk266 = 0; - EWRAM_1B000.unk264++; + EWRAM_1B000.monIndex = 0; + EWRAM_1B000.setupState++; } break; case 1: LoadHeldItemIconGraphics(); - EWRAM_1B000.unk264++; + EWRAM_1B000.setupState++; break; case 2: - CreateHeldItemIcons_806DC34(EWRAM_1B000.unk260); - EWRAM_1B000.unk264++; + CreateHeldItemIcons_806DC34(EWRAM_1B000.menuHandlerTaskId); + EWRAM_1B000.setupState++; break; case 3: - if (sub_806BD58(EWRAM_1B000.unk260, EWRAM_1B000.unk266) != 1) + if (sub_806BD58(EWRAM_1B000.menuHandlerTaskId, EWRAM_1B000.monIndex) != 1) { - EWRAM_1B000.unk266++; + EWRAM_1B000.monIndex++; break; } else { - EWRAM_1B000.unk266 = 0; - EWRAM_1B000.unk264++; + EWRAM_1B000.monIndex = 0; + EWRAM_1B000.setupState++; break; } case 4: PartyMenuPrintMonsLevelOrStatus(); - EWRAM_1B000.unk264++; + EWRAM_1B000.setupState++; break; case 5: PrintPartyMenuMonNicknames(); - EWRAM_1B000.unk264++; + EWRAM_1B000.setupState++; break; case 6: sub_80F9E1C(); - EWRAM_1B000.unk264++; + EWRAM_1B000.setupState++; break; case 7: // the only case that can return true. - if (sub_806B58C(EWRAM_1B000.unk266) != 1) + if (sub_806B58C(EWRAM_1B000.monIndex) != 1) { - EWRAM_1B000.unk266++; + EWRAM_1B000.monIndex++; break; } else { - EWRAM_1B000.unk266 = 0; - EWRAM_1B000.unk264 = 0; + EWRAM_1B000.monIndex = 0; + EWRAM_1B000.setupState = 0; return TRUE; } } -- cgit v1.2.3 From 3a5020764fe3f26e8003487eff5d25b425a277a7 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Tue, 10 Oct 2017 19:21:23 -0700 Subject: Add more party_menu documentation --- src/script_pokemon_util_80F99CC.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/script_pokemon_util_80F99CC.c') diff --git a/src/script_pokemon_util_80F99CC.c b/src/script_pokemon_util_80F99CC.c index 57b670de3..e303d5173 100644 --- a/src/script_pokemon_util_80F99CC.c +++ b/src/script_pokemon_util_80F99CC.c @@ -115,7 +115,7 @@ bool8 SetupContestPartyMenu(void) EWRAM_1B000.setupState++; break; case 7: // the only case that can return true. - if (sub_806B58C(EWRAM_1B000.monIndex) != 1) + if (DrawPartyMonBackground(EWRAM_1B000.monIndex) != 1) { EWRAM_1B000.monIndex++; break; @@ -155,15 +155,15 @@ void HandleSelectPartyMenu(u8 var) { if (!gPaletteFade.active) { - switch (sub_806BD80(var)) + switch (HandleDefaultPartyMenuInput(var)) { - case 1: + case A_BUTTON: PlaySE(SE_SELECT); gUnknown_02038694 = sub_806CA38(var); gSpecialVar_0x8004 = gUnknown_02038694; sub_8123138(var); break; - case 2: + case B_BUTTON: PlaySE(SE_SELECT); gUnknown_02038694 = 0xFF; gSpecialVar_0x8004 = 0xFF; @@ -201,14 +201,13 @@ bool8 SetupMoveTutorPartyMenu(void) if (sub_806BD58(EWRAM_1B000.menuHandlerTaskId, EWRAM_1B000.monIndex) != 1) { EWRAM_1B000.monIndex++; - break; } else { EWRAM_1B000.monIndex = 0; EWRAM_1B000.setupState++; - break; } + break; case 4: PartyMenuPrintMonsLevelOrStatus(); EWRAM_1B000.setupState++; @@ -222,10 +221,9 @@ bool8 SetupMoveTutorPartyMenu(void) EWRAM_1B000.setupState++; break; case 7: // the only case that can return true. - if (sub_806B58C(EWRAM_1B000.monIndex) != 1) + if (DrawPartyMonBackground(EWRAM_1B000.monIndex) != 1) { EWRAM_1B000.monIndex++; - break; } else { @@ -234,6 +232,7 @@ bool8 SetupMoveTutorPartyMenu(void) return TRUE; } } + return FALSE; } @@ -254,15 +253,15 @@ void HandleMoveTutorPartyMenu(u8 var) { if (!gPaletteFade.active) { - switch (sub_806BD80(var)) + switch (HandleDefaultPartyMenuInput(var)) { - case 1: + case A_BUTTON: PlaySE(SE_SELECT); gSpecialVar_0x8004 = sub_806CA38(var); gSpecialVar_0x8005 = sub_8040574(&gPlayerParty[gSpecialVar_0x8004]); sub_8123138(var); break; - case 2: + case B_BUTTON: PlaySE(SE_SELECT); gSpecialVar_0x8004 = 0xFF; sub_8123138(var); -- cgit v1.2.3 From 4cf701c5871a17f0bc580019e8d294bc1c84ebf3 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 5 Nov 2017 01:34:52 -0400 Subject: move ewram defines to ewram.h. --- src/script_pokemon_util_80F99CC.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/script_pokemon_util_80F99CC.c') diff --git a/src/script_pokemon_util_80F99CC.c b/src/script_pokemon_util_80F99CC.c index e303d5173..b9c84b9e7 100644 --- a/src/script_pokemon_util_80F99CC.c +++ b/src/script_pokemon_util_80F99CC.c @@ -272,7 +272,7 @@ void HandleMoveTutorPartyMenu(u8 var) void sub_80F9EEC(void) { sub_809D9F0(&gPlayerParty[0], gSpecialVar_0x8004, gPlayerPartyCount - 1, c2_exit_to_overworld_2_switch, 0); - unk_2018000.unk8 = 3; + UNK_2018000_STRUCT.unk8 = 3; gFieldCallback = sub_8080990; } -- cgit v1.2.3 From 5fc9a151463ade7d260ce5f105674908d6e4449d Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 5 Nov 2017 12:55:45 -0500 Subject: move ewram.h includes in include/ to src files. --- src/script_pokemon_util_80F99CC.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/script_pokemon_util_80F99CC.c') diff --git a/src/script_pokemon_util_80F99CC.c b/src/script_pokemon_util_80F99CC.c index b9c84b9e7..21ff220d2 100644 --- a/src/script_pokemon_util_80F99CC.c +++ b/src/script_pokemon_util_80F99CC.c @@ -17,6 +17,7 @@ #include "string_util.h" #include "task.h" #include "text.h" +#include "ewram.h" extern u8 gPlayerPartyCount; extern u16 gSpecialVar_0x8004; -- cgit v1.2.3