Merge pull request #655 from huderlem/misc_docs

Document weather effects and some faraway island
This commit is contained in:
huderlem 2019-04-02 18:38:08 -05:00 committed by GitHub
commit 4018017e9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 1435 additions and 1361 deletions

3
common_syms/faraway_island.txt Executable file
View File

@ -0,0 +1,3 @@
sPlayerToMewDeltaX
sPlayerToMewDeltaY
sMewDirectionCandidates

View File

@ -327,7 +327,7 @@ gSpecials:: @ 81DBA64
def_special SetUpTrainerMovement
def_special DoSealedChamberShakingEffect2
def_special FoundBlackGlasses
def_special sub_80AC81C
def_special StartDroughtWeatherBlend
def_special DoDiveWarp
def_special DoFallWarp
def_special ShowContestEntryMonPic

View File

@ -1,19 +0,0 @@
JASC-PAL
0100
16
65 148 255
180 222 255
115 205 246
131 197 255
82 189 246
172 238 246
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

View File

@ -1,19 +0,0 @@
JASC-PAL
0100
16
0 0 0
255 230 139
189 131 74
238 197 123
213 164 98
164 106 49
255 246 164
222 205 164
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

View File

@ -89,7 +89,7 @@ u8 AddPseudoEventObject(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subprio
u8 show_sprite(u8, u8, u8);
u8 SpawnSpecialEventObjectParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 z);
u8 SpawnSpecialEventObject(struct EventObjectTemplate *);
void sub_8093038(s16, s16, s16 *, s16 *);
void SetSpritePosToMapCoords(s16, s16, s16 *, s16 *);
void CameraObjectReset1(void);
void EventObjectSetGraphicsId(struct EventObject *, u8 graphicsId);
void EventObjectTurn(struct EventObject *, u8);

View File

@ -1,7 +1,7 @@
#ifndef GUARD_FARAWAY_ISLAND_H
#define GUARD_FARAWAY_ISLAND_H
u32 sub_81D427C(void);
u32 GetMewMoveDirection(void);
bool8 sub_81D4A58(struct EventObject*);
void UpdateFarawayIslandStepCounter(void);
bool8 EventObjectIsFarawayIslandMew(struct EventObject *);

View File

