diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/battle/battle_transition.asm | 42 | ||||
-rwxr-xr-x | engine/battle_anims/functions.asm | 42 | ||||
-rwxr-xr-x | engine/events/celebi.asm | 43 | ||||
-rwxr-xr-x | engine/routines/sine.asm | 48 | ||||
-rwxr-xr-x | engine/sprites.asm | 45 |
5 files changed, 12 insertions, 208 deletions
diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index e331cf3ee..1de84421d 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -749,47 +749,7 @@ WipeLYOverrides: ; 8c6d8 StartTrainerBattle_DrawSineWave: ; 8c6f7 (23:46f7) -; a = d * sin(a * pi/32) - and %111111 - cp %100000 - jr nc, .negative - call .ApplySineWave - ld a, h - ret - -.negative - and %011111 - call .ApplySineWave - ld a, h - xor $ff - inc a - ret - -.ApplySineWave: ; 8c70c (23:470c) - ld e, a - ld a, d - ld d, 0 - ld hl, .sinewave - add hl, de - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld hl, 0 -.multiply - srl a - jr nc, .even - add hl, de -.even - sla e - rl d - and a - jr nz, .multiply - ret -; 8c728 (23:4728) - -.sinewave ; 8c728 - sine_wave 32 + calc_sine_wave ; 8c768 StartTrainerBattle_ZoomToBlack: ; 8c768 (23:4768) diff --git a/engine/battle_anims/functions.asm b/engine/battle_anims/functions.asm index 28612e636..e0eedec86 100755 --- a/engine/battle_anims/functions.asm +++ b/engine/battle_anims/functions.asm @@ -4125,45 +4125,11 @@ BattleAnim_IncAnonJumptableIndex: ; ce72c (33:672c) BattleAnim_Cosine: ; ce732 (33:6732) ; a = d * cos(a * pi/32) - add %010000 + add %010000 ; cos(x) = sin(x + pi/2) + ; fallthrough BattleAnim_Sine: ; ce734 (33:6734) ; a = d * sin(a * pi/32) - and %111111 - cp %100000 - jr nc, .negative - call .ApplySineWave - ld a, h - ret - -.negative - and %011111 - call .ApplySineWave - ld a, h - xor $ff - inc a - ret - -.ApplySineWave: - ld e, a - ld a, d - ld d, 0 - ld hl, BattleAnimSineWave - add hl, de - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld hl, 0 -.multiply - srl a - jr nc, .even - add hl, de -.even - sla e - rl d - and a - jr nz, .multiply - ret + calc_sine_wave BattleAnimSineWave BattleAnim_Sine_e: ; ce765 (33:6765) ld a, e @@ -4195,5 +4161,5 @@ BattleAnim_AbsCosinePrecise: ; ce778 ; ce77f BattleAnimSineWave: ; ce77f - sine_wave 32 + sine_table 32 ; ce7bf diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index 87876f1cb..99c22f49f 100755 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -241,47 +241,8 @@ UpdateCelebiPosition: ; 49aa2 (12:5aa2) CelebiEvent_Cosine: ; 49b3b (12:5b3b) ; a = d * cos(a * pi/32) - add %010000 - and %111111 - cp %100000 - jr nc, .negative - call .ApplySineWave - ld a, h - ret - -.negative - and %011111 - call .ApplySineWave - ld a, h - xor $ff - inc a - ret - -.ApplySineWave: ; 49b52 (12:5b52) - ld e, a - ld a, d - ld d, 0 - ld hl, .sinewave - add hl, de - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld hl, 0 -.multiply - srl a - jr nc, .even - add hl, de -.even - sla e - rl d - and a - jr nz, .multiply - ret -; 49b6e (12:5b6e) - -.sinewave ; 49b6e - sine_wave 32 + add %010000 ; cos(x) = sin(x + pi/2) + calc_sine_wave ; 49bae GetCelebiSpriteTile: ; 49bae diff --git a/engine/routines/sine.asm b/engine/routines/sine.asm index 1b2b8f2f3..23e86c015 100755 --- a/engine/routines/sine.asm +++ b/engine/routines/sine.asm @@ -1,48 +1,4 @@ _Sine:: ; 84d9 -; A simple sine function. -; Return d * sin(e) in hl. - -; e is a signed 6-bit value. +; a = d * sin(e * pi/32) ld a, e - and %111111 - cp %100000 - jr nc, .negative - call .ApplySineWave - ld a, h - ret - -.negative - and %011111 - call .ApplySineWave - ld a, h - xor $ff - inc a - ret - -.ApplySineWave: ; 84ef - ld e, a - ld a, d - ld d, 0 - ld hl, .sinewave - add hl, de - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld hl, 0 -; Factor amplitude -.multiply - srl a - jr nc, .even - add hl, de -.even - sla e - rl d - and a - jr nz, .multiply - ret - -.sinewave ; 850b -; A 32-word table representing a sine wave. -; sin(90 degrees) is index $10 with an amplitude of $100. - sine_wave 32 + calc_sine_wave diff --git a/engine/sprites.asm b/engine/sprites.asm index e39fa615d..97ac13559 100755 --- a/engine/sprites.asm +++ b/engine/sprites.asm @@ -577,50 +577,11 @@ endr Sprites_Cosine: ; 8e72a ; a = d * cos(a * pi/32) - add %010000 + add %010000 ; cos(x) = sin(x + pi/2) + ; fallthrough Sprites_Sine: ; 8e72c ; a = d * sin(a * pi/32) - and %111111 - cp %100000 - jr nc, .negative - call .ApplySineWave - ld a, h - ret - -.negative - and %011111 - call .ApplySineWave - ld a, h - xor $ff - inc a - ret -; 8e741 - -.ApplySineWave: ; 8e741 - ld e, a - ld a, d - ld d, 0 - ld hl, .sinewave - add hl, de - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld hl, 0 -.multiply - srl a - jr nc, .even - add hl, de -.even - sla e - rl d - and a - jr nz, .multiply - ret -; 8e75d - -.sinewave ; 8e75d - sine_wave 32 + calc_sine_wave AnimateEndOfExpBar: ; 8e79d |