Merge remote-tracking branch 'pret/master' into RHH/sync/pret_20230214

# Conflicts:
#	src/battle_main.c
#	src/field_specials.c
#	src/trade.c
This commit is contained in:
Eduardo Quezada 2023-02-15 14:11:03 -03:00
commit b62e5aa72e
28 changed files with 2217 additions and 2238 deletions

View File

@ -1,5 +1,2 @@
gUnusedWindowVar1
gUnusedWindowVar2
gTransparentTileNumber gTransparentTileNumber
gUnusedWindowVar3
gWindowBgTilemapBuffers gWindowBgTilemapBuffers

View File

@ -48,21 +48,24 @@ BirthIsland_Exterior_EventScript_Triangle::
special DoDeoxysRockInteraction special DoDeoxysRockInteraction
waitstate waitstate
switch VAR_RESULT switch VAR_RESULT
case 0, BirthIsland_Exterior_EventScript_NotSolved1 case DEOXYS_ROCK_FAILED, BirthIsland_Exterior_EventScript_Failed
case 1, BirthIsland_Exterior_EventScript_NotSolved2 case DEOXYS_ROCK_PROGRESSED, BirthIsland_Exterior_EventScript_Progressed
case 2, BirthIsland_Exterior_EventScript_Deoxys case DEOXYS_ROCK_SOLVED, BirthIsland_Exterior_EventScript_Deoxys
case 3, BirthIsland_Exterior_EventScript_NotSolved3 case DEOXYS_ROCK_COMPLETE, BirthIsland_Exterior_EventScript_Complete
end end
BirthIsland_Exterior_EventScript_NotSolved1:: @ The actual rock triangle movement is handled by DoDeoxysRockInteraction.
@ Unless the player has solved the puzzle and needs to encounter Deoxys,
@ there's nothing else the script needs to do.
BirthIsland_Exterior_EventScript_Failed::
release release
end end
BirthIsland_Exterior_EventScript_NotSolved2:: BirthIsland_Exterior_EventScript_Progressed::
release release
end end
BirthIsland_Exterior_EventScript_NotSolved3:: BirthIsland_Exterior_EventScript_Complete::
release release
end end

View File

@ -38,7 +38,7 @@ PetalburgCity_OnFrame:
PetalburgCity_EventScript_WallyTutorial:: PetalburgCity_EventScript_WallyTutorial::
lockall lockall
special SavePlayerParty special SavePlayerParty
special PutZigzagoonInPlayerParty special LoadWallyZigzagoon
applymovement LOCALID_WALLY, PetalburgCity_Movement_WallyTutorialWally applymovement LOCALID_WALLY, PetalburgCity_Movement_WallyTutorialWally
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_WallyTutorialPlayer applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_WallyTutorialPlayer
waitmovement 0 waitmovement 0

View File

@ -311,7 +311,7 @@ gSpecials::
def_special TryUpdateRusturfTunnelState def_special TryUpdateRusturfTunnelState
def_special IsGrassTypeInParty def_special IsGrassTypeInParty
def_special DoContestHallWarp def_special DoContestHallWarp
def_special PutZigzagoonInPlayerParty def_special LoadWallyZigzagoon
def_special IsStarterInParty def_special IsStarterInParty
def_special CopyCurSecretBaseOwnerName_StrVar1 def_special CopyCurSecretBaseOwnerName_StrVar1
def_special ScriptCheckFreePokemonStorageSpace def_special ScriptCheckFreePokemonStorageSpace

View File

@ -4,11 +4,8 @@
#include "bg.h" #include "bg.h"
#include "blit.h" #include "blit.h"
u32 gUnusedWindowVar1;
u32 gUnusedWindowVar2;
// This global is set to 0 and never changed. // This global is set to 0 and never changed.
u8 gTransparentTileNumber; u8 gTransparentTileNumber;
u32 gUnusedWindowVar3;
void *gWindowBgTilemapBuffers[NUM_BACKGROUNDS]; void *gWindowBgTilemapBuffers[NUM_BACKGROUNDS];
extern u32 gWindowTileAutoAllocEnabled; extern u32 gWindowTileAutoAllocEnabled;

View File

@ -74,8 +74,5 @@ void CopyWindowToVram8Bit(u8 windowId, u8 mode);
extern struct Window gWindows[]; extern struct Window gWindows[];
extern void *gWindowBgTilemapBuffers[]; extern void *gWindowBgTilemapBuffers[];
extern u32 gUnusedWindowVar1;
extern u32 gUnusedWindowVar2;
extern u32 gUnusedWindowVar3;
#endif // GUARD_WINDOW_H #endif // GUARD_WINDOW_H

View File

@ -160,7 +160,7 @@ void AnimThrowProjectile(struct Sprite *sprite);
void GetBgDataForTransform(struct BattleAnimBgData *dest, u8 battlerId); void GetBgDataForTransform(struct BattleAnimBgData *dest, u8 battlerId);
u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId); u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId);
void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite); void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite);
void TradeMenuBouncePartySprites(struct Sprite *sprite); void Trade_MoveSelectedMonToTarget(struct Sprite *sprite);
void DestroyAnimVisualTaskAndDisableBlend(u8 taskId); void DestroyAnimVisualTaskAndDisableBlend(u8 taskId);
void DestroySpriteAndFreeResources_(struct Sprite *sprite); void DestroySpriteAndFreeResources_(struct Sprite *sprite);
void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId); void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId);

View File

@ -1,7 +1,7 @@
#ifndef GUARD_CONSTANTS_BATTLE_PYRAMID_H #ifndef GUARD_CONSTANTS_BATTLE_PYRAMID_H
#define GUARD_CONSTANTS_BATTLE_PYRAMID_H #define GUARD_CONSTANTS_BATTLE_PYRAMID_H
#define TOTAL_ROUNDS 20 #define TOTAL_PYRAMID_ROUNDS 20
#define PICKUP_ITEMS_PER_ROUND 10 #define PICKUP_ITEMS_PER_ROUND 10
#define HINT_EXIT_DIRECTION 0 #define HINT_EXIT_DIRECTION 0

View File

@ -80,4 +80,10 @@
#define FANCOUNTER_FINISHED_CONTEST 2 #define FANCOUNTER_FINISHED_CONTEST 2
#define FANCOUNTER_USED_BATTLE_TOWER 3 #define FANCOUNTER_USED_BATTLE_TOWER 3
// Return values for DoDeoxysRockInteraction
#define DEOXYS_ROCK_FAILED 0
#define DEOXYS_ROCK_PROGRESSED 1
#define DEOXYS_ROCK_SOLVED 2
#define DEOXYS_ROCK_COMPLETE 3
#endif // GUARD_CONSTANTS_FIELD_SPECIALS_H #endif // GUARD_CONSTANTS_FIELD_SPECIALS_H

View File

@ -4,29 +4,19 @@
#define TRADE_PLAYER 0 #define TRADE_PLAYER 0
#define TRADE_PARTNER 1 #define TRADE_PARTNER 1
#define LINK_TRADE_TIMEOUT 300
// In-game Trade IDs // In-game Trade IDs
#define INGAME_TRADE_SEEDOT 0 #define INGAME_TRADE_SEEDOT 0
#define INGAME_TRADE_PLUSLE 1 #define INGAME_TRADE_PLUSLE 1
#define INGAME_TRADE_HORSEA 2 #define INGAME_TRADE_HORSEA 2
#define INGAME_TRADE_MEOWTH 3 #define INGAME_TRADE_MEOWTH 3
// Flag IDs for sending link data
#define INITIATE_TRADE 1
#define CANCEL_TRADE 2
#define WANTS_TO_TRADE 1
#define WANTS_TO_CANCEL 2
#define READY_FINISH_TRADE 1
#define FINISH_TRADE 2
// Return values for CanTradeSelectedMon and CanSpinTradeMon // Return values for CanTradeSelectedMon and CanSpinTradeMon
#define CAN_TRADE_MON 0 #define CAN_TRADE_MON 0
#define CANT_TRADE_LAST_MON 1 #define CANT_TRADE_LAST_MON 1
#define CANT_TRADE_NATIONAL 2 #define CANT_TRADE_NATIONAL 2
#define CANT_TRADE_EGG_YET 3 #define CANT_TRADE_EGG_YET 3
#define CANT_TRADE_INVALID_MON 4 #define CANT_TRADE_INVALID_MON 4
#define CANT_TRADE_EGG_YET2 5 #define CANT_TRADE_PARTNER_EGG_YET 5
// Return values for CheckValidityOfTradeMons // Return values for CheckValidityOfTradeMons
#define PLAYER_MON_INVALID 0 #define PLAYER_MON_INVALID 0
@ -38,63 +28,6 @@
#define TRADE_PLAYER_NOT_READY 1 #define TRADE_PLAYER_NOT_READY 1
#define TRADE_PARTNER_NOT_READY 2 #define TRADE_PARTNER_NOT_READY 2
// Indexes for sTradeActionTexts
#define TRADE_TEXT_CANCEL 0
#define TRADE_TEXT_CHOOSE_MON 1
#define TRADE_TEXT_SUMMARY 2
#define TRADE_TEXT_TRADE 3
#define TRADE_TEXT_CANCEL_TRADE 4
#define TRADE_TEXT_JP_QUIT 5
// Checked to confirm DrawTradeMenuParty has reached final state
#define DRAW_PARTY_FINISH 5
// Message indexes for sTradeMessages
#define TRADE_MSG_STANDBY 0
#define TRADE_MSG_CANCELED 1
#define TRADE_MSG_ONLY_MON1 2
#define TRADE_MSG_ONLY_MON2 3
#define TRADE_MSG_WAITING_FOR_FRIEND 4
#define TRADE_MSG_FRIEND_WANTS_TO_TRADE 5
#define TRADE_MSG_MON_CANT_BE_TRADED 6
#define TRADE_MSG_EGG_CANT_BE_TRADED 7
#define TRADE_MSG_FRIENDS_MON_CANT_BE_TRADED 8
// IDs for QueueAction
#define QUEUE_SEND_DATA 0
#define QUEUE_STANDBY 1
#define QUEUE_ONLY_MON1 2
#define QUEUE_ONLY_MON2 3
#define QUEUE_UNUSED1 4
#define QUEUE_UNUSED2 5
#define QUEUE_MON_CANT_BE_TRADED 6
#define QUEUE_EGG_CANT_BE_TRADED 7
#define QUEUE_FRIENDS_MON_CANT_BE_TRADED 8
#define QUEUE_DELAY_MSG 3
#define QUEUE_DELAY_DATA 5
// IDs for CallTradeMenuFunc
#define TRADEMENUFUNC_MAIN_MENU 0
#define TRADEMENUFUNC_SELECTED_MON 1
#define TRADEMENUFUNC_SHOW_MON_SUMMARY 2
#define TRADEMENUFUNC_CONFIRM_OR_CANCEL_TRADE 3
#define TRADEMENUFUNC_CANCEL_TRADE_PROMPT 4
#define TRADEMENUFUNC_UNUSED_5 5
#define TRADEMENUFUNC_BOTH_MONS_SELECTED 6
#define TRADEMENUFUNC_CONFIRM_TRADE_PROMPT 7
#define TRADEMENUFUNC_REDRAW_MAIN_MENU 8
#define TRADEMENUFUNC_LINK_TRADE_FADE_OUT 9
#define TRADEMENUFUNC_LINK_TRADE_WAIT_FADE 10
#define TRADEMENUFUNC_CANCEL_TRADE_1 11
#define TRADEMENUFUNC_CANCEL_TRADE_2 12
#define TRADEMENUFUNC_START_LINK_TRADE 13
#define TRADEMENUFUNC_DELAY_TRADE_CONFIRM 14
#define TRADEMENUFUNC_UNUSED_15 15
#define TRADEMENUFUNC_LINK_TRADE_WAIT_QUEUE 16
#define TRADEMENUFUNC_PARTNER_MON_INVALID 17
#define TRADEMENUFUNC_STANDBY 100
// Message indexes for sUnionRoomTradeMessages // Message indexes for sUnionRoomTradeMessages
#define UR_TRADE_MSG_NONE 0 #define UR_TRADE_MSG_NONE 0
#define UR_TRADE_MSG_NOT_MON_PARTNER_WANTS 1 #define UR_TRADE_MSG_NOT_MON_PARTNER_WANTS 1

View File

@ -83,7 +83,7 @@ struct RfuGameCompatibilityData
u16 hasNews:1; u16 hasNews:1;
u16 hasCard:1; u16 hasCard:1;
u16 unknown:1; // Never read u16 unknown:1; // Never read
u16 isChampion:1; u16 canLinkNationally:1;
u16 hasNationalDex:1; u16 hasNationalDex:1;
u16 gameClear:1; u16 gameClear:1;
u16 version:4; u16 version:4;

View File

