Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ Skills:
- @ 0 - None
- @ 1 - Intuition
- @ 2 - Concordant Roots
- @ 3 - Arcane Advance
- .thumb
- .org 0x00
- Begin:
- push {r0-r6}
- FindUnit:
- ldr r3, StatScreenStruct @r3 points to char struct (stat screen)
- ldr r3, [r3, #0x0C] @goes 0c into stat screen struct, loads the word there; r3 points to char struct in memory
- ldr r3, [r3] @loads the word there; r3 points to the character's entry in the table in the rom
- ldrb r3, [r3, #0x04] @r3 now contains character number
- CheckIfHasSkillsEntry:
- ldr r6, SkillTable @load pointer to skill table
- @add r6, #0x04
- Jump1:
- ldrb r5, [r6] @load unit #
- cmp r5, #0x00 @end of table
- beq DrawAffinity @if no skills, skip to DrawAffinity
- cmp r3, r5 @if the unit has skills defined
- beq GetSkills @then get skills
- @else
- add r6, #0x03 @next entry!
- b Jump1
- GetSkills: @r3 is current unit, r6 is pointer to that unit's entry in skill table
- ldrb r5, [r6, #0x01] @load first skill to r5
- ldrb r6, [r6, #0x02] @load second skill to r6
- DecideWhichSkillsToDraw:
- @add r6, #0x04 @load skills to r4 and r5, r4 empty -> affin, r5 empty -> draw 1 icon, else -> continue
- cmp r5, #0x00
- beq DrawAffinity
- cmp r6, #0x00
- beq DrawFirstIcon
- @else continue to draw second, then draw first
- DrawSecondIcon:
- mov r2, #0x10
- @sub r6, #0x01
- @mov r1, #0x20
- @mul r6, r6, r1
- lsl r6, #0x07 @r6 has skill #
- ldr r1, Skill2Top
- ldr r0, SkillIconsPointer
- add r0, r0, r6 @choose icon properly
- @push {r0}
- ldr r3, CPUFastSet
- bl Goto_r3
- @pop {r0}
- ldr r1, Skill2Bottom
- add r0, r0, #0x40 @advance to bottom part
- ldr r3, CPUFastSet
- bl Goto_r3
- mov r0, #0x00
- mov r1, #0x00
- ldr r2, OAMTable1
- mov r3, #0x00
- ldr r4, OAMWriteRoutine
- bl Goto_r4
- DrawFirstIcon:
- mov r2, #0x10
- @sub r5, #0x01
- @mov r1, #0x20
- @mul r5r5, r1
- lsl r5, #0x07
- ldr r1, Skill1Top
- ldr r0, SkillIconsPointer
- add r0, r0, r5 @choose icon properly
- @push {r0}
- ldr r3, CPUFastSet
- bl Goto_r3
- @pop {r0}
- ldr r1, Skill1Bottom
- add r0, r0, #0x40 @advance to bottom part
- ldr r3, CPUFastSet
- bl Goto_r3
- mov r0, #0x00
- mov r1, #0x00
- ldr r2, OAMTable2
- mov r3, #0x00
- ldr r4, OAMWriteRoutine
- bl Goto_r4
- DrawAffinity:
- @should be done i think...
- End:
- pop {r0-r6}
- OriginalFunctions:
- str r0, [sp]
- ldr r0, [r1, #0x04]
- ldrb r0, [r0, $0x14]
- lsl r0, r0, #0x18
- Return:
- ldr r2, ReturnLocation
- bx r2
- Goto_r3:
- bx r3
- Goto_r4:
- bx r4
- .align 2
- Skill1OAMTable:
- .short 0x0001 @ Don't touch this
- .short 0x0058 @ the last two digits modify y position ; attr0
- .short 0x20C4 @ first two digits are size, I wouldn't edit it, last two modify x position ; attr1
- .short 0x400B @ first two digits are palette, others are tile ; attr2
- .short 0x0000 @ leave blank ; attr3
- Skill2OAMTable:
- .short 0x0001 @ Don't touch this
- .short 0x0058 @ the last two digits modify y position ; attr0
- .short 0x20DA @ first two digits are size, I wouldn't edit it, last two modify x position ; attr1
- .short 0x400D @ first two digits are palette, others are tile ; attr2
- .short 0x0000 @ leave blank ; attr3
- ReturnLocation:
- .long 0x80871FC+1
- @BG0Buffer:
- @ .long 0x2022CA8
- CPUFastSet:
- .long 0x080D1675
- StatScreenStruct:
- .long 0x2003BFC
- Skill1Top:
- .long 0x6010160
- Skill1Bottom:
- .long 0x6010560
- Skill2Top:
- .long 0x60101A0
- Skill2Bottom:
- .long 0x60105A0
- SkillTable:
- .long 0x8B2E000
- OAMTable1:
- .long 0x8B2E500
- OAMTable2:
- .long 0x8B2F000
- OAMWriteRoutine:
- .long 0x8002BB8+1
- SkillIconsPointer:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement