1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-05-18 05:23:22 -07:00

implement actor var selection/changing

This commit is contained in:
Connor Olding 2016-01-12 07:44:41 -08:00
parent d80d9db0b2
commit a04f7a669e
2 changed files with 34 additions and 17 deletions

View File

@ -13,7 +13,7 @@ dpad_control:
dpad_values:
// use table of values for branchless operation
.byte 0, 1, -1, 0
.byte -10, -9, -11, -10
.byte +10, +11, +9, +10
.byte -16, -8, -32, -16
.byte +16, +32, +8, +16
.byte 0, 1, -1, 0
.align

View File

@ -1,18 +1,22 @@
[button_L]: 0x0020
[button_D_right]: 0x0100
[button_D_left]: 0x0200
[button_D_down]: 0x0400
[button_D_up]: 0x0800
[button_R]: 0x0010
[button_any]: 0x0F20
[hold_delay_amount]: 3
push 4, s0, s1, s2, ra
push 4, s0, s1, s2, s3, s4, ra,
li t0, @link_save
li t1, @global_context
lhu s2, @buttons_offset(t1)
lhu s0, anum
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
bnez t4, +
addi s1, s1, 1
@ -23,12 +27,19 @@
subi t4, s1, @hold_delay_amount
bltz t4, return
nop
+:
mov a0, s0
jal dpad_control
+: // handle dpad
bnez s4, +
mov a1, s2
jal dpad_control
mov a0, s0
mov s0, v0
b ++
nop
+:
jal dpad_control
mov a0, s3
mov s3, v0
+: // set min/max on actor number
subi t4, s0, 1
bgez t4, +
nop
@ -38,8 +49,7 @@
blez t4, +
nop
li s0, 1
+:
sh s0, anum
+: // spawn
andi t3, s2, @button_L
beqz t3, return
nop
@ -48,7 +58,7 @@
bal simple_spawn
nop
return:
sw s1, hold_delay
andi s3, s3, 0xFFFF
// render actor number
li a0, 0x0001001C // xy
li a1, 0x88CCFFFF // rgba
@ -60,15 +70,22 @@ return:
li a0, 0x0006001C // xy
li a1, 0xFFCC88FF // rgba
la a2, fmt
lhu a3, avar
mov a3, s3
jal simple_text
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:
.word 0
avar:
.word 0
selected:
.word 0
fmt:
.byte 0x25,0x30,0x34,0x58,0x00 // %04X