0018e660 - 0018e6b4

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Used in Weather Elemental effects routine.  Credit goes to Dokurider for finding it for me. Credit to Talcall for finding the snowy weather flag.

No Parameters 

Returns r2 = 0x00 if 0x800b6698 has flag 0x02 ON (ignore weather ? Inside of building ?)
        r2 = Weather value
        r2 = Weather value + 0x03 if it snows (0x800b6698 has flag 0x01 ON)

See Weather - See Notes
---------------------------------------------------------------------------------------------
0018e660: 27bdffe8 addiu r29,r29,-0x0018    
0018e664: afbf0010 sw r31,0x0010(r29)       
0018e668: 0c04ed64 jal 0x0013b590           |-->Get Script Variable  Returns r2 = Weather value
0018e66c: 34040023 ori r4,r0,0x0023         |r4 = 0x23 (Variable Weather)
0018e670: 3c04800b lui r4,0x800b            |
0018e674: 8c846698 lw r4,0x6698(r4)         |r4 = weather palette mods  0x800b6698 / 800b6698
0018e678: 00401821 addu r3,r2,r0            |r3 = weather value
0018e67c: 30820002 andi r2,r4,0x0002        |r2 <> 0x00 if Palette Mod = 0x2 palette mod bitflag
0018e680: 14400009 bne r2,r0,0x0018e6a8     #If Ignore weather is OFF /Else branch to END (r2 set to 0x00)
0018e684: 00001021 addu r2,r0,r0            |r2 = 0x00
0018e688: 28620002 slti r2,r3,0x0002            |r2 = 0x01 if Weather < 0x02 (clear sky)
0018e68c: 14400006 bne r2,r0,0x0018e6a8         #If It's not  a beautiful day
0018e690: 00601021 addu r2,r3,r0                |r2 = Weather value (0x00 or 0x01)
0018e694: 30820001 andi r2,r4,0x0001                |r2 <> 0x00 if it snows
0018e698: 10400003 beq r2,r0,0x0018e6a8             #If it snows
0018e69c: 00601021 addu r2,r3,r0                    |r2 = Weather value
0018e6a0: 24630003 addiu r3,r3,0x0003                   |r3 = Weather + 0x03
0018e6a4: 00601021 addu r2,r3,r0                        |r2 = Weather + 3 (snowy weather)
0018e6a8: 8fbf0010 lw r31,0x0010(r29)       END
0018e6ac: 27bd0018 addiu r29,r29,0x0018     
0018e6b0: 03e00008 jr r31                   
0018e6b4: 00000000 nop 

Notes

Returned values
 r2 = 0x00 If weather is ignored
 r2 = 0x01 Clear
 r2 = 0x02 Rain
 r2 = 0x03 Thunderstorm
 r2 = 0x04 Strong Thunderstorm
 r2 = 0x05 Snowstorm
 r2 = 0x06 Snowstorm
 r2 = 0x07 Strong Snowstorm                     

Return locations

Battle.bin
00174380: 00174370-001743c4
00186eec: Weather_Elemental_effects