Merge pull request #1520 from GriffinRichards/doc-random

Document random remaining symbols
This commit is contained in:
GriffinR 2021-10-24 23:43:17 -04:00 committed by GitHub
commit 6dc3c9864c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 1063 additions and 1027 deletions

View File

@ -12,7 +12,7 @@ MauvilleCity_PokemonCenter_1F_OnTransition:
end
MauvilleCity_PokemonCenter_1F_EventScript_SetMauvilleOldManGfx::
special ScrSpecial_SetMauvilleOldManObjEventGfx
special SetMauvilleOldManObjEventGfx
end
MauvilleCity_PokemonCenter_1F_EventScript_Nurse::

View File

@ -1,5 +1,5 @@
MauvilleCity_PokemonCenter_1F_EventScript_MauvilleOldMan::
special ScrSpecial_GetCurrentMauvilleMan
special Script_GetCurrentMauvilleMan
switch VAR_RESULT
case MAUVILLE_MAN_BARD, MauvilleCity_PokemonCenter_1F_EventScript_Bard
case MAUVILLE_MAN_HIPSTER, MauvilleCity_PokemonCenter_1F_EventScript_Hipster
@ -21,9 +21,9 @@ MauvilleCity_PokemonCenter_1F_EventScript_Bard::
MauvilleCity_PokemonCenter_1F_EventScript_PlaySong::
setvar VAR_0x8004, 0
special ScrSpecial_PlayBardSong
special PlayBardSong
delay 60
special ScrSpecial_HasBardSongBeenChanged
special HasBardSongBeenChanged
compare VAR_RESULT, FALSE
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_AskToWriteLyrics
msgbox MauvilleCity_PokemonCenter_1F_Text_WishICouldPlaySongForOthers, MSGBOX_DEFAULT
@ -52,12 +52,12 @@ MauvilleCity_PokemonCenter_1F_EventScript_WriteLyrics::
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_DeclineWritingLyrics
msgbox MauvilleCity_PokemonCenter_1F_Text_LetMeSingItForYou, MSGBOX_DEFAULT
setvar VAR_0x8004, 1
special ScrSpecial_PlayBardSong
special PlayBardSong
delay 60
msgbox MauvilleCity_PokemonCenter_1F_Text_ThatHowYouWantedSongToGo, MSGBOX_YESNO
compare VAR_RESULT, NO
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_WriteLyrics
special ScrSpecial_SaveBardSongLyrics
special SaveBardSongLyrics
msgbox MauvilleCity_PokemonCenter_1F_Text_IllSingThisSongForAWhile, MSGBOX_DEFAULT
release
end
@ -73,7 +73,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_Hipster::
faceplayer
setflag FLAG_SYS_HIPSTER_MEET
msgbox MauvilleCity_PokemonCenter_1F_Text_TeachWhatsHipAndHappening, MSGBOX_DEFAULT
special ScrSpecial_GetHipsterSpokenFlag
special GetHipsterSpokenFlag
compare VAR_RESULT, FALSE
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_TryTeachWord
msgbox MauvilleCity_PokemonCenter_1F_Text_IAlreadyTaughtYou, MSGBOX_DEFAULT
@ -81,7 +81,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_Hipster::
end
MauvilleCity_PokemonCenter_1F_EventScript_TryTeachWord::
special ScrSpecial_HipsterTeachWord
special HipsterTryTeachWord
compare VAR_RESULT, TRUE
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_TeachWord
msgbox MauvilleCity_PokemonCenter_1F_Text_IveGotNothingNewToTeach, MSGBOX_DEFAULT
@ -90,7 +90,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_TryTeachWord::
MauvilleCity_PokemonCenter_1F_EventScript_TeachWord::
msgbox MauvilleCity_PokemonCenter_1F_Text_HaveYouHeardOfPhrase, MSGBOX_DEFAULT
special ScrSpecial_SetHipsterSpokenFlag
special SetHipsterSpokenFlag
release
end
@ -160,7 +160,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_Trader::
msgbox MauvilleCity_PokemonCenter_1F_Text_WantToTradeDecor, MSGBOX_YESNO
compare VAR_RESULT, NO
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_DeclineTrade
special ScrSpecial_GetTraderTradedFlag
special GetTraderTradedFlag
compare VAR_RESULT, TRUE
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_AlreadyTraded
message MauvilleCity_PokemonCenter_1F_Text_PickADecorItem
@ -179,7 +179,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_AlreadyTraded::
end
MauvilleCity_PokemonCenter_1F_EventScript_PickDecorToReceive::
special ScrSpecial_TraderMenuGetDecoration
special TraderMenuGetDecoration
waitstate
compare VAR_0x8004, 0
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_CancelPickDecor
@ -188,7 +188,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_PickDecorToReceive::
msgbox MauvilleCity_PokemonCenter_1F_Text_OnceBelongedToPlayerDoYouWantIt, MSGBOX_YESNO
compare VAR_RESULT, NO
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_PickDifferentDecor
special ScrSpecial_DoesPlayerHaveNoDecorations
special DoesPlayerHaveNoDecorations
compare VAR_RESULT, TRUE
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_DontHaveAnyDecor
goto MauvilleCity_PokemonCenter_1F_EventScript_PickDecorToGive
@ -218,19 +218,19 @@ MauvilleCity_PokemonCenter_1F_EventScript_DontHaveAnyDecor::
MauvilleCity_PokemonCenter_1F_EventScript_PickDecorToGive::
msgbox MauvilleCity_PokemonCenter_1F_Text_PickTheDecorToTrade, MSGBOX_DEFAULT
special ScrSpecial_TraderMenuGiveDecoration
special TraderShowDecorationMenu
waitstate
compare VAR_0x8006, 0
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_CancelGiveDecor
compare VAR_0x8006, 0xFFFF
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_DecorInUse
special ScrSpecial_IsDecorationFull
special IsDecorationCategoryFull
compare VAR_RESULT, TRUE
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_NoRoomForDecor
msgbox MauvilleCity_PokemonCenter_1F_Text_SoWellTradeTheseDecor, MSGBOX_YESNO
compare VAR_RESULT, NO
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_PickDecorToGive
special ScrSpecial_TraderDoDecorationTrade
special TraderDoDecorationTrade
msgbox MauvilleCity_PokemonCenter_1F_Text_SendDecorToYourPC, MSGBOX_DEFAULT
release
end
@ -818,20 +818,20 @@ MauvilleCity_PokemonCenter_1F_EventScript_Storyteller::
msgbox MauvilleCity_PokemonCenter_1F_Text_WillYouHearMyTale, MSGBOX_YESNO
compare VAR_RESULT, NO
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_DeclineStoryteller
specialvar VAR_RESULT, ScrSpecial_StorytellerGetFreeStorySlot
specialvar VAR_RESULT, StorytellerGetFreeStorySlot
compare VAR_RESULT, 0
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_KnowNoTales
message MauvilleCity_PokemonCenter_1F_Text_WhichTaleToTell
waitmessage
special ScrSpecial_StorytellerStoryListMenu
special StorytellerStoryListMenu
waitstate
compare VAR_RESULT, 0
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_CancelStorySelection
setvar VAR_0x8008, 1
special ScrSpecial_StorytellerDisplayStory
special Script_StorytellerDisplayStory
waitmessage
waitbuttonpress
specialvar VAR_RESULT, ScrSpecial_StorytellerUpdateStat
specialvar VAR_RESULT, StorytellerUpdateStat
compare VAR_RESULT, 0
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_AreThereOtherTales
goto MauvilleCity_PokemonCenter_1F_EventScript_TellPlayersTale
@ -842,7 +842,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_CancelStorySelection::
MauvilleCity_PokemonCenter_1F_EventScript_AreThereOtherTales::
msgbox MauvilleCity_PokemonCenter_1F_Text_CouldThereBeOtherLegends, MSGBOX_DEFAULT
specialvar VAR_RESULT, ScrSpecial_HasStorytellerAlreadyRecorded
specialvar VAR_RESULT, HasStorytellerAlreadyRecorded
compare VAR_RESULT, TRUE
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_StorytellerEnd
goto MauvilleCity_PokemonCenter_1F_EventScript_DoYouHaveAnyTales
@ -853,7 +853,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_DoYouHaveAnyTales::
msgbox MauvilleCity_PokemonCenter_1F_Text_HaveYouAnyLegendaryTales, MSGBOX_YESNO
compare VAR_RESULT, NO
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_DeclineStoryteller
specialvar VAR_RESULT, ScrSpecial_StorytellerInitializeRandomStat
specialvar VAR_RESULT, Script_StorytellerInitializeRandomStat
compare VAR_RESULT, 1
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_TellPlayersTale
msgbox MauvilleCity_PokemonCenter_1F_Text_NotWorthyOfLegend, MSGBOX_DEFAULT
@ -909,7 +909,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_Giddy::
end
MauvilleCity_PokemonCenter_1F_EventScript_TryTellTale::
special ScrSpecial_GiddyShouldTellAnotherTale
special GiddyShouldTellAnotherTale
compare VAR_RESULT, TRUE
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_GiddyTellTale
compare VAR_RESULT, FALSE
@ -917,7 +917,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_TryTellTale::
end
MauvilleCity_PokemonCenter_1F_EventScript_TryTellNewTale::
special ScrSpecial_GiddyShouldTellAnotherTale
special GiddyShouldTellAnotherTale
compare VAR_RESULT, TRUE
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_GiddyStartNewTale
compare VAR_RESULT, FALSE
@ -929,15 +929,16 @@ MauvilleCity_PokemonCenter_1F_EventScript_GiddyStartNewTale::
goto MauvilleCity_PokemonCenter_1F_EventScript_GiddyTellTale
end
@ Regardless of whether yes or no is selected below, Giddy will continue to tell stories until he's told 10
@ Giddy will continue to tell stories regardless of whether yes or no is selected below.
@ Each story there is a 10% chance it will be his last. Otherwise he will stop at 10 stories.
MauvilleCity_PokemonCenter_1F_EventScript_GiddyTellTale::
special ScrSpecial_GenerateGiddyLine
special GenerateGiddyLine
special ShowFieldMessageStringVar4
waitmessage
yesnobox 20, 8
compare VAR_RESULT, 1
compare VAR_RESULT, YES
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_TryTellNewTale
compare VAR_RESULT, 0
compare VAR_RESULT, NO
goto_if_eq MauvilleCity_PokemonCenter_1F_EventScript_TryTellNewTale
end

View File

@ -108,28 +108,28 @@ gSpecials::
def_special DoWateringBerryTreeAnim
def_special ShowEasyChatScreen
def_special ShowEasyChatProfile
def_special ScrSpecial_GetCurrentMauvilleMan
def_special ScrSpecial_HasBardSongBeenChanged
def_special ScrSpecial_SaveBardSongLyrics
def_special ScrSpecial_GetHipsterSpokenFlag
def_special ScrSpecial_SetHipsterSpokenFlag
def_special ScrSpecial_HipsterTeachWord
def_special ScrSpecial_PlayBardSong
def_special ScrSpecial_SetMauvilleOldManObjEventGfx
def_special ScrSpecial_GenerateGiddyLine
def_special ScrSpecial_GiddyShouldTellAnotherTale
def_special ScrSpecial_StorytellerGetFreeStorySlot
def_special ScrSpecial_StorytellerDisplayStory
def_special ScrSpecial_StorytellerStoryListMenu
def_special ScrSpecial_StorytellerUpdateStat
def_special ScrSpecial_StorytellerInitializeRandomStat
def_special ScrSpecial_HasStorytellerAlreadyRecorded
def_special ScrSpecial_TraderMenuGetDecoration
def_special ScrSpecial_GetTraderTradedFlag
def_special ScrSpecial_DoesPlayerHaveNoDecorations
def_special ScrSpecial_IsDecorationFull
def_special ScrSpecial_TraderMenuGiveDecoration
def_special ScrSpecial_TraderDoDecorationTrade
def_special Script_GetCurrentMauvilleMan
def_special HasBardSongBeenChanged
def_special SaveBardSongLyrics
def_special GetHipsterSpokenFlag
def_special SetHipsterSpokenFlag
def_special HipsterTryTeachWord
def_special PlayBardSong
def_special SetMauvilleOldManObjEventGfx
def_special GenerateGiddyLine
def_special GiddyShouldTellAnotherTale
def_special StorytellerGetFreeStorySlot
def_special Script_StorytellerDisplayStory
def_special StorytellerStoryListMenu
def_special StorytellerUpdateStat
def_special Script_StorytellerInitializeRandomStat
def_special HasStorytellerAlreadyRecorded
def_special TraderMenuGetDecoration
def_special GetTraderTradedFlag
def_special DoesPlayerHaveNoDecorations
def_special IsDecorationCategoryFull
def_special TraderShowDecorationMenu
def_special TraderDoDecorationTrade
def_special GetSeedotSizeRecordInfo
def_special CompareSeedotSize
def_special GetLotadSizeRecordInfo
@ -455,7 +455,7 @@ gSpecials::
def_special ClearLinkContestFlags
def_special TryContestEModeLinkup
def_special ShowScrollableMultichoice
def_special sub_813A630
def_special ScrollableMultichoice_TryReturnToList
def_special BufferBattleTowerElevatorFloors
def_special TryStoreHeldItemsInPyramidBag
def_special ChooseItemsToTossFromPyramidBag
@ -484,10 +484,10 @@ gSpecials::
def_special CountPlayerTrainerStars
def_special BufferBattleFrontierTutorMoveName
def_special CloseBattleFrontierTutorWindow
def_special sub_813ADD4
def_special ScrollableMultichoice_RedrawPersistentMenu
def_special ChooseMonForMoveTutor
def_special GetBattleFrontierTutorMoveIndex
def_special sub_813AF48
def_special ScrollableMultichoice_ClosePersistentMenu
def_special DoDeoxysRockInteraction
def_special SetDeoxysRockPalette
def_special CreateEventLegalEnemyMon

View File

@ -1,63 +1,63 @@
@ Only contains a portion of the mauville_man text. The rest is in scripts/mauville_man.inc
gText_SoPretty::
@ Only contains the text for the Mauville Man named Giddy. The rest is in scripts/mauville_man.inc
GiddyText_SoPretty::
.string " so pretty!$"
gText_SoDarling::
GiddyText_SoDarling::
.string " so darling!$"
gText_SoRelaxed::
GiddyText_SoRelaxed::
.string " so relaxed!$"
gText_SoSunny::
GiddyText_SoSunny::
.string " so sunny!$"
gText_SoDesirable::
GiddyText_SoDesirable::
.string " so desirable!$"
gText_SoExciting::
GiddyText_SoExciting::
.string " so exciting!$"
gText_SoAmusing::
GiddyText_SoAmusing::
.string " so amusing!$"
gText_SoMagical::
GiddyText_SoMagical::
.string " so magical!$"
gOtherText_Is::
GiddyText_Is::
.string " is$"
gOtherText_DontYouAgree::
GiddyText_DontYouAgree::
.string "\n"
.string "Don't you agree?$"
gMauvilleManText_ISoWantToGoOnAVacation::
GiddyText_ISoWantToGoOnAVacation::
.string "I so want to go on a vacation.\n"
.string "Would you happen to know a nice place?$"
gMauvilleManText_IBoughtCrayonsWith120Colors::
GiddyText_IBoughtCrayonsWith120Colors::
.string "I bought crayons with 120 colors!\n"
.string "Don't you think that's nice?$"
gMauvilleManText_WouldntItBeNiceIfWeCouldFloat::
GiddyText_WouldntItBeNiceIfWeCouldFloat::
.string "Wouldn't it be nice if we could float\n"
.string "away on a cloud of bubbles?$"
gMauvilleManText_WhenYouWriteOnASandyBeach::
GiddyText_WhenYouWriteOnASandyBeach::
.string "When you write on a sandy beach,\n"
.string "they wash away. It makes me sad.$"
gMauvilleManText_WhatsTheBottomOfTheSeaLike::
GiddyText_WhatsTheBottomOfTheSeaLike::
.string "What's the bottom of the sea like?\n"
.string "Just once I would so love to go!$"
gMauvilleManText_WhenYouSeeTheSettingSunDoesIt::
GiddyText_WhenYouSeeTheSettingSunDoesIt::
.string "When you see the setting sun, does it\n"
.string "make you want to go home?$"
gMauvilleManText_LyingBackInTheGreenGrass::
GiddyText_LyingBackInTheGreenGrass::
.string "Lying back in the green grass…\n"
.string "Oh, it's so, so nice!$"
gMauvilleManText_SecretBasesAreSoWonderful::
GiddyText_SecretBasesAreSoWonderful::
.string "SECRET BASES are so wonderful!\n"
.string "Can't you feel the excitement?$"

