mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Document somre more weather effects
This commit is contained in:
parent
099ea89b77
commit
35505c7f5b
@ -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);
|
||||||
|
@ -3,7 +3,10 @@
|
|||||||
|
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
|
|
||||||
#define MAX_RAIN_SPRITES 24
|
#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.
|
// Controls how the weather should be changing the screen palettes.
|
||||||
enum
|
enum
|
||||||
@ -31,13 +34,13 @@ struct Weather
|
|||||||
{
|
{
|
||||||
struct Sprite *rainSprites[MAX_RAIN_SPRITES];
|
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_FOG_SPRITES];
|
||||||
struct Sprite *ashSprites[20];
|
struct Sprite *ashSprites[NUM_ASH_SPRITES];
|
||||||
struct Sprite *fog2Sprites[20];
|
struct Sprite *fog2Sprites[20];
|
||||||
struct Sprite *sandstormSprites1[20];
|
struct Sprite *sandstormSprites1[20];
|
||||||
struct Sprite *sandstormSprites2[5];
|
struct Sprite *sandstormSprites2[5];
|
||||||
@ -66,30 +69,30 @@ struct Weather
|
|||||||
u8 altGammaSpritePalIndex;
|
u8 altGammaSpritePalIndex;
|
||||||
u16 rainSpriteVisibleCounter;
|
u16 rainSpriteVisibleCounter;
|
||||||
u8 curRainSpriteIndex;
|
u8 curRainSpriteIndex;
|
||||||
u8 maxRainSprites;
|
u8 targetRainSpriteCount;
|
||||||
u8 rainSpriteCount;
|
u8 rainSpriteCount;
|
||||||
u8 rainSpriteVisibleDelay;
|
u8 rainSpriteVisibleDelay;
|
||||||
u8 isHeavyRain;
|
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 baseAshSpritesX;
|
||||||
u16 unknown_6FE;
|
u16 unknown_6FE;
|
||||||
u8 ashSpritesCreated;
|
u8 ashSpritesCreated;
|
||||||
u8 filler_701[3];
|
u8 filler_701[3];
|
||||||
@ -176,10 +179,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);
|
||||||
|
@ -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;
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -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},
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user