Merge branch 'master' into doc-overworld

This commit is contained in:
GriffinR 2020-07-15 00:40:47 -04:00 committed by GitHub
commit e129d04b93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
88 changed files with 1413 additions and 1248 deletions

View File

@ -274,15 +274,17 @@
.2byte \functionId
.endm
@ Blocks script execution until a command or ASM code manually unblocks it. Generally used with specific commands and specials. If this command runs, and a subsequent command or piece of ASM does not unblock state, the script will remain blocked indefinitely (essentially a hang).
@ Blocks script execution until a command or ASM code manually unblocks it. Generally used with specific
@ commands and specials. If this command runs, and a subsequent command or piece of ASM does not unblock
@ state, the script will remain blocked indefinitely (essentially a hang).
.macro waitstate
.byte 0x27
.endm
@ Blocks script execution for time (frames? milliseconds?).
.macro delay time:req
@ Blocks script execution for frames. (Pokemon Emerald runs at just shy of 60 frames per second.)
.macro delay frames:req
.byte 0x28
.2byte \time
.2byte \frames
.endm
@ Sets a to 1.
@ -315,7 +317,8 @@
.byte 0x2d
.endm
@ Sets the values of variables 0x8000, 0x8001, and 0x8002 to the current hour, minute, and second. In FRLG, this command sets those variables to zero.
@ Sets the values of variables 0x8000, 0x8001, and 0x8002 to the current hour, minute, and second. In FRLG,
@ this command sets those variables to zero.
.macro gettime
.byte 0x2e
.endm
@ -378,7 +381,8 @@
.byte \speed
.endm
@ Sends the player to Warp warp on Map bank.map. If the specified warp is 0xFF, then the player will instead be sent to (X, Y) on the map.
@ Sends the player to Warp warp on Map bank.map. If the specified warp is 0xFF,
@ then the player will instead be sent to (X, Y) on the map.
.macro warp map:req, warp:req, X:req, Y:req
.byte 0x39
map \map
@ -429,7 +433,8 @@
.2byte \Y
.endm
@ Sets the warp destination that a warp to Warp 127 on Map 127.127 will connect to. Useful when a map has warps that need to go to script-controlled locations (i.e. elevators).
@ Sets the warp destination that a warp to Warp 127 on Map 127.127 will connect to.
@ Useful when a map has warps that need to go to script-controlled locations (i.e. elevators).
.macro setdynamicwarp map:req, warp:req, X:req, Y:req
.byte 0x3f
map \map
@ -468,7 +473,8 @@
.byte 0x43
.endm
@ Attempts to add quantity of item index to the player's Bag. If the player has enough room, the item will be added and VAR_RESULT will be set to TRUE; otherwise, VAR_RESULT is set to FALSE.
@ Attempts to add quantity of item index to the player's Bag. If the player has enough room, the item will be added and
@ VAR_RESULT will be set to TRUE; otherwise, VAR_RESULT is set to FALSE.
.macro additem index:req, quantity=1
.byte 0x44
.2byte \index
@ -482,21 +488,24 @@
.2byte \quantity
.endm
@ Checks if the player has enough space in their Bag to hold quantity more of item index. Sets VAR_RESULT to TRUE if there is room, or FALSE is there is no room.
@ Checks if the player has enough space in their Bag to hold quantity more of item index. Sets VAR_RESULT to
@ TRUE if there is room, or FALSE is there is no room.
.macro checkitemspace index:req, quantity:req
.byte 0x46
.2byte \index
.2byte \quantity
.endm
@ Checks if the player has quantity or more of item index in their Bag. Sets VAR_RESULT to TRUE if the player has enough of the item, or FALSE if they have fewer than quantity of the item.
@ Checks if the player has quantity or more of item index in their Bag. Sets VAR_RESULT to TRUE if the player has
@ enough of the item, or FALSE if they have fewer than quantity of the item.
.macro checkitem index:req, quantity:req
.byte 0x47
.2byte \index
.2byte \quantity
.endm
@ Checks which Bag pocket the specified item belongs in, and writes the pocket value (POCKET_*) to VAR_RESULT. This script is used to show the name of the proper Bag pocket when the player receives an item via callstd (simplified to giveitem in XSE).
@ Checks which Bag pocket the specified item belongs in, and writes the pocket value (POCKET_*) to VAR_RESULT.
@ This script is used to show the name of the proper Bag pocket when the player receives an item via callstd (simplified to giveitem in XSE).
.macro checkitemtype index:req
.byte 0x48
.2byte \index
@ -534,7 +543,8 @@
.2byte \decoration
.endm
@ Checks if the player has enough space in their PC to hold decoration. Sets VAR_RESULT to TRUE if there is room, or FALSE is there is no room. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
@ Checks if the player has enough space in their PC to hold decoration. Sets VAR_RESULT to TRUE if there is room, or
@ FALSE is there is no room. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
.macro checkdecorspace decoration:req
.byte 0x4e
.2byte \decoration
@ -556,7 +566,10 @@
.endif
.endm
@ Blocks script execution until the movements being applied to the specified (index) Object finish. If the specified Object is 0x0000, then the command will block script execution until all Objects affected by applymovement finish their movements. If the specified Object is not currently being manipulated with applymovement, then this command does nothing.
@ Blocks script execution until the movements being applied to the specified (index) Object finish.
@ If the specified Object is 0x0000, then the command will block script execution until all Objects
@ affected by applymovement finish their movements. If the specified Object is not currently being
@ manipulated with applymovement, then this command does nothing.
@ If no map is specified, then the current map is used.
.macro waitmovement index:req, map
.ifb \map
@ -569,7 +582,9 @@
.endif
.endm
@ Attempts to hide the specified (index) Object on the specified (map_group, map_num) map, by setting its visibility flag if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
@ Attempts to hide the specified (index) Object on the specified (map_group, map_num) map,
@ by setting its visibility flag if it has a valid one. If the Object does not have a valid
@ visibility flag, this command does nothing.
@ If no map is specified, then the current map is used.
.macro removeobject index:req, map
.ifb \map
@ -582,7 +597,8 @@
.endif
.endm
@ Unsets the specified (index) Object's visibility flag on the specified (map_group, map_num) map if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
@ Unsets the specified (index) Object's visibility flag on the specified (map_group, map_num) map if it has a valid one.
@ If the Object does not have a valid visibility flag, this command does nothing.
@ If no map is specified, then the current map is used.
.macro addobject index:req, map
.ifb \map
@ -723,7 +739,8 @@
.endm
@ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this command behind-the-scenes), and blocks script execution until the battle finishes.
@ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this
@ command behind-the-scenes), and blocks script execution until the battle finishes.
.macro trainerbattlebegin
.byte 0x5d
.endm
@ -763,7 +780,8 @@
.2byte \y
.endm
@ Copies a live object event's xy position to its template, so that if the sprite goes off screen, it'll still be there when it comes back on screen.
@ Copies a live object event's xy position to its template, so that if the sprite goes off screen,
@ it'll still be there when it comes back on screen.
.macro copyobjectxytoperm index:req
.byte 0x64
.2byte \index
@ -775,12 +793,15 @@
.byte \byte
.endm
@ If a standard message box (or its text) is being drawn on-screen, this command blocks script execution until the box and its text have been fully drawn.
@ If a standard message box (or its text) is being drawn on-screen, this command blocks script execution until the
@ box and its text have been fully drawn.
.macro waitmessage
.byte 0x66
.endm
@ Starts displaying a standard message box containing the specified text. If text is a pointer, then the string at that offset will be loaded and used. If text is script bank 0, then the value of script bank 0 will be treated as a pointer to the text. (You can use loadpointer to place a string pointer in a script bank.)
@ Starts displaying a standard message box containing the specified text. If text is a pointer, then the string at
@ that offset will be loaded and used. If text is script bank 0, then the value of script bank 0 will be treated as
@ a pointer to the text. (You can use loadpointer to place a string pointer in a script bank.)
.macro message text:req
.byte 0x67
.4byte \text
@ -816,14 +837,16 @@
.byte 0x6d
.endm
@ Displays a YES/NO multichoice box at the specified coordinates, and blocks script execution until the user makes a selection. Their selection is stored in VAR_RESULT as NO (0) or YES (1). Pressing B is equivalent to answering NO
@ Displays a YES/NO multichoice box at the specified coordinates, and blocks script execution until the user makes a selection.
@ Their selection is stored in VAR_RESULT as NO (0) or YES (1). Pressing B is equivalent to answering NO
.macro yesnobox x:req, y:req
.byte 0x6e
.byte \x
.byte \y
.endm
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made.
@ Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
.macro multichoice x:req, y:req, list:req, b:req
.byte 0x6f
.byte \x
@ -832,7 +855,10 @@
.byte \b
.endm
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. The default argument determines the initial position of the cursor when the box is first opened; it is zero-indexed, and if it is too large, it is treated as 0x00. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made.
@ Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. The default argument determines
@ the initial position of the cursor when the box is first opened; it is zero-indexed, and if it is too large, it is treated as 0x00.
@ If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
.macro multichoicedefault x:req, y:req, list:req, default:req, b:req
.byte 0x70
.byte \x
@ -842,7 +868,9 @@
.byte \b
.endm
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. The per_row argument determines how many list items will be shown on a single row of the box.
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made.
@ Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list.
@ The per_row argument determines how many list items will be shown on a single row of the box.
.macro multichoicegrid x:req, y:req, list:req, per_row:req, B:req
.byte 0x71
.byte \x
@ -894,7 +922,9 @@
.byte \a
.endm
@ Displays the string at pointer as braille text in a standard message box. The string must be formatted to use braille characters and needs to provide six extra starting characters that are skipped (in RS, these characters determined the box's size and position, but in Emerald these are calculated automatically).
@ Displays the string at pointer as braille text in a standard message box. The string must be formatted to use braille
@ characters and needs to provide six extra starting characters that are skipped (in RS, these characters determined the
@ box's size and position, but in Emerald these are calculated automatically).
.macro braillemessage text:req
.byte 0x78
.4byte \text
@ -923,7 +953,9 @@
.2byte \move
.endm
@ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, VAR_RESULT is set to the (zero-indexed) slot number of the first Pokemon that knows the move. If not, VAR_RESULT is set to PARTY_SIZE. VAR_0x8004 is also set to this Pokemon's species.
@ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, VAR_RESULT is set to the
@ (zero-indexed) slot number of the first Pokemon that knows the move. If not, VAR_RESULT is set to PARTY_SIZE.
@ VAR_0x8004 is also set to this Pokemon's species.
.macro checkpartymove index:req
.byte 0x7c
.2byte \index
@ -942,14 +974,16 @@
.byte \out
.endm
@ Writes the nickname of the Pokemon in slot slot (zero-indexed) of the player's party to the specified buffer. If an empty or invalid slot is specified, ten spaces ("") are written to the buffer.
@ Writes the nickname of the Pokemon in slot slot (zero-indexed) of the player's party to the specified buffer.
@ If an empty or invalid slot is specified, ten spaces ("") are written to the buffer.
.macro bufferpartymonnick out:req, slot:req
.byte 0x7f
.byte \out
.2byte \slot
.endm
@ Writes the name of the item at index item to the specified buffer. If the specified index is larger than the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
@ Writes the name of the item at index item to the specified buffer. If the specified index is larger than
@ the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
.macro bufferitemname out:req, item:req
.byte 0x80
.byte \out
@ -977,7 +1011,8 @@
.2byte \input
.endm
@ Writes the standard string identified by index to the specified buffer. This command has no protections in place at all, so specifying an invalid standard string (e.x. 0x2B) can and usually will cause data corruption.
@ Writes the standard string identified by index to the specified buffer. This command has no protections in place at all,
@ so specifying an invalid standard string (e.x. 0x2B) can and usually will cause crashes or garbage characters.
.macro bufferstdstring out:req, index:req
.byte 0x84
.byte \out
@ -1063,7 +1098,8 @@
.byte \check
.endm
@ If check is 0x00, this command will check if the player has money >= value; VAR_RESULT is set to TRUE if the player has enough money, or FALSE if they do not.
@ If check is 0x00, this command will check if the player has money >= value; VAR_RESULT is set to TRUE if the player
@ has enough money, or FALSE if they do not.
.macro checkmoney value:req, check:req
.byte 0x92
.4byte \value
@ -1291,7 +1327,8 @@
.2byte \count
.endm
@ Prepares to start a wild battle against a species at Level level holding item. Running this command will not affect normal wild battles. You start the prepared battle with dowildbattle.
@ Prepares to start a wild battle against a species at Level level holding item. Running this command will not affect
@ normal wild battles. You start the prepared battle with dowildbattle.
.macro setwildbattle species:req, level:req, item:req
.byte 0xb6
.2byte \species
@ -1395,19 +1432,22 @@
.2byte \box
.endm
@ Sets the color of the text in standard message boxes. 0x00 produces blue (male) text, 0x01 produces red (female) text, 0xFF resets the color to the default for the current OW's gender, and all other values produce black text.
@ Sets the color of the text in standard message boxes. 0x00 produces blue (male) text, 0x01 produces red (female) text,
@ 0xFF resets the color to the default for the current OW's gender, and all other values produce black text.
.macro textcolor color:req
.byte 0xc7
.byte \color
.endm
@ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened.
@ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom
@ of the screen when the Main Menu is opened.
.macro loadhelp pointer:req
.byte 0xc8
.4byte \pointer
.endm
@ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened.
@ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of
@ the screen when the Main Menu is opened.
.macro unloadhelp
.byte 0xc9
.endm
@ -1435,13 +1475,15 @@
.2byte \slot
.endm
@ Checks if the Pokemon in the specified slot of the player's party is obedient. If the Pokemon is disobedient, VAR_RESULT is TRUE. If the Pokemon is obedient (or if the specified slot is empty or invalid), VAR_RESULT is FALSE.
@ Checks if the Pokemon in the specified slot of the player's party is obedient. If the Pokemon is disobedient,
@ VAR_RESULT is TRUE. If the Pokemon is obedient (or if the specified slot is empty or invalid), VAR_RESULT is FALSE.
.macro checkmonobedience slot:req
.byte 0xce
.2byte \slot
.endm
@ Depending on factors I haven't managed to understand yet, this command may cause script execution to jump to the offset specified by the pointer at 0x020375C0.
@ Depending on factors I haven't managed to understand yet, this command may cause script execution to jump to the
@ offset specified by the pointer at 0x020375C0.
.macro gotoram
.byte 0xcf
.endm
@ -1468,7 +1510,8 @@
.byte \location
.endm
@ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Moves the objects on the colored puzzle specified by puzzleNumber one rotation
@ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Moves the objects on the colored puzzle
@ specified by puzzleNumber one rotation
.macro moverotatingtileobjects puzzleNumber:req
.byte 0xd3
.2byte \puzzleNumber
@ -1479,7 +1522,9 @@
.byte 0xd4
.endm
@ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Allocates memory for the puzzle objects. isTrickHouse is needed to determine which of the two maps the puzzle is on, in order to know where in the tileset the puzzle tiles start. In FireRed, this command is a nop.
@ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Allocates memory for the puzzle objects.
@ isTrickHouse is needed to determine which of the two maps the puzzle is on, in order to know where in the tileset
@ the puzzle tiles start. In FireRed, this command is a nop.
.macro initrotatingtilepuzzle isTrickHouse:req
.byte 0xd5
.2byte \isTrickHouse
@ -1551,7 +1596,10 @@
.2byte \word
.endm
@ Writes the name of the specified (item) item to the specified buffer. If the specified item is a Berry (0x85 - 0xAE) or Poke Ball (0x4) and if the quantity is 2 or more, the buffered string will be pluralized ("IES" or "S" appended). If the specified item is the Enigma Berry, I have no idea what this command does (but testing showed no pluralization). If the specified index is larger than the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
@ Writes the name of the specified (item) item to the specified buffer. If the specified item is a Berry (0x85 - 0xAE) or
@ Poke Ball (0x4) and if the quantity is 2 or more, the buffered string will be pluralized ("IES" or "S" appended).
@ If the specified item is the Enigma Berry, I have no idea what this command does (but testing showed no pluralization).
@ If the specified index is larger than the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
.macro bufferitemnameplural out:req, item:req, quantity:req
.byte 0xe2
.byte \out

View File

@ -172,7 +172,7 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_WonTourney:: @ 824BF62
BattleFrontier_BattleDomeBattleRoom_EventScript_WonLvOpenTourney:: @ 824BF96
msgbox BattleFrontier_BattleDomeBattleRoom_Text_PlayerIsLvOpenChamp, MSGBOX_DEFAULT
BattleFrontier_BattleDomeBattleRoom_EventScript_CelebrateWin:: @ 824BF9E
special DoConfettiEffect
special DoDomeConfetti
playse SE_W227B
call BattleFrontier_BattleDomeBattleRoom_EventScript_AudienceLookAround
delay 60

View File

@ -45,7 +45,7 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_OpponentEnter:: @ 8241BC3
BattleFrontier_BattleTower_EventScript_WarpToLobbyLost:: @ 8241C03
frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST
tower_set TOWER_DATA_LVL_MODE
setvar VAR_0x8004, 3
setvar VAR_0x8004, FANCOUNTER_USED_BATTLE_TOWER
special Script_TryGainNewFanFromCounter
goto BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobby
@ -134,7 +134,7 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_ContinueChallenge:: @ 8241DDC
BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobbyWon:: @ 8241DF6
frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_WON
tower_set TOWER_DATA_LVL_MODE
setvar VAR_0x8004, 3
setvar VAR_0x8004, FANCOUNTER_USED_BATTLE_TOWER
special Script_TryGainNewFanFromCounter
goto BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobby

View File

@ -103,7 +103,7 @@ BattleFrontier_BattleTowerMultiBattleRoom_EventScript_DoTowerBattle:: @ 8249069
BattleFrontier_BattleTowerMultiBattleRoom_EventScript_WarpToLobbyLost:: @ 824907E
frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST
tower_set TOWER_DATA_LVL_MODE
setvar VAR_0x8004, 3
setvar VAR_0x8004, FANCOUNTER_USED_BATTLE_TOWER
special Script_TryGainNewFanFromCounter
goto BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobby
@ -208,7 +208,7 @@ BattleFrontier_BattleTowerMultiBattleRoom_EventScript_ContinueChallenge:: @ 8249
BattleFrontier_BattleTowerMultiBattleRoom_EventScript_WarpToLobbyWon:: @ 82492AF
frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_WON
tower_set TOWER_DATA_LVL_MODE
setvar VAR_0x8004, 3
setvar VAR_0x8004, FANCOUNTER_USED_BATTLE_TOWER
special Script_TryGainNewFanFromCounter
goto BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobby

View File

@ -54,7 +54,7 @@ EverGrandeCity_DrakesRoom_EventScript_PostBattleSpeech:: @ 822871A
end
EverGrandeCity_DrakesRoom_EventScript_Defeated:: @ 8228724
setvar VAR_0x8004, 0
setvar VAR_0x8004, FANCOUNTER_DEFEATED_DRAKE
special Script_TryGainNewFanFromCounter
setflag FLAG_DEFEATED_ELITE_4_DRAKE
call PokemonLeague_EliteFour_SetAdvanceToNextRoomMetatiles

View File

@ -43,7 +43,7 @@ LilycoveCity_ContestLobby_EventScript_ContestArtist:: @ 821A264
msgbox LilycoveCity_ContestLobby_Text_YourPokemonSpurredMeToPaint, MSGBOX_DEFAULT
lockall
fadescreen FADE_TO_BLACK
showcontestwinner 0
showcontestwinner CONTEST_WINNER_ARTIST
lockall
msgbox LilycoveCity_ContestLobby_Text_ShouldITakePaintingToMuseum, MSGBOX_YESNO
compare VAR_RESULT, YES
@ -217,7 +217,7 @@ LilycoveCity_ContestLobby_EventScript_LinkContestArtist:: @ 821A436
msgbox LilycoveCity_ContestLobby_Text_YourPokemonSpurredMeToPaint, MSGBOX_DEFAULT
lockall
fadescreen FADE_TO_BLACK
showcontestwinner 0
showcontestwinner CONTEST_WINNER_ARTIST
msgbox LilycoveCity_ContestLobby_Text_ShouldITakePaintingToMuseum, MSGBOX_YESNO
compare VAR_RESULT, YES
goto_if_eq LilycoveCity_ContestLobby_EventScript_TakePaintingToMuseumLink
@ -505,42 +505,42 @@ LilycoveCity_ContestLobby_EventScript_NinjaBoy:: @ 821A735
LilycoveCity_ContestLobby_EventScript_ContestWinner1:: @ 821A73E
lockall
fadescreen FADE_TO_BLACK
showcontestwinner 1
showcontestwinner CONTEST_WINNER_HALL_1
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner2:: @ 821A745
lockall
fadescreen FADE_TO_BLACK
showcontestwinner 2
showcontestwinner CONTEST_WINNER_HALL_2
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner3:: @ 821A74C
lockall
fadescreen FADE_TO_BLACK
showcontestwinner 3
showcontestwinner CONTEST_WINNER_HALL_3
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner4:: @ 821A753
lockall
fadescreen FADE_TO_BLACK
showcontestwinner 4
showcontestwinner CONTEST_WINNER_HALL_4
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner5:: @ 821A75A
lockall
fadescreen FADE_TO_BLACK
showcontestwinner 5
showcontestwinner CONTEST_WINNER_HALL_5
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner6:: @ 821A761
lockall
fadescreen FADE_TO_BLACK
showcontestwinner 6
showcontestwinner CONTEST_WINNER_HALL_6
releaseall
end

View File

@ -183,35 +183,35 @@ LilycoveCity_LilycoveMuseum_2F_EventScript_RichBoy:: @ 821999C
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowCoolPainting:: @ 82199A5
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
showcontestwinner 9
showcontestwinner CONTEST_WINNER_MUSEUM_COOL
releaseall
end
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowBeautyPainting:: @ 82199B3
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
showcontestwinner 10
showcontestwinner CONTEST_WINNER_MUSEUM_BEAUTY
releaseall
end
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowCutePainting:: @ 82199C1
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
showcontestwinner 11
showcontestwinner CONTEST_WINNER_MUSEUM_CUTE
releaseall
end
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowSmartPainting:: @ 82199CF
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
showcontestwinner 12
showcontestwinner CONTEST_WINNER_MUSEUM_SMART
releaseall
end
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowToughPainting:: @ 82199DD
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
showcontestwinner 13
showcontestwinner CONTEST_WINNER_MUSEUM_TOUGH
releaseall
end

View File

@ -498,7 +498,7 @@ gSpecials:: @ 81DBA64
def_special GetPCBoxToSendMon
def_special ShouldShowBoxWasFullMessage
def_special SetMatchCallRegisteredFlag
def_special DoConfettiEffect
def_special DoDomeConfetti
def_special CreateAbnormalWeatherEvent
def_special GetAbnormalWeatherMapNameAndType
def_special GetMartEmployeeObjectEventId

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -57,15 +57,15 @@ u32 sub_80397C4(u32 setId, u32 tableId);
void SpriteCb_WildMon(struct Sprite *sprite);
void SpriteCallbackDummy_2(struct Sprite *sprite);
void SpriteCB_FaintOpponentMon(struct Sprite *sprite);
void sub_8039AD8(struct Sprite *sprite);
void sub_8039B2C(struct Sprite *sprite);
void sub_8039B58(struct Sprite *sprite);
void SpriteCb_ShowAsMoveTarget(struct Sprite *sprite);
void SpriteCb_HideAsMoveTarget(struct Sprite *sprite);
void SpriteCb_OpponentMonFromBall(struct Sprite *sprite);
void sub_8039BB4(struct Sprite *sprite);
void sub_80105DC(struct Sprite *sprite);
void sub_8039C00(struct Sprite *sprite);
void DoBounceEffect(u8 battlerId, u8 b, s8 c, s8 d);
void EndBounceEffect(u8 battlerId, bool8 b);
void sub_8039E44(struct Sprite *sprite);
void SpriteCb_PlayerMonFromBall(struct Sprite *sprite);
void sub_8039E60(struct Sprite *sprite);
void sub_8039E84(struct Sprite *sprite);
void sub_8039E9C(struct Sprite *sprite);

33
include/confetti_util.h Normal file
View File

@ -0,0 +1,33 @@
#ifndef GUARD_CONFETTI_UTIL_H
#define GUARD_CONFETTI_UTIL_H
struct ConfettiUtil
{
struct OamData oam;
s16 x;
s16 y;
s16 xDelta;
s16 yDelta;
u16 tileTag;
u16 palTag;
u16 tileNum;
u8 id;
u8 filler;
u8 animNum;
u8 active:1;
u8 allowUpdates:1;
u8 dummied:1;
u8 priority:2;
s16 data[8];
void (*callback)(struct ConfettiUtil *);
};
bool32 ConfettiUtil_Init(u8 count);
bool32 ConfettiUtil_Free(void);
bool32 ConfettiUtil_Update(void);
u8 ConfettiUtil_SetCallback(u8 id, void (*func)(struct ConfettiUtil *));
u8 ConfettiUtil_SetData(u8 id, u8 dataArrayId, s16 dataValue);
u8 ConfettiUtil_AddNew(const struct OamData *oam, u16 tileTag, u16 palTag, s16 x, s16 y, u8 animNum, u8 priority);
u8 ConfettiUtil_Remove(u8 id);
#endif // GUARD_CONFETTI_UTIL_H

View File

@ -29,6 +29,23 @@
#define CONTEST_CATEGORY_TOUGH 4
#define CONTEST_CATEGORIES_COUNT 5
#define CONTEST_WINNER_ARTIST 0 // Winner shown by the artist, painting not necessarily saved
#define CONTEST_WINNER_HALL_1 1
#define CONTEST_WINNER_HALL_2 2
#define CONTEST_WINNER_HALL_3 3
#define CONTEST_WINNER_HALL_4 4
#define CONTEST_WINNER_HALL_5 5
#define CONTEST_WINNER_HALL_6 6
#define NUM_CONTEST_HALL_WINNERS 6
#define CONTEST_WINNER_7 7
#define CONTEST_WINNER_8 8
#define CONTEST_WINNER_MUSEUM_COOL 9
#define CONTEST_WINNER_MUSEUM_BEAUTY 10
#define CONTEST_WINNER_MUSEUM_CUTE 11
#define CONTEST_WINNER_MUSEUM_SMART 12
#define CONTEST_WINNER_MUSEUM_TOUGH 13
// NUM_CONTEST_WINNERS in constants/global.h
#define CANT_ENTER_CONTEST 0
#define CAN_ENTER_CONTEST_EQUAL_RANK 1
#define CAN_ENTER_CONTEST_HIGH_RANK 2

View File

@ -75,4 +75,9 @@
#define FANCLUB_MEMBER7 14
#define FANCLUB_MEMBER8 15
#define FANCOUNTER_DEFEATED_DRAKE 0
#define FANCOUNTER_BATTLED_AT_BASE 1
#define FANCOUNTER_FINISHED_CONTEST 2
#define FANCOUNTER_USED_BATTLE_TOWER 3
#endif // GUARD_CONSTANTS_FIELD_SPECIALS_H

View File

@ -1573,7 +1573,9 @@
#define FLAG_UNUSED_0x91F (SYSTEM_FLAGS + 0xBF) // Unused Flag
// Daily Flags
#define DAILY_FLAGS_START 0x920
// These flags are cleared once per day
// The start and end are byte-aligned because the flags are cleared in byte increments
#define DAILY_FLAGS_START (FLAG_UNUSED_0x91F + (8 - FLAG_UNUSED_0x91F % 8))
#define FLAG_UNUSED_0x920 (DAILY_FLAGS_START + 0x0) // Unused Flag
#define FLAG_DAILY_CONTEST_LOBBY_RECEIVED_BERRY (DAILY_FLAGS_START + 0x1)
#define FLAG_DAILY_SECRET_BASE (DAILY_FLAGS_START + 0x2)
@ -1639,7 +1641,9 @@
#define FLAG_UNUSED_0x95D (DAILY_FLAGS_START + 0x3D) // Unused Flag
#define FLAG_UNUSED_0x95E (DAILY_FLAGS_START + 0x3E) // Unused Flag
#define FLAG_UNUSED_0x95F (DAILY_FLAGS_START + 0x3F) // Unused Flag
#define DAILY_FLAGS_END FLAG_UNUSED_0x95F
#define DAILY_FLAGS_END (FLAG_UNUSED_0x95F + (7 - FLAG_UNUSED_0x95F % 8))
#define FLAGS_COUNT (DAILY_FLAGS_END + 1)
// Special Flags (Stored in EWRAM (gSpecialFlags), not in the SaveBlock)
#define SPECIAL_FLAGS_START 0x4000

View File

@ -34,8 +34,6 @@
#define POKEBLOCKS_COUNT 40
#define OBJECT_EVENTS_COUNT 16
#define BERRY_TREES_COUNT 128
#define FLAGS_COUNT 300
#define VARS_COUNT 256
#define MAIL_COUNT 16
#define SECRET_BASES_COUNT 20
#define TV_SHOWS_COUNT 25
@ -52,6 +50,7 @@
#define APPRENTICE_COUNT 4
#define APPRENTICE_MAX_QUESTIONS 9
#define MAX_REMATCH_ENTRIES 100 // only REMATCH_TABLE_ENTRIES (78) are used
#define NUM_CONTEST_WINNERS 13
#define UNION_ROOM_KB_ROW_COUNT 10
#define PYRAMID_BAG_ITEMS_COUNT 10

View File

@ -17,6 +17,8 @@
#define ITEM_LUXURY_BALL 11
#define ITEM_PREMIER_BALL 12
#define LAST_BALL ITEM_PREMIER_BALL
// Pokemon Items
#define ITEM_POTION 13
#define ITEM_ANTIDOTE 14

View File

@ -859,6 +859,7 @@
// NOTE: Because each Trainer uses a flag to determine when they are defeated, there is only space for 9 additional trainers before trainer flag space overflows
// More space can be made by shifting flags around in constants/flags.h or changing how trainer flags are handled
// MAX_TRAINERS_COUNT can be increased but will take up additional saveblock space
#define TRAINERS_COUNT 855
#define MAX_TRAINERS_COUNT 864

View File

@ -274,6 +274,7 @@
#define VAR_UNUSED_0x40FF 0x40FF // Unused Var
#define VARS_END 0x40FF
#define VARS_COUNT (VARS_END - VARS_START + 1)
#define SPECIAL_VARS_START 0x8000
// special vars

View File

@ -430,9 +430,9 @@ struct ContestResources
extern struct ContestPokemon gContestMons[CONTESTANT_COUNT];
extern s16 gContestMonConditions[CONTESTANT_COUNT];
extern s16 gUnknown_02039F08[CONTESTANT_COUNT];
extern s16 gContestMonTotalPoints[CONTESTANT_COUNT];
extern s16 gUnknown_02039F10[CONTESTANT_COUNT];
extern s16 gUnknown_02039F18[CONTESTANT_COUNT];
extern s16 gContestMonRound2Points[CONTESTANT_COUNT];
extern u8 gContestFinalStandings[CONTESTANT_COUNT];
extern u8 gContestMonPartyIndex;
extern u8 gContestPlayerMonIndex;
@ -448,7 +448,6 @@ extern u8 sContestBgCopyFlags;
extern struct ContestWinner gCurContestWinner;
extern u8 gUnknown_02039F5C;
extern u8 gUnknown_02039F5D;
extern u32 gContestRngValue;
// contest.c

View File

@ -1,5 +1,5 @@
#ifndef GUARD_CONTEST_LINK_80FC4F4_H
#define GUARD_CONTEST_LINK_80FC4F4_H
#ifndef GUARD_CONTEST_LINK_H
#define GUARD_CONTEST_LINK_H
void sub_80FCC88(u8);
void sub_80FCC88(u8);
@ -10,4 +10,4 @@ void sub_80FC804(u8);
void sub_80FCE48(u8);
void sub_80FC894(u8);
#endif //GUARD_CONTEST_LINK_80FC4F4_H
#endif //GUARD_CONTEST_LINK_H

View File

@ -1,12 +1,12 @@
#ifndef GUARD_CONTEST_LINK_80F57C4_H
#define GUARD_CONTEST_LINK_80F57C4_H
#ifndef GUARD_CONTEST_UTIL_H
#define GUARD_CONTEST_UTIL_H
void BufferContestantTrainerName(void);
void BufferContestantMonNickname(void);
void StartContest(void);
void BufferContestantMonSpecies(void);
void sub_80F8484(void);
void sub_80F84C4(u8);
void ShowContestResults(void);
void ContestLinkTransfer(u8);
void sub_80FC998(u8 taskId);
#endif // GUARD_CONTEST_LINK_80F57C4_H
#endif // GUARD_CONTEST_UTIL_H

View File

@ -1,9 +1,6 @@
#ifndef GUARD_EVENT_DATA_H
#define GUARD_EVENT_DATA_H
#include "constants/flags.h"
#include "constants/vars.h"
void InitEventData(void);
void ClearTempFieldEventData(void);
void ClearDailyFlags(void);

View File

@ -6,6 +6,8 @@
#include "config.h" // we need to define config before gba headers as print stuff needs the functions nulled before defines.
#include "gba/gba.h"
#include "constants/global.h"
#include "constants/flags.h"
#include "constants/vars.h"
// Prevent cross-jump optimization.
#define BLOCK_CROSS_JUMP asm("");
@ -109,6 +111,11 @@
f; \
})
#define ROUND_BITS_TO_BYTES(numBits)(((numBits) / 8) + (((numBits) % 8) ? 1 : 0))
#define DEX_FLAGS_NO (ROUND_BITS_TO_BYTES(POKEMON_SLOTS_NUMBER))
#define NUM_FLAG_BYTES (ROUND_BITS_TO_BYTES(FLAGS_COUNT))
struct Coords8
{
s8 x;
@ -153,8 +160,6 @@ struct Time
/*0x04*/ s8 seconds;
};
#define DEX_FLAGS_NO ((POKEMON_SLOTS_NUMBER / 8) + ((POKEMON_SLOTS_NUMBER % 8) ? 1 : 0))
struct Pokedex
{
/*0x00*/ u8 order;
@ -923,7 +928,7 @@ struct SaveBlock1
/*0x9CA*/ u8 trainerRematches[MAX_REMATCH_ENTRIES];
/*0xA30*/ struct ObjectEvent objectEvents[OBJECT_EVENTS_COUNT];
/*0xC70*/ struct ObjectEventTemplate objectEventTemplates[OBJECT_EVENT_TEMPLATES_COUNT];
/*0x1270*/ u8 flags[FLAGS_COUNT];
/*0x1270*/ u8 flags[NUM_FLAG_BYTES];
/*0x139C*/ u16 vars[VARS_COUNT];
/*0x159C*/ u32 gameStats[NUM_GAME_STATS];
/*0x169C*/ struct BerryTree berryTrees[BERRY_TREES_COUNT];
@ -960,7 +965,7 @@ struct SaveBlock1
/*0x2E20*/ u8 additionalPhrases[8]; // bitfield for 33 additional phrases in easy chat system
/*0x2E28*/ OldMan oldMan;
/*0x2e64*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff
/*0x2e90*/ struct ContestWinner contestWinners[13]; // 0 - 5 used in contest hall, 6 - 7 unused?, 8 - 12 museum
/*0x2e90*/ struct ContestWinner contestWinners[NUM_CONTEST_WINNERS]; // see CONTEST_WINNER_*
/*0x3030*/ struct DayCare daycare;
/*0x3150*/ struct LinkBattleRecords linkBattleRecords;
/*0x31A8*/ u8 giftRibbons[52];

View File

@ -4082,8 +4082,8 @@ extern const u8 gNamingScreenUnderscoreTiles[];
extern const u32 gUnknown_08D9BA44[];
extern const u32 gContestConfetti_Gfx[];
extern const u32 gContestConfetti_Pal[];
extern const u32 gConfetti_Gfx[];
extern const u32 gConfetti_Pal[];
extern const u32 gUnknown_08C093F0[];
extern const u32 gSubstituteDollTilemap[];
@ -4927,23 +4927,23 @@ extern const u32 gRouletteCreditTiles[];
extern const u32 gRouletteNumbersTiles[];
extern const u32 gRouletteMultiplierTiles[];
// Contest Link
extern const u32 gUnknown_08C19588[];
// Contest util
extern const u32 gContestResults_Gfx[];
extern const u32 gUnknown_08C19EEC[];
extern const u32 gUnknown_08C1A000[];
extern const u32 gUnknown_08C1A12C[];
extern const u32 gUnknown_08C1A2B4[];
extern const u16 gUnknown_08DC6498[];
extern const u16 gUnknown_08DC63F8[];
extern const u16 gUnknown_08DC6420[];
extern const u16 gUnknown_08DC6448[];
extern const u16 gUnknown_08DC6470[];
extern const u16 gUnknown_08DC64AC[];
extern const u16 gUnknown_08DC64C0[];
extern const u16 gUnknown_08DC64D4[];
extern const u16 gUnknown_08DC64E8[];
extern const u16 gUnknown_08DC64FC[];
extern const u16 gUnknown_08DC6510[];
extern const u32 gContestResults_Pal[];
extern const u16 gLinkContestResults_Tilemap[];
extern const u16 gNormalContestResults_Tilemap[];
extern const u16 gSuperContestResults_Tilemap[];
extern const u16 gHyperContestResults_Tilemap[];
extern const u16 gMasterContestResults_Tilemap[];
extern const u16 gCoolContestResults_Tilemap[];
extern const u16 gBeautyContestResults_Tilemap[];
extern const u16 gCuteContestResults_Tilemap[];
extern const u16 gSmartContestResults_Tilemap[];
extern const u16 gToughContestResults_Tilemap[];
extern const u16 gContestResults_Tilemap[];
// Trainer Card.
extern const u16 gHoennTrainerCard0Star_Pal[];

View File

@ -4,7 +4,6 @@
void CB2_DoHallOfFameScreen(void);
void CB2_DoHallOfFameScreenDontSaveData(void);
void CB2_DoHallOfFamePC(void);
void DoConfettiEffect(void);
// hof_pc.c
void ReturnFromHallOfFamePC(void);

View File

@ -52,10 +52,7 @@ struct BagMenuStruct
void (*exitCallback)(void);
u8 tilemapBuffer[0x800];
u8 spriteId[12];
u8 windowPointers[7];
u8 unk817;
u8 unk818;
u8 unk819;
u8 windowPointers[10];
u8 itemOriginalLocation;
u8 pocketSwitchDisabled:4;
u8 itemIconSlot:2;

View File

@ -1,33 +0,0 @@
#ifndef GUARD_ROM_81520A8_H
#define GUARD_ROM_81520A8_H
struct UnkStruct_81520A8
{
struct OamData oam;
s16 x;
s16 y;
s16 xDelta;
s16 yDelta;
u16 tileTag;
u16 palTag;
u16 tileNum;
u8 id;
u8 filler17; // Unused.
u8 unk18;
u8 unk19_0:1;
u8 unk19_1:1;
u8 unk19_2:1;
u8 priority:2;
s16 data[8];
void (*callback)(struct UnkStruct_81520A8 *);
};
bool32 sub_81521C0(u8 count);
bool32 sub_8152254(void);
bool32 sub_81522D4(void);
u8 sub_8152438(u8 id, void (*func)(struct UnkStruct_81520A8 *));
u8 sub_8152474(u8 id, u8 dataArrayId, s16 dataValue);
u8 sub_81524C4(const struct OamData *oam, u16 tileTag, u16 palTag, s16 x, s16 y, u8 arg5, u8 priority);
u8 sub_81525D0(u8 id);
#endif // GUARD_ROM_81520A8_H

View File

@ -2494,7 +2494,7 @@ extern const u8 gText_CommunicationStandby[];
extern const u8 gText_AnnouncingResults[];
extern const u8 gText_PreliminaryResults[];
extern const u8 gText_Round2Results[];
extern const u8 gText_Var1sVar2Won[];
extern const u8 gText_ContestantsMonWon[];
// Trainer Card
extern const u8 gText_LinkCableBattles[];

View File

@ -169,7 +169,7 @@ SECTIONS {
src/record_mixing.o(.text);
src/secret_base.o(.text);
src/tv.o(.text);
src/contest_link_80F57C4.o(.text);
src/contest_util.o(.text);
src/script_pokemon_util_80F87D8.o(.text);
src/field_poison.o(.text);
src/pokemon_size_record.o(.text);
@ -177,7 +177,7 @@ SECTIONS {
src/field_special_scene.o(.text);
src/rotating_gate.o(.text);
src/safari_zone.o(.text);
src/contest_link_80FC4F4.o(.text);
src/contest_link.o(.text);
src/item_use.o(.text);
src/battle_anim_effects_1.o(.text);
src/battle_anim_effects_2.o(.text);
@ -238,7 +238,7 @@ SECTIONS {
src/cable_car.o(.text);
src/math_util.o(.text);
src/roulette_util.o(.text);
src/rom_81520A8.o(.text);
src/confetti_util.o(.text);
src/save.o(.text);
src/mystery_event_script.o(.text);
src/field_effect_helpers.o(.text);
@ -329,7 +329,7 @@ SECTIONS {
src/trainer_hill.o(.text);
src/rayquaza_scene.o(.text);
src/walda_phrase.o(.text);
src/contest_link_81D9DE4.o(.text);
src/contest_link_util.o(.text);
src/gym_leader_rematch.o(.text);
src/unk_transition.o(.text);
src/international_string_util.o(.text);
@ -544,13 +544,13 @@ SECTIONS {
src/record_mixing.o(.rodata);
src/secret_base.o(.rodata);
src/tv.o(.rodata);
src/contest_link_80F57C4.o(.rodata);
src/contest_util.o(.rodata);
src/script_pokemon_util_80F87D8.o(.rodata);
src/pokemon_size_record.o(.rodata)
src/fldeff_misc.o(.rodata);
src/field_special_scene.o(.rodata);
src/rotating_gate.o(.rodata);
src/contest_link_80FC4F4.o(.rodata);
src/contest_link.o(.rodata);
src/item_use.o(.rodata);
src/battle_anim_effects_1.o(.rodata);
src/battle_anim_effects_2.o(.rodata);

View File

@ -316,7 +316,7 @@ static void HandleInputChooseAction(void)
if (gBattleBufferA[gActiveBattler][1] == B_ACTION_USE_ITEM)
{
// Add item to bag if it is a ball
if (itemId <= ITEM_PREMIER_BALL)
if (itemId <= LAST_BALL)
AddBagItem(itemId, 1);
else
return;
@ -359,7 +359,7 @@ static void HandleInputChooseTarget(void)
} while (i < gBattlersCount);
}
if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2)
if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
gPlayerDpadHoldFrames++;
else
gPlayerDpadHoldFrames = 0;
@ -367,7 +367,7 @@ static void HandleInputChooseTarget(void)
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C;
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
PlayerBufferExecCompleted();
@ -375,7 +375,7 @@ static void HandleInputChooseTarget(void)
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
{
PlaySE(SE_SELECT);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C;
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove;
DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1);
DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1);
@ -384,7 +384,7 @@ static void HandleInputChooseTarget(void)
else if (gMain.newKeys & (DPAD_LEFT | DPAD_UP))
{
PlaySE(SE_SELECT);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C;
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
do
{
@ -421,12 +421,12 @@ static void HandleInputChooseTarget(void)
if (gAbsentBattlerFlags & gBitTable[gMultiUsePlayerCursor])
i = 0;
} while (i == 0);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8;
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget;
}
else if (gMain.newKeys & (DPAD_RIGHT | DPAD_DOWN))
{
PlaySE(SE_SELECT);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C;
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
do
{
@ -463,7 +463,7 @@ static void HandleInputChooseTarget(void)
if (gAbsentBattlerFlags & gBitTable[gMultiUsePlayerCursor])
i = 0;
} while (i == 0);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8;
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget;
}
}
@ -536,7 +536,7 @@ static void HandleInputChooseMove(void)
else
gMultiUsePlayerCursor = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8;
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget;
}
}
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)

