• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Development: Weather hacking

Derlo

Tired....
135
Posts
16
Years
Hello, a little question!
Is there any way to mix minisprites [OW] or grass animation to fog to make it better?
I noticed that the OW or its animations overlap or stay under the fog, do not mix.
 
35
Posts
13
Years
  • Seen yesterday
Emerald offsets for 'Three snowflakes' fix:

AB162: 04 1C E1 F7 32 F8 0D 4A D9 21 C9 00 88 5C (Causes game to go black and the player is the only thing on screen. I recommend not changing this one)

AB480: F4 B4 (This is what prevents the screen from going darker)

ABD16: 80 5C 03 28 0D DB 04 28 0B D0 06 28 03 DD 0D 28 07 DC 0B 28 05 DB 01 22 04 E0 (Appears to make no difference in game, so changing the bytes here isn't needed)

ACFA6: 00 (This isn't even needed. You can keep it at the default as it doesn't change anything)

ACFB6: 20 (setting it to this value causes an issue where if you look in your bag and then go back to the overworld, the game takes longer to load and the higher the value, the more time the game takes to load)

AD39E: 4B E0 (Fixes spawning issue with the snowflakes)
 
Last edited:
760
Posts
15
Years
  • Seen yesterday
Hi all,

I would love to implement correct snowy weather in my hack and tried the hex changes mentioned in the first post. It seems to work correctly in first instance, but for some reason the screen is darkened the first time you re-enter the map... (See GIF)
Snow_Problem.gif

Does anyone have a fix for this/ knows how to fix this?
 

BluRose

blu rass
811
Posts
9
Years
let's fix this in pokeruby

source code (src/field_weather_effects.c):
Code:
void sub_807ED48(struct Sprite *sprite)
{
    s16 r3;
    s16 r2;

    sprite->data[0] += sprite->data[1];
    sprite->pos1.y = sprite->data[0] >> 7;
    sprite->data[3] = (sprite->data[3] + sprite->data[2]) & 0xFF;
    sprite->pos2.x = gSineTable[sprite->data[3]] / 64;

    r3 = (sprite->pos1.x + sprite->centerToCornerVecX + gSpriteCoordOffsetX) & 0x1FF;
    if (r3 & 0x100)
        r3 = -0x100 | r3;  // hmm... what is this?
    if (r3 < -3)
        sprite->pos1.x = 242 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX);
    else if (r3 > 242)
        sprite->pos1.x = -3 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX);

    r2 = (sprite->pos1.y + sprite->centerToCornerVecY + gSpriteCoordOffsetY) & 0xFF;
    if (r2 > 163 && r2 < 171)
    {
        sprite->pos1.y = 250 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY);
        sprite->data[0] = sprite->pos1.y * 128;
        sprite->data[5] = 0;
        sprite->data[6] = 220;
    }
    else if (r2 > 242 && r2 < 250)
    {
        sprite->pos1.y = 163;
        sprite->data[0] = sprite->pos1.y * 128;
        sprite->data[5] = 0;
        sprite->data[6] = 220;
        sprite->invisible = TRUE;
        sprite->callback = sub_807ECEC;
    }

    sprite->data[5]++;
    if (sprite->data[5] == sprite->data[6])
    {
        sub_807EC40(sprite);
        sprite->pos1.y = 250;
        sprite->invisible = TRUE;
        sprite->callback = sub_807ECEC;
    }
}
this is responsible for assigning the flakes their position

