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
gUnusedWindowVar3
gWindowBgTilemapBuffers

View File

@ -48,21 +48,24 @@ BirthIsland_Exterior_EventScript_Triangle::
special DoDeoxysRockInteraction
waitstate
switch VAR_RESULT
case 0, BirthIsland_Exterior_EventScript_NotSolved1
case 1, BirthIsland_Exterior_EventScript_NotSolved2
case 2, BirthIsland_Exterior_EventScript_Deoxys
case 3, BirthIsland_Exterior_EventScript_NotSolved3
case DEOXYS_ROCK_FAILED, BirthIsland_Exterior_EventScript_Failed
case DEOXYS_ROCK_PROGRESSED, BirthIsland_Exterior_EventScript_Progressed
case DEOXYS_ROCK_SOLVED, BirthIsland_Exterior_EventScript_Deoxys
case DEOXYS_ROCK_COMPLETE, BirthIsland_Exterior_EventScript_Complete
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
end
BirthIsland_Exterior_EventScript_NotSolved2::
BirthIsland_Exterior_EventScript_Progressed::
release
end
BirthIsland_Exterior_EventScript_NotSolved3::
BirthIsland_Exterior_EventScript_Complete::
release
end

View File

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

View File

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

View File

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

View File

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

View File

@ -160,7 +160,7 @@ void AnimThrowProjectile(struct Sprite *sprite);
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);
void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite);
void TradeMenuBouncePartySprites(struct Sprite *sprite);
void Trade_MoveSelectedMonToTarget(struct Sprite *sprite);
void DestroyAnimVisualTaskAndDisableBlend(u8 taskId);
void DestroySpriteAndFreeResources_(struct Sprite *sprite);
void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId);

View File

@ -1,7 +1,7 @@
#ifndef 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 HINT_EXIT_DIRECTION 0

View File

@ -80,4 +80,10 @@
#define FANCOUNTER_FINISHED_CONTEST 2
#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

View File

@ -4,29 +4,19 @@
#define TRADE_PLAYER 0
#define TRADE_PARTNER 1
#define LINK_TRADE_TIMEOUT 300
// In-game Trade IDs
#define INGAME_TRADE_SEEDOT 0
#define INGAME_TRADE_PLUSLE 1
#define INGAME_TRADE_HORSEA 2
#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
#define CAN_TRADE_MON 0
#define CANT_TRADE_LAST_MON 1
#define CANT_TRADE_NATIONAL 2
#define CANT_TRADE_EGG_YET 3
#define CANT_TRADE_INVALID_MON 4
#define CANT_TRADE_EGG_YET2 5
#define CAN_TRADE_MON 0
#define CANT_TRADE_LAST_MON 1
#define CANT_TRADE_NATIONAL 2
#define CANT_TRADE_EGG_YET 3
#define CANT_TRADE_INVALID_MON 4
#define CANT_TRADE_PARTNER_EGG_YET 5
// Return values for CheckValidityOfTradeMons
#define PLAYER_MON_INVALID 0
@ -38,63 +28,6 @@
#define TRADE_PLAYER_NOT_READY 1
#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
#define UR_TRADE_MSG_NONE 0
#define UR_TRADE_MSG_NOT_MON_PARTNER_WANTS 1

View File

@ -83,7 +83,7 @@ struct RfuGameCompatibilityData
u16 hasNews:1;
u16 hasCard:1;
u16 unknown:1; // Never read
u16 isChampion:1;
u16 canLinkNationally:1;
u16 hasNationalDex:1;
u16 gameClear:1;
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[3] = sprite->y;

View File

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

View File

@ -284,7 +284,7 @@ static const u8 sFloorTemplateOffsets[FRONTIER_STAGES_PER_CHALLENGE] =
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_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},
};
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_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;
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
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)
round = TOTAL_ROUNDS - 1;
if (round >= TOTAL_PYRAMID_ROUNDS)
round = TOTAL_PYRAMID_ROUNDS - 1;
id = GetPyramidFloorTemplateId();
itemIndex = (gSpecialVar_LastTalked - sPyramidFloorTemplates[id].numTrainers) - 1;
@ -1345,10 +1345,10 @@ void GenerateBattlePyramidWildMon(void)
const struct PyramidWildMon *wildMons;
u32 id;
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)
round = TOTAL_ROUNDS - 1;
if (round >= TOTAL_PYRAMID_ROUNDS)
round = TOTAL_PYRAMID_ROUNDS - 1;
if (lvl != FRONTIER_LVL_50)
wildMons = sOpenLevelWildMonPointers[round];
@ -1961,8 +1961,8 @@ u16 GetBattlePyramidPickupItemId(void)
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
int round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE);
if (round >= TOTAL_ROUNDS)
round = TOTAL_ROUNDS - 1;
if (round >= TOTAL_PYRAMID_ROUNDS)
round = TOTAL_PYRAMID_ROUNDS - 1;
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_Round2,

