migrated and rewrote AttemptCounter with C2
This commit is contained in:
parent
b798226c14
commit
0ccbd6b3c0
2 changed files with 94 additions and 82 deletions
|
@ -1,15 +1,26 @@
|
||||||
$$ = 0x817f9f0c;
|
$$ = 0;
|
||||||
|
|
||||||
$bl$.onStart = 0x8010c3c8;
|
$C2$.onStart = TMarDirector.setupObjects + 0x1C;
|
||||||
$bl$.onShineGet = 0x800edb34;
|
$C2$.onShineGet = TMarDirector.fireGetStar;
|
||||||
$bl$.onMoveStage = 0x3C + TMarDirector.moveStage;
|
$C2$.onMoveStage = TMarDirector.moveStage + 0x3C;
|
||||||
$b$.onRender = 0x80206898;
|
$C2$.onRender = drawWater - 0x28;
|
||||||
drawText = 0x817f0238;
|
drawText = 0x817f0238;
|
||||||
|
|
||||||
/**
|
/** size = 2 */
|
||||||
* u32 success count
|
area0 = 0x817f0476;
|
||||||
* u32 total count
|
/** size = 1 */
|
||||||
* u16 last area
|
showTimer = 0x817f0478;
|
||||||
* u16 freeze count
|
showLength = 0x817f0479;
|
||||||
*/
|
/** size = 6 */
|
||||||
$data = 0x817f9f00;
|
fmt = 0x817f047a;
|
||||||
|
/** size = 0x10 */
|
||||||
|
textOpt = 0x817f0480;
|
||||||
|
/** size = 0x14 */
|
||||||
|
rectOpt = 0x817f0490;
|
||||||
|
/** size = 2 */
|
||||||
|
succnt = 0x817f04a4;
|
||||||
|
totcnt = 0x817f04a6;
|
||||||
|
/** size = 1 */
|
||||||
|
gotShineFlag = 0x817f04a8;
|
||||||
|
|
||||||
|
gpApplication = DEFINED(SMS__GMSE01) ? 0x803E9700 : gpApplication;
|
||||||
|
|
|
@ -1,102 +1,103 @@
|
||||||
.include "./macros.s"
|
.include "./macros.s"
|
||||||
|
|
||||||
.set x, 144
|
|
||||||
.set y, 124
|
|
||||||
.set fontSize, 28
|
|
||||||
.set color, 0x99ffffff
|
|
||||||
.set freezeDuration, 60
|
|
||||||
|
|
||||||
.set off$succnt, 0
|
|
||||||
.set off$tolcnt, 4
|
|
||||||
.set off$area0, 8
|
|
||||||
.set off$freeze, 10
|
|
||||||
|
|
||||||
.onStart:
|
.onStart:
|
||||||
.set r$$, 12
|
|
||||||
.set off$$, off$area0
|
|
||||||
.set a$$, $data+off$$
|
|
||||||
## orig
|
## orig
|
||||||
|
### r30 = gpMarDirector
|
||||||
mr r30, r3
|
mr r30, r3
|
||||||
## check last area
|
## check last area
|
||||||
### r0 = last area
|
### r0 = last area
|
||||||
### r11 = current area
|
### r11 = current area
|
||||||
lis r$$, a$$@ha
|
### r12 = 0x817F0000
|
||||||
lhzu r0, a$$@l(r$$)
|
lis r12, 0x817F
|
||||||
|
lhz r0, area0@l(r12)
|
||||||
lhz r11, 0x7c(r30)
|
lhz r11, 0x7c(r30)
|
||||||
cmpw r0, r11
|
cmpw r0, r11
|
||||||
### store current area
|
### store current area
|
||||||
sth r11, off$area0-off$$@l(r$$)
|
sth r11, area0@l(r12)
|
||||||
## set freeze
|
## set timer
|
||||||
li r11, freezeDuration
|
lbz r11, showLength@l(r12)
|
||||||
sth r11, off$freeze-off$$(r$$)
|
stb r11, showTimer@l(r12)
|
||||||
## total count (r11), success count (r10)
|
## reset gotShineFlag
|
||||||
### if curArea != area0, totalCount = 1
|
li r11, 0
|
||||||
|
stb r11, gotShineFlag@l(r12)
|
||||||
|
## update count: r11 = (successCount, totalCount)
|
||||||
|
### if curArea != area0, (suc, tot) = (0, 1)
|
||||||
li r11, 1
|
li r11, 1
|
||||||
li r10, 0
|
|
||||||
bne .onStart.done
|
bne .onStart.done
|
||||||
### else total Count += 1
|
### else (suc, tot) += (0, 1)
|
||||||
lwz r11, off$tolcnt-off$$(r$$)
|
lwz r11, succnt@l(r12)
|
||||||
addi r11, r11, 1
|
addi r11, r11, 1
|
||||||
lwz r10, off$succnt-off$$(r$$)
|
|
||||||
.onStart.done:
|
.onStart.done:
|
||||||
stw r11, off$tolcnt-off$$(r$$)
|
stw r11, succnt@l(r12)
|
||||||
stw r10, off$succnt-off$$(r$$)
|
|
||||||
blr
|
|
||||||
|
|
||||||
.onShineGet:
|
.onShineGet:
|
||||||
## orig
|
## orig
|
||||||
li r8, 0
|
mflr r0
|
||||||
.doSuccess:
|
|
||||||
.set r$$, 12
|
|
||||||
.set off$$, off$succnt
|
|
||||||
.set a$$, $data+off$$
|
|
||||||
## success count += 1
|
## success count += 1
|
||||||
lis r$$, a$$@ha
|
### r11 = (suc, tot)
|
||||||
lwzu r11, a$$@l(r$$)
|
### r12 = 0x817F0000
|
||||||
addi r11, r11, 1
|
lis r12, 0x817F
|
||||||
stw r11, 0(r$$)
|
lwz r11, succnt@l(r12)
|
||||||
|
addis r11, r11, 1
|
||||||
|
stw r11, succnt@l(r12)
|
||||||
## set freeze
|
## set freeze
|
||||||
li r11, freezeDuration
|
lbz r11, showLength@l(r12)
|
||||||
sth r11, off$freeze-off$$(r$$)
|
stb r11, showTimer@l(r12)
|
||||||
blr
|
## set gotShineFlag
|
||||||
|
li r11, 1
|
||||||
|
stb r11, gotShineFlag@l(r12)
|
||||||
|
|
||||||
.onMoveStage:
|
.onMoveStage:
|
||||||
## orig
|
## orig
|
||||||
addi r28, r3, gpApplication@l # TODO check version
|
addi r28, r3, gpApplication@l
|
||||||
## r31 = this
|
### r31 = this
|
||||||
## r12, r11 = curArea, prevArea
|
### r12, r11 = curArea, prevArea
|
||||||
lhz r12, 0xe(r28)
|
lhz r12, 0xe(r28)
|
||||||
lhz r11, 0xa(r28)
|
lhz r11, 0xa(r28)
|
||||||
cmpw r12, r11
|
cmpw r12, r11
|
||||||
beqlr # same area -> reset -> not success
|
## ignore if curArea == prevArea (set by IR/ILS when resetting manually)
|
||||||
b .doSuccess
|
## 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:
|
.onRender:
|
||||||
## orig (setup2D)
|
### r12 = 0x817F0000
|
||||||
bl setup2D
|
### r3 = showTimer
|
||||||
## check freeze count
|
lis r12, 0x817F
|
||||||
.set r$$, 12
|
lbz r3, showTimer@l(r12)
|
||||||
.set off$$, off$freeze
|
|
||||||
.set a$$, $data+off$$
|
|
||||||
### r$$ = &freezeCount
|
|
||||||
### r3 = freezeCount
|
|
||||||
lis r$$, a$$@ha
|
|
||||||
lhzu r3, a$$@l(r$$)
|
|
||||||
addic. r3, r3, -1
|
addic. r3, r3, -1
|
||||||
## if freezeCount < 0, return
|
## if freezeCount < 0, return
|
||||||
blt .onRender.done
|
blt+ .onRender.done
|
||||||
## update freezeCount
|
## update timer
|
||||||
sth r3, off$freeze-off$$(r$$)
|
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:
|
.onRender.drawText:
|
||||||
li r3, x
|
lis r12, 0x817F
|
||||||
li r4, y
|
la r3, textOpt@l(r12)
|
||||||
li r5, fontSize
|
la r4, fmt@l(r12)
|
||||||
liDX r6, color
|
lhz r5, succnt@l(r12)
|
||||||
mr r7, r6 # colorBot
|
lhz r6, totcnt@l(r12)
|
||||||
bl .onRender.fmt; .string "%d\n%d"; .align 2; .onRender.fmt: mflr r8
|
la r12, drawText@l(r12)
|
||||||
lwz r9, off$succnt-off$$(r$$)
|
mtlr r12
|
||||||
lwz r10, off$tolcnt-off$$(r$$)
|
blrl
|
||||||
bl drawText
|
|
||||||
.onRender.done:
|
.onRender.done:
|
||||||
## orig
|
|
||||||
b 4+$b$.onRender
|
|
||||||
|
|
Loading…
Reference in a new issue