Document somre more weather effects

This commit is contained in:
Marcus Huderle 2019-04-01 20:04:23 -05:00
parent 099ea89b77
commit 35505c7f5b
7 changed files with 582 additions and 543 deletions

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

@ -4,6 +4,9 @@
#include "sprite.h"
#define MAX_RAIN_SPRITES 24
#define NUM_CLOUD_SPRITES 3
#define NUM_FOG_SPRITES 20
#define NUM_ASH_SPRITES 20
// Controls how the weather should be changing the screen palettes.
enum
@ -31,13 +34,13 @@ struct Weather
{
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 *fog1Sprites[NUM_FOG_SPRITES];
struct Sprite *ashSprites[NUM_ASH_SPRITES];
struct Sprite *fog2Sprites[20];
struct Sprite *sandstormSprites1[20];
struct Sprite *sandstormSprites2[5];
@ -66,30 +69,30 @@ struct Weather
u8 altGammaSpritePalIndex;
u16 rainSpriteVisibleCounter;
u8 curRainSpriteIndex;
u8 maxRainSprites;
u8 targetRainSpriteCount;
u8 rainSpriteCount;
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 baseAshSpritesX;
u16 unknown_6FE;
u8 ashSpritesCreated;
u8 filler_701[3];
@ -176,10 +179,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

@ -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;
@ -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

@ -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},

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);
}