mirror of
https://github.com/notwa/mm
synced 2025-02-05 05:23:22 -08:00
implement actor var selection/changing
This commit is contained in:
parent
d80d9db0b2
commit
a04f7a669e
2 changed files with 34 additions and 17 deletions
|
@ -13,7 +13,7 @@ dpad_control:
|
||||||
dpad_values:
|
dpad_values:
|
||||||
// use table of values for branchless operation
|
// use table of values for branchless operation
|
||||||
.byte 0, 1, -1, 0
|
.byte 0, 1, -1, 0
|
||||||
.byte -10, -9, -11, -10
|
.byte -16, -8, -32, -16
|
||||||
.byte +10, +11, +9, +10
|
.byte +16, +32, +8, +16
|
||||||
.byte 0, 1, -1, 0
|
.byte 0, 1, -1, 0
|
||||||
.align
|
.align
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
[button_L]: 0x0020
|
[button_L]: 0x0020
|
||||||
[button_D_right]: 0x0100
|
[button_R]: 0x0010
|
||||||
[button_D_left]: 0x0200
|
|
||||||
[button_D_down]: 0x0400
|
|
||||||
[button_D_up]: 0x0800
|
|
||||||
[button_any]: 0x0F20
|
[button_any]: 0x0F20
|
||||||
|
|
||||||
[hold_delay_amount]: 3
|
[hold_delay_amount]: 3
|
||||||
|
|
||||||
push 4, s0, s1, s2, ra
|
push 4, s0, s1, s2, s3, s4, ra,
|
||||||
li t0, @link_save
|
li t0, @link_save
|
||||||
li t1, @global_context
|
li t1, @global_context
|
||||||
lhu s2, @buttons_offset(t1)
|
|
||||||
lhu s0, anum
|
lhu s0, anum
|
||||||
lw s1, hold_delay
|
lw s1, hold_delay
|
||||||
|
lhu s2, @buttons_offset(t1)
|
||||||
|
lhu s3, avar
|
||||||
|
lw s4, selected
|
||||||
|
// set selected
|
||||||
|
// andi t2, s2, @button_R
|
||||||
|
srl s4, s2, 4
|
||||||
|
andi s4, s4, 1
|
||||||
|
// handle hold delay
|
||||||
andi t4, s2, @button_any
|
andi t4, s2, @button_any
|
||||||
bnez t4, +
|
bnez t4, +
|
||||||
addi s1, s1, 1
|
addi s1, s1, 1
|
||||||
|
@ -23,12 +27,19 @@
|
||||||
subi t4, s1, @hold_delay_amount
|
subi t4, s1, @hold_delay_amount
|
||||||
bltz t4, return
|
bltz t4, return
|
||||||
nop
|
nop
|
||||||
+:
|
+: // handle dpad
|
||||||
mov a0, s0
|
bnez s4, +
|
||||||
jal dpad_control
|
|
||||||
mov a1, s2
|
mov a1, s2
|
||||||
|
jal dpad_control
|
||||||
|
mov a0, s0
|
||||||
mov s0, v0
|
mov s0, v0
|
||||||
|
b ++
|
||||||
|
nop
|
||||||
|
+:
|
||||||
|
jal dpad_control
|
||||||
|
mov a0, s3
|
||||||
|
mov s3, v0
|
||||||
|
+: // set min/max on actor number
|
||||||
subi t4, s0, 1
|
subi t4, s0, 1
|
||||||
bgez t4, +
|
bgez t4, +
|
||||||
nop
|
nop
|
||||||
|
@ -38,8 +49,7 @@
|
||||||
blez t4, +
|
blez t4, +
|
||||||
nop
|
nop
|
||||||
li s0, 1
|
li s0, 1
|
||||||
+:
|
+: // spawn
|
||||||
sh s0, anum
|
|
||||||
andi t3, s2, @button_L
|
andi t3, s2, @button_L
|
||||||
beqz t3, return
|
beqz t3, return
|
||||||
nop
|
nop
|
||||||
|
@ -48,7 +58,7 @@
|
||||||
bal simple_spawn
|
bal simple_spawn
|
||||||
nop
|
nop
|
||||||
return:
|
return:
|
||||||
sw s1, hold_delay
|
andi s3, s3, 0xFFFF
|
||||||
// render actor number
|
// render actor number
|
||||||
li a0, 0x0001001C // xy
|
li a0, 0x0001001C // xy
|
||||||
li a1, 0x88CCFFFF // rgba
|
li a1, 0x88CCFFFF // rgba
|
||||||
|
@ -60,15 +70,22 @@ return:
|
||||||
li a0, 0x0006001C // xy
|
li a0, 0x0006001C // xy
|
||||||
li a1, 0xFFCC88FF // rgba
|
li a1, 0xFFCC88FF // rgba
|
||||||
la a2, fmt
|
la a2, fmt
|
||||||
lhu a3, avar
|
mov a3, s3
|
||||||
jal simple_text
|
jal simple_text
|
||||||
nop
|
nop
|
||||||
jpop 4, s0, s1, s2, ra
|
// done
|
||||||
|
sh s0, anum
|
||||||
|
sw s1, hold_delay
|
||||||
|
sh s3, avar
|
||||||
|
sw s4, selected
|
||||||
|
jpop 4, s0, s1, s2, s3, s4, ra,
|
||||||
|
|
||||||
anum:
|
anum:
|
||||||
.word 0
|
.word 0
|
||||||
avar:
|
avar:
|
||||||
.word 0
|
.word 0
|
||||||
|
selected:
|
||||||
|
.word 0
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
.byte 0x25,0x30,0x34,0x58,0x00 // %04X
|
.byte 0x25,0x30,0x34,0x58,0x00 // %04X
|
||||||
|
|
Loading…
Add table
Reference in a new issue