Use pokecrystal's sine_table macro

A circle has 65536 "degrees", so 32768 "degrees" = pi radians = half a circle
This commit is contained in:
Rangi
2020-06-15 12:12:05 -04:00
parent 9048adc08a
commit 6bc203541b
5 changed files with 8 additions and 17 deletions

View File

@@ -669,10 +669,7 @@ WipeLYOverrides:
ret
StartTrainerBattle_DrawSineWave:
calc_sine_wave .SineWave
.SineWave:
sine_table 256
calc_sine_wave
StartTrainerBattle_ZoomToBlack:
farcall Function55a1

View File

@@ -4151,4 +4151,4 @@ BattleAnim_AbsCosinePrecise:
ret
BattleAnimSineWave:
sine_table 256
sine_table 32

View File

@@ -545,10 +545,7 @@ Sprites_Cosine:
; fallthrough
Sprites_Sine:
; a = d * sin(a * pi/32)
calc_sine_wave .SineWave
.SineWave:
sine_table 256
calc_sine_wave
AnimateEndOfExpBar:
ldh a, [hSGB]

View File

@@ -1,7 +1,4 @@
_Sine::
; a = d * sin(e * pi/256)
; a = d * sin(e * pi/32)
ld a, e
calc_sine_wave .SineWave
.SineWave:
sine_table $100
calc_sine_wave

View File

@@ -124,10 +124,10 @@ endr
ENDM
sine_table: MACRO
; \1: amplitude
; \1 samples of sin(x) from x=0 to x<32768 (pi radians)
x = 0
rept 32
rept \1
dw (sin(x) + (sin(x) & $ff)) >> 8 ; round up
x = x + (\1) * $40000
x = x + DIV(32768, \1); a circle has 65536 "degrees"
endr
ENDM