now, essentially what daniils does with his byte change (the 4B E0) is tell the game to skip over a bunch of the code responsible for "deleting" the snow flake sprites, except it actually just makes them invisible; they're still floating around on the screen ahaha
so the new fix?
Code:
void sub_807ED48(struct Sprite *sprite)
{
    s16 r3;

    sprite->data[0] += sprite->data[1];
    sprite->pos1.y = sprite->data[0] >> 7;
    sprite->data[3] = (sprite->data[3] + sprite->data[2]) & 0xFF;
    sprite->pos2.x = gSineTable[sprite->data[3]] / 64;

    r3 = (sprite->pos1.x + sprite->centerToCornerVecX + gSpriteCoordOffsetX) & 0x1FF;
    if (r3 & 0x100)
        r3 = -0x100 | r3;  // hmm... what is this?
    if (r3 < -3)
        sprite->pos1.x = 242 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX);
    else if (r3 > 242)
        sprite->pos1.x = -3 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX);
}
and that does it
i think what gamefreak wanted to do with the rest was make it so that the snow seemed like it was landing and melting. however, they never made the sprites visible again at the top, so it in essence "deleted" the snow

also, if you want to edit the number of flakes:
Code:
void Snow_InitVars(void)
{
    gWeatherPtr->initStep = 0;
    gWeatherPtr->weatherGfxLoaded = FALSE;
    gWeatherPtr->gammaTargetIndex = 3;
    gWeatherPtr->gammaStepDelay = 20;
    gWeatherPtr->unknown_6E5 = 16; // THIS NUMBER RIGHT HERE, i've put it up to 50 before
    gWeatherPtr->unknown_6E0 = 0;
}
finally, if you want to make it so that the game never fades for snow, head over to field_weather.c: and search for "case WEATHER_SNOW," deleting both instances.
 

AtecainCorp.

Rejishan awake...
1,377
Posts
15
Years
let's fix this in pokeruby

source code (src/field_weather_effects.c):
Code:
void sub_807ED48(struct Sprite *sprite)
{
    s16 r3;
    s16 r2;

    sprite->data[0] += sprite->data[1];
    sprite->pos1.y = sprite->data[0] >> 7;
    sprite->data[3] = (sprite->data[3] + sprite->data[2]) & 0xFF;
    sprite->pos2.x = gSineTable[sprite->data[3]] / 64;

    r3 = (sprite->pos1.x + sprite->centerToCornerVecX + gSpriteCoordOffsetX) & 0x1FF;
    if (r3 & 0x100)
        r3 = -0x100 | r3;  // hmm... what is this?
    if (r3 < -3)
        sprite->pos1.x = 242 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX);
    else if (r3 > 242)
        sprite->pos1.x = -3 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX);

    r2 = (sprite->pos1.y + sprite->centerToCornerVecY + gSpriteCoordOffsetY) & 0xFF;
    if (r2 > 163 && r2 < 171)
    {
        sprite->pos1.y = 250 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY);
        sprite->data[0] = sprite->pos1.y * 128;
        sprite->data[5] = 0;
        sprite->data[6] = 220;
    }
    else if (r2 > 242 && r2 < 250)
    {
        sprite->pos1.y = 163;
        sprite->data[0] = sprite->pos1.y * 128;
        sprite->data[5] = 0;
        sprite->data[6] = 220;
        sprite->invisible = TRUE;
        sprite->callback = sub_807ECEC;
    }

    sprite->data[5]++;
    if (sprite->data[5] == sprite->data[6])
    {
        sub_807EC40(sprite);
        sprite->pos1.y = 250;
        sprite->invisible = TRUE;
        sprite->callback = sub_807ECEC;
    }
}
this is responsible for assigning the flakes their position

now, essentially what daniils does with his byte change (the 4B E0) is tell the game to skip over a bunch of the code responsible for "deleting" the snow flake sprites, except it actually just makes them invisible; they're still floating around on the screen ahaha
so the new fix?
Code:
void sub_807ED48(struct Sprite *sprite)
{
    s16 r3;

    sprite->data[0] += sprite->data[1];
    sprite->pos1.y = sprite->data[0] >> 7;
    sprite->data[3] = (sprite->data[3] + sprite->data[2]) & 0xFF;
    sprite->pos2.x = gSineTable[sprite->data[3]] / 64;

    r3 = (sprite->pos1.x + sprite->centerToCornerVecX + gSpriteCoordOffsetX) & 0x1FF;
    if (r3 & 0x100)
        r3 = -0x100 | r3;  // hmm... what is this?
    if (r3 < -3)
        sprite->pos1.x = 242 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX);
    else if (r3 > 242)
        sprite->pos1.x = -3 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX);
}
and that does it
i think what gamefreak wanted to do with the rest was make it so that the snow seemed like it was landing and melting. however, they never made the sprites visible again at the top, so it in essence "deleted" the snow