View File

@ -96,7 +96,7 @@ static void SpriteCb_WildMonShowHealthbox(struct Sprite *sprite);
static void SpriteCb_WildMonAnimate(struct Sprite *sprite);
static void sub_80398D0(struct Sprite *sprite);
static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite);
static void sub_8039AF4(struct Sprite *sprite);
static void SpriteCb_BlinkVisible(struct Sprite *sprite);
static void SpriteCallbackDummy_3(struct Sprite *sprite);
static void oac_poke_ally_(struct Sprite *sprite);
static void SpecialStatusesClear(void);
@ -2798,31 +2798,31 @@ static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite)
}
}
void sub_8039AD8(struct Sprite *sprite)
// Used when selecting a move, which can hit multiple targets, in double battles.
void SpriteCb_ShowAsMoveTarget(struct Sprite *sprite)
{
sprite->data[3] = 8;
sprite->data[4] = sprite->invisible;
sprite->callback = sub_8039AF4;
sprite->callback = SpriteCb_BlinkVisible;
}
static void sub_8039AF4(struct Sprite *sprite)
static void SpriteCb_BlinkVisible(struct Sprite *sprite)
{
sprite->data[3]--;
if (sprite->data[3] == 0)
if (--sprite->data[3] == 0)
{
sprite->invisible ^= 1;
sprite->data[3] = 8;
}
}
void sub_8039B2C(struct Sprite *sprite)
void SpriteCb_HideAsMoveTarget(struct Sprite *sprite)
{
sprite->invisible = sprite->data[4];
sprite->data[4] = FALSE;
sprite->callback = SpriteCallbackDummy_2;
}
void sub_8039B58(struct Sprite *sprite)
void SpriteCb_OpponentMonFromBall(struct Sprite *sprite)
{
if (sprite->affineAnimEnded)
{
@ -2965,7 +2965,7 @@ static void SpriteCB_BounceEffect(struct Sprite *sprite)
#undef sBouncerSpriteId
#undef sWhich
void sub_8039E44(struct Sprite *sprite)
void SpriteCb_PlayerMonFromBall(struct Sprite *sprite)
{
if (sprite->affineAnimEnded)
BattleAnimateBackSprite(sprite, sprite->sSpeciesId);
@ -5547,7 +5547,7 @@ static void HandleAction_UseItem(void)
ClearFuryCutterDestinyBondGrudge(gBattlerAttacker);
gLastUsedItem = gBattleBufferB[gBattlerAttacker][1] | (gBattleBufferB[gBattlerAttacker][2] << 8);
if (gLastUsedItem <= ITEM_PREMIER_BALL) // is ball
if (gLastUsedItem <= LAST_BALL) // is ball
{
gBattlescriptCurrInstr = gBattlescriptsForBallThrow[gLastUsedItem];
}

View File

@ -7,7 +7,6 @@
#include "metatile_behavior.h"
#include "overworld.h"
#include "sound.h"
#include "constants/flags.h"
#include "constants/map_types.h"
#include "constants/songs.h"

View File

@ -6,7 +6,6 @@
#include "sound.h"
#include "task.h"
#include "constants/field_effects.h"
#include "constants/flags.h"
#include "constants/maps.h"
#include "constants/songs.h"
#include "constants/species.h"

218
src/confetti_util.c Normal file
View File

@ -0,0 +1,218 @@
#include "global.h"
#include "confetti_util.h"
#include "malloc.h"
#include "main.h"
#include "digit_obj_util.h"
static EWRAM_DATA struct
{
u8 count;
struct ConfettiUtil *array;
} *sWork = NULL;
static void sub_81520A8(void *dest, u16 value, u8 left, u8 top, u8 width, u8 height) // Unused.
{
u8 i;
u8 j;
u8 x;
u8 y;
for (i = 0, y = top; i < height; i++)
{
for (x = left, j = 0; j < width; j++)
{
*(u16 *)((dest) + (y * 64 + x * 2)) = value;
x = (x + 1) % 32;
}
y = (y + 1) % 32;
}
}
static void sub_8152134(void *dest, const u16 *src, u8 left, u8 top, u8 width, u8 height) // Unused.
{
u8 i;
u8 j;
u8 x;
u8 y;
const u16 *_src;
for (i = 0, _src = src, y = top; i < height; i++)
{
for (x = left, j = 0; j < width; j++)
{
*(u16 *)((dest) + (y * 64 + x * 2)) = *(_src++);
x = (x + 1) % 32;
}
y = (y + 1) % 32;
}
}
bool32 ConfettiUtil_Init(u8 count)
{
u8 i = 0;
if (count == 0)
return FALSE;
if (count > 64)
count = 64;
sWork = AllocZeroed(sizeof(*sWork));
if (sWork == NULL)
return FALSE;
sWork->array = AllocZeroed(count * sizeof(struct ConfettiUtil));
if (sWork->array == NULL)
{
FREE_AND_SET_NULL(sWork);
return FALSE;
}
sWork->count = count;
for (i = 0; i < count; i++)
{
memcpy(&sWork->array[i].oam, &gDummyOamData, sizeof(struct OamData));
sWork->array[i].dummied = TRUE;
}
return TRUE;
}
bool32 ConfettiUtil_Free(void)
{
u8 i = 0;
if (sWork == NULL)
return FALSE;
for (i = 0; i < sWork->count; i++)
memcpy(&gMain.oamBuffer[i + 64], &gDummyOamData, sizeof(struct OamData));
memset(sWork->array, 0, sWork->count * sizeof(struct ConfettiUtil));
FREE_AND_SET_NULL(sWork->array);
memset(sWork, 0, sizeof(*sWork));
FREE_AND_SET_NULL(sWork);
return TRUE;
}
bool32 ConfettiUtil_Update(void)
{
u8 i = 0;
if (sWork == NULL || sWork->array == NULL)
return FALSE;
for (i = 0; i < sWork->count; i++)
{
if (sWork->array[i].active && sWork->array[i].allowUpdates)
{
if (sWork->array[i].callback != NULL)
sWork->array[i].callback(&sWork->array[i]);
if (sWork->array[i].dummied)
{
memcpy(&gMain.oamBuffer[i + 64], &gDummyOamData, sizeof(struct OamData));
}
else
{
sWork->array[i].oam.y = sWork->array[i].y + sWork->array[i].yDelta;
sWork->array[i].oam.x = sWork->array[i].x + sWork->array[i].xDelta;
sWork->array[i].oam.priority = sWork->array[i].priority;
sWork->array[i].oam.tileNum = sWork->array[i].tileNum;
memcpy(&gMain.oamBuffer[i + 64], &sWork->array[i], sizeof(struct OamData));
}
}
}
return TRUE;
}
static bool32 SetAnimAndTileNum(struct ConfettiUtil *structPtr, u8 animNum)
{
u16 tileStart;
if (structPtr == NULL)
return FALSE;
tileStart = GetSpriteTileStartByTag(structPtr->tileTag);
if (tileStart == 0xFFFF)
return FALSE;
structPtr->animNum = animNum;
structPtr->tileNum = (GetTilesPerImage(structPtr->oam.shape, structPtr->oam.size) * animNum) + tileStart;
return TRUE;
}
u8 ConfettiUtil_SetCallback(u8 id, void (*func)(struct ConfettiUtil *))
{
if (sWork == NULL || id >= sWork->count)
return 0xFF;
else if (!sWork->array[id].active)
return 0xFF;
sWork->array[id].callback = func;
return id;
}
u8 ConfettiUtil_SetData(u8 id, u8 dataArrayId, s16 dataValue)
{
if (sWork == NULL || id >= sWork->count)
return 0xFF;
else if (!sWork->array[id].active || dataArrayId > ARRAY_COUNT(sWork->array[id].data) - 1) // - 1 b/c last slot is reserved for taskId
return 0xFF;
sWork->array[id].data[dataArrayId] = dataValue;
return id;
}
u8 ConfettiUtil_AddNew(const struct OamData *oam, u16 tileTag, u16 palTag, s16 x, s16 y, u8 animNum, u8 priority)
{
struct ConfettiUtil *structPtr = NULL;
u8 i;
if (sWork == NULL || oam == NULL)
return 0xFF;
for (i = 0; i < sWork->count; i++)
{
if (!sWork->array[i].active)
{
structPtr = &sWork->array[i];
memset(structPtr, 0, sizeof(*structPtr));
structPtr->id = i;
structPtr->active = TRUE;
structPtr->allowUpdates = TRUE;
break;
}
}
if (structPtr == NULL)
return 0xFF;
memcpy(&structPtr->oam, oam, sizeof(*oam));
structPtr->tileTag = tileTag;
structPtr->palTag = palTag;
structPtr->x = x;
structPtr->y = y;
structPtr->oam.paletteNum = IndexOfSpritePaletteTag(palTag);
if (priority < 4)
{
structPtr->priority = priority;
structPtr->oam.priority = priority;
}
SetAnimAndTileNum(structPtr, animNum);
return structPtr->id;
}
u8 ConfettiUtil_Remove(u8 id)
{
if (sWork == NULL || !sWork->array[id].active)
return 0xFF;
memset(&sWork->array[id], 0, sizeof(struct ConfettiUtil));
sWork->array[id].oam.y = 160;
sWork->array[id].oam.x = 240;
sWork->array[id].dummied = TRUE;
memcpy(&gMain.oamBuffer[id + 64], &gDummyOamData, sizeof(struct OamData));
return id;
}

View File

@ -7,7 +7,6 @@
#include "constants/moves.h"
#include "constants/songs.h"
#include "constants/species.h"
#include "constants/flags.h"
#include "battle.h"
#include "battle_anim.h"
#include "contest.h"
@ -31,14 +30,14 @@
#include "tv.h"
#include "scanline_effect.h"
#include "util.h"
#include "contest_link_80F57C4.h"
#include "contest_util.h"
#include "dma3.h"
#include "battle_message.h"
#include "event_scripts.h"
#include "event_data.h"
#include "strings.h"
#include "contest_effect.h"
#include "contest_link_80FC4F4.h"
#include "contest_link.h"
#include "script_pokemon_util_80F87D8.h"
#include "international_string_util.h"
#include "data.h"
@ -155,7 +154,7 @@ static void Contest_StartTextPrinter(const u8 *, u32);
static void ContestBG_FillBoxWithIncrementingTile(u8, u16, u8, u8, u8, u8, u8, s16);
static bool32 Contest_RunTextPrinters(void);
static void Contest_SetBgCopyFlags(u32 flagIndex);
static void sub_80DBD18(void);
static void CalculateFinalScores(void);
static void sub_80DD080(u8);
static void sub_80DE9DC(u8);
static void sub_80DCBE8(u8, u8);
@ -184,7 +183,7 @@ static void sub_80DC3AC(void);
static bool8 sub_80DC3C4(void);
static void ContestBG_FillBoxWithTile(u8, u16, u8, u8, u8, u8, u8);
static void Contest_PrintTextToBg0WindowStd(u32, const u8 *);
static s16 sub_80DBD34(u8);
static s16 GetContestantRound2Points(u8);
static void DetermineFinalStandings(void);
static bool8 sub_80DBF30(s32, s32, struct UnknownContestStruct6 *);
static void sub_80DC0F4(u8);
@ -221,9 +220,9 @@ static void SwapMoveDescAndContestTilemaps(void);
// EWRAM vars.
EWRAM_DATA struct ContestPokemon gContestMons[CONTESTANT_COUNT] = {0};
EWRAM_DATA s16 gContestMonConditions[CONTESTANT_COUNT] = {0};
EWRAM_DATA s16 gUnknown_02039F08[CONTESTANT_COUNT] = {0};
EWRAM_DATA s16 gContestMonTotalPoints[CONTESTANT_COUNT] = {0};
EWRAM_DATA s16 gUnknown_02039F10[CONTESTANT_COUNT] = {0};
EWRAM_DATA s16 gUnknown_02039F18[CONTESTANT_COUNT] = {0};
EWRAM_DATA s16 gContestMonRound2Points[CONTESTANT_COUNT] = {0};
EWRAM_DATA u8 gContestFinalStandings[CONTESTANT_COUNT] = {0};
EWRAM_DATA u8 gContestMonPartyIndex = 0;
EWRAM_DATA u8 gContestPlayerMonIndex = 0;
@ -239,7 +238,7 @@ EWRAM_DATA u8 gHighestRibbonRank = 0;
EWRAM_DATA struct ContestResources *gContestResources = NULL;
EWRAM_DATA u8 sContestBgCopyFlags = 0;
EWRAM_DATA struct ContestWinner gCurContestWinner = {0};
EWRAM_DATA u8 gUnknown_02039F5C = 0;
EWRAM_DATA bool8 gUnknown_02039F5C = 0;
EWRAM_DATA u8 gUnknown_02039F5D = 0;
// IWRAM common vars.
@ -2490,7 +2489,7 @@ static void sub_80DA5E8(u8 taskId)
gBattle_BG2_Y = 0;
for (i = 0; i < CONTESTANT_COUNT; i++)
gUnknown_02039F10[i] = eContestantStatus[i].pointTotal;
sub_80DBD18();
CalculateFinalScores();
ContestClearGeneralTextWindow();
if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK))
BravoTrainerPokemonProfile_BeforeInterview1(eContestantStatus[gContestPlayerMonIndex].prevMove);
@ -3367,22 +3366,22 @@ bool8 Contest_IsMonsTurnDisabled(u8 a)
return FALSE;
}
static void sub_80DBCE0(u8 contestant)
static void CalculateTotalPointsForContestant(u8 contestant)
{
gUnknown_02039F18[contestant] = sub_80DBD34(contestant);
gUnknown_02039F08[contestant] = gContestMonConditions[contestant] + gUnknown_02039F18[contestant];
gContestMonRound2Points[contestant] = GetContestantRound2Points(contestant);
gContestMonTotalPoints[contestant] = gContestMonConditions[contestant] + gContestMonRound2Points[contestant];
}
static void sub_80DBD18(void)
static void CalculateFinalScores(void)
{
s32 i;
for (i = 0; i < CONTESTANT_COUNT; i++)
sub_80DBCE0(i);
CalculateTotalPointsForContestant(i);
DetermineFinalStandings();
}
static s16 sub_80DBD34(u8 contestant)
static s16 GetContestantRound2Points(u8 contestant)
{
return gUnknown_02039F10[contestant] * 2;
}
@ -3411,7 +3410,7 @@ static void DetermineFinalStandings(void)
for (i = 0; i < CONTESTANT_COUNT; i++)
{
sp8[i].unk0 = gUnknown_02039F08[i];
sp8[i].unk0 = gContestMonTotalPoints[i];
sp8[i].unk4 = gContestMonConditions[i];
sp8[i].unk8 = randomOrdering[i];
sp8[i].unkC = i;
@ -5313,22 +5312,22 @@ bool8 sub_80DEDA8(u8 rank)
}
if (rank != 0xFE)
{
u8 r4 = sub_80DEFA8(rank, 1);
u8 id = sub_80DEFA8(rank, 1);
gSaveBlock1Ptr->contestWinners[r4].personality = gContestMons[i].personality;
gSaveBlock1Ptr->contestWinners[r4].species = gContestMons[i].species;
gSaveBlock1Ptr->contestWinners[r4].trainerId = gContestMons[i].otId;
StringCopy(gSaveBlock1Ptr->contestWinners[r4].monName, gContestMons[i].nickname);
StringCopy(gSaveBlock1Ptr->contestWinners[r4].trainerName, gContestMons[i].trainerName);
gSaveBlock1Ptr->contestWinners[id].personality = gContestMons[i].personality;
gSaveBlock1Ptr->contestWinners[id].species = gContestMons[i].species;
gSaveBlock1Ptr->contestWinners[id].trainerId = gContestMons[i].otId;
StringCopy(gSaveBlock1Ptr->contestWinners[id].monName, gContestMons[i].nickname);
StringCopy(gSaveBlock1Ptr->contestWinners[id].trainerName, gContestMons[i].trainerName);
if(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
gSaveBlock1Ptr->contestWinners[r4].contestRank = CONTEST_RANK_LINK;
gSaveBlock1Ptr->contestWinners[id].contestRank = CONTEST_RANK_LINK;
else
gSaveBlock1Ptr->contestWinners[r4].contestRank = gSpecialVar_ContestRank;
gSaveBlock1Ptr->contestWinners[id].contestRank = gSpecialVar_ContestRank;
if (rank != 0xFF)
gSaveBlock1Ptr->contestWinners[r4].contestCategory = gSpecialVar_ContestCategory;
gSaveBlock1Ptr->contestWinners[id].contestCategory = gSpecialVar_ContestCategory;
else
gSaveBlock1Ptr->contestWinners[r4].contestCategory = r7;
gSaveBlock1Ptr->contestWinners[id].contestCategory = r7;
}
else
{
@ -5354,24 +5353,24 @@ u8 sub_80DEFA8(u8 rank, u8 b)
case CONTEST_RANK_MASTER:
if (b != 0)
{
for (i = 5; i >= 1; i--)
for (i = NUM_CONTEST_HALL_WINNERS - 1; i >= 1; i--)
memcpy(&gSaveBlock1Ptr->contestWinners[i], &gSaveBlock1Ptr->contestWinners[i - 1], sizeof(struct ContestWinner));
}
return 0;
default: // CONTEST_RANK_LINK
default:
switch (gSpecialVar_ContestCategory)
{
case CONTEST_CATEGORY_COOL:
return 8;
return CONTEST_WINNER_MUSEUM_COOL - 1;
case CONTEST_CATEGORY_BEAUTY:
return 9;
return CONTEST_WINNER_MUSEUM_BEAUTY - 1;
case CONTEST_CATEGORY_CUTE:
return 10;
return CONTEST_WINNER_MUSEUM_CUTE - 1;
case CONTEST_CATEGORY_SMART:
return 11;
return CONTEST_WINNER_MUSEUM_SMART - 1;
case CONTEST_CATEGORY_TOUGH:
default:
return 12;
return CONTEST_WINNER_MUSEUM_TOUGH - 1;
}
}
}
@ -5471,7 +5470,7 @@ static void sub_80DF250(void)
gContestResources->field_1c[r1].unkD |= 1;
for (i = 0; i < CONTESTANT_COUNT; i++)
{
if (i != var_38 && gUnknown_02039F08[var_38] - gUnknown_02039F08[i] <= 50)
if (i != var_38 && gContestMonTotalPoints[var_38] - gContestMonTotalPoints[i] <= 50)
gContestResources->field_1c[i].unkD |= 4;
if (!gContestResources->field_1c[i].unkE_2)
@ -5491,7 +5490,7 @@ static void sub_80DF250(void)
{
if (gContestMonConditions[i] > gContestMonConditions[j])
r12 = TRUE;
if (gUnknown_02039F18[i] > gUnknown_02039F18[j])
if (gContestMonRound2Points[i] > gContestMonRound2Points[j])
r8 = TRUE;
}
if (!r12 && !r8)
@ -5582,7 +5581,7 @@ static void sub_80DF4F8(void)
{
if (gContestMonConditions[r7] < gContestMonConditions[i])
r9++;
if (gUnknown_02039F18[r7] < gUnknown_02039F18[i])
if (gContestMonRound2Points[r7] < gContestMonRound2Points[i])
r10++;
}

View File

@ -6,7 +6,7 @@
#include "pokemon.h"
#include "random.h"
#include "task.h"
#include "constants/flags.h"
#include "contest_link.h"
static void sub_80FC5C0(u8);
static void sub_80FC5DC(u8);
@ -296,14 +296,14 @@ void sub_80FCACC(u8 taskId)
case 0:
if (IsLinkTaskFinished())
{
if (sub_80FC4F4(gUnknown_02039F08, sizeof(gUnknown_02039F08)) == 1)
if (sub_80FC4F4(gContestMonTotalPoints, sizeof(gContestMonTotalPoints)) == 1)
gTasks[taskId].data[0]++;
}
break;
case 1:
if (sub_80FC55C())
{
memcpy(gUnknown_02039F08, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F08));
memcpy(gContestMonTotalPoints, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonTotalPoints));
gTasks[taskId].data[0]++;
}
break;
@ -334,14 +334,14 @@ void sub_80FCACC(u8 taskId)
case 6:
if (IsLinkTaskFinished())
{
if (sub_80FC4F4(gUnknown_02039F18, sizeof(gUnknown_02039F18)) == 1)
if (sub_80FC4F4(gContestMonRound2Points, sizeof(gContestMonRound2Points)) == 1)
gTasks[taskId].data[0]++;
}
break;
case 7:
if (sub_80FC55C())
{
memcpy(gUnknown_02039F18, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F18));
memcpy(gContestMonRound2Points, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonRound2Points));
gTasks[taskId].data[0]++;
}
break;