@ -1080,7 +1080,7 @@ void UpdateAnimBg3ScreenSize(bool8 largeScreenSize)
} }
} }
void TradeMenuBouncePartySprites(struct Sprite *sprite) void Trade_MoveSelectedMonToTarget(struct Sprite *sprite)
{ {
sprite->data[1] = sprite->x; sprite->data[1] = sprite->x;
sprite->data[3] = sprite->y; sprite->data[3] = sprite->y;

View File

@ -2083,288 +2083,236 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 1, .speed = 1,
.fgColor = TEXT_COLOR_WHITE, .fgColor = 1,
.bgColor = TEXT_DYNAMIC_COLOR_6, .bgColor = 15,
.shadowColor = TEXT_COLOR_GREEN, .shadowColor = 6,
}, },
[B_WIN_ACTION_PROMPT] = { [B_WIN_ACTION_PROMPT] = {
.fillValue = PIXEL_FILL(0xF), .fillValue = PIXEL_FILL(0xF),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 1, .x = 1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_COLOR_WHITE, .fgColor = 1,
.bgColor = TEXT_DYNAMIC_COLOR_6, .bgColor = 15,
.shadowColor = TEXT_COLOR_GREEN, .shadowColor = 6,
}, },
[B_WIN_ACTION_MENU] = { [B_WIN_ACTION_MENU] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_MOVE_NAME_1] = { [B_WIN_MOVE_NAME_1] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW, .fontId = FONT_NARROW,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_MOVE_NAME_2] = { [B_WIN_MOVE_NAME_2] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW, .fontId = FONT_NARROW,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_MOVE_NAME_3] = { [B_WIN_MOVE_NAME_3] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW, .fontId = FONT_NARROW,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_MOVE_NAME_4] = { [B_WIN_MOVE_NAME_4] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW, .fontId = FONT_NARROW,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_PP] = { [B_WIN_PP] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW, .fontId = FONT_NARROW,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_3, .fgColor = 12,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_2, .shadowColor = 11,
}, },
[B_WIN_DUMMY] = { [B_WIN_DUMMY] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_PP_REMAINING] = { [B_WIN_PP_REMAINING] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 2, .x = 2,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_3, .fgColor = 12,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_2, .shadowColor = 11,
}, },
[B_WIN_MOVE_TYPE] = { [B_WIN_MOVE_TYPE] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW, .fontId = FONT_NARROW,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_SWITCH_PROMPT] = { [B_WIN_SWITCH_PROMPT] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW, .fontId = FONT_NARROW,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_YESNO] = { [B_WIN_YESNO] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_LEVEL_UP_BOX] = { [B_WIN_LEVEL_UP_BOX] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_LEVEL_UP_BANNER] = { [B_WIN_LEVEL_UP_BANNER] = {
.fillValue = PIXEL_FILL(0), .fillValue = PIXEL_FILL(0),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 32, .x = 32,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_COLOR_WHITE, .fgColor = 1,
.bgColor = TEXT_COLOR_TRANSPARENT, .shadowColor = 2,
.shadowColor = TEXT_COLOR_DARK_GRAY,
}, },
[B_WIN_VS_PLAYER] = { [B_WIN_VS_PLAYER] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_VS_OPPONENT] = { [B_WIN_VS_OPPONENT] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_VS_MULTI_PLAYER_1] = { [B_WIN_VS_MULTI_PLAYER_1] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_VS_MULTI_PLAYER_2] = { [B_WIN_VS_MULTI_PLAYER_2] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_VS_MULTI_PLAYER_3] = { [B_WIN_VS_MULTI_PLAYER_3] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_VS_MULTI_PLAYER_4] = { [B_WIN_VS_MULTI_PLAYER_4] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_VS_OUTCOME_DRAW] = { [B_WIN_VS_OUTCOME_DRAW] = {
.fillValue = PIXEL_FILL(0), .fillValue = PIXEL_FILL(0),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_COLOR_WHITE, .fgColor = 1,
.bgColor = TEXT_COLOR_TRANSPARENT, .shadowColor = 6,
.shadowColor = TEXT_COLOR_GREEN,
}, },
[B_WIN_VS_OUTCOME_LEFT] = { [B_WIN_VS_OUTCOME_LEFT] = {
.fillValue = PIXEL_FILL(0), .fillValue = PIXEL_FILL(0),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_COLOR_WHITE, .fgColor = 1,
.bgColor = TEXT_COLOR_TRANSPARENT, .shadowColor = 6,
.shadowColor = TEXT_COLOR_GREEN,
}, },
[B_WIN_VS_OUTCOME_RIGHT] = { [B_WIN_VS_OUTCOME_RIGHT] = {
.fillValue = PIXEL_FILL(0x0), .fillValue = PIXEL_FILL(0x0),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_COLOR_WHITE, .fgColor = 1,
.bgColor = TEXT_COLOR_TRANSPARENT, .shadowColor = 6,
.shadowColor = TEXT_COLOR_GREEN,
}, },
}; };
@ -2375,276 +2323,229 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 1, .speed = 1,
.fgColor = TEXT_COLOR_WHITE, .fgColor = 1,
.bgColor = TEXT_DYNAMIC_COLOR_6, .bgColor = 15,
.shadowColor = TEXT_COLOR_GREEN, .shadowColor = 6,
}, },
[B_WIN_ACTION_PROMPT] = { [B_WIN_ACTION_PROMPT] = {
.fillValue = PIXEL_FILL(0xF), .fillValue = PIXEL_FILL(0xF),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 1, .x = 1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_COLOR_WHITE, .fgColor = 1,
.bgColor = TEXT_DYNAMIC_COLOR_6, .bgColor = 15,
.shadowColor = TEXT_COLOR_GREEN, .shadowColor = 6,
}, },
[B_WIN_ACTION_MENU] = { [B_WIN_ACTION_MENU] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_MOVE_NAME_1] = { [B_WIN_MOVE_NAME_1] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW, .fontId = FONT_NARROW,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_MOVE_NAME_2] = { [B_WIN_MOVE_NAME_2] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW, .fontId = FONT_NARROW,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_MOVE_NAME_3] = { [B_WIN_MOVE_NAME_3] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW, .fontId = FONT_NARROW,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_MOVE_NAME_4] = { [B_WIN_MOVE_NAME_4] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW, .fontId = FONT_NARROW,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_PP] = { [B_WIN_PP] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW, .fontId = FONT_NARROW,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_3, .fgColor = 12,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_2, .shadowColor = 11,
}, },
[B_WIN_DUMMY] = { [B_WIN_DUMMY] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_PP_REMAINING] = { [B_WIN_PP_REMAINING] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 2, .x = 2,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_3, .fgColor = 12,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_2, .shadowColor = 11,
}, },
[B_WIN_MOVE_TYPE] = { [B_WIN_MOVE_TYPE] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW, .fontId = FONT_NARROW,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_SWITCH_PROMPT] = { [B_WIN_SWITCH_PROMPT] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW, .fontId = FONT_NARROW,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_YESNO] = { [B_WIN_YESNO] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_LEVEL_UP_BOX] = { [B_WIN_LEVEL_UP_BOX] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[B_WIN_LEVEL_UP_BANNER] = { [B_WIN_LEVEL_UP_BANNER] = {
.fillValue = PIXEL_FILL(0), .fillValue = PIXEL_FILL(0),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 32, .x = 32,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_COLOR_WHITE, .fgColor = 1,
.bgColor = TEXT_COLOR_TRANSPARENT, .shadowColor = 2,
.shadowColor = TEXT_COLOR_DARK_GRAY,
}, },
[ARENA_WIN_PLAYER_NAME] = { [ARENA_WIN_PLAYER_NAME] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_COLOR_WHITE, .fgColor = 1,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[ARENA_WIN_VS] = { [ARENA_WIN_VS] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[ARENA_WIN_OPPONENT_NAME] = { [ARENA_WIN_OPPONENT_NAME] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[ARENA_WIN_MIND] = { [ARENA_WIN_MIND] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[ARENA_WIN_SKILL] = { [ARENA_WIN_SKILL] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[ARENA_WIN_BODY] = { [ARENA_WIN_BODY] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[ARENA_WIN_JUDGMENT_TITLE] = { [ARENA_WIN_JUDGMENT_TITLE] = {
.fillValue = PIXEL_FILL(0xE), .fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = -1, .x = -1,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0, .speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4, .fgColor = 13,
.bgColor = TEXT_DYNAMIC_COLOR_5, .bgColor = 14,
.shadowColor = TEXT_DYNAMIC_COLOR_6, .shadowColor = 15,
}, },
[ARENA_WIN_JUDGMENT_TEXT] = { [ARENA_WIN_JUDGMENT_TEXT] = {
.fillValue = PIXEL_FILL(0x1), .fillValue = PIXEL_FILL(0x1),
.fontId = FONT_NORMAL, .fontId = FONT_NORMAL,
.x = 0, .x = 0,
.y = 1, .y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 1, .speed = 1,
.fgColor = TEXT_COLOR_DARK_GRAY, .fgColor = 2,
.bgColor = TEXT_COLOR_WHITE, .bgColor = 1,
.shadowColor = TEXT_COLOR_LIGHT_GRAY, .shadowColor = 3,
}, },
}; };

View File

@ -284,7 +284,7 @@ static const u8 sFloorTemplateOffsets[FRONTIER_STAGES_PER_CHALLENGE] =
0, 4, 9, 14, 19, 24, 29 0, 4, 9, 14, 19, 24, 29
}; };
static const u16 sPickupItemsLvl50[TOTAL_ROUNDS][PICKUP_ITEMS_PER_ROUND] = static const u16 sPickupItemsLvl50[TOTAL_PYRAMID_ROUNDS][PICKUP_ITEMS_PER_ROUND] =
{ {
{ITEM_HYPER_POTION, ITEM_FLUFFY_TAIL, ITEM_CHERI_BERRY, ITEM_ETHER, ITEM_LUM_BERRY, ITEM_REVIVE, ITEM_BRIGHT_POWDER, ITEM_SHELL_BELL, ITEM_MAX_REVIVE, ITEM_SACRED_ASH}, {ITEM_HYPER_POTION, ITEM_FLUFFY_TAIL, ITEM_CHERI_BERRY, ITEM_ETHER, ITEM_LUM_BERRY, ITEM_REVIVE, ITEM_BRIGHT_POWDER, ITEM_SHELL_BELL, ITEM_MAX_REVIVE, ITEM_SACRED_ASH},
{ITEM_HYPER_POTION, ITEM_DIRE_HIT, ITEM_PECHA_BERRY, ITEM_ETHER, ITEM_LEPPA_BERRY, ITEM_REVIVE, ITEM_LEFTOVERS, ITEM_CHOICE_BAND, ITEM_FULL_RESTORE, ITEM_MAX_ELIXIR}, {ITEM_HYPER_POTION, ITEM_DIRE_HIT, ITEM_PECHA_BERRY, ITEM_ETHER, ITEM_LEPPA_BERRY, ITEM_REVIVE, ITEM_LEFTOVERS, ITEM_CHOICE_BAND, ITEM_FULL_RESTORE, ITEM_MAX_ELIXIR},
@ -308,7 +308,7 @@ static const u16 sPickupItemsLvl50[TOTAL_ROUNDS][PICKUP_ITEMS_PER_ROUND] =
{ITEM_HYPER_POTION, ITEM_X_DEFENSE, ITEM_LUM_BERRY, ITEM_ETHER, ITEM_LEPPA_BERRY, ITEM_REVIVE, ITEM_QUICK_CLAW, ITEM_KINGS_ROCK, ITEM_FULL_RESTORE, ITEM_MAX_ELIXIR}, {ITEM_HYPER_POTION, ITEM_X_DEFENSE, ITEM_LUM_BERRY, ITEM_ETHER, ITEM_LEPPA_BERRY, ITEM_REVIVE, ITEM_QUICK_CLAW, ITEM_KINGS_ROCK, ITEM_FULL_RESTORE, ITEM_MAX_ELIXIR},
}; };
static const u16 sPickupItemsLvlOpen[TOTAL_ROUNDS][PICKUP_ITEMS_PER_ROUND] = static const u16 sPickupItemsLvlOpen[TOTAL_PYRAMID_ROUNDS][PICKUP_ITEMS_PER_ROUND] =
{ {
{ITEM_HYPER_POTION, ITEM_FLUFFY_TAIL, ITEM_CHERI_BERRY, ITEM_ETHER, ITEM_LUM_BERRY, ITEM_REVIVE, ITEM_BRIGHT_POWDER, ITEM_SHELL_BELL, ITEM_MAX_REVIVE, ITEM_SACRED_ASH}, {ITEM_HYPER_POTION, ITEM_FLUFFY_TAIL, ITEM_CHERI_BERRY, ITEM_ETHER, ITEM_LUM_BERRY, ITEM_REVIVE, ITEM_BRIGHT_POWDER, ITEM_SHELL_BELL, ITEM_MAX_REVIVE, ITEM_SACRED_ASH},
{ITEM_HYPER_POTION, ITEM_DIRE_HIT, ITEM_PECHA_BERRY, ITEM_ETHER, ITEM_LEPPA_BERRY, ITEM_REVIVE, ITEM_LEFTOVERS, ITEM_CHOICE_BAND, ITEM_FULL_RESTORE, ITEM_MAX_ELIXIR}, {ITEM_HYPER_POTION, ITEM_DIRE_HIT, ITEM_PECHA_BERRY, ITEM_ETHER, ITEM_LEPPA_BERRY, ITEM_REVIVE, ITEM_LEFTOVERS, ITEM_CHOICE_BAND, ITEM_FULL_RESTORE, ITEM_MAX_ELIXIR},
@ -977,10 +977,10 @@ static void SetPickupItem(void)
u8 id; u8 id;
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u32 floor = gSaveBlock2Ptr->frontier.curChallengeBattleNum; u32 floor = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
u32 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE) % TOTAL_ROUNDS; u32 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE) % TOTAL_PYRAMID_ROUNDS;
if (round >= TOTAL_ROUNDS) if (round >= TOTAL_PYRAMID_ROUNDS)
round = TOTAL_ROUNDS - 1; round = TOTAL_PYRAMID_ROUNDS - 1;
id = GetPyramidFloorTemplateId(); id = GetPyramidFloorTemplateId();
itemIndex = (gSpecialVar_LastTalked - sPyramidFloorTemplates[id].numTrainers) - 1; itemIndex = (gSpecialVar_LastTalked - sPyramidFloorTemplates[id].numTrainers) - 1;
@ -1345,10 +1345,10 @@ void GenerateBattlePyramidWildMon(void)
const struct PyramidWildMon *wildMons; const struct PyramidWildMon *wildMons;
u32 id; u32 id;
u32 lvl = gSaveBlock2Ptr->frontier.lvlMode; u32 lvl = gSaveBlock2Ptr->frontier.lvlMode;
u16 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] / FRONTIER_STAGES_PER_CHALLENGE) % TOTAL_ROUNDS; u16 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] / FRONTIER_STAGES_PER_CHALLENGE) % TOTAL_PYRAMID_ROUNDS;
if (round >= TOTAL_ROUNDS) if (round >= TOTAL_PYRAMID_ROUNDS)
round = TOTAL_ROUNDS - 1; round = TOTAL_PYRAMID_ROUNDS - 1;
if (lvl != FRONTIER_LVL_50) if (lvl != FRONTIER_LVL_50)
wildMons = sOpenLevelWildMonPointers[round]; wildMons = sOpenLevelWildMonPointers[round];
@ -1961,8 +1961,8 @@ u16 GetBattlePyramidPickupItemId(void)
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
int round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE); int round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE);
if (round >= TOTAL_ROUNDS) if (round >= TOTAL_PYRAMID_ROUNDS)
round = TOTAL_ROUNDS - 1; round = TOTAL_PYRAMID_ROUNDS - 1;
rand = Random() % 100; rand = Random() % 100;