also, if you want to edit the number of flakes:
Code:
void Snow_InitVars(void)
{
    gWeatherPtr->initStep = 0;
    gWeatherPtr->weatherGfxLoaded = FALSE;
    gWeatherPtr->gammaTargetIndex = 3;
    gWeatherPtr->gammaStepDelay = 20;
    gWeatherPtr->unknown_6E5 = 16; // THIS NUMBER RIGHT HERE, i've put it up to 50 before
    gWeatherPtr->unknown_6E0 = 0;
}
finally, if you want to make it so that the game never fades for snow, head over to field_weather.c: and search for "case WEATHER_SNOW," deleting both instances.

Nice. But you have that same solution in Hex?
 

BluRose

blu rass
811
Posts
9
Years
Nice. But you have that same solution in Hex?
7EDDA: 4B E0 fixes the flakes
7E9F2 is the # of flakes

is the rest of it even necessary? not honestly sure, it seems to be pretty much covered with that
if you want to remove the faded screen, then i'll look at it sometime ahaha

and i'll respond to your pm here:
I also tested your routine. And my game acts weirdly. FIrst Torchich change forme, secoundly rain and sandstorm runs at that same time.
i'll look at it sometime ahaha
how did the torchic change form though? like what happened exactly?
 

AtecainCorp.

Rejishan awake...
1,377
Posts
15
Years
7EDDA: 4B E0 fixes the flakes
7E9F2 is the # of flakes

is the rest of it even necessary? not honestly sure, it seems to be pretty much covered with that
if you want to remove the faded screen, then i'll look at it sometime ahaha

and i'll respond to your pm here:
i'll look at it sometime ahaha
how did the torchic change form though? like what happened exactly?

First I had Healing Animation. After that Torchic turns into Hero backsprite with "Transform" Animation <That gives me hint for work with that on ability called Limber and Ilusion> Anyways. After that two effects. Rain and Sandstorm started at the same time.
 

BluRose

blu rass
811
Posts
9
Years
First I had Healing Animation. After that Torchic turns into Hero backsprite with "Transform" Animation <That gives me hint for work with that on ability called Limber and Ilusion> Anyways. After that two effects. Rain and Sandstorm started at the same time.
awesome, thank you!
this is probably caused by the battle animation effects not being the same in ruby as they are in fire red/emerald, so the routine loads and executes the wrong one. the weather bits, however, i am a bit confused about, ahaha
the hail bit seems like it should be set correctly (0x02024DB8); it's handled exactly as it should be. did you shift around the battle ram at all?
 

AtecainCorp.

Rejishan awake...
1,377
Posts
15
Years
awesome, thank you!
this is probably caused by the battle animation effects not being the same in ruby as they are in fire red/emerald, so the routine loads and executes the wrong one. the weather bits, however, i am a bit confused about, ahaha
the hail bit seems like it should be set correctly (0x02024DB8); it's handled exactly as it should be. did you shift around the battle ram at all?

No. I do not change anything in ram so far.
 
81
Posts
7
Years
  • Age 30
  • Seen Mar 23, 2024
Bug:

Pokémon Ruby.

rtGdgHF.gif
 

__fred__40

fred
277
Posts
4
Years
i compiled the routine for harsh sunlight ,inserted in free space in fire red and replace the indicated pointers,but it doesnt work,more specifically whenever I leave the player house the game freezes.What did I miss here?Did I had to edit some pointers in the routine as well?
only thing I'm not sure is if 8a0000 is 00008a or 0000a8 in reversed hex(I inserted 00008a)
 
Back
Top