View File

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

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_YourFriendWantsToTrade[] = _("Your friend wants\nto trade POKéMON.");
static const struct OamData sTradeOamData_32x16 =
static const struct OamData sOamData_MenuText =
{
.shape = SPRITE_SHAPE(32x16),
.size = SPRITE_SIZE(32x16),
@ -167,17 +167,17 @@ static const struct SpriteTemplate sSpriteTemplate_MenuText =
{
.tileTag = GFXTAG_MENU_TEXT,
.paletteTag = PALTAG_MENU_TEXT,
.oam = &sTradeOamData_32x16,
.oam = &sOamData_MenuText,
.anims = sAnims_MenuText,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const u16 sTradeScreenTextPalette[] = INCBIN_U16("graphics/trade/text.gbapal");
static const struct SpritePalette sSpritePalette_TradeScreenText =
static const u16 sMenuText_Pal[] = INCBIN_U16("graphics/trade/text.gbapal");
static const struct SpritePalette sSpritePalette_MenuText =
{
.data = sTradeScreenTextPalette,
.data = sMenuText_Pal,
.tag = PALTAG_MENU_TEXT
};
@ -193,7 +193,7 @@ static const struct SpritePalette sSpritePalette_TradeScreenText =
// 1st array is the current positions
// 2nd array is directions of input
// 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
@ -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] =
{
// Your party
{1, 5 },
{8, 5 },
{1, 10},
{8, 10},
{1, 15},
{8, 15},
// Friend's party
{16, 5 },
{23, 5 },
{16, 10},
{23, 10},
{16, 15},
{23, 15},
{23, 18} // CANCEL
// Player's party
{COL0_X, ROW0_Y},
{COL1_X, ROW0_Y},
{COL0_X, ROW1_Y},
{COL1_X, ROW1_Y},
{COL0_X, ROW2_Y},
{COL1_X, ROW2_Y},
// Partners's party
{COL2_X, ROW0_Y},
{COL3_X, ROW0_Y},
{COL2_X, ROW1_Y},
{COL3_X, ROW1_Y},
{COL2_X, ROW2_Y},
{COL3_X, ROW2_Y},
// Cancel
{COL3_X, ROW3_Y}
};
static const u8 sTradeMonLevelCoords[][2][2] =
{
// Your party
{
{5, 4},
{12, 4},
},
{
{5, 9},
{12, 9},
},
{
{5, 14},
static const u8 sTradeMonLevelCoords[PARTY_SIZE * 2][2] = {
[TRADE_PLAYER] =
{ 5, 4},
{12, 4},
{ 5, 9},
{12, 9},
{ 5, 14},
{12, 14},
},
// Friend's party
{
{20, 4},
{27, 4},
},
{
{20, 9},
{27, 9},
},
{
[TRADE_PARTNER * PARTY_SIZE] =
{20, 4},
{27, 4},
{20, 9},
{27, 9},
{20, 14},
{27, 14},
},
};
static const u8 sTradeMonBoxCoords[][2][2] =
{
// Your party
{
{1, 3},
{8, 3},
},
{
{1, 8},
{8, 8},
},
{
{1, 13},
{8, 13},
},
// Friend's party
{
{16, 3},
{23, 3},
},
{
{16, 8},
{23, 8},
},
{
static const u8 sTradeMonBoxCoords[PARTY_SIZE * 2][2] = {
[TRADE_PLAYER] =
{ 1, 3},
{ 8, 3},
{ 1, 8},
{ 8, 8},
{ 1, 13},
{ 8, 13},
[TRADE_PARTNER * PARTY_SIZE] =
{16, 3},
{23, 3},
{16, 8},
{23, 8},
{16, 13},
{23, 13},
},
};
static const u8 sUnusedCoords[][2] =
@ -379,14 +360,14 @@ static const u8 sUnusedCoords[][2] =
{23, 12}
};
static const u8 *const sTradeActionTexts[] =
static const u8 *const sActionTexts[] =
{
[TRADE_TEXT_CANCEL] = sText_Cancel,
[TRADE_TEXT_CHOOSE_MON] = sText_ChooseAPkmn,
[TRADE_TEXT_SUMMARY] = sText_Summary,
[TRADE_TEXT_TRADE] = sText_Trade,
[TRADE_TEXT_CANCEL_TRADE] = sText_CancelTrade,
[TRADE_TEXT_JP_QUIT] = sJPText_PressBButtonToQuit
[TEXT_CANCEL] = sText_Cancel,
[TEXT_CHOOSE_MON] = sText_ChooseAPkmn,
[TEXT_SUMMARY] = sText_Summary,
[TEXT_TRADE] = sText_Trade,
[TEXT_CANCEL_TRADE] = sText_CancelTrade,
[TEXT_JP_QUIT] = sJPText_PressBButtonToQuit
};
static const struct MenuAction sSelectTradeMonActions[] =
@ -395,17 +376,17 @@ static const struct MenuAction sSelectTradeMonActions[] =
{sText_Trade2, Task_DrawSelectionTrade}
};
static const u8 *const sTradeMessages[] =
static const u8 *const sMessages[] =
{
[TRADE_MSG_STANDBY] = sText_CommunicationStandby,
[TRADE_MSG_CANCELED] = sText_TheTradeHasBeenCanceled,
[TRADE_MSG_ONLY_MON1] = sText_OnlyPkmnForBattle,
[TRADE_MSG_ONLY_MON2] = gText_OnlyPkmnForBattle, //identical text to above
[TRADE_MSG_WAITING_FOR_FRIEND] = sText_WaitingForYourFriend,
[TRADE_MSG_FRIEND_WANTS_TO_TRADE] = sText_YourFriendWantsToTrade,
[TRADE_MSG_MON_CANT_BE_TRADED] = gText_PkmnCantBeTradedNow,
[TRADE_MSG_EGG_CANT_BE_TRADED] = gText_EggCantBeTradedNow,
[TRADE_MSG_FRIENDS_MON_CANT_BE_TRADED] = gText_OtherTrainersPkmnCantBeTraded
[MSG_STANDBY] = sText_CommunicationStandby,
[MSG_CANCELED] = sText_TheTradeHasBeenCanceled,
[MSG_ONLY_MON1] = sText_OnlyPkmnForBattle,
[MSG_ONLY_MON2] = gText_OnlyPkmnForBattle, //identical text to above
[MSG_WAITING_FOR_FRIEND] = sText_WaitingForYourFriend,
[MSG_FRIEND_WANTS_TO_TRADE] = sText_YourFriendWantsToTrade,
[MSG_MON_CANT_BE_TRADED] = gText_PkmnCantBeTradedNow,
[MSG_EGG_CANT_BE_TRADED] = gText_EggCantBeTradedNow,
[MSG_FRIENDS_MON_CANT_BE_TRADED] = gText_OtherTrainersPkmnCantBeTraded
};
static const u8 sTradeTextColors[] =
@ -415,7 +396,7 @@ static const u8 sTradeTextColors[] =
TEXT_COLOR_DARK_GRAY //shadow color
};
static const struct BgTemplate sTradeMenuBgTemplates[] =
static const struct BgTemplate sBgTemplates[] =
{
{
.bg = 0,
@ -455,7 +436,7 @@ static const struct BgTemplate sTradeMenuBgTemplates[] =
},
};
static const struct WindowTemplate sTradeMenuWindowTemplates[] =
static const struct WindowTemplate sWindowTemplates[] =
{
{
.bg = 0,
@ -633,8 +614,8 @@ static const struct WindowTemplate sTradeYesNoWindowTemplate =
.baseBlock = 582
};
static const u8 sJPText_Shedinja[] = _("ヌケニン");
static const u8 sTradeMenuPartyMonBoxDimensions[3][2] =
static const u8 sText_ShedinjaJP[] = _("ヌケニン");
static const u8 sSelectedMonLevelGenderCoords[3][2] =
{
[TRADE_PLAYER] = {4, 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 u8 sPokeball_Gfx[] = INCBIN_U8("graphics/trade/pokeball.4bpp");
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 sTradeTilemap_PokeBallSymbol[] = INCBIN_U16("graphics/trade/pokeball_symbol_map.bin"); // unused?
static const u16 sCableCloseup_Map[] = INCBIN_U16("graphics/trade/crossing_highlight_cable.bin");
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 sGba_Pal[] = INCBIN_U16("graphics/trade/gba.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");
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 sGbaCable_AffineTilemap[] = 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 u16 sGbaWireless_Tilemap[] = INCBIN_U16("graphics/trade/gba_map_wireless.bin");
static const u16 sGbaCable_Tilemap[] = INCBIN_U16("graphics/trade/gba_map_cable.bin");
static const u32 sCrossingHighlightWireless_Tilemap[] = INCBIN_U32("graphics/trade/crossing_highlight_wireless.bin.lz");
static const u8 sGbaAffineMapCable[] = INCBIN_U8("graphics/trade/gba_affine_map_cable.bin");
static const u8 sGbaAffineMapWireless[] = INCBIN_U8("graphics/trade/gba_affine_map_wireless.bin");
static const u16 sGbaMapWireless[] = INCBIN_U16("graphics/trade/gba_map_wireless.bin");
static const u16 sGbaMapCable[] = INCBIN_U16("graphics/trade/gba_map_cable.bin");
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 sWirelessSignalRecv_Pal[] = INCBIN_U16("graphics/trade/wireless_signal_receive.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 =
{
.data = sPokeball_Gfx,
.size = 0x600,
.size = sizeof(sPokeball_Gfx),
.tag = GFXTAG_POKEBALL
};
@ -805,7 +786,7 @@ static const union AffineAnimCmd *const sAffineAnims_LinkMonGlow[] =
static const struct SpriteSheet sSpriteSheet_LinkMonGlow =
{
.data = sLinkMonGlow_Gfx,
.size = 0x200,
.size = sizeof(sLinkMonGlow_Gfx),
.tag = GFXTAG_LINK_MON_GLOW
};
@ -962,7 +943,7 @@ static const union AnimCmd *const sAnims_GbaScreen_Short[] =
static const struct SpriteSheet sSpriteSheet_GbaScreen =
{
.data = sGbaScreen_Gfx,
.size = 0x1000,
.size = sizeof(sGbaScreen_Gfx),
.tag = GFXTAG_GBA_SCREEN
};
@ -1185,7 +1166,7 @@ static const s8 sTradeBallVerticalVelocityTable[] =
0, 0, 0, 1, 0, 1, 1, 2, 3
};
static const u8 sWirelessSignalTiming[][2] =
static const u8 sWirelessSignalAnimParams[][2] =
{
{ 0, 1},
{ 1, 1},

View File

@ -3831,26 +3831,38 @@ static void SpriteCB_DeoxysRockFragment(struct Sprite *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)
{
u8 objectEventIdBuffer;
if (!TryGetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2], &objectEventIdBuffer))
u8 objectEventId;
if (!TryGetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2], &objectEventId))
{
struct ObjectEvent *object;
int xPos, yPos;
u8 taskId;
object = &gObjectEvents[objectEventIdBuffer];
object = &gObjectEvents[objectEventId];
xPos = object->currentCoords.x - MAP_OFFSET;
yPos = object->currentCoords.y - MAP_OFFSET;
xPos = (gFieldEffectArguments[3] - xPos) * 16;
yPos = (gFieldEffectArguments[4] - yPos) * 16;
ShiftObjectEventCoords(object, gFieldEffectArguments[3] + MAP_OFFSET, gFieldEffectArguments[4] + MAP_OFFSET);
taskId = CreateTask(Task_MoveDeoxysRock, 80);
gTasks[taskId].data[1] = object->spriteId;
gTasks[taskId].data[2] = gSprites[object->spriteId].x + xPos;
gTasks[taskId].data[3] = gSprites[object->spriteId].y + yPos;
gTasks[taskId].data[8] = gFieldEffectArguments[5];
gTasks[taskId].data[9] = objectEventIdBuffer;
gTasks[taskId].tSpriteId = object->spriteId;
gTasks[taskId].tTargetX = gSprites[object->spriteId].x + xPos;
gTasks[taskId].tTargetY = gSprites[object->spriteId].y + yPos;
gTasks[taskId].tMoveSteps = gFieldEffectArguments[5];
gTasks[taskId].tObjEventId = objectEventId;
}
return FALSE;
}
@ -3858,29 +3870,30 @@ bool8 FldEff_MoveDeoxysRock(struct Sprite *sprite)
static void Task_MoveDeoxysRock(u8 taskId)
{
s16 *data = gTasks[taskId].data;
struct Sprite *sprite = &gSprites[data[1]];
switch (data[0])
struct Sprite *sprite = &gSprites[tSpriteId];
switch (tState)
{
case 0:
data[4] = sprite->x << 4;
data[5] = sprite->y << 4;
data[6] = SAFE_DIV(data[2] * 16 - data[4], data[8]);
data[7] = SAFE_DIV(data[3] * 16 - data[5], data[8]);
data[0]++;
tCurX = sprite->x << 4;
tCurY = sprite->y << 4;
tVelocityX = SAFE_DIV(tTargetX * 16 - tCurX, tMoveSteps);
tVelocityY = SAFE_DIV(tTargetY * 16 - tCurY, tMoveSteps);
tState++;
// fallthrough
case 1:
if (data[8] != 0)
if (tMoveSteps != 0)
{
data[8]--;
data[4] += data[6];
data[5] += data[7];
sprite->x = data[4] >> 4;
sprite->y = data[5] >> 4;
tMoveSteps--;
tCurX += tVelocityX;
tCurY += tVelocityY;
sprite->x = tCurX >> 4;
sprite->y = tCurY >> 4;
}
else
{
struct ObjectEvent *object = &gObjectEvents[data[9]];
sprite->x = data[2];
sprite->y = data[3];
struct ObjectEvent *object = &gObjectEvents[tObjEventId];
sprite->x = tTargetX;
sprite->y = tTargetY;
ShiftStillObjectEventCoords(object);
object->triggerGroundEffectsOnStop = TRUE;
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 "window.h"
#include "constants/battle_frontier.h"
#include "constants/battle_pyramid.h"
#include "constants/battle_tower.h"
#include "constants/decorations.h"
#include "constants/event_objects.h"
@ -67,6 +68,15 @@
#include "palette.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 u8 gBikeCollisions = 0;
static EWRAM_DATA u32 sBikeCyclingTimer = 0;
@ -95,8 +105,8 @@ static void LoadLinkPartnerObjectEventSpritePalette(u8, u8, u8);
static void Task_PetalburgGymSlideOpenRoomDoors(u8);
static void PetalburgGymSetDoorMetatiles(u8, u16);
static void Task_PCTurnOnEffect(u8);
static void PCTurnOnEffect_0(struct Task *);
static void PCTurnOnEffect_1(s16, s8, s8);
static void PCTurnOnEffect(struct Task *);
static void PCTurnOnEffect_SetMetatile(s16, s8, s8);
static void PCTurnOffEffect(void);
static void Task_LotteryCornerComputerEffect(u8);
static void LotteryCornerComputerEffect(struct Task *);
@ -969,34 +979,44 @@ static bool8 IsPlayerInFrontOfPC(void)
|| 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)
{
if (FuncIsActiveTask(Task_PCTurnOnEffect) != TRUE && IsPlayerInFrontOfPC() == TRUE)
{
u8 taskId = CreateTask(Task_PCTurnOnEffect, 8);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = taskId;
gTasks[taskId].data[2] = 0;
gTasks[taskId].data[3] = 0;
gTasks[taskId].data[4] = 0;
gTasks[taskId].tPaused = FALSE;
gTasks[taskId].tTaskId = taskId;
gTasks[taskId].tFlickerCount = 0;
gTasks[taskId].tTimer = 0;
gTasks[taskId].tIsScreenOn = FALSE;
}
}
static void Task_PCTurnOnEffect(u8 taskId)
{
struct Task *task = &gTasks[taskId];
if (task->data[0] == 0)
PCTurnOnEffect_0(task);
if (!task->tPaused)
PCTurnOnEffect(task);
}
static void PCTurnOnEffect_0(struct Task *task)
static void PCTurnOnEffect(struct Task *task)
{
u8 playerDirection;
s8 dx = 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();
switch (playerDirection)
{
@ -1013,39 +1033,47 @@ static void PCTurnOnEffect_0(struct Task *task)
dy = -1;
break;
}
PCTurnOnEffect_1(task->data[4], dx, dy);
// Update map
PCTurnOnEffect_SetMetatile(task->tIsScreenOn, dx, dy);
DrawWholeMapView();
task->data[4] ^= 1;
if ((++task->data[2]) == 5)
DestroyTask(task->data[1]);
// Screen flickers 5 times. Odd number and starting with the
// 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;
if (isPcTurnedOn)
u16 metatileId = 0;
if (isScreenOn)
{
// Screen is on, set it off
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
tileId = METATILE_Building_PC_Off;
metatileId = METATILE_Building_PC_Off;
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)
tileId = METATILE_BrendansMaysHouse_MayPC_Off;
metatileId = METATILE_BrendansMaysHouse_MayPC_Off;
}
else
{
// Screen is off, set it on
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
tileId = METATILE_Building_PC_On;
metatileId = METATILE_Building_PC_On;
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)
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)
{
PCTurnOffEffect();
@ -1055,7 +1083,9 @@ static void PCTurnOffEffect(void)
{
s8 dx = 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();
if (IsPlayerInFrontOfPC() == FALSE)
@ -1075,13 +1105,15 @@ static void PCTurnOffEffect(void)
dy = -1;
break;
}
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
tileId = METATILE_Building_PC_Off;
metatileId = METATILE_Building_PC_Off;
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)
tileId = METATILE_BrendansMaysHouse_MayPC_Off;
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | MAPGRID_COLLISION_MASK);
metatileId = METATILE_BrendansMaysHouse_MayPC_Off;
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, metatileId | MAPGRID_COLLISION_MASK);
DrawWholeMapView();
}
@ -1090,42 +1122,47 @@ void DoLotteryCornerComputerEffect(void)
if (FuncIsActiveTask(Task_LotteryCornerComputerEffect) != TRUE)
{
u8 taskId = CreateTask(Task_LotteryCornerComputerEffect, 8);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = taskId;
gTasks[taskId].data[2] = 0;
gTasks[taskId].data[3] = 0;
gTasks[taskId].data[4] = 0;
gTasks[taskId].tPaused = FALSE;
gTasks[taskId].tTaskId = taskId;
gTasks[taskId].tFlickerCount = 0;
gTasks[taskId].tTimer = 0;
gTasks[taskId].tIsScreenOn = FALSE;
}
}
static void Task_LotteryCornerComputerEffect(u8 taskId)
{
struct Task *task = &gTasks[taskId];
if (task->data[0] == 0)
if (!task->tPaused)
LotteryCornerComputerEffect(task);
}
static void LotteryCornerComputerEffect(struct Task *task)
{
if (task->data[3] == 6)
if (task->tTimer == 6)
{
task->data[3] = 0;
if (task->data[4] != 0)
task->tTimer = 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, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Normal | MAPGRID_COLLISION_MASK);
}
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, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Flash | MAPGRID_COLLISION_MASK);
}
DrawWholeMapView();
task->data[4] ^= 1;
if ((++task->data[2]) == 5)
DestroyTask(task->data[1]);
// Screen flickers 5 times. Odd number and starting with the
// 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)
@ -1135,6 +1172,12 @@ void EndLotteryCornerComputerEffect(void)
DrawWholeMapView();
}
#undef tPaused
#undef tTaskId
#undef tFlickerCount
#undef tTimer
#undef tIsScreenOn
void SetTrickHouseNuggetFlag(void)
{
u16 *specVar = &gSpecialVar_0x8004;
@ -1219,7 +1262,7 @@ void SpawnCameraObject(void)
OBJ_EVENT_ID_CAMERA,
gSaveBlock1Ptr->pos.x + MAP_OFFSET,
gSaveBlock1Ptr->pos.y + MAP_OFFSET,
3);
3); // elevation
gObjectEvents[obj].invisible = TRUE;
CameraObjectSetFollowedSpriteId(gObjectEvents[obj].spriteId);
}
@ -1384,7 +1427,7 @@ void SetShoalItemFlag(u16 unused)
FlagSet(FLAG_SYS_SHOAL_ITEM);
}
void PutZigzagoonInPlayerParty(void)
void LoadWallyZigzagoon(void)
{
u16 monData;
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;
}
#define horizontalPan data[0]
#define delayCounter data[1]
#define numShakes data[2]
#define delay data[3]
#define verticalPan data[4]
// Task data for Task_ShakeCamera
#define tHorizontalPan data[0]
#define tDelayCounter data[1]
#define tNumShakes data[2]
#define tDelay data[3]
#define tVerticalPan data[4]
void ShakeCamera(void)
{
u8 taskId = CreateTask(Task_ShakeCamera, 9);
gTasks[taskId].horizontalPan = gSpecialVar_0x8005;
gTasks[taskId].delayCounter = 0;
gTasks[taskId].numShakes = gSpecialVar_0x8006;
gTasks[taskId].delay = gSpecialVar_0x8007;
gTasks[taskId].verticalPan = gSpecialVar_0x8004;
gTasks[taskId].tHorizontalPan = gSpecialVar_0x8005;
gTasks[taskId].tDelayCounter = 0;
gTasks[taskId].tNumShakes = gSpecialVar_0x8006;
gTasks[taskId].tDelay = gSpecialVar_0x8007;
gTasks[taskId].tVerticalPan = gSpecialVar_0x8004;
SetCameraPanningCallback(NULL);
PlaySE(SE_M_STRENGTH);
}
@ -1446,15 +1490,15 @@ static void Task_ShakeCamera(u8 taskId)
{
s16 *data = gTasks[taskId].data;
delayCounter++;
if (delayCounter % delay == 0)
tDelayCounter++;
if (tDelayCounter % tDelay == 0)
{
delayCounter = 0;
numShakes--;
horizontalPan = -horizontalPan;
verticalPan = -verticalPan;
SetCameraPanning(horizontalPan, verticalPan);
if (numShakes == 0)
tDelayCounter = 0;
tNumShakes--;
tHorizontalPan = -tHorizontalPan;
tVerticalPan = -tVerticalPan;
SetCameraPanning(tHorizontalPan, tVerticalPan);
if (tNumShakes == 0)
{
StopCameraShake(taskId);
InstallCameraPanAheadCallback();
@ -1468,11 +1512,11 @@ static void StopCameraShake(u8 taskId)
ScriptContext_Enable();
}
#undef horizontalPan
#undef delayCounter
#undef numShakes
#undef delay
#undef verticalPan
#undef tHorizontalPan
#undef tDelayCounter
#undef tNumShakes
#undef tDelay
#undef tVerticalPan
bool8 FoundBlackGlasses(void)
{
@ -1497,7 +1541,8 @@ u8 GetLeadMonIndex(void)
u8 partyCount = CalculatePlayerPartyCount();
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 0;
@ -1637,7 +1682,7 @@ void OffsetCameraForBattle(void)
SetCameraPanning(8, 0);
}
const struct WindowTemplate gElevatorFloor_WindowTemplate =
static const struct WindowTemplate sWindowTemplate_ElevatorFloor =
{
.bg = 0,
.tilemapLeft = 21,
@ -1648,7 +1693,7 @@ const struct WindowTemplate gElevatorFloor_WindowTemplate =
.baseBlock = 8,
};
const u8 *const gDeptStoreFloorNames[] =
static const u8 *const sDeptStoreFloorNames[] =
{
[DEPT_STORE_FLOORNUM_B4F] = gText_B4F,
[DEPT_STORE_FLOORNUM_B3F] = gText_B3F,
@ -1668,7 +1713,7 @@ const u8 *const gDeptStoreFloorNames[] =
[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,
@ -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,
@ -1771,53 +1816,66 @@ u16 GetDeptStoreDefaultFloorChoice(void)
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)
{
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;
u16 floorDelta;
data[1] = 0;
data[2] = 0;
data[4] = 1;
tTimer = 0;
tMoveCounter = 0;
tVerticalPan = 1;
// descending
if (gSpecialVar_0x8005 > gSpecialVar_0x8006)
{
floorDelta = gSpecialVar_0x8005 - gSpecialVar_0x8006;
data[6] = TRUE;
tDescending = TRUE;
}
else
{
floorDelta = gSpecialVar_0x8006 - gSpecialVar_0x8005;
data[6] = FALSE;
tDescending = FALSE;
}
if (floorDelta > 8)
floorDelta = 8;
if (floorDelta > MAX_ELEVATOR_TRIP - 1)
floorDelta = MAX_ELEVATOR_TRIP - 1;
data[5] = sElevatorTripLength[floorDelta];
tTotalMoves = sElevatorTripLength[floorDelta];
SetCameraPanningCallback(NULL);
MoveElevatorWindowLights(floorDelta, data[6]);
MoveElevatorWindowLights(floorDelta, tDescending);
PlaySE(SE_ELEVATOR);
}
static void Task_MoveElevator(u8 taskId)
{
s16 *data = gTasks[taskId].data;
data[1]++;
if (data[1] % 3 == 0)
tTimer++;
if (tTimer % 3 == 0)
{
data[1] = 0;
data[2]++;
data[4] = -data[4];
SetCameraPanning(0, data[4]);
tTimer = 0;
tMoveCounter++;
tVerticalPan = -tVerticalPan;
SetCameraPanning(0, tVerticalPan);
// arrived at floor
if (data[2] == data[5])
if (tMoveCounter == tTotalMoves)
{
// Arrived at floor
PlaySE(SE_DING_DONG);
DestroyTask(taskId);
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)
{
int xPos;
sTutorMoveAndElevatorWindowId = AddWindow(&gElevatorFloor_WindowTemplate);
sTutorMoveAndElevatorWindowId = AddWindow(&sWindowTemplate_ElevatorFloor);
SetStandardWindowBorderStyle(sTutorMoveAndElevatorWindowId, FALSE);
xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gText_ElevatorNowOn, 64);
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, gText_ElevatorNowOn, xPos, 1, TEXT_SKIP_DRAW, NULL);
xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gDeptStoreFloorNames[gSpecialVar_0x8005], 64);
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, gDeptStoreFloorNames[gSpecialVar_0x8005], xPos, 17, TEXT_SKIP_DRAW, NULL);
xPos = GetStringCenterAlignXOffset(FONT_NORMAL, sDeptStoreFloorNames[gSpecialVar_0x8005], 64);
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, sDeptStoreFloorNames[gSpecialVar_0x8005], xPos, 17, TEXT_SKIP_DRAW, NULL);
PutWindowTilemap(sTutorMoveAndElevatorWindowId);
CopyWindowToVram(sTutorMoveAndElevatorWindowId, COPYWIN_FULL);
@ -1849,17 +1913,23 @@ void CloseDeptStoreElevatorWindow(void)
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 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)
{
u8 taskId = CreateTask(Task_MoveElevatorWindowLights, 8);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = descending;
gTasks[taskId].data[3] = sElevatorLightCycles[floorDelta];
gTasks[taskId].tMoveCounter = 0;
gTasks[taskId].tTimer = 0;
gTasks[taskId].tDescending = descending;
gTasks[taskId].tTotalMoves = sElevatorLightCycles[floorDelta];
}
}
@ -1868,36 +1938,41 @@ static void Task_MoveElevatorWindowLights(u8 taskId)
u8 x, y;
s16 *data = gTasks[taskId].data;
if (data[1] == 6)
if (tTimer == 6)
{
data[0]++;
tMoveCounter++;
// ascending
if (data[2] == FALSE)
if (!tDescending)
{
for (y = 0; y < 3; y++)
// Ascending
for (y = 0; y < ELEVATOR_WINDOW_HEIGHT; y++)
{
for (x = 0; x < 3; x++)
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][data[0] % 3] | MAPGRID_COLLISION_MASK);
for (x = 0; x < ELEVATOR_WINDOW_WIDTH; x++)
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][tMoveCounter % ELEVATOR_LIGHT_STAGES] | MAPGRID_COLLISION_MASK);
}
}
// descending
else
{
for (y = 0; y < 3; y++)
// Descending
for (y = 0; y < ELEVATOR_WINDOW_HEIGHT; y++)
{
for (x = 0; x < 3; x++)
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][data[0] % 3] | MAPGRID_COLLISION_MASK);
for (x = 0; x < ELEVATOR_WINDOW_WIDTH; x++)
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][tMoveCounter % ELEVATOR_LIGHT_STAGES] | MAPGRID_COLLISION_MASK);
}
}
DrawWholeMapView();
data[1] = 0;
if (data[0] == data[3])
tTimer = 0;
if (tMoveCounter == tTotalMoves)
DestroyTask(taskId);
}
data[1]++;
tTimer++;
}
#undef tMoveCounter
#undef tTimer
#undef tDescending
#undef tTotalMoves
void BufferVarsForIVRater(void)
{
u8 i;
@ -1959,13 +2034,13 @@ bool8 UsedPokemonCenterWarp(void)
MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F,
MAP_BATTLE_FRONTIER_POKEMON_CENTER_1F,
MAP_UNION_ROOM,
0xFFFF
MAP_UNDEFINED
};
int i;
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)
return TRUE;
@ -2663,21 +2738,21 @@ static void ScrollableMultichoice_UpdateScrollArrows(u8 taskId)
.secondY = 0,
.fullyUpThreshold = 0,
.fullyDownThreshold = 0,
.tileTag = 2000,
.palTag = 100,
.tileTag = GFXTAG_MULTICHOICE_SCROLL_ARROWS,
.palTag = PALTAG_MULTICHOICE_SCROLL_ARROWS,
.palNum = 0
};
struct Task *task = &gTasks[taskId];
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.firstY = 8;
template.secondX = (task->tWidth / 2) * 8 + 12 + (task->tLeft - 1) * 8;
template.secondY = task->tHeight * 8 + 10;
template.fullyUpThreshold = 0;
template.fullyDownThreshold = task->data[1] - task->tMaxItemsOnScreen;
template.fullyDownThreshold = task->tNumItems - task->tMaxItemsOnScreen;
task->tScrollArrowId = AddScrollIndicatorArrowPair(&template, &sScrollableMultichoice_ScrollOffset);
}
}
@ -2685,10 +2760,8 @@ static void ScrollableMultichoice_UpdateScrollArrows(u8 taskId)
static void ScrollableMultichoice_RemoveScrollArrows(u8 taskId)
{
struct Task *task = &gTasks[taskId];
if (task->tMaxItemsOnScreen != task->data[1])
{
if (task->tMaxItemsOnScreen != task->tNumItems)
RemoveScrollIndicatorArrowPair(task->tScrollArrowId);
}
}
// Removed for Emerald (replaced by ShowScrollableMultichoice)
@ -2912,8 +2985,6 @@ void CloseFrontierExchangeCornerItemIconWindow(void)
RemoveWindow(sFrontierExchangeCorner_ItemIconWindowId);
}
#define TAG_ITEM_ICON 5500
static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection)
{
#include "data/battle_frontier/battle_frontier_exchange_corner.h"
@ -3125,12 +3196,14 @@ void ScrollableMultichoice_ClosePersistentMenu(void)
#undef tListTaskId
#undef tTaskId
#define DEOXYS_ROCK_LEVELS 11
void DoDeoxysRockInteraction(void)
{
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_2.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"),
};
static const u8 sDeoxysRockCoords[][2] = {
static const u8 sDeoxysRockCoords[DEOXYS_ROCK_LEVELS][2] = {
{ 15, 12 },
{ 11, 14 },
{ 15, 8 },
@ -3160,11 +3233,11 @@ static const u8 sDeoxysRockCoords[][2] = {
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)
{
gSpecialVar_Result = 3;
gSpecialVar_Result = DEOXYS_ROCK_COMPLETE;
ScriptContext_Enable();
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.
ChangeDeoxysRockLevel(0);
VarSet(VAR_DEOXYS_ROCK_LEVEL, 0);
gSpecialVar_Result = 0;
gSpecialVar_Result = DEOXYS_ROCK_FAILED;
DestroyTask(taskId);
}
else if (rockLevel == 10)
else if (rockLevel == DEOXYS_ROCK_LEVELS - 1)
{
FlagSet(FLAG_DEOXYS_ROCK_COMPLETE);
gSpecialVar_Result = 2;
gSpecialVar_Result = DEOXYS_ROCK_SOLVED;
ScriptContext_Enable();
DestroyTask(taskId);
}
@ -3194,7 +3267,7 @@ static void Task_DeoxysRockInteraction(u8 taskId)
rockLevel++;
ChangeDeoxysRockLevel(rockLevel);
VarSet(VAR_DEOXYS_ROCK_LEVEL, rockLevel);
gSpecialVar_Result = 1;
gSpecialVar_Result = DEOXYS_ROCK_PROGRESSED;
DestroyTask(taskId);
}
}
@ -3207,9 +3280,9 @@ static void ChangeDeoxysRockLevel(u8 rockLevel)
TryGetObjectEventIdByLocalIdAndMap(LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectEventId);
if (rockLevel == 0)
PlaySE(SE_M_CONFUSE_RAY);
PlaySE(SE_M_CONFUSE_RAY); // Failure sound
else
PlaySE(SE_RG_DEOXYS_MOVE);
PlaySE(SE_RG_DEOXYS_MOVE); // Success sound
CreateTask(WaitForDeoxysRockMovement, 8);
gFieldEffectArguments[0] = LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK;
@ -3218,6 +3291,8 @@ static void ChangeDeoxysRockLevel(u8 rockLevel)
gFieldEffectArguments[3] = sDeoxysRockCoords[rockLevel][0];
gFieldEffectArguments[4] = sDeoxysRockCoords[rockLevel][1];
// Set number of movement steps.
// Resetting for failure is slow, successful movement is fast.
if (rockLevel == 0)
gFieldEffectArguments[5] = 60;
else
@ -3735,8 +3810,9 @@ static void Task_CloseBattlePikeCurtain(u8 taskId)
void GetBattlePyramidHint(void)
{
gSpecialVar_Result = gSpecialVar_0x8004 / 7;
gSpecialVar_Result -= (gSpecialVar_Result / 20) * 20;
// gSpecialVar_0x8004 here is expected to be the current Battle Pyramid win streak.
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
@ -3771,13 +3847,13 @@ bool8 InPokemonCenter(void)
MAP_TRADE_CENTER,
MAP_RECORD_CORNER,
MAP_BATTLE_COLOSSEUM_4P,
0xFFFF
MAP_UNDEFINED
};
int i;
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)
return TRUE;