@ -3,6 +3,14 @@
#include "sprite.h"
#define MAX_RAIN_SPRITES 24
#define NUM_CLOUD_SPRITES 3
#define NUM_FOG1_SPRITES 20
#define NUM_ASH_SPRITES 20
#define NUM_FOG2_SPRITES 20
#define NUM_SANDSTORM_SPRITES 20
#define NUM_SWIRL_SANDSTORM_SPRITES 5
// Controls how the weather should be changing the screen palettes.
enum
{
@ -27,18 +35,18 @@ struct Weather
{
struct
{
struct Sprite *rainSprites[24];
struct Sprite *rainSprites[MAX_RAIN_SPRITES];
struct Sprite *snowflakeSprites[101];
struct Sprite *cloudSprites[3];
struct Sprite *cloudSprites[NUM_CLOUD_SPRITES];
} s1;
struct
{
u8 filler0[0xA0];
struct Sprite *fog1Sprites[20];
struct Sprite *ashSprites[20];
struct Sprite *fog2Sprites[20];
struct Sprite *sandstormSprites1[20];
struct Sprite *sandstormSprites2[5];
struct Sprite *fog1Sprites[NUM_FOG1_SPRITES];
struct Sprite *ashSprites[NUM_ASH_SPRITES];
struct Sprite *fog2Sprites[NUM_FOG2_SPRITES];
struct Sprite *sandstormSprites1[NUM_SANDSTORM_SPRITES];
struct Sprite *sandstormSprites2[NUM_SWIRL_SANDSTORM_SPRITES];
} s2;
} sprites;
u8 gammaShifts[19][32];
@ -62,57 +70,57 @@ struct Weather
bool8 weatherChangeComplete;
u8 weatherPicSpritePalIndex;
u8 altGammaSpritePalIndex;
u16 unknown_6D6;
u8 unknown_6D8;
u8 unknown_6D9;
u16 rainSpriteVisibleCounter;
u8 curRainSpriteIndex;
u8 targetRainSpriteCount;
u8 rainSpriteCount;
u8 unknown_6DB;
u8 unknown_6DC;
u8 rainSpriteVisibleDelay;
u8 isHeavyRain;
u8 rainStrength;
/*0x6DE*/ u8 cloudSpritesCreated;
u8 filler_6DF[1];
u16 unknown_6E0;
u16 snowflakeVisibleCounter;
u16 unknown_6E2;
u8 snowflakeSpriteCount;
u8 unknown_6E5;
u8 targetSnowflakeSpriteCount;
u16 unknown_6E6;
u16 thunderCounter;
u8 unknown_6EA;
u8 unknown_6EB;
u8 unknown_6EC;
u8 unknown_6ED;
u8 thunderTriggered;
u16 fog1ScrollPosX;
u16 unknown_6F0;
u16 unknown_6F2;
u16 fog1ScrollCounter;
u16 fog1ScrollOffset;
u8 lightenedFogSpritePals[6];
u8 lightenedFogSpritePalsCount;
u8 fog1SpritesCreated;
u16 unknown_6FC;
u16 ashBaseSpritesX;
u16 unknown_6FE;
u8 ashSpritesCreated;
u8 filler_701[3];
u32 unknown_704;
u32 unknown_708;
u32 sandstormXOffset;
u32 sandstormYOffset;
u8 filler_70C[2];
u16 unknown_70E;
u16 unknown_710;
u16 unknown_712;
u16 unknown_714;
u8 sandstormSprites1Created;
u8 sandstormSprites2Created;
u16 unknown_718;
u16 unknown_71A;
u16 unknown_71C;
u16 unknown_71E;
u16 unknown_720;
u16 unknown_722;
u16 sandstormBaseSpritesX;
u16 sandstormPosY;
u16 sandstormWaveIndex;
u16 sandstormWaveCounter;
u8 sandstormSpritesCreated;
u8 sandstormSwirlSpritesCreated;
u16 fog2BaseSpritesX;
u16 fog2PosY;
u16 fog2ScrollXCounter;
u16 fog2ScrollYCounter;
u16 fog2XOffset;
u16 fog2YOffset;
u8 fog2SpritesCreated;
u8 filler_725[1];
u16 unknown_726;
u16 unknown_728;
u16 unknown_72A;
u16 unknown_72C;
u8 unknown_72E;
u16 bubblesDelayCounter;
u16 bubblesDelayIndex;
u16 bubblesCoordsIndex;
u16 bubblesSpriteCount;
u8 bubblesSpritesCreated;
u8 filler_72F;
u16 currBlendEVA;
u16 currBlendEVB;
@ -174,10 +182,10 @@ void Clouds_InitVars(void);
void Clouds_Main(void);
void Clouds_InitAll(void);
bool8 Clouds_Finish(void);
void Weather2_InitVars(void);
void Weather2_Main(void);
void Weather2_InitAll(void);
bool8 Weather2_Finish(void);
void Sunny_InitVars(void);
void Sunny_Main(void);
void Sunny_InitAll(void);
bool8 Sunny_Finish(void);
void LightRain_InitVars(void);
void LightRain_Main(void);
void LightRain_InitAll(void);

View File

@ -25,42 +25,42 @@ EWRAM_DATA static u8 sBraillePuzzleCallbackFlag = 0;
static const u8 gRegicePathCoords[][2] =
{
{0x04, 0x15},
{0x05, 0x15},
{0x06, 0x15},
{0x07, 0x15},
{0x08, 0x15},
{0x09, 0x15},
{0x0a, 0x15},
{0x0b, 0x15},
{0x0c, 0x15},
{0x0c, 0x16},
{0x0c, 0x17},
{0x0d, 0x17},
{0x0d, 0x18},
{0x0d, 0x19},
{0x0d, 0x1a},
{0x0d, 0x1b},
{0x0c, 0x1b},
{0x0c, 0x1c},
{0x04, 0x1d},
{0x05, 0x1d},
{0x06, 0x1d},
{0x07, 0x1d},
{0x08, 0x1d},
{0x09, 0x1d},
{0x0a, 0x1d},
{0x0b, 0x1d},
{0x0c, 0x1d},
{0x04, 0x1c},
{0x04, 0x1b},
{0x03, 0x1b},
{0x03, 0x1a},
{0x03, 0x19},
{0x03, 0x18},
{0x03, 0x17},
{0x04, 0x17},
{0x04, 0x16},
{4, 21},
{5, 21},
{6, 21},
{7, 21},
{8, 21},
{9, 21},
{10, 21},
{11, 21},
{12, 21},
{12, 22},
{12, 23},
{13, 23},
{13, 24},
{13, 25},
{13, 26},
{13, 27},
{12, 27},
{12, 28},
{4, 29},
{5, 29},
{6, 29},
{7, 29},
{8, 29},
{9, 29},
{10, 29},
{11, 29},
{12, 29},
{4, 28},
{4, 27},
{3, 27},
{3, 26},
{3, 25},
{3, 24},
{3, 23},
{4, 23},
{4, 22},
};
void SealedChamberShakingEffect(u8);

View File

@ -428,13 +428,12 @@ static void sub_81503E4(u8 taskId)
case WEATHER_ASH:
if (gWeatherPtr->sprites.s2.ashSprites[0] != NULL && gWeatherPtr->sprites.s2.ashSprites[0]->oam.priority != 0)
{
for (; i < 20; i++)
for (; i < NUM_ASH_SPRITES; i++)
{
if (gWeatherPtr->sprites.s2.ashSprites[i] != NULL)
{
if (gWeatherPtr->sprites.s2.ashSprites[i])
gWeatherPtr->sprites.s2.ashSprites[i]->oam.priority = 0;
}
}
sCableCar->state = 2;
}
break;
@ -445,12 +444,10 @@ static void sub_81503E4(u8 taskId)
}
else if (sCableCar->timer >= sCableCar->unk4 + 8)
{
for (; i < 20; i++)
for (; i < NUM_ASH_SPRITES; i++)
{
if (gWeatherPtr->sprites.s2.ashSprites[i] != NULL)
{
gWeatherPtr->sprites.s2.ashSprites[i]->invisible ^= TRUE;
}
if (gWeatherPtr->sprites.s2.ashSprites[i])
gWeatherPtr->sprites.s2.ashSprites[i]->invisible ^= 1;
}
}
break;
@ -466,9 +463,7 @@ static void sub_81503E4(u8 taskId)
break;
case 3:
if (!gPaletteFade.active)
{
sCableCar->state = 0xFF;
}
break;
case 0xFF:
SetVBlankCallback(NULL);
@ -557,7 +552,7 @@ static void sub_8150664(u8 taskId)
if (sCableCar->timer < sCableCar->unk4)
gSpriteCoordOffsetX = (gSpriteCoordOffsetX + 247) % 248;
else
gWeatherPtr->unknown_6FC = (gWeatherPtr->unknown_6FC + 247) % 248;
gWeatherPtr->ashBaseSpritesX = (gWeatherPtr->ashBaseSpritesX + 247) % 248;
}
static void CableCarVblankCallback(void)