View File

@ -52,7 +52,7 @@
#define CHAR_LV 0x34
#define CHAR_EQUALS 0x35
#define CHAR_SEMICOLON 0x36
//
#define CHAR_BARD_WORD_DELIMIT 0x37 // Empty space to separate words in Bard's song
#define CHAR_INV_QUESTION_MARK 0x51
#define CHAR_INV_EXCL_MARK 0x52
#define CHAR_PK 0x53
@ -71,7 +71,7 @@
//
#define CHAR_i_ACUTE 0x6F
//
#define CHAR_GENDERLESS 0x77 // Empty space for lack of gender icon
#define CHAR_SPACER 0x77 // Empty space
//
#define CHAR_UP_ARROW 0x79
#define CHAR_DOWN_ARROW 0x7A

View File

@ -101,6 +101,8 @@
#define BARD_SONG_LENGTH 6
#define NUM_STORYTELLER_TALES 4
#define NUM_TRADER_ITEMS 4
#define GIDDY_MAX_TALES 10
#define GIDDY_MAX_QUESTIONS 8
#define OPTIONS_BUTTON_MODE_NORMAL 0
#define OPTIONS_BUTTON_MODE_LR 1

View File

@ -113,22 +113,22 @@
#define MB_WATER_SOUTH_ARROW_WARP 0x6D
#define MB_DEEP_SOUTH_WARP 0x6E
#define MB_UNUSED_6F 0x6F
#define MB_WARP_OR_BRIDGE 0x70
#define MB_UNUSED_71 0x71
#define MB_ROUTE120_NORTH_BRIDGE_1 0x72
#define MB_ROUTE120_NORTH_BRIDGE_2 0x73
#define MB_BRIDGE_OVER_OCEAN 0x70
#define MB_BRIDGE_OVER_POND_LOW 0x71
#define MB_BRIDGE_OVER_POND_MED 0x72
#define MB_BRIDGE_OVER_POND_HIGH 0x73
#define MB_PACIFIDLOG_VERTICAL_LOG_1 0x74
#define MB_PACIFIDLOG_VERTICAL_LOG_2 0x75
#define MB_PACIFIDLOG_HORIZONTAL_LOG_1 0x76
#define MB_PACIFIDLOG_HORIZONTAL_LOG_2 0x77
#define MB_FORTREE_BRIDGE 0x78
#define MB_UNUSED_79 0x79
#define MB_ROUTE120_SOUTH_BRIDGE_1 0x7A
#define MB_ROUTE120_SOUTH_BRIDGE_2 0x7B
#define MB_ROUTE120_NORTH_BRIDGE_3 0x7C
#define MB_ROUTE120_NORTH_BRIDGE_4 0x7D
#define MB_UNUSED_7E 0x7E
#define MB_ROUTE110_BRIDGE 0x7F
#define MB_BRIDGE_OVER_POND_MED_EDGE_1 0x7A
#define MB_BRIDGE_OVER_POND_MED_EDGE_2 0x7B
#define MB_BRIDGE_OVER_POND_HIGH_EDGE_1 0x7C
#define MB_BRIDGE_OVER_POND_HIGH_EDGE_2 0x7D
#define MB_UNUSED_BRIDGE_1 0x7E
#define MB_UNUSED_BRIDGE_2 0x7F
#define MB_COUNTER 0x80
#define MB_UNUSED_81 0x81
#define MB_UNUSED_82 0x82

View File

@ -382,27 +382,27 @@ extern const u8 EventScript_UseRockSmash[];
extern const u8 LittlerootTown_BrendansHouse_2F_EventScript_TurnOffPlayerPC[];
extern const u8 LittlerootTown_MaysHouse_2F_EventScript_TurnOffPlayerPC[];
//mauville_old_man
extern const u8 gOtherText_Is[];
extern const u8 gOtherText_DontYouAgree[];
extern const u8 gText_SoPretty[];
extern const u8 gText_SoDarling[];
extern const u8 gText_SoRelaxed[];
extern const u8 gText_SoSunny[];
extern const u8 gText_SoDesirable[];
extern const u8 gText_SoExciting[];
extern const u8 gText_SoAmusing[];
extern const u8 gText_SoMagical[];
extern const u8 gMauvilleManText_ISoWantToGoOnAVacation[];
extern const u8 gMauvilleManText_IBoughtCrayonsWith120Colors[];
extern const u8 gMauvilleManText_WouldntItBeNiceIfWeCouldFloat[];
extern const u8 gMauvilleManText_WhenYouWriteOnASandyBeach[];
extern const u8 gMauvilleManText_WhatsTheBottomOfTheSeaLike[];
extern const u8 gMauvilleManText_WhenYouSeeTheSettingSunDoesIt[];
extern const u8 gMauvilleManText_LyingBackInTheGreenGrass[];
extern const u8 gMauvilleManText_SecretBasesAreSoWonderful[];
// Mauville Old Man (Giddy)
extern const u8 GiddyText_Is[];
extern const u8 GiddyText_DontYouAgree[];
extern const u8 GiddyText_SoPretty[];
extern const u8 GiddyText_SoDarling[];
extern const u8 GiddyText_SoRelaxed[];
extern const u8 GiddyText_SoSunny[];
extern const u8 GiddyText_SoDesirable[];
extern const u8 GiddyText_SoExciting[];
extern const u8 GiddyText_SoAmusing[];
extern const u8 GiddyText_SoMagical[];
extern const u8 GiddyText_ISoWantToGoOnAVacation[];
extern const u8 GiddyText_IBoughtCrayonsWith120Colors[];
extern const u8 GiddyText_WouldntItBeNiceIfWeCouldFloat[];
extern const u8 GiddyText_WhenYouWriteOnASandyBeach[];
extern const u8 GiddyText_WhatsTheBottomOfTheSeaLike[];
extern const u8 GiddyText_WhenYouSeeTheSettingSunDoesIt[];
extern const u8 GiddyText_LyingBackInTheGreenGrass[];
extern const u8 GiddyText_SecretBasesAreSoWonderful[];
// mauville old man storyteller
// Mauville Old Man (storyteller)
extern const u8 MauvilleCity_PokemonCenter_1F_Text_SavedGameTitle[];
extern const u8 MauvilleCity_PokemonCenter_1F_Text_SavedGameAction[];
extern const u8 MauvilleCity_PokemonCenter_1F_Text_SavedGameStory[];

View File

@ -638,8 +638,8 @@ struct MauvilleManGiddy
/*0x00*/ u8 id;
/*0x01*/ u8 taleCounter;
/*0x02*/ u8 questionNum;
/*0x04*/ u16 randomWords[10];
/*0x18*/ u8 questionList[8];
/*0x04*/ u16 randomWords[GIDDY_MAX_TALES];
/*0x18*/ u8 questionList[GIDDY_MAX_QUESTIONS];
/*0x20*/ u8 language;
}; /*size = 0x2C*/

View File

@ -10,15 +10,15 @@ int GetStringCenterAlignXOffset(int fontId, const u8 *str, int totalWidth);
int GetStringRightAlignXOffset(int fontId, const u8 *str, int totalWidth);
int GetStringCenterAlignXOffsetWithLetterSpacing(int fontId, const u8 *str, int totalWidth, int letterSpacing);
int GetStringWidthDifference(int fontId, const u8 *str, int totalWidth, int letterSpacing);
int GetMaxWidthInMenuTable(const struct MenuAction *str, int arg1);
int sub_81DB3D8(const struct MenuAction *str, const u8* arg1, int arg2);
int GetMaxWidthInMenuTable(const struct MenuAction *actions, int numActions);
int GetMaxWidthInSubsetOfMenuTable(const struct MenuAction *actions, const u8* actionIds, int numActions);
int Intl_GetListMenuWidth(const struct ListMenuTemplate *listMenu);
void CopyMonCategoryText(int dexNum, u8 *dest);
u8 *sub_81DB494(u8 *str, int fontId, const u8 *str2, int totalStringWidth);
u8 *GetStringClearToWidth(u8 *dest, int fontId, const u8 *str, int totalStringWidth);
void PadNameString(u8 *dest, u8 padChar);
void ConvertInternationalPlayerNameStripChar(u8 *, u8);
void ConvertInternationalContestantName(u8 *);
int sub_81DB604(u8 *);
int GetNicknameLanguage(u8 *);
void sub_81DB620(int windowId, int columnStart, int rowStart, int numFillTiles, int numRows);
#endif // GUARD_INTERNATIONAL_STRING_UTIL_H

View File

@ -5,7 +5,7 @@ extern struct BardSong gBardSong;
void SetMauvilleOldMan(void);
u8 GetCurrentMauvilleOldMan(void);
void ScrSpecial_SetMauvilleOldManObjEventGfx(void);
void SetMauvilleOldManObjEventGfx(void);
u8 sub_81201C8(void);
void SanitizeMauvilleOldManForRuby(OldMan *dest);
void sub_8120670(void);

View File

@ -1,6 +1,14 @@
#ifndef GUARD_METATILE_BEHAVIOR_H
#define GUARD_METATILE_BEHAVIOR_H
// Return values for MetatileBehavior_GetBridgeType
enum {
BRIDGE_TYPE_OCEAN, // For log bridges over 'ocean' style water (Routes 110/119 use this).
BRIDGE_TYPE_POND_LOW,
BRIDGE_TYPE_POND_MED,
BRIDGE_TYPE_POND_HIGH,
};
bool8 MetatileBehavior_IsATile(u8);
bool8 MetatileBehavior_IsEncounterTile(u8);
bool8 MetatileBehavior_IsJumpEast(u8);
@ -76,9 +84,9 @@ bool8 MetatileBehavior_IsLongGrass(u8);
bool8 MetatileBehavior_IsBerryTreeSoil(u8);
bool8 MetatileBehavior_IsAshGrass(u8);
bool8 MetatileBehavior_IsFootprints(u8);
bool8 MetatileBehavior_IsBridge(u8);
bool8 MetatileBehavior_IsBridgeOverWater(u8);
u8 MetatileBehavior_GetBridgeType(u8);
u8 MetatileBehavior_8089510(u8);
bool8 MetatileBehavior_IsBridgeOverWaterNoEdge(u8);
bool8 MetatileBehavior_IsLandWildEncounter(u8);
bool8 MetatileBehavior_IsWaterWildEncounter(u8);
bool8 MetatileBehavior_IsIndoorEncounter(u8);
@ -115,7 +123,7 @@ bool8 MetatileBehavior_IsSecretBaseSpinMat(u8);
bool8 MetatileBehavior_IsLavaridgeB1FWarp(u8);
bool8 MetatileBehavior_IsLavaridge1FWarp(u8);
bool8 MetatileBehavior_IsAquaHideoutWarp(u8);
bool8 MetatileBehavior_IsWarpOrBridge(u8);
bool8 MetatileBehavior_IsBridgeOverOcean(u8);
bool8 MetatileBehavior_IsMossdeepGymWarp(u8);
bool8 MetatileBehavior_IsSurfableFishableWater(u8);
bool8 MetatileBehavior_IsMtPyreHole(u8);

View File

@ -4,7 +4,7 @@
extern const u8 gMonIconPaletteIndices[];
const u8 *GetMonIconTiles(u16 species, bool32);
void sub_80D304C(u16 offset);
void TryLoadAllMonIconPalettesAtOffset(u16 offset);
u8 GetValidMonIconPalIndex(u16 species);
const u8 *GetMonIconPtr(u16 speciesId, u32 personality, u32 frameNo);
const u16 *GetValidMonIconPalettePtr(u16 speciesId);
@ -20,7 +20,6 @@ void FreeAndDestroyMonIconSprite(struct Sprite *sprite);
u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u32 personality, bool32 handleDeoxys);
u8 UpdateMonIconFrame(struct Sprite *sprite);
void LoadMonIconPalette(u16 species);
void sub_80D328C(struct Sprite *sprite);
void SpriteCB_MonIcon(struct Sprite *sprite);
void SetPartyHPBarSprite(struct Sprite *sprite, u8 animNum);
u8 GetMonIconPaletteIndexFromSpecies(u16 species);

View File

@ -1,8 +1,14 @@
#ifndef GUARD_TRAINER_POKEMON_SPRITES_H
#define GUARD_TRAINER_POKEMON_SPRITES_H
// For the flags argument of CreateMonPicSprite_Affine
#define MON_PIC_AFFINE_BACK 0
#define MON_PIC_AFFINE_FRONT 1
#define MON_PIC_AFFINE_NONE 3
#define F_MON_PIC_NO_AFFINE (1 << 7)
bool16 ResetAllPicSprites(void);
u16 CreatePicSprite2(u16 species, u32 otId, u32 personality, u8 flags, s16 x, s16 y, u8 paletteSlot, u16 paletteTag);
u16 CreateMonPicSprite_Affine(u16 species, u32 otId, u32 personality, u8 flags, s16 x, s16 y, u8 paletteSlot, u16 paletteTag);
u16 CreateMonPicSprite_HandleDeoxys(u16 species, u32 otId, u32 personality, bool8 isFrontPic, s16 x, s16 y, u8 paletteSlot, u16 paletteTag);
u16 FreeAndDestroyMonPicSprite(u16 spriteId);
u16 CreateTrainerPicSprite(u16 species, bool8 isFrontPic, s16 x, s16 y, u8 paletteSlot, u16 paletteTag);

View File

@ -33,7 +33,6 @@ extern const struct WildPokemonHeader gWildMonHeaders[];
void DisableWildEncounters(bool8 disabled);
bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavior);
void ScrSpecial_RockSmashWildEncounter(void);
bool8 SweetScentWildEncounter(void);
bool8 DoesCurrentMapHaveFishingMons(void);
void FishingWildEncounter(u8 rod);

View File

@ -6062,7 +6062,7 @@ static void DrawLevelUpBannerText(void)
var = (u32)(txtPtr);
txtPtr = ConvertIntToDecimalStringN(txtPtr, monLevel, STR_CONV_MODE_LEFT_ALIGN, 3);
var = (u32)(txtPtr) - var;
txtPtr = StringFill(txtPtr, CHAR_GENDERLESS, 4 - var);
txtPtr = StringFill(txtPtr, CHAR_SPACER, 4 - var);
if (monGender != MON_GENDERLESS)
{

View File

@ -674,9 +674,11 @@ u8 BattleSetup_GetTerrainId(void)
return BATTLE_TERRAIN_MOUNTAIN;
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
{
if (MetatileBehavior_GetBridgeType(tileBehavior))
// Is BRIDGE_TYPE_POND_*?
if (MetatileBehavior_GetBridgeType(tileBehavior) != BRIDGE_TYPE_OCEAN)
return BATTLE_TERRAIN_POND;
if (MetatileBehavior_IsBridge(tileBehavior) == TRUE)
if (MetatileBehavior_IsBridgeOverWater(tileBehavior) == TRUE)
return BATTLE_TERRAIN_WATER;
}
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(ROUTE113) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE113))

View File

@ -729,9 +729,9 @@ static bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileB
DoTeleportTileWarp();
return TRUE;
}
if (MetatileBehavior_IsWarpOrBridge(metatileBehavior) == TRUE)
if (MetatileBehavior_IsBridgeOverOcean(metatileBehavior) == TRUE)
{
// Maybe unused? This MB is used by log bridges, but there's never a warp event on them
// Maybe unused? This MB is used by log bridges, but there's never a warp event on them.
DoSpinExitWarp();
return TRUE;
}
@ -762,7 +762,7 @@ static bool8 IsWarpMetatileBehavior(u16 metatileBehavior)
&& MetatileBehavior_IsAquaHideoutWarp(metatileBehavior) != TRUE
&& MetatileBehavior_IsMtPyreHole(metatileBehavior) != TRUE
&& MetatileBehavior_IsMossdeepGymWarp(metatileBehavior) != TRUE
&& MetatileBehavior_IsWarpOrBridge(metatileBehavior) != TRUE)
&& MetatileBehavior_IsBridgeOverOcean(metatileBehavior) != TRUE)
return FALSE;
return TRUE;
}

View File

@ -71,9 +71,15 @@ static s16 GetReflectionVerticalOffset(struct ObjectEvent *objectEvent)
static void LoadObjectReflectionPalette(struct ObjectEvent *objectEvent, struct Sprite *reflectionSprite)
{
u8 bridgeType;
u16 bridgeReflectionVerticalOffsets[] = { 12, 28, 44 };
u16 bridgeReflectionVerticalOffsets[] = {
[BRIDGE_TYPE_POND_LOW - 1] = 12,
[BRIDGE_TYPE_POND_MED - 1] = 28,
[BRIDGE_TYPE_POND_HIGH - 1] = 44
};
reflectionSprite->sReflectionVerticalOffset = 0;
if (!GetObjectEventGraphicsInfo(objectEvent->graphicsId)->disableReflectionPaletteLoad && ((bridgeType = MetatileBehavior_GetBridgeType(objectEvent->previousMetatileBehavior)) || (bridgeType = MetatileBehavior_GetBridgeType(objectEvent->currentMetatileBehavior))))
if (!GetObjectEventGraphicsInfo(objectEvent->graphicsId)->disableReflectionPaletteLoad
&& ((bridgeType = MetatileBehavior_GetBridgeType(objectEvent->previousMetatileBehavior))
|| (bridgeType = MetatileBehavior_GetBridgeType(objectEvent->currentMetatileBehavior))))
{
reflectionSprite->sReflectionVerticalOffset = bridgeReflectionVerticalOffsets[bridgeType - 1];
LoadObjectHighBridgeReflectionPalette(objectEvent, reflectionSprite->oam.paletteNum);

View File

@ -116,8 +116,8 @@ static void HideFrontierExchangeCornerItemIcon(u16 menu, u16 unused);
static void ShowBattleFrontierTutorMoveDescription(u8 menu, u16 selection);
static void CloseScrollableMultichoice(u8 taskId);
static void ScrollableMultichoice_RemoveScrollArrows(u8 taskId);
static void sub_813A600(u8 taskId);
static void sub_813A664(u8 taskId);
static void Task_ScrollableMultichoice_WaitReturnToList(u8 taskId);
static void Task_ScrollableMultichoice_ReturnToList(u8 taskId);
static void ShowFrontierExchangeCornerItemIcon(u16 item);
static void Task_DeoxysRockInteraction(u8 taskId);
static void ChangeDeoxysRockLevel(u8 a0);
@ -2702,10 +2702,10 @@ static void ScrollableMultichoice_ProcessInput(u8 taskId)
{
CloseScrollableMultichoice(taskId);
}
else
else // Handle selection while keeping the menu open
{
ScrollableMultichoice_RemoveScrollArrows(taskId);
task->func = sub_813A600;
task->func = Task_ScrollableMultichoice_WaitReturnToList;
EnableBothScriptContexts();
}
break;
@ -2729,36 +2729,32 @@ static void CloseScrollableMultichoice(u8 taskId)
EnableBothScriptContexts();
}
// Functionally unused; tKeepOpenAfterSelect is only != 0 in unused functions
static void sub_813A600(u8 taskId)
// Never run, tKeepOpenAfterSelect is FALSE for all scrollable multichoices.
static void Task_ScrollableMultichoice_WaitReturnToList(u8 taskId)
{
switch (gTasks[taskId].tKeepOpenAfterSelect)
{
case 1:
default:
break;
case 2:
gTasks[taskId].tKeepOpenAfterSelect = 1;
gTasks[taskId].func = sub_813A664;
break;
case 1:
default:
break;
case 2:
gTasks[taskId].tKeepOpenAfterSelect = 1;
gTasks[taskId].func = Task_ScrollableMultichoice_ReturnToList;
break;
}
}
// Never called
void sub_813A630(void)
void ScrollableMultichoice_TryReturnToList(void)
{
u8 taskId = FindTaskIdByFunc(sub_813A600);
u8 taskId = FindTaskIdByFunc(Task_ScrollableMultichoice_WaitReturnToList);
if (taskId == TASK_NONE)
{
EnableBothScriptContexts();
}
else
{
gTasks[taskId].tKeepOpenAfterSelect++;
}
gTasks[taskId].tKeepOpenAfterSelect++; // Return to list
}
static void sub_813A664(u8 taskId)
static void Task_ScrollableMultichoice_ReturnToList(u8 taskId)
{
ScriptContext2_Enable();
ScrollableMultichoice_UpdateScrollArrows(taskId);
@ -2807,23 +2803,7 @@ static void ScrollableMultichoice_RemoveScrollArrows(u8 taskId)
// Removed for Emerald (replaced by ShowScrollableMultichoice)
void ShowGlassWorkshopMenu(void)
{
/*
u8 i;
ScriptContext2_Enable();
Menu_DrawStdWindowFrame(0, 0, 10, 11);
InitMenu(0, 1, 1, 5, 0, 9);
gUnknown_0203925C = 0;
ClearVerticalScrollIndicatorPalettes();
LoadScrollIndicatorPalette();
sub_810F2B4();
for (i = 0; i < 5; i++)
{
Menu_PrintText(gUnknown_083F83C0[i], 1, 2 * i + 1);
}
gUnknown_0203925B = 0;
gUnknown_0203925A = ARRAY_COUNT(gUnknown_083F83C0);
CreateTask(sub_810F118, 8);
*/
}
void SetBattleTowerLinkPlayerGfx(void)
@ -3252,11 +3232,11 @@ void CloseBattleFrontierTutorWindow(void)
}
// Never called
void sub_813ADD4(void)
void ScrollableMultichoice_RedrawPersistentMenu(void)
{
u16 scrollOffset, selectedRow;
u8 i;
u8 taskId = FindTaskIdByFunc(sub_813A600);
u8 taskId = FindTaskIdByFunc(Task_ScrollableMultichoice_WaitReturnToList);
if (taskId != TASK_NONE)
{
struct Task *task = &gTasks[taskId];
@ -3264,9 +3244,7 @@ void sub_813ADD4(void)
SetStandardWindowBorderStyle(task->tWindowId, 0);
for (i = 0; i < MAX_SCROLL_MULTI_ON_SCREEN; i++)
{
AddTextPrinterParameterized5(task->tWindowId, 1, sScrollableMultichoiceOptions[gSpecialVar_0x8004][scrollOffset + i], 10, i * 16, TEXT_SPEED_FF, NULL, 0, 0);
}
AddTextPrinterParameterized(task->tWindowId, 1, gText_SelectorArrow, 0, selectedRow * 16, TEXT_SPEED_FF, NULL);
PutWindowTilemap(task->tWindowId);
@ -3313,9 +3291,10 @@ void GetBattleFrontierTutorMoveIndex(void)
}
// Never called
void sub_813AF48(void)
// Close a scrollable multichoice that stays open after selection
void ScrollableMultichoice_ClosePersistentMenu(void)
{
u8 taskId = FindTaskIdByFunc(sub_813A600);
u8 taskId = FindTaskIdByFunc(Task_ScrollableMultichoice_WaitReturnToList);
if (taskId != TASK_NONE)
{
struct Task *task = &gTasks[taskId];

View File

@ -586,7 +586,7 @@ static void Task_Hof_DisplayMon(u8 taskId)
if (currMon->species == SPECIES_EGG)
destY += 10;
spriteId = CreatePicSprite2(currMon->species, currMon->tid, currMon->personality, 1, startX, startY, currMonId, TAG_NONE);
spriteId = CreateMonPicSprite_Affine(currMon->species, currMon->tid, currMon->personality, MON_PIC_AFFINE_FRONT, startX, startY, currMonId, TAG_NONE);
gSprites[spriteId].tDestinationX = destX;
gSprites[spriteId].tDestinationY = destY;
gSprites[spriteId].data[0] = 0;

View File

@ -34,32 +34,32 @@ int GetStringWidthDifference(int fontId, const u8 *str, int totalWidth, int lett
return 0;
}
int GetMaxWidthInMenuTable(const struct MenuAction *str, int numActions)
int GetMaxWidthInMenuTable(const struct MenuAction *actions, int numActions)
{
int i, var;
int i, maxWidth;
for (var = 0, i = 0; i < numActions; i++)
for (maxWidth = 0, i = 0; i < numActions; i++)
{
int stringWidth = GetStringWidth(1, str[i].text, 0);
if (stringWidth > var)
var = stringWidth;
int stringWidth = GetStringWidth(1, actions[i].text, 0);
if (stringWidth > maxWidth)
maxWidth = stringWidth;
}
return ConvertPixelWidthToTileWidth(var);
return ConvertPixelWidthToTileWidth(maxWidth);
}
int sub_81DB3D8(const struct MenuAction *str, const u8* arg1, int arg2)
int GetMaxWidthInSubsetOfMenuTable(const struct MenuAction *actions, const u8* actionIds, int numActions)
{
int i, var;
int i, maxWidth;
for (var = 0, i = 0; i < arg2; i++)
for (maxWidth = 0, i = 0; i < numActions; i++)
{
int stringWidth = GetStringWidth(1, str[arg1[i]].text, 0);
if (stringWidth > var)
var = stringWidth;
int stringWidth = GetStringWidth(1, actions[actionIds[i]].text, 0);
if (stringWidth > maxWidth)
maxWidth = stringWidth;
}
return ConvertPixelWidthToTileWidth(var);
return ConvertPixelWidthToTileWidth(maxWidth);
}
int Intl_GetListMenuWidth(const struct ListMenuTemplate *listMenu)
@ -93,32 +93,29 @@ void CopyMonCategoryText(int dexNum, u8 *dest)
StringCopy(str + 1, gText_Pokemon);
}
u8 *sub_81DB494(u8 *str, int fontId, const u8 *str2, int totalStringWidth)
u8 *GetStringClearToWidth(u8 *dest, int fontId, const u8 *str, int totalStringWidth)
{
u8 *buffer;
int width;
int clearWidth;
if (str2)
if (str)
{
buffer = StringCopy(str, str2);
width = GetStringWidth(fontId, str2, 0);
buffer = StringCopy(dest, str);
width = GetStringWidth(fontId, str, 0);
}
else
{
buffer = str;
buffer = dest;
width = 0;
}
clearWidth = totalStringWidth - width;
if (clearWidth > 0)
{
*buffer = EXT_CTRL_CODE_BEGIN;
buffer++;
*buffer = EXT_CTRL_CODE_CLEAR;
buffer++;
*buffer = clearWidth;
buffer++;
*(buffer++) = EXT_CTRL_CODE_BEGIN;
*(buffer++) = EXT_CTRL_CODE_CLEAR;
*(buffer++) = clearWidth;
*buffer = EOS;
}
@ -209,7 +206,7 @@ void TVShowConvertInternationalString(u8 *dest, const u8 *src, int language)
ConvertInternationalString(dest, language);
}
int sub_81DB604(u8 *str)
int GetNicknameLanguage(u8 *str)
{
if (str[0] == EXT_CTRL_CODE_BEGIN && str[1] == EXT_CTRL_CODE_JPN)
return LANGUAGE_JAPANESE;

View File

@ -249,7 +249,7 @@ static bool32 CanFish(void)
{
if (MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior) && !MapGridIsImpassableAt(x, y))
return TRUE;
if (MetatileBehavior_8089510(tileBehavior) == TRUE)
if (MetatileBehavior_IsBridgeOverWaterNoEdge(tileBehavior) == TRUE)
return TRUE;
}

View File

@ -1871,9 +1871,9 @@ static void SpriteCB_MovePlayerDownWhileShrinking(struct Sprite *sprite)
sprite->data[0] = y;
}
static u8 NewGameBirchSpeech_CreateLotadSprite(u8 a, u8 b)
static u8 NewGameBirchSpeech_CreateLotadSprite(u8 x, u8 y)
{
return CreatePicSprite2(SPECIES_LOTAD, SHINY_ODDS, 0, 1, a, b, 14, -1);
return CreateMonPicSprite_Affine(SPECIES_LOTAD, SHINY_ODDS, 0, MON_PIC_AFFINE_FRONT, x, y, 14, TAG_NONE);
}
static void AddBirchSpeechObjects(u8 taskId)

File diff suppressed because it is too large Load Diff

View File

@ -122,22 +122,22 @@ static const u8 sTileBitAttributes[] =
[MB_WATER_SOUTH_ARROW_WARP] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
[MB_DEEP_SOUTH_WARP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_UNUSED_6F] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
[MB_WARP_OR_BRIDGE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
[MB_UNUSED_71] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_ROUTE120_NORTH_BRIDGE_1] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_ROUTE120_NORTH_BRIDGE_2] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_BRIDGE_OVER_OCEAN] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
[MB_BRIDGE_OVER_POND_LOW] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_BRIDGE_OVER_POND_MED] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_BRIDGE_OVER_POND_HIGH] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_PACIFIDLOG_VERTICAL_LOG_1] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_PACIFIDLOG_VERTICAL_LOG_2] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_PACIFIDLOG_HORIZONTAL_LOG_1] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_PACIFIDLOG_HORIZONTAL_LOG_2] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_FORTREE_BRIDGE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_UNUSED_79] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
[MB_ROUTE120_SOUTH_BRIDGE_1] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_ROUTE120_SOUTH_BRIDGE_2] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_ROUTE120_NORTH_BRIDGE_3] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_ROUTE120_NORTH_BRIDGE_4] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_UNUSED_7E] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_ROUTE110_BRIDGE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_BRIDGE_OVER_POND_MED_EDGE_1] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_BRIDGE_OVER_POND_MED_EDGE_2] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_BRIDGE_OVER_POND_HIGH_EDGE_1] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_BRIDGE_OVER_POND_HIGH_EDGE_2] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_UNUSED_BRIDGE_1] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_UNUSED_BRIDGE_2] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_COUNTER] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
[MB_UNUSED_81] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
[MB_UNUSED_82] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
@ -833,7 +833,9 @@ bool8 MetatileBehavior_IsPlayerRoomPCOn(u8 metatileBehavior)
bool8 MetatileBehavior_HasRipples(u8 metatileBehavior)
{
if (metatileBehavior == MB_POND_WATER || metatileBehavior == MB_PUDDLE || metatileBehavior == MB_SOOTOPOLIS_DEEP_WATER)
if (metatileBehavior == MB_POND_WATER
|| metatileBehavior == MB_PUDDLE
|| metatileBehavior == MB_SOOTOPOLIS_DEEP_WATER)
return TRUE;
else
return FALSE;
@ -888,10 +890,19 @@ bool8 MetatileBehavior_IsFootprints(u8 metatileBehavior)
return FALSE;
}
bool8 MetatileBehavior_IsBridge(u8 metatileBehavior)
// For the sections of log bridges that span water / water's edge.
// Note that the rest of the metatiles for these bridges use MB_NORMAL.
// This is used to allow encounters on the water below the bridge.
bool8 MetatileBehavior_IsBridgeOverWater(u8 metatileBehavior)
{
if ((metatileBehavior == MB_WARP_OR_BRIDGE || metatileBehavior == MB_UNUSED_71 || metatileBehavior == MB_ROUTE120_NORTH_BRIDGE_1 || metatileBehavior == MB_ROUTE120_NORTH_BRIDGE_2)
|| (metatileBehavior == MB_ROUTE120_NORTH_BRIDGE_3 || metatileBehavior == MB_ROUTE120_NORTH_BRIDGE_4 || metatileBehavior == MB_UNUSED_7E || metatileBehavior == MB_ROUTE110_BRIDGE))
if ((metatileBehavior == MB_BRIDGE_OVER_OCEAN
|| metatileBehavior == MB_BRIDGE_OVER_POND_LOW
|| metatileBehavior == MB_BRIDGE_OVER_POND_MED
|| metatileBehavior == MB_BRIDGE_OVER_POND_HIGH)
|| (metatileBehavior == MB_BRIDGE_OVER_POND_HIGH_EDGE_1
|| metatileBehavior == MB_BRIDGE_OVER_POND_HIGH_EDGE_2
|| metatileBehavior == MB_UNUSED_BRIDGE_1
|| metatileBehavior == MB_UNUSED_BRIDGE_2))
return TRUE;
else
return FALSE;
@ -899,34 +910,39 @@ bool8 MetatileBehavior_IsBridge(u8 metatileBehavior)
u8 MetatileBehavior_GetBridgeType(u8 metatileBehavior)
{
u8 result = metatileBehavior - MB_WARP_OR_BRIDGE;
if (result < 4)
return result;
// MB_BRIDGE_OVER_OCEAN --> BRIDGE_TYPE_OCEAN (Routes 110/119)
// MB_BRIDGE_OVER_POND_LOW --> BRIDGE_TYPE_POND_LOW (Unused)
// MB_BRIDGE_OVER_POND_MED --> BRIDGE_TYPE_POND_MED (Route 120, south)
// MB_BRIDGE_OVER_POND_HIGH --> BRIDGE_TYPE_POND_HIGH (Route 120, north)
if (metatileBehavior >= MB_BRIDGE_OVER_OCEAN
&& metatileBehavior <= MB_BRIDGE_OVER_POND_HIGH)
return metatileBehavior - MB_BRIDGE_OVER_OCEAN;
result = metatileBehavior - MB_ROUTE120_SOUTH_BRIDGE_1;
if (result < 2)
return 2;
if (metatileBehavior >= MB_BRIDGE_OVER_POND_MED_EDGE_1
&& metatileBehavior <= MB_BRIDGE_OVER_POND_MED_EDGE_2)
return BRIDGE_TYPE_POND_MED;
result = metatileBehavior - MB_ROUTE120_NORTH_BRIDGE_3;
if (result < 2)
return 3;
if (metatileBehavior >= MB_BRIDGE_OVER_POND_HIGH_EDGE_1
&& metatileBehavior <= MB_BRIDGE_OVER_POND_HIGH_EDGE_2)
return BRIDGE_TYPE_POND_HIGH;
return 0;
return BRIDGE_TYPE_OCEAN;
}
u8 MetatileBehavior_8089510(u8 metatileBehavior)
// Used to allow fishing below the bridge metatiles.
bool8 MetatileBehavior_IsBridgeOverWaterNoEdge(u8 metatileBehavior)
{
u8 result = metatileBehavior - MB_WARP_OR_BRIDGE;
if (result < 4)
return 1;
if (metatileBehavior >= MB_BRIDGE_OVER_OCEAN
&& metatileBehavior <= MB_BRIDGE_OVER_POND_HIGH)
return TRUE;
else
return 0;
return FALSE;
}
bool8 MetatileBehavior_IsLandWildEncounter(u8 metatileBehavior)
{
if (MetatileBehavior_IsSurfableWaterOrUnderwater(metatileBehavior) == FALSE && MetatileBehavior_IsEncounterTile(metatileBehavior) == TRUE)
if (MetatileBehavior_IsSurfableWaterOrUnderwater(metatileBehavior) == FALSE
&& MetatileBehavior_IsEncounterTile(metatileBehavior) == TRUE)
return TRUE;
else
return FALSE;
@ -934,7 +950,8 @@ bool8 MetatileBehavior_IsLandWildEncounter(u8 metatileBehavior)
bool8 MetatileBehavior_IsWaterWildEncounter(u8 metatileBehavior)
{
if (MetatileBehavior_IsSurfableWaterOrUnderwater(metatileBehavior) == TRUE && MetatileBehavior_IsEncounterTile(metatileBehavior) == TRUE)
if (MetatileBehavior_IsSurfableWaterOrUnderwater(metatileBehavior) == TRUE
&& MetatileBehavior_IsEncounterTile(metatileBehavior) == TRUE)
return TRUE;
else
return FALSE;
@ -1148,8 +1165,10 @@ bool8 MetatileBehavior_IsPacifidlogHorizontalLog2(u8 metatileBehavior)
bool8 MetatileBehavior_IsPacifidlogLog(u8 metatileBehavior)
{
if (metatileBehavior == MB_PACIFIDLOG_VERTICAL_LOG_1 || metatileBehavior == MB_PACIFIDLOG_VERTICAL_LOG_2
|| metatileBehavior == MB_PACIFIDLOG_HORIZONTAL_LOG_1 || metatileBehavior == MB_PACIFIDLOG_HORIZONTAL_LOG_2)
if (metatileBehavior == MB_PACIFIDLOG_VERTICAL_LOG_1
|| metatileBehavior == MB_PACIFIDLOG_VERTICAL_LOG_2
|| metatileBehavior == MB_PACIFIDLOG_HORIZONTAL_LOG_1
|| metatileBehavior == MB_PACIFIDLOG_HORIZONTAL_LOG_2)
return TRUE;
else
return FALSE;
@ -1243,9 +1262,13 @@ bool8 MetatileBehavior_IsAquaHideoutWarp(u8 metatileBehavior)
return FALSE;
}
bool8 MetatileBehavior_IsWarpOrBridge(u8 metatileBehavior)
// Very odd, used to initiate a teleport-style warp.
// No warp events seem to be on a metatile of this kind, and it's
// used by log bridges over ocean-style water, which wouldn't make
// sense to have a warp like this.
bool8 MetatileBehavior_IsBridgeOverOcean(u8 metatileBehavior)
{
if (metatileBehavior == MB_WARP_OR_BRIDGE)
if (metatileBehavior == MB_BRIDGE_OVER_OCEAN)
return TRUE;
else
return FALSE;
@ -1262,9 +1285,15 @@ bool8 MetatileBehavior_IsMossdeepGymWarp(u8 metatileBehavior)
bool8 MetatileBehavior_IsSurfableFishableWater(u8 metatileBehavior)
{
if (metatileBehavior == MB_POND_WATER || metatileBehavior == MB_OCEAN_WATER || metatileBehavior == MB_SEMI_DEEP_WATER || metatileBehavior == MB_DEEP_WATER
|| metatileBehavior == MB_SOOTOPOLIS_DEEP_WATER || (metatileBehavior == MB_EASTWARD_CURRENT || metatileBehavior == MB_WESTWARD_CURRENT
|| metatileBehavior == MB_NORTHWARD_CURRENT || metatileBehavior == MB_SOUTHWARD_CURRENT))
if (metatileBehavior == MB_POND_WATER
|| metatileBehavior == MB_OCEAN_WATER
|| metatileBehavior == MB_SEMI_DEEP_WATER
|| metatileBehavior == MB_DEEP_WATER
|| metatileBehavior == MB_SOOTOPOLIS_DEEP_WATER
|| (metatileBehavior == MB_EASTWARD_CURRENT
|| metatileBehavior == MB_WESTWARD_CURRENT
|| metatileBehavior == MB_NORTHWARD_CURRENT
|| metatileBehavior == MB_SOUTHWARD_CURRENT))
return TRUE;
else
return FALSE;

View File

@ -396,7 +396,7 @@ static void InitPlayerPCMenu(u8 taskId)
else // Bedroom PC
windowTemplate = sWindowTemplates_MainMenus[WIN_MAIN_MENU_BEDROOM];
windowTemplate.width = sub_81DB3D8(sPlayerPCMenuActions, sTopMenuOptionOrder, sTopMenuNumOptions);
windowTemplate.width = GetMaxWidthInSubsetOfMenuTable(sPlayerPCMenuActions, sTopMenuOptionOrder, sTopMenuNumOptions);
tWindowId = AddWindow(&windowTemplate);
SetStandardWindowBorderStyle(tWindowId, 0);
sub_81995E4(tWindowId, sTopMenuNumOptions, sPlayerPCMenuActions, sTopMenuOptionOrder);

View File

@ -104,13 +104,15 @@ enum
#define POKEBALL_ROTATION_TOP 64
#define POKEBALL_ROTATION_BOTTOM (POKEBALL_ROTATION_TOP - 16)
// EWRAM
// Coordinates of the Pokémon sprite on its page (info/cry screens)
#define MON_PAGE_X 48
#define MON_PAGE_Y 56
static EWRAM_DATA struct PokedexView *sPokedexView = NULL;
static EWRAM_DATA u16 sLastSelectedPokemon = 0;
static EWRAM_DATA u8 sPokeBallRotation = 0;
static EWRAM_DATA struct PokedexListItem *sPokedexListItem = NULL;
// IWRAM common
// This is written to, but never read.
u8 gUnusedPokedexU8;
void (*gPokedexVBlankCB)(void);
@ -239,7 +241,7 @@ static void SpriteCB_DexListStartMenuCursor(struct Sprite *sprite);
static void SpriteCB_PokedexListMonSprite(struct Sprite *sprite);
static u8 LoadInfoScreen(struct PokedexListItem*, u8 monSpriteId);
static bool8 IsInfoScreenScrolling(u8);
static u8 sub_80BE9F8(struct PokedexListItem*, u8);
static u8 StartInfoScreenScroll(struct PokedexListItem*, u8);
static void Task_LoadInfoScreen(u8);
static void Task_HandleInfoScreenInput(u8);
static void Task_SwitchScreensFromInfoScreen(u8);
@ -268,7 +270,7 @@ static void PrintMonHeight(u16 height, u8 left, u8 top);
static void PrintMonWeight(u16 weight, u8 left, u8 top);
static void ResetOtherVideoRegisters(u16);
static u8 PrintCryScreenSpeciesName(u8, u16, u8, u8);
static void PrintFootprint(u8 windowId, u16 dexNum);
static void DrawFootprint(u8 windowId, u16 dexNum);
static u16 CreateSizeScreenTrainerPic(u16, s16, s16, s8);
static u16 GetNextPosition(u8, u16, u16, u16);
static u8 LoadSearchMenu(void);
@ -1655,7 +1657,7 @@ void Task_OpenPokedexMainPage(u8 taskId)
gTasks[taskId].func = Task_HandlePokedexInput;
}
#define tTaskId data[0]
#define tLoadScreenTaskId data[0]
static void Task_HandlePokedexInput(u8 taskId)
{
@ -1667,7 +1669,7 @@ static void Task_HandlePokedexInput(u8 taskId)
}
else
{
if ((JOY_NEW(A_BUTTON)) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen)
if (JOY_NEW(A_BUTTON) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen)
{
UpdateSelectedMonSpriteId();
BeginNormalPaletteFade(~(1 << (gSprites[sPokedexView->selectedMonSpriteId].oam.paletteNum + 16)), 0, 0, 0x10, RGB_BLACK);
@ -1688,7 +1690,7 @@ static void Task_HandlePokedexInput(u8 taskId)
{
PlaySE(SE_SELECT);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK);
gTasks[taskId].tTaskId = LoadSearchMenu();
gTasks[taskId].tLoadScreenTaskId = LoadSearchMenu();
sPokedexView->screenSwitchState = 0;
sPokedexView->pokeBallRotationBackup = sPokedexView->pokeBallRotation;
sPokedexView->selectedPokemonBackup = sPokedexView->selectedPokemon;
@ -1768,12 +1770,12 @@ static void Task_HandlePokedexStartMenuInput(u8 taskId)
gTasks[taskId].func = Task_HandlePokedexInput;
PlaySE(SE_SELECT);
}
else if ((JOY_REPEAT(DPAD_UP)) && sPokedexView->menuCursorPos != 0)
else if (JOY_REPEAT(DPAD_UP) && sPokedexView->menuCursorPos != 0)
{
sPokedexView->menuCursorPos--;
PlaySE(SE_SELECT);
}
else if ((JOY_REPEAT(DPAD_DOWN)) && sPokedexView->menuCursorPos < 3)
else if (JOY_REPEAT(DPAD_DOWN) && sPokedexView->menuCursorPos < 3)
{
sPokedexView->menuCursorPos++;
PlaySE(SE_SELECT);
@ -1781,25 +1783,28 @@ static void Task_HandlePokedexStartMenuInput(u8 taskId)
}
}
// Opening the info screen from list view. Pokémon sprite is moving to its new position, wait for it to arrive
static void Task_OpenInfoScreenAfterMonMovement(u8 taskId)
{
if (gSprites[sPokedexView->selectedMonSpriteId].x == 48 && gSprites[sPokedexView->selectedMonSpriteId].y == 56)
if (gSprites[sPokedexView->selectedMonSpriteId].x == MON_PAGE_X && gSprites[sPokedexView->selectedMonSpriteId].y == MON_PAGE_Y)
{
sPokedexView->currentPageBackup = sPokedexView->currentPage;
gTasks[taskId].tTaskId = LoadInfoScreen(&sPokedexView->pokedexList[sPokedexView->selectedPokemon], sPokedexView->selectedMonSpriteId);
gTasks[taskId].tLoadScreenTaskId = LoadInfoScreen(&sPokedexView->pokedexList[sPokedexView->selectedPokemon], sPokedexView->selectedMonSpriteId);
gTasks[taskId].func = Task_WaitForExitInfoScreen;
}
}
static void Task_WaitForExitInfoScreen(u8 taskId)
{
if (gTasks[gTasks[taskId].tTaskId].isActive)
if (gTasks[gTasks[taskId].tLoadScreenTaskId].isActive)
{
if (sPokedexView->currentPage == PAGE_INFO && !IsInfoScreenScrolling(gTasks[taskId].tTaskId) && TryDoInfoScreenScroll())
sub_80BE9F8(&sPokedexView->pokedexList[sPokedexView->selectedPokemon], gTasks[taskId].tTaskId);
// While active, handle scroll input
if (sPokedexView->currentPage == PAGE_INFO && !IsInfoScreenScrolling(gTasks[taskId].tLoadScreenTaskId) && TryDoInfoScreenScroll())
StartInfoScreenScroll(&sPokedexView->pokedexList[sPokedexView->selectedPokemon], gTasks[taskId].tLoadScreenTaskId);
}
else
{
// Exiting, back to list view
sLastSelectedPokemon = sPokedexView->selectedPokemon;
sPokeBallRotation = sPokedexView->pokeBallRotation;
gTasks[taskId].func = Task_OpenPokedexMainPage;
@ -1808,7 +1813,7 @@ static void Task_WaitForExitInfoScreen(u8 taskId)
static void Task_WaitForExitSearch(u8 taskId)
{
if (!gTasks[gTasks[taskId].tTaskId].isActive)
if (!gTasks[gTasks[taskId].tLoadScreenTaskId].isActive)
{
ClearMonSprites();
@ -1867,7 +1872,7 @@ static void Task_HandleSearchResultsInput(u8 taskId)
}
else
{
if ((JOY_NEW(A_BUTTON)) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen)
if (JOY_NEW(A_BUTTON) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen)
{
u32 a;
@ -1890,7 +1895,7 @@ static void Task_HandleSearchResultsInput(u8 taskId)
else if (JOY_NEW(SELECT_BUTTON))
{
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK);
gTasks[taskId].tTaskId = LoadSearchMenu();
gTasks[taskId].tLoadScreenTaskId = LoadSearchMenu();
sPokedexView->screenSwitchState = 0;
gTasks[taskId].func = Task_WaitForExitSearch;
PlaySE(SE_PC_LOGIN);
@ -1970,12 +1975,12 @@ static void Task_HandleSearchResultsStartMenuInput(u8 taskId)
gTasks[taskId].func = Task_HandleSearchResultsInput;
PlaySE(SE_SELECT);
}
else if ((JOY_REPEAT(DPAD_UP)) && sPokedexView->menuCursorPos)
else if (JOY_REPEAT(DPAD_UP) && sPokedexView->menuCursorPos)
{
sPokedexView->menuCursorPos--;
PlaySE(SE_SELECT);
}
else if ((JOY_REPEAT(DPAD_DOWN)) && sPokedexView->menuCursorPos < 4)
else if (JOY_REPEAT(DPAD_DOWN) && sPokedexView->menuCursorPos < 4)
{
sPokedexView->menuCursorPos++;
PlaySE(SE_SELECT);
@ -1985,10 +1990,10 @@ static void Task_HandleSearchResultsStartMenuInput(u8 taskId)
static void Task_OpenSearchResultsInfoScreenAfterMonMovement(u8 taskId)
{
if (gSprites[sPokedexView->selectedMonSpriteId].x == 48 && gSprites[sPokedexView->selectedMonSpriteId].y == 56)
if (gSprites[sPokedexView->selectedMonSpriteId].x == MON_PAGE_X && gSprites[sPokedexView->selectedMonSpriteId].y == MON_PAGE_Y)
{
sPokedexView->currentPageBackup = sPokedexView->currentPage;
gTasks[taskId].tTaskId = LoadInfoScreen(&sPokedexView->pokedexList[sPokedexView->selectedPokemon], sPokedexView->selectedMonSpriteId);
gTasks[taskId].tLoadScreenTaskId = LoadInfoScreen(&sPokedexView->pokedexList[sPokedexView->selectedPokemon], sPokedexView->selectedMonSpriteId);
sPokedexView->selectedMonSpriteId = -1;
gTasks[taskId].func = Task_WaitForExitSearchResultsInfoScreen;
}
@ -1996,13 +2001,15 @@ static void Task_OpenSearchResultsInfoScreenAfterMonMovement(u8 taskId)
static void Task_WaitForExitSearchResultsInfoScreen(u8 taskId)
{
if (gTasks[gTasks[taskId].tTaskId].isActive)
if (gTasks[gTasks[taskId].tLoadScreenTaskId].isActive)
{
if (sPokedexView->currentPage == PAGE_INFO && !IsInfoScreenScrolling(gTasks[taskId].tTaskId) && TryDoInfoScreenScroll())
sub_80BE9F8(&sPokedexView->pokedexList[sPokedexView->selectedPokemon], gTasks[taskId].tTaskId);
// While active, handle scroll input
if (sPokedexView->currentPage == PAGE_INFO && !IsInfoScreenScrolling(gTasks[taskId].tLoadScreenTaskId) && TryDoInfoScreenScroll())
StartInfoScreenScroll(&sPokedexView->pokedexList[sPokedexView->selectedPokemon], gTasks[taskId].tLoadScreenTaskId);
}
else
{
// Exiting, back to search results
gTasks[taskId].func = Task_OpenSearchResults;
}
}
@ -2037,7 +2044,7 @@ static void Task_ClosePokedexFromSearchResultsStartMenu(u8 taskId)
}
}
#undef tTaskId
#undef tLoadScreenTaskId
// For loading main pokedex page or pokedex search results
static bool8 LoadPokedexListPage(u8 page)
@ -2584,7 +2591,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored)
u16 startingPos;
u8 scrollDir = 0;
if ((JOY_HELD(DPAD_UP)) && (selectedMon > 0))
if (JOY_HELD(DPAD_UP) && (selectedMon > 0))
{
scrollDir = 1;
selectedMon = GetNextPosition(1, selectedMon, 0, sPokedexView->pokemonListCount - 1);
@ -2592,7 +2599,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored)
CreateMonListEntry(1, selectedMon, ignored);
PlaySE(SE_DEX_SCROLL);
}
else if ((JOY_HELD(DPAD_DOWN)) && (selectedMon < sPokedexView->pokemonListCount - 1))
else if (JOY_HELD(DPAD_DOWN) && (selectedMon < sPokedexView->pokemonListCount - 1))
{
scrollDir = 2;
selectedMon = GetNextPosition(0, selectedMon, 0, sPokedexView->pokemonListCount - 1);
@ -2600,7 +2607,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored)
CreateMonListEntry(2, selectedMon, ignored);
PlaySE(SE_DEX_SCROLL);
}
else if ((JOY_NEW(DPAD_LEFT)) && (selectedMon > 0))
else if (JOY_NEW(DPAD_LEFT) && (selectedMon > 0))
{
startingPos = selectedMon;
@ -2611,7 +2618,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored)
CreateMonSpritesAtPos(selectedMon, 0xE);
PlaySE(SE_DEX_PAGE);
}
else if ((JOY_NEW(DPAD_RIGHT)) && (selectedMon < sPokedexView->pokemonListCount - 1))
else if (JOY_NEW(DPAD_RIGHT) && (selectedMon < sPokedexView->pokemonListCount - 1))
{
startingPos = selectedMon;
for (i = 0; i < 7; i++)
@ -2660,7 +2667,7 @@ static bool8 TryDoInfoScreenScroll(void)
u16 nextPokemon;
u16 selectedPokemon = sPokedexView->selectedPokemon;
if ((JOY_NEW(DPAD_UP)) && selectedPokemon)
if (JOY_NEW(DPAD_UP) && selectedPokemon)
{
nextPokemon = selectedPokemon;
while (nextPokemon != 0)
@ -2683,7 +2690,7 @@ static bool8 TryDoInfoScreenScroll(void)
return TRUE;
}
}
else if ((JOY_NEW(DPAD_DOWN)) && selectedPokemon < sPokedexView->pokemonListCount - 1)
else if (JOY_NEW(DPAD_DOWN) && selectedPokemon < sPokedexView->pokemonListCount - 1)
{
nextPokemon = selectedPokemon;
while (nextPokemon < sPokedexView->pokemonListCount - 1)
@ -3000,16 +3007,16 @@ void SpriteCB_MoveMonForInfoScreen(struct Sprite *sprite)
sprite->oam.affineMode = ST_OAM_AFFINE_OFF;
sprite->x2 = 0;
sprite->y2 = 0;
if (sprite->x != 48 || sprite->y != 56)
if (sprite->x != MON_PAGE_X || sprite->y != MON_PAGE_Y)
{
if (sprite->x > 48)
if (sprite->x > MON_PAGE_X)
sprite->x--;
if (sprite->x < 48)
if (sprite->x < MON_PAGE_X)
sprite->x++;
if (sprite->y > 56)
if (sprite->y > MON_PAGE_Y)
sprite->y--;
if (sprite->y < 56)
if (sprite->y < MON_PAGE_Y)
sprite->y++;
}
else
@ -3163,7 +3170,12 @@ static void PrintInfoScreenText(const u8* str, u8 left, u8 top)
AddTextPrinterParameterized4(0, 1, left, top, 0, 0, color, -1, str);
}
#define tMonSpriteId data[4]
#define tScrolling data[0]
#define tMonSpriteDone data[1]
#define tBgLoaded data[2]
#define tSkipCry data[3]
#define tMonSpriteId data[4]
#define tTrainerSpriteId data[5]
static u8 LoadInfoScreen(struct PokedexListItem* item, u8 monSpriteId)
{
@ -3171,12 +3183,12 @@ static u8 LoadInfoScreen(struct PokedexListItem* item, u8 monSpriteId)
sPokedexListItem = item;
taskId = CreateTask(Task_LoadInfoScreen, 0);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 1;
gTasks[taskId].data[2] = 0;
gTasks[taskId].data[3] = 0;
gTasks[taskId].tScrolling = FALSE;
gTasks[taskId].tMonSpriteDone = TRUE; // Already has sprite from list view
gTasks[taskId].tBgLoaded = FALSE;
gTasks[taskId].tSkipCry = FALSE;
gTasks[taskId].tMonSpriteId = monSpriteId;
gTasks[taskId].data[5] = 255;
gTasks[taskId].tTrainerSpriteId = SPRITE_NONE;
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sInfoScreen_BgTemplate, ARRAY_COUNT(sInfoScreen_BgTemplate));
SetBgTilemapBuffer(3, AllocZeroed(BG_SCREEN_SIZE));
@ -3191,19 +3203,19 @@ static u8 LoadInfoScreen(struct PokedexListItem* item, u8 monSpriteId)
static bool8 IsInfoScreenScrolling(u8 taskId)
{
if (gTasks[taskId].data[0] == 0 && gTasks[taskId].func == Task_HandleInfoScreenInput)
if (!gTasks[taskId].tScrolling && gTasks[taskId].func == Task_HandleInfoScreenInput)
return FALSE;
else
return TRUE;
}
static u8 sub_80BE9F8(struct PokedexListItem *item, u8 taskId)
static u8 StartInfoScreenScroll(struct PokedexListItem *item, u8 taskId)
{
sPokedexListItem = item;
gTasks[taskId].data[0] = 1;
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = 0;
gTasks[taskId].data[3] = 0;
gTasks[taskId].tScrolling = TRUE;
gTasks[taskId].tMonSpriteDone = FALSE;
gTasks[taskId].tBgLoaded = FALSE;
gTasks[taskId].tSkipCry = FALSE;
return taskId;
}
@ -3221,9 +3233,9 @@ static void Task_LoadInfoScreen(u8 taskId)
gPokedexVBlankCB = gMain.vblankCallback;
SetVBlankCallback(NULL);
r2 = 0;
if (gTasks[taskId].data[1] != 0)
if (gTasks[taskId].tMonSpriteDone)
r2 += DISPCNT_OBJ_ON;
if (gTasks[taskId].data[2] != 0)
if (gTasks[taskId].tBgLoaded)
r2 |= DISPCNT_BG1_ON;
ResetOtherVideoRegisters(r2);
gMain.state = 1;
@ -3235,7 +3247,7 @@ static void Task_LoadInfoScreen(u8 taskId)
FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0));
PutWindowTilemap(WIN_INFO);
PutWindowTilemap(WIN_FOOTPRINT);
PrintFootprint(WIN_FOOTPRINT, sPokedexListItem->dexNum);
DrawFootprint(WIN_FOOTPRINT, sPokedexListItem->dexNum);
CopyWindowToVram(WIN_FOOTPRINT, 2);
gMain.state++;
break;
@ -3259,9 +3271,9 @@ static void Task_LoadInfoScreen(u8 taskId)
gMain.state++;
break;
case 5:
if (gTasks[taskId].data[1] == 0)
if (!gTasks[taskId].tMonSpriteDone)
{
gTasks[taskId].tMonSpriteId = (u16)CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, 48, 56, 0);
gTasks[taskId].tMonSpriteId = (u16)CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, MON_PAGE_X, MON_PAGE_Y, 0);
gSprites[gTasks[taskId].tMonSpriteId].oam.priority = 0;
}
gMain.state++;
@ -3270,9 +3282,9 @@ static void Task_LoadInfoScreen(u8 taskId)
{
u32 preservedPalettes = 0;
if (gTasks[taskId].data[2] != 0)
if (gTasks[taskId].tBgLoaded)
preservedPalettes = 0x14; // each bit represents a palette index
if (gTasks[taskId].data[1] != 0)
if (gTasks[taskId].tMonSpriteDone)
preservedPalettes |= (1 << (gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum + 16));
BeginNormalPaletteFade(~preservedPalettes, 0, 16, 0, RGB_BLACK);
SetVBlankCallback(gPokedexVBlankCB);
@ -3294,10 +3306,10 @@ static void Task_LoadInfoScreen(u8 taskId)
if (!gPaletteFade.active)
{
gMain.state++;
if (gTasks[taskId].data[3] == 0)
if (!gTasks[taskId].tSkipCry)
{
StopCryAndClearCrySongs();
PlayCry2(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), 0, 0x7D, 0xA);
PlayCry2(NationalPokedexNumToSpecies(sPokedexListItem->dexNum), 0, 125, 10);
}
else
{
@ -3310,10 +3322,10 @@ static void Task_LoadInfoScreen(u8 taskId)
gMain.state++;
break;
case 10:
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = 1;
gTasks[taskId].data[3] = 1;
gTasks[taskId].tScrolling = FALSE;
gTasks[taskId].tMonSpriteDone = FALSE; // Reload next time screen comes up
gTasks[taskId].tBgLoaded = TRUE;
gTasks[taskId].tSkipCry = TRUE;
gTasks[taskId].func = Task_HandleInfoScreenInput;
gMain.state = 0;
break;
@ -3341,7 +3353,7 @@ static void FreeInfoScreenWindowAndBgBuffers(void)
static void Task_HandleInfoScreenInput(u8 taskId)
{
if (gTasks[taskId].data[0] != 0)
if (gTasks[taskId].tScrolling)
{
// Scroll up/down
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
@ -3393,8 +3405,8 @@ static void Task_HandleInfoScreenInput(u8 taskId)
}
return;
}
if (((JOY_NEW(DPAD_LEFT))
|| ((JOY_NEW(L_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
if ((JOY_NEW(DPAD_LEFT)
|| (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
&& sPokedexView->selectedScreen > 0)
{
sPokedexView->selectedScreen--;
@ -3402,8 +3414,8 @@ static void Task_HandleInfoScreenInput(u8 taskId)
PlaySE(SE_DEX_PAGE);
return;
}
if (((JOY_NEW(DPAD_RIGHT))
|| ((JOY_NEW(R_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
if ((JOY_NEW(DPAD_RIGHT)
|| (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
&& sPokedexView->selectedScreen < CANCEL_SCREEN)
{
sPokedexView->selectedScreen++;
@ -3552,7 +3564,7 @@ static void Task_LoadCryScreen(u8 taskId)
gMain.state++;
break;
case 5:
gTasks[taskId].tMonSpriteId = CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, 48, 56, 0);
gTasks[taskId].tMonSpriteId = CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, MON_PAGE_X, MON_PAGE_Y, 0);
gSprites[gTasks[taskId].tMonSpriteId].oam.priority = 0;
gDexCryScreenState = 0;
gMain.state++;
@ -3640,8 +3652,8 @@ static void Task_HandleCryScreenInput(u8 taskId)
PlaySE(SE_PC_OFF);
return;
}
if ((JOY_NEW(DPAD_LEFT))
|| ((JOY_NEW(L_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
if (JOY_NEW(DPAD_LEFT)
|| (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
{
BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK);
m4aMPlayContinue(&gMPlayInfo_BGM);
@ -3650,8 +3662,8 @@ static void Task_HandleCryScreenInput(u8 taskId)
PlaySE(SE_DEX_PAGE);
return;
}
if ((JOY_NEW(DPAD_RIGHT))
|| ((JOY_NEW(R_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
if (JOY_NEW(DPAD_RIGHT)
|| (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
{
if (!sPokedexListItem->owned)
{
@ -3756,7 +3768,7 @@ static void Task_LoadSizeScreen(u8 taskId)
gSprites[spriteId].y2 = gPokedexEntries[sPokedexListItem->dexNum].trainerOffset;
SetOamMatrix(1, gPokedexEntries[sPokedexListItem->dexNum].trainerScale, 0, 0, gPokedexEntries[sPokedexListItem->dexNum].trainerScale);
LoadPalette(sSizeScreenSilhouette_Pal, (gSprites[spriteId].oam.paletteNum + 16) * 16, 0x20);
gTasks[taskId].data[5] = spriteId;
gTasks[taskId].tTrainerSpriteId = spriteId;
gMain.state++;
break;
case 6:
@ -3810,8 +3822,8 @@ static void Task_HandleSizeScreenInput(u8 taskId)
gTasks[taskId].func = Task_SwitchScreensFromSizeScreen;
PlaySE(SE_PC_OFF);
}
else if ((JOY_NEW(DPAD_LEFT))
|| ((JOY_NEW(L_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
else if (JOY_NEW(DPAD_LEFT)
|| (JOY_NEW(L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
{
BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK);
sPokedexView->screenSwitchState = 2;
@ -3825,7 +3837,7 @@ static void Task_SwitchScreensFromSizeScreen(u8 taskId)
if (!gPaletteFade.active)
{
FreeAndDestroyMonPicSprite(gTasks[taskId].tMonSpriteId);
FreeAndDestroyTrainerPicSprite(gTasks[taskId].data[5]);
FreeAndDestroyTrainerPicSprite(gTasks[taskId].tTrainerSpriteId);
switch (sPokedexView->screenSwitchState)
{
default:
@ -3839,7 +3851,12 @@ static void Task_SwitchScreensFromSizeScreen(u8 taskId)
}
}
#undef tScrolling
#undef tMonSpriteDone
#undef tBgLoaded
#undef tSkipCry
#undef tMonSpriteId
#undef tTrainerSpriteId
static void LoadScreenSelectBarMain(u16 unused)
{
@ -3957,7 +3974,7 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId)
FillWindowPixelBuffer(WIN_INFO, PIXEL_FILL(0));
PutWindowTilemap(WIN_INFO);
PutWindowTilemap(WIN_FOOTPRINT);
PrintFootprint(WIN_FOOTPRINT, gTasks[taskId].tDexNum);
DrawFootprint(WIN_FOOTPRINT, gTasks[taskId].tDexNum);
CopyWindowToVram(WIN_FOOTPRINT, 2);
ResetPaletteFade();
LoadPokedexBgPalette(FALSE);
@ -3974,7 +3991,7 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId)
gTasks[taskId].tState++;
break;
case 4:
spriteId = CreateMonSpriteFromNationalDexNumber(dexNum, 48, 56, 0);
spriteId = CreateMonSpriteFromNationalDexNumber(dexNum, MON_PAGE_X, MON_PAGE_Y, 0);
gSprites[spriteId].oam.priority = 0;
BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK);
SetVBlankCallback(gPokedexVBlankCB);
@ -4172,7 +4189,7 @@ static void PrintMonWeight(u16 weight, u8 left, u8 top)
if ((buffer[i] = (lbs / 100000) + CHAR_0) == CHAR_0 && !output)
{
buffer[i++] = 0x77;
buffer[i++] = CHAR_SPACER;
}
else
{
@ -4183,7 +4200,7 @@ static void PrintMonWeight(u16 weight, u8 left, u8 top)
lbs %= 100000;
if ((buffer[i] = (lbs / 10000) + CHAR_0) == CHAR_0 && !output)
{
buffer[i++] = 0x77;
buffer[i++] = CHAR_SPACER;
}
else
{
@ -4194,7 +4211,7 @@ static void PrintMonWeight(u16 weight, u8 left, u8 top)
lbs %= 10000;
if ((buffer[i] = (lbs / 1000) + CHAR_0) == CHAR_0 && !output)
{
buffer[i++] = 0x77;
buffer[i++] = CHAR_SPACER;
}
else
{
@ -4523,7 +4540,7 @@ static void UnusedPrintDecimalNum(u8 windowId, u16 b, u8 left, u8 top)
result = b / 1000;
if (result == 0)
{
str[0] = 0x77;
str[0] = CHAR_SPACER;
outputted = FALSE;
}
else
@ -4535,7 +4552,7 @@ static void UnusedPrintDecimalNum(u8 windowId, u16 b, u8 left, u8 top)
result = (b % 1000) / 100;
if (result == 0 && !outputted)
{
str[1] = 0x77;
str[1] = CHAR_SPACER;
outputted = FALSE;
}
else
@ -4551,36 +4568,35 @@ static void UnusedPrintDecimalNum(u8 windowId, u16 b, u8 left, u8 top)
PrintInfoSubMenuText(windowId, str, left, top);
}
static void PrintFootprint(u8 windowId, u16 dexNum)
static void DrawFootprint(u8 windowId, u16 dexNum)
{
u8 image[32 * 4];
const u8 * r12 = gMonFootprintTable[NationalPokedexNumToSpecies(dexNum)];
u16 r5 = 0;
u16 i;
u16 j;
u8 footprint[32 * 4];
const u8 * footprintGfx = gMonFootprintTable[NationalPokedexNumToSpecies(dexNum)];
u16 tileIdx = 0;
u16 i, j;
for (i = 0; i < 32; i++)
{
u8 r3 = r12[i];
u8 tile = footprintGfx[i];
for (j = 0; j < 4; j++)
{
u8 value = ((r3 >> (2 * j)) & 1 ? 2 : 0);
if ((2 << (2 * j)) & r3)
u8 value = ((tile >> (2 * j)) & 1 ? 2 : 0);
if (tile & (2 << (2 * j)))
value |= 0x20;
image[r5] = value;
r5++;
footprint[tileIdx] = value;
tileIdx++;
}
}
CopyToWindowPixelBuffer(windowId, image, sizeof(image), 0);
CopyToWindowPixelBuffer(windowId, footprint, sizeof(footprint), 0);
}
// Unused
void sub_80C0DC0(u16 a, u16 b)
// Unused Ruby/Sapphire function.
static void RS_DrawFootprint(u16 offset, u16 tileNum)
{
*(u16 *)(VRAM + a * 0x800 + 0x232) = 0xF000 + b + 0;
*(u16 *)(VRAM + a * 0x800 + 0x234) = 0xF000 + b + 1;
*(u16 *)(VRAM + a * 0x800 + 0x272) = 0xF000 + b + 2;
*(u16 *)(VRAM + a * 0x800 + 0x274) = 0xF000 + b + 3;
*(u16 *)(VRAM + offset * 0x800 + 0x232) = 0xF000 + tileNum + 0;
*(u16 *)(VRAM + offset * 0x800 + 0x234) = 0xF000 + tileNum + 1;
*(u16 *)(VRAM + offset * 0x800 + 0x272) = 0xF000 + tileNum + 2;
*(u16 *)(VRAM + offset * 0x800 + 0x274) = 0xF000 + tileNum + 3;
}
static u16 GetNextPosition(u8 direction, u16 position, u16 min, u16 max)
@ -4919,7 +4935,7 @@ static void Task_HandleSearchTopBarInput(u8 taskId)
}
return;
}
if ((JOY_NEW(DPAD_LEFT)) && gTasks[taskId].tTopBarItem > SEARCH_TOPBAR_SEARCH)
if (JOY_NEW(DPAD_LEFT) && gTasks[taskId].tTopBarItem > SEARCH_TOPBAR_SEARCH)
{
PlaySE(SE_DEX_PAGE);
gTasks[taskId].tTopBarItem--;
@ -4927,7 +4943,7 @@ static void Task_HandleSearchTopBarInput(u8 taskId)
CopyWindowToVram(0, 2);
CopyBgTilemapBufferToVram(3);
}
if ((JOY_NEW(DPAD_RIGHT)) && gTasks[taskId].tTopBarItem < SEARCH_TOPBAR_CANCEL)
if (JOY_NEW(DPAD_RIGHT) && gTasks[taskId].tTopBarItem < SEARCH_TOPBAR_CANCEL)
{
PlaySE(SE_DEX_PAGE);
gTasks[taskId].tTopBarItem++;
@ -5008,7 +5024,7 @@ static void Task_HandleSearchMenuInput(u8 taskId)
return;
}
if ((JOY_NEW(DPAD_LEFT)) && movementMap[gTasks[taskId].tMenuItem][0] != 0xFF)
if (JOY_NEW(DPAD_LEFT) && movementMap[gTasks[taskId].tMenuItem][0] != 0xFF)
{
PlaySE(SE_SELECT);
gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][0];
@ -5016,7 +5032,7 @@ static void Task_HandleSearchMenuInput(u8 taskId)
CopyWindowToVram(0, 2);
CopyBgTilemapBufferToVram(3);
}
if ((JOY_NEW(DPAD_RIGHT)) && movementMap[gTasks[taskId].tMenuItem][1] != 0xFF)
if (JOY_NEW(DPAD_RIGHT) && movementMap[gTasks[taskId].tMenuItem][1] != 0xFF)
{
PlaySE(SE_SELECT);
gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][1];
@ -5024,7 +5040,7 @@ static void Task_HandleSearchMenuInput(u8 taskId)
CopyWindowToVram(0, 2);
CopyBgTilemapBufferToVram(3);
}
if ((JOY_NEW(DPAD_UP)) && movementMap[gTasks[taskId].tMenuItem][2] != 0xFF)
if (JOY_NEW(DPAD_UP) && movementMap[gTasks[taskId].tMenuItem][2] != 0xFF)
{
PlaySE(SE_SELECT);
gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][2];
@ -5032,7 +5048,7 @@ static void Task_HandleSearchMenuInput(u8 taskId)
CopyWindowToVram(0, 2);
CopyBgTilemapBufferToVram(3);
}
if ((JOY_NEW(DPAD_DOWN)) && movementMap[gTasks[taskId].tMenuItem][3] != 0xFF)
if (JOY_NEW(DPAD_DOWN) && movementMap[gTasks[taskId].tMenuItem][3] != 0xFF)
{
PlaySE(SE_SELECT);
gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][3];

View File

@ -19,10 +19,8 @@ struct MonIconSpriteTemplate
u16 paletteTag;
};
// static functions
static u8 CreateMonIconSprite(struct MonIconSpriteTemplate *, s16, s16, u8);
// .rodata
static void FreeAndDestroyMonIconSprite_(struct Sprite *sprite);
const u8 *const gMonIconTable[] =
{
@ -925,7 +923,7 @@ const struct SpritePalette gMonIconPaletteTable[] =
{ gMonIconPalettes[5], POKE_ICON_BASE_PAL_TAG + 5 },
};
const struct OamData sMonIconOamData =
static const struct OamData sMonIconOamData =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@ -976,7 +974,7 @@ static const union AnimCmd sAnim_4[] =
ANIMCMD_JUMP(0),
};
const union AnimCmd *const sMonIconAnims[] =
static const union AnimCmd *const sMonIconAnims[] =
{
sAnim_0,
sAnim_1,
@ -997,34 +995,34 @@ static const union AffineAnimCmd sAffineAnim_1[] =
AFFINEANIMCMD_END,
};
const union AffineAnimCmd *const sMonIconAffineAnims[] =
static const union AffineAnimCmd *const sMonIconAffineAnims[] =
{
sAffineAnim_0,
sAffineAnim_1,
};
const u16 sSpriteImageSizes[3][4] =
static const u16 sSpriteImageSizes[3][4] =
{
[ST_OAM_SQUARE] =
{
[SPRITE_SIZE(8x8)] = 0x20,
[SPRITE_SIZE(16x16)] = 0x80,
[SPRITE_SIZE(32x32)] = 0x200,
[SPRITE_SIZE(64x64)] = 0x800,
[SPRITE_SIZE(8x8)] = 8 * 8 / 2,
[SPRITE_SIZE(16x16)] = 16 * 16 / 2,
[SPRITE_SIZE(32x32)] = 32 * 32 / 2,
[SPRITE_SIZE(64x64)] = 64 * 64 / 2,
},
[ST_OAM_H_RECTANGLE] =
{
[SPRITE_SIZE(16x8)] = 0x40,
[SPRITE_SIZE(32x8)] = 0x80,
[SPRITE_SIZE(32x16)] = 0x100,
[SPRITE_SIZE(64x32)] = 0x400,
[SPRITE_SIZE(16x8)] = 16 * 8 / 2,
[SPRITE_SIZE(32x8)] = 32 * 8 / 2,
[SPRITE_SIZE(32x16)] = 32 * 16 / 2,
[SPRITE_SIZE(64x32)] = 64 * 32 / 2,
},
[ST_OAM_V_RECTANGLE] =
{
[SPRITE_SIZE(8x16)] = 0x40,
[SPRITE_SIZE(8x32)] = 0x80,
[SPRITE_SIZE(16x32)] = 0x100,
[SPRITE_SIZE(32x64)] = 0x400,
[SPRITE_SIZE(8x16)] = 8 * 16 / 2,
[SPRITE_SIZE(8x32)] = 8 * 32 / 2,
[SPRITE_SIZE(16x32)] = 16 * 32 / 2,
[SPRITE_SIZE(32x64)] = 32 * 64 / 2,
},
};
@ -1131,7 +1129,7 @@ const u8 *GetMonIconPtr(u16 species, u32 personality, bool32 handleDeoxys)
void FreeAndDestroyMonIconSprite(struct Sprite *sprite)
{
sub_80D328C(sprite);
FreeAndDestroyMonIconSprite_(sprite);
}
void LoadMonIconPalettes(void)
@ -1198,7 +1196,7 @@ const u8* GetMonIconTiles(u16 species, bool32 handleDeoxys)
return iconSprite;
}
void sub_80D304C(u16 offset)
void TryLoadAllMonIconPalettesAtOffset(u16 offset)
{
s32 i;
const struct SpritePalette* monIconPalettePtr;
@ -1206,7 +1204,7 @@ void sub_80D304C(u16 offset)
if (offset <= 0xA0)
{
monIconPalettePtr = gMonIconPaletteTable;
for(i = 5; i >= 0; i--)
for(i = ARRAY_COUNT(gMonIconPaletteTable) - 1; i >= 0; i--)
{
LoadPalette(monIconPalettePtr->data, offset, 0x20);
offset += 0x10;
@ -1294,7 +1292,7 @@ static u8 CreateMonIconSprite(struct MonIconSpriteTemplate *iconTemplate, s16 x,
return spriteId;
}
void sub_80D328C(struct Sprite *sprite)
static void FreeAndDestroyMonIconSprite_(struct Sprite *sprite)
{
struct SpriteFrameImage image = { NULL, sSpriteImageSizes[sprite->oam.shape][sprite->oam.size] };
sprite->images = &image;

View File

@ -6980,7 +6980,7 @@ static void SetDisplayMonData(void *pokemon, u8 mode)
*(txtPtr)++ = TEXT_COLOR_DARK_GRAY;
*(txtPtr)++ = TEXT_COLOR_WHITE;
*(txtPtr)++ = TEXT_COLOR_LIGHT_GRAY;
*(txtPtr)++ = CHAR_GENDERLESS;
*(txtPtr)++ = CHAR_SPACER; // Genderless
break;
}
@ -8177,7 +8177,7 @@ static bool8 MultiMove_Start(void)
{
case 0:
HideBg(0);
sub_80D304C(0x80);
TryLoadAllMonIconPalettesAtOffset(0x80);
sMultiMove->state++;
break;
case 1:

View File

@ -372,7 +372,7 @@ u8 *CopyMonConditionNameGender(u8 *str, u16 id, bool8 arg3)
switch (gender)
{
default:
*(str_++) = CHAR_GENDERLESS;
*(str_++) = CHAR_SPACER; // Genderless
break;
case MON_MALE:
*(str_++) = EXT_CTRL_CODE_BEGIN;

View File

@ -705,7 +705,7 @@ static void PrintSearchMonListItem(struct PokenavMonList * item, u8 * dest)
}
StringGetEnd10(gStringVar3);
dest = sub_81DB494(dest, 1, gStringVar3, 60);
dest = GetStringClearToWidth(dest, 1, gStringVar3, 60);
switch (gender)
{
default:
@ -723,5 +723,5 @@ static void PrintSearchMonListItem(struct PokenavMonList * item, u8 * dest)
*s++ = CHAR_EXTRA_SYMBOL;
*s++ = CHAR_LV_2;
ConvertIntToDecimalStringN(s, level, STR_CONV_MODE_LEFT_ALIGN, 3);
sub_81DB494(dest, 1, gStringVar1, 40);
GetStringClearToWidth(dest, 1, gStringVar1, 40);
}

View File

@ -413,12 +413,12 @@ void BufferMatchCallNameAndDesc(struct PokenavMatchCallEntries *matchCallEntry,
if (className && trainerName)
{
u8 *str2 = sub_81DB494(str, 7, className, 69);
sub_81DB494(str2, 7, trainerName, 51);
u8 *str2 = GetStringClearToWidth(str, 7, className, 69);
GetStringClearToWidth(str2, 7, trainerName, 51);
}
else
{
sub_81DB494(str, 7, NULL, 120);
GetStringClearToWidth(str, 7, NULL, 120);
}
}

View File

@ -722,7 +722,7 @@ static void BufferRibbonMonInfoText(struct PokenavMonList * item0, u8 * dest)
}
StringGetEnd10(gStringVar3);
dest = sub_81DB494(dest, 1, gStringVar3, 60);
dest = GetStringClearToWidth(dest, 1, gStringVar3, 60);
switch (gender)
{
default:
@ -741,6 +741,6 @@ static void BufferRibbonMonInfoText(struct PokenavMonList * item0, u8 * dest)
*s++ = CHAR_EXTRA_SYMBOL;
*s++ = CHAR_LV_2;
ConvertIntToDecimalStringN(s, level, STR_CONV_MODE_LEFT_ALIGN, 3);
dest = sub_81DB494(dest, 1, gStringVar1, 54);
dest = GetStringClearToWidth(dest, 1, gStringVar1, 54);
ConvertIntToDecimalStringN(dest, item->data, STR_CONV_MODE_RIGHT_ALIGN, 2);
}

View File

@ -2,14 +2,16 @@
#include "save_location.h"
#include "constants/maps.h"
#define LIST_END 0xFFFF
static bool32 IsCurMapInLocationList(const u16 *list)
{
s32 i;
u16 locSum = (gSaveBlock1Ptr->location.mapGroup << 8) + (gSaveBlock1Ptr->location.mapNum);
u16 map = (gSaveBlock1Ptr->location.mapGroup << 8) + gSaveBlock1Ptr->location.mapNum;
for (i = 0; list[i] != 0xFFFF; i++)
for (i = 0; list[i] != LIST_END; i++)
{
if (list[i] == locSum)
if (list[i] == map)
return TRUE;
}
@ -56,7 +58,7 @@ static const u16 sSaveLocationPokeCenterList[] =
MAP_TRADE_CENTER,
MAP_RECORD_CORNER,
MAP_BATTLE_COLOSSEUM_4P,
0xFFFF,
LIST_END,
};
static bool32 IsCurMapPokeCenter(void)
@ -67,7 +69,7 @@ static bool32 IsCurMapPokeCenter(void)
static const u16 sSaveLocationReloadLocList[] = // There's only 1 location, and it's presumed its for the save reload feature for battle tower.
{
MAP_BATTLE_FRONTIER_BATTLE_TOWER_LOBBY,
0xFFFF,
LIST_END,
};
static bool32 IsCurMapReloadLocation(void)
@ -76,20 +78,20 @@ static bool32 IsCurMapReloadLocation(void)
}
// Nulled out list. Unknown what this would have been.
static const u16 sUnknown_0861440E[] =
static const u16 sEmptyMapList[] =
{
0xFFFF,
LIST_END,
};
static bool32 sub_81AFCEC(void)
static bool32 IsCurMapInEmptyList(void)
{
return IsCurMapInLocationList(sUnknown_0861440E);
return IsCurMapInLocationList(sEmptyMapList);
}
static void TrySetPokeCenterWarpStatus(void)
{
if (IsCurMapPokeCenter() == FALSE)
gSaveBlock2Ptr->specialSaveWarpFlags &= ~(POKECENTER_SAVEWARP);
if (!IsCurMapPokeCenter())
gSaveBlock2Ptr->specialSaveWarpFlags &= ~POKECENTER_SAVEWARP;
else
gSaveBlock2Ptr->specialSaveWarpFlags |= POKECENTER_SAVEWARP;
}
@ -97,16 +99,16 @@ static void TrySetPokeCenterWarpStatus(void)
static void TrySetReloadWarpStatus(void)
{
if (!IsCurMapReloadLocation())
gSaveBlock2Ptr->specialSaveWarpFlags &= ~(LOBBY_SAVEWARP);
gSaveBlock2Ptr->specialSaveWarpFlags &= ~LOBBY_SAVEWARP;
else
gSaveBlock2Ptr->specialSaveWarpFlags |= LOBBY_SAVEWARP;
}
// this function definitely sets a warp status, but because the list is empty, it's unknown what this does yet.
static void sub_81AFD5C(void)
// Unknown save warp flag. Never set because map list is empty.
static void TrySetUnknownWarpStatus(void)
{
if (!sub_81AFCEC())
gSaveBlock2Ptr->specialSaveWarpFlags &= ~(UNK_SPECIAL_SAVE_WARP_FLAG_3);
if (!IsCurMapInEmptyList())
gSaveBlock2Ptr->specialSaveWarpFlags &= ~UNK_SPECIAL_SAVE_WARP_FLAG_3;
else
gSaveBlock2Ptr->specialSaveWarpFlags |= UNK_SPECIAL_SAVE_WARP_FLAG_3;
}
@ -115,21 +117,21 @@ void TrySetMapSaveWarpStatus(void)
{
TrySetPokeCenterWarpStatus();
TrySetReloadWarpStatus();
sub_81AFD5C();
TrySetUnknownWarpStatus();
}
// In FRLG, only 0x1, 0x10, and 0x20 are set when the pokedex is received
// 0x2, 0x4, 0x8, and 0x8000 are instead set by SetPostgameFlags
// In FRLG, only bits 0, 4, and 5 are set when the pokedex is received.
// Bits 1, 2, 3, and 15 are instead set by SetPostgameFlags.
// These flags are read by Pokemon Colosseum/XD for linking. XD Additionally requires FLAG_SYS_GAME_CLEAR
void SetUnlockedPokedexFlags(void)
{
gSaveBlock2Ptr->gcnLinkFlags |= 0x8000;
gSaveBlock2Ptr->gcnLinkFlags |= 0x1;
gSaveBlock2Ptr->gcnLinkFlags |= 0x2;
gSaveBlock2Ptr->gcnLinkFlags |= 0x4;
gSaveBlock2Ptr->gcnLinkFlags |= 0x10;
gSaveBlock2Ptr->gcnLinkFlags |= 0x20;
gSaveBlock2Ptr->gcnLinkFlags |= 0x8;
gSaveBlock2Ptr->gcnLinkFlags |= (1 << 15);
gSaveBlock2Ptr->gcnLinkFlags |= (1 << 0);
gSaveBlock2Ptr->gcnLinkFlags |= (1 << 1);
gSaveBlock2Ptr->gcnLinkFlags |= (1 << 2);
gSaveBlock2Ptr->gcnLinkFlags |= (1 << 4);
gSaveBlock2Ptr->gcnLinkFlags |= (1 << 5);
gSaveBlock2Ptr->gcnLinkFlags |= (1 << 3);
}
void SetChampionSaveWarp(void)

View File

@ -635,7 +635,7 @@ static u8 CreatePokemonFrontSprite(u16 species, u8 x, u8 y)
{
u8 spriteId;
spriteId = CreatePicSprite2(species, SHINY_ODDS, 0, 1, x, y, 0xE, TAG_NONE);
spriteId = CreateMonPicSprite_Affine(species, SHINY_ODDS, 0, MON_PIC_AFFINE_FRONT, x, y, 14, TAG_NONE);
gSprites[spriteId].oam.priority = 0;
return spriteId;
}

View File

@ -130,13 +130,13 @@ void Task_HandleGetDecorationMenuInput(u8 taskId)
}
}
void ScrSpecial_GetTraderTradedFlag(void)
void GetTraderTradedFlag(void)
{
struct MauvilleOldManTrader *trader = &gSaveBlock1Ptr->oldMan.trader;
gSpecialVar_Result = trader->alreadyTraded;
}
void ScrSpecial_DoesPlayerHaveNoDecorations(void)
void DoesPlayerHaveNoDecorations(void)
{
u8 i;
@ -151,7 +151,7 @@ void ScrSpecial_DoesPlayerHaveNoDecorations(void)
gSpecialVar_Result = TRUE;
}
void ScrSpecial_IsDecorationFull(void)
void IsDecorationCategoryFull(void)
{
gSpecialVar_Result = FALSE;
if (gDecorations[gSpecialVar_0x8004].category != gDecorations[gSpecialVar_0x8006].category
@ -162,7 +162,7 @@ void ScrSpecial_IsDecorationFull(void)
}
}
void ScrSpecial_TraderMenuGiveDecoration(void)
void TraderShowDecorationMenu(void)
{
CreateTask(ShowDecorationCategoriesWindow, 0);
}
@ -190,7 +190,7 @@ void ExitTraderMenu(u8 taskId)
EnableBothScriptContexts();
}
void ScrSpecial_TraderDoDecorationTrade(void)
void TraderDoDecorationTrade(void)
{
struct MauvilleOldManTrader *trader = &gSaveBlock1Ptr->oldMan.trader;
@ -202,7 +202,7 @@ void ScrSpecial_TraderDoDecorationTrade(void)
trader->alreadyTraded = TRUE;
}
void ScrSpecial_TraderMenuGetDecoration(void)
void TraderMenuGetDecoration(void)
{
u8 taskId = CreateTask(Task_HandleGetDecorationMenuInput, 0);
CreateAvailableDecorationsMenu(taskId);

View File

@ -9,8 +9,6 @@
#include "pokemon.h"
#include "constants/trainers.h"
// Static type declarations
struct PicData
{
u8 *frames;
@ -20,33 +18,26 @@ struct PicData
u8 active;
};
// Static RAM declarations
#define PICS_COUNT 8
static EWRAM_DATA struct SpriteTemplate sCreatingSpriteTemplate = {};
static EWRAM_DATA struct PicData sSpritePics[PICS_COUNT] = {};
// Static ROM declarations
// .rodata
static const struct PicData sDummyPicData = {};
static const struct OamData gUnknown_0860B064 =
static const struct OamData sOamData_Normal =
{
.shape = SPRITE_SHAPE(64x64),
.size = SPRITE_SIZE(64x64)
};
static const struct OamData gUnknown_0860B06C =
static const struct OamData sOamData_Affine =
{
.affineMode = ST_OAM_AFFINE_NORMAL,
.shape = SPRITE_SHAPE(64x64),
.size = SPRITE_SIZE(64x64)
};
// .text
static void DummyPicSpriteCallback(struct Sprite *sprite)
{
@ -153,19 +144,15 @@ static u16 CreatePicSprite(u16 species, u32 otId, u32 personality, bool8 isFront
for (i = 0; i < PICS_COUNT; i ++)
{
if (!sSpritePics[i].active)
{
break;
}
}
if (i == PICS_COUNT)
{
return 0xFFFF;
}
framePics = Alloc(4 * 0x800);
if (!framePics)
{
return 0xFFFF;
}
images = Alloc(4 * sizeof(struct SpriteFrameImage));
if (!images)
{
@ -183,7 +170,7 @@ static u16 CreatePicSprite(u16 species, u32 otId, u32 personality, bool8 isFront
images[j].size = 0x800;
}
sCreatingSpriteTemplate.tileTag = TAG_NONE;
sCreatingSpriteTemplate.oam = &gUnknown_0860B064;
sCreatingSpriteTemplate.oam = &sOamData_Normal;
AssignSpriteAnimsTable(isTrainer);
sCreatingSpriteTemplate.images = images;
sCreatingSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
@ -191,9 +178,7 @@ static u16 CreatePicSprite(u16 species, u32 otId, u32 personality, bool8 isFront
LoadPicPaletteByTagOrSlot(species, otId, personality, paletteSlot, paletteTag, isTrainer);
spriteId = CreateSprite(&sCreatingSpriteTemplate, x, y, 0);
if (paletteTag == TAG_NONE)
{
gSprites[spriteId].oam.paletteNum = paletteSlot;
}
sSpritePics[i].frames = framePics;
sSpritePics[i].images = images;
sSpritePics[i].paletteTag = paletteTag;
@ -207,39 +192,35 @@ static u16 CreatePicSprite_HandleDeoxys(u16 species, u32 otId, u32 personality,
return CreatePicSprite(species, otId, personality, isFrontPic, x, y, paletteSlot, paletteTag, isTrainer, FALSE);
}
u16 CreatePicSprite2(u16 species, u32 otId, u32 personality, u8 flags, s16 x, s16 y, u8 paletteSlot, u16 paletteTag)
u16 CreateMonPicSprite_Affine(u16 species, u32 otId, u32 personality, u8 flags, s16 x, s16 y, u8 paletteSlot, u16 paletteTag)
{
u8 *framePics;
struct SpriteFrameImage *images;
int j;
u8 i;
u8 spriteId;
u8 flags2;
u8 type;
for (i = 0; i < PICS_COUNT; i ++)
for (i = 0; i < PICS_COUNT; i++)
{
if (!sSpritePics[i].active)
{
break;
}
}
if (i == PICS_COUNT)
{
return 0xFFFF;
}
framePics = Alloc(4 * 0x800);
framePics = Alloc(4 * MON_PIC_SIZE);
if (!framePics)
{
return 0xFFFF;
}
if (flags & 0x80)
if (flags & F_MON_PIC_NO_AFFINE)
{
flags &= 0x7F;
flags2 = 3;
flags &= ~F_MON_PIC_NO_AFFINE;
type = MON_PIC_AFFINE_NONE;
}
else
{
flags2 = flags;
type = flags;
}
images = Alloc(4 * sizeof(struct SpriteFrameImage));
if (!images)
@ -254,34 +235,32 @@ u16 CreatePicSprite2(u16 species, u32 otId, u32 personality, u8 flags, s16 x, s1
}
for (j = 0; j < 4; j ++)
{
images[j].data = framePics + 0x800 * j;
images[j].size = 0x800;
images[j].data = framePics + MON_PIC_SIZE * j;
images[j].size = MON_PIC_SIZE;
}
sCreatingSpriteTemplate.tileTag = TAG_NONE;
sCreatingSpriteTemplate.anims = gMonFrontAnimsPtrTable[species];
sCreatingSpriteTemplate.images = images;
if (flags2 == 0x01)
if (type == MON_PIC_AFFINE_FRONT)
{
sCreatingSpriteTemplate.affineAnims = gAffineAnims_BattleSpriteOpponentSide;
sCreatingSpriteTemplate.oam = &gUnknown_0860B06C;
sCreatingSpriteTemplate.oam = &sOamData_Affine;
}
else if (flags2 == 0x00)
else if (type == MON_PIC_AFFINE_BACK)
{
sCreatingSpriteTemplate.affineAnims = gAffineAnims_BattleSpritePlayerSide;
sCreatingSpriteTemplate.oam = &gUnknown_0860B06C;
sCreatingSpriteTemplate.oam = &sOamData_Affine;
}
else
else // MON_PIC_AFFINE_NONE
{
sCreatingSpriteTemplate.oam = &gUnknown_0860B064;
sCreatingSpriteTemplate.oam = &sOamData_Normal;
sCreatingSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
}
sCreatingSpriteTemplate.callback = DummyPicSpriteCallback;
LoadPicPaletteByTagOrSlot(species, otId, personality, paletteSlot, paletteTag, FALSE);
spriteId = CreateSprite(&sCreatingSpriteTemplate, x, y, 0);
if (paletteTag == TAG_NONE)
{
gSprites[spriteId].oam.paletteNum = paletteSlot;
}
sSpritePics[i].frames = framePics;
sSpritePics[i].images = images;
sSpritePics[i].paletteTag = paletteTag;
@ -299,20 +278,15 @@ static u16 FreeAndDestroyPicSpriteInternal(u16 spriteId)
for (i = 0; i < PICS_COUNT; i ++)
{
if (sSpritePics[i].spriteId == spriteId)
{
break;
}
}
if (i == PICS_COUNT)
{
return 0xFFFF;
}
framePics = sSpritePics[i].frames;
images = sSpritePics[i].images;
if (sSpritePics[i].paletteTag != TAG_NONE)
{
FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(gSprites[spriteId].oam.paletteNum));
}
DestroySprite(&gSprites[spriteId]);
Free(framePics);
Free(images);
@ -320,12 +294,11 @@ static u16 FreeAndDestroyPicSpriteInternal(u16 spriteId)
return 0;
}
static u16 sub_818D65C(u16 species, u32 otId, u32 personality, bool8 isFrontPic, u8 paletteSlot, u8 windowId, bool8 isTrainer)
static u16 LoadPicSpriteInWindow(u16 species, u32 otId, u32 personality, bool8 isFrontPic, u8 paletteSlot, u8 windowId, bool8 isTrainer)
{
if (DecompressPic_HandleDeoxys(species, personality, isFrontPic, (u8 *)GetWindowAttribute(windowId, WINDOW_TILE_DATA), FALSE))
{
return 0xFFFF;
}
LoadPicPaletteBySlot(species, otId, personality, paletteSlot, isTrainer);
return 0;
}
@ -360,9 +333,10 @@ u16 FreeAndDestroyMonPicSprite(u16 spriteId)
return FreeAndDestroyPicSpriteInternal(spriteId);
}
u16 sub_818D834(u16 species, u32 otId, u32 personality, bool8 isFrontPic, u8 paletteSlot, u8 windowId)
// Unused
static u16 LoadMonPicInWindow(u16 species, u32 otId, u32 personality, bool8 isFrontPic, u8 paletteSlot, u8 windowId)
{
return sub_818D65C(species, otId, personality, isFrontPic, paletteSlot, windowId, FALSE);
return LoadPicSpriteInWindow(species, otId, personality, isFrontPic, paletteSlot, windowId, FALSE);
}
// Unused, FRLG only
@ -381,9 +355,10 @@ u16 FreeAndDestroyTrainerPicSprite(u16 spriteId)
return FreeAndDestroyPicSpriteInternal(spriteId);
}
u16 sub_818D904(u16 species, bool8 isFrontPic, u8 paletteSlot, u8 windowId)
// Unused
static u16 LoadTrainerPicInWindow(u16 species, bool8 isFrontPic, u8 paletteSlot, u8 windowId)
{
return sub_818D65C(species, 0, 0, isFrontPic, paletteSlot, windowId, TRUE);
return LoadPicSpriteInWindow(species, 0, 0, isFrontPic, paletteSlot, windowId, TRUE);
}
u16 CreateTrainerCardTrainerPicSprite(u16 species, bool8 isFrontPic, u16 destX, u16 destY, u8 paletteSlot, u8 windowId)
@ -395,13 +370,10 @@ u16 PlayerGenderToFrontTrainerPicId_Debug(u8 gender, bool8 getClass)
{
if (getClass == TRUE)
{
switch (gender)
{
default:
if (gender != MALE)
return gFacilityClassToPicIndex[FACILITY_CLASS_MAY];
case MALE:
else
return gFacilityClassToPicIndex[FACILITY_CLASS_BRENDAN];
}
}
return gender;
}

View File

@ -1155,7 +1155,7 @@ void TryPutPokemonTodayOnAir(void)
show->pokemonToday.ball = itemLastUsed;
StringCopy(show->pokemonToday.playerName, gSaveBlock2Ptr->playerName);
StringCopy(show->pokemonToday.nickname, gBattleResults.caughtMonNick);
language2 = sub_81DB604(show->pokemonToday.nickname);
language2 = GetNicknameLanguage(show->pokemonToday.nickname);
StripExtCtrlCodes(show->pokemonToday.nickname);
show->pokemonToday.species = gBattleResults.caughtMonSpecies;
StorePlayerIdInRecordMixShow(show);

View File

@ -105,6 +105,17 @@ enum {
CHAT_EXIT_DISBANDED,
};
enum {
GFXTAG_KEYBOARD_CURSOR,
GFXTAG_TEXT_ENTRY_ARROW,
GFXTAG_TEXT_ENTRY_CURSOR,
GFXTAG_RBUTTON_ICON,
GFXTAG_RBUTTON_LABELS,
};
// Shared by all above
#define PALTAG_INTERFACE 0
struct UnionRoomChat
{
u32 filler1;
@ -123,7 +134,7 @@ struct UnionRoomChat
u8 lastBufferCursorPos;
u8 bufferCursorPos;
u8 receivedPlayerIndex;
u8 exitType;
u8 exitType; // CHAT_EXIT_*
bool8 changedRegisteredTexts;
u8 afterSaveTimer;
u8 messageEntryBuffer[2 * MAX_MESSAGE_LENGTH + 1];
@ -249,9 +260,9 @@ static void CreateRButtonSprites(void);
static void ShowKeyboardSwapMenu(void);
static void HideKeyboardSwapMenu(void);
static void SetKeyboardCursorInvisibility(bool32);
static bool32 sub_8020320(void);
static bool32 SlideKeyboardPageOut(void);
static void PrintCurrentKeyboardPage(void);
static bool32 sub_8020368(void);
static bool32 SlideKeyboardPageIn(void);
static void MoveKeyboardCursor(void);
static void UpdateRButtonLabel(void);
static void AddStdMessageWindow(int, u16);
@ -266,8 +277,8 @@ static void SetRegisteredTextPalette(bool32);
static void PrintChatMessage(u16, u8 *, u8);
static void StartKeyboardCursorAnim(void);
static bool32 TryKeyboardCursorReopen(void);
static void sub_80207C0(s16);
static void sub_8020818(s16);
static void UpdateSlidingKeyboard(s16);
static void FinishSlidingKeyboard(s16);
static bool32 Display_Dummy(u8 *);
static bool32 Display_LoadGfx(u8 *state);
static bool32 Display_ShowKeyboardSwapMenu(u8 *state);
@ -550,36 +561,36 @@ static const struct BgTemplate sBgTemplates[] = {
static const struct WindowTemplate sWinTemplates[] = {
{
.bg = 0x03,
.tilemapLeft = 0x08,
.tilemapTop = 0x01,
.width = 0x15,
.height = 0x13,
.paletteNum = 0x0f,
.bg = 3,
.tilemapLeft = 8,
.tilemapTop = 1,
.width = 21,
.height = 19,
.paletteNum = 15,
.baseBlock = 0x0001,
}, {
.bg = 0x01,
.tilemapLeft = 0x09,
.tilemapTop = 0x12,
.width = 0x0f,
.height = 0x02,
.paletteNum = 0x0c,
.bg = 1,
.tilemapLeft = 9,
.tilemapTop = 18,
.width = 15,
.height = 2,
.paletteNum = 12,
.baseBlock = 0x007a,
}, {
.bg = 0x01,
.tilemapLeft = 0x00,
.tilemapTop = 0x02,
.width = 0x06,
.height = 0x0f,
.paletteNum = 0x07,
.bg = 1,
.tilemapLeft = 0,
.tilemapTop = 2,
.width = 6,
.height = 15,
.paletteNum = 7,
.baseBlock = 0x0020,
}, {
.bg = 0x00,
.tilemapLeft = 0x01,
.tilemapTop = 0x02,
.width = 0x07,
.height = 0x09,
.paletteNum = 0x0e,
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 2,
.width = 7,
.height = 9,
.paletteNum = 14,
.baseBlock = 0x0013,
}, DUMMY_WIN_TEMPLATE
};
@ -783,8 +794,8 @@ static const union AnimCmd *const sAnims_KeyboardCursor[] = {
};
static const struct SpriteTemplate sSpriteTemplate_KeyboardCursor = {
.tileTag = 0x0000,
.paletteTag = 0x0000,
.tileTag = GFXTAG_KEYBOARD_CURSOR,
.paletteTag = PALTAG_INTERFACE,
.oam = &sOam_KeyboardCursor,
.anims = sAnims_KeyboardCursor,
.images = NULL,
@ -799,8 +810,8 @@ static const struct OamData sOam_TextEntrySprite = {
};
static const struct SpriteTemplate sSpriteTemplate_TextEntryCursor = {
.tileTag = 0x0002,
.paletteTag = 0x0000,
.tileTag = GFXTAG_TEXT_ENTRY_CURSOR,
.paletteTag = PALTAG_INTERFACE,
.oam = &sOam_TextEntrySprite,
.anims = gDummySpriteAnimTable,
.images = NULL,
@ -809,8 +820,8 @@ static const struct SpriteTemplate sSpriteTemplate_TextEntryCursor = {
};
static const struct SpriteTemplate sSpriteTemplate_TextEntryArrow = {
.tileTag = 0x0001,
.paletteTag = 0x0000,
.tileTag = GFXTAG_TEXT_ENTRY_ARROW,
.paletteTag = PALTAG_INTERFACE,
.oam = &sOam_TextEntrySprite,
.anims = gDummySpriteAnimTable,
.images = NULL,
@ -858,8 +869,8 @@ static const union AnimCmd *const sAnims_RButtonLabels[] = {
};
static const struct SpriteTemplate sSpriteTemplate_RButtonIcon = {
.tileTag = 0x0003,
.paletteTag = 0x0000,
.tileTag = GFXTAG_RBUTTON_ICON,
.paletteTag = PALTAG_INTERFACE,
.oam = &sOam_RButtonIcon,
.anims = gDummySpriteAnimTable,
.images = NULL,
@ -868,8 +879,8 @@ static const struct SpriteTemplate sSpriteTemplate_RButtonIcon = {
};
static const struct SpriteTemplate sSpriteTemplate_RButtonLabels = {
.tileTag = 0x0004,
.paletteTag = 0x0000,
.tileTag = GFXTAG_RBUTTON_LABELS,
.paletteTag = PALTAG_INTERFACE,
.oam = &sOam_RButtonLabel,
.anims = sAnims_RButtonLabels,
.images = NULL,
@ -879,7 +890,7 @@ static const struct SpriteTemplate sSpriteTemplate_RButtonLabels = {
void EnterUnionRoomChat(void)
{
sChat = Alloc(sizeof(struct UnionRoomChat));
sChat = Alloc(sizeof(*sChat));
InitUnionRoomChat(sChat);
gKeyRepeatStartDelay = 20;
SetVBlankCallback(NULL);
@ -890,7 +901,7 @@ static void InitUnionRoomChat(struct UnionRoomChat *chat)
{
int i;
chat->funcId = 0;
chat->funcId = CHAT_FUNC_JOIN;
chat->funcState = 0;
chat->currentPage = 0;
chat->currentCol = 0;
@ -901,7 +912,7 @@ static void InitUnionRoomChat(struct UnionRoomChat *chat)
chat->messageEntryBuffer[0] = EOS;
chat->linkPlayerCount = GetLinkPlayerCount();
chat->multiplayerId = GetMultiplayerId();
chat->exitType = 0;
chat->exitType = CHAT_EXIT_NONE;
chat->changedRegisteredTexts = FALSE;
PrepareSendBuffer_Null(chat->sendMessageBuffer);
for (i = 0; i < UNION_ROOM_KB_ROW_COUNT; i++)
@ -969,6 +980,8 @@ static void CB2_UnionRoomChatMain(void)
static void Task_HandlePlayerInput(u8 taskId)
{
// If exitType is not CHAT_EXIT_NONE, begin exit function.
// Otherwise just call main function below.
switch (sChat->exitType)
{
case CHAT_EXIT_ONLY_LEADER:
@ -1056,7 +1069,7 @@ static void Chat_HandleInput(void)
}
else
{
SetChatFunction(5);
SetChatFunction(CHAT_FUNC_REGISTER);
}
}
else if (HandleDPadInput())
@ -2080,7 +2093,7 @@ static void Task_ReceiveChatMessage(u8 taskId)
if (GetLinkPlayerCount() == 2)
{
Rfu_StopPartnerSearch();
sChat->exitType = 1;
sChat->exitType = CHAT_EXIT_ONLY_LEADER;
DestroyTask(taskId);
return;
}
@ -2091,12 +2104,12 @@ static void Task_ReceiveChatMessage(u8 taskId)
break;
case 5:
if (sChat->multiplayerId)
sChat->exitType = 2;
sChat->exitType = CHAT_EXIT_DROPPED;
DestroyTask(taskId);
break;
case 6:
sChat->exitType = 3;
sChat->exitType = CHAT_EXIT_DISBANDED;
DestroyTask(taskId);
break;
case 2:
@ -2295,7 +2308,7 @@ static bool32 Display_SwitchPages(u8 *state)
{
case 0:
SetKeyboardCursorInvisibility(TRUE);
if (sub_8020320())
if (SlideKeyboardPageOut())
return TRUE;
PrintCurrentKeyboardPage();
@ -2306,7 +2319,7 @@ static bool32 Display_SwitchPages(u8 *state)
return TRUE;
break;
case 2:
if (sub_8020368())
if (SlideKeyboardPageIn())
return TRUE;
MoveKeyboardCursor();
@ -2928,26 +2941,29 @@ static void PrintCurrentKeyboardPage(void)
}
}
static bool32 sub_8020320(void)
#define KEYBOARD_HOFS_END 56
static bool32 SlideKeyboardPageOut(void)
{
if (sDisplay->bg1hofs < 56)
if (sDisplay->bg1hofs < KEYBOARD_HOFS_END)
{
sDisplay->bg1hofs += 12;
if (sDisplay->bg1hofs >= 56)
sDisplay->bg1hofs = 56;
if (sDisplay->bg1hofs >= KEYBOARD_HOFS_END)
sDisplay->bg1hofs = KEYBOARD_HOFS_END;
if (sDisplay->bg1hofs < 56)
if (sDisplay->bg1hofs < KEYBOARD_HOFS_END)
{
sub_80207C0(sDisplay->bg1hofs);
// Still sliding
UpdateSlidingKeyboard(sDisplay->bg1hofs);
return TRUE;
}
}
sub_8020818(sDisplay->bg1hofs);
FinishSlidingKeyboard(sDisplay->bg1hofs);
return FALSE;
}
static bool32 sub_8020368(void)
static bool32 SlideKeyboardPageIn(void)
{
if (sDisplay->bg1hofs > 0)
{
@ -2957,12 +2973,13 @@ static bool32 sub_8020368(void)
if (sDisplay->bg1hofs > 0)
{
sub_80207C0(sDisplay->bg1hofs);
// Still sliding
UpdateSlidingKeyboard(sDisplay->bg1hofs);
return TRUE;
}
}
sub_8020818(sDisplay->bg1hofs);
FinishSlidingKeyboard(sDisplay->bg1hofs);
return FALSE;
}
@ -3049,8 +3066,8 @@ static void LoadChatWindowGfx(void)
ptr = DecompressAndCopyTileDataToVram(2, gUnionRoomChat_Background_Gfx, 0, 0, 0);
if (ptr)
{
CpuFastCopy(&ptr[0x220], sDisplay->unk2128, 0x20);
CpuFastCopy(&ptr[0x420], sDisplay->unk2148, 0x20);
CpuFastCopy(&ptr[0x220], sDisplay->unk2128, sizeof(sDisplay->unk2128));
CpuFastCopy(&ptr[0x420], sDisplay->unk2148, sizeof(sDisplay->unk2148));
}
CopyToBgTilemapBuffer(2, gUnionRoomChat_Background_Tilemap, 0, 0);
@ -3059,13 +3076,13 @@ static void LoadChatWindowGfx(void)
static void sub_8020680(void)
{
LoadPalette(sUnk_Palette1, 0x80, 0x20);
LoadPalette(sUnk_Palette1, 0x80, sizeof(sUnk_Palette1));
RequestDma3Fill(0, (void *)BG_CHAR_ADDR(1) + 0x20, 0x20, 1);
}
static void LoadChatMessagesWindow(void)
{
LoadPalette(sUnk_Palette2, 0xF0, 0x20);
LoadPalette(sUnk_Palette2, 0xF0, sizeof(sUnk_Palette2));
PutWindowTilemap(0);
FillWindowPixelBuffer(0, PIXEL_FILL(1));
CopyWindowToVram(0, 3);
@ -3113,13 +3130,13 @@ static void InitScanlineEffect(void)
ScanlineEffect_SetParams(params);
}
static void sub_80207C0(s16 bg1hofs)
static void UpdateSlidingKeyboard(s16 bg1hofs)
{
CpuFill16(bg1hofs, gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer], 0x120);
CpuFill16(0, gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer] + 0x90, 0x20);
}
static void sub_8020818(s16 bg1hofs)
static void FinishSlidingKeyboard(s16 bg1hofs)
{
CpuFill16(bg1hofs, gScanlineEffectRegBuffers[0], 0x120);
CpuFill16(0, gScanlineEffectRegBuffers[0] + 0x90, 0x20);
@ -3134,7 +3151,7 @@ static bool32 TryAllocSprites(void)
LoadCompressedSpriteSheet(&sSpriteSheets[i]);
LoadSpritePalette(&sSpritePalette);
sSprites = Alloc(sizeof(struct UnionRoomChatSprites));
sSprites = Alloc(sizeof(*sSprites));
if (!sSprites)
return FALSE;
@ -3180,7 +3197,7 @@ static void MoveKeyboardCursor(void)
static void SetRegisteredTextPalette(bool32 registering)
{
const u16 *palette = &sUnionRoomChatInterfacePal[registering * 2 + 1];
u8 index = IndexOfSpritePaletteTag(0);
u8 index = IndexOfSpritePaletteTag(PALTAG_INTERFACE);
LoadPalette(palette, index * 16 + 0x101, 4);
}

View File

@ -613,7 +613,7 @@ bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavi
}
}
else if (MetatileBehavior_IsWaterWildEncounter(currMetaTileBehavior) == TRUE
|| (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING) && MetatileBehavior_IsBridge(currMetaTileBehavior) == TRUE))
|| (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING) && MetatileBehavior_IsBridgeOverWater(currMetaTileBehavior) == TRUE))
{
if (AreLegendariesInSootopolisPreventingEncounters() == TRUE)
return FALSE;