View File

@ -30,6 +30,17 @@
#include "constants/region_map_sections.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.
enum
{
@ -768,7 +779,7 @@ static bool32 InitFrontierPass(void)
CopyBgTilemapBufferToVram(2);
break;
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(GetTextWindowPalette(0), BG_PLTT_ID(15), PLTT_SIZE_4BPP);
DrawFrontierPassBg();
@ -1412,7 +1423,7 @@ static bool32 InitFrontierMap(void)
case 5:
if (FreeTempTileDataBuffersIfPossible())
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);
CopyToBgTilemapBuffer(2, sMapScreen_Tilemap, 0, 0);
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 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 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");

View File

@ -677,7 +677,7 @@ void InitHostRfuGameData(struct RfuGameData *data, u8 activity, bool32 startedAc
data->compatibility.hasNews = FALSE;
data->compatibility.hasCard = 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.gameClear = FlagGet(FLAG_SYS_GAME_CLEAR);
}

View File

@ -503,7 +503,9 @@ static const u8 *const sFemalePresetNames[] = {
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
{
@ -1597,7 +1599,7 @@ static void Task_NewGameBirchSpeech_StartNamingScreen(u8 taskId)
{
FreeAllWindowBuffers();
FreeAndDestroyMonPicSprite(gTasks[taskId].tLotadSpriteId);
NewGameBirchSpeech_SetDefaultPlayerName(Random() % 20);
NewGameBirchSpeech_SetDefaultPlayerName(Random() % NUM_PRESET_NAMES);
DestroyTask(taskId);
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;
}
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;
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 sMapNum data[1]
#define sMapGroup data[2]
#define sData3 data[3]
#define sData4 data[4]
#define sYVelocity data[3]
#define sYOffset data[4]
#define sFldEffId data[7]
u8 FldEff_ExclamationMarkIcon(void)
@ -739,7 +739,7 @@ static void SetIconSpriteData(struct Sprite *sprite, u16 fldEffId, u8 spriteAnim
sprite->sLocalId = gFieldEffectArguments[0];
sprite->sMapNum = gFieldEffectArguments[1];
sprite->sMapGroup = gFieldEffectArguments[2];
sprite->sData3 = -5;
sprite->sYVelocity = -5;
sprite->sFldEffId = fldEffId;
StartSpriteAnim(sprite, spriteAnimNum);
@ -757,23 +757,23 @@ static void SpriteCB_TrainerIcons(struct Sprite *sprite)
else
{
struct Sprite *objEventSprite = &gSprites[gObjectEvents[objEventId].spriteId];
sprite->sData4 += sprite->sData3;
sprite->sYOffset += sprite->sYVelocity;
sprite->x = objEventSprite->x;
sprite->y = objEventSprite->y - 16;
sprite->x2 = objEventSprite->x2;
sprite->y2 = objEventSprite->y2 + sprite->sData4;
if (sprite->sData4)
sprite->sData3++;
sprite->y2 = objEventSprite->y2 + sprite->sYOffset;
if (sprite->sYOffset)
sprite->sYVelocity++;
else
sprite->sData3 = 0;
sprite->sYVelocity = 0;
}
}
#undef sLocalId
#undef sMapNum
#undef sMapGroup
#undef sData3
#undef sData4
#undef sYVelocity
#undef sYOffset
#undef sFldEffId
u8 GetCurrentApproachingTrainerObjectEventId(void)

View File

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

View File

@ -32,7 +32,7 @@ enum {
#define GROUPTYPE_BATTLE 1
#define GROUPTYPE_UNION 2
#define GROUPTYPE_TOTAL 3
#define GROUPTYPE_NONE -1
#define GROUPTYPE_NONE 0xFF
#define NUM_GROUPTYPES 4
struct WirelessCommunicationStatusScreen
@ -126,7 +126,6 @@ static const u8 *const sHeaderTexts[NUM_GROUPTYPES + 1] = {
// Activity, group type, number of players
// 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"
// UB: GROUPTYPE_NONE (-1) can potentially be used as an index into a u8[4] in CountPlayersInGroupAndGetActivity
static const u8 sActivityGroupInfo[][3] = {
{ACTIVITY_BATTLE_SINGLE, 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++)
{
#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 (group_players(i) == 0)