Elemental ability loading

From Final Fantasy Hacktics Wiki
(Redirected from Elemental)
Jump to navigation Jump to search
001821cc: 27bdff40 addiu r29,r29,0xff40
001821d0: afb100b4 sw r17,0x00b4(r29)
001821d4: 00808821 addu r17,r4,r0			Battle Unit ID
001821d8: afb000b0 sw r16,0x00b0(r29)
001821dc: 00a08021 addu r16,r5,r0			Skillset ID
001821e0: afbf00bc sw r31,0x00bc(r29)
001821e4: 0c060435 jal 0x001810d4                     Load unit Data
001821e8: afb200b8 sw r18,0x00b8(r29)
001821ec: 00409021 addu r18,r2,r0                     Unit ID in r18
001821f0: 1240002e beq r18,r0,0x 001822ac             Branch if No unit exist
001821f4: 34020011 ori r2,r0,0x0011                   r2 = 0x11
001821f8: 320300ff andi r3,r16,0x00ff
001821fc: 1462002c bne r3,r2,0x 001822b0              Branch if Skillset is not Elemental
00182200: 00001021 addu r2,r0,r0                      Clear r2
00182204: 02202021 addu r4,r17,r0                     Unit ID to r4
00182208: 27a20060 addiu r2,r29,0x0060
0018220c: afa20010 sw r2,0x0010(r29)			stack + 0x60 for ability CT
00182210: 34020001 ori r2,r0,0x0001
00182214: afa20014 sw r2,0x0014(r29)			similiar to math...? sets 0x1 here instead of 0x0... what does this do...
00182218: 27a20078 addiu r2,r29,0x0078
0018221c: afa20018 sw r2,0x0018(r29)			stack + 0x78 for silence/performance checks
00182220: 27a20090 addiu r2,r29,0x0090
00182224: 34050011 ori r5,r0,0x0011			skillset = elemental                 
00182228: 27a60020 addiu r6,r29,0x0020			stack + 0x20 for ability IDs
0018222c: 27a70048 addiu r7,r29,0x0048			stack + 0x48 for MP cost
00182230: 0c0605f0 jal 0x001817c0			Load ability data for skillset
00182234: afa2001c sw r2,0x001c(r29)			stack + 0x90 for #turns to complete
00182238: 00408021 addu r16,r2,r0
0018223c: 16000005 bne r16,r0,0x00182254		Branch if any abilities are learned (available?)
00182240: 00001021 addu r2,r0,r0			Clear r2 ("Gray" out menu)

00182244: 080608ac j 0x 001822b0			End
00182248: 00000000 nop

0018224c: 080608ac j 0x 001822b0			End
00182250: 30c2ffff andi r2,r6,0xffff			return terrain elemental ID

00182254: 0c060428 jal 0x001810a0			Map Location Calculation
00182258: 02402021 addu r4,r18,r0			Move Unit Data Pointer to r4
0018225c: 000210c0 sll r2,r2,0x03
00182260: 3c018019 lui r1,0x8019
00182264: 00220821 addu r1,r1,r2
00182268: 9022f8cc lbu r2,-0x0734(r1)			load tile type
0018226c: 00000000 nop
00182270: 3042003f andi r2,r2,0x003f
00182274: 3c018006 lui r1,0x8006
00182278: 00220821 addu r1,r1,r2
0018227c: 9026e9d0 lbu r6,-0x1630(r1)			load ability ID for geomancy
00182280: 1a00000a blez r16,0x001822ac			branch if no abilities available (a... another check? redundant?)
00182284: 00001821 addu r3,r0,r0			counter = 0
00182288: 00c02821 addu r5,r6,r0			Move Terrain Elemental ID to r5
0018228c: 27a40020 addiu r4,r29,0x0020			Pointer to ability IDs
00182290: 84820000 lh r2,0x0000(r4)			Load Learned Ability
00182294: 00000000 nop
00182298: 1045ffec beq r2,r5,0x0018224c		branch if tile ability = ability ID for geomancy
0018229c: 24630001 addiu r3,r3,0x0001			counter + 1
001822a0: 0070102a slt r2,r3,r16
001822a4: 1440fffa bne r2,r0,0x 00182290		Branch if all total Learn Abilities have not been checked
001822a8: 24840002 addiu r4,r4,0x0002			next ability ID

001822ac: 00001021 addu r2,r0,r0			Return r2 = 0 (no valid abilities, grey out menu)
001822b0: 8fbf00bc lw r31,0x00bc(r29)
001822b4: 8fb200b8 lw r18,0x00b8(r29)
001822b8: 8fb100b4 lw r17,0x00b4(r29)
001822bc: 8fb000b0 lw r16,0x00b0(r29)
001822c0: 27bd00c0 addiu r29,r29,0x00c0
001822c4: 03e00008 jr r31
001822c8: 00000000 nop