View File

@ -1949,7 +1949,7 @@ void EventObjectSetGraphicsId(struct EventObject *eventObject, u8 graphicsId)
sprite->oam.paletteNum = paletteSlot;
eventObject->inanimate = graphicsInfo->inanimate;
eventObject->graphicsId = graphicsId;
sub_8093038(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y);
SetSpritePosToMapCoords(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y);
sprite->centerToCornerVecX = -(graphicsInfo->width >> 1);
sprite->centerToCornerVecY = -(graphicsInfo->height >> 1);
sprite->pos1.x += 8;
@ -2253,7 +2253,7 @@ void sub_808EB08(struct EventObject *eventObject, s16 x, s16 y)
sprite = &gSprites[eventObject->spriteId];
graphicsInfo = GetEventObjectGraphicsInfo(eventObject->graphicsId);
SetEventObjectCoords(eventObject, x, y);
sub_8093038(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y);
SetSpritePosToMapCoords(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y);
sprite->centerToCornerVecX = -(graphicsInfo->width >> 1);
sprite->centerToCornerVecY = -(graphicsInfo->height >> 1);
sprite->pos1.x += 8;
@ -4414,8 +4414,8 @@ bool8 CopyablePlayerMovement_GoSpeed0(struct EventObject *eventObject, struct Sp
direction = playerDirection;
if (EventObjectIsFarawayIslandMew(eventObject))
{
direction = sub_81D427C();
if (direction == 0)
direction = GetMewMoveDirection();
if (direction == DIR_NONE)
{
direction = playerDirection;
direction = state_to_direction(gInitialMovementTypeFacingDirections[eventObject->movementType], eventObject->directionSequenceIndex, direction);
@ -5024,44 +5024,37 @@ static void MoveCoordsInDirection(u32 dir, s16 *x, s16 *y, s16 deltaX, s16 delta
*y -= dy2;
}
void sub_8092FF0(s16 x, s16 y, s16 *dest_x, s16 *dest_y)
void sub_8092FF0(s16 x, s16 y, s16 *destX, s16 *destY)
{
*dest_x = (x - gSaveBlock1Ptr->pos.x) << 4;
*dest_y = (y - gSaveBlock1Ptr->pos.y) << 4;
*dest_x -= gTotalCameraPixelOffsetX;
*dest_y -= gTotalCameraPixelOffsetY;
*destX = (x - gSaveBlock1Ptr->pos.x) << 4;
*destY = (y - gSaveBlock1Ptr->pos.y) << 4;
*destX -= gTotalCameraPixelOffsetX;
*destY -= gTotalCameraPixelOffsetY;
}
void sub_8093038(s16 x, s16 y, s16 *dest_x, s16 *dest_y)
void SetSpritePosToMapCoords(s16 mapX, s16 mapY, s16 *destX, s16 *destY)
{
s16 dx;
s16 dy;
dx = -gTotalCameraPixelOffsetX - gFieldCamera.x;
dy = -gTotalCameraPixelOffsetY - gFieldCamera.y;
s16 dx = -gTotalCameraPixelOffsetX - gFieldCamera.x;
s16 dy = -gTotalCameraPixelOffsetY - gFieldCamera.y;
if (gFieldCamera.x > 0)
{
dx += 0x10;
}
dx += 1 << 4;
if (gFieldCamera.x < 0)
{
dx -= 0x10;
}
dx -= 1 << 4;
if (gFieldCamera.y > 0)
{
dy += 0x10;
}
dy += 1 << 4;
if (gFieldCamera.y < 0)
{
dy -= 0x10;
}
*dest_x = ((x - gSaveBlock1Ptr->pos.x) << 4) + dx;
*dest_y = ((y - gSaveBlock1Ptr->pos.y) << 4) + dy;
dy -= 1 << 4;
*destX = ((mapX - gSaveBlock1Ptr->pos.x) << 4) + dx;
*destY = ((mapY - gSaveBlock1Ptr->pos.y) << 4) + dy;
}
void sub_80930E0(s16 *x, s16 *y, s16 dx, s16 dy)
{
sub_8093038(*x, *y, x, y);
SetSpritePosToMapCoords(*x, *y, x, y);
*x += dx;
*y += dy;
}

View File

@ -17,12 +17,13 @@ static u8 sub_81D4C9C(struct EventObject*, u8);
static u8 sub_81D4C58(struct EventObject*, u8);
static u8 sub_81D4CE0(struct EventObject*, u8);
static u8 sub_81D4D24(u8);
static bool8 sub_81D4834(s16, s16);
static bool8 CanMewWalkToCoords(s16, s16);
extern u8 gUnknown_0203CF50;
extern s16 gUnknown_030012F8;
extern s16 gUnknown_030012FA;
extern u8 gUnknown_030012FC[4];
static EWRAM_DATA u8 sUnknown_0203CF50 = 0;
static s16 sPlayerToMewDeltaX;
static s16 sPlayerToMewDeltaY;
static u8 sMewDirectionCandidates[4];
extern const struct SpritePalette gFieldEffectObjectPaletteInfo1;
extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[];
@ -35,23 +36,23 @@ static const s16 sFarawayIslandRockCoords[4][2] =
{20, 20},
};
static u8 sub_81D4258(void)
static u8 GetMewEventObjectId(void)
{
u8 eventObjectId;
TryGetEventObjectIdByLocalIdAndMap(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &eventObjectId);
return eventObjectId;
}
u32 sub_81D427C(void)
u32 GetMewMoveDirection(void)
{
u8 i;
int skip;
struct EventObject *mew = &gEventObjects[sub_81D4258()];
struct EventObject *mew = &gEventObjects[GetMewEventObjectId()];
gUnknown_030012F8 = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x - mew->currentCoords.x;
gUnknown_030012FA = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y - mew->currentCoords.y;
for (i = 0; i < ARRAY_COUNT(gUnknown_030012FC); i++)
gUnknown_030012FC[i] = DIR_NONE;
sPlayerToMewDeltaX = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x - mew->currentCoords.x;
sPlayerToMewDeltaY = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y - mew->currentCoords.y;
for (i = 0; i < ARRAY_COUNT(sMewDirectionCandidates); i++)
sMewDirectionCandidates[i] = DIR_NONE;
if (gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x == gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x
&& gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y == gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y)
@ -85,33 +86,33 @@ u32 sub_81D427C(void)
if (!skip)
{
if (gUnknown_030012F8 > 0)
if (sPlayerToMewDeltaX > 0)
{
if (mew->currentCoords.x + 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x)
{
if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y))
if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
return DIR_EAST;
}
}
else if (gUnknown_030012F8 < 0)
else if (sPlayerToMewDeltaX < 0)
{
if (mew->currentCoords.x - 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x)
{
if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y))
if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
return DIR_WEST;
}
}
if (mew->currentCoords.x == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x)
{
if (gUnknown_030012FA > 0)
if (sPlayerToMewDeltaY > 0)
{
if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1))
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
return DIR_NORTH;
}
else
{
if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1))
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
return DIR_SOUTH;
}
}
@ -134,33 +135,33 @@ u32 sub_81D427C(void)
if (!skip)
{
if (gUnknown_030012FA > 0)
if (sPlayerToMewDeltaY > 0)
{
if (mew->currentCoords.y + 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y)
{
if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1))
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
return DIR_SOUTH;
}
}
else if (gUnknown_030012FA < 0)
else if (sPlayerToMewDeltaY < 0)
{
if (mew->currentCoords.y - 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y)
{
if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1))
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
return DIR_NORTH;
}
}
if (mew->currentCoords.y == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y)
{
if (gUnknown_030012F8 > 0)
if (sPlayerToMewDeltaX > 0)
{
if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y))
if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
return DIR_WEST;
}
else
{
if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y))
if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
return DIR_EAST;
}
}
@ -208,52 +209,52 @@ u32 sub_81D427C(void)
return DIR_WEST;
}
if (gUnknown_030012FA == 0)
if (sPlayerToMewDeltaY == 0)
{
if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y > mew->currentCoords.y)
{
if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1))
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
return DIR_NORTH;
}
if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y < mew->currentCoords.y)
{
if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1))
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
return DIR_SOUTH;
}
if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1))
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
return DIR_NORTH;
if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1))
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
return DIR_SOUTH;
}
if (gUnknown_030012F8 == 0)
if (sPlayerToMewDeltaX == 0)
{
if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x > mew->currentCoords.x)
{
if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y))
if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
return DIR_WEST;
}
if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x < mew->currentCoords.x)
{
if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y))
if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
return DIR_EAST;
}
if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y))
if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
return DIR_EAST;
if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y))
if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
return DIR_WEST;
}
return sub_81D4890(DIR_NONE);
}
static bool8 sub_81D4834(s16 x, s16 y)
static bool8 CanMewWalkToCoords(s16 x, s16 y)
{
if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x == x
&& gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y == y)
@ -268,39 +269,39 @@ static u8 sub_81D4890(u8 ignoredDir)
{
u8 i;
u8 count = 0;
struct EventObject *mew = &gEventObjects[sub_81D4258()];
struct EventObject *mew = &gEventObjects[GetMewEventObjectId()];
for (i = 0; i < ARRAY_COUNT(gUnknown_030012FC); i++)
gUnknown_030012FC[i] = DIR_NONE;
for (i = 0; i < ARRAY_COUNT(sMewDirectionCandidates); i++)
sMewDirectionCandidates[i] = DIR_NONE;
if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1) == TRUE && ignoredDir != DIR_NORTH)
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1) == TRUE && ignoredDir != DIR_NORTH)
{
gUnknown_030012FC[count] = DIR_NORTH;
sMewDirectionCandidates[count] = DIR_NORTH;
count++;
}
if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_EAST)
if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_EAST)
{
gUnknown_030012FC[count] = DIR_EAST;
sMewDirectionCandidates[count] = DIR_EAST;
count++;
}
if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1) == TRUE && ignoredDir != DIR_SOUTH)
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1) == TRUE && ignoredDir != DIR_SOUTH)
{
gUnknown_030012FC[count] = DIR_SOUTH;
sMewDirectionCandidates[count] = DIR_SOUTH;
count++;
}
if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_WEST)
if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_WEST)
{
gUnknown_030012FC[count] = DIR_WEST;
sMewDirectionCandidates[count] = DIR_WEST;
count++;
}
if (count > 1)
return gUnknown_030012FC[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % count];
return sMewDirectionCandidates[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % count];
else
return gUnknown_030012FC[0];
return sMewDirectionCandidates[0];
}
void UpdateFarawayIslandStepCounter(void)
@ -355,7 +356,7 @@ void sub_81D4A90(void)
s16 x;
s16 y;
u8 spriteId;
struct EventObject *mew = &gEventObjects[sub_81D4258()];
struct EventObject *mew = &gEventObjects[GetMewEventObjectId()];
mew->invisible = 0;
if (gSpecialVar_0x8004 == 1)
@ -378,10 +379,10 @@ void sub_81D4A90(void)
x = mew->currentCoords.x;
y = mew->currentCoords.y;
sub_80930E0(&x, &y, 8, 8);
gUnknown_0203CF50 = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[15], x, y, gSprites[mew->spriteId].subpriority - 1);
if (gUnknown_0203CF50 != MAX_SPRITES)
sUnknown_0203CF50 = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[15], x, y, gSprites[mew->spriteId].subpriority - 1);
if (sUnknown_0203CF50 != MAX_SPRITES)
{
struct Sprite *sprite = &gSprites[gUnknown_0203CF50];
struct Sprite *sprite = &gSprites[sUnknown_0203CF50];
sprite->coordOffsetEnabled = 1;
sprite->oam.priority = 2;
sprite->callback = SpriteCallbackDummy;
@ -391,15 +392,15 @@ void sub_81D4A90(void)
void sub_81D4BEC(void)
{
if (gUnknown_0203CF50 != MAX_SPRITES)
DestroySprite(&gSprites[gUnknown_0203CF50]);
if (sUnknown_0203CF50 != MAX_SPRITES)
DestroySprite(&gSprites[sUnknown_0203CF50]);
}
static bool8 sub_81D4C14(struct EventObject *mew, u8 index)
{
if (gUnknown_030012FA > 0 && sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1))
if (sPlayerToMewDeltaY > 0 && CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
{
gUnknown_030012FC[index] = DIR_NORTH;
sMewDirectionCandidates[index] = DIR_NORTH;
return TRUE;
}
@ -408,9 +409,9 @@ static bool8 sub_81D4C14(struct EventObject *mew, u8 index)
static u8 sub_81D4C58(struct EventObject *mew, u8 index)
{
if (gUnknown_030012F8 < 0 && sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y))
if (sPlayerToMewDeltaX < 0 && CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
{
gUnknown_030012FC[index] = DIR_EAST;
sMewDirectionCandidates[index] = DIR_EAST;
return TRUE;
}
@ -419,9 +420,9 @@ static u8 sub_81D4C58(struct EventObject *mew, u8 index)
static u8 sub_81D4C9C(struct EventObject *mew, u8 index)
{
if (gUnknown_030012FA < 0 && sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1))
if (sPlayerToMewDeltaY < 0 && CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
{
gUnknown_030012FC[index] = DIR_SOUTH;
sMewDirectionCandidates[index] = DIR_SOUTH;
return TRUE;
}
@ -430,9 +431,9 @@ static u8 sub_81D4C9C(struct EventObject *mew, u8 index)
static u8 sub_81D4CE0(struct EventObject *mew, u8 index)
{
if (gUnknown_030012F8 > 0 && sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y))
if (sPlayerToMewDeltaX > 0 && CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
{
gUnknown_030012FC[index] = DIR_WEST;
sMewDirectionCandidates[index] = DIR_WEST;
return TRUE;
}
@ -441,5 +442,5 @@ static u8 sub_81D4CE0(struct EventObject *mew, u8 index)
static u8 sub_81D4D24(u8 mod)
{
return gUnknown_030012FC[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % mod];
return sMewDirectionCandidates[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % mod];
}

View File

@ -191,7 +191,7 @@ void ShowWarpArrowSprite(u8 spriteId, u8 direction, s16 x, s16 y)
sprite = &gSprites[spriteId];
if (sprite->invisible || sprite->data[0] != x || sprite->data[1] != y)
{
sub_8093038(x, y, &x2, &y2);
SetSpritePosToMapCoords(x, y, &x2, &y2);
sprite = &gSprites[spriteId];
sprite->pos1.x = x2 + 8;
sprite->pos1.y = y2 + 8;

View File

@ -91,7 +91,7 @@ static const struct WeatherCallbacks sWeatherFuncs[] =
{
{None_Init, None_Main, None_Init, None_Finish},
{Clouds_InitVars, Clouds_Main, Clouds_InitAll, Clouds_Finish},
{Weather2_InitVars, Weather2_Main, Weather2_InitAll, Weather2_Finish},
{Sunny_InitVars, Sunny_Main, Sunny_InitAll, Sunny_Finish},
{LightRain_InitVars, LightRain_Main, LightRain_InitAll, LightRain_Finish},
{Snow_InitVars, Snow_Main, Snow_InitAll, Snow_Finish},
{MedRain_InitVars, Rain_Main, MedRain_InitAll, Rain_Finish},
@ -167,15 +167,15 @@ void StartWeather(void)
gWeatherPtr->altGammaSpritePalIndex = index;
gWeatherPtr->weatherPicSpritePalIndex = AllocSpritePalette(0x1201);
gWeatherPtr->rainSpriteCount = 0;
gWeatherPtr->unknown_6D8 = 0;
gWeatherPtr->curRainSpriteIndex = 0;
gWeatherPtr->cloudSpritesCreated = 0;
gWeatherPtr->snowflakeSpriteCount = 0;
gWeatherPtr->ashSpritesCreated = 0;
gWeatherPtr->fog1SpritesCreated = 0;
gWeatherPtr->fog2SpritesCreated = 0;
gWeatherPtr->sandstormSprites1Created = 0;
gWeatherPtr->sandstormSprites2Created = 0;
gWeatherPtr->unknown_72E = 0;
gWeatherPtr->sandstormSpritesCreated = 0;
gWeatherPtr->sandstormSwirlSpritesCreated = 0;
gWeatherPtr->bubblesSpritesCreated = 0;
gWeatherPtr->lightenedFogSpritePalsCount = 0;
Weather_SetBlendCoeffs(16, 0);
gWeatherPtr->currWeather = 0;
@ -234,7 +234,8 @@ static void Task_WeatherMain(u8 taskId)
{
if (gWeatherPtr->currWeather != gWeatherPtr->nextWeather)
{
if (!sWeatherFuncs[gWeatherPtr->currWeather].finish() && gWeatherPtr->palProcessingState != WEATHER_PAL_STATE_SCREEN_FADING_OUT)
if (!sWeatherFuncs[gWeatherPtr->currWeather].finish()
&& gWeatherPtr->palProcessingState != WEATHER_PAL_STATE_SCREEN_FADING_OUT)
{
// Finished cleaning up previous weather. Now transition to next weather.
sWeatherFuncs[gWeatherPtr->nextWeather].initVars();

File diff suppressed because it is too large Load Diff

View File

@ -2960,7 +2960,7 @@ static void InitLinkPlayerEventObjectPos(struct EventObject *eventObj, s16 x, s1
eventObj->currentCoords.y = y;
eventObj->previousCoords.x = x;
eventObj->previousCoords.y = y;
sub_8093038(x, y, &eventObj->initialCoords.x, &eventObj->initialCoords.y);
SetSpritePosToMapCoords(x, y, &eventObj->initialCoords.x, &eventObj->initialCoords.y);
eventObj->initialCoords.x += 8;
EventObjectUpdateZCoord(eventObj);
}

View File

@ -89,14 +89,7 @@ gUnknown_030012F2: @ 30012F2
gUnknown_030012F4: @ 30012F4
.space 0x4
gUnknown_030012F8: @ 30012F8
.space 0x2
gUnknown_030012FA: @ 30012FA
.space 0x2
gUnknown_030012FC: @ 30012FC
.space 0x4
.include "src/faraway_island.o"
gUnknown_03001300: @ 3001300
.space 0x40

View File

@ -193,9 +193,6 @@ gUnknown_0203CF44: @ 203CF44
.space 0x4
.include "src/menu_specialized.o"
gUnknown_0203CF50: @ 203CF50
.space 0x4
.include "src/faraway_island.o"
.include "src/trainer_hill.o"
.include "src/rayquaza_scene.o"