View File

@ -1038,7 +1038,7 @@ static const struct PyramidWildMon sOpenLevelWildMons_Round20[] =
} }
}; };
static const struct PyramidWildMon *const sOpenLevelWildMonPointers[TOTAL_ROUNDS] = static const struct PyramidWildMon *const sOpenLevelWildMonPointers[TOTAL_PYRAMID_ROUNDS] =
{ {
sOpenLevelWildMons_Round1, sOpenLevelWildMons_Round1,
sOpenLevelWildMons_Round2, sOpenLevelWildMons_Round2,

View File

@ -2,102 +2,104 @@
#include "global.h" #include "global.h"
#include "contest.h" #include "contest.h"
#define CONTEST_OPPONENT_JIMMY 0 enum {
#define CONTEST_OPPONENT_EDITH 1 CONTEST_OPPONENT_JIMMY,
#define CONTEST_OPPONENT_EVAN 2 CONTEST_OPPONENT_EDITH,
#define CONTEST_OPPONENT_KELSEY 3 CONTEST_OPPONENT_EVAN,
#define CONTEST_OPPONENT_MADISON 4 CONTEST_OPPONENT_KELSEY,
#define CONTEST_OPPONENT_RAYMOND 5 CONTEST_OPPONENT_MADISON,
#define CONTEST_OPPONENT_GRANT 6 CONTEST_OPPONENT_RAYMOND,
#define CONTEST_OPPONENT_PAIGE 7 CONTEST_OPPONENT_GRANT,
#define CONTEST_OPPONENT_ALEC 8 CONTEST_OPPONENT_PAIGE,
#define CONTEST_OPPONENT_SYDNEY 9 CONTEST_OPPONENT_ALEC,
#define CONTEST_OPPONENT_MORRIS 10 CONTEST_OPPONENT_SYDNEY,
#define CONTEST_OPPONENT_MARIAH 11 CONTEST_OPPONENT_MORRIS,
#define CONTEST_OPPONENT_RUSSELL 12 CONTEST_OPPONENT_MARIAH,
#define CONTEST_OPPONENT_MELANIE 13 CONTEST_OPPONENT_RUSSELL,
#define CONTEST_OPPONENT_CHANCE 14 CONTEST_OPPONENT_MELANIE,
#define CONTEST_OPPONENT_AGATHA 15 CONTEST_OPPONENT_CHANCE,
#define CONTEST_OPPONENT_BEAU 16 CONTEST_OPPONENT_AGATHA,
#define CONTEST_OPPONENT_KAY 17 CONTEST_OPPONENT_BEAU,
#define CONTEST_OPPONENT_CALE 18 CONTEST_OPPONENT_KAY,
#define CONTEST_OPPONENT_CAITLIN 19 CONTEST_OPPONENT_CALE,
#define CONTEST_OPPONENT_COLBY 20 CONTEST_OPPONENT_CAITLIN,
#define CONTEST_OPPONENT_KYLIE 21 CONTEST_OPPONENT_COLBY,
#define CONTEST_OPPONENT_LIAM 22 CONTEST_OPPONENT_KYLIE,
#define CONTEST_OPPONENT_MILO 23 CONTEST_OPPONENT_LIAM,
#define CONTEST_OPPONENT_KARINA 24 CONTEST_OPPONENT_MILO,
#define CONTEST_OPPONENT_BOBBY 25 CONTEST_OPPONENT_KARINA,
#define CONTEST_OPPONENT_CLAIRE 26 CONTEST_OPPONENT_BOBBY,
#define CONTEST_OPPONENT_WILLIE 27 CONTEST_OPPONENT_CLAIRE,
#define CONTEST_OPPONENT_CASSIDY 28 CONTEST_OPPONENT_WILLIE,
#define CONTEST_OPPONENT_MORGAN 29 CONTEST_OPPONENT_CASSIDY,
#define CONTEST_OPPONENT_SUMMER 30 CONTEST_OPPONENT_MORGAN,
#define CONTEST_OPPONENT_MILES 31 CONTEST_OPPONENT_SUMMER,
#define CONTEST_OPPONENT_AUDREY 32 CONTEST_OPPONENT_MILES,
#define CONTEST_OPPONENT_AVERY 33 CONTEST_OPPONENT_AUDREY,
#define CONTEST_OPPONENT_ARIANA 34 CONTEST_OPPONENT_AVERY,
#define CONTEST_OPPONENT_ASHTON 35 CONTEST_OPPONENT_ARIANA,
#define CONTEST_OPPONENT_SANDRA 36 CONTEST_OPPONENT_ASHTON,
#define CONTEST_OPPONENT_CARSON 37 CONTEST_OPPONENT_SANDRA,
#define CONTEST_OPPONENT_KATRINA 38 CONTEST_OPPONENT_CARSON,
#define CONTEST_OPPONENT_LUKE 39 CONTEST_OPPONENT_KATRINA,
#define CONTEST_OPPONENT_RAUL 40 CONTEST_OPPONENT_LUKE,
#define CONTEST_OPPONENT_JADA 41 CONTEST_OPPONENT_RAUL,
#define CONTEST_OPPONENT_ZEEK 42 CONTEST_OPPONENT_JADA,
#define CONTEST_OPPONENT_DIEGO 43 CONTEST_OPPONENT_ZEEK,
#define CONTEST_OPPONENT_ALIYAH 44 CONTEST_OPPONENT_DIEGO,
#define CONTEST_OPPONENT_NATALIA 45 CONTEST_OPPONENT_ALIYAH,
#define CONTEST_OPPONENT_DEVIN 46 CONTEST_OPPONENT_NATALIA,
#define CONTEST_OPPONENT_TYLOR 47 CONTEST_OPPONENT_DEVIN,
#define CONTEST_OPPONENT_RONNIE 48 CONTEST_OPPONENT_TYLOR,
#define CONTEST_OPPONENT_CLAUDIA 49 CONTEST_OPPONENT_RONNIE,
#define CONTEST_OPPONENT_ELIAS 50 CONTEST_OPPONENT_CLAUDIA,
#define CONTEST_OPPONENT_JADE 51 CONTEST_OPPONENT_ELIAS,
#define CONTEST_OPPONENT_FRANCIS 52 CONTEST_OPPONENT_JADE,
#define CONTEST_OPPONENT_ALISHA 53 CONTEST_OPPONENT_FRANCIS,
#define CONTEST_OPPONENT_SAUL 54 CONTEST_OPPONENT_ALISHA,
#define CONTEST_OPPONENT_FELICIA 55 CONTEST_OPPONENT_SAUL,
#define CONTEST_OPPONENT_EMILIO 56 CONTEST_OPPONENT_FELICIA,
#define CONTEST_OPPONENT_KARLA 57 CONTEST_OPPONENT_EMILIO,
#define CONTEST_OPPONENT_DARRYL 58 CONTEST_OPPONENT_KARLA,
#define CONTEST_OPPONENT_SELENA 59 CONTEST_OPPONENT_DARRYL,
#define CONTEST_OPPONENT_NOEL 60 CONTEST_OPPONENT_SELENA,
#define CONTEST_OPPONENT_LACEY 61 CONTEST_OPPONENT_NOEL,
#define CONTEST_OPPONENT_CORBIN 62 CONTEST_OPPONENT_LACEY,
#define CONTEST_OPPONENT_GRACIE 63 CONTEST_OPPONENT_CORBIN,
#define CONTEST_OPPONENT_COLTIN 64 CONTEST_OPPONENT_GRACIE,
#define CONTEST_OPPONENT_ELLIE 65 CONTEST_OPPONENT_COLTIN,
#define CONTEST_OPPONENT_MARCUS 66 CONTEST_OPPONENT_ELLIE,
#define CONTEST_OPPONENT_KIARA 67 CONTEST_OPPONENT_MARCUS,
#define CONTEST_OPPONENT_BRYCE 68 CONTEST_OPPONENT_KIARA,
#define CONTEST_OPPONENT_JAMIE 69 CONTEST_OPPONENT_BRYCE,
#define CONTEST_OPPONENT_JORGE 70 CONTEST_OPPONENT_JAMIE,
#define CONTEST_OPPONENT_DEVON 71 CONTEST_OPPONENT_JORGE,
#define CONTEST_OPPONENT_JUSTINA 72 CONTEST_OPPONENT_DEVON,
#define CONTEST_OPPONENT_RALPH 73 CONTEST_OPPONENT_JUSTINA,
#define CONTEST_OPPONENT_ROSA 74 CONTEST_OPPONENT_RALPH,
#define CONTEST_OPPONENT_KEATON 75 CONTEST_OPPONENT_ROSA,
#define CONTEST_OPPONENT_MAYRA 76 CONTEST_OPPONENT_KEATON,
#define CONTEST_OPPONENT_LAMAR 77 CONTEST_OPPONENT_MAYRA,
#define CONTEST_OPPONENT_AUBREY 78 CONTEST_OPPONENT_LAMAR,
#define CONTEST_OPPONENT_NIGEL 79 CONTEST_OPPONENT_AUBREY,
#define CONTEST_OPPONENT_CAMILLE 80 CONTEST_OPPONENT_NIGEL,
#define CONTEST_OPPONENT_DEON 81 CONTEST_OPPONENT_CAMILLE,
#define CONTEST_OPPONENT_JANELLE 82 CONTEST_OPPONENT_DEON,
#define CONTEST_OPPONENT_HEATH 83 CONTEST_OPPONENT_JANELLE,
#define CONTEST_OPPONENT_SASHA 84 CONTEST_OPPONENT_HEATH,
#define CONTEST_OPPONENT_FRANKIE 85 CONTEST_OPPONENT_SASHA,
#define CONTEST_OPPONENT_HELEN 86 CONTEST_OPPONENT_FRANKIE,
#define CONTEST_OPPONENT_CAMILE 87 CONTEST_OPPONENT_HELEN,
#define CONTEST_OPPONENT_MARTIN 88 CONTEST_OPPONENT_CAMILE,
#define CONTEST_OPPONENT_SERGIO 89 CONTEST_OPPONENT_MARTIN,
#define CONTEST_OPPONENT_KAILEY 90 CONTEST_OPPONENT_SERGIO,
#define CONTEST_OPPONENT_PERLA 91 CONTEST_OPPONENT_KAILEY,
#define CONTEST_OPPONENT_CLARA 92 CONTEST_OPPONENT_PERLA,
#define CONTEST_OPPONENT_JAKOB 93 CONTEST_OPPONENT_CLARA,
#define CONTEST_OPPONENT_TREY 94 CONTEST_OPPONENT_JAKOB,
#define CONTEST_OPPONENT_LANE 95 CONTEST_OPPONENT_TREY,
CONTEST_OPPONENT_LANE
};
// All contest opponents have a common set of AI flags (which contains all of the actually // All contest opponents have a common set of AI flags (which contains all of the actually
// useful AI scripts, as well as some dummys) and a random combination of 2-3 dummy flags. // useful AI scripts, as well as some dummys) and a random combination of 2-3 dummy flags.

View File

@ -55,7 +55,7 @@ static const u8 sText_OnlyPkmnForBattle[] = _("That's your only\nPOKéMON for ba
static const u8 sText_WaitingForYourFriend[] = _("{COLOR DARK_GRAY}{HIGHLIGHT WHITE}{SHADOW LIGHT_GRAY}Waiting for your friend\nto finish…"); static const u8 sText_WaitingForYourFriend[] = _("{COLOR DARK_GRAY}{HIGHLIGHT WHITE}{SHADOW LIGHT_GRAY}Waiting for your friend\nto finish…");
static const u8 sText_YourFriendWantsToTrade[] = _("Your friend wants\nto trade POKéMON."); static const u8 sText_YourFriendWantsToTrade[] = _("Your friend wants\nto trade POKéMON.");
static const struct OamData sTradeOamData_32x16 = static const struct OamData sOamData_MenuText =
{ {
.shape = SPRITE_SHAPE(32x16), .shape = SPRITE_SHAPE(32x16),
.size = SPRITE_SIZE(32x16), .size = SPRITE_SIZE(32x16),
@ -167,17 +167,17 @@ static const struct SpriteTemplate sSpriteTemplate_MenuText =
{ {
.tileTag = GFXTAG_MENU_TEXT, .tileTag = GFXTAG_MENU_TEXT,
.paletteTag = PALTAG_MENU_TEXT, .paletteTag = PALTAG_MENU_TEXT,
.oam = &sTradeOamData_32x16, .oam = &sOamData_MenuText,
.anims = sAnims_MenuText, .anims = sAnims_MenuText,
.images = NULL, .images = NULL,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy, .callback = SpriteCallbackDummy,
}; };
static const u16 sTradeScreenTextPalette[] = INCBIN_U16("graphics/trade/text.gbapal"); static const u16 sMenuText_Pal[] = INCBIN_U16("graphics/trade/text.gbapal");
static const struct SpritePalette sSpritePalette_TradeScreenText = static const struct SpritePalette sSpritePalette_MenuText =
{ {
.data = sTradeScreenTextPalette, .data = sMenuText_Pal,
.tag = PALTAG_MENU_TEXT .tag = PALTAG_MENU_TEXT
}; };
@ -193,7 +193,7 @@ static const struct SpritePalette sSpritePalette_TradeScreenText =
// 1st array is the current positions // 1st array is the current positions
// 2nd array is directions of input // 2nd array is directions of input
// 3rd array is the next positions to go to (unoccupied spaces are skipped over) // 3rd array is the next positions to go to (unoccupied spaces are skipped over)
static const u8 sTradeNextSelectedMonTable[(PARTY_SIZE * 2) + 1][4][PARTY_SIZE] = static const u8 sCursorMoveDestinations[(PARTY_SIZE * 2) + 1][4][PARTY_SIZE] =
{ {
{ {
{4, 2, 12, 12, 0, 0}, // UP {4, 2, 12, 12, 0, 0}, // UP
@ -275,86 +275,67 @@ static const u8 sTradeNextSelectedMonTable[(PARTY_SIZE * 2) + 1][4][PARTY_SIZE]
} }
}; };
#define COL0_X 1
#define COL1_X 8
#define COL2_X 16
#define COL3_X 23
#define ROW0_Y 5
#define ROW1_Y 10
#define ROW2_Y 15
#define ROW3_Y 18
static const u8 sTradeMonSpriteCoords[(PARTY_SIZE * 2) + 1][2] = static const u8 sTradeMonSpriteCoords[(PARTY_SIZE * 2) + 1][2] =
{ {
// Your party // Player's party
{1, 5 }, {COL0_X, ROW0_Y},
{8, 5 }, {COL1_X, ROW0_Y},
{1, 10}, {COL0_X, ROW1_Y},
{8, 10}, {COL1_X, ROW1_Y},
{1, 15}, {COL0_X, ROW2_Y},
{8, 15}, {COL1_X, ROW2_Y},
// Partners's party
// Friend's party {COL2_X, ROW0_Y},
{16, 5 }, {COL3_X, ROW0_Y},
{23, 5 }, {COL2_X, ROW1_Y},
{16, 10}, {COL3_X, ROW1_Y},
{23, 10}, {COL2_X, ROW2_Y},
{16, 15}, {COL3_X, ROW2_Y},
{23, 15}, // Cancel
{COL3_X, ROW3_Y}
{23, 18} // CANCEL
}; };
static const u8 sTradeMonLevelCoords[][2][2] = static const u8 sTradeMonLevelCoords[PARTY_SIZE * 2][2] = {
{ [TRADE_PLAYER] =
// Your party
{
{ 5, 4}, { 5, 4},
{12, 4}, {12, 4},
},
{
{ 5, 9}, { 5, 9},
{12, 9}, {12, 9},
},
{
{ 5, 14}, { 5, 14},
{12, 14}, {12, 14},
}, [TRADE_PARTNER * PARTY_SIZE] =
// Friend's party
{
{20, 4}, {20, 4},
{27, 4}, {27, 4},
},
{
{20, 9}, {20, 9},
{27, 9}, {27, 9},
},
{
{20, 14}, {20, 14},
{27, 14}, {27, 14},
},
}; };
static const u8 sTradeMonBoxCoords[][2][2] = static const u8 sTradeMonBoxCoords[PARTY_SIZE * 2][2] = {
{ [TRADE_PLAYER] =
// Your party
{
{ 1, 3}, { 1, 3},
{ 8, 3}, { 8, 3},
},
{
{ 1, 8}, { 1, 8},
{ 8, 8}, { 8, 8},
},
{
{ 1, 13}, { 1, 13},
{ 8, 13}, { 8, 13},
}, [TRADE_PARTNER * PARTY_SIZE] =
// Friend's party
{
{16, 3}, {16, 3},
{23, 3}, {23, 3},
},
{
{16, 8}, {16, 8},
{23, 8}, {23, 8},
},
{
{16, 13}, {16, 13},
{23, 13}, {23, 13},
},
}; };
static const u8 sUnusedCoords[][2] = static const u8 sUnusedCoords[][2] =
@ -379,14 +360,14 @@ static const u8 sUnusedCoords[][2] =
{23, 12} {23, 12}
}; };
static const u8 *const sTradeActionTexts[] = static const u8 *const sActionTexts[] =
{ {
[TRADE_TEXT_CANCEL] = sText_Cancel, [TEXT_CANCEL] = sText_Cancel,
[TRADE_TEXT_CHOOSE_MON] = sText_ChooseAPkmn, [TEXT_CHOOSE_MON] = sText_ChooseAPkmn,
[TRADE_TEXT_SUMMARY] = sText_Summary, [TEXT_SUMMARY] = sText_Summary,
[TRADE_TEXT_TRADE] = sText_Trade, [TEXT_TRADE] = sText_Trade,
[TRADE_TEXT_CANCEL_TRADE] = sText_CancelTrade, [TEXT_CANCEL_TRADE] = sText_CancelTrade,
[TRADE_TEXT_JP_QUIT] = sJPText_PressBButtonToQuit [TEXT_JP_QUIT] = sJPText_PressBButtonToQuit
}; };
static const struct MenuAction sSelectTradeMonActions[] = static const struct MenuAction sSelectTradeMonActions[] =
@ -395,17 +376,17 @@ static const struct MenuAction sSelectTradeMonActions[] =
{sText_Trade2, Task_DrawSelectionTrade} {sText_Trade2, Task_DrawSelectionTrade}
}; };
static const u8 *const sTradeMessages[] = static const u8 *const sMessages[] =
{ {
[TRADE_MSG_STANDBY] = sText_CommunicationStandby, [MSG_STANDBY] = sText_CommunicationStandby,
[TRADE_MSG_CANCELED] = sText_TheTradeHasBeenCanceled, [MSG_CANCELED] = sText_TheTradeHasBeenCanceled,
[TRADE_MSG_ONLY_MON1] = sText_OnlyPkmnForBattle, [MSG_ONLY_MON1] = sText_OnlyPkmnForBattle,
[TRADE_MSG_ONLY_MON2] = gText_OnlyPkmnForBattle, //identical text to above [MSG_ONLY_MON2] = gText_OnlyPkmnForBattle, //identical text to above
[TRADE_MSG_WAITING_FOR_FRIEND] = sText_WaitingForYourFriend, [MSG_WAITING_FOR_FRIEND] = sText_WaitingForYourFriend,
[TRADE_MSG_FRIEND_WANTS_TO_TRADE] = sText_YourFriendWantsToTrade, [MSG_FRIEND_WANTS_TO_TRADE] = sText_YourFriendWantsToTrade,
[TRADE_MSG_MON_CANT_BE_TRADED] = gText_PkmnCantBeTradedNow, [MSG_MON_CANT_BE_TRADED] = gText_PkmnCantBeTradedNow,
[TRADE_MSG_EGG_CANT_BE_TRADED] = gText_EggCantBeTradedNow, [MSG_EGG_CANT_BE_TRADED] = gText_EggCantBeTradedNow,
[TRADE_MSG_FRIENDS_MON_CANT_BE_TRADED] = gText_OtherTrainersPkmnCantBeTraded [MSG_FRIENDS_MON_CANT_BE_TRADED] = gText_OtherTrainersPkmnCantBeTraded
}; };
static const u8 sTradeTextColors[] = static const u8 sTradeTextColors[] =
@ -415,7 +396,7 @@ static const u8 sTradeTextColors[] =
TEXT_COLOR_DARK_GRAY //shadow color TEXT_COLOR_DARK_GRAY //shadow color
}; };
static const struct BgTemplate sTradeMenuBgTemplates[] = static const struct BgTemplate sBgTemplates[] =
{ {
{ {
.bg = 0, .bg = 0,
@ -455,7 +436,7 @@ static const struct BgTemplate sTradeMenuBgTemplates[] =
}, },
}; };
static const struct WindowTemplate sTradeMenuWindowTemplates[] = static const struct WindowTemplate sWindowTemplates[] =
{ {
{ {
.bg = 0, .bg = 0,
@ -633,8 +614,8 @@ static const struct WindowTemplate sTradeYesNoWindowTemplate =
.baseBlock = 582 .baseBlock = 582
}; };
static const u8 sJPText_Shedinja[] = _("ヌケニン"); static const u8 sText_ShedinjaJP[] = _("ヌケニン");
static const u8 sTradeMenuPartyMonBoxDimensions[3][2] = static const u8 sSelectedMonLevelGenderCoords[3][2] =
{ {
[TRADE_PLAYER] = {4, 3}, [TRADE_PLAYER] = {4, 3},
[TRADE_PARTNER] = {19, 3} [TRADE_PARTNER] = {19, 3}
@ -643,8 +624,8 @@ static const u8 sTradeMenuPartyMonBoxDimensions[3][2] =
static const u16 sPokeball_Pal[] = INCBIN_U16("graphics/trade/pokeball.gbapal"); static const u16 sPokeball_Pal[] = INCBIN_U16("graphics/trade/pokeball.gbapal");
static const u8 sPokeball_Gfx[] = INCBIN_U8("graphics/trade/pokeball.4bpp"); static const u8 sPokeball_Gfx[] = INCBIN_U8("graphics/trade/pokeball.4bpp");
static const u8 sPokeballSymbol_Gfx[] = INCBIN_U8("graphics/trade/pokeball_symbol.8bpp"); // unused static const u8 sPokeballSymbol_Gfx[] = INCBIN_U8("graphics/trade/pokeball_symbol.8bpp"); // unused
static const u16 sCrossingHighlightCable_Tilemap[] = INCBIN_U16("graphics/trade/crossing_highlight_cable.bin"); static const u16 sCableCloseup_Map[] = INCBIN_U16("graphics/trade/crossing_highlight_cable.bin");
static const u16 sTradeTilemap_PokeBallSymbol[] = INCBIN_U16("graphics/trade/pokeball_symbol_map.bin"); // unused? static const u16 sPokeballSymbol_Map[] = INCBIN_U16("graphics/trade/pokeball_symbol_map.bin"); // unused?
static const u16 sUnusedPal1[] = INCBIN_U16("graphics/trade/unused1.gbapal"); static const u16 sUnusedPal1[] = INCBIN_U16("graphics/trade/unused1.gbapal");
static const u16 sGba_Pal[] = INCBIN_U16("graphics/trade/gba.gbapal"); static const u16 sGba_Pal[] = INCBIN_U16("graphics/trade/gba.gbapal");
static const u16 sUnusedPal2[] = INCBIN_U16("graphics/trade/unused2.gbapal"); static const u16 sUnusedPal2[] = INCBIN_U16("graphics/trade/unused2.gbapal");
@ -657,11 +638,11 @@ static const u8 sGbaScreen_Gfx[] = INCBIN_U8("graphics/trade/gba_screen.4bpp");
const u16 gTradePlatform_Tilemap[] = INCBIN_U16("graphics/trade/platform.bin"); const u16 gTradePlatform_Tilemap[] = INCBIN_U16("graphics/trade/platform.bin");
static const u8 sGbaAffine_Gfx[] = INCBIN_U8("graphics/trade/gba_affine.8bpp"); // Only the gfx for when the GBA is zooming in/out static const u8 sGbaAffine_Gfx[] = INCBIN_U8("graphics/trade/gba_affine.8bpp"); // Only the gfx for when the GBA is zooming in/out
static const u8 sEmptyGfx[64] = {}; static const u8 sEmptyGfx[64] = {};
static const u8 sGbaCable_AffineTilemap[] = INCBIN_U8("graphics/trade/gba_affine_map_cable.bin"); static const u8 sGbaAffineMapCable[] = INCBIN_U8("graphics/trade/gba_affine_map_cable.bin");
static const u8 sGbaWireless_AffineTilemap[] = INCBIN_U8("graphics/trade/gba_affine_map_wireless.bin"); static const u8 sGbaAffineMapWireless[] = INCBIN_U8("graphics/trade/gba_affine_map_wireless.bin");
static const u16 sGbaWireless_Tilemap[] = INCBIN_U16("graphics/trade/gba_map_wireless.bin"); static const u16 sGbaMapWireless[] = INCBIN_U16("graphics/trade/gba_map_wireless.bin");
static const u16 sGbaCable_Tilemap[] = INCBIN_U16("graphics/trade/gba_map_cable.bin"); static const u16 sGbaMapCable[] = INCBIN_U16("graphics/trade/gba_map_cable.bin");
static const u32 sCrossingHighlightWireless_Tilemap[] = INCBIN_U32("graphics/trade/crossing_highlight_wireless.bin.lz"); static const u32 sWirelessCloseup_Map[] = INCBIN_U32("graphics/trade/crossing_highlight_wireless.bin.lz");
static const u16 sWirelessSignalSend_Pal[] = INCBIN_U16("graphics/trade/wireless_signal_send.gbapal"); static const u16 sWirelessSignalSend_Pal[] = INCBIN_U16("graphics/trade/wireless_signal_send.gbapal");
static const u16 sWirelessSignalRecv_Pal[] = INCBIN_U16("graphics/trade/wireless_signal_receive.gbapal"); static const u16 sWirelessSignalRecv_Pal[] = INCBIN_U16("graphics/trade/wireless_signal_receive.gbapal");
static const u16 sWirelessSignalNone_Pal[] = INCBIN_U16("graphics/trade/wireless_signal_none.gbapal"); static const u16 sWirelessSignalNone_Pal[] = INCBIN_U16("graphics/trade/wireless_signal_none.gbapal");
@ -749,7 +730,7 @@ static const union AffineAnimCmd *const sAffineAnims_Pokeball[] =
static const struct SpriteSheet sPokeBallSpriteSheet = static const struct SpriteSheet sPokeBallSpriteSheet =
{ {
.data = sPokeball_Gfx, .data = sPokeball_Gfx,
.size = 0x600, .size = sizeof(sPokeball_Gfx),
.tag = GFXTAG_POKEBALL .tag = GFXTAG_POKEBALL
}; };
@ -805,7 +786,7 @@ static const union AffineAnimCmd *const sAffineAnims_LinkMonGlow[] =
static const struct SpriteSheet sSpriteSheet_LinkMonGlow = static const struct SpriteSheet sSpriteSheet_LinkMonGlow =
{ {
.data = sLinkMonGlow_Gfx, .data = sLinkMonGlow_Gfx,
.size = 0x200, .size = sizeof(sLinkMonGlow_Gfx),
.tag = GFXTAG_LINK_MON_GLOW .tag = GFXTAG_LINK_MON_GLOW
}; };
@ -962,7 +943,7 @@ static const union AnimCmd *const sAnims_GbaScreen_Short[] =
static const struct SpriteSheet sSpriteSheet_GbaScreen = static const struct SpriteSheet sSpriteSheet_GbaScreen =
{ {
.data = sGbaScreen_Gfx, .data = sGbaScreen_Gfx,
.size = 0x1000, .size = sizeof(sGbaScreen_Gfx),
.tag = GFXTAG_GBA_SCREEN .tag = GFXTAG_GBA_SCREEN
}; };
@ -1185,7 +1166,7 @@ static const s8 sTradeBallVerticalVelocityTable[] =
0, 0, 0, 1, 0, 1, 1, 2, 3 0, 0, 0, 1, 0, 1, 1, 2, 3
}; };
static const u8 sWirelessSignalTiming[][2] = static const u8 sWirelessSignalAnimParams[][2] =
{ {
{ 0, 1}, { 0, 1},
{ 1, 1}, { 1, 1},

View File

@ -3831,26 +3831,38 @@ static void SpriteCB_DeoxysRockFragment(struct Sprite *sprite)
DestroySprite(sprite); DestroySprite(sprite);
} }
// Task data for Task_MoveDeoxysRock
#define tState data[0]
#define tSpriteId data[1]
#define tTargetX data[2]
#define tTargetY data[3]
#define tCurX data[4]
#define tCurY data[5]
#define tVelocityX data[6]
#define tVelocityY data[7]
#define tMoveSteps data[8]
#define tObjEventId data[9]
bool8 FldEff_MoveDeoxysRock(struct Sprite *sprite) bool8 FldEff_MoveDeoxysRock(struct Sprite *sprite)
{ {
u8 objectEventIdBuffer; u8 objectEventId;
if (!TryGetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2], &objectEventIdBuffer)) if (!TryGetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2], &objectEventId))
{ {
struct ObjectEvent *object; struct ObjectEvent *object;
int xPos, yPos; int xPos, yPos;
u8 taskId; u8 taskId;
object = &gObjectEvents[objectEventIdBuffer]; object = &gObjectEvents[objectEventId];
xPos = object->currentCoords.x - MAP_OFFSET; xPos = object->currentCoords.x - MAP_OFFSET;
yPos = object->currentCoords.y - MAP_OFFSET; yPos = object->currentCoords.y - MAP_OFFSET;
xPos = (gFieldEffectArguments[3] - xPos) * 16; xPos = (gFieldEffectArguments[3] - xPos) * 16;
yPos = (gFieldEffectArguments[4] - yPos) * 16; yPos = (gFieldEffectArguments[4] - yPos) * 16;
ShiftObjectEventCoords(object, gFieldEffectArguments[3] + MAP_OFFSET, gFieldEffectArguments[4] + MAP_OFFSET); ShiftObjectEventCoords(object, gFieldEffectArguments[3] + MAP_OFFSET, gFieldEffectArguments[4] + MAP_OFFSET);
taskId = CreateTask(Task_MoveDeoxysRock, 80); taskId = CreateTask(Task_MoveDeoxysRock, 80);
gTasks[taskId].data[1] = object->spriteId; gTasks[taskId].tSpriteId = object->spriteId;
gTasks[taskId].data[2] = gSprites[object->spriteId].x + xPos; gTasks[taskId].tTargetX = gSprites[object->spriteId].x + xPos;
gTasks[taskId].data[3] = gSprites[object->spriteId].y + yPos; gTasks[taskId].tTargetY = gSprites[object->spriteId].y + yPos;
gTasks[taskId].data[8] = gFieldEffectArguments[5]; gTasks[taskId].tMoveSteps = gFieldEffectArguments[5];
gTasks[taskId].data[9] = objectEventIdBuffer; gTasks[taskId].tObjEventId = objectEventId;
} }
return FALSE; return FALSE;
} }
@ -3858,29 +3870,30 @@ bool8 FldEff_MoveDeoxysRock(struct Sprite *sprite)
static void Task_MoveDeoxysRock(u8 taskId) static void Task_MoveDeoxysRock(u8 taskId)
{ {
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
struct Sprite *sprite = &gSprites[data[1]]; struct Sprite *sprite = &gSprites[tSpriteId];
switch (data[0]) switch (tState)
{ {
case 0: case 0:
data[4] = sprite->x << 4; tCurX = sprite->x << 4;
data[5] = sprite->y << 4; tCurY = sprite->y << 4;
data[6] = SAFE_DIV(data[2] * 16 - data[4], data[8]); tVelocityX = SAFE_DIV(tTargetX * 16 - tCurX, tMoveSteps);
data[7] = SAFE_DIV(data[3] * 16 - data[5], data[8]); tVelocityY = SAFE_DIV(tTargetY * 16 - tCurY, tMoveSteps);
data[0]++; tState++;
// fallthrough
case 1: case 1:
if (data[8] != 0) if (tMoveSteps != 0)
{ {
data[8]--; tMoveSteps--;
data[4] += data[6]; tCurX += tVelocityX;
data[5] += data[7]; tCurY += tVelocityY;
sprite->x = data[4] >> 4; sprite->x = tCurX >> 4;
sprite->y = data[5] >> 4; sprite->y = tCurY >> 4;
} }
else else
{ {
struct ObjectEvent *object = &gObjectEvents[data[9]]; struct ObjectEvent *object = &gObjectEvents[tObjEventId];
sprite->x = data[2]; sprite->x = tTargetX;
sprite->y = data[3]; sprite->y = tTargetY;
ShiftStillObjectEventCoords(object); ShiftStillObjectEventCoords(object);
object->triggerGroundEffectsOnStop = TRUE; object->triggerGroundEffectsOnStop = TRUE;
FieldEffectActiveListRemove(FLDEFF_MOVE_DEOXYS_ROCK); FieldEffectActiveListRemove(FLDEFF_MOVE_DEOXYS_ROCK);
@ -3890,3 +3903,13 @@ static void Task_MoveDeoxysRock(u8 taskId)
} }
} }
#undef tState
#undef tSpriteId
#undef tTargetX
#undef tTargetY
#undef tCurX
#undef tCurY
#undef tVelocityX
#undef tVelocityY
#undef tMoveSteps
#undef tObjEventId

View File

@ -46,6 +46,7 @@
#include "wallclock.h" #include "wallclock.h"
#include "window.h" #include "window.h"
#include "constants/battle_frontier.h" #include "constants/battle_frontier.h"
#include "constants/battle_pyramid.h"
#include "constants/battle_tower.h" #include "constants/battle_tower.h"
#include "constants/decorations.h" #include "constants/decorations.h"
#include "constants/event_objects.h" #include "constants/event_objects.h"
@ -67,6 +68,15 @@
#include "palette.h" #include "palette.h"
#include "battle_util.h" #include "battle_util.h"
#define TAG_ITEM_ICON 5500
#define GFXTAG_MULTICHOICE_SCROLL_ARROWS 2000
#define PALTAG_MULTICHOICE_SCROLL_ARROWS 100
#define ELEVATOR_WINDOW_WIDTH 3
#define ELEVATOR_WINDOW_HEIGHT 3
#define ELEVATOR_LIGHT_STAGES 3
EWRAM_DATA bool8 gBikeCyclingChallenge = FALSE; EWRAM_DATA bool8 gBikeCyclingChallenge = FALSE;
EWRAM_DATA u8 gBikeCollisions = 0; EWRAM_DATA u8 gBikeCollisions = 0;
static EWRAM_DATA u32 sBikeCyclingTimer = 0; static EWRAM_DATA u32 sBikeCyclingTimer = 0;
@ -95,8 +105,8 @@ static void LoadLinkPartnerObjectEventSpritePalette(u8, u8, u8);
static void Task_PetalburgGymSlideOpenRoomDoors(u8); static void Task_PetalburgGymSlideOpenRoomDoors(u8);
static void PetalburgGymSetDoorMetatiles(u8, u16); static void PetalburgGymSetDoorMetatiles(u8, u16);
static void Task_PCTurnOnEffect(u8); static void Task_PCTurnOnEffect(u8);
static void PCTurnOnEffect_0(struct Task *); static void PCTurnOnEffect(struct Task *);
static void PCTurnOnEffect_1(s16, s8, s8); static void PCTurnOnEffect_SetMetatile(s16, s8, s8);
static void PCTurnOffEffect(void); static void PCTurnOffEffect(void);
static void Task_LotteryCornerComputerEffect(u8); static void Task_LotteryCornerComputerEffect(u8);
static void LotteryCornerComputerEffect(struct Task *); static void LotteryCornerComputerEffect(struct Task *);
@ -969,34 +979,44 @@ static bool8 IsPlayerInFrontOfPC(void)
|| tileInFront == METATILE_Building_PC_Off); || tileInFront == METATILE_Building_PC_Off);
} }
// Task data for Task_PCTurnOnEffect and Task_LotteryCornerComputerEffect
#define tPaused data[0] // Never set
#define tTaskId data[1]
#define tFlickerCount data[2]
#define tTimer data[3]
#define tIsScreenOn data[4]
// For this special, gSpecialVar_0x8004 is expected to be some PC_LOCATION_* value.
void DoPCTurnOnEffect(void) void DoPCTurnOnEffect(void)
{ {
if (FuncIsActiveTask(Task_PCTurnOnEffect) != TRUE && IsPlayerInFrontOfPC() == TRUE) if (FuncIsActiveTask(Task_PCTurnOnEffect) != TRUE && IsPlayerInFrontOfPC() == TRUE)
{ {
u8 taskId = CreateTask(Task_PCTurnOnEffect, 8); u8 taskId = CreateTask(Task_PCTurnOnEffect, 8);
gTasks[taskId].data[0] = 0; gTasks[taskId].tPaused = FALSE;
gTasks[taskId].data[1] = taskId; gTasks[taskId].tTaskId = taskId;
gTasks[taskId].data[2] = 0; gTasks[taskId].tFlickerCount = 0;
gTasks[taskId].data[3] = 0; gTasks[taskId].tTimer = 0;
gTasks[taskId].data[4] = 0; gTasks[taskId].tIsScreenOn = FALSE;
} }
} }
static void Task_PCTurnOnEffect(u8 taskId) static void Task_PCTurnOnEffect(u8 taskId)
{ {
struct Task *task = &gTasks[taskId]; struct Task *task = &gTasks[taskId];
if (task->data[0] == 0) if (!task->tPaused)
PCTurnOnEffect_0(task); PCTurnOnEffect(task);
} }
static void PCTurnOnEffect_0(struct Task *task) static void PCTurnOnEffect(struct Task *task)
{ {
u8 playerDirection; u8 playerDirection;
s8 dx = 0; s8 dx = 0;
s8 dy = 0; s8 dy = 0;
if (task->data[3] == 6) if (task->tTimer == 6)
{ {
task->data[3] = 0; task->tTimer = 0;
// Get where the PC should be, depending on where the player is looking.
playerDirection = GetPlayerFacingDirection(); playerDirection = GetPlayerFacingDirection();
switch (playerDirection) switch (playerDirection)
{ {
@ -1013,39 +1033,47 @@ static void PCTurnOnEffect_0(struct Task *task)
dy = -1; dy = -1;
break; break;
} }
PCTurnOnEffect_1(task->data[4], dx, dy);
// Update map
PCTurnOnEffect_SetMetatile(task->tIsScreenOn, dx, dy);
DrawWholeMapView(); DrawWholeMapView();
task->data[4] ^= 1;
if ((++task->data[2]) == 5) // Screen flickers 5 times. Odd number and starting with the
DestroyTask(task->data[1]); // screen off means the animation ends with the screen on.
task->tIsScreenOn ^= 1;
if (++task->tFlickerCount == 5)
DestroyTask(task->tTaskId);
} }
task->data[3]++; task->tTimer++;
} }
static void PCTurnOnEffect_1(s16 isPcTurnedOn, s8 dx, s8 dy) static void PCTurnOnEffect_SetMetatile(s16 isScreenOn, s8 dx, s8 dy)
{ {
u16 tileId = 0; u16 metatileId = 0;
if (isPcTurnedOn) if (isScreenOn)
{ {
// Screen is on, set it off
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER) if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
tileId = METATILE_Building_PC_Off; metatileId = METATILE_Building_PC_Off;
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE) else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
tileId = METATILE_BrendansMaysHouse_BrendanPC_Off; metatileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE) else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
tileId = METATILE_BrendansMaysHouse_MayPC_Off; metatileId = METATILE_BrendansMaysHouse_MayPC_Off;
} }
else else
{ {
// Screen is off, set it on
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER) if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
tileId = METATILE_Building_PC_On; metatileId = METATILE_Building_PC_On;
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE) else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
tileId = METATILE_BrendansMaysHouse_BrendanPC_On; metatileId = METATILE_BrendansMaysHouse_BrendanPC_On;
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE) else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
tileId = METATILE_BrendansMaysHouse_MayPC_On; metatileId = METATILE_BrendansMaysHouse_MayPC_On;
} }
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, metatileId | MAPGRID_COLLISION_MASK);
} }
// For this special, gSpecialVar_0x8004 is expected to be some PC_LOCATION_* value.
void DoPCTurnOffEffect(void) void DoPCTurnOffEffect(void)
{ {
PCTurnOffEffect(); PCTurnOffEffect();
@ -1055,7 +1083,9 @@ static void PCTurnOffEffect(void)
{ {
s8 dx = 0; s8 dx = 0;
s8 dy = 0; s8 dy = 0;
u16 tileId = 0; u16 metatileId = 0;
// Get where the PC should be, depending on where the player is looking.
u8 playerDirection = GetPlayerFacingDirection(); u8 playerDirection = GetPlayerFacingDirection();
if (IsPlayerInFrontOfPC() == FALSE) if (IsPlayerInFrontOfPC() == FALSE)
@ -1075,13 +1105,15 @@ static void PCTurnOffEffect(void)
dy = -1; dy = -1;
break; break;
} }
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER) if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
tileId = METATILE_Building_PC_Off; metatileId = METATILE_Building_PC_Off;
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE) else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
tileId = METATILE_BrendansMaysHouse_BrendanPC_Off; metatileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE) else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
tileId = METATILE_BrendansMaysHouse_MayPC_Off; metatileId = METATILE_BrendansMaysHouse_MayPC_Off;
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, metatileId | MAPGRID_COLLISION_MASK);
DrawWholeMapView(); DrawWholeMapView();
} }
@ -1090,42 +1122,47 @@ void DoLotteryCornerComputerEffect(void)
if (FuncIsActiveTask(Task_LotteryCornerComputerEffect) != TRUE) if (FuncIsActiveTask(Task_LotteryCornerComputerEffect) != TRUE)
{ {
u8 taskId = CreateTask(Task_LotteryCornerComputerEffect, 8); u8 taskId = CreateTask(Task_LotteryCornerComputerEffect, 8);
gTasks[taskId].data[0] = 0; gTasks[taskId].tPaused = FALSE;
gTasks[taskId].data[1] = taskId; gTasks[taskId].tTaskId = taskId;
gTasks[taskId].data[2] = 0; gTasks[taskId].tFlickerCount = 0;
gTasks[taskId].data[3] = 0; gTasks[taskId].tTimer = 0;
gTasks[taskId].data[4] = 0; gTasks[taskId].tIsScreenOn = FALSE;
} }
} }
static void Task_LotteryCornerComputerEffect(u8 taskId) static void Task_LotteryCornerComputerEffect(u8 taskId)
{ {
struct Task *task = &gTasks[taskId]; struct Task *task = &gTasks[taskId];
if (task->data[0] == 0) if (!task->tPaused)
LotteryCornerComputerEffect(task); LotteryCornerComputerEffect(task);
} }
static void LotteryCornerComputerEffect(struct Task *task) static void LotteryCornerComputerEffect(struct Task *task)
{ {
if (task->data[3] == 6) if (task->tTimer == 6)
{ {
task->data[3] = 0; task->tTimer = 0;
if (task->data[4] != 0) if (task->tIsScreenOn)
{ {
// Screen is on, set it off
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Normal | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Normal | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Normal | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Normal | MAPGRID_COLLISION_MASK);
} }
else else
{ {
// Screen is off, set it on
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Flash | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Flash | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Flash | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Flash | MAPGRID_COLLISION_MASK);
} }
DrawWholeMapView(); DrawWholeMapView();
task->data[4] ^= 1;
if ((++task->data[2]) == 5) // Screen flickers 5 times. Odd number and starting with the
DestroyTask(task->data[1]); // screen off means the animation ends with the screen on.
task->tIsScreenOn ^= 1;
if (++task->tFlickerCount == 5)
DestroyTask(task->tTaskId);
} }
task->data[3]++; task->tTimer++;
} }
void EndLotteryCornerComputerEffect(void) void EndLotteryCornerComputerEffect(void)
@ -1135,6 +1172,12 @@ void EndLotteryCornerComputerEffect(void)
DrawWholeMapView(); DrawWholeMapView();
} }
#undef tPaused
#undef tTaskId
#undef tFlickerCount
#undef tTimer
#undef tIsScreenOn
void SetTrickHouseNuggetFlag(void) void SetTrickHouseNuggetFlag(void)
{ {
u16 *specVar = &gSpecialVar_0x8004; u16 *specVar = &gSpecialVar_0x8004;
@ -1219,7 +1262,7 @@ void SpawnCameraObject(void)
OBJ_EVENT_ID_CAMERA, OBJ_EVENT_ID_CAMERA,
gSaveBlock1Ptr->pos.x + MAP_OFFSET, gSaveBlock1Ptr->pos.x + MAP_OFFSET,
gSaveBlock1Ptr->pos.y + MAP_OFFSET, gSaveBlock1Ptr->pos.y + MAP_OFFSET,
3); 3); // elevation
gObjectEvents[obj].invisible = TRUE; gObjectEvents[obj].invisible = TRUE;
CameraObjectSetFollowedSpriteId(gObjectEvents[obj].spriteId); CameraObjectSetFollowedSpriteId(gObjectEvents[obj].spriteId);
} }
@ -1384,7 +1427,7 @@ void SetShoalItemFlag(u16 unused)
FlagSet(FLAG_SYS_SHOAL_ITEM); FlagSet(FLAG_SYS_SHOAL_ITEM);
} }
void PutZigzagoonInPlayerParty(void) void LoadWallyZigzagoon(void)
{ {
u16 monData; u16 monData;
CreateMon(&gPlayerParty[0], SPECIES_ZIGZAGOON, 7, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0); CreateMon(&gPlayerParty[0], SPECIES_ZIGZAGOON, 7, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0);
@ -1424,20 +1467,21 @@ bool8 IsPokerusInParty(void)
return TRUE; return TRUE;
} }
#define horizontalPan data[0] // Task data for Task_ShakeCamera
#define delayCounter data[1] #define tHorizontalPan data[0]
#define numShakes data[2] #define tDelayCounter data[1]
#define delay data[3] #define tNumShakes data[2]
#define verticalPan data[4] #define tDelay data[3]
#define tVerticalPan data[4]
void ShakeCamera(void) void ShakeCamera(void)
{ {
u8 taskId = CreateTask(Task_ShakeCamera, 9); u8 taskId = CreateTask(Task_ShakeCamera, 9);
gTasks[taskId].horizontalPan = gSpecialVar_0x8005; gTasks[taskId].tHorizontalPan = gSpecialVar_0x8005;
gTasks[taskId].delayCounter = 0; gTasks[taskId].tDelayCounter = 0;
gTasks[taskId].numShakes = gSpecialVar_0x8006; gTasks[taskId].tNumShakes = gSpecialVar_0x8006;
gTasks[taskId].delay = gSpecialVar_0x8007; gTasks[taskId].tDelay = gSpecialVar_0x8007;
gTasks[taskId].verticalPan = gSpecialVar_0x8004; gTasks[taskId].tVerticalPan = gSpecialVar_0x8004;
SetCameraPanningCallback(NULL); SetCameraPanningCallback(NULL);
PlaySE(SE_M_STRENGTH); PlaySE(SE_M_STRENGTH);
} }
@ -1446,15 +1490,15 @@ static void Task_ShakeCamera(u8 taskId)
{ {
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
delayCounter++; tDelayCounter++;
if (delayCounter % delay == 0) if (tDelayCounter % tDelay == 0)
{ {
delayCounter = 0; tDelayCounter = 0;
numShakes--; tNumShakes--;
horizontalPan = -horizontalPan; tHorizontalPan = -tHorizontalPan;
verticalPan = -verticalPan; tVerticalPan = -tVerticalPan;
SetCameraPanning(horizontalPan, verticalPan); SetCameraPanning(tHorizontalPan, tVerticalPan);
if (numShakes == 0) if (tNumShakes == 0)
{ {
StopCameraShake(taskId); StopCameraShake(taskId);
InstallCameraPanAheadCallback(); InstallCameraPanAheadCallback();
@ -1468,11 +1512,11 @@ static void StopCameraShake(u8 taskId)
ScriptContext_Enable(); ScriptContext_Enable();
} }
#undef horizontalPan #undef tHorizontalPan
#undef delayCounter #undef tDelayCounter
#undef numShakes #undef tNumShakes
#undef delay #undef tDelay
#undef verticalPan #undef tVerticalPan
bool8 FoundBlackGlasses(void) bool8 FoundBlackGlasses(void)
{ {
@ -1497,7 +1541,8 @@ u8 GetLeadMonIndex(void)
u8 partyCount = CalculatePlayerPartyCount(); u8 partyCount = CalculatePlayerPartyCount();
for (i = 0; i < partyCount; i++) for (i = 0; i < partyCount; i++)
{ {
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_EGG && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != 0) if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_EGG
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_NONE)
return i; return i;
} }
return 0; return 0;
@ -1637,7 +1682,7 @@ void OffsetCameraForBattle(void)
SetCameraPanning(8, 0); SetCameraPanning(8, 0);
} }
const struct WindowTemplate gElevatorFloor_WindowTemplate = static const struct WindowTemplate sWindowTemplate_ElevatorFloor =
{ {
.bg = 0, .bg = 0,
.tilemapLeft = 21, .tilemapLeft = 21,
@ -1648,7 +1693,7 @@ const struct WindowTemplate gElevatorFloor_WindowTemplate =
.baseBlock = 8, .baseBlock = 8,
}; };
const u8 *const gDeptStoreFloorNames[] = static const u8 *const sDeptStoreFloorNames[] =
{ {
[DEPT_STORE_FLOORNUM_B4F] = gText_B4F, [DEPT_STORE_FLOORNUM_B4F] = gText_B4F,
[DEPT_STORE_FLOORNUM_B3F] = gText_B3F, [DEPT_STORE_FLOORNUM_B3F] = gText_B3F,
@ -1668,7 +1713,7 @@ const u8 *const gDeptStoreFloorNames[] =
[DEPT_STORE_FLOORNUM_ROOFTOP] = gText_Rooftop [DEPT_STORE_FLOORNUM_ROOFTOP] = gText_Rooftop
}; };
static const u16 sElevatorWindowTiles_Ascending[][3] = static const u16 sElevatorWindowTiles_Ascending[ELEVATOR_WINDOW_HEIGHT][ELEVATOR_LIGHT_STAGES] =
{ {
{ {
METATILE_BattleFrontier_Elevator_Top0, METATILE_BattleFrontier_Elevator_Top0,
@ -1687,7 +1732,7 @@ static const u16 sElevatorWindowTiles_Ascending[][3] =
}, },
}; };
static const u16 sElevatorWindowTiles_Descending[][3] = static const u16 sElevatorWindowTiles_Descending[ELEVATOR_WINDOW_HEIGHT][ELEVATOR_LIGHT_STAGES] =
{ {
{ {
METATILE_BattleFrontier_Elevator_Top0, METATILE_BattleFrontier_Elevator_Top0,
@ -1771,53 +1816,66 @@ u16 GetDeptStoreDefaultFloorChoice(void)
return sLilycoveDeptStore_DefaultFloorChoice; return sLilycoveDeptStore_DefaultFloorChoice;
} }
// Task data for Task_MoveElevator
#define tTimer data[1]
#define tMoveCounter data[2]
#define tVerticalPan data[4]
#define tTotalMoves data[5]
#define tDescending data[6]
// The maximum considered difference between floors.
// Elevator trips with a larger difference are treated the same
// (i.e. traveling 9 floors and 200 floors would take the same amount of time).
#define MAX_ELEVATOR_TRIP 9
// gSpecialVar_0x8005 here is expected to be the current floor number, and
// gSpecialVar_0x8006 is expected to be the destination floor number.
void MoveElevator(void) void MoveElevator(void)
{ {
static const u8 sElevatorTripLength[] = { 8, 16, 24, 32, 38, 46, 52, 56, 57 }; static const u8 sElevatorTripLength[MAX_ELEVATOR_TRIP] = { 8, 16, 24, 32, 38, 46, 52, 56, 57 };
s16 *data = gTasks[CreateTask(Task_MoveElevator, 9)].data; s16 *data = gTasks[CreateTask(Task_MoveElevator, 9)].data;
u16 floorDelta; u16 floorDelta;
data[1] = 0; tTimer = 0;
data[2] = 0; tMoveCounter = 0;
data[4] = 1; tVerticalPan = 1;
// descending
if (gSpecialVar_0x8005 > gSpecialVar_0x8006) if (gSpecialVar_0x8005 > gSpecialVar_0x8006)
{ {
floorDelta = gSpecialVar_0x8005 - gSpecialVar_0x8006; floorDelta = gSpecialVar_0x8005 - gSpecialVar_0x8006;
data[6] = TRUE; tDescending = TRUE;
} }
else else
{ {
floorDelta = gSpecialVar_0x8006 - gSpecialVar_0x8005; floorDelta = gSpecialVar_0x8006 - gSpecialVar_0x8005;
data[6] = FALSE; tDescending = FALSE;
} }
if (floorDelta > 8) if (floorDelta > MAX_ELEVATOR_TRIP - 1)
floorDelta = 8; floorDelta = MAX_ELEVATOR_TRIP - 1;
data[5] = sElevatorTripLength[floorDelta]; tTotalMoves = sElevatorTripLength[floorDelta];
SetCameraPanningCallback(NULL); SetCameraPanningCallback(NULL);
MoveElevatorWindowLights(floorDelta, data[6]); MoveElevatorWindowLights(floorDelta, tDescending);
PlaySE(SE_ELEVATOR); PlaySE(SE_ELEVATOR);
} }
static void Task_MoveElevator(u8 taskId) static void Task_MoveElevator(u8 taskId)
{ {
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
data[1]++; tTimer++;
if (data[1] % 3 == 0) if (tTimer % 3 == 0)
{ {
data[1] = 0; tTimer = 0;
data[2]++; tMoveCounter++;
data[4] = -data[4]; tVerticalPan = -tVerticalPan;
SetCameraPanning(0, data[4]); SetCameraPanning(0, tVerticalPan);
// arrived at floor if (tMoveCounter == tTotalMoves)
if (data[2] == data[5])
{ {
// Arrived at floor
PlaySE(SE_DING_DONG); PlaySE(SE_DING_DONG);
DestroyTask(taskId); DestroyTask(taskId);
ScriptContext_Enable(); ScriptContext_Enable();
@ -1826,18 +1884,24 @@ static void Task_MoveElevator(u8 taskId)
} }
} }
#undef tTimer
#undef tMoveCounter
#undef tVerticalPan
#undef tTotalMoves
#undef tDescending
void ShowDeptStoreElevatorFloorSelect(void) void ShowDeptStoreElevatorFloorSelect(void)
{ {
int xPos; int xPos;
sTutorMoveAndElevatorWindowId = AddWindow(&gElevatorFloor_WindowTemplate); sTutorMoveAndElevatorWindowId = AddWindow(&sWindowTemplate_ElevatorFloor);
SetStandardWindowBorderStyle(sTutorMoveAndElevatorWindowId, FALSE); SetStandardWindowBorderStyle(sTutorMoveAndElevatorWindowId, FALSE);
xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gText_ElevatorNowOn, 64); xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gText_ElevatorNowOn, 64);
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, gText_ElevatorNowOn, xPos, 1, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, gText_ElevatorNowOn, xPos, 1, TEXT_SKIP_DRAW, NULL);
xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gDeptStoreFloorNames[gSpecialVar_0x8005], 64); xPos = GetStringCenterAlignXOffset(FONT_NORMAL, sDeptStoreFloorNames[gSpecialVar_0x8005], 64);
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, gDeptStoreFloorNames[gSpecialVar_0x8005], xPos, 17, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, sDeptStoreFloorNames[gSpecialVar_0x8005], xPos, 17, TEXT_SKIP_DRAW, NULL);
PutWindowTilemap(sTutorMoveAndElevatorWindowId); PutWindowTilemap(sTutorMoveAndElevatorWindowId);
CopyWindowToVram(sTutorMoveAndElevatorWindowId, COPYWIN_FULL); CopyWindowToVram(sTutorMoveAndElevatorWindowId, COPYWIN_FULL);
@ -1849,17 +1913,23 @@ void CloseDeptStoreElevatorWindow(void)
RemoveWindow(sTutorMoveAndElevatorWindowId); RemoveWindow(sTutorMoveAndElevatorWindowId);
} }
// Task data for Task_MoveElevatorWindowLights
#define tMoveCounter data[0]
#define tTimer data[1]
#define tDescending data[2]
#define tTotalMoves data[3]
static void MoveElevatorWindowLights(u16 floorDelta, bool8 descending) static void MoveElevatorWindowLights(u16 floorDelta, bool8 descending)
{ {
static const u8 sElevatorLightCycles[] = { 3, 6, 9, 12, 15, 18, 21, 24, 27 }; static const u8 sElevatorLightCycles[MAX_ELEVATOR_TRIP] = { 3, 6, 9, 12, 15, 18, 21, 24, 27 };
if (FuncIsActiveTask(Task_MoveElevatorWindowLights) != TRUE) if (FuncIsActiveTask(Task_MoveElevatorWindowLights) != TRUE)
{ {
u8 taskId = CreateTask(Task_MoveElevatorWindowLights, 8); u8 taskId = CreateTask(Task_MoveElevatorWindowLights, 8);
gTasks[taskId].data[0] = 0; gTasks[taskId].tMoveCounter = 0;
gTasks[taskId].data[1] = 0; gTasks[taskId].tTimer = 0;
gTasks[taskId].data[2] = descending; gTasks[taskId].tDescending = descending;
gTasks[taskId].data[3] = sElevatorLightCycles[floorDelta]; gTasks[taskId].tTotalMoves = sElevatorLightCycles[floorDelta];
} }
} }
@ -1868,36 +1938,41 @@ static void Task_MoveElevatorWindowLights(u8 taskId)
u8 x, y; u8 x, y;
s16 *data = gTasks[taskId].data; s16 *data = gTasks[taskId].data;
if (data[1] == 6) if (tTimer == 6)
{ {
data[0]++; tMoveCounter++;
// ascending if (!tDescending)
if (data[2] == FALSE)
{ {
for (y = 0; y < 3; y++) // Ascending
for (y = 0; y < ELEVATOR_WINDOW_HEIGHT; y++)
{ {
for (x = 0; x < 3; x++) for (x = 0; x < ELEVATOR_WINDOW_WIDTH; x++)
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][data[0] % 3] | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][tMoveCounter % ELEVATOR_LIGHT_STAGES] | MAPGRID_COLLISION_MASK);
} }
} }
// descending
else else
{ {
for (y = 0; y < 3; y++) // Descending
for (y = 0; y < ELEVATOR_WINDOW_HEIGHT; y++)
{ {
for (x = 0; x < 3; x++) for (x = 0; x < ELEVATOR_WINDOW_WIDTH; x++)
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][data[0] % 3] | MAPGRID_COLLISION_MASK); MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][tMoveCounter % ELEVATOR_LIGHT_STAGES] | MAPGRID_COLLISION_MASK);
} }
} }
DrawWholeMapView(); DrawWholeMapView();
data[1] = 0; tTimer = 0;
if (data[0] == data[3]) if (tMoveCounter == tTotalMoves)
DestroyTask(taskId); DestroyTask(taskId);
} }
data[1]++; tTimer++;
} }
#undef tMoveCounter
#undef tTimer
#undef tDescending
#undef tTotalMoves
void BufferVarsForIVRater(void) void BufferVarsForIVRater(void)
{ {
u8 i; u8 i;
@ -1959,13 +2034,13 @@ bool8 UsedPokemonCenterWarp(void)
MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F, MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F,
MAP_BATTLE_FRONTIER_POKEMON_CENTER_1F, MAP_BATTLE_FRONTIER_POKEMON_CENTER_1F,
MAP_UNION_ROOM, MAP_UNION_ROOM,
0xFFFF MAP_UNDEFINED
}; };
int i; int i;
u16 map = (gLastUsedWarp.mapGroup << 8) + gLastUsedWarp.mapNum; u16 map = (gLastUsedWarp.mapGroup << 8) + gLastUsedWarp.mapNum;
for (i = 0; sPokemonCenters[i] != 0xFFFF; i++) for (i = 0; sPokemonCenters[i] != MAP_UNDEFINED; i++)
{ {
if (sPokemonCenters[i] == map) if (sPokemonCenters[i] == map)
return TRUE; return TRUE;
@ -2663,21 +2738,21 @@ static void ScrollableMultichoice_UpdateScrollArrows(u8 taskId)
.secondY = 0, .secondY = 0,
.fullyUpThreshold = 0, .fullyUpThreshold = 0,
.fullyDownThreshold = 0, .fullyDownThreshold = 0,
.tileTag = 2000, .tileTag = GFXTAG_MULTICHOICE_SCROLL_ARROWS,
.palTag = 100, .palTag = PALTAG_MULTICHOICE_SCROLL_ARROWS,
.palNum = 0 .palNum = 0
}; };
struct Task *task = &gTasks[taskId]; struct Task *task = &gTasks[taskId];
struct ScrollArrowsTemplate template = sScrollableMultichoice_ScrollArrowsTemplate; struct ScrollArrowsTemplate template = sScrollableMultichoice_ScrollArrowsTemplate;
if (task->tMaxItemsOnScreen != task->data[1]) if (task->tMaxItemsOnScreen != task->tNumItems)
{ {
template.firstX = (task->tWidth / 2) * 8 + 12 + (task->tLeft - 1) * 8; template.firstX = (task->tWidth / 2) * 8 + 12 + (task->tLeft - 1) * 8;
template.firstY = 8; template.firstY = 8;
template.secondX = (task->tWidth / 2) * 8 + 12 + (task->tLeft - 1) * 8; template.secondX = (task->tWidth / 2) * 8 + 12 + (task->tLeft - 1) * 8;
template.secondY = task->tHeight * 8 + 10; template.secondY = task->tHeight * 8 + 10;
template.fullyUpThreshold = 0; template.fullyUpThreshold = 0;
template.fullyDownThreshold = task->data[1] - task->tMaxItemsOnScreen; template.fullyDownThreshold = task->tNumItems - task->tMaxItemsOnScreen;
task->tScrollArrowId = AddScrollIndicatorArrowPair(&template, &sScrollableMultichoice_ScrollOffset); task->tScrollArrowId = AddScrollIndicatorArrowPair(&template, &sScrollableMultichoice_ScrollOffset);
} }
} }
@ -2685,11 +2760,9 @@ static void ScrollableMultichoice_UpdateScrollArrows(u8 taskId)
static void ScrollableMultichoice_RemoveScrollArrows(u8 taskId) static void ScrollableMultichoice_RemoveScrollArrows(u8 taskId)
{ {
struct Task *task = &gTasks[taskId]; struct Task *task = &gTasks[taskId];
if (task->tMaxItemsOnScreen != task->data[1]) if (task->tMaxItemsOnScreen != task->tNumItems)
{
RemoveScrollIndicatorArrowPair(task->tScrollArrowId); RemoveScrollIndicatorArrowPair(task->tScrollArrowId);
} }
}
// Removed for Emerald (replaced by ShowScrollableMultichoice) // Removed for Emerald (replaced by ShowScrollableMultichoice)
void ShowGlassWorkshopMenu(void) void ShowGlassWorkshopMenu(void)
@ -2912,8 +2985,6 @@ void CloseFrontierExchangeCornerItemIconWindow(void)
RemoveWindow(sFrontierExchangeCorner_ItemIconWindowId); RemoveWindow(sFrontierExchangeCorner_ItemIconWindowId);
} }
#define TAG_ITEM_ICON 5500
static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection) static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection)
{ {
#include "data/battle_frontier/battle_frontier_exchange_corner.h" #include "data/battle_frontier/battle_frontier_exchange_corner.h"
@ -3125,12 +3196,14 @@ void ScrollableMultichoice_ClosePersistentMenu(void)
#undef tListTaskId #undef tListTaskId
#undef tTaskId #undef tTaskId
#define DEOXYS_ROCK_LEVELS 11
void DoDeoxysRockInteraction(void) void DoDeoxysRockInteraction(void)
{ {
CreateTask(Task_DeoxysRockInteraction, 8); CreateTask(Task_DeoxysRockInteraction, 8);
} }
static const u16 sDeoxysRockPalettes[][16] = { static const u16 sDeoxysRockPalettes[DEOXYS_ROCK_LEVELS][16] = {
INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_1.gbapal"), INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_1.gbapal"),
INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_2.gbapal"), INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_2.gbapal"),
INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_3.gbapal"), INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_3.gbapal"),
@ -3144,7 +3217,7 @@ static const u16 sDeoxysRockPalettes[][16] = {
INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_11.gbapal"), INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_11.gbapal"),
}; };
static const u8 sDeoxysRockCoords[][2] = { static const u8 sDeoxysRockCoords[DEOXYS_ROCK_LEVELS][2] = {
{ 15, 12 }, { 15, 12 },
{ 11, 14 }, { 11, 14 },
{ 15, 8 }, { 15, 8 },
@ -3160,11 +3233,11 @@ static const u8 sDeoxysRockCoords[][2] = {
static void Task_DeoxysRockInteraction(u8 taskId) static void Task_DeoxysRockInteraction(u8 taskId)
{ {
static const u8 sStoneMaxStepCounts[] = { 4, 8, 8, 8, 4, 4, 4, 6, 3, 3 }; static const u8 sStoneMaxStepCounts[DEOXYS_ROCK_LEVELS - 1] = { 4, 8, 8, 8, 4, 4, 4, 6, 3, 3 };
if (FlagGet(FLAG_DEOXYS_ROCK_COMPLETE) == TRUE) if (FlagGet(FLAG_DEOXYS_ROCK_COMPLETE) == TRUE)
{ {
gSpecialVar_Result = 3; gSpecialVar_Result = DEOXYS_ROCK_COMPLETE;
ScriptContext_Enable(); ScriptContext_Enable();
DestroyTask(taskId); DestroyTask(taskId);
} }
@ -3179,13 +3252,13 @@ static void Task_DeoxysRockInteraction(u8 taskId)
// Player failed to take the shortest path to the stone, so it resets. // Player failed to take the shortest path to the stone, so it resets.
ChangeDeoxysRockLevel(0); ChangeDeoxysRockLevel(0);
VarSet(VAR_DEOXYS_ROCK_LEVEL, 0); VarSet(VAR_DEOXYS_ROCK_LEVEL, 0);
gSpecialVar_Result = 0; gSpecialVar_Result = DEOXYS_ROCK_FAILED;
DestroyTask(taskId); DestroyTask(taskId);
} }
else if (rockLevel == 10) else if (rockLevel == DEOXYS_ROCK_LEVELS - 1)
{ {
FlagSet(FLAG_DEOXYS_ROCK_COMPLETE); FlagSet(FLAG_DEOXYS_ROCK_COMPLETE);
gSpecialVar_Result = 2; gSpecialVar_Result = DEOXYS_ROCK_SOLVED;
ScriptContext_Enable(); ScriptContext_Enable();
DestroyTask(taskId); DestroyTask(taskId);
} }
@ -3194,7 +3267,7 @@ static void Task_DeoxysRockInteraction(u8 taskId)
rockLevel++; rockLevel++;
ChangeDeoxysRockLevel(rockLevel); ChangeDeoxysRockLevel(rockLevel);
VarSet(VAR_DEOXYS_ROCK_LEVEL, rockLevel); VarSet(VAR_DEOXYS_ROCK_LEVEL, rockLevel);
gSpecialVar_Result = 1; gSpecialVar_Result = DEOXYS_ROCK_PROGRESSED;
DestroyTask(taskId); DestroyTask(taskId);
} }
} }
@ -3207,9 +3280,9 @@ static void ChangeDeoxysRockLevel(u8 rockLevel)
TryGetObjectEventIdByLocalIdAndMap(LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectEventId); TryGetObjectEventIdByLocalIdAndMap(LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectEventId);
if (rockLevel == 0) if (rockLevel == 0)
PlaySE(SE_M_CONFUSE_RAY); PlaySE(SE_M_CONFUSE_RAY); // Failure sound
else else
PlaySE(SE_RG_DEOXYS_MOVE); PlaySE(SE_RG_DEOXYS_MOVE); // Success sound
CreateTask(WaitForDeoxysRockMovement, 8); CreateTask(WaitForDeoxysRockMovement, 8);
gFieldEffectArguments[0] = LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK; gFieldEffectArguments[0] = LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK;
@ -3218,6 +3291,8 @@ static void ChangeDeoxysRockLevel(u8 rockLevel)
gFieldEffectArguments[3] = sDeoxysRockCoords[rockLevel][0]; gFieldEffectArguments[3] = sDeoxysRockCoords[rockLevel][0];
gFieldEffectArguments[4] = sDeoxysRockCoords[rockLevel][1]; gFieldEffectArguments[4] = sDeoxysRockCoords[rockLevel][1];
// Set number of movement steps.
// Resetting for failure is slow, successful movement is fast.
if (rockLevel == 0) if (rockLevel == 0)
gFieldEffectArguments[5] = 60; gFieldEffectArguments[5] = 60;
else else
@ -3735,8 +3810,9 @@ static void Task_CloseBattlePikeCurtain(u8 taskId)
void GetBattlePyramidHint(void) void GetBattlePyramidHint(void)
{ {
gSpecialVar_Result = gSpecialVar_0x8004 / 7; // gSpecialVar_0x8004 here is expected to be the current Battle Pyramid win streak.
gSpecialVar_Result -= (gSpecialVar_Result / 20) * 20; gSpecialVar_Result = gSpecialVar_0x8004 / FRONTIER_STAGES_PER_CHALLENGE;
gSpecialVar_Result -= (gSpecialVar_Result / TOTAL_PYRAMID_ROUNDS) * TOTAL_PYRAMID_ROUNDS;
} }
// Used to avoid a potential softlock if the player respawns on Dewford with no way off // Used to avoid a potential softlock if the player respawns on Dewford with no way off
@ -3771,13 +3847,13 @@ bool8 InPokemonCenter(void)
MAP_TRADE_CENTER, MAP_TRADE_CENTER,
MAP_RECORD_CORNER, MAP_RECORD_CORNER,
MAP_BATTLE_COLOSSEUM_4P, MAP_BATTLE_COLOSSEUM_4P,
0xFFFF MAP_UNDEFINED
}; };
int i; int i;
u16 map = (gSaveBlock1Ptr->location.mapGroup << 8) + gSaveBlock1Ptr->location.mapNum; u16 map = (gSaveBlock1Ptr->location.mapGroup << 8) + gSaveBlock1Ptr->location.mapNum;
for (i = 0; sPokemonCenters[i] != 0xFFFF; i++) for (i = 0; sPokemonCenters[i] != MAP_UNDEFINED; i++)
{ {
if (sPokemonCenters[i] == map) if (sPokemonCenters[i] == map)
return TRUE; return TRUE;

View File

@ -30,6 +30,17 @@
#include "constants/region_map_sections.h" #include "constants/region_map_sections.h"
#include "constants/songs.h" #include "constants/songs.h"
// gFrontierPassBg_Pal has 8*16 colors, but they attempt to load 13*16 colors.
// As a result it goes out of bounds and interprets 160 bytes of whatever comes
// after gFrontierPassBg_Pal (by default, gFrontierPassBg_Gfx) as a palette.
// Nothing uses these colors (except the Trainer Card, which correctly writes them)
// so in practice this bug has no effect on the game.
#ifdef BUGFIX_
#define NUM_BG_PAL_SLOTS 8
#else
#define NUM_BG_PAL_SLOTS 13
#endif
// All windows displayed in the frontier pass. // All windows displayed in the frontier pass.
enum enum
{ {
@ -768,7 +779,7 @@ static bool32 InitFrontierPass(void)
CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(2);
break; break;
case 8: case 8:
LoadPalette(gFrontierPassBg_Pal[0], 0, 13 * PLTT_SIZE_4BPP); LoadPalette(gFrontierPassBg_Pal, 0, NUM_BG_PAL_SLOTS * PLTT_SIZE_4BPP);
LoadPalette(gFrontierPassBg_Pal[1 + sPassData->trainerStars], BG_PLTT_ID(1), PLTT_SIZE_4BPP); LoadPalette(gFrontierPassBg_Pal[1 + sPassData->trainerStars], BG_PLTT_ID(1), PLTT_SIZE_4BPP);
LoadPalette(GetTextWindowPalette(0), BG_PLTT_ID(15), PLTT_SIZE_4BPP); LoadPalette(GetTextWindowPalette(0), BG_PLTT_ID(15), PLTT_SIZE_4BPP);
DrawFrontierPassBg(); DrawFrontierPassBg();
@ -1412,7 +1423,7 @@ static bool32 InitFrontierMap(void)
case 5: case 5:
if (FreeTempTileDataBuffersIfPossible()) if (FreeTempTileDataBuffersIfPossible())
return FALSE; return FALSE;
LoadPalette(gFrontierPassBg_Pal[0], BG_PLTT_ID(0), 13 * PLTT_SIZE_4BPP); LoadPalette(gFrontierPassBg_Pal, BG_PLTT_ID(0), NUM_BG_PAL_SLOTS * PLTT_SIZE_4BPP);
LoadPalette(GetTextWindowPalette(0), BG_PLTT_ID(15), PLTT_SIZE_4BPP); LoadPalette(GetTextWindowPalette(0), BG_PLTT_ID(15), PLTT_SIZE_4BPP);
CopyToBgTilemapBuffer(2, sMapScreen_Tilemap, 0, 0); CopyToBgTilemapBuffer(2, sMapScreen_Tilemap, 0, 0);
CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(2);

View File

@ -2013,7 +2013,6 @@ const u16 gTitleScreenPressStartPal[] = INCBIN_U16("graphics/title_screen/p
const u32 gTitleScreenPressStartGfx[] = INCBIN_U32("graphics/title_screen/press_start.4bpp.lz"); const u32 gTitleScreenPressStartGfx[] = INCBIN_U32("graphics/title_screen/press_start.4bpp.lz");
const u32 gTitleScreenPokemonLogoTilemap[] = INCBIN_U32("graphics/title_screen/pokemon_logo.bin.lz"); const u32 gTitleScreenPokemonLogoTilemap[] = INCBIN_U32("graphics/title_screen/pokemon_logo.bin.lz");
// size in LoadPalette calls is reported as 0xD0 << 1, which is 0x1A0, but palette is only 0x100 bytes long so it loads garbage as well
const u16 gFrontierPassBg_Pal[][16] = INCBIN_U16("graphics/frontier_pass/bg.gbapal"); const u16 gFrontierPassBg_Pal[][16] = INCBIN_U16("graphics/frontier_pass/bg.gbapal");
const u32 gFrontierPassBg_Gfx[] = INCBIN_U32("graphics/frontier_pass/bg.4bpp.lz"); const u32 gFrontierPassBg_Gfx[] = INCBIN_U32("graphics/frontier_pass/bg.4bpp.lz");
const u32 gFrontierPassMapAndCard_Gfx[] = INCBIN_U32("graphics/frontier_pass/map_and_card.8bpp.lz"); const u32 gFrontierPassMapAndCard_Gfx[] = INCBIN_U32("graphics/frontier_pass/map_and_card.8bpp.lz");

View File

@ -677,7 +677,7 @@ void InitHostRfuGameData(struct RfuGameData *data, u8 activity, bool32 startedAc
data->compatibility.hasNews = FALSE; data->compatibility.hasNews = FALSE;
data->compatibility.hasCard = FALSE; data->compatibility.hasCard = FALSE;
data->compatibility.unknown = FALSE; data->compatibility.unknown = FALSE;
data->compatibility.isChampion = FlagGet(FLAG_IS_CHAMPION); data->compatibility.canLinkNationally = FlagGet(FLAG_IS_CHAMPION);
data->compatibility.hasNationalDex = IsNationalPokedexEnabled(); data->compatibility.hasNationalDex = IsNationalPokedexEnabled();
data->compatibility.gameClear = FlagGet(FLAG_SYS_GAME_CLEAR); data->compatibility.gameClear = FlagGet(FLAG_SYS_GAME_CLEAR);
} }

View File

@ -503,7 +503,9 @@ static const u8 *const sFemalePresetNames[] = {
gText_DefaultNameHalie gText_DefaultNameHalie
}; };
// .text // The number of male vs. female names is assumed to be the same.
// If they aren't, the smaller of the two sizes will be used and any extra names will be ignored.
#define NUM_PRESET_NAMES min(ARRAY_COUNT(sMalePresetNames), ARRAY_COUNT(sFemalePresetNames))
enum enum
{ {
@ -1597,7 +1599,7 @@ static void Task_NewGameBirchSpeech_StartNamingScreen(u8 taskId)
{ {
FreeAllWindowBuffers(); FreeAllWindowBuffers();
FreeAndDestroyMonPicSprite(gTasks[taskId].tLotadSpriteId); FreeAndDestroyMonPicSprite(gTasks[taskId].tLotadSpriteId);
NewGameBirchSpeech_SetDefaultPlayerName(Random() % 20); NewGameBirchSpeech_SetDefaultPlayerName(Random() % NUM_PRESET_NAMES);
DestroyTask(taskId); DestroyTask(taskId);
DoNamingScreen(NAMING_SCREEN_PLAYER, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_NewGameBirchSpeech_ReturnFromNamingScreen); DoNamingScreen(NAMING_SCREEN_PLAYER, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_NewGameBirchSpeech_ReturnFromNamingScreen);
} }

View File

@ -142,7 +142,7 @@ static s32 mini_strlen(const char *s)
return len; return len;
} }
static s32 mini_itoa(u32 value, u32 radix, s32 uppercase, bool32 unsig, char *buffer) static s32 mini_itoa(s32 value, u32 radix, s32 uppercase, bool32 unsig, char *buffer)
{ {
char *pbuffer = buffer; char *pbuffer = buffer;
s32 negative = 0; s32 negative = 0;

File diff suppressed because it is too large Load Diff

View File

@ -692,8 +692,8 @@ void TryPrepareSecondApproachingTrainer(void)
#define sLocalId data[0] #define sLocalId data[0]
#define sMapNum data[1] #define sMapNum data[1]
#define sMapGroup data[2] #define sMapGroup data[2]
#define sData3 data[3] #define sYVelocity data[3]
#define sData4 data[4] #define sYOffset data[4]
#define sFldEffId data[7] #define sFldEffId data[7]
u8 FldEff_ExclamationMarkIcon(void) u8 FldEff_ExclamationMarkIcon(void)
@ -739,7 +739,7 @@ static void SetIconSpriteData(struct Sprite *sprite, u16 fldEffId, u8 spriteAnim
sprite->sLocalId = gFieldEffectArguments[0]; sprite->sLocalId = gFieldEffectArguments[0];
sprite->sMapNum = gFieldEffectArguments[1]; sprite->sMapNum = gFieldEffectArguments[1];
sprite->sMapGroup = gFieldEffectArguments[2]; sprite->sMapGroup = gFieldEffectArguments[2];
sprite->sData3 = -5; sprite->sYVelocity = -5;
sprite->sFldEffId = fldEffId; sprite->sFldEffId = fldEffId;
StartSpriteAnim(sprite, spriteAnimNum); StartSpriteAnim(sprite, spriteAnimNum);
@ -757,23 +757,23 @@ static void SpriteCB_TrainerIcons(struct Sprite *sprite)
else else
{ {
struct Sprite *objEventSprite = &gSprites[gObjectEvents[objEventId].spriteId]; struct Sprite *objEventSprite = &gSprites[gObjectEvents[objEventId].spriteId];
sprite->sData4 += sprite->sData3; sprite->sYOffset += sprite->sYVelocity;
sprite->x = objEventSprite->x; sprite->x = objEventSprite->x;
sprite->y = objEventSprite->y - 16; sprite->y = objEventSprite->y - 16;
sprite->x2 = objEventSprite->x2; sprite->x2 = objEventSprite->x2;
sprite->y2 = objEventSprite->y2 + sprite->sData4; sprite->y2 = objEventSprite->y2 + sprite->sYOffset;
if (sprite->sData4) if (sprite->sYOffset)
sprite->sData3++; sprite->sYVelocity++;
else else
sprite->sData3 = 0; sprite->sYVelocity = 0;
} }
} }
#undef sLocalId #undef sLocalId
#undef sMapNum #undef sMapNum
#undef sMapGroup #undef sMapGroup
#undef sData3 #undef sYVelocity
#undef sData4 #undef sYOffset
#undef sFldEffId #undef sFldEffId
u8 GetCurrentApproachingTrainerObjectEventId(void) u8 GetCurrentApproachingTrainerObjectEventId(void)

View File

@ -1271,7 +1271,7 @@ static u32 IsTryingToTradeAcrossVersionTooSoon(struct WirelessLink_Group *data,
{ {
if (!(gSaveBlock2Ptr->specialSaveWarpFlags & CHAMPION_SAVEWARP)) if (!(gSaveBlock2Ptr->specialSaveWarpFlags & CHAMPION_SAVEWARP))
return UR_TRADE_PLAYER_NOT_READY; return UR_TRADE_PLAYER_NOT_READY;
else if (partner->rfu.data.compatibility.isChampion) else if (partner->rfu.data.compatibility.canLinkNationally)
return UR_TRADE_READY; return UR_TRADE_READY;
} }
else else

View File

@ -32,7 +32,7 @@ enum {
#define GROUPTYPE_BATTLE 1 #define GROUPTYPE_BATTLE 1
#define GROUPTYPE_UNION 2 #define GROUPTYPE_UNION 2
#define GROUPTYPE_TOTAL 3 #define GROUPTYPE_TOTAL 3
#define GROUPTYPE_NONE -1 #define GROUPTYPE_NONE 0xFF
#define NUM_GROUPTYPES 4 #define NUM_GROUPTYPES 4
struct WirelessCommunicationStatusScreen struct WirelessCommunicationStatusScreen
@ -126,7 +126,6 @@ static const u8 *const sHeaderTexts[NUM_GROUPTYPES + 1] = {
// Activity, group type, number of players // Activity, group type, number of players
// 0 players means the number of players can change and should be counted dynamically // 0 players means the number of players can change and should be counted dynamically
// GROUPTYPE_TOTAL have no unique group and are simply counted in the total of "people communicating" // GROUPTYPE_TOTAL have no unique group and are simply counted in the total of "people communicating"
// UB: GROUPTYPE_NONE (-1) can potentially be used as an index into a u8[4] in CountPlayersInGroupAndGetActivity
static const u8 sActivityGroupInfo[][3] = { static const u8 sActivityGroupInfo[][3] = {
{ACTIVITY_BATTLE_SINGLE, GROUPTYPE_BATTLE, 2}, {ACTIVITY_BATTLE_SINGLE, GROUPTYPE_BATTLE, 2},
{ACTIVITY_BATTLE_DOUBLE, GROUPTYPE_BATTLE, 2}, {ACTIVITY_BATTLE_DOUBLE, GROUPTYPE_BATTLE, 2},
@ -382,6 +381,13 @@ static u32 CountPlayersInGroupAndGetActivity(struct RfuPlayer * player, u32 * gr
for (i = 0; i < ARRAY_COUNT(sActivityGroupInfo); i++) for (i = 0; i < ARRAY_COUNT(sActivityGroupInfo); i++)
{ {
#ifdef UBFIX_
// GROUPTYPE_NONE is 0xFF, and shouldn't be used as an index into groupCounts.
// In theory the only activity with this group type (ACTIVITY_SEARCH) wouldn't
// satisfy the condition below, but not necessarily.
if (group_type(i) == GROUPTYPE_NONE)
continue;
#endif
if (activity == group_activity(i) && player->groupScheduledAnim == UNION_ROOM_SPAWN_IN) if (activity == group_activity(i) && player->groupScheduledAnim == UNION_ROOM_SPAWN_IN)
{ {
if (group_players(i) == 0) if (group_players(i) == 0)