1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-11-05 01:29:03 -08:00

add barebones actor spawning asm

This commit is contained in:
Connor Olding 2015-12-18 10:00:15 -08:00
parent 9a2757d16d
commit 080bb9340d
2 changed files with 48 additions and 2 deletions

View file

@ -10,9 +10,9 @@ end
local asm_path
if bizstring then
asm_path = "inject/crap.asm"
asm_path = "inject/spawn.asm"
else
asm_path = "./mm/Lua/inject/crap.asm"
asm_path = "./mm/Lua/inject/spawn.asm"
end
local inject_addr, inject_maxlen, ow_addr, ow_before

46
Lua/inject/spawn.asm Normal file
View file

@ -0,0 +1,46 @@
[actor_spawn]: 0x800BAE14
[global_context]: 0x803E6B20
[buttons_offset]: 0x14
[actor_spawn_offset]: 0x1CA0
[button_mask]: 0x0020
[actor_to_spawn]: 0x0009
push 4, ra
li t0, @global_context
lhu t2, @buttons_offset(t0)
andi t2, t2, @button_mask
beq t2, r0, return
nop
li a0, @actor_to_spawn
bal simple_spawn
nop
return:
jpop 4, ra
simple_spawn: // args: a0 (actor to spawn)
push 4, 9, ra
mov a2, a0
li a1, @global_context
addi a0, a1, @actor_spawn_offset
cl a3 // unknown
mtc1 r0, F4 // X position?
mtc1 r0, F8 // Y position?
mtc1 r0, F16 // Z position?
// load up the rest of the args
sw r0, 0x10(sp) // unknown
sw r0, 0x14(sp) // X, Y rotations?
sw r0, 0x18(sp) // Z rotation?
sw r0, 0x1C(sp) // unknown
sw r0, 0x20(sp) // unknown
sw r0, 0x24(sp) // object number?
li t0, 0x0000007F
sw t0, 0x28(sp) // unknown
li t0, 0x000003FF
sw t0, 0x2C(sp) // unknown
sw r0, 0x30(sp) // unknown
// and finally..
jal @actor_spawn
nop
jpop 4, 9, ra