Untitled
unknown
plain_text
2 years ago
2.1 kB
6
Indexable
// Variables and Constant
.equ PLAYER_SPEED, 4
@ SKILL_POINT_REGEN_RATE: .float 0.065
.equ player_width, 50
.equ player_height, 100
.global p2RemainingJumpsDecrease
p2RemainingJumpsDecrease:
@ Save registers, if necessary
push {r4, r5, lr}
@ For example, push registers to the stack
@ Set player2_jumping to true (1)
ldr r0, =player2_jumping
mov r1, #1
str r1, [r0]
@ Set player2_velocity_y to -20
ldr r0, =player2_velocity_y
mov r1, #-20
str r1, [r0]
@ Decrement player2_remaining_jumps
ldr r0, =player2_remaining_jumps
ldr r1, [r0]
sub r1, r1, #1
str r1, [r0]
@ Restore registers, if necessary
@ For example, pop registers from the stack
@ Return
pop {r4, r5, pc}
bx lr
.global p1FWD
p1FWD:
add r0, r0, #PLAYER_SPEED @ Add pspeed to p1x
bx lr @ Return
.global p1BWD
p1BWD:
sub r0, r0, #PLAYER_SPEED @ Decrease pspeed to p1x
bx lr @ Return
.global p2FWD
p2FWD:
sub r0, r0, #PLAYER_SPEED @ Decrease pspeed to p2x
bx lr @ Return
.global p2BWD
p2BWD:
add r0, r0, #PLAYER_SPEED @ Add pspeed to p2x
bx lr @ Return
.global p1x_increase_position
p1x_increase_position:
add r0, r0, #1
bx lr
.global p1x_decrease_position
p1x_decrease_position:
sub r0, r0, #1
bx lr
.global p2x_increase_position
p2x_increase_position:
add r0, r0, #1
bx lr
.global p2x_decrease_position
p2x_decrease_position:
sub r0, r0, #1
bx lr
@ .global skill_point_regeneration
@ skill_point_regeneration:
@ add r0, r0, #SKILL_POINT_REGEN_RATE
@ bx lr
.global CheckPower
CheckPower:
// Input: r0 = power
// Output: r0 = calculated power
// Check if power < 0
cmp r0, #0
blt below_zero
// Check if power > 100
cmp r0, #100
bgt above_100
// Power is within the range [0, 100], no change needed
bx lr
below_zero:
// Power is less than 0, set it to 0
mov r0, #0
bx lr
above_100:
// Power is greater than 100, set it to 100
mov r0, #100
bx lr
Editor is loading...