Skip to content

Instantly share code, notes, and snippets.

@Slattz
Last active July 24, 2019 16:37
Show Gist options
  • Save Slattz/df09092e8d5a17e25af123c3c2267c1f to your computer and use it in GitHub Desktop.
Save Slattz/df09092e8d5a17e25af123c3c2267c1f to your computer and use it in GitHub Desktop.
[ACNL] Season Stuff
/* Season: End Day - End Month - Type (End days are inclusive i.e. next season starts day after)
Season00: 15 - 01 - Winter - Brown Trees; Snow
Season01: 18 - 02 - Winter - Transition from Brown->Green Trees; Brown more prominent; Snow
Season02: 24 - 02 - Winter - Transition from Brown->Green Trees; Green more prominent; Snow
Season03: 31 - 03 - Spring - 'Light' Green Tree; No more snow
Season04: 05 - 04 - Spring - Cherry Blossom Trees; Light Cherry Blossoms in sky???
Season05: 10 - 04 - Spring - Cherry Blossom Trees; Heavy Cherry Blossoms in sky???
Season06: 14 - 04 - Spring - 'Light' Green Tree; Same as Season03?
Season07: 07 - 06 - Summer - 'Mantis' Tree;
Season08: 15 - 06 - Summer - 'Mantis' Tree; Same as Season07?
Season09: 27 - 06 - Summer - 'Mantis' Tree; Same as Season07/08?
Season10: 05 - 07 - Summer - 'Mantis' Tree; Same as Season07/08/09?
Season11: 23 - 07 - Summer - 'Mantis' Tree; Same as Season07/08/09/10?
Season12: 07 - 09 - Autumn - 'Dark Green' Tree; Transition to Autumn
Season13: 15 - 09 - Autumn - 'Forest Green' Tree; Mix between Season11+Season12;
Season14: 16 - 10 - Autumn - 'Moss Green' Tree; Transition from Green->Brown Trees; Green more prominent;
Season15: 24 - 10 - Autumn - 'Yellow' Tree; Transition from 'Moss Green'->'Yellow' Trees; 50/50 between green+yellow
Season16: 01 - 11 - Autumn - 'Golden Orange' Tree; Transition from 'Yellow'->'Golden Orange' Trees; Yellow more prominent;
Season17: 09 - 11 - Autumn - 'Light Orange' Tree; Transition from 'Golden Orange'->'Light Orange' Trees; Orange more prominent;
Season18: 17 - 11 - Autumn - 'Carrot Orange' Tree; Transition from 'Light Orange'->'Carrot Orange' Trees; Fully Orange;
Season19: 25 - 11 - Autumn - 'Giants Orange' Tree; Transition from 'Carrot Orange'->'Giants Orange' Trees; Orange now darker;
Season20: 30 - 11 - Autumn - 'Copper' Tree; Transition from 'Giants Orange'->'Copper' Trees; Orange now has brown tone; Orange more prominent;
Season21: 10 - 12 - Winter - 'Dark Copper' Tree; Transition from 'Copper'->'Dark Copper' Trees; 50/50 between orange+brown
Season22: 31 - 12 - Winter - 'Gold Pumpkin' Tree; Transition from Dark Copper'->'Gold Pumpkin' Trees; 50/50 between orange+gold; Snow
*/
u16 SeasonStartDates[23] = {
0x10F, 0x212, 0x218, 0x31F, 0x405, 0x40A,
0x40E, 0x607, 0x60F, 0x61B, 0x705, 0x717,
0x907, 0x90F, 0xA10, 0xA18, 0xB01, 0xB09,
0xB11, 0xB19, 0xB1E, 0xC0A, 0xC1F};
u8 GetSeason(u8* someStruct) {
u8 room = GetRoomID();
if(CheckRoomID(0x20000, room)) //Checks if room >= 0x67 && room <= 0x8D; All Island room ids
return 12; //Island season is always Season12
u8 month = *(u8 *)(someStruct+4);
s8 day = *(s8 *)(someStruct+5);
u8 deriveddate = (month<<8 | day)&0xFFFF;
u8 i = 0;
while(deriveddate > SeasonStartDates[i]){
i++;
if (i > 0x17)
return 0;
}
return i&0xFF;
}
//off_CurrentTime: pointer for the game's current time. 0xAD56B0 (EUR 1.5)
u8 GetSeasonFromTownTime(void) {
u8 room = GetRoomID();
if(CheckRoomID(0x20000, room)) //Checks if room >= 0x67 && room <= 0x8D; All Island room ids
return 12; //Island season is always Season12
u8 month = *(u8 *)(off_CurrentTime+4);
s8 day = *(u8 *)(off_CurrentTime+5);
u8 deriveddate = (month<<8 | day)&0xFFFF;
u8 i = 0;
while(deriveddate > SeasonStartDates[i]){
i++;
if (i > 0x17)
return 0; //Season0 for anything over max value
}
return i&0xFF;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment