Merge remote-tracking branch 'upstream/master' into document-trade

This commit is contained in:
Marcus Huderle
2019-10-12 15:39:17 -05:00
173 changed files with 6154 additions and 6895 deletions

View File

@@ -1174,7 +1174,7 @@ static void sub_8080018(void)
{
case 0:
sub_8080588();
gLinkType = 0x4422;
gLinkType = LINKTYPE_BERRY_BLENDER;
sBerryBlenderData->field_72 = 0;
for (i = 0; i < BLENDER_MAX_PLAYERS; i++)
{
@@ -1517,7 +1517,7 @@ static void sub_80808D4(void)
sBerryBlenderData->playAgainState = 0;
sBerryBlenderData->loadGfxState = 0;
gLinkType = 0x4422;
gLinkType = LINKTYPE_BERRY_BLENDER;
sBerryBlenderData->mainState++;
break;
case 1:

View File

@@ -45,8 +45,8 @@ static u8 AcroBike_GetJumpDirection(void);
static void Bike_UpdateDirTimerHistory(u8);
static void Bike_UpdateABStartSelectHistory(u8);
static u8 Bike_DPadToDirection(u16);
static u8 get_some_collision(u8);
static u8 Bike_CheckCollisionTryAdvanceCollisionCount(struct EventObject *, s16, s16, u8, u8);
static u8 GetBikeCollision(u8);
static u8 GetBikeCollisionAt(struct EventObject *, s16, s16, u8, u8);
static bool8 IsRunningDisallowedByMetatile(u8);
static void Bike_TryAdvanceCyclingRoadCollisions();
static u8 CanBikeFaceDirOnMetatile(u8, u8);
@@ -214,8 +214,8 @@ static void MachBikeTransition_TrySpeedUp(u8 direction)
}
else
{
collision = get_some_collision(direction);
if (collision > 0 && collision < 12)
collision = GetBikeCollision(direction);
if (collision > 0 && collision < COLLISION_VERTICAL_RAIL)
{
// we hit a solid object, but check to see if its a ledge and then jump.
if (collision == COLLISION_LEDGE_JUMP)
@@ -226,9 +226,9 @@ static void MachBikeTransition_TrySpeedUp(u8 direction)
{
// we hit a solid object that is not a ledge, so perform the collision.
Bike_SetBikeStill();
if (collision == 4 && IsPlayerCollidingWithFarawayIslandMew(direction))
if (collision == COLLISION_EVENT_OBJECT && IsPlayerCollidingWithFarawayIslandMew(direction))
PlayerOnBikeCollideWithFarawayIslandMew(direction);
else if (collision < 5 || collision > 8)
else if (collision < COLLISION_STOP_SURFING || collision > COLLISION_ROTATING_GATE)
PlayerOnBikeCollide(direction);
}
}
@@ -250,9 +250,9 @@ static void MachBikeTransition_TrySlowDown(u8 direction)
if (gPlayerAvatar.bikeSpeed != SPEED_STANDING)
gPlayerAvatar.bikeFrameCounter = --gPlayerAvatar.bikeSpeed;
collision = get_some_collision(direction);
collision = GetBikeCollision(direction);
if (collision > 0 && collision < 12)
if (collision > 0 && collision < COLLISION_VERTICAL_RAIL)
{
if (collision == COLLISION_LEDGE_JUMP)
{
@@ -261,9 +261,9 @@ static void MachBikeTransition_TrySlowDown(u8 direction)
else
{
Bike_SetBikeStill();
if (collision == 4 && IsPlayerCollidingWithFarawayIslandMew(direction))
if (collision == COLLISION_EVENT_OBJECT && IsPlayerCollidingWithFarawayIslandMew(direction))
PlayerOnBikeCollideWithFarawayIslandMew(direction);
else if (collision < 5 || collision > 8)
else if (collision < COLLISION_STOP_SURFING || collision > COLLISION_ROTATING_GATE)
PlayerOnBikeCollide(direction);
}
}
@@ -552,14 +552,14 @@ static void AcroBikeTransition_Moving(u8 direction)
AcroBikeTransition_FaceDirection(playerEventObj->movementDirection);
return;
}
collision = get_some_collision(direction);
if (collision > 0 && collision < 12)
collision = GetBikeCollision(direction);
if (collision > 0 && collision < COLLISION_VERTICAL_RAIL)
{
if (collision == COLLISION_LEDGE_JUMP)
PlayerJumpLedge(direction);
else if (collision == 4 && IsPlayerCollidingWithFarawayIslandMew(direction))
else if (collision == COLLISION_EVENT_OBJECT && IsPlayerCollidingWithFarawayIslandMew(direction))
PlayerOnBikeCollideWithFarawayIslandMew(direction);
else if (collision < 5 || collision > 8)
else if (collision < COLLISION_STOP_SURFING || collision > COLLISION_ROTATING_GATE)
PlayerOnBikeCollide(direction);
}
else
@@ -614,19 +614,19 @@ static void AcroBikeTransition_WheelieHoppingMoving(u8 direction)
AcroBikeTransition_WheelieHoppingStanding(playerEventObj->movementDirection);
return;
}
collision = get_some_collision(direction);
collision = GetBikeCollision(direction);
// TODO: Try to get rid of this goto
if (collision == 0 || collision == 9)
if (collision == 0 || collision == COLLISION_WHEELIE_HOP)
{
goto derp;
}
else if (collision == 6)
else if (collision == COLLISION_LEDGE_JUMP)
{
PlayerLedgeHoppingWheelie(direction);
}
else if (collision < 5 || collision > 8)
else if (collision < COLLISION_STOP_SURFING || collision > COLLISION_ROTATING_GATE)
{
if (collision <= 11)
if (collision < COLLISION_VERTICAL_RAIL)
{
AcroBikeTransition_WheelieHoppingStanding(direction);
}
@@ -643,12 +643,12 @@ static void AcroBikeTransition_SideJump(u8 direction)
u8 collision;
struct EventObject *playerEventObj;
collision = get_some_collision(direction);
if (collision != 0)
collision = GetBikeCollision(direction);
if (collision)
{
if (collision == 7)
if (collision == COLLISION_PUSHED_BOULDER)
return;
if (collision < 10)
if (collision < COLLISION_ISOLATED_VERTICAL_RAIL)
{
AcroBikeTransition_TurnDirection(direction);
return;
@@ -680,18 +680,18 @@ static void AcroBikeTransition_WheelieMoving(u8 direction)
PlayerIdleWheelie(playerEventObj->movementDirection);
return;
}
collision = get_some_collision(direction);
if (collision > 0 && collision < 12)
collision = GetBikeCollision(direction);
if (collision > 0 && collision < COLLISION_VERTICAL_RAIL)
{
if (collision == 6)
if (collision == COLLISION_LEDGE_JUMP)
{
PlayerLedgeHoppingWheelie(direction);
}
else if (collision == 9)
else if (collision == COLLISION_WHEELIE_HOP)
{
PlayerIdleWheelie(direction);
}
else if (collision <= 4)
else if (collision < COLLISION_STOP_SURFING)
{
if (MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior))
PlayerIdleWheelie(direction);
@@ -714,18 +714,18 @@ static void AcroBikeTransition_WheelieRisingMoving(u8 direction)
PlayerStartWheelie(playerEventObj->movementDirection);
return;
}
collision = get_some_collision(direction);
if (collision > 0 && collision < 12)
collision = GetBikeCollision(direction);
if (collision > 0 && collision < COLLISION_VERTICAL_RAIL)
{
if (collision == 6)
if (collision == COLLISION_LEDGE_JUMP)
{
PlayerLedgeHoppingWheelie(direction);
}
else if (collision == 9)
else if (collision == COLLISION_WHEELIE_HOP)
{
PlayerIdleWheelie(direction);
}
else if (collision <= 4)
else if (collision < COLLISION_STOP_SURFING)
{
if (MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior))
PlayerIdleWheelie(direction);
@@ -748,12 +748,12 @@ static void AcroBikeTransition_WheelieLoweringMoving(u8 direction)
PlayerEndWheelie(playerEventObj->movementDirection);
return;
}
collision = get_some_collision(direction);
if (collision > 0 && collision < 12)
collision = GetBikeCollision(direction);
if (collision > 0 && collision < COLLISION_VERTICAL_RAIL)
{
if (collision == 6)
if (collision == COLLISION_LEDGE_JUMP)
PlayerJumpLedge(direction);
else if (collision < 5 || collision > 8)
else if (collision < COLLISION_STOP_SURFING || collision > COLLISION_ROTATING_GATE)
PlayerEndWheelie(direction);
return;
}
@@ -865,29 +865,26 @@ static u8 Bike_DPadToDirection(u16 heldKeys)
return DIR_NONE;
}
static u8 get_some_collision(u8 direction)
static u8 GetBikeCollision(u8 direction)
{
s16 x;
s16 y;
u8 metatitleBehavior;
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
x = playerEventObj->currentCoords.x;
y = playerEventObj->currentCoords.y;
s16 x = playerEventObj->currentCoords.x;
s16 y = playerEventObj->currentCoords.y;
MoveCoords(direction, &x, &y);
metatitleBehavior = MapGridGetMetatileBehaviorAt(x, y);
return Bike_CheckCollisionTryAdvanceCollisionCount(playerEventObj, x, y, direction, metatitleBehavior);
return GetBikeCollisionAt(playerEventObj, x, y, direction, metatitleBehavior);
}
static u8 Bike_CheckCollisionTryAdvanceCollisionCount(struct EventObject *eventObject, s16 x, s16 y, u8 direction, u8 metatitleBehavior)
static u8 GetBikeCollisionAt(struct EventObject *eventObject, s16 x, s16 y, u8 direction, u8 metatitleBehavior)
{
u8 collision = CheckForEventObjectCollision(eventObject, x, y, direction, metatitleBehavior);
if (collision > 4)
if (collision > COLLISION_EVENT_OBJECT)
return collision;
if (collision == 0 && IsRunningDisallowedByMetatile(metatitleBehavior))
collision = 2;
if (collision == COLLISION_NONE && IsRunningDisallowedByMetatile(metatitleBehavior))
collision = COLLISION_IMPASSABLE;
if (collision)
Bike_TryAdvanceCyclingRoadCollisions();
@@ -941,10 +938,10 @@ static bool8 WillPlayerCollideWithCollision(u8 newTileCollision, u8 direction)
{
if (direction == DIR_NORTH || direction == DIR_SOUTH)
{
if (newTileCollision == 10 || newTileCollision == 12)
if (newTileCollision == COLLISION_ISOLATED_VERTICAL_RAIL || newTileCollision == COLLISION_VERTICAL_RAIL)
return FALSE;
}
else if (newTileCollision == 11 || newTileCollision == 13)
else if (newTileCollision == COLLISION_ISOLATED_HORIZONTAL_RAIL || newTileCollision == COLLISION_HORIZONTAL_RAIL)
{
return FALSE;
}

View File

@@ -30,6 +30,8 @@
#include "trainer_card.h"
#include "party_menu.h"
#include "window.h"
#include "constants/battle_frontier.h"
#include "constants/cable_club.h"
#include "constants/songs.h"
static const struct WindowTemplate gUnknown_08550594 = {
@@ -457,7 +459,7 @@ static void task_map_chg_seq_0807EC34(u16 *a0, u32 taskId)
if (*a0 == 1)
{
if (gLinkType == 0x2266 || gLinkType == 0x2277)
if (gLinkType == LINKTYPE_BATTLE_TOWER_50 || gLinkType == LINKTYPE_BATTLE_TOWER_OPEN)
{
if (sub_80B2AF4(trainerCards[0].monSpecies, trainerCards[1].monSpecies))
{
@@ -550,45 +552,42 @@ static bool8 sub_80B2D6C(u8 taskId)
return FALSE;
}
void sub_80B2DA4(u8 arg0)
void TryBattleLinkup(u8 arg0)
{
u8 r3 = 2;
u8 r2 = 2;
switch (gSpecialVar_0x8004)
{
case 1:
case USING_SINGLE_BATTLE:
r3 = 2;
gLinkType = 0x2233;
gLinkType = LINKTYPE_SINGLE_BATTLE;
break;
case 2:
case USING_DOUBLE_BATTLE:
r3 = 2;
gLinkType = 0x2244;
gLinkType = LINKTYPE_DOUBLE_BATTLE;
break;
case 5:
case USING_MULTI_BATTLE:
r3 = 4;
r2 = 4;
gLinkType = 0x2255;
gLinkType = LINKTYPE_MULTI_BATTLE;
break;
case 9:
case USING_BATTLE_TOWER:
r3 = 2;
if (gSaveBlock2Ptr->frontier.lvlMode == 0)
{
gLinkType = 0x2266;
}
if (gSaveBlock2Ptr->frontier.lvlMode == FRONTIER_LVL_50)
gLinkType = LINKTYPE_BATTLE_TOWER_50;
else
{
gLinkType = 0x2277;
}
gLinkType = LINKTYPE_BATTLE_TOWER_OPEN;
break;
}
sub_80B236C(r3, r2);
}
void sub_80B2E4C(void)
void TryTradeLinkup(void)
{
gLinkType = 0x1133;
gLinkType = LINKTYPE_0x1133;
gBattleTypeFlags = 0;
sub_80B236C(2, 2);
}
@@ -596,7 +595,7 @@ void sub_80B2E4C(void)
void sub_80B2E74(void)
{
gSpecialVar_Result = 0;
gLinkType = 0x3311;
gLinkType = LINKTYPE_0x3311;
gBattleTypeFlags = 0;
sub_80B236C(2, 4);
}
@@ -681,21 +680,21 @@ static void sub_80B2EE4(u8 taskId)
void sub_80B2FD8(void)
{
gLinkType = 0x4411;
gLinkType = LINKTYPE_0x4411;
gBattleTypeFlags = 0;
sub_80B236C(2, 4);
}
void sub_80B3000(void)
{
gLinkType = 0x6601;
gLinkType = LINKTYPE_0x6601;
gBattleTypeFlags = 0;
sub_80B236C(4, 4);
}
void sub_80B3028(void)
{
gLinkType = 0x6602;
gLinkType = LINKTYPE_0x6602;
gBattleTypeFlags = 0;
sub_80B236C(2, 4);
}
@@ -707,30 +706,30 @@ u8 sub_80B3050(void)
switch (gSpecialVar_0x8004)
{
case 1:
gLinkType = 0x2233;
case USING_SINGLE_BATTLE:
gLinkType = LINKTYPE_SINGLE_BATTLE;
break;
case 2:
gLinkType = 0x2244;
case USING_DOUBLE_BATTLE:
gLinkType = LINKTYPE_DOUBLE_BATTLE;
break;
case 5:
gLinkType = 0x2255;
case USING_MULTI_BATTLE:
gLinkType = LINKTYPE_MULTI_BATTLE;
break;
case 9:
if (gSaveBlock2Ptr->frontier.lvlMode == 0)
case USING_BATTLE_TOWER:
if (gSaveBlock2Ptr->frontier.lvlMode == FRONTIER_LVL_50)
{
gLinkType = 0x2266;
gLinkType = LINKTYPE_BATTLE_TOWER_50;
}
else
{
gLinkType = 0x2277;
gLinkType = LINKTYPE_BATTLE_TOWER_OPEN;
}
break;
case 3:
gLinkType = 0x1111;
case USING_TRADE_CENTER:
gLinkType = LINKTYPE_0x1111;
break;
case 4:
gLinkType = 0x3322;
case USING_RECORD_CORNER:
gLinkType = LINKTYPE_0x3322;
break;
}
@@ -790,21 +789,21 @@ void sub_80B3254(void)
SaveGame();
}
static void sub_80B3260(int a0)
static void SetLinkBattleTypeFlags(int linkService)
{
switch (a0)
switch (linkService)
{
case 1:
case USING_SINGLE_BATTLE:
gBattleTypeFlags = BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER;
break;
case 2:
case USING_DOUBLE_BATTLE:
gBattleTypeFlags = BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER;
break;
case 5:
case USING_MULTI_BATTLE:
ReducePlayerPartyToSelectedMons();
gBattleTypeFlags = BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER | BATTLE_TYPE_MULTI;
break;
case 9:
case USING_BATTLE_TOWER:
gBattleTypeFlags = BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER | BATTLE_TYPE_MULTI;
break;
}
@@ -818,7 +817,7 @@ static void sub_80B32B4(u8 taskId)
{
case 0:
FadeScreen(1, 0);
gLinkType = 0x2211;
gLinkType = LINKTYPE_BATTLE;
ClearLinkCallback_2();
task->data[0]++;
break;
@@ -845,7 +844,7 @@ static void sub_80B32B4(u8 taskId)
else
PlayMapChosenOrBattleBGM(MUS_BATTLE20);
sub_80B3260(gSpecialVar_0x8004);
SetLinkBattleTypeFlags(gSpecialVar_0x8004);
CleanupOverworldWindowsAndTilemaps();
gTrainerBattleOpponent_A = 0x800;
SetMainCallback2(CB2_InitBattle);
@@ -864,7 +863,7 @@ static void sub_80B33BC(u8 taskId)
{
case 0:
FadeScreen(1, 0);
gLinkType = 0x2211;
gLinkType = LINKTYPE_BATTLE;
ClearLinkCallback_2();
data[0] = 1;
break;
@@ -910,8 +909,8 @@ static void sub_80B33BC(u8 taskId)
else
PlayMapChosenOrBattleBGM(MUS_BATTLE20);
gLinkPlayers[0].linkType = 0x2211;
sub_80B3260(gSpecialVar_0x8004);
gLinkPlayers[0].linkType = LINKTYPE_BATTLE;
SetLinkBattleTypeFlags(gSpecialVar_0x8004);
CleanupOverworldWindowsAndTilemaps();
gTrainerBattleOpponent_A = 0x800;
SetMainCallback2(CB2_InitBattle);
@@ -973,7 +972,7 @@ void sub_80B360C(void)
SavePlayerBag();
sub_813BF10();
if (gSpecialVar_0x8004 == 1 || gSpecialVar_0x8004 == 2)
if (gSpecialVar_0x8004 == USING_SINGLE_BATTLE || gSpecialVar_0x8004 == USING_DOUBLE_BATTLE)
{
UpdatePlayerLinkBattleRecords(gLocalLinkPlayerId ^ 1);
if (gWirelessCommType)
@@ -1004,7 +1003,10 @@ void sub_80B360C(void)
void CleanupLinkRoomState(void)
{
if (gSpecialVar_0x8004 == 1 || gSpecialVar_0x8004 == 2 || gSpecialVar_0x8004 == 5 || gSpecialVar_0x8004 == 9)
if (gSpecialVar_0x8004 == USING_SINGLE_BATTLE
|| gSpecialVar_0x8004 == USING_DOUBLE_BATTLE
|| gSpecialVar_0x8004 == USING_MULTI_BATTLE
|| gSpecialVar_0x8004 == USING_BATTLE_TOWER)
{
LoadPlayerParty();
SavePlayerBag();
@@ -1159,7 +1161,7 @@ void nullsub_37(void)
// Note: VAR_0x8005 is set to the ID of the player spot.
void ColosseumPlayerSpotTriggered(void)
{
gLinkType = 0x2211;
gLinkType = LINKTYPE_BATTLE;
if (gWirelessCommType != 0)
{
@@ -1178,7 +1180,7 @@ static void sub_80B39A4(void)
ScriptContext1_Stop();
}
void sp02A_crash_sound(void)
void Script_ShowLinkTrainerCard(void)
{
ShowTrainerCardInLink(gSpecialVar_0x8006, CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
@@ -1300,6 +1302,6 @@ void sub_80B3BC4(void)
{
if (gWirelessCommType == 0)
{
gLinkType = 0x2288;
gLinkType = LINKTYPE_0x2288;
}
}

View File

@@ -170,8 +170,8 @@ u8 MovementAction_SetFixedPriority_Step0(struct EventObject *, struct Sprite *);
u8 MovementAction_ClearFixedPriority_Step0(struct EventObject *, struct Sprite *);
u8 MovementAction_InitAffineAnim_Step0(struct EventObject *, struct Sprite *);
u8 MovementAction_ClearAffineAnim_Step0(struct EventObject *, struct Sprite *);
u8 MovementAction_Unknown1_Step0(struct EventObject *, struct Sprite *);
u8 MovementAction_Unknown2_Step0(struct EventObject *, struct Sprite *);
u8 MovementAction_HideReflection_Step0(struct EventObject *, struct Sprite *);
u8 MovementAction_ShowReflection_Step0(struct EventObject *, struct Sprite *);
u8 MovementAction_WalkDownStartAffine_Step0(struct EventObject *, struct Sprite *);
u8 MovementAction_WalkDownStartAffine_Step1(struct EventObject *, struct Sprite *);
u8 MovementAction_WalkDownAffine_Step0(struct EventObject *, struct Sprite *);
@@ -358,8 +358,8 @@ u8 (*const gMovementActionFuncs_SetFixedPriority[])(struct EventObject *, struct
u8 (*const gMovementActionFuncs_ClearFixedPriority[])(struct EventObject *, struct Sprite *);
u8 (*const gMovementActionFuncs_InitAffineAnim[])(struct EventObject *, struct Sprite *);
u8 (*const gMovementActionFuncs_ClearAffineAnim[])(struct EventObject *, struct Sprite *);
u8 (*const gMovementActionFuncs_Unknown1[])(struct EventObject *, struct Sprite *);
u8 (*const gMovementActionFuncs_Unknown2[])(struct EventObject *, struct Sprite *);
u8 (*const gMovementActionFuncs_HideReflection[])(struct EventObject *, struct Sprite *);
u8 (*const gMovementActionFuncs_ShowReflection[])(struct EventObject *, struct Sprite *);
u8 (*const gMovementActionFuncs_WalkDownStartAffine[])(struct EventObject *, struct Sprite *);
u8 (*const gMovementActionFuncs_WalkDownAffine[])(struct EventObject *, struct Sprite *);
u8 (*const gMovementActionFuncs_AcroWheelieFaceDown[])(struct EventObject *, struct Sprite *);
@@ -518,8 +518,8 @@ u8 (*const *const gMovementActionFuncs[])(struct EventObject *, struct Sprite *)
[MOVEMENT_ACTION_CLEAR_FIXED_PRIORITY] = gMovementActionFuncs_ClearFixedPriority,
[MOVEMENT_ACTION_INIT_AFFINE_ANIM] = gMovementActionFuncs_InitAffineAnim,
[MOVEMENT_ACTION_CLEAR_AFFINE_ANIM] = gMovementActionFuncs_ClearAffineAnim,
[MOVEMENT_ACTION_UNKNOWN1] = gMovementActionFuncs_Unknown1,
[MOVEMENT_ACTION_UNKNOWN2] = gMovementActionFuncs_Unknown2,
[MOVEMENT_ACTION_HIDE_REFLECTION] = gMovementActionFuncs_HideReflection,
[MOVEMENT_ACTION_SHOW_REFLECTION] = gMovementActionFuncs_ShowReflection,
[MOVEMENT_ACTION_WALK_DOWN_START_AFFINE] = gMovementActionFuncs_WalkDownStartAffine,
[MOVEMENT_ACTION_WALK_DOWN_AFFINE] = gMovementActionFuncs_WalkDownAffine,
[MOVEMENT_ACTION_ACRO_WHEELIE_FACE_DOWN] = gMovementActionFuncs_AcroWheelieFaceDown,
@@ -1197,13 +1197,13 @@ u8 (*const gMovementActionFuncs_ClearAffineAnim[])(struct EventObject *, struct
MovementAction_Finish,
};
u8 (*const gMovementActionFuncs_Unknown1[])(struct EventObject *, struct Sprite *) = {
MovementAction_Unknown1_Step0,
u8 (*const gMovementActionFuncs_HideReflection[])(struct EventObject *, struct Sprite *) = {
MovementAction_HideReflection_Step0,
MovementAction_Finish,
};
u8 (*const gMovementActionFuncs_Unknown2[])(struct EventObject *, struct Sprite *) = {
MovementAction_Unknown2_Step0,
u8 (*const gMovementActionFuncs_ShowReflection[])(struct EventObject *, struct Sprite *) = {
MovementAction_ShowReflection_Step0,
MovementAction_Finish,
};

View File

@@ -245,7 +245,7 @@ static u32 sub_8027DFC(u32 arg0);
static u32 IncrementWithLimit(u32 arg0, u32 arg1);
static u32 Min(u32 arg0, u32 arg1);
static u32 sub_80276C0(u8 arg0);
static void sub_8027ACC(u8 taskId);
static void Task_ShowDodrioBerryPickingRecords(u8 taskId);
static void sub_8029314(u8 taskId);
static void sub_8027BEC(u8 windowId, s32 width);
static void nullsub_15(struct Sprite *sprite);
@@ -2580,7 +2580,7 @@ static u8 sub_8027A48(u8 id)
return gUnknown_02022C98->unk34[id];
}
void sub_8027A5C(void)
void IsDodrioInParty(void)
{
int i;
for (i = 0; i < PARTY_SIZE; i++)
@@ -2588,18 +2588,18 @@ void sub_8027A5C(void)
if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_HAS_SPECIES)
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) == SPECIES_DODRIO)
{
gSpecialVar_Result = 1;
gSpecialVar_Result = TRUE;
return;
}
}
gSpecialVar_Result = 0;
gSpecialVar_Result = FALSE;
}
void sub_8027AAC(void)
void ShowDodrioBerryPickingRecords(void)
{
u8 taskId = CreateTask(sub_8027ACC, 0);
sub_8027ACC(taskId);
u8 taskId = CreateTask(Task_ShowDodrioBerryPickingRecords, 0);
Task_ShowDodrioBerryPickingRecords(taskId);
}
// Data related to printing saved results.
@@ -2621,7 +2621,7 @@ ALIGNED(4)
static const u8 gUnknown_082F7B44[][2] = {{25}, {41}, {57}};
static const u8 gUnknown_082F7B4A[][2] = {{25}, {41}, {73}};
static void sub_8027ACC(u8 taskId)
static void Task_ShowDodrioBerryPickingRecords(u8 taskId)
{
struct WindowTemplate window;
s32 i, width, widthCurr;

View File

@@ -88,7 +88,7 @@ static u8 sub_81D4DE8(struct Unk03006370 *arg0)
static void sub_81D4E30(void)
{
memset(gDecompressionBuffer, 0, 0x2000);
gLinkType = 0x5503;
gLinkType = LINKTYPE_0x5503;
OpenLink();
SetSuppressLinkErrorMessage(TRUE);
}

View File

@@ -108,12 +108,12 @@ void sub_8098524(void)
UnfreezeEventObjects();
}
void sub_8098574(void)
void Script_FacePlayer(void)
{
EventObjectFaceOppositeDirection(&gEventObjects[gSelectedEventObject], gSpecialVar_Facing);
}
void sub_809859C(void)
void Script_ClearHeldMovement(void)
{
EventObjectClearHeldMovementIfActive(&gEventObjects[gSelectedEventObject]);
}

View File

@@ -2723,9 +2723,8 @@ bool8 MovementType_WanderAround_Step4(struct EventObject *eventObject, struct Sp
SetEventObjectDirection(eventObject, chosenDirection);
sprite->data[1] = 5;
if (GetCollisionInDirection(eventObject, chosenDirection))
{
sprite->data[1] = 1;
}
return TRUE;
}
@@ -3093,9 +3092,8 @@ bool8 MovementType_WanderUpAndDown_Step4(struct EventObject *eventObject, struct
SetEventObjectDirection(eventObject, direction);
sprite->data[1] = 5;
if (GetCollisionInDirection(eventObject, direction))
{
sprite->data[1] = 1;
}
return TRUE;
}
@@ -3163,9 +3161,8 @@ bool8 MovementType_WanderLeftAndRight_Step4(struct EventObject *eventObject, str
SetEventObjectDirection(eventObject, direction);
sprite->data[1] = 5;
if (GetCollisionInDirection(eventObject, direction))
{
sprite->data[1] = 1;
}
return TRUE;
}
@@ -3952,7 +3949,7 @@ bool8 MovementType_WalkBackAndForth_Step1(struct EventObject *eventObject, struc
bool8 MovementType_WalkBackAndForth_Step2(struct EventObject *eventObject, struct Sprite *sprite)
{
bool8 collisionState;
bool8 collision;
u8 movementActionId;
if (eventObject->directionSequenceIndex && eventObject->initialCoords.x == eventObject->currentCoords.x && eventObject->initialCoords.y == eventObject->currentCoords.y)
@@ -3960,19 +3957,19 @@ bool8 MovementType_WalkBackAndForth_Step2(struct EventObject *eventObject, struc
eventObject->directionSequenceIndex = 0;
SetEventObjectDirection(eventObject, GetOppositeDirection(eventObject->movementDirection));
}
collisionState = GetCollisionInDirection(eventObject, eventObject->movementDirection);
collision = GetCollisionInDirection(eventObject, eventObject->movementDirection);
movementActionId = GetWalkNormalMovementAction(eventObject->movementDirection);
if (collisionState == TRUE)
if (collision == COLLISION_OUTSIDE_RANGE)
{
eventObject->directionSequenceIndex++;
SetEventObjectDirection(eventObject, GetOppositeDirection(eventObject->movementDirection));
movementActionId = GetWalkNormalMovementAction(eventObject->movementDirection);
collisionState = GetCollisionInDirection(eventObject, eventObject->movementDirection);
collision = GetCollisionInDirection(eventObject, eventObject->movementDirection);
}
if (collisionState)
{
if (collision)
movementActionId = GetWalkInPlaceNormalMovementAction(eventObject->facingDirection);
}
EventObjectSetSingleMovement(eventObject, sprite, movementActionId);
eventObject->singleMovementActive = 1;
sprite->data[1] = 3;
@@ -3998,27 +3995,26 @@ bool8 MovementType_WalkSequence_Step0(struct EventObject *eventObject, struct Sp
bool8 MoveNextDirectionInSequence(struct EventObject *eventObject, struct Sprite *sprite, u8 *route)
{
u8 collisionState;
u8 collision;
u8 movementActionId;
if (eventObject->directionSequenceIndex == 3 && eventObject->initialCoords.x == eventObject->currentCoords.x && eventObject->initialCoords.y == eventObject->currentCoords.y)
{
eventObject->directionSequenceIndex = 0;
}
SetEventObjectDirection(eventObject, route[eventObject->directionSequenceIndex]);
movementActionId = GetWalkNormalMovementAction(eventObject->movementDirection);
collisionState = GetCollisionInDirection(eventObject, eventObject->movementDirection);
if (collisionState == TRUE)
collision = GetCollisionInDirection(eventObject, eventObject->movementDirection);
if (collision == COLLISION_OUTSIDE_RANGE)
{
eventObject->directionSequenceIndex++;
SetEventObjectDirection(eventObject, route[eventObject->directionSequenceIndex]);
movementActionId = GetWalkNormalMovementAction(eventObject->movementDirection);
collisionState = GetCollisionInDirection(eventObject, eventObject->movementDirection);
collision = GetCollisionInDirection(eventObject, eventObject->movementDirection);
}
if (collisionState)
{
if (collision)
movementActionId = GetWalkInPlaceNormalMovementAction(eventObject->facingDirection);
}
EventObjectSetSingleMovement(eventObject, sprite, movementActionId);
eventObject->singleMovementActive = 1;
sprite->data[1] = 2;
@@ -4868,22 +4864,20 @@ static u8 GetCollisionInDirection(struct EventObject *eventObject, u8 direction)
return GetCollisionAtCoords(eventObject, x, y, direction);
}
u8 GetCollisionAtCoords(struct EventObject *eventObject, s16 x, s16 y, u32 dirn)
u8 GetCollisionAtCoords(struct EventObject *eventObject, s16 x, s16 y, u32 dir)
{
u8 direction;
direction = dirn;
u8 direction = dir;
if (IsCoordOutsideEventObjectMovementRange(eventObject, x, y))
return 1;
return COLLISION_OUTSIDE_RANGE;
else if (MapGridIsImpassableAt(x, y) || GetMapBorderIdAt(x, y) == -1 || IsMetatileDirectionallyImpassable(eventObject, x, y, direction))
return 2;
return COLLISION_IMPASSABLE;
else if (eventObject->trackedByCamera && !CanCameraMoveInDirection(direction))
return 2;
return COLLISION_IMPASSABLE;
else if (IsZCoordMismatchAt(eventObject->currentElevation, x, y))
return 3;
return COLLISION_ELEVATION_MISMATCH;
else if (DoesObjectCollideWithObjectAt(eventObject, x, y))
return 4;
return 0;
return COLLISION_EVENT_OBJECT;
return COLLISION_NONE;
}
u8 GetCollisionFlagsAtCoords(struct EventObject *eventObject, s16 x, s16 y, u8 direction)
@@ -6831,15 +6825,15 @@ bool8 MovementAction_ClearAffineAnim_Step0(struct EventObject *eventObject, stru
return TRUE;
}
bool8 MovementAction_Unknown1_Step0(struct EventObject *eventObject, struct Sprite *sprite)
bool8 MovementAction_HideReflection_Step0(struct EventObject *eventObject, struct Sprite *sprite)
{
eventObject->unk3_3 = TRUE;
eventObject->hideReflection = TRUE;
return TRUE;
}
bool8 MovementAction_Unknown2_Step0(struct EventObject *eventObject, struct Sprite *sprite)
bool8 MovementAction_ShowReflection_Step0(struct EventObject *eventObject, struct Sprite *sprite)
{
eventObject->unk3_3 = FALSE;
eventObject->hideReflection = FALSE;
return TRUE;
}

View File

@@ -143,7 +143,7 @@ static void UpdateObjectReflectionSprite(struct Sprite *reflectionSprite)
reflectionSprite->pos2.y = -mainSprite->pos2.y;
reflectionSprite->coordOffsetEnabled = mainSprite->coordOffsetEnabled;
if (eventObject->unk3_3 == TRUE)
if (eventObject->hideReflection == TRUE)
reflectionSprite->invisible = TRUE;
// Check if the reflection is not still.

View File

@@ -71,10 +71,10 @@ static void PlayerNotOnBikeMoving(u8, u16);
static u8 CheckForPlayerAvatarCollision(u8);
static u8 sub_808B028(u8);
static u8 sub_808B164(struct EventObject *, s16, s16, u8, u8);
static bool8 sub_808B1BC(s16, s16, u8);
static bool8 CanStopSurfing(s16, s16, u8);
static bool8 ShouldJumpLedge(s16, s16, u8);
static u8 sub_808B238(s16, s16, u8);
static void check_acro_bike_metatile(s16, s16, u8, u8 *);
static bool8 TryPushBoulder(s16, s16, u8);
static void CheckAcroBikeCollision(s16, s16, u8, u8 *);
static void DoPlayerAvatarTransition(void);
static void PlayerAvatarTransition_Dummy(struct EventObject *a);
@@ -115,9 +115,9 @@ static bool8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *task, struct Event
static bool8 PlayerAvatar_SecretBaseMatSpinStep2(struct Task *task, struct EventObject *eventObject);
static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct EventObject *eventObject);
static void sub_808C750(u8);
static void taskFF_0805D1D4(u8 taskId);
static void sub_808C814(u8 taskId);
static void CreateStopSurfingTask(u8);
static void Task_StopSurfingInit(u8 taskId);
static void Task_WaitStopSurfing(u8 taskId);
static void Task_Fishing(u8 taskId);
static u8 Fishing1(struct Task *task);
@@ -194,7 +194,7 @@ static void (*const gUnknown_08497490[])(u8, u16) =
PlayerNotOnBikeMoving,
};
static bool8 (*const gUnknown_0849749C[])(u8) =
static bool8 (*const sAcroBikeTrickMetatiles[])(u8) =
{
MetatileBehavior_IsBumpySlope,
MetatileBehavior_IsIsolatedVerticalRail,
@@ -203,7 +203,13 @@ static bool8 (*const gUnknown_0849749C[])(u8) =
MetatileBehavior_IsHorizontalRail,
};
static const u8 gUnknown_084974B0[] = {9, 10, 11, 12, 13, 0, 0, 0};
static const u8 sAcroBikeTrickCollisionTypes[] = {
COLLISION_WHEELIE_HOP,
COLLISION_ISOLATED_VERTICAL_RAIL,
COLLISION_ISOLATED_HORIZONTAL_RAIL,
COLLISION_VERTICAL_RAIL,
COLLISION_HORIZONTAL_RAIL,
};
static void (*const gUnknown_084974B8[])(struct EventObject *) =
{
@@ -432,19 +438,19 @@ static bool8 ForcedMovement_None(void)
static u8 DoForcedMovement(u8 direction, void (*b)(u8))
{
struct PlayerAvatar *playerAvatar = &gPlayerAvatar;
u8 collisionType = CheckForPlayerAvatarCollision(direction);
u8 collision = CheckForPlayerAvatarCollision(direction);
playerAvatar->flags |= PLAYER_AVATAR_FLAG_6;
if (collisionType != 0)
if (collision)
{
ForcedMovement_None();
if (collisionType <= 4)
if (collision < COLLISION_STOP_SURFING)
{
return 0;
}
else
{
if (collisionType == COLLISION_LEDGE_JUMP)
if (collision == COLLISION_LEDGE_JUMP)
PlayerJumpLedge(direction);
playerAvatar->flags |= PLAYER_AVATAR_FLAG_6;
playerAvatar->runningState = MOVING;
@@ -605,33 +611,26 @@ static void PlayerNotOnBikeTurningInPlace(u8 direction, u16 heldKeys)
static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys)
{
u8 r0 = CheckForPlayerAvatarCollision(direction);
u8 collision = CheckForPlayerAvatarCollision(direction);
if (r0 != 0)
if (collision)
{
if (r0 == 6)
if (collision == COLLISION_LEDGE_JUMP)
{
PlayerJumpLedge(direction);
return;
}
else if (r0 == 4 && IsPlayerCollidingWithFarawayIslandMew(direction) != 0)
else if (collision == COLLISION_EVENT_OBJECT && IsPlayerCollidingWithFarawayIslandMew(direction))
{
PlayerNotOnBikeCollideWithFarawayIslandMew(direction);
return;
}
else
{
u8 r4 = r0 - 5;
if (r4 > 3)
{
u8 adjustedCollision = collision - COLLISION_STOP_SURFING;
if (adjustedCollision > 3)
PlayerNotOnBikeCollide(direction);
return;
}
else
{
return;
}
return;
}
}
@@ -677,50 +676,49 @@ static u8 sub_808B028(u8 direction)
return sub_808B164(playerEventObj, x, y, direction, MapGridGetMetatileBehaviorAt(x, y));
}
u8 CheckForEventObjectCollision(struct EventObject *a, s16 x, s16 y, u8 direction, u8 e)
u8 CheckForEventObjectCollision(struct EventObject *eventObject, s16 x, s16 y, u8 direction, u8 metatileBehavior)
{
u8 collision;
u8 collision = GetCollisionAtCoords(eventObject, x, y, direction);
if (collision == COLLISION_ELEVATION_MISMATCH && CanStopSurfing(x, y, direction))
return COLLISION_STOP_SURFING;
collision = GetCollisionAtCoords(a, x, y, direction);
if (collision == 3 && sub_808B1BC(x, y, direction))
return 5;
if (ShouldJumpLedge(x, y, direction))
{
IncrementGameStat(GAME_STAT_JUMPED_DOWN_LEDGES);
return COLLISION_LEDGE_JUMP;
}
if (collision == 4 && sub_808B238(x, y, direction))
return 7;
if (collision == COLLISION_EVENT_OBJECT && TryPushBoulder(x, y, direction))
return COLLISION_PUSHED_BOULDER;
if (collision == 0)
if (collision == COLLISION_NONE)
{
if (CheckForRotatingGatePuzzleCollision(direction, x, y))
return 8;
check_acro_bike_metatile(x, y, e, &collision);
return COLLISION_ROTATING_GATE;
CheckAcroBikeCollision(x, y, metatileBehavior, &collision);
}
return collision;
}
static u8 sub_808B164(struct EventObject *a, s16 x, s16 y, u8 direction, u8 e)
static u8 sub_808B164(struct EventObject *eventObject, s16 x, s16 y, u8 direction, u8 metatileBehavior)
{
u8 collision = GetCollisionAtCoords(a, x, y, direction);
u8 collision = GetCollisionAtCoords(eventObject, x, y, direction);
if (collision == 0)
if (collision == COLLISION_NONE)
{
if (CheckForRotatingGatePuzzleCollisionWithoutAnimation(direction, x, y) != 0)
return 8;
check_acro_bike_metatile(x, y, e, &collision);
if (CheckForRotatingGatePuzzleCollisionWithoutAnimation(direction, x, y))
return COLLISION_ROTATING_GATE;
CheckAcroBikeCollision(x, y, metatileBehavior, &collision);
}
return collision;
}
static bool8 sub_808B1BC(s16 x, s16 y, u8 direction)
static bool8 CanStopSurfing(s16 x, s16 y, u8 direction)
{
if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
&& MapGridGetZCoordAt(x, y) == 3
&& GetEventObjectIdByXYZ(x, y, 3) == EVENT_OBJECTS_COUNT)
{
sub_808C750(direction);
CreateStopSurfingTask(direction);
return TRUE;
}
else
@@ -737,7 +735,7 @@ static bool8 ShouldJumpLedge(s16 x, s16 y, u8 z)
return FALSE;
}
static u8 sub_808B238(s16 x, s16 y, u8 direction)
static bool8 TryPushBoulder(s16 x, s16 y, u8 direction)
{
if (FlagGet(FLAG_SYS_USE_STRENGTH))
{
@@ -748,26 +746,26 @@ static u8 sub_808B238(s16 x, s16 y, u8 direction)
x = gEventObjects[eventObjectId].currentCoords.x;
y = gEventObjects[eventObjectId].currentCoords.y;
MoveCoords(direction, &x, &y);
if (GetCollisionAtCoords(&gEventObjects[eventObjectId], x, y, direction) == 0
if (GetCollisionAtCoords(&gEventObjects[eventObjectId], x, y, direction) == COLLISION_NONE
&& MetatileBehavior_IsNonAnimDoor(MapGridGetMetatileBehaviorAt(x, y)) == 0)
{
StartStrengthAnim(eventObjectId, direction);
return 1;
return TRUE;
}
}
}
return 0;
return FALSE;
}
static void check_acro_bike_metatile(s16 unused1, s16 unused2, u8 c, u8 *d)
static void CheckAcroBikeCollision(s16 x, s16 y, u8 metatileBehavior, u8 *collision)
{
u8 i;
for (i = 0; i < 5; i++)
for (i = 0; i < ARRAY_COUNT(sAcroBikeTrickMetatiles); i++)
{
if (gUnknown_0849749C[i](c))
if (sAcroBikeTrickMetatiles[i](metatileBehavior))
{
*d = gUnknown_084974B0[i];
*collision = sAcroBikeTrickCollisionTypes[i];
return;
}
}
@@ -1314,7 +1312,8 @@ bool8 IsPlayerFacingSurfableFishableWater(void)
s16 y = playerEventObj->currentCoords.y;
MoveCoords(playerEventObj->facingDirection, &x, &y);
if (GetCollisionAtCoords(playerEventObj, x, y, playerEventObj->facingDirection) == 3 && PlayerGetZCoord() == 3
if (GetCollisionAtCoords(playerEventObj, x, y, playerEventObj->facingDirection) == COLLISION_ELEVATION_MISMATCH
&& PlayerGetZCoord() == 3
&& MetatileBehavior_IsSurfableFishableWater(MapGridGetMetatileBehaviorAt(x, y)))
return TRUE;
else
@@ -1626,9 +1625,7 @@ static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct Event
return FALSE;
}
/* Some Field effect */
static void sub_808C750(u8 a)
static void CreateStopSurfingTask(u8 direction)
{
u8 taskId;
@@ -1638,12 +1635,12 @@ static void sub_808C750(u8 a)
gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_SURFING;
gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_ON_FOOT;
gPlayerAvatar.preventStep = TRUE;
taskId = CreateTask(taskFF_0805D1D4, 0xFF);
gTasks[taskId].data[0] = a;
taskFF_0805D1D4(taskId);
taskId = CreateTask(Task_StopSurfingInit, 0xFF);
gTasks[taskId].data[0] = direction;
Task_StopSurfingInit(taskId);
}
static void taskFF_0805D1D4(u8 taskId)
static void Task_StopSurfingInit(u8 taskId)
{
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
@@ -1654,10 +1651,10 @@ static void taskFF_0805D1D4(u8 taskId)
}
sub_81555AC(playerEventObj->fieldEffectSpriteId, 2);
EventObjectSetHeldMovement(playerEventObj, GetJumpSpecialMovementAction((u8)gTasks[taskId].data[0]));
gTasks[taskId].func = sub_808C814;
gTasks[taskId].func = Task_WaitStopSurfing;
}
static void sub_808C814(u8 taskId)
static void Task_WaitStopSurfing(u8 taskId)
{
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];

View File

@@ -638,7 +638,7 @@ static void Task_ReturnToWorldFromLinkRoom(u8 taskId)
}
}
void sub_80AF9F8(void)
void ReturnFromLinkRoom(void)
{
CreateTask(Task_ReturnToWorldFromLinkRoom, 10);
}

View File

@@ -3737,12 +3737,11 @@ bool32 IsTrainerRegistered(void)
}
// Always returns FALSE
bool32 sub_813B514(void)
bool32 ShouldDistributeEonTicket(void)
{
if (!VarGet(VAR_ALWAYS_ZERO_0x403F))
{
if (!VarGet(VAR_DISTRIBUTE_EON_TICKET))
return FALSE;
}
return TRUE;
}

File diff suppressed because it is too large Load Diff

View File

@@ -283,7 +283,7 @@ void LinkTestScreen(void)
ResetTasks();
SetVBlankCallback(sub_80096BC);
ResetBlockSend();
gLinkType = 0x1111;
gLinkType = LINKTYPE_0x1111;
OpenLink();
SeedRng(gMain.vblankCounter2);
for (i = 0; i < MAX_LINK_PLAYERS; i++)
@@ -1350,7 +1350,7 @@ bool8 sub_800AA60(void)
{
if (gLinkPlayers[i].trainerId == gSavedLinkPlayers[i].trainerId)
{
if (gLinkType == 0x2288)
if (gLinkType == LINKTYPE_0x2288)
{
if (gLinkType == gLinkPlayers[i].linkType)
{

View File

@@ -4741,7 +4741,7 @@ void sub_8011AFC(void)
SetVBlankCallback(sub_8011AE8);
if (IsWirelessAdapterConnected())
{
gLinkType = 0x1111;
gLinkType = LINKTYPE_0x1111;
sub_800B488();
OpenLink();
SeedRng(gMain.vblankCounter2);

View File

@@ -152,7 +152,7 @@ static void CB2_MysteryEventMenu(void)
if (!IsTextPrinterActive(0))
{
gMain.state++;
gLinkType = 0x5501;
gLinkType = LINKTYPE_0x5501;
OpenLink();
}
break;

View File

@@ -85,9 +85,9 @@
extern const u8 EventScript_WhiteOut[];
extern const u8 EventScript_ResetMrBriney[];
extern const u8 EventScript_DoLinkRoomExit[];
extern const u8 gEventScript_TradeRoom_TooBusyToNotice[];
extern const u8 gEventScript_TradeRoom_ReadTrainerCard_NoColor[];
extern const u8 gEventScript_TradeRoom_ReadTrainerCard_Normal[];
extern const u8 CableClub_EventScript_TooBusyToNotice[];
extern const u8 CableClub_EventScript_ReadTrainerCard[];
extern const u8 CableClub_EventScript_ReadTrainerCardColored[];
extern const u8 EventScript_DoubleBattleColosseum_PlayerSpot0[];
extern const u8 EventScript_DoubleBattleColosseum_PlayerSpot1[];
extern const u8 EventScript_DoubleBattleColosseum_PlayerSpot2[];
@@ -2742,7 +2742,7 @@ static bool32 PlayerIsAtSouthExit(struct TradeRoomPlayer *player)
return FALSE;
else if (!MetatileBehavior_IsSouthArrowWarp(player->field_C))
return FALSE;
else if (player->facing != 1)
else if (player->facing != DIR_SOUTH)
return FALSE;
else
return TRUE;
@@ -2765,13 +2765,13 @@ static const u8 *TryInteractWithPlayer(struct TradeRoomPlayer *player)
if (linkPlayerId != 4)
{
if (!player->isLocalPlayer)
return gEventScript_TradeRoom_TooBusyToNotice;
return CableClub_EventScript_TooBusyToNotice;
else if (sPlayerTradingStates[linkPlayerId] != PLAYER_TRADING_STATE_IDLE)
return gEventScript_TradeRoom_TooBusyToNotice;
return CableClub_EventScript_TooBusyToNotice;
else if (!GetLinkTrainerCardColor(linkPlayerId))
return gEventScript_TradeRoom_ReadTrainerCard_NoColor;
return CableClub_EventScript_ReadTrainerCard;
else
return gEventScript_TradeRoom_ReadTrainerCard_Normal;
return CableClub_EventScript_ReadTrainerCardColored;
}
return GetInteractedLinkPlayerScript(&otherPlayerPos, player->field_C, player->facing);

View File

@@ -240,7 +240,7 @@ static void PartyMenuPrintText(const u8*);
static void sub_81B1B8C(u8);
static void DisplayPartyPokemonHPCheck(struct Pokemon*, struct Struct203CEDC*, u8);
static void DisplayPartyPokemonHPBarCheck(struct Pokemon*, struct Struct203CEDC*);
static bool16 sub_81B2134(struct Pokemon*);
static bool16 IsMonAllowedInPokemonJump(struct Pokemon*);
static bool16 sub_81B2164(struct Pokemon*);
static void sub_81B2248(u8);
static void sub_81B227C(u8);
@@ -3007,7 +3007,7 @@ static void sub_81B209C(void)
if (gSpecialVar_0x8005 == 0)
{
for (i = 0; i < gPlayerPartyCount; i++)
*ptr += sub_81B2134(&gPlayerParty[i]) << i;
*ptr += IsMonAllowedInPokemonJump(&gPlayerParty[i]) << i;
}
else
{
@@ -3017,9 +3017,9 @@ static void sub_81B209C(void)
}
}
static bool16 sub_81B2134(struct Pokemon *mon)
static bool16 IsMonAllowedInPokemonJump(struct Pokemon *mon)
{
if (GetMonData(mon, MON_DATA_IS_EGG) != TRUE && sub_802C908(GetMonData(mon, MON_DATA_SPECIES)))
if (GetMonData(mon, MON_DATA_IS_EGG) != TRUE && IsSpeciesAllowedInPokemonJump(GetMonData(mon, MON_DATA_SPECIES)))
return TRUE;
return FALSE;
}
@@ -6762,7 +6762,7 @@ void sub_81B892C(void)
InitPartyMenu(0, 0, 12, 0, 4, sub_81B1370, CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
void sub_81B8958(void)
void ChooseMonForWirelessMinigame(void)
{
InitPartyMenu(11, 0, 13, 0, 1, sub_81B1370, CB2_ReturnToFieldContinueScriptPlayMapMusic);
}

View File

@@ -5724,9 +5724,9 @@ u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex)
switch (gNatureStatTable[nature][statIndex - 1])
{
case 1:
return (u16)(n * 110) / 100;
return (u16)(n * 110) / 100; // NOTE: will overflow for n > 595 because the intermediate value is cast to u16 before the division. Fix by removing (u16) cast
case -1:
return (u16)(n * 90) / 100;
return (u16)(n * 90) / 100; // NOTE: will overflow for n > 728, see above
}
return n;

View File

@@ -158,7 +158,7 @@ static void sub_802AA60(struct PokemonJump1 *);
static void sub_802AA94(struct PokemonJump1 *);
static void sub_802AB20(void);
static void sub_802AB98(void);
static s16 sub_802AC00(u16 species);
static s16 GetPokemonJumpSpeciesIdx(u16 species);
static void sub_802AC2C(struct PokemonJump1_MonInfo *monInfo, struct Pokemon *mon);
static void sub_802AC6C(void);
static void sub_802ACA0(u8 taskId);
@@ -288,7 +288,7 @@ static void sub_802D598(void);
static void sub_802D5E4(void);
static void sub_802D72C(void);
static void sub_802D688(void);
static void sub_802E3E4(u8 taskId);
static void Task_ShowPokemonJumpRecords(u8 taskId);
static void sub_802E6D0(u8 taskId);
static void sub_802EB98(u8 taskId);
static void sub_802E500(u16 windowId, int width);
@@ -501,7 +501,7 @@ static void sub_802AB20(void)
for (i = 0; i < MAX_RFU_PLAYERS; i++)
{
index = sub_802AC00(gUnknown_02022CFC->unk82A8[i].species);
index = GetPokemonJumpSpeciesIdx(gUnknown_02022CFC->unk82A8[i].species);
gUnknown_02022CFC->unk82E4[i].unkC = gPkmnJumpSpecies[index].unk2;
}
@@ -524,7 +524,7 @@ static void sub_802AB98(void)
}
}
static s16 sub_802AC00(u16 species)
static s16 GetPokemonJumpSpeciesIdx(u16 species)
{
u32 i;
for (i = 0; i < ARRAY_COUNT(gPkmnJumpSpecies); i++)
@@ -533,7 +533,7 @@ static s16 sub_802AC00(u16 species)
return i;
}
return -1;
return -1; // species isnt allowed
}
static void sub_802AC2C(struct PokemonJump1_MonInfo *monInfo, struct Pokemon *mon)
@@ -2204,12 +2204,12 @@ static u8 *sub_802C8E8(u8 multiplayerId)
return gUnknown_02022CFC->unk82E4[multiplayerId].unk1C;
}
bool32 sub_802C908(u16 species)
bool32 IsSpeciesAllowedInPokemonJump(u16 species)
{
return sub_802AC00(species) > -1;
return GetPokemonJumpSpeciesIdx(species) > -1;
}
void sub_802C920(void)
void IsPokemonJumpSpeciesInParty(void)
{
int i;
@@ -2218,15 +2218,15 @@ void sub_802C920(void)
if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_HAS_SPECIES))
{
u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
if (sub_802C908(species))
if (IsSpeciesAllowedInPokemonJump(species))
{
gSpecialVar_Result = 1;
gSpecialVar_Result = TRUE;
return;
}
}
}
gSpecialVar_Result = 0;
gSpecialVar_Result = FALSE;
}
// Large group of data.
@@ -3922,10 +3922,10 @@ static void sub_802E3A8(void)
pokeJump->field6++;
}
void sub_802E3C4(void)
void ShowPokemonJumpRecords(void)
{
u8 taskId = CreateTask(sub_802E3E4, 0);
sub_802E3E4(taskId);
u8 taskId = CreateTask(Task_ShowPokemonJumpRecords, 0);
Task_ShowPokemonJumpRecords(taskId);
}
static const struct WindowTemplate gUnknown_082FE270 =
@@ -3941,7 +3941,7 @@ static const struct WindowTemplate gUnknown_082FE270 =
static const u8 *const gUnknown_082FE278[] = {gText_JumpsInARow, gText_BestScore2, gText_ExcellentsInARow};
static void sub_802E3E4(u8 taskId)
static void Task_ShowPokemonJumpRecords(u8 taskId)
{
struct WindowTemplate window;
int i, width, widthCurr;

View File

@@ -2218,6 +2218,8 @@ bool8 ScrCmd_checkmonobedience(struct ScriptContext *ctx)
return FALSE;
}
// TODO: Should be renamed. Name implies general usage, but its specifically for Wonder Card
// See GetSavedRamScriptIfValid, which is NULL if ValidateReceivedWonderCard returns FALSE
bool8 ScrCmd_gotoram(struct ScriptContext *ctx)
{
const u8* v1 = GetSavedRamScriptIfValid();

View File

@@ -610,7 +610,7 @@ static bool8 CheckPartyMonHasHeldItem(u16 item)
return FALSE;
}
bool8 sub_80F9370(void)
bool8 DoesPartyHaveEnigmaBerry(void)
{
bool8 hasItem = CheckPartyMonHasHeldItem(ITEM_ENIGMA_BERRY);
if (hasItem == TRUE)

View File

@@ -388,7 +388,7 @@ static void CB2_CreateTradeMenu(void)
if (!gReceivedRemoteLinkPlayers)
{
gLinkType = 0x1122;
gLinkType = LINKTYPE_0x1122;
sTradeMenuData->timer = 0;
if (gWirelessCommType)
@@ -2939,7 +2939,7 @@ void CB2_LinkTrade(void)
case 0:
if (!gReceivedRemoteLinkPlayers)
{
gLinkType = 0x1144;
gLinkType = LINKTYPE_0x1144;
CloseLink();
}
sTradeData = AllocZeroed(sizeof(*sTradeData));

View File

@@ -44,6 +44,7 @@
#include "union_room_player_avatar.h"
#include "window.h"
#include "constants/battle_frontier.h"
#include "constants/cable_club.h"
#include "constants/game_stat.h"
#include "constants/maps.h"
#include "constants/rgb.h"
@@ -211,7 +212,7 @@ bool32 sub_80126CC(u32 caseId)
}
}
void BerryBlenderLinkBecomeLeader(void)
void TryBecomeLinkLeader(void)
{
u8 taskId;
struct UnkStruct_Leader *dataPtr;
@@ -793,7 +794,7 @@ u8 sub_8013398(struct UnkStruct_Main0 *arg0)
return ret;
}
void BerryBlenderLinkJoinGroup(void)
void TryJoinLinkGroup(void)
{
u8 taskId;
struct UnkStruct_Group *dataPtr;
@@ -1383,7 +1384,7 @@ void sub_8014210(u16 battleFlags)
HealPlayerParty();
SavePlayerParty();
LoadPlayerBag();
gLinkPlayers[0].linkType = 0x2211;
gLinkPlayers[0].linkType = LINKTYPE_BATTLE;
gLinkPlayers[GetMultiplayerId()].id = GetMultiplayerId();
gLinkPlayers[GetMultiplayerId() ^ 1].id = GetMultiplayerId() ^ 1;
gMain.savedCallback = sub_80B360C;
@@ -1391,18 +1392,18 @@ void sub_8014210(u16 battleFlags)
PlayBattleBGM();
}
void sub_8014290(u16 arg0, u16 x, u16 y)
static void sub_8014290(u16 linkService, u16 x, u16 y)
{
VarSet(VAR_CABLE_CLUB_STATE, arg0);
VarSet(VAR_CABLE_CLUB_STATE, linkService);
SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y);
SetDynamicWarpWithCoords(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y);
WarpIntoMap();
}
void sub_8014304(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 arg4)
void sub_8014304(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 linkService)
{
gSpecialVar_0x8004 = arg4;
VarSet(VAR_CABLE_CLUB_STATE, arg4);
gSpecialVar_0x8004 = linkService;
VarSet(VAR_CABLE_CLUB_STATE, linkService);
gFieldLinkPlayerCount = GetLinkPlayerCount();
gLocalLinkPlayerId = GetMultiplayerId();
SetCableClubWarp();
@@ -1468,7 +1469,7 @@ void sub_801440C(u8 taskId)
HealPlayerParty();
SavePlayerParty();
LoadPlayerBag();
sub_8014304(MAP_GROUP(SINGLE_BATTLE_COLOSSEUM), MAP_NUM(SINGLE_BATTLE_COLOSSEUM), 6, 8, 1);
sub_8014304(MAP_GROUP(SINGLE_BATTLE_COLOSSEUM), MAP_NUM(SINGLE_BATTLE_COLOSSEUM), 6, 8, USING_SINGLE_BATTLE);
SetMainCallback2(sub_8014384);
break;
case 2:
@@ -1477,7 +1478,7 @@ void sub_801440C(u8 taskId)
SavePlayerParty();
LoadPlayerBag();
sub_80143E4(gBlockSendBuffer, TRUE);
sub_8014304(MAP_GROUP(SINGLE_BATTLE_COLOSSEUM), MAP_NUM(SINGLE_BATTLE_COLOSSEUM), 6, 8, 2);
sub_8014304(MAP_GROUP(SINGLE_BATTLE_COLOSSEUM), MAP_NUM(SINGLE_BATTLE_COLOSSEUM), 6, 8, USING_DOUBLE_BATTLE);
SetMainCallback2(sub_8014384);
break;
case 3:
@@ -1486,19 +1487,19 @@ void sub_801440C(u8 taskId)
SavePlayerParty();
LoadPlayerBag();
sub_80143E4(gBlockSendBuffer, TRUE);
sub_8014304(MAP_GROUP(DOUBLE_BATTLE_COLOSSEUM), MAP_NUM(DOUBLE_BATTLE_COLOSSEUM), 5, 8, 5);
sub_8014304(MAP_GROUP(DOUBLE_BATTLE_COLOSSEUM), MAP_NUM(DOUBLE_BATTLE_COLOSSEUM), 5, 8, USING_MULTI_BATTLE);
SetMainCallback2(sub_8014384);
break;
case 4:
sub_80143E4(gBlockSendBuffer, TRUE);
CleanupOverworldWindowsAndTilemaps();
sub_8014304(MAP_GROUP(TRADE_CENTER), MAP_NUM(TRADE_CENTER), 5, 8, 3);
sub_8014304(MAP_GROUP(TRADE_CENTER), MAP_NUM(TRADE_CENTER), 5, 8, USING_TRADE_CENTER);
SetMainCallback2(sub_8014384);
break;
case 15:
sub_80143E4(gBlockSendBuffer, TRUE);
CleanupOverworldWindowsAndTilemaps();
sub_8014304(MAP_GROUP(RECORD_CORNER), MAP_NUM(RECORD_CORNER), 8, 9, 4);
sub_8014304(MAP_GROUP(RECORD_CORNER), MAP_NUM(RECORD_CORNER), 8, 9, USING_RECORD_CORNER);
SetMainCallback2(sub_8014384);
break;
case 68:
@@ -1524,15 +1525,15 @@ void sub_801440C(u8 taskId)
SetMainCallback2(sub_80141A4);
break;
case 9:
sub_8014290(8, 5, 1);
sub_8014290(USING_MINIGAME, 5, 1);
sub_802A9A8(GetCursorSelectionMonId(), CB2_LoadMap);
break;
case 10:
sub_8014290(7, 9, 1);
sub_8014290(USING_BERRY_CRUSH, 9, 1);
sub_8020C70(CB2_LoadMap);
break;
case 11:
sub_8014290(8, 5, 1);
sub_8014290(USING_MINIGAME, 5, 1);
sub_802493C(GetCursorSelectionMonId(), CB2_LoadMap);
break;
}
@@ -1556,7 +1557,7 @@ void sub_8014790(u8 taskId)
{
case 14:
case 28:
gLinkPlayers[0].linkType = 0x2211;
gLinkPlayers[0].linkType = LINKTYPE_BATTLE;
gLinkPlayers[0].id = 0;
gLinkPlayers[1].id = 2;
sendBuff[0] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[0] - 1], MON_DATA_SPECIES);
@@ -3059,14 +3060,14 @@ bool32 sub_80168DC(struct UnkStruct_URoom *arg0)
return TRUE;
}
void sub_8016934(void)
void InitUnionRoom(void)
{
struct UnkStruct_URoom *ptr;
sUnionRoomPlayerName[0] = EOS;
CreateTask(sub_801697C, 0);
gUnknown_02022C30.uRoom = gUnknown_02022C30.uRoom; // Needed to match.
gUnknown_02022C30.uRoom = ptr = AllocZeroed(0x26C);
gUnknown_02022C30.uRoom = ptr = AllocZeroed(sizeof(struct UnkStruct_URoom));
gUnknown_03000DA8 = gUnknown_02022C30.uRoom;
ptr->state = 0;
ptr->textState = 0;