shithub: pokecrystal

Download patch

ref: 3108c9fa6a265a7ecbac6fa2aaa458025f5aeead
parent: 1a84ca4e552c6b5c98500475a5bc177f59e3b42a
author: pikalaxalt <[email protected]>
date: Sat May 14 08:28:00 EDT 2016

Unify step_sleep macro

--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -1876,8 +1876,8 @@
 	ld a, [wPlayerNextMovement]
 	ld hl, wPlayerMovement
 	ld [hl], a
-; load [wPlayerNextMovement] with movement_step_sleep_1
-	ld a, movement_step_sleep_1
+; load [wPlayerNextMovement] with movement_step_sleep
+	ld a, movement_step_sleep
 	ld [wPlayerNextMovement], a
 ; recover the previous value of [wPlayerNextMovement]
 	ld a, [hl]
@@ -1987,7 +1987,7 @@
 	cp d
 	ret nz
 	ld a, e
-	cp movement_step_sleep_1
+	cp movement_step_sleep
 	ret z
 	cp movement_step_end
 	ret z
@@ -2034,7 +2034,7 @@
 .done
 	call .CancelFollowIfLeaderMissing
 	ret c
-	ld a, movement_step_sleep_1
+	ld a, movement_step_sleep
 	ret
 
 .CancelFollowIfLeaderMissing:
@@ -2505,7 +2505,7 @@
 ; 579d
 
 RefreshPlayerSprite: ; 579d
-	ld a, movement_step_sleep_1
+	ld a, movement_step_sleep
 	ld [wPlayerNextMovement], a
 	ld [wPlayerMovement], a
 	xor a
--- a/engine/movement.asm
+++ b/engine/movement.asm
@@ -55,8 +55,8 @@
 	dw Movement_fast_jump_step_up     ; 35
 	dw Movement_fast_jump_step_left   ; 36
 	dw Movement_fast_jump_step_right  ; 37
-	dw Movement_remove_sliding                    ; 38
-	dw Movement_set_sliding                    ; 39
+	dw Movement_remove_sliding        ; 38
+	dw Movement_set_sliding           ; 39
 	dw Movement_remove_fixed_facing   ; 3a
 	dw Movement_fix_facing            ; 3b
 	dw Movement_show_person           ; 3c
@@ -85,10 +85,10 @@
 	dw Movement_hide_emote            ; 53
 	dw Movement_show_emote            ; 54
 	dw Movement_step_shake            ; 55
-	dw Movement_tree_shake                    ; 56
+	dw Movement_tree_shake            ; 56
 	dw Movement_rock_smash            ; 57
 	dw Movement_return_dig            ; 58
-	dw Movement_skyfall_top       ; 59
+	dw Movement_skyfall_top           ; 59
 ; 5129
 
 
--- a/engine/player_movement.asm
+++ b/engine/player_movement.asm
@@ -1,7 +1,7 @@
 DoPlayerMovement:: ; 80000
 
 	call .GetDPad
-	ld a, movement_step_sleep_1
+	ld a, movement_step_sleep
 	ld [MovementAnimation], a
 	xor a
 	ld [wd041], a
@@ -528,7 +528,7 @@
 .StandInPlace: ; 802b3
 	ld a, 0
 	ld [wd04e], a
-	ld a, movement_step_sleep_1
+	ld a, movement_step_sleep
 	ld [MovementAnimation], a
 	xor a
 	ret
@@ -835,7 +835,7 @@
 
 Function80422:: ; 80422
 	ld hl, wPlayerNextMovement
-	ld a, movement_step_sleep_1
+	ld a, movement_step_sleep
 	cp [hl]
 	ret z
 
--- a/engine/player_object.asm
+++ b/engine/player_object.asm
@@ -516,7 +516,7 @@
 TrainerWalkToPlayer: ; 831e
 	ld a, [hLastTalked]
 	call InitMovementBuffer
-	ld a, movement_step_sleep_1
+	ld a, movement_step_sleep
 	call AppendToMovementBuffer
 	ld a, [wd03f]
 	dec a
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -1427,12 +1427,12 @@
 
 .Show:
 	show_emote
-	step_sleep_1
+	step_sleep 1
 	step_end
 
 .Hide:
 	hide_emote
-	step_sleep_1
+	step_sleep 1
 	step_end
 ; 973c7
 
--- a/event/overworld.asm
+++ b/event/overworld.asm
@@ -1632,7 +1632,7 @@
 	fish_got_bite
 	fish_got_bite
 	fish_got_bite
-	step_sleep_1
+	step_sleep 1
 	show_emote
 	step_end
 
--- a/macros/movement.asm
+++ b/macros/movement.asm
@@ -311,51 +311,16 @@
 	db movement_hide_person ; $3d
 	endm
 