View File

@ -170,7 +170,7 @@ void SetContestWinnerForPainting(int contestWinnerId)
u8 *ptr2 = &gUnknown_02039F5C;
gCurContestWinner = gSaveBlock1Ptr->contestWinners[contestWinnerId - 1];
*ptr1 = contestWinnerId - 1;
*ptr2 = 0;
*ptr2 = FALSE;
}
void CB2_ContestPainting(void)
@ -281,7 +281,7 @@ static void InitContestPaintingWindow(void)
ShowBg(1);
}
static void PrintContestPaintingCaption(u8 contestType, u8 arg1)
static void PrintContestPaintingCaption(u8 contestType, bool8 arg1)
{
int x;
u8 category;
@ -519,12 +519,14 @@ _081303F8:\n\
}
#endif
static void LoadContestPaintingFrame(u8 contestWinnerId, u8 arg1)
#define VRAM_PICTURE_DATA(x, y) (((u16 *)(BG_SCREEN_ADDR(12)))[(y) * 32 + (x)])
static void LoadContestPaintingFrame(u8 contestWinnerId, bool8 arg1)
{
u8 x, y;
LoadPalette(gPictureFramePalettes, 0, 0x100);
if (arg1 == 1)
if (arg1 == TRUE)
{
switch (gContestPaintingWinner->contestCategory / 3)
{
@ -550,8 +552,6 @@ static void LoadContestPaintingFrame(u8 contestWinnerId, u8 arg1)
break;
}
#define VRAM_PICTURE_DATA(x, y) (((u16 *)(BG_SCREEN_ADDR(12)))[(y) * 32 + (x)])
// Set the background
for (y = 0; y < 20; y++)
{
@ -569,8 +569,6 @@ static void LoadContestPaintingFrame(u8 contestWinnerId, u8 arg1)
// Re-set the entire top row to the first top frame part
for (x = 0; x < 16; x++)
VRAM_PICTURE_DATA(x + 7, 2) = (*gContestMonPixels)[2][7];
#undef VRAM_PICTURE_DATA
}
else if (contestWinnerId < 8)
{
@ -605,6 +603,8 @@ static void LoadContestPaintingFrame(u8 contestWinnerId, u8 arg1)
}
}
#undef VRAM_PICTURE_DATA
static void InitPaintingMonOamData(u8 contestWinnerId)
{
//Some hacks just to get the asm to match
@ -692,7 +692,7 @@ static void DoContestPaintingImageProcessing(u8 imageEffect)
LoadPalette(gContestPaintingMonPalette, 0x100, 0x200);
}
static void CreateContestPaintingPicture(u8 contestWinnerId, u8 arg1)
static void CreateContestPaintingPicture(u8 contestWinnerId, bool8 arg1)
{
AllocPaintingResources();
InitContestMonPixels(gContestPaintingWinner->species, 0);

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,6 @@
#include "trig.h"
#include "graphics.h"
#include "pokedex.h"
#include "constants/vars.h"
#include "event_data.h"
#include "random.h"
#include "constants/species.h"

View File

@ -29,7 +29,6 @@
#include "window.h"
#include "constants/easy_chat.h"
#include "constants/event_objects.h"
#include "constants/flags.h"
#include "constants/lilycove_lady.h"
#include "constants/mauville_old_man.h"
#include "constants/songs.h"

View File

@ -7,10 +7,8 @@
#include "sprite.h"
#include "constants/event_objects.h"
#include "constants/field_effects.h"
#include "constants/flags.h"
#include "constants/maps.h"
#include "constants/metatile_behaviors.h"
#include "constants/vars.h"
static u8 sub_81D4890(u8);
static bool8 sub_81D4C14(struct ObjectEvent*, u8);

View File

@ -5,7 +5,6 @@
#include "fieldmap.h"
#include "metatile_behavior.h"
#include "task.h"
#include "constants/flags.h"
#include "constants/maps.h"
#include "constants/songs.h"
#include "constants/metatile_labels.h"

View File

@ -25,7 +25,6 @@
#include "constants/event_objects.h"
#include "constants/event_object_movement.h"
#include "constants/field_effects.h"
#include "constants/flags.h"
#include "constants/items.h"
#include "constants/maps.h"
#include "constants/moves.h"

View File

@ -17,7 +17,6 @@
#include "constants/event_object_movement.h"
#include "constants/field_specials.h"
#include "constants/songs.h"
#include "constants/vars.h"
#include "constants/metatile_labels.h"
#define SECONDS(value) ((signed) (60.0 * value + 0.5))

View File

@ -63,7 +63,6 @@
#include "constants/species.h"
#include "constants/moves.h"
#include "constants/party_menu.h"
#include "constants/vars.h"
#include "constants/battle_frontier.h"
#include "constants/weather.h"
#include "constants/metatile_labels.h"
@ -4095,11 +4094,17 @@ void UpdateTrainerFanClubGameClear(void)
}
// If the player has < 3 fans, gain a new fan whenever the counter reaches 20+
// Defeating Drake or participating in a Link Contest increments the counter by 2
// Defeating Drake or participating in a Contest increments the counter by 2
// Participating at Battle Tower or in a Secret Base battle increments the counter by 1
u8 TryGainNewFanFromCounter(u8 incrementId)
{
static const u8 sCounterIncrements[] = { 2, 1, 2, 1 };
static const u8 sCounterIncrements[] =
{
[FANCOUNTER_DEFEATED_DRAKE] = 2,
[FANCOUNTER_BATTLED_AT_BASE] = 1,
[FANCOUNTER_FINISHED_CONTEST] = 2,
[FANCOUNTER_USED_BATTLE_TOWER] = 1
};
if (VarGet(VAR_LILYCOVE_FAN_CLUB_STATE) == 2)
{

View File

@ -19,7 +19,6 @@
#include "constants/field_tasks.h"
#include "constants/items.h"
#include "constants/songs.h"
#include "constants/vars.h"
#include "constants/metatile_labels.h"
struct PacifidlogMetatileOffsets

View File

@ -23,7 +23,6 @@
#include "constants/metatile_labels.h"
#include "constants/songs.h"
#include "constants/tv.h"
#include "constants/vars.h"
EWRAM_DATA struct MapPosition gPlayerFacingPosition = {0};

View File

@ -471,13 +471,11 @@ const u8 gTiles_8C19450[] = INCBIN_U8("graphics/contest/heart.4bpp");
const u32 gUnknownGfx_C19470[] = INCBIN_U32("graphics/unknown/unknown_C19470.4bpp.lz");
const u32 gUnknownPal_C19470[] = INCBIN_U32("graphics/unknown/unknown_C19470.gbapal.lz");
const u32 gUnknown_08C19588[] = INCBIN_U32("graphics/contest/misc_2.4bpp.lz");
const u32 gContestResults_Gfx[] = INCBIN_U32("graphics/contest/results_screen.4bpp.lz");
const u32 gUnknown_08C19EEC[] = INCBIN_U32("graphics/contest/misc_2_tilemap_1.bin.lz");
const u32 gUnknown_08C1A000[] = INCBIN_U32("graphics/contest/misc_2_tilemap_2.bin.lz");
const u32 gUnknown_08C1A12C[] = INCBIN_U32("graphics/contest/misc_2_tilemap_3.bin.lz");
const u32 gUnknown_08C1A2B4[] = INCBIN_U32("graphics/contest/misc_2.gbapal.lz");
const u32 gContestResults_Pal[] = INCBIN_U32("graphics/contest/results_screen.gbapal.lz");
const u32 gBattleAnimSpriteGfx_Impact[] = INCBIN_U32("graphics/battle_anims/sprites/impact.4bpp.lz");
const u32 gBattleAnimSpritePal_Impact[] = INCBIN_U32("graphics/battle_anims/sprites/impact.gbapal.lz");
@ -875,8 +873,8 @@ const u32 gSubstituteDollTilemap[] = INCBIN_U32("graphics/battle_anims/sprites/s
const u32 gBattleAnimSpriteGfx_GreenStar[] = INCBIN_U32("graphics/battle_anims/sprites/green_star.4bpp.lz");
const u32 gBattleAnimSpritePal_GreenStar[] = INCBIN_U32("graphics/battle_anims/sprites/green_star.gbapal.lz");
const u32 gContestConfetti_Gfx[] = INCBIN_U32("graphics/misc/confetti.4bpp.lz");
const u32 gContestConfetti_Pal[] = INCBIN_U32("graphics/misc/confetti.gbapal.lz");
const u32 gConfetti_Gfx[] = INCBIN_U32("graphics/misc/confetti.4bpp.lz");
const u32 gConfetti_Pal[] = INCBIN_U32("graphics/misc/confetti.gbapal.lz");
const u32 gBattleAnimSpriteGfx_PinkCloud[] = INCBIN_U32("graphics/battle_anims/sprites/pink_cloud.4bpp.lz");
const u32 gBattleAnimSpritePal_PinkCloud[] = INCBIN_U32("graphics/battle_anims/sprites/pink_cloud.gbapal.lz");
@ -1298,19 +1296,19 @@ const u8 gFireRedMenuElements_Gfx[] = INCBIN_U8("graphics/interface_fr/menu.4bpp
const u8 gBagMenuHMIcon_Gfx[] = INCBIN_U8("graphics/interface/hm.4bpp");
// contest link stuff, appears to be a set of tilemaps
// contest results screen
const u16 gUnknown_08DC63F8[] = INCBIN_U16("graphics/contest/clink_tilemap1.bin");
const u16 gUnknown_08DC6420[] = INCBIN_U16("graphics/contest/clink_tilemap2.bin");
const u16 gUnknown_08DC6448[] = INCBIN_U16("graphics/contest/clink_tilemap3.bin");
const u16 gUnknown_08DC6470[] = INCBIN_U16("graphics/contest/clink_tilemap4.bin");
const u16 gUnknown_08DC6498[] = INCBIN_U16("graphics/contest/clink_tilemap5.bin");
const u16 gUnknown_08DC64AC[] = INCBIN_U16("graphics/contest/clink_tilemap6.bin");
const u16 gUnknown_08DC64C0[] = INCBIN_U16("graphics/contest/clink_tilemap7.bin");
const u16 gUnknown_08DC64D4[] = INCBIN_U16("graphics/contest/clink_tilemap8.bin");
const u16 gUnknown_08DC64E8[] = INCBIN_U16("graphics/contest/clink_tilemap9.bin");
const u16 gUnknown_08DC64FC[] = INCBIN_U16("graphics/contest/clink_tilemap10.bin");
const u16 gUnknown_08DC6510[] = INCBIN_U16("graphics/contest/clink_tilemap11.bin");
const u16 gNormalContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_normal.bin");
const u16 gSuperContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_super.bin");
const u16 gHyperContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_hyper.bin");
const u16 gMasterContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_master.bin");
const u16 gLinkContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_link.bin");
const u16 gCoolContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_cool.bin");
const u16 gBeautyContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_beauty.bin");
const u16 gCuteContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_cute.bin");
const u16 gSmartContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_smart.bin");
const u16 gToughContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_tough.bin");
const u16 gContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen.bin");
// pokenav

View File

@ -1,5 +1,4 @@
#include "global.h"
#include "constants/flags.h"
#include "random.h"
#include "event_data.h"
#include "battle_setup.h"

View File

@ -33,9 +33,12 @@
#include "fldeff_misc.h"
#include "trainer_pokemon_sprites.h"
#include "data.h"
#include "rom_81520A8.h"
#include "confetti_util.h"
#include "constants/rgb.h"
#define HALL_OF_FAME_MAX_TEAMS 50
#define TAG_CONFETTI 1001
struct HallofFameMon
{
u32 tid;
@ -58,33 +61,31 @@ struct HofGfx
u8 tilemap2[0x1000];
};
static EWRAM_DATA u32 sUnknown_0203BCD4 = 0;
static EWRAM_DATA u32 sHofFadePalettes = 0;
static EWRAM_DATA struct HallofFameTeam *sHofMonPtr = NULL;
static EWRAM_DATA struct HofGfx *sHofGfxPtr = NULL;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
#define HALL_OF_FAME_MAX_TEAMS 50
// this file's functions
static void ClearVramOamPltt_LoadHofPal(void);
static void sub_8174F70(void);
static void sub_8174FAC(void);
static bool8 sub_81751FC(void);
static void LoadHofGfx(void);
static void InitHofBgs(void);
static bool8 CreateHofConfettiSprite(void);
static void SetCallback2AfterHallOfFameDisplay(void);
static bool8 sub_8175024(void);
static void Task_Hof_InitMonData(u8 taskId);
static void Task_Hof_InitTeamSaveData(u8 taskId);
static void Task_Hof_SetMonDisplayTask(u8 taskId);
static void Task_Hof_TrySaveData(u8 taskId);
static void Task_Hof_WaitForFrames(u8 taskId);
static void Task_Hof_WaitToDisplayMon(u8 taskId);
static void Task_Hof_DisplayMon(u8 taskId);
static void Task_Hof_PrintMonInfoAfterAnimating(u8 taskId);
static void Task_Hof_TryDisplayAnotherMon(u8 taskId);
static void Task_Hof_PaletteFadeAndPrintWelcomeText(u8 taskId);
static void sub_8173DC0(u8 taskId);
static void sub_8173EA4(u8 taskId);
static void sub_8173EE4(u8 taskId);
static void Task_Hof_DoConfetti(u8 taskId);
static void Task_Hof_WaitToDisplayPlayer(u8 taskId);
static void Task_Hof_DisplayPlayer(u8 taskId);
static void Task_Hof_WaitAndPrintPlayerInfo(u8 taskId);
static void Task_Hof_ExitOnKeyPressed(u8 taskId);
static void Task_Hof_HandlePaletteOnExit(u8 taskId);
@ -101,8 +102,8 @@ static void SpriteCB_GetOnScreenAndAnimate(struct Sprite *sprite);
static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u8 unused2);
static void HallOfFame_PrintWelcomeText(u8 unusedPossiblyWindowId, u8 unused2);
static void HallOfFame_PrintPlayerInfo(u8 unused1, u8 unused2);
static void Task_DoConfettiEffect(u8 taskId);
static void sub_81751A4(struct Sprite* sprite);
static void Task_DoDomeConfetti(u8 taskId);
static void SpriteCB_HofConfetti(struct Sprite* sprite);
// const rom data
static const struct BgTemplate sHof_BgTemplates[] =
@ -143,15 +144,15 @@ static const u8 sPlayerInfoTextColors[4] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_D
static const u8 sUnused_085E538C[] = {4, 5, 0, 0};
static const struct CompressedSpriteSheet sHallOfFame_ConfettiSpriteSheet[] =
static const struct CompressedSpriteSheet sSpriteSheet_Confetti[] =
{
{gContestConfetti_Gfx, 0x220, 1001},
{.data = gConfetti_Gfx, .size = 0x220, .tag = TAG_CONFETTI},
{},
};
static const struct CompressedSpritePalette sHallOfFame_ConfettiSpritePalette[] =
static const struct CompressedSpritePalette sSpritePalette_Confetti[] =
{
{gContestConfetti_Pal, 1001},
{.data = gConfetti_Pal, .tag = TAG_CONFETTI},
{},
};
@ -172,7 +173,7 @@ static const s16 sHallOfFame_MonHalfTeamPositions[PARTY_SIZE / 2][4] =
{-86, 244, 184, 64}
};
static const struct OamData sOamData_85E53FC =
static const struct OamData sOamData_Confetti =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@ -189,126 +190,138 @@ static const struct OamData sOamData_85E53FC =
.affineParam = 0,
};
static const union AnimCmd sSpriteAnim_85E5404[] =
static const union AnimCmd sAnim_PinkConfettiA[] =
{
ANIMCMD_FRAME(0, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E540C[] =
static const union AnimCmd sAnim_RedConfettiA[] =
{
ANIMCMD_FRAME(1, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E5414[] =
static const union AnimCmd sAnim_BlueConfettiA[] =
{
ANIMCMD_FRAME(2, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E541C[] =
static const union AnimCmd sAnim_RedConfettiB[] =
{
ANIMCMD_FRAME(3, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E5424[] =
static const union AnimCmd sAnim_BlueConfettiB[] =
{
ANIMCMD_FRAME(4, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E542C[] =
static const union AnimCmd sAnim_YellowConfettiA[] =
{
ANIMCMD_FRAME(5, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E5434[] =
static const union AnimCmd sAnim_WhiteConfettiA[] =
{
ANIMCMD_FRAME(6, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E543C[] =
static const union AnimCmd sAnim_GreenConfettiA[] =
{
ANIMCMD_FRAME(7, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E5444[] =
static const union AnimCmd sAnim_PinkConfettiB[] =
{
ANIMCMD_FRAME(8, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E544C[] =
static const union AnimCmd sAnim_BlueConfettiC[] =
{
ANIMCMD_FRAME(9, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E5454[] =
static const union AnimCmd sAnim_YellowConfettiB[] =
{
ANIMCMD_FRAME(10, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E545C[] =
static const union AnimCmd sAnim_WhiteConfettiB[] =
{
ANIMCMD_FRAME(11, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E5464[] =
static const union AnimCmd sAnim_GreenConfettiB[] =
{
ANIMCMD_FRAME(12, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E546C[] =
static const union AnimCmd sAnim_PinkConfettiC[] =
{
ANIMCMD_FRAME(13, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E5474[] =
static const union AnimCmd sAnim_RedConfettiC[] =
{
ANIMCMD_FRAME(14, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E547C[] =
static const union AnimCmd sAnim_YellowConfettiC[] =
{
ANIMCMD_FRAME(15, 30),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85E5484[] =
static const union AnimCmd sAnim_WhiteConfettiC[] =
{
ANIMCMD_FRAME(16, 30),
ANIMCMD_END
};
static const union AnimCmd * const sSpriteAnimTable_85E548C[] =
static const union AnimCmd * const sAnims_Confetti[] =
{
sSpriteAnim_85E5404, sSpriteAnim_85E540C, sSpriteAnim_85E5414, sSpriteAnim_85E541C,
sSpriteAnim_85E5424, sSpriteAnim_85E542C, sSpriteAnim_85E5434, sSpriteAnim_85E543C,
sSpriteAnim_85E5444, sSpriteAnim_85E544C, sSpriteAnim_85E5454, sSpriteAnim_85E545C,
sSpriteAnim_85E5464, sSpriteAnim_85E546C, sSpriteAnim_85E5474, sSpriteAnim_85E547C,
sSpriteAnim_85E5484
sAnim_PinkConfettiA,
sAnim_RedConfettiA,
sAnim_BlueConfettiA,
sAnim_RedConfettiB,
sAnim_BlueConfettiB,
sAnim_YellowConfettiA,
sAnim_WhiteConfettiA,
sAnim_GreenConfettiA,
sAnim_PinkConfettiB,
sAnim_BlueConfettiC,
sAnim_YellowConfettiB,
sAnim_WhiteConfettiB,
sAnim_GreenConfettiB,
sAnim_PinkConfettiC,
sAnim_RedConfettiC,
sAnim_YellowConfettiC,
sAnim_WhiteConfettiC
};
static const struct SpriteTemplate sSpriteTemplate_85E54D0 =
static const struct SpriteTemplate sSpriteTemplate_HofConfetti =
{
.tileTag = 1001,
.paletteTag = 1001,
.oam = &sOamData_85E53FC,
.anims = sSpriteAnimTable_85E548C,
.tileTag = TAG_CONFETTI,
.paletteTag = TAG_CONFETTI,
.oam = &sOamData_Confetti,
.anims = sAnims_Confetti,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_81751A4
.callback = SpriteCB_HofConfetti
};
static const u16 sHallOfFame_Pal[] = INCBIN_U16("graphics/misc/japanese_hof.gbapal");
@ -317,10 +330,19 @@ static const u32 sHallOfFame_Gfx[] = INCBIN_U32("graphics/misc/japanese_hof.4bpp
static const struct HallofFameMon sDummyFameMon =
{
0x3EA03EA, 0, 0, 0, {0}
.tid = 0x3EA03EA,
.personality = 0,
.species = SPECIES_NONE,
.lvl = 0,
.nick = {0}
};
static const u8 sUnused2[] = {2, 1, 3, 6, 4, 5, 0, 0};
// Unused, order of party slots on Hall of Fame screen
static const u8 sHallOfFame_SlotOrder[] = {
2, 1, 3,
6, 4, 5,
0, 0
};
// code
static void VBlankCB_HallOfFame(void)
@ -350,14 +372,14 @@ static bool8 InitHallOfFameScreen(void)
gMain.state = 1;
break;
case 1:
sub_8174F70();
LoadHofGfx();
gMain.state++;
break;
case 2:
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 7));
SetGpuReg(REG_OFFSET_BLDY, 0);
sub_8174FAC();
InitHofBgs();
sHofGfxPtr->state = 0;
gMain.state++;
break;
@ -433,7 +455,7 @@ static void Task_Hof_InitMonData(u8 taskId)
}
else
{
sHofMonPtr->mon[i].species = 0;
sHofMonPtr->mon[i].species = SPECIES_NONE;
sHofMonPtr->mon[i].tid = 0;
sHofMonPtr->mon[i].personality = 0;
sHofMonPtr->mon[i].lvl = 0;
@ -441,7 +463,7 @@ static void Task_Hof_InitMonData(u8 taskId)
}
}
sUnknown_0203BCD4 = 0;
sHofFadePalettes = 0;
gTasks[taskId].tDisplayedMonId = 0;
gTasks[taskId].tPlayerSpriteID = 0xFF;
@ -514,12 +536,12 @@ static void Task_Hof_TrySaveData(u8 taskId)
else
{
PlaySE(SE_SAVE);
gTasks[taskId].func = Task_Hof_WaitForFrames;
gTasks[taskId].func = Task_Hof_WaitToDisplayMon;
gTasks[taskId].tFrameCount = 32;
}
}
static void Task_Hof_WaitForFrames(u8 taskId)
static void Task_Hof_WaitToDisplayMon(u8 taskId)
{
if (gTasks[taskId].tFrameCount)
gTasks[taskId].tFrameCount--;
@ -539,32 +561,32 @@ static void Task_Hof_SetMonDisplayTask(u8 taskId)
static void Task_Hof_DisplayMon(u8 taskId)
{
u8 spriteId;
s16 xPos, yPos, field4, field6;
s16 startX, startY, destX, destY;
u16 currMonId = gTasks[taskId].tDisplayedMonId;
struct HallofFameMon* currMon = &sHofMonPtr->mon[currMonId];
if (gTasks[taskId].tMonNumber > PARTY_SIZE / 2)
{
xPos = sHallOfFame_MonFullTeamPositions[currMonId][0];
yPos = sHallOfFame_MonFullTeamPositions[currMonId][1];
field4 = sHallOfFame_MonFullTeamPositions[currMonId][2];
field6 = sHallOfFame_MonFullTeamPositions[currMonId][3];
startX = sHallOfFame_MonFullTeamPositions[currMonId][0];
startY = sHallOfFame_MonFullTeamPositions[currMonId][1];
destX = sHallOfFame_MonFullTeamPositions[currMonId][2];
destY = sHallOfFame_MonFullTeamPositions[currMonId][3];
}
else
{
xPos = sHallOfFame_MonHalfTeamPositions[currMonId][0];
yPos = sHallOfFame_MonHalfTeamPositions[currMonId][1];
field4 = sHallOfFame_MonHalfTeamPositions[currMonId][2];
field6 = sHallOfFame_MonHalfTeamPositions[currMonId][3];
startX = sHallOfFame_MonHalfTeamPositions[currMonId][0];
startY = sHallOfFame_MonHalfTeamPositions[currMonId][1];
destX = sHallOfFame_MonHalfTeamPositions[currMonId][2];
destY = sHallOfFame_MonHalfTeamPositions[currMonId][3];
}
if (currMon->species == SPECIES_EGG)
field6 += 10;
destY += 10;
spriteId = CreatePicSprite2(currMon->species, currMon->tid, currMon->personality, 1, xPos, yPos, currMonId, 0xFFFF);
gSprites[spriteId].tDestinationX = field4;
gSprites[spriteId].tDestinationY = field6;
spriteId = CreatePicSprite2(currMon->species, currMon->tid, currMon->personality, 1, startX, startY, currMonId, 0xFFFF);
gSprites[spriteId].tDestinationX = destX;
gSprites[spriteId].tDestinationY = destY;
gSprites[spriteId].data[0] = 0;
gSprites[spriteId].tSpecies = currMon->species;
gSprites[spriteId].callback = SpriteCB_GetOnScreenAndAnimate;
@ -599,11 +621,11 @@ static void Task_Hof_TryDisplayAnotherMon(u8 taskId)
}
else
{
sUnknown_0203BCD4 |= (0x10000 << gSprites[gTasks[taskId].tMonSpriteId(currPokeID)].oam.paletteNum);
if (gTasks[taskId].tDisplayedMonId <= 4 && currMon[1].species != SPECIES_NONE) // there is another pokemon to display
sHofFadePalettes |= (0x10000 << gSprites[gTasks[taskId].tMonSpriteId(currPokeID)].oam.paletteNum);
if (gTasks[taskId].tDisplayedMonId < PARTY_SIZE - 1 && currMon[1].species != SPECIES_NONE) // there is another pokemon to display
{
gTasks[taskId].tDisplayedMonId++;
BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, RGB(16, 29, 24));
BeginNormalPaletteFade(sHofFadePalettes, 0, 12, 12, RGB(16, 29, 24));
gSprites[gTasks[taskId].tMonSpriteId(currPokeID)].oam.priority = 1;
gTasks[taskId].func = Task_Hof_DisplayMon;
}
@ -628,16 +650,19 @@ static void Task_Hof_PaletteFadeAndPrintWelcomeText(u8 taskId)
HallOfFame_PrintWelcomeText(0, 15);
PlaySE(SE_DENDOU);
gTasks[taskId].tFrameCount = 400;
gTasks[taskId].func = sub_8173DC0;
gTasks[taskId].func = Task_Hof_DoConfetti;
}
static void sub_8173DC0(u8 taskId)
static void Task_Hof_DoConfetti(u8 taskId)
{
if (gTasks[taskId].tFrameCount != 0)
{
gTasks[taskId].tFrameCount--;
// Create new confetti every 4th frame for the first 290 frames
// For the last 110 frames wait for the existing confetti to fall offscreen
if ((gTasks[taskId].tFrameCount & 3) == 0 && gTasks[taskId].tFrameCount > 110)
sub_81751FC();
CreateHofConfettiSprite();
}
else
{
@ -647,19 +672,19 @@ static void sub_8173DC0(u8 taskId)
if (gTasks[taskId].tMonSpriteId(i) != 0xFF)
gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 1;
}
BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, RGB(16, 29, 24));
BeginNormalPaletteFade(sHofFadePalettes, 0, 12, 12, RGB(16, 29, 24));
FillWindowPixelBuffer(0, PIXEL_FILL(0));
CopyWindowToVram(0, 3);
gTasks[taskId].tFrameCount = 7;
gTasks[taskId].func = sub_8173EA4;
gTasks[taskId].func = Task_Hof_WaitToDisplayPlayer;
}
}
static void sub_8173EA4(u8 taskId)
static void Task_Hof_WaitToDisplayPlayer(u8 taskId)
{
if (gTasks[taskId].tFrameCount >= 16)
{
gTasks[taskId].func = sub_8173EE4;
gTasks[taskId].func = Task_Hof_DisplayPlayer;
}
else
{
@ -668,7 +693,7 @@ static void sub_8173EA4(u8 taskId)
}
}
static void sub_8173EE4(u8 taskId)
static void Task_Hof_DisplayPlayer(u8 taskId)
{
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
ShowBg(0);
@ -784,14 +809,14 @@ void CB2_DoHallOfFamePC(void)
gMain.state = 1;
break;
case 1:
sub_8174F70();
LoadHofGfx();
gMain.state++;
break;
case 2:
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
sub_8174FAC();
InitHofBgs();
gMain.state++;
break;
case 3:
@ -874,7 +899,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId)
savedTeams++;
currMon = &savedTeams->mon[0];
sUnknown_0203BCD4 = 0;
sHofFadePalettes = 0;
gTasks[taskId].tCurrMonId = 0;
gTasks[taskId].tMonNo = 0;
@ -949,8 +974,8 @@ static void Task_HofPC_PrintMonInfo(u8 taskId)
currMonID = gTasks[taskId].tMonSpriteId(gTasks[taskId].tCurrMonId);
gSprites[currMonID].oam.priority = 0;
sUnknown_0203BCD4 = (0x10000 << gSprites[currMonID].oam.paletteNum) ^ 0xFFFF0000;
BlendPalettesUnfaded(sUnknown_0203BCD4, 0xC, RGB(16, 29, 24));
sHofFadePalettes = (0x10000 << gSprites[currMonID].oam.paletteNum) ^ 0xFFFF0000;
BlendPalettesUnfaded(sHofFadePalettes, 0xC, RGB(16, 29, 24));
currMon = &savedTeams->mon[gTasks[taskId].tCurrMonId];
if (currMon->species != SPECIES_EGG)
@ -972,7 +997,7 @@ static void Task_HofPC_HandleInput(u8 taskId)
if (gTasks[taskId].tCurrTeamNo != 0) // prepare another team to view
{
gTasks[taskId].tCurrTeamNo--;
for (i = 0; i < 6; i++)
for (i = 0; i < PARTY_SIZE; i++)
{
u8 spriteId = gTasks[taskId].tMonSpriteId(i);
if (spriteId != 0xFF)
@ -1250,7 +1275,7 @@ static void ClearVramOamPltt_LoadHofPal(void)
LoadPalette(sHallOfFame_Pal, 0, 0x20);
}
static void sub_8174F70(void)
static void LoadHofGfx(void)
{
ScanlineEffect_Stop();
ResetTasks();
@ -1259,11 +1284,11 @@ static void sub_8174F70(void)
ResetAllPicSprites();
FreeAllSpritePalettes();
gReservedSpritePaletteCount = 8;
LoadCompressedSpriteSheet(sHallOfFame_ConfettiSpriteSheet);
LoadCompressedSpritePalette(sHallOfFame_ConfettiSpritePalette);
LoadCompressedSpriteSheet(sSpriteSheet_Confetti);
LoadCompressedSpritePalette(sSpritePalette_Confetti);
}
static void sub_8174FAC(void)
static void InitHofBgs(void)
{
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sHof_BgTemplates, ARRAY_COUNT(sHof_BgTemplates));
@ -1344,7 +1369,10 @@ static void SpriteCB_GetOnScreenAndAnimate(struct Sprite *sprite)
#undef tDestinationY
#undef tSpecies
static void sub_81751A4(struct Sprite* sprite)
#define sSineIdx data[0]
#define sExtraY data[1]
static void SpriteCB_HofConfetti(struct Sprite* sprite)
{
if (sprite->pos2.y > 120)
{
@ -1353,20 +1381,20 @@ static void sub_81751A4(struct Sprite* sprite)
else
{
u16 rand;
u8 tableID;
u8 sineIdx;
sprite->pos2.y++;
sprite->pos2.y += sprite->data[1];
sprite->pos2.y += sprite->sExtraY;
tableID = sprite->data[0];
sineIdx = sprite->sSineIdx;
rand = (Random() % 4) + 8;
sprite->pos2.x = rand * gSineTable[tableID] / 256;
sprite->pos2.x = rand * gSineTable[sineIdx] / 256;
sprite->data[0] += 4;
sprite->sSineIdx += 4;
}
}
static bool8 sub_81751FC(void)
static bool8 CreateHofConfettiSprite(void)
{
u8 spriteID;
struct Sprite* sprite;
@ -1374,110 +1402,136 @@ static bool8 sub_81751FC(void)
s16 posX = Random() % 240;
s16 posY = -(Random() % 8);
spriteID = CreateSprite(&sSpriteTemplate_85E54D0, posX, posY, 0);
spriteID = CreateSprite(&sSpriteTemplate_HofConfetti, posX, posY, 0);
sprite = &gSprites[spriteID];
StartSpriteAnim(sprite, Random() % 17);
StartSpriteAnim(sprite, Random() % ARRAY_COUNT(sAnims_Confetti));
// 1/4 confetti sprites move an extra Y coord each frame
if (Random() & 3)
sprite->data[1] = 0;
sprite->sExtraY = 0;
else
sprite->data[1] = 1;
sprite->sExtraY = 1;
return FALSE;
}
// Used when a Battle Dome tourney is won
void DoConfettiEffect(void)
// The below confetti functions are used when a Battle Dome tourney is won
// For the Hall of Fame confetti see Task_Hof_DoConfetti
// The end result is essentially the same, just a very different way of handling it
#define tState data[0]
#define tTimer data[1]
#define tConfettiCount data[15]
// Indexes into the data array of the struct ConfettiUtil
#define CONFETTI_SINE_IDX 0
#define CONFETTI_EXTRA_Y 1
#define CONFETTI_TASK_ID 7
void DoDomeConfetti(void)
{
u8 taskId;
gSpecialVar_0x8004 = 180;
taskId = CreateTask(Task_DoConfettiEffect, 0);
taskId = CreateTask(Task_DoDomeConfetti, 0);
if (taskId != 0xFF)
{
gTasks[taskId].data[1] = gSpecialVar_0x8004;
gTasks[taskId].tTimer = gSpecialVar_0x8004;
gSpecialVar_0x8005 = taskId;
}
}
static void StopConfettiEffect(void)
static void StopDomeConfetti(void)
{
u8 taskId;
if ((taskId = FindTaskIdByFunc(Task_DoConfettiEffect)) != 0xFF)
if ((taskId = FindTaskIdByFunc(Task_DoDomeConfetti)) != 0xFF)
DestroyTask(taskId);
sub_8152254();
FreeSpriteTilesByTag(0x3E9);
FreeSpritePaletteByTag(0x3E9);
ConfettiUtil_Free();
FreeSpriteTilesByTag(TAG_CONFETTI);
FreeSpritePaletteByTag(TAG_CONFETTI);
}
static void sub_81752F4(struct UnkStruct_81520A8 *structPtr)
static void UpdateDomeConfetti(struct ConfettiUtil *util)
{
if (structPtr->yDelta > 110)
if (util->yDelta > 110)
{
gTasks[structPtr->data[7]].data[15]--;
sub_81525D0(structPtr->id);
// Destroy confetti after it falls far enough
gTasks[util->data[CONFETTI_TASK_ID]].tConfettiCount--;
ConfettiUtil_Remove(util->id);
}
else
{
u8 var;
// Move confetti down
u8 sineIdx;
s32 rand;
structPtr->yDelta++;
structPtr->yDelta += structPtr->data[1];
util->yDelta++;
util->yDelta += util->data[CONFETTI_EXTRA_Y];
var = structPtr->data[0];
sineIdx = util->data[CONFETTI_SINE_IDX];
rand = Random();
rand &= 3;
rand += 8;
structPtr->xDelta = (rand) * ((gSineTable[var])) / 256;
util->xDelta = (rand) * ((gSineTable[sineIdx])) / 256;
structPtr->data[0] += 4;
util->data[CONFETTI_SINE_IDX] += 4;
}
}
static void Task_DoConfettiEffect(u8 taskId)
static void Task_DoDomeConfetti(u8 taskId)
{
u32 var = 0;
u32 id = 0;
u16 *data = gTasks[taskId].data;
switch (data[0])
switch (tState)
{
case 0:
if (!sub_81521C0(0x40))
if (!ConfettiUtil_Init(64))
{
// Init failed
DestroyTask(taskId);
gSpecialVar_0x8004 = var;
gSpecialVar_0x8004 = 0;
gSpecialVar_0x8005 = 0xFFFF;
}
LoadCompressedSpriteSheet(sHallOfFame_ConfettiSpriteSheet);
LoadCompressedSpritePalette(sHallOfFame_ConfettiSpritePalette);
data[0]++;
LoadCompressedSpriteSheet(sSpriteSheet_Confetti);
LoadCompressedSpritePalette(sSpritePalette_Confetti);
tState++;
break;
case 1:
if (data[1] != 0 && data[1] % 3 == 0)
if (tTimer != 0 && tTimer % 3 == 0)
{
var = sub_81524C4(&sOamData_85E53FC, 0x3E9, 0x3E9, Random() % 240, -(Random() % 8), Random() % 0x11, var);
if (var != 0xFF)
// Create new confetti every 3 frames
id = ConfettiUtil_AddNew(&sOamData_Confetti,
TAG_CONFETTI,
TAG_CONFETTI,
Random() % 240,
-(Random() % 8),
Random() % ARRAY_COUNT(sAnims_Confetti),
id);
if (id != 0xFF)
{
sub_8152438(var, sub_81752F4);
if ((Random() & 3) == 0)
sub_8152474(var, 1, 1);
sub_8152474(var, 7, taskId);
data[15]++;
ConfettiUtil_SetCallback(id, UpdateDomeConfetti);
// 1/4 of the confetti move an extra y coord every frame
if ((Random() % 4) == 0)
ConfettiUtil_SetData(id, CONFETTI_EXTRA_Y, 1);
ConfettiUtil_SetData(id, CONFETTI_TASK_ID, taskId);
tConfettiCount++;
}
}
sub_81522D4();
if (data[1] != 0)
data[1]--;
else if (data[15] == 0)
data[0] = 0xFF;
ConfettiUtil_Update();
if (tTimer != 0)
tTimer--;
else if (tConfettiCount == 0)
tState = 0xFF;
break;
case 0xFF:
StopConfettiEffect();
gSpecialVar_0x8004 = var;
StopDomeConfetti();
gSpecialVar_0x8004 = 0;
gSpecialVar_0x8005 = 0xFFFF;
break;
}

View File

@ -1776,7 +1776,7 @@ void Task_ChooseHowManyToToss(u8 taskId)
if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE)
{
PrintItemDepositAmount(gBagMenu->unk817, tItemCount);
PrintItemDepositAmount(gBagMenu->windowPointers[7], tItemCount);
}
else if (gMain.newKeys & A_BUTTON)
{
@ -2050,7 +2050,7 @@ void Task_BuyHowManyDialogueHandleInput(u8 taskId)
if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE)
{
PrintItemSoldAmount(gBagMenu->unk818, tItemCount, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount);
PrintItemSoldAmount(gBagMenu->windowPointers[8], tItemCount, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount);
}
else if (gMain.newKeys & A_BUTTON)
{
@ -2094,7 +2094,7 @@ void sub_81AD8C8(u8 taskId)
LoadBagItemListBuffers(gBagPositionStruct.pocket);
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
BagMenu_PrintCursor_(data[0], 2);
PrintMoneyAmountInMoneyBox(gBagMenu->unk819, GetMoney(&gSaveBlock1Ptr->money), 0);
PrintMoneyAmountInMoneyBox(gBagMenu->windowPointers[9], GetMoney(&gSaveBlock1Ptr->money), 0);
gTasks[taskId].func = sub_81AD9C0;
}
@ -2134,7 +2134,7 @@ void sub_81ADA7C(u8 taskId)
if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE)
{
PrintItemDepositAmount(gBagMenu->unk817, tItemCount);
PrintItemDepositAmount(gBagMenu->windowPointers[7], tItemCount);
}
else if (gMain.newKeys & A_BUTTON)
{

View File

@ -38,11 +38,9 @@
#include "text.h"
#include "constants/event_bg.h"
#include "constants/event_objects.h"
#include "constants/flags.h"
#include "constants/item_effects.h"
#include "constants/items.h"
#include "constants/songs.h"
#include "constants/vars.h"
static void SetUpItemUseCallback(u8 taskId);
static void FieldCB_UseItemOnField(void);

View File

@ -280,7 +280,7 @@ static void ReadKeys(void)
gMain.heldKeys = gMain.heldKeysRaw;
// Remap L to A if the L=A option is enabled.
if (gSaveBlock2Ptr->optionsButtonMode == 2)
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
{
if (gMain.newKeys & L_BUTTON)
gMain.newKeys |= A_BUTTON;

View File

@ -1,7 +1,6 @@
#include "global.h"
#include "trainer_pokemon_sprites.h"
#include "bg.h"
#include "constants/flags.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/species.h"

View File

@ -3,7 +3,6 @@
#include "constants/songs.h"
#include "constants/easy_chat.h"
#include "constants/event_objects.h"
#include "constants/vars.h"
#include "mauville_old_man.h"
#include "event_data.h"
#include "string_util.h"

View File

@ -18,7 +18,6 @@
#include "task.h"
#include "text_window.h"
#include "window.h"
#include "constants/flags.h"
#include "constants/songs.h"
#define DLG_WINDOW_PALETTE_NUM 15

View File

@ -14,7 +14,6 @@
#include "sprite.h"
#include "task.h"
#include "window.h"
#include "constants/flags.h"
#include "constants/maps.h"
#include "constants/rgb.h"
#include "constants/songs.h"

View File

@ -13,7 +13,6 @@
#include "field_player_avatar.h"
#include "event_object_movement.h"
#include "event_data.h"
#include "constants/vars.h"
#include "constants/songs.h"
#include "pokemon_storage_system.h"
#include "graphics.h"

View File

@ -67,7 +67,6 @@
#include "constants/battle_frontier.h"
#include "constants/easy_chat.h"
#include "constants/field_effects.h"
#include "constants/flags.h"
#include "constants/item_effects.h"
#include "constants/items.h"
#include "constants/maps.h"
@ -76,7 +75,6 @@
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/species.h"
#include "constants/vars.h"
#define PARTY_PAL_SELECTED (1 << 0)
#define PARTY_PAL_FAINTED (1 << 1)

View File

@ -798,9 +798,9 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBattler]], 1);
if (GetBattlerSide(sprite->sBattler) == B_SIDE_OPPONENT)
gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = sub_8039B58;
gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = SpriteCb_OpponentMonFromBall;
else
gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = sub_8039E44;
gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = SpriteCb_PlayerMonFromBall;
AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBattler]]);
gSprites[gBattlerSpriteIds[sprite->sBattler]].data[1] = 0x1000;

View File

@ -4521,7 +4521,11 @@ static void UnusedPrintMonName(u8 windowId, const u8* name, u8 left, u8 top)
;
for (i = 0; i < nameLength; i++)
str[ARRAY_COUNT(str) - nameLength + i] = name[i];
#ifdef UBFIX
str[ARRAY_COUNT(str) - 1] = EOS;
#else
str[ARRAY_COUNT(str)] = EOS;
#endif
PrintInfoSubMenuText(windowId, str, left, top);
}

View File

@ -21,7 +21,6 @@
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/species.h"
#include "constants/vars.h"
#define AREA_SCREEN_WIDTH 32
#define AREA_SCREEN_HEIGHT 20

View File

@ -3234,7 +3234,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
damage /= 2;
}
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == 8 && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == MOVE_TARGET_BOTH && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
damage /= 2;
// moves always do at least 1 damage.
@ -3281,7 +3281,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
damage /= 2;
}
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == 8 && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == MOVE_TARGET_BOTH && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
damage /= 2;
// are effects of weather negated with cloud nine or air lock

View File

@ -12,7 +12,6 @@
#include "sound.h"
#include "string_util.h"
#include "strings.h"
#include "constants/flags.h"
#include "constants/songs.h"
struct Pokenav3Struct

View File

@ -8,7 +8,6 @@
#include "script_pokemon_util_80F87D8.h"
#include "tv.h"
#include "constants/heal_locations.h"
#include "constants/flags.h"
#include "constants/tv.h"
int GameClear(void)

View File

@ -9,7 +9,6 @@
#include "trig.h"
#include "constants/maps.h"
#include "overworld.h"
#include "constants/flags.h"
#include "event_data.h"
#include "secret_base.h"
#include "string_util.h"

View File

@ -1,218 +0,0 @@
#include "global.h"
#include "rom_81520A8.h"
#include "malloc.h"
#include "main.h"
#include "digit_obj_util.h"
static EWRAM_DATA struct
{
u8 count;
struct UnkStruct_81520A8 *unk4;
} *sUnknown_0203ABB8 = NULL;
void sub_81520A8(void *dest, u16 value, u8 left, u8 top, u8 width, u8 height) // Unused.
{
u8 i;
u8 j;
u8 x;
u8 y;
for (i = 0, y = top; i < height; i++)
{
for (x = left, j = 0; j < width; j++)
{
*(u16 *)((dest) + (y * 64 + x * 2)) = value;
x = (x + 1) % 32;
}
y = (y + 1) % 32;
}
}
void sub_8152134(void *dest, const u16 *src, u8 left, u8 top, u8 width, u8 height) // Unused.
{
u8 i;
u8 j;
u8 x;
u8 y;
const u16 *_src;
for (i = 0, _src = src, y = top; i < height; i++)
{
for (x = left, j = 0; j < width; j++)
{
*(u16 *)((dest) + (y * 64 + x * 2)) = *(_src++);
x = (x + 1) % 32;
}
y = (y + 1) % 32;
}
}
bool32 sub_81521C0(u8 count)
{
u8 i = 0;
if (count == 0)
return FALSE;
if (count > 64)
count = 64;
sUnknown_0203ABB8 = AllocZeroed(sizeof(*sUnknown_0203ABB8));
if (sUnknown_0203ABB8 == NULL)
return FALSE;
sUnknown_0203ABB8->unk4 = AllocZeroed(count * sizeof(struct UnkStruct_81520A8));
if (sUnknown_0203ABB8->unk4 == NULL)
{
FREE_AND_SET_NULL(sUnknown_0203ABB8);
return FALSE;
}
sUnknown_0203ABB8->count = count;
for (i = 0; i < count; i++)
{
memcpy(&sUnknown_0203ABB8->unk4[i].oam, &gDummyOamData, sizeof(struct OamData));
sUnknown_0203ABB8->unk4[i].unk19_2 = TRUE;
}
return TRUE;
}
bool32 sub_8152254(void)
{
u8 i = 0;
if (sUnknown_0203ABB8 == NULL)
return FALSE;
for (i = 0; i < sUnknown_0203ABB8->count; i++)
memcpy(&gMain.oamBuffer[i + 64], &gDummyOamData, sizeof(struct OamData));
memset(sUnknown_0203ABB8->unk4, 0, sUnknown_0203ABB8->count * sizeof(struct UnkStruct_81520A8));
FREE_AND_SET_NULL(sUnknown_0203ABB8->unk4);
memset(sUnknown_0203ABB8, 0, sizeof(*sUnknown_0203ABB8));
FREE_AND_SET_NULL(sUnknown_0203ABB8);
return TRUE;
}
bool32 sub_81522D4(void)
{
u8 i = 0;
if (sUnknown_0203ABB8 == NULL || sUnknown_0203ABB8->unk4 == NULL)
return FALSE;
for (i = 0; i < sUnknown_0203ABB8->count; i++)
{
if (sUnknown_0203ABB8->unk4[i].unk19_0 && sUnknown_0203ABB8->unk4[i].unk19_1)
{
if (sUnknown_0203ABB8->unk4[i].callback != NULL)
sUnknown_0203ABB8->unk4[i].callback(&sUnknown_0203ABB8->unk4[i]);
if (sUnknown_0203ABB8->unk4[i].unk19_2)
{
memcpy(&gMain.oamBuffer[i + 64], &gDummyOamData, sizeof(struct OamData));
}
else
{
sUnknown_0203ABB8->unk4[i].oam.y = sUnknown_0203ABB8->unk4[i].y + sUnknown_0203ABB8->unk4[i].yDelta;
sUnknown_0203ABB8->unk4[i].oam.x = sUnknown_0203ABB8->unk4[i].x + sUnknown_0203ABB8->unk4[i].xDelta;
sUnknown_0203ABB8->unk4[i].oam.priority = sUnknown_0203ABB8->unk4[i].priority;
sUnknown_0203ABB8->unk4[i].oam.tileNum = sUnknown_0203ABB8->unk4[i].tileNum;
memcpy(&gMain.oamBuffer[i + 64], &sUnknown_0203ABB8->unk4[i], sizeof(struct OamData));
}
}
}
return TRUE;
}
static bool32 sub_81523F4(struct UnkStruct_81520A8 *structPtr, u8 arg1)
{
u16 tileStart;
if (structPtr == NULL)
return FALSE;
tileStart = GetSpriteTileStartByTag(structPtr->tileTag);
if (tileStart == 0xFFFF)
return FALSE;
structPtr->unk18 = arg1;
structPtr->tileNum = (GetTilesPerImage(structPtr->oam.shape, structPtr->oam.size) * arg1) + tileStart;
return TRUE;
}
u8 sub_8152438(u8 id, void (*func)(struct UnkStruct_81520A8 *))
{
if (sUnknown_0203ABB8 == NULL || id >= sUnknown_0203ABB8->count)
return 0xFF;
else if (!sUnknown_0203ABB8->unk4[id].unk19_0)
return 0xFF;
sUnknown_0203ABB8->unk4[id].callback = func;
return id;
}
u8 sub_8152474(u8 id, u8 dataArrayId, s16 dataValue)
{
if (sUnknown_0203ABB8 == NULL || id >= sUnknown_0203ABB8->count)
return 0xFF;
else if (!sUnknown_0203ABB8->unk4[id].unk19_0 || dataArrayId >= ARRAY_COUNT(sUnknown_0203ABB8->unk4[id].data))
return 0xFF;
sUnknown_0203ABB8->unk4[id].data[dataArrayId] = dataValue;
return id;
}
u8 sub_81524C4(const struct OamData *oam, u16 tileTag, u16 palTag, s16 x, s16 y, u8 arg5, u8 priority)
{
struct UnkStruct_81520A8 *structPtr = NULL;
u8 i;
if (sUnknown_0203ABB8 == NULL || oam == NULL)
return 0xFF;
for (i = 0; i < sUnknown_0203ABB8->count; i++)
{
if (!sUnknown_0203ABB8->unk4[i].unk19_0)
{
structPtr = &sUnknown_0203ABB8->unk4[i];
memset(structPtr, 0, sizeof(*structPtr));
structPtr->id = i;
structPtr->unk19_0 = TRUE;
structPtr->unk19_1 = TRUE;
break;
}
}
if (structPtr == NULL)
return 0xFF;
memcpy(&structPtr->oam, oam, sizeof(*oam));
structPtr->tileTag = tileTag;
structPtr->palTag = palTag;
structPtr->x = x;
structPtr->y = y;
structPtr->oam.paletteNum = IndexOfSpritePaletteTag(palTag);
if (priority < 4)
{
structPtr->priority = priority;
structPtr->oam.priority = priority;
}
sub_81523F4(structPtr, arg5);
return structPtr->id;
}
u8 sub_81525D0(u8 id)
{
if (sUnknown_0203ABB8 == NULL || !sUnknown_0203ABB8->unk4[id].unk19_0)
return 0xFF;
memset(&sUnknown_0203ABB8->unk4[id], 0, sizeof(struct UnkStruct_81520A8));
sUnknown_0203ABB8->unk4[id].oam.y = 160;
sUnknown_0203ABB8->unk4[id].oam.x = 240;
sUnknown_0203ABB8->unk4[id].unk19_2 = TRUE;
memcpy(&gMain.oamBuffer[id + 64], &gDummyOamData, sizeof(struct OamData));
return id;
}

View File

@ -5,7 +5,7 @@
#include "clock.h"
#include "coins.h"
#include "contest.h"
#include "contest_link_80F57C4.h"
#include "contest_util.h"
#include "contest_painting.h"
#include "data.h"
#include "decoration.h"
@ -1470,7 +1470,9 @@ bool8 ScrCmd_hidemonpic(struct ScriptContext *ctx)
bool8 ScrCmd_showcontestwinner(struct ScriptContext *ctx)
{
u8 contestWinnerId = ScriptReadByte(ctx);
if (contestWinnerId)
// Don't save artist's painting yet
if (contestWinnerId != CONTEST_WINNER_ARTIST)
SetContestWinnerForPainting(contestWinnerId);
ShowContestWinner();
@ -1954,14 +1956,14 @@ bool8 ScrCmd_startcontest(struct ScriptContext *ctx)
bool8 ScrCmd_showcontestresults(struct ScriptContext *ctx)
{
sub_80F8484();
ShowContestResults();
ScriptContext1_Stop();
return TRUE;
}
bool8 ScrCmd_contestlinktransfer(struct ScriptContext *ctx)
{
sub_80F84C4(gSpecialVar_ContestCategory);
ContestLinkTransfer(gSpecialVar_ContestCategory);
ScriptContext1_Stop();
return TRUE;
}

View File

@ -3,7 +3,7 @@
#include "battle_gfx_sfx_util.h"
#include "berry.h"
#include "contest.h"
#include "contest_link_80F57C4.h"
#include "contest_util.h"
#include "contest_painting.h"
#include "data.h"
#include "daycare.h"
@ -30,7 +30,6 @@
#include "constants/items.h"
#include "constants/species.h"
#include "constants/tv.h"
#include "constants/vars.h"
#include "constants/battle_frontier.h"
extern const u16 gObjectEventPalette8[];
@ -122,7 +121,7 @@ void ShouldReadyContestArtist(void)
{
if (gContestFinalStandings[gContestPlayerMonIndex] == 0
&& gSpecialVar_ContestRank == CONTEST_RANK_MASTER
&& gUnknown_02039F08[gContestPlayerMonIndex] >= 800)
&& gContestMonTotalPoints[gContestPlayerMonIndex] >= 800)
{
gSpecialVar_0x8004 = TRUE;
}
@ -304,7 +303,7 @@ u8 GiveMonArtistRibbon(void)
if (!hasArtistRibbon
&& gContestFinalStandings[gContestPlayerMonIndex] == 0
&& gSpecialVar_ContestRank == CONTEST_RANK_MASTER
&& gUnknown_02039F08[gContestPlayerMonIndex] >= 800)
&& gContestMonTotalPoints[gContestPlayerMonIndex] >= 800)
{
hasArtistRibbon = 1;
SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_ARTIST_RIBBON, &hasArtistRibbon);

View File

@ -37,6 +37,7 @@
#include "constants/event_bg.h"
#include "constants/decorations.h"
#include "constants/event_objects.h"
#include "constants/field_specials.h"
#include "constants/items.h"
#include "constants/maps.h"
#include "constants/map_types.h"
@ -1120,7 +1121,7 @@ const u8 *GetSecretBaseTrainerLoseText(void)
void PrepSecretBaseBattleFlags(void)
{
TryGainNewFanFromCounter(1);
TryGainNewFanFromCounter(FANCOUNTER_BATTLED_AT_BASE);
gTrainerBattleOpponent_A = TRAINER_SECRET_BASE;
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_SECRET_BASE;
}

View File

@ -1236,7 +1236,7 @@ const u8 gText_BDot[] = _("B.");
const u8 gText_AnnouncingResults[] = _("Announcing the results!");
const u8 gText_PreliminaryResults[] = _("The preliminary results!");
const u8 gText_Round2Results[] = _("Round 2 results!");
const u8 gText_Var1sVar2Won[] = _("{STR_VAR_1}'s {STR_VAR_2} won!");
const u8 gText_ContestantsMonWon[] = _("{STR_VAR_1}'s {STR_VAR_2} won!");
const u8 gText_CommunicationStandby[] = _("Communication standby…");
const u8 gText_ColorDarkGrey[] = _("{COLOR DARK_GREY}");
const u8 gText_ColorDynamic6WhiteDynamic5[] = _("{COLOR_HIGHLIGHT_SHADOW DYNAMIC_COLOR6 WHITE DYNAMIC_COLOR5}"); // Unused

View File

@ -27,7 +27,6 @@
#include "trainer_pokemon_sprites.h"
#include "script_pokemon_util_80F87D8.h"
#include "constants/songs.h"
#include "constants/flags.h"
#include "constants/game_stat.h"
#include "constants/battle_frontier.h"
#include "constants/rgb.h"

View File

@ -8,7 +8,6 @@
#include "union_room.h"
#include "constants/event_objects.h"
#include "constants/event_object_movement.h"
#include "constants/flags.h"
#define UR_SPRITE_START_ID (MAX_SPRITES - MAX_UNION_ROOM_PLAYERS)
#define UR_PLAYER_SPRITE_ID(playerIdx, facingDir)(5 * playerIdx + facingDir)

View File

@ -75,7 +75,7 @@
.include "src/record_mixing.o"
.include "src/secret_base.o"
.include "src/tv.o"
.include "src/contest_link_80F57C4.o"
.include "src/contest_util.o"
.include "src/rotating_gate.o"
.include "src/safari_zone.o"
.include "src/item_use.o"
@ -104,7 +104,7 @@
.include "src/battle_transition.o"
.include "src/battle_message.o"
.include "src/cable_car.o"
.include "src/rom_81520A8.o"
.include "src/confetti_util.o"
.include "src/save.o"
.include "src/mystery_event_script.o"
.include "src/move_relearner.o"

View File

@ -92,6 +92,7 @@ void HandleGbaToPngCommand(char *inputPath, char *outputPath, int argc, char **a
options.width = 1;
options.metatileWidth = 1;
options.metatileHeight = 1;
options.tilemapFilePath = NULL;
options.isAffineMap = false;
for (int i = 3; i < argc; i++)