103 lines
2.1 KiB
ArmAsm
103 lines
2.1 KiB
ArmAsm
.include "./macros.s"
|
|
|
|
.onStart:
|
|
## orig
|
|
### r30 = gpMarDirector
|
|
mr r30, r3
|
|
## check last area
|
|
### r0 = last area
|
|
### r11 = current area
|
|
### r12 = 0x817F0000
|
|
lis r12, 0x817F
|
|
lhz r0, area0@l(r12)
|
|
lhz r11, 0x7c(r30)
|
|
cmpw r0, r11
|
|
### store current area
|
|
sth r11, area0@l(r12)
|
|
## set timer
|
|
lbz r11, showLength@l(r12)
|
|
stb r11, showTimer@l(r12)
|
|
## reset gotShineFlag
|
|
li r11, 0
|
|
stb r11, gotShineFlag@l(r12)
|
|
## update count: r11 = (successCount, totalCount)
|
|
### if curArea != area0, (suc, tot) = (0, 1)
|
|
li r11, 1
|
|
bne .onStart.done
|
|
### else (suc, tot) += (0, 1)
|
|
lwz r11, succnt@l(r12)
|
|
addi r11, r11, 1
|
|
.onStart.done:
|
|
stw r11, succnt@l(r12)
|
|
|
|
.onShineGet:
|
|
## orig
|
|
mflr r0
|
|
## success count += 1
|
|
### r11 = (suc, tot)
|
|
### r12 = 0x817F0000
|
|
lis r12, 0x817F
|
|
lwz r11, succnt@l(r12)
|
|
addis r11, r11, 1
|
|
stw r11, succnt@l(r12)
|
|
## set freeze
|
|
lbz r11, showLength@l(r12)
|
|
stb r11, showTimer@l(r12)
|
|
## set gotShineFlag
|
|
li r11, 1
|
|
stb r11, gotShineFlag@l(r12)
|
|
|
|
.onMoveStage:
|
|
## orig
|
|
addi r28, r3, gpApplication@l
|
|
### r31 = this
|
|
### r12, r11 = curArea, prevArea
|
|
lhz r12, 0xe(r28)
|
|
lhz r11, 0xa(r28)
|
|
cmpw r12, r11
|
|
## ignore if curArea == prevArea (set by IR/ILS when resetting manually)
|
|
## else count as success
|
|
beq .onMoveStage.done
|
|
## if gotShineFlag, skip
|
|
lis r12, 0x817F
|
|
lbz r11, gotShineFlag@l(r12)
|
|
mr. r11, r11
|
|
bne .onMoveStage.done
|
|
## success count += 1
|
|
### r11 = (suc, tot)
|
|
### r12 = 0x817F0000
|
|
lwz r11, succnt@l(r12)
|
|
addis r11, r11, 1
|
|
stw r11, succnt@l(r12)
|
|
## set freeze
|
|
lbz r11, showLength@l(r12)
|
|
stb r11, showTimer@l(r12)
|
|
.onMoveStage.done:
|
|
|
|
.onRender:
|
|
### r12 = 0x817F0000
|
|
### r3 = showTimer
|
|
lis r12, 0x817F
|
|
lbz r3, showTimer@l(r12)
|
|
addic. r3, r3, -1
|
|
## if freezeCount < 0, return
|
|
blt+ .onRender.done
|
|
## update timer
|
|
stb r3, showTimer@l(r12)
|
|
.onRender.fillRect:
|
|
la r3, rectOpt@l(r12)
|
|
addi r4, r3, 0x10
|
|
lis r12, fill_rect@ha
|
|
la r12, fill_rect@l(r12)
|
|
mtlr r12
|
|
blrl
|
|
.onRender.drawText:
|
|
lis r12, 0x817F
|
|
la r3, textOpt@l(r12)
|
|
la r4, fmt@l(r12)
|
|
lhz r5, succnt@l(r12)
|
|
lhz r6, totcnt@l(r12)
|
|
la r12, drawText@l(r12)
|
|
mtlr r12
|
|
blrl
|
|
.onRender.done:
|