-	enum movement_step_sleep_1
-step_sleep_1: macro
-	db movement_step_sleep_1 ; $3e
-	endm
-
-	enum movement_step_sleep_2
-step_sleep_2: macro
-	db movement_step_sleep_2 ; $3f
-	endm
-
-	enum movement_step_sleep_3
-step_sleep_3: macro
-	db movement_step_sleep_3 ; $40
-	endm
-
-	enum movement_step_sleep_4
-step_sleep_4: macro
-	db movement_step_sleep_4 ; $41
-	endm
-
-	enum movement_step_sleep_5
-step_sleep_5: macro
-	db movement_step_sleep_5 ; $42
-	endm
-
-	enum movement_step_sleep_6
-step_sleep_6: macro
-	db movement_step_sleep_6 ; $43
-	endm
-
-	enum movement_step_sleep_7
-step_sleep_7: macro
-	db movement_step_sleep_7 ; $44
-	endm
-
-	enum movement_step_sleep_8
-step_sleep_8: macro
-	db movement_step_sleep_8 ; $45
-	endm
-
 	enum movement_step_sleep
 step_sleep: macro
-	db movement_step_sleep ; $46
-	db \1 ; duration
-	endm
+if \1 <= 8
+	db movement_step_sleep + \1 - 1
+else
+	db movement_step_sleep + 8, \1
+endc
+endm
+
+__enum__ SET $47
 
 	enum movement_step_end
 step_end: macro
--- a/maps/CeruleanGym.asm
+++ b/maps/CeruleanGym.asm
@@ -184,8 +184,8 @@
 	jump_step_up
 	db $38 ; movement
 	remove_fixed_facing
-	step_sleep_8
-	step_sleep_8
+	step_sleep 8
+	step_sleep 8
 	step_down
 	step_down
 	step_end
--- a/maps/IlexForest.asm
+++ b/maps/IlexForest.asm
@@ -578,17 +578,17 @@
 MovementData_Farfetched_Pos5_Pos4_Right:
 	big_step_right
 	turn_head_up
-	step_sleep_1
+	step_sleep 1
 	turn_head_down
-	step_sleep_1
+	step_sleep 1
 	turn_head_up
-	step_sleep_1
+	step_sleep 1
 	big_step_down
 	big_step_down
 	fix_facing
 	jump_step_up
-	step_sleep_8
-	step_sleep_8
+	step_sleep 8
+	step_sleep 8
 	remove_fixed_facing
 	big_step_up
 	big_step_up
@@ -679,8 +679,8 @@
 	big_step_left
 	fix_facing
 	jump_step_right
-	step_sleep_8
-	step_sleep_8
+	step_sleep 8
+	step_sleep 8
 	remove_fixed_facing
 	big_step_left
 	big_step_left
@@ -709,8 +709,8 @@
 	big_step_left
 	fix_facing
 	jump_step_right
-	step_sleep_8
-	step_sleep_8
+	step_sleep 8
+	step_sleep 8
 	remove_fixed_facing
 	big_step_right
 	big_step_right
--- a/maps/OlivineLighthouse6F.asm
+++ b/maps/OlivineLighthouse6F.asm
@@ -136,8 +136,8 @@
 	slow_step_right
 	slow_step_up
 	slow_step_up
-	step_sleep_8
-	step_sleep_8
+	step_sleep 8
+	step_sleep 8
 	step_end
 
 MovementData_0x60c70:
@@ -158,7 +158,7 @@
 	slow_step_up
 	slow_step_up
 	slow_step_up
-	step_sleep_8
+	step_sleep 8
 	step_end
 
 UnknownText_0x60c81:
--- a/maps/SlowpokeWellB1F.asm
+++ b/maps/SlowpokeWellB1F.asm
@@ -132,15 +132,15 @@
 	step_left
 	step_left
 	step_up
-	step_sleep_8
-	step_sleep_8
-	step_sleep_8
+	step_sleep 8
+	step_sleep 8
+	step_sleep 8
 	step_left
 	step_up
 	step_up
-	step_sleep_8
-	step_sleep_8
-	step_sleep_8
+	step_sleep 8
+	step_sleep 8
+	step_sleep 8
 	turn_head_left
 	step_end
 
--- a/maps/TeamRocketBaseB2F.asm
+++ b/maps/TeamRocketBaseB2F.asm
@@ -465,17 +465,17 @@
 	step_end
 
 MovementData_0x6d258:
-	step_sleep_8
+	step_sleep 8
 	step_left
 	step_left
 	turn_head_up
-	step_sleep_8
+	step_sleep 8
 	step_right
 	step_right
 	step_right
 	step_right
 	turn_head_up
-	step_sleep_8
+	step_sleep 8
 	step_left
 	step_left
 	turn_head_down
--- a/maps/TeamRocketBaseB3F.asm
+++ b/maps/TeamRocketBaseB3F.asm
@@ -270,8 +270,8 @@
 	fix_facing
 	fast_jump_step_left
 	remove_fixed_facing
-	step_sleep_8
-	step_sleep_8
+	step_sleep 8
+	step_sleep 8
 	slow_step_right
 	big_step_down
 	big_step_down