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 From 5f242ae6cee377d219defa8290ef1c164b003f52 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Sun, 26 Nov 2017 13:00:26 -0600 Subject: abilities, songs, species constants --- 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 21ff220d2..95555d167 100644 --- a/src/script_pokemon_util_80F99CC.c +++ b/src/script_pokemon_util_80F99CC.c @@ -12,7 +12,7 @@ #include "overworld.h" #include "script.h" #include "script_pokemon_80F9.h" -#include "songs.h" +#include "constants/songs.h" #include "sound.h" #include "string_util.h" #include "task.h" -- cgit v1.2.3 From 1829f7e7195575e872eb378722a56b344e2a1cd7 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 26 Nov 2017 13:35:08 -0800 Subject: Cleanup pokemon_summary_screen --- 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 21ff220d2..d95a0ed39 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); + ShowSelectMovePokemonSummaryScreen(&gPlayerParty[0], gSpecialVar_0x8004, gPlayerPartyCount - 1, c2_exit_to_overworld_2_switch, 0); UNK_2018000_STRUCT.unk8 = 3; gFieldCallback = sub_8080990; } -- cgit v1.2.3 From 754e911b4e95205bafa5dc93242da9cee3f2c5c6 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Thu, 21 Dec 2017 11:40:26 -0600 Subject: Rename gScript* vars to gSpecialVar_* --- src/script_pokemon_util_80F99CC.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 aed11bb7e..33e7620f7 100644 --- a/src/script_pokemon_util_80F99CC.c +++ b/src/script_pokemon_util_80F99CC.c @@ -23,7 +23,7 @@ extern u8 gPlayerPartyCount; extern u16 gSpecialVar_0x8004; extern u16 gSpecialVar_0x8005; extern u8 gUnknown_02038694; -extern u16 gScriptResult; +extern u16 gSpecialVar_Result; extern void (*gFieldCallback)(void); @@ -281,11 +281,11 @@ void ScrSpecial_CountPokemonMoves(void) // count pokemon moves { u8 i; - gScriptResult = 0; + gSpecialVar_Result = 0; for (i = 0; i < 4; i++) // checks MOVE1-MOVE4 if (GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_MOVE1 + i)) - gScriptResult++; + gSpecialVar_Result++; } void ScrSpecial_GetPokemonNicknameAndMoveName(void) @@ -437,8 +437,8 @@ void sub_80FA0DC(void) void sub_80FA148(void) { struct Pokemon *party = &gPlayerParty[gSpecialVar_0x8004]; - gScriptResult = 0; + gSpecialVar_Result = 0; if (GetMonData(party, MON_DATA_IS_EGG)) - gScriptResult = 1; + gSpecialVar_Result = 1; } -- cgit v1.2.3 From 570977c5fcb876dfca20710608b8fabf6df33319 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Sat, 23 Dec 2017 17:44:49 -0600 Subject: decompile sub_80F9FDC --- src/script_pokemon_util_80F99CC.c | 144 ++++++-------------------------------- 1 file changed, 21 insertions(+), 123 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 33e7620f7..b58363d31 100644 --- a/src/script_pokemon_util_80F99CC.c +++ b/src/script_pokemon_util_80F99CC.c @@ -19,6 +19,8 @@ #include "text.h" #include "ewram.h" +extern const u8 gUnknown_08208238[]; + extern u8 gPlayerPartyCount; extern u16 gSpecialVar_0x8004; extern u16 gSpecialVar_0x8005; @@ -297,130 +299,26 @@ void ScrSpecial_GetPokemonNicknameAndMoveName(void) StringCopy(gStringVar2, gMoveNames[data]); } -// no. hard -__attribute__((naked)) -void sub_80F9FDC(struct Pokemon *party, u8 var, u8 var2) +void sub_80F9FDC(struct Pokemon *pkmn, u8 moveIndex1, u8 moveIndex2) { - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, 0x20\n\ - mov r8, r0\n\ - adds r5, r1, 0\n\ - adds r4, r2, 0\n\ - lsls r5, 24\n\ - lsrs r5, 24\n\ - lsls r4, 24\n\ - lsrs r4, 24\n\ - adds r0, r5, 0\n\ - adds r0, 0xD\n\ - str r0, [sp, 0x8]\n\ - mov r0, r8\n\ - ldr r1, [sp, 0x8]\n\ - bl GetMonData\n\ - mov r1, sp\n\ - adds r1, 0x2\n\ - str r1, [sp, 0x14]\n\ - strh r0, [r1]\n\ - adds r3, r4, 0\n\ - adds r3, 0xD\n\ - str r3, [sp, 0xC]\n\ - mov r0, r8\n\ - adds r1, r3, 0\n\ - bl GetMonData\n\ - mov r1, sp\n\ - strh r0, [r1]\n\ - adds r7, r5, 0\n\ - adds r7, 0x11\n\ - str r7, [sp, 0x10]\n\ - mov r0, r8\n\ - adds r1, r7, 0\n\ - bl GetMonData\n\ - mov r1, sp\n\ - adds r1, 0x5\n\ - str r1, [sp, 0x18]\n\ - strb r0, [r1]\n\ - adds r3, r4, 0\n\ - adds r3, 0x11\n\ - str r3, [sp, 0x1C]\n\ - mov r0, r8\n\ - adds r1, r3, 0\n\ - bl GetMonData\n\ - add r7, sp, 0x4\n\ - mov r10, r7\n\ - strb r0, [r7]\n\ - mov r0, r8\n\ - movs r1, 0x15\n\ - bl GetMonData\n\ - mov r6, sp\n\ - adds r6, 0x6\n\ - strb r0, [r6]\n\ - ldr r1, _080FA0D8 @ =gUnknown_08208238\n\ - adds r0, r5, r1\n\ - ldrb r0, [r0]\n\ - mov r9, r0\n\ - ldrb r0, [r6]\n\ - adds r2, r0, 0\n\ - mov r3, r9\n\ - ands r2, r3\n\ - lsls r5, 1\n\ - asrs r2, r5\n\ - lsls r2, 24\n\ - lsrs r2, 24\n\ - adds r1, r4, r1\n\ - ldrb r3, [r1]\n\ - adds r1, r0, 0\n\ - ands r1, r3\n\ - lsls r4, 1\n\ - asrs r1, r4\n\ - lsls r1, 24\n\ - lsrs r1, 24\n\ - mov r7, r9\n\ - bics r0, r7\n\ - strb r0, [r6]\n\ - ldrb r0, [r6]\n\ - bics r0, r3\n\ - strb r0, [r6]\n\ - lsls r2, r4\n\ - lsls r1, r5\n\ - adds r2, r1\n\ - ldrb r0, [r6]\n\ - orrs r0, r2\n\ - strb r0, [r6]\n\ - mov r0, r8\n\ - ldr r1, [sp, 0x8]\n\ - mov r2, sp\n\ - bl SetMonData\n\ - mov r0, r8\n\ - ldr r1, [sp, 0xC]\n\ - ldr r2, [sp, 0x14]\n\ - bl SetMonData\n\ - mov r0, r8\n\ - ldr r1, [sp, 0x10]\n\ - mov r2, r10\n\ - bl SetMonData\n\ - mov r0, r8\n\ - ldr r1, [sp, 0x1C]\n\ - ldr r2, [sp, 0x18]\n\ - bl SetMonData\n\ - mov r0, r8\n\ - movs r1, 0x15\n\ - adds r2, r6, 0\n\ - bl SetMonData\n\ - add sp, 0x20\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .align 2, 0\n\ -_080FA0D8: .4byte gUnknown_08208238\n\ - .syntax divided"); + u16 move1 = GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex1); + u16 move2 = GetMonData(pkmn, MON_DATA_MOVE1 + moveIndex2); + u8 pp1 = GetMonData(pkmn, MON_DATA_PP1 + moveIndex1); + u8 pp2 = GetMonData(pkmn, MON_DATA_PP1 + moveIndex2); + u8 bonuses = GetMonData(pkmn, MON_DATA_PP_BONUSES); + + u8 r2 = (bonuses & gUnknown_08208238[moveIndex1]) >> (moveIndex1 * 2); + u8 r1 = (bonuses & gUnknown_08208238[moveIndex2]) >> (moveIndex2 * 2); + + bonuses &= ~gUnknown_08208238[moveIndex1]; + bonuses &= ~gUnknown_08208238[moveIndex2]; + bonuses |= (r2 << (moveIndex2 * 2)) + (r1 << (moveIndex1 * 2)); + + SetMonData(pkmn, MON_DATA_MOVE1 + moveIndex1, &move2); + SetMonData(pkmn, MON_DATA_MOVE1 + moveIndex2, &move1); + SetMonData(pkmn, MON_DATA_PP1 + moveIndex1, &pp2); + SetMonData(pkmn, MON_DATA_PP1 + moveIndex2, &pp1); + SetMonData(pkmn, MON_DATA_PP_BONUSES, &bonuses); } void sub_80FA0DC(void) -- cgit v1.2.3 From 7158286302493c6fe34068926b351292af2cb6a9 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Mon, 1 Jan 2018 13:59:39 -0600 Subject: Label a bunch more specials --- src/script_pokemon_util_80F99CC.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 b58363d31..df83d3e2d 100644 --- a/src/script_pokemon_util_80F99CC.c +++ b/src/script_pokemon_util_80F99CC.c @@ -39,7 +39,7 @@ void sub_80F99CC(void) BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); } -void sub_80F9A0C(void) +void SelectMonForNPCTrade(void) { u8 taskId; @@ -49,7 +49,7 @@ void sub_80F9A0C(void) BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); } -void sub_80F9A4C(void) +void SelectMoveTutorMon(void) { u8 taskId; @@ -272,7 +272,7 @@ void HandleMoveTutorPartyMenu(u8 var) } } -void sub_80F9EEC(void) +void SelectMove(void) { ShowSelectMovePokemonSummaryScreen(&gPlayerParty[0], gSpecialVar_0x8004, gPlayerPartyCount - 1, c2_exit_to_overworld_2_switch, 0); UNK_2018000_STRUCT.unk8 = 3; @@ -321,7 +321,7 @@ void sub_80F9FDC(struct Pokemon *pkmn, u8 moveIndex1, u8 moveIndex2) SetMonData(pkmn, MON_DATA_PP_BONUSES, &bonuses); } -void sub_80FA0DC(void) +void DeleteMonMove(void) { u16 i; @@ -332,7 +332,7 @@ void sub_80FA0DC(void) sub_80F9FDC(&gPlayerParty[gSpecialVar_0x8004], i, i + 1); } -void sub_80FA148(void) +void IsSelectedMonEgg(void) { struct Pokemon *party = &gPlayerParty[gSpecialVar_0x8004]; gSpecialVar_Result = 0; -- cgit v1.2.3