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
17 changed files with 1435 additions and 1361 deletions
+3
View File
@@ -0,0 +1,3 @@
sPlayerToMewDeltaX
sPlayerToMewDeltaY
sMewDirectionCandidates
+1 -1
View File
@@ -327,7 +327,7 @@ gSpecials:: @ 81DBA64
def_special SetUpTrainerMovement def_special SetUpTrainerMovement
def_special DoSealedChamberShakingEffect2 def_special DoSealedChamberShakingEffect2
def_special FoundBlackGlasses def_special FoundBlackGlasses
def_special sub_80AC81C def_special StartDroughtWeatherBlend
def_special DoDiveWarp def_special DoDiveWarp
def_special DoFallWarp def_special DoFallWarp
def_special ShowContestEntryMonPic def_special ShowContestEntryMonPic
-19
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
-19
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
+1 -1
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 show_sprite(u8, u8, u8);
u8 SpawnSpecialEventObjectParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 z); u8 SpawnSpecialEventObjectParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 z);
u8 SpawnSpecialEventObject(struct EventObjectTemplate *); u8 SpawnSpecialEventObject(struct EventObjectTemplate *);
void sub_8093038(s16, s16, s16 *, s16 *); void SetSpritePosToMapCoords(s16, s16, s16 *, s16 *);
void CameraObjectReset1(void); void CameraObjectReset1(void);
void EventObjectSetGraphicsId(struct EventObject *, u8 graphicsId); void EventObjectSetGraphicsId(struct EventObject *, u8 graphicsId);
void EventObjectTurn(struct EventObject *, u8); void EventObjectTurn(struct EventObject *, u8);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef GUARD_FARAWAY_ISLAND_H #ifndef GUARD_FARAWAY_ISLAND_H
#define GUARD_FARAWAY_ISLAND_H #define GUARD_FARAWAY_ISLAND_H
u32 sub_81D427C(void); u32 GetMewMoveDirection(void);
bool8 sub_81D4A58(struct EventObject*); bool8 sub_81D4A58(struct EventObject*);
void UpdateFarawayIslandStepCounter(void); void UpdateFarawayIslandStepCounter(void);
bool8 EventObjectIsFarawayIslandMew(struct EventObject *); bool8 EventObjectIsFarawayIslandMew(struct EventObject *);
+49 -41
View File
@@ -3,6 +3,14 @@
#include "sprite.h" #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. // Controls how the weather should be changing the screen palettes.
enum enum
{ {
@@ -27,18 +35,18 @@ struct Weather
{ {
struct struct
{ {
struct Sprite *rainSprites[24]; struct Sprite *rainSprites[MAX_RAIN_SPRITES];
struct Sprite *snowflakeSprites[101]; struct Sprite *snowflakeSprites[101];
struct Sprite *cloudSprites[3]; struct Sprite *cloudSprites[NUM_CLOUD_SPRITES];
} s1; } s1;
struct struct
{ {
u8 filler0[0xA0]; u8 filler0[0xA0];
struct Sprite *fog1Sprites[20]; struct Sprite *fog1Sprites[NUM_FOG1_SPRITES];
struct Sprite *ashSprites[20]; struct Sprite *ashSprites[NUM_ASH_SPRITES];
struct Sprite *fog2Sprites[20]; struct Sprite *fog2Sprites[NUM_FOG2_SPRITES];
struct Sprite *sandstormSprites1[20]; struct Sprite *sandstormSprites1[NUM_SANDSTORM_SPRITES];
struct Sprite *sandstormSprites2[5]; struct Sprite *sandstormSprites2[NUM_SWIRL_SANDSTORM_SPRITES];
} s2; } s2;
} sprites; } sprites;
u8 gammaShifts[19][32]; u8 gammaShifts[19][32];
@@ -62,57 +70,57 @@ struct Weather
bool8 weatherChangeComplete; bool8 weatherChangeComplete;
u8 weatherPicSpritePalIndex; u8 weatherPicSpritePalIndex;
u8 altGammaSpritePalIndex; u8 altGammaSpritePalIndex;
u16 unknown_6D6; u16 rainSpriteVisibleCounter;
u8 unknown_6D8; u8 curRainSpriteIndex;
u8 unknown_6D9; u8 targetRainSpriteCount;
u8 rainSpriteCount; u8 rainSpriteCount;
u8 unknown_6DB; u8 rainSpriteVisibleDelay;
u8 unknown_6DC; u8 isHeavyRain;
u8 rainStrength; u8 rainStrength;
/*0x6DE*/ u8 cloudSpritesCreated; /*0x6DE*/ u8 cloudSpritesCreated;
u8 filler_6DF[1]; u8 filler_6DF[1];
u16 unknown_6E0; u16 snowflakeVisibleCounter;
u16 unknown_6E2; u16 unknown_6E2;
u8 snowflakeSpriteCount; u8 snowflakeSpriteCount;
u8 unknown_6E5; u8 targetSnowflakeSpriteCount;
u16 unknown_6E6; u16 unknown_6E6;
u16 thunderCounter; u16 thunderCounter;
u8 unknown_6EA; u8 unknown_6EA;
u8 unknown_6EB; u8 unknown_6EB;
u8 unknown_6EC; u8 unknown_6EC;
u8 unknown_6ED; u8 thunderTriggered;
u16 fog1ScrollPosX; u16 fog1ScrollPosX;
u16 unknown_6F0; u16 fog1ScrollCounter;
u16 unknown_6F2; u16 fog1ScrollOffset;
u8 lightenedFogSpritePals[6]; u8 lightenedFogSpritePals[6];
u8 lightenedFogSpritePalsCount; u8 lightenedFogSpritePalsCount;
u8 fog1SpritesCreated; u8 fog1SpritesCreated;
u16 unknown_6FC; u16 ashBaseSpritesX;
u16 unknown_6FE; u16 unknown_6FE;
u8 ashSpritesCreated; u8 ashSpritesCreated;
u8 filler_701[3]; u8 filler_701[3];
u32 unknown_704; u32 sandstormXOffset;
u32 unknown_708; u32 sandstormYOffset;
u8 filler_70C[2]; u8 filler_70C[2];
u16 unknown_70E; u16 sandstormBaseSpritesX;
u16 unknown_710; u16 sandstormPosY;
u16 unknown_712; u16 sandstormWaveIndex;
u16 unknown_714; u16 sandstormWaveCounter;
u8 sandstormSprites1Created; u8 sandstormSpritesCreated;
u8 sandstormSprites2Created; u8 sandstormSwirlSpritesCreated;
u16 unknown_718; u16 fog2BaseSpritesX;
u16 unknown_71A; u16 fog2PosY;
u16 unknown_71C; u16 fog2ScrollXCounter;
u16 unknown_71E; u16 fog2ScrollYCounter;
u16 unknown_720; u16 fog2XOffset;
u16 unknown_722; u16 fog2YOffset;
u8 fog2SpritesCreated; u8 fog2SpritesCreated;
u8 filler_725[1]; u8 filler_725[1];
u16 unknown_726; u16 bubblesDelayCounter;
u16 unknown_728; u16 bubblesDelayIndex;
u16 unknown_72A; u16 bubblesCoordsIndex;
u16 unknown_72C; u16 bubblesSpriteCount;
u8 unknown_72E; u8 bubblesSpritesCreated;
u8 filler_72F; u8 filler_72F;
u16 currBlendEVA; u16 currBlendEVA;
u16 currBlendEVB; u16 currBlendEVB;
@@ -174,10 +182,10 @@ void Clouds_InitVars(void);
void Clouds_Main(void); void Clouds_Main(void);
void Clouds_InitAll(void); void Clouds_InitAll(void);
bool8 Clouds_Finish(void); bool8 Clouds_Finish(void);
void Weather2_InitVars(void); void Sunny_InitVars(void);
void Weather2_Main(void); void Sunny_Main(void);
void Weather2_InitAll(void); void Sunny_InitAll(void);
bool8 Weather2_Finish(void); bool8 Sunny_Finish(void);
void LightRain_InitVars(void); void LightRain_InitVars(void);
void LightRain_Main(void); void LightRain_Main(void);
void LightRain_InitAll(void); void LightRain_InitAll(void);
+36 -36
View File
@@ -25,42 +25,42 @@ EWRAM_DATA static u8 sBraillePuzzleCallbackFlag = 0;
static const u8 gRegicePathCoords[][2] = static const u8 gRegicePathCoords[][2] =
{ {
{0x04, 0x15}, {4, 21},
{0x05, 0x15}, {5, 21},
{0x06, 0x15}, {6, 21},
{0x07, 0x15}, {7, 21},
{0x08, 0x15}, {8, 21},
{0x09, 0x15}, {9, 21},
{0x0a, 0x15}, {10, 21},
{0x0b, 0x15}, {11, 21},
{0x0c, 0x15}, {12, 21},
{0x0c, 0x16}, {12, 22},
{0x0c, 0x17}, {12, 23},
{0x0d, 0x17}, {13, 23},
{0x0d, 0x18}, {13, 24},
{0x0d, 0x19}, {13, 25},
{0x0d, 0x1a}, {13, 26},
{0x0d, 0x1b}, {13, 27},
{0x0c, 0x1b}, {12, 27},
{0x0c, 0x1c}, {12, 28},
{0x04, 0x1d}, {4, 29},
{0x05, 0x1d}, {5, 29},
{0x06, 0x1d}, {6, 29},
{0x07, 0x1d}, {7, 29},
{0x08, 0x1d}, {8, 29},
{0x09, 0x1d}, {9, 29},
{0x0a, 0x1d}, {10, 29},
{0x0b, 0x1d}, {11, 29},
{0x0c, 0x1d}, {12, 29},
{0x04, 0x1c}, {4, 28},
{0x04, 0x1b}, {4, 27},
{0x03, 0x1b}, {3, 27},
{0x03, 0x1a}, {3, 26},
{0x03, 0x19}, {3, 25},
{0x03, 0x18}, {3, 24},
{0x03, 0x17}, {3, 23},
{0x04, 0x17}, {4, 23},
{0x04, 0x16}, {4, 22},
}; };
void SealedChamberShakingEffect(u8); void SealedChamberShakingEffect(u8);
+7 -12
View File
@@ -428,13 +428,12 @@ static void sub_81503E4(u8 taskId)
case WEATHER_ASH: case WEATHER_ASH:
if (gWeatherPtr->sprites.s2.ashSprites[0] != NULL && gWeatherPtr->sprites.s2.ashSprites[0]->oam.priority != 0) 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; gWeatherPtr->sprites.s2.ashSprites[i]->oam.priority = 0;
}
} }
sCableCar->state = 2; sCableCar->state = 2;
} }
break; break;
@@ -445,12 +444,10 @@ static void sub_81503E4(u8 taskId)
} }
else if (sCableCar->timer >= sCableCar->unk4 + 8) else if (sCableCar->timer >= sCableCar->unk4 + 8)
{ {
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]->invisible ^= 1;
gWeatherPtr->sprites.s2.ashSprites[i]->invisible ^= TRUE;
}
} }
} }
break; break;
@@ -466,9 +463,7 @@ static void sub_81503E4(u8 taskId)
break; break;
case 3: case 3:
if (!gPaletteFade.active) if (!gPaletteFade.active)
{
sCableCar->state = 0xFF; sCableCar->state = 0xFF;
}
break; break;
case 0xFF: case 0xFF:
SetVBlankCallback(NULL); SetVBlankCallback(NULL);
@@ -557,7 +552,7 @@ static void sub_8150664(u8 taskId)
if (sCableCar->timer < sCableCar->unk4) if (sCableCar->timer < sCableCar->unk4)
gSpriteCoordOffsetX = (gSpriteCoordOffsetX + 247) % 248; gSpriteCoordOffsetX = (gSpriteCoordOffsetX + 247) % 248;
else else
gWeatherPtr->unknown_6FC = (gWeatherPtr->unknown_6FC + 247) % 248; gWeatherPtr->ashBaseSpritesX = (gWeatherPtr->ashBaseSpritesX + 247) % 248;
} }
static void CableCarVblankCallback(void) static void CableCarVblankCallback(void)
+23 -30
View File
@@ -1949,7 +1949,7 @@ void EventObjectSetGraphicsId(struct EventObject *eventObject, u8 graphicsId)
sprite->oam.paletteNum = paletteSlot; sprite->oam.paletteNum = paletteSlot;
eventObject->inanimate = graphicsInfo->inanimate; eventObject->inanimate = graphicsInfo->inanimate;
eventObject->graphicsId = graphicsId; 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->centerToCornerVecX = -(graphicsInfo->width >> 1);
sprite->centerToCornerVecY = -(graphicsInfo->height >> 1); sprite->centerToCornerVecY = -(graphicsInfo->height >> 1);
sprite->pos1.x += 8; sprite->pos1.x += 8;
@@ -2253,7 +2253,7 @@ void sub_808EB08(struct EventObject *eventObject, s16 x, s16 y)
sprite = &gSprites[eventObject->spriteId]; sprite = &gSprites[eventObject->spriteId];
graphicsInfo = GetEventObjectGraphicsInfo(eventObject->graphicsId); graphicsInfo = GetEventObjectGraphicsInfo(eventObject->graphicsId);
SetEventObjectCoords(eventObject, x, y); 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->centerToCornerVecX = -(graphicsInfo->width >> 1);
sprite->centerToCornerVecY = -(graphicsInfo->height >> 1); sprite->centerToCornerVecY = -(graphicsInfo->height >> 1);
sprite->pos1.x += 8; sprite->pos1.x += 8;
@@ -4414,8 +4414,8 @@ bool8 CopyablePlayerMovement_GoSpeed0(struct EventObject *eventObject, struct Sp
direction = playerDirection; direction = playerDirection;
if (EventObjectIsFarawayIslandMew(eventObject)) if (EventObjectIsFarawayIslandMew(eventObject))
{ {
direction = sub_81D427C(); direction = GetMewMoveDirection();
if (direction == 0) if (direction == DIR_NONE)
{ {
direction = playerDirection; direction = playerDirection;
direction = state_to_direction(gInitialMovementTypeFacingDirections[eventObject->movementType], eventObject->directionSequenceIndex, direction); 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; *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; *destX = (x - gSaveBlock1Ptr->pos.x) << 4;
*dest_y = (y - gSaveBlock1Ptr->pos.y) << 4; *destY = (y - gSaveBlock1Ptr->pos.y) << 4;
*dest_x -= gTotalCameraPixelOffsetX; *destX -= gTotalCameraPixelOffsetX;
*dest_y -= gTotalCameraPixelOffsetY; *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 dx = -gTotalCameraPixelOffsetX - gFieldCamera.x;
s16 dy; s16 dy = -gTotalCameraPixelOffsetY - gFieldCamera.y;
dx = -gTotalCameraPixelOffsetX - gFieldCamera.x;
dy = -gTotalCameraPixelOffsetY - gFieldCamera.y;
if (gFieldCamera.x > 0) if (gFieldCamera.x > 0)
{ dx += 1 << 4;
dx += 0x10;
}
if (gFieldCamera.x < 0) if (gFieldCamera.x < 0)
{ dx -= 1 << 4;
dx -= 0x10;
}
if (gFieldCamera.y > 0) if (gFieldCamera.y > 0)
{ dy += 1 << 4;
dy += 0x10;
}
if (gFieldCamera.y < 0) if (gFieldCamera.y < 0)
{ dy -= 1 << 4;
dy -= 0x10;
} *destX = ((mapX - gSaveBlock1Ptr->pos.x) << 4) + dx;
*dest_x = ((x - gSaveBlock1Ptr->pos.x) << 4) + dx; *destY = ((mapY - gSaveBlock1Ptr->pos.y) << 4) + dy;
*dest_y = ((y - gSaveBlock1Ptr->pos.y) << 4) + dy;
} }
void sub_80930E0(s16 *x, s16 *y, s16 dx, s16 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; *x += dx;
*y += dy; *y += dy;
} }
+66 -65
View File
@@ -17,12 +17,13 @@ static u8 sub_81D4C9C(struct EventObject*, u8);
static u8 sub_81D4C58(struct EventObject*, u8); static u8 sub_81D4C58(struct EventObject*, u8);
static u8 sub_81D4CE0(struct EventObject*, u8); static u8 sub_81D4CE0(struct EventObject*, u8);
static u8 sub_81D4D24(u8); static u8 sub_81D4D24(u8);
static bool8 sub_81D4834(s16, s16); static bool8 CanMewWalkToCoords(s16, s16);
extern u8 gUnknown_0203CF50; static EWRAM_DATA u8 sUnknown_0203CF50 = 0;
extern s16 gUnknown_030012F8;
extern s16 gUnknown_030012FA; static s16 sPlayerToMewDeltaX;
extern u8 gUnknown_030012FC[4]; static s16 sPlayerToMewDeltaY;
static u8 sMewDirectionCandidates[4];
extern const struct SpritePalette gFieldEffectObjectPaletteInfo1; extern const struct SpritePalette gFieldEffectObjectPaletteInfo1;
extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[]; extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[];
@@ -35,23 +36,23 @@ static const s16 sFarawayIslandRockCoords[4][2] =
{20, 20}, {20, 20},
}; };
static u8 sub_81D4258(void) static u8 GetMewEventObjectId(void)
{ {
u8 eventObjectId; u8 eventObjectId;
TryGetEventObjectIdByLocalIdAndMap(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &eventObjectId); TryGetEventObjectIdByLocalIdAndMap(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &eventObjectId);
return eventObjectId; return eventObjectId;
} }
u32 sub_81D427C(void) u32 GetMewMoveDirection(void)
{ {
u8 i; u8 i;
int skip; int skip;
struct EventObject *mew = &gEventObjects[sub_81D4258()]; struct EventObject *mew = &gEventObjects[GetMewEventObjectId()];
gUnknown_030012F8 = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x - mew->currentCoords.x; sPlayerToMewDeltaX = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x - mew->currentCoords.x;
gUnknown_030012FA = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y - mew->currentCoords.y; sPlayerToMewDeltaY = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y - mew->currentCoords.y;
for (i = 0; i < ARRAY_COUNT(gUnknown_030012FC); i++) for (i = 0; i < ARRAY_COUNT(sMewDirectionCandidates); i++)
gUnknown_030012FC[i] = DIR_NONE; sMewDirectionCandidates[i] = DIR_NONE;
if (gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x == gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x if (gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x == gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x
&& gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y == gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y) && gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y == gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y)
@@ -85,33 +86,33 @@ u32 sub_81D427C(void)
if (!skip) if (!skip)
{ {
if (gUnknown_030012F8 > 0) if (sPlayerToMewDeltaX > 0)
{ {
if (mew->currentCoords.x + 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x) 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; return DIR_EAST;
} }
} }
else if (gUnknown_030012F8 < 0) else if (sPlayerToMewDeltaX < 0)
{ {
if (mew->currentCoords.x - 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x) 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; return DIR_WEST;
} }
} }
if (mew->currentCoords.x == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x) 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; return DIR_NORTH;
} }
else else
{ {
if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1)) if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
return DIR_SOUTH; return DIR_SOUTH;
} }
} }
@@ -134,33 +135,33 @@ u32 sub_81D427C(void)
if (!skip) if (!skip)
{ {
if (gUnknown_030012FA > 0) if (sPlayerToMewDeltaY > 0)
{ {
if (mew->currentCoords.y + 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y) 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; return DIR_SOUTH;
} }
} }
else if (gUnknown_030012FA < 0) else if (sPlayerToMewDeltaY < 0)
{ {
if (mew->currentCoords.y - 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y) 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; return DIR_NORTH;
} }
} }
if (mew->currentCoords.y == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y) 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; return DIR_WEST;
} }
else else
{ {
if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y)) if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
return DIR_EAST; return DIR_EAST;
} }
} }
@@ -208,52 +209,52 @@ u32 sub_81D427C(void)
return DIR_WEST; return DIR_WEST;
} }
if (gUnknown_030012FA == 0) if (sPlayerToMewDeltaY == 0)
{ {
if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y > mew->currentCoords.y) 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; return DIR_NORTH;
} }
if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y < mew->currentCoords.y) 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; 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; 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; return DIR_SOUTH;
} }
if (gUnknown_030012F8 == 0) if (sPlayerToMewDeltaX == 0)
{ {
if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x > mew->currentCoords.x) 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; return DIR_WEST;
} }
if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x < mew->currentCoords.x) 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; 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; 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 DIR_WEST;
} }
return sub_81D4890(DIR_NONE); 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 if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x == x
&& gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y == y) && gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y == y)
@@ -268,39 +269,39 @@ static u8 sub_81D4890(u8 ignoredDir)
{ {
u8 i; u8 i;
u8 count = 0; u8 count = 0;
struct EventObject *mew = &gEventObjects[sub_81D4258()]; struct EventObject *mew = &gEventObjects[GetMewEventObjectId()];
for (i = 0; i < ARRAY_COUNT(gUnknown_030012FC); i++) for (i = 0; i < ARRAY_COUNT(sMewDirectionCandidates); i++)
gUnknown_030012FC[i] = DIR_NONE; 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++; 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++; 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++; 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++; count++;
} }
if (count > 1) if (count > 1)
return gUnknown_030012FC[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % count]; return sMewDirectionCandidates[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % count];
else else
return gUnknown_030012FC[0]; return sMewDirectionCandidates[0];
} }
void UpdateFarawayIslandStepCounter(void) void UpdateFarawayIslandStepCounter(void)
@@ -355,7 +356,7 @@ void sub_81D4A90(void)
s16 x; s16 x;
s16 y; s16 y;
u8 spriteId; u8 spriteId;
struct EventObject *mew = &gEventObjects[sub_81D4258()]; struct EventObject *mew = &gEventObjects[GetMewEventObjectId()];
mew->invisible = 0; mew->invisible = 0;
if (gSpecialVar_0x8004 == 1) if (gSpecialVar_0x8004 == 1)
@@ -378,10 +379,10 @@ void sub_81D4A90(void)
x = mew->currentCoords.x; x = mew->currentCoords.x;
y = mew->currentCoords.y; y = mew->currentCoords.y;
sub_80930E0(&x, &y, 8, 8); sub_80930E0(&x, &y, 8, 8);
gUnknown_0203CF50 = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[15], x, y, gSprites[mew->spriteId].subpriority - 1); sUnknown_0203CF50 = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[15], x, y, gSprites[mew->spriteId].subpriority - 1);
if (gUnknown_0203CF50 != MAX_SPRITES) if (sUnknown_0203CF50 != MAX_SPRITES)
{ {
struct Sprite *sprite = &gSprites[gUnknown_0203CF50]; struct Sprite *sprite = &gSprites[sUnknown_0203CF50];
sprite->coordOffsetEnabled = 1; sprite->coordOffsetEnabled = 1;
sprite->oam.priority = 2; sprite->oam.priority = 2;
sprite->callback = SpriteCallbackDummy; sprite->callback = SpriteCallbackDummy;
@@ -391,15 +392,15 @@ void sub_81D4A90(void)
void sub_81D4BEC(void) void sub_81D4BEC(void)
{ {
if (gUnknown_0203CF50 != MAX_SPRITES) if (sUnknown_0203CF50 != MAX_SPRITES)
DestroySprite(&gSprites[gUnknown_0203CF50]); DestroySprite(&gSprites[sUnknown_0203CF50]);
} }
static bool8 sub_81D4C14(struct EventObject *mew, u8 index) 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; return TRUE;
} }
@@ -408,9 +409,9 @@ static bool8 sub_81D4C14(struct EventObject *mew, u8 index)
static u8 sub_81D4C58(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; return TRUE;
} }
@@ -419,9 +420,9 @@ static u8 sub_81D4C58(struct EventObject *mew, u8 index)
static u8 sub_81D4C9C(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; return TRUE;
} }
@@ -430,9 +431,9 @@ static u8 sub_81D4C9C(struct EventObject *mew, u8 index)
static u8 sub_81D4CE0(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; return TRUE;
} }
@@ -441,5 +442,5 @@ static u8 sub_81D4CE0(struct EventObject *mew, u8 index)
static u8 sub_81D4D24(u8 mod) 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];
} }
+1 -1
View File
@@ -191,7 +191,7 @@ void ShowWarpArrowSprite(u8 spriteId, u8 direction, s16 x, s16 y)
sprite = &gSprites[spriteId]; sprite = &gSprites[spriteId];
if (sprite->invisible || sprite->data[0] != x || sprite->data[1] != y) 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 = &gSprites[spriteId];
sprite->pos1.x = x2 + 8; sprite->pos1.x = x2 + 8;
sprite->pos1.y = y2 + 8; sprite->pos1.y = y2 + 8;
+7 -6
View File
@@ -91,7 +91,7 @@ static const struct WeatherCallbacks sWeatherFuncs[] =
{ {
{None_Init, None_Main, None_Init, None_Finish}, {None_Init, None_Main, None_Init, None_Finish},
{Clouds_InitVars, Clouds_Main, Clouds_InitAll, Clouds_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}, {LightRain_InitVars, LightRain_Main, LightRain_InitAll, LightRain_Finish},
{Snow_InitVars, Snow_Main, Snow_InitAll, Snow_Finish}, {Snow_InitVars, Snow_Main, Snow_InitAll, Snow_Finish},
{MedRain_InitVars, Rain_Main, MedRain_InitAll, Rain_Finish}, {MedRain_InitVars, Rain_Main, MedRain_InitAll, Rain_Finish},
@@ -167,15 +167,15 @@ void StartWeather(void)
gWeatherPtr->altGammaSpritePalIndex = index; gWeatherPtr->altGammaSpritePalIndex = index;
gWeatherPtr->weatherPicSpritePalIndex = AllocSpritePalette(0x1201); gWeatherPtr->weatherPicSpritePalIndex = AllocSpritePalette(0x1201);
gWeatherPtr->rainSpriteCount = 0; gWeatherPtr->rainSpriteCount = 0;
gWeatherPtr->unknown_6D8 = 0; gWeatherPtr->curRainSpriteIndex = 0;
gWeatherPtr->cloudSpritesCreated = 0; gWeatherPtr->cloudSpritesCreated = 0;
gWeatherPtr->snowflakeSpriteCount = 0; gWeatherPtr->snowflakeSpriteCount = 0;
gWeatherPtr->ashSpritesCreated = 0; gWeatherPtr->ashSpritesCreated = 0;
gWeatherPtr->fog1SpritesCreated = 0; gWeatherPtr->fog1SpritesCreated = 0;
gWeatherPtr->fog2SpritesCreated = 0; gWeatherPtr->fog2SpritesCreated = 0;
gWeatherPtr->sandstormSprites1Created = 0; gWeatherPtr->sandstormSpritesCreated = 0;
gWeatherPtr->sandstormSprites2Created = 0; gWeatherPtr->sandstormSwirlSpritesCreated = 0;
gWeatherPtr->unknown_72E = 0; gWeatherPtr->bubblesSpritesCreated = 0;
gWeatherPtr->lightenedFogSpritePalsCount = 0; gWeatherPtr->lightenedFogSpritePalsCount = 0;
Weather_SetBlendCoeffs(16, 0); Weather_SetBlendCoeffs(16, 0);
gWeatherPtr->currWeather = 0; gWeatherPtr->currWeather = 0;
@@ -234,7 +234,8 @@ static void Task_WeatherMain(u8 taskId)
{ {
if (gWeatherPtr->currWeather != gWeatherPtr->nextWeather) 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. // Finished cleaning up previous weather. Now transition to next weather.
sWeatherFuncs[gWeatherPtr->nextWeather].initVars(); sWeatherFuncs[gWeatherPtr->nextWeather].initVars();
+1237 -1116
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2960,7 +2960,7 @@ static void InitLinkPlayerEventObjectPos(struct EventObject *eventObj, s16 x, s1
eventObj->currentCoords.y = y; eventObj->currentCoords.y = y;
eventObj->previousCoords.x = x; eventObj->previousCoords.x = x;
eventObj->previousCoords.y = y; 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; eventObj->initialCoords.x += 8;
EventObjectUpdateZCoord(eventObj); EventObjectUpdateZCoord(eventObj);
} }
+1 -8
View File
@@ -89,14 +89,7 @@ gUnknown_030012F2: @ 30012F2
gUnknown_030012F4: @ 30012F4 gUnknown_030012F4: @ 30012F4
.space 0x4 .space 0x4
gUnknown_030012F8: @ 30012F8 .include "src/faraway_island.o"
.space 0x2
gUnknown_030012FA: @ 30012FA
.space 0x2
gUnknown_030012FC: @ 30012FC
.space 0x4
gUnknown_03001300: @ 3001300 gUnknown_03001300: @ 3001300
.space 0x40 .space 0x40
+1 -4
View File
@@ -193,9 +193,6 @@ gUnknown_0203CF44: @ 203CF44
.space 0x4 .space 0x4
.include "src/menu_specialized.o" .include "src/menu_specialized.o"
.include "src/faraway_island.o"
gUnknown_0203CF50: @ 203CF50
.space 0x4
.include "src/trainer_hill.o" .include "src/trainer_hill.o"
.include "src/rayquaza_scene.o" .include "src/rayquaza_scene.o"