summaryrefslogtreecommitdiff
path: root/Fix-Snow-Weather.md
blob: 01d9377f3cabe6fe29a9f2acd886992d3b63e123 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
## Fix Snow Weather

Credit to daniilS for the binary implementation this is based off of

In vanilla emerald (and Fire Red!) the WEATHER_SNOW is broken and will only emit a few snowflakes before stopping. Let's fix it!

For starters, open [src/field_weather_effects.c](../blob/master/src/field_weather_effect.c)

### Increase the number of snowflakes (optional)
If you want to have the snow be heavier (or lighter), find `Snow_InitVars` and edit the line `gWeatherPtr->targetSnowflakeSpriteCount = 16;` to a value of your choosing.

### Stop the snow from disappearing
Find the function `UpdateSnowflakeSprite`, and delete the following code (lines 974-998):
```c
    y = (sprite->pos1.y + sprite->centerToCornerVecY + gSpriteCoordOffsetY) & 0xFF;
    if (y > 163 && y < 171)
    {
        sprite->pos1.y = 250 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY);
        sprite->tPosY = sprite->pos1.y * 128;
        sprite->tFallCounter = 0;
        sprite->tFallDuration = 220;
    }
    else if (y > 242 && y < 250)
    {
        sprite->pos1.y = 163;
        sprite->tPosY = sprite->pos1.y * 128;
        sprite->tFallCounter = 0;
        sprite->tFallDuration = 220;
        sprite->invisible = TRUE;
        sprite->callback = WaitSnowflakeSprite;
    }

    if (++sprite->tFallCounter == sprite->tFallDuration)
    {
        InitSnowflakeSpriteMovement(sprite);
        sprite->pos1.y = 250;
        sprite->invisible = TRUE;
        sprite->callback = WaitSnowflakeSprite;
    }
```

### Fix snow spawning upon returning to the overworld
The snow is spawned based on gSpriteCoordOffsetX/Y, which is not updated until after the weather is initialized. To fix this, open [src/field_weather.c](../blob/master/src/field_weather.c).

1. First, add `#include "field_camera.h"` to the top of the file somewhere.
2. Next, add `UpdateCameraPanning();` before `sWeatherFuncs[gWeatherPtr->currWeather].initAll();` in `Task_WeatherInit`

### Hail on Overworld
Credit to Samu, To allow hail on when snow is present, go to **src/battle_util.c**
Search for `switch (GetCurrentWeather())` (Around line 2908) and input these code below the `WEATHER_DROUGHT` code.
```c
	case WEATHER_SNOW:
	if (!(gBattleWeather & WEATHER_HAIL_ANY))
	{
 		gBattleWeather = WEATHER_HAIL_ANY;
 		gBattleScripting.animArg1 = B_ANIM_HAIL_CONTINUES;
		gBattleScripting.battler = battler;
		effect++;
	}
	break;
```

Then head over to `src/battle_message.c`, search for `const u16 gWeatherContinuesStringIds` and replace the code with :
```c
    STRINGID_ITISRAINING, STRINGID_ITISRAINING, STRINGID_ITISRAINING,
    STRINGID_ITISRAINING, STRINGID_STARTEDHAIL, STRINGID_ITISRAINING,
    STRINGID_ITISRAINING, STRINGID_ITISRAINING, STRINGID_SANDSTORMISRAGING,
    STRINGID_ITISRAINING, STRINGID_ITISRAINING, STRINGID_ITISRAINING,
    STRINGID_SUNLIGHTSTRONG, STRINGID_ITISRAINING, STRINGID_ITISRAINING, STRINGID_ITISRAINING
```