mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Getting started with battle anims; sine and cosine
This commit is contained in:
parent
5b94d54a6c
commit
81ea723b04
@ -106,7 +106,7 @@ RunBattleAnimScript: ; cc163
|
||||
|
||||
.playframe
|
||||
call Functioncc25f
|
||||
call Functionccb48
|
||||
call _ExecuteBGEffects
|
||||
call Functioncc96e
|
||||
call Function3b0c
|
||||
call BattleAnimRequestPals
|
||||
@ -633,7 +633,7 @@ BattleAnimCmd_Obj: ; cc41f (33:441f)
|
||||
ld [BattleAnimTemps + 2], a
|
||||
call GetBattleAnimByte
|
||||
ld [BattleAnimTemps + 3], a
|
||||
call Functioncc9a1
|
||||
call QueueBattleAnimation
|
||||
ret
|
||||
|
||||
BattleAnimCmd_BGEffect: ; cc43b (33:443b)
|
||||
@ -645,7 +645,7 @@ BattleAnimCmd_BGEffect: ; cc43b (33:443b)
|
||||
ld [BattleAnimTemps + 2], a
|
||||
call GetBattleAnimByte
|
||||
ld [BattleAnimTemps + 3], a
|
||||
call Functionccb4f
|
||||
call _QueueBGEffect
|
||||
ret
|
||||
|
||||
BattleAnimCmd_BGP: ; cc457 (33:4457)
|
||||
@ -667,20 +667,20 @@ BattleAnimCmd_ResetObp0: ; cc46c (33:446c)
|
||||
ld a, [hSGB]
|
||||
and a
|
||||
ld a, $e0
|
||||
jr z, .asm_cc475
|
||||
jr z, .not_sgb
|
||||
ld a, $f0
|
||||
.asm_cc475
|
||||
.not_sgb
|
||||
ld [wcfc8], a
|
||||
ret
|
||||
|
||||
BattleAnimCmd_ClearObjs: ; cc479 (33:4479)
|
||||
ld hl, OTPartyMon3HP
|
||||
ld hl, ActiveAnimObjects
|
||||
ld a, $a0
|
||||
.asm_cc47e
|
||||
.loop
|
||||
ld [hl], $0
|
||||
inc hl
|
||||
dec a
|
||||
jr nz, .asm_cc47e
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
BattleAnimCmd_1GFX:
|
||||
@ -725,7 +725,7 @@ endr
|
||||
BattleAnimCmd_IncObj: ; cc4c0 (33:44c0)
|
||||
call GetBattleAnimByte
|
||||
ld e, $a
|
||||
ld bc, OTPartyMon3HP
|
||||
ld bc, ActiveAnimObjects
|
||||
.asm_cc4c8
|
||||
ld hl, $0
|
||||
add hl, bc
|
||||
@ -773,7 +773,7 @@ BattleAnimCmd_IncBGEffect: ; cc4e3 (33:44e3)
|
||||
BattleAnimCmd_SetObj: ; cc506 (33:4506)
|
||||
call GetBattleAnimByte
|
||||
ld e, $a
|
||||
ld bc, OTPartyMon3HP
|
||||
ld bc, ActiveAnimObjects
|
||||
.asm_cc50e
|
||||
ld hl, $0
|
||||
add hl, bc
|
||||
@ -1480,12 +1480,12 @@ Functioncc94b: ; cc94b
|
||||
Functioncc96e: ; cc96e
|
||||
ld a, $0
|
||||
ld [w5_d418], a
|
||||
ld hl, OTPartyMon3HP
|
||||
ld e, $a
|
||||
.asm_cc978
|
||||
ld hl, ActiveAnimObjects
|
||||
ld e, 10
|
||||
.loop
|
||||
ld a, [hl]
|
||||
and a
|
||||
jr z, .asm_cc98a
|
||||
jr z, .next
|
||||
ld c, l
|
||||
ld b, h
|
||||
push hl
|
||||
@ -1494,24 +1494,24 @@ Functioncc96e: ; cc96e
|
||||
call Functioncca09
|
||||
pop de
|
||||
pop hl
|
||||
jr c, .asm_cc9a0
|
||||
jr c, .done
|
||||
|
||||
.asm_cc98a
|
||||
.next
|
||||
ld bc, $0018
|
||||
add hl, bc
|
||||
dec e
|
||||
jr nz, .asm_cc978
|
||||
jr nz, .loop
|
||||
ld a, [w5_d418]
|
||||
ld l, a
|
||||
ld h, $c4
|
||||
.asm_cc997
|
||||
ld h, Sprites / $100
|
||||
.loop2
|
||||
ld a, l
|
||||
cp $a0
|
||||
jr nc, .asm_cc9a0
|
||||
cp SpritesEnd % $100
|
||||
jr nc, .done
|
||||
xor a
|
||||
ld [hli], a
|
||||
jr .asm_cc997
|
||||
jr .loop2
|
||||
|
||||
.asm_cc9a0
|
||||
.done
|
||||
ret
|
||||
; cc9a1
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -192,7 +192,7 @@ endr
|
||||
ld a, [hl]
|
||||
add $3
|
||||
ld [hl], a
|
||||
call .ApplySineWaveY
|
||||
call .Sprites_Sine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
||||
add hl, bc
|
||||
@ -211,7 +211,7 @@ endr
|
||||
inc a
|
||||
ld [hl], a
|
||||
ld d, $2
|
||||
call .ApplySineWaveY
|
||||
call .Sprites_Sine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
||||
add hl, bc
|
||||
@ -252,14 +252,14 @@ endr
|
||||
ld a, [hl]
|
||||
push af
|
||||
push de
|
||||
call .ApplySineWaveY
|
||||
call .Sprites_Sine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
pop de
|
||||
pop af
|
||||
call .ApplySineWaveX
|
||||
call .Sprites_Cosine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_XOFFSET
|
||||
add hl, bc
|
||||
@ -297,14 +297,14 @@ endr
|
||||
ld a, [hl]
|
||||
push af
|
||||
push de
|
||||
call .ApplySineWaveY
|
||||
call .Sprites_Sine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
pop de
|
||||
pop af
|
||||
call .ApplySineWaveX
|
||||
call .Sprites_Cosine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_XOFFSET
|
||||
add hl, bc
|
||||
@ -399,7 +399,7 @@ endr
|
||||
.asm_8d462
|
||||
ld a, e
|
||||
ld d, $20
|
||||
call .ApplySineWaveY
|
||||
call .Sprites_Sine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
||||
add hl, bc
|
||||
@ -470,7 +470,7 @@ endr
|
||||
jr c, .asm_8d4cd
|
||||
dec [hl]
|
||||
ld d, $28
|
||||
call .ApplySineWaveY
|
||||
call .Sprites_Sine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
||||
add hl, bc
|
||||
@ -509,7 +509,7 @@ endr
|
||||
ld hl, SPRITEANIMSTRUCT_0C
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
call ApplySineWaveY
|
||||
call Sprites_Sine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
||||
add hl, bc
|
||||
@ -590,7 +590,7 @@ endr
|
||||
|
||||
push af
|
||||
push de
|
||||
call .ApplySineWaveY
|
||||
call .Sprites_Sine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
||||
add hl, bc
|
||||
@ -598,7 +598,7 @@ endr
|
||||
|
||||
pop de
|
||||
pop af
|
||||
call .ApplySineWaveX
|
||||
call .Sprites_Cosine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_XOFFSET
|
||||
add hl, bc
|
||||
@ -638,14 +638,14 @@ rept 3
|
||||
endr
|
||||
push af
|
||||
push de
|
||||
call .ApplySineWaveY
|
||||
call .Sprites_Sine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
pop de
|
||||
pop af
|
||||
call .ApplySineWaveX
|
||||
call .Sprites_Cosine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_XOFFSET
|
||||
add hl, bc
|
||||
@ -685,7 +685,7 @@ endr
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
inc [hl]
|
||||
call .ApplySineWaveX
|
||||
call .Sprites_Cosine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_XOFFSET
|
||||
add hl, bc
|
||||
@ -711,7 +711,7 @@ endr
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
inc [hl]
|
||||
call .ApplySineWaveX
|
||||
call .Sprites_Cosine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_XOFFSET
|
||||
add hl, bc
|
||||
@ -747,7 +747,7 @@ endr
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
inc [hl]
|
||||
call .ApplySineWaveX
|
||||
call .Sprites_Cosine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_XOFFSET
|
||||
add hl, bc
|
||||
@ -780,7 +780,7 @@ endr
|
||||
xor $ff
|
||||
inc a
|
||||
ld d, $20
|
||||
call .ApplySineWaveY
|
||||
call .Sprites_Sine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
||||
add hl, bc
|
||||
@ -800,7 +800,7 @@ endr
|
||||
xor $ff
|
||||
inc a
|
||||
ld d, $20
|
||||
call .ApplySineWaveY
|
||||
call .Sprites_Sine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
||||
add hl, bc
|
||||
@ -821,14 +821,14 @@ endr
|
||||
ld a, [hl]
|
||||
push af
|
||||
push de
|
||||
call .ApplySineWaveY
|
||||
call .Sprites_Sine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
pop de
|
||||
pop af
|
||||
call .ApplySineWaveX
|
||||
call .Sprites_Cosine
|
||||
|
||||
ld hl, SPRITEANIMSTRUCT_XOFFSET
|
||||
add hl, bc
|
||||
@ -885,11 +885,11 @@ endr
|
||||
ret
|
||||
; 8d6de
|
||||
|
||||
.ApplySineWaveY: ; 8d6de (23:56de)
|
||||
call ApplySineWaveY
|
||||
.Sprites_Sine: ; 8d6de (23:56de)
|
||||
call Sprites_Sine
|
||||
ret
|
||||
|
||||
.ApplySineWaveX: ; 8d6e2 (23:56e2)
|
||||
call ApplySineWaveX
|
||||
.Sprites_Cosine: ; 8d6e2 (23:56e2)
|
||||
call Sprites_Cosine
|
||||
ret
|
||||
; 8d6e6 (23:56e6)
|
||||
|
@ -610,26 +610,26 @@ INCLUDE "data/sprite_engine.asm"
|
||||
; Unknown_8d6e6
|
||||
; Unknown_8d94d
|
||||
|
||||
ApplySineWaveX: ; 8e72a
|
||||
Sprites_Cosine: ; 8e72a
|
||||
add $10
|
||||
ApplySineWaveY: ; 8e72c
|
||||
Sprites_Sine: ; 8e72c
|
||||
and $3f
|
||||
cp $20
|
||||
jr nc, .flip
|
||||
call .ApplyOffset
|
||||
jr nc, .negative
|
||||
call .ApplySineWave
|
||||
ld a, h
|
||||
ret
|
||||
|
||||
.flip
|
||||
.negative
|
||||
and $1f
|
||||
call .ApplyOffset
|
||||
call .ApplySineWave
|
||||
ld a, h
|
||||
xor $ff ; cpl
|
||||
inc a
|
||||
ret
|
||||
; 8e741
|
||||
|
||||
.ApplyOffset: ; 8e741
|
||||
.ApplySineWave: ; 8e741
|
||||
ld e, a
|
||||
ld a, d
|
||||
ld d, 0
|
||||
@ -641,16 +641,16 @@ endr
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
ld hl, 0
|
||||
.loop
|
||||
.multiply
|
||||
srl a
|
||||
jr nc, .skip_add
|
||||
jr nc, .even
|
||||
add hl, de
|
||||
|
||||
.skip_add
|
||||
.even
|
||||
sla e
|
||||
rl d
|
||||
and a
|
||||
jr nz, .loop
|
||||
jr nz, .multiply
|
||||
ret
|
||||
; 8e75d
|
||||
|
||||
@ -701,7 +701,7 @@ endr
|
||||
|
||||
push de
|
||||
push hl
|
||||
call ApplySineWaveY
|
||||
call Sprites_Sine
|
||||
pop hl
|
||||
pop de
|
||||
add 13 * 8
|
||||
@ -710,7 +710,7 @@ endr
|
||||
pop af
|
||||
push de
|
||||
push hl
|
||||
call ApplySineWaveX
|
||||
call Sprites_Cosine
|
||||
pop hl
|
||||
pop de
|
||||
add 10 * 8 + 4
|
||||
|
@ -151,7 +151,7 @@ Function49aa2: ; 49aa2 (12:5aa2)
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
inc [hl]
|
||||
call Function49b3b
|
||||
call CelebiEvent_Cosine
|
||||
ld hl, $6
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
@ -223,27 +223,27 @@ Function49b30: ; 49b30 (12:5b30)
|
||||
call Function3b3c
|
||||
ret
|
||||
|
||||
Function49b3b: ; 49b3b (12:5b3b)
|
||||
CelebiEvent_Cosine: ; 49b3b (12:5b3b)
|
||||
add $10
|
||||
and $3f
|
||||
cp $20
|
||||
jr nc, .asm_49b48
|
||||
call Function49b52
|
||||
call .SineFunction
|
||||
ld a, h
|
||||
ret
|
||||
.asm_49b48
|
||||
and $1f
|
||||
call Function49b52
|
||||
call .SineFunction
|
||||
ld a, h
|
||||
xor $ff
|
||||
inc a
|
||||
ret
|
||||
|
||||
Function49b52: ; 49b52 (12:5b52)
|
||||
.SineFunction: ; 49b52 (12:5b52)
|
||||
ld e, a
|
||||
ld a, d
|
||||
ld d, $0
|
||||
ld hl, Unknown_49b6e
|
||||
ld hl, .sinewave
|
||||
rept 2
|
||||
add hl, de
|
||||
endr
|
||||
@ -251,19 +251,19 @@ endr
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
ld hl, 0
|
||||
.asm_49b61
|
||||
.multiply
|
||||
srl a
|
||||
jr nc, .asm_49b66
|
||||
jr nc, .even
|
||||
add hl, de
|
||||
.asm_49b66
|
||||
.even
|
||||
sla e
|
||||
rl d
|
||||
and a
|
||||
jr nz, .asm_49b61
|
||||
jr nz, .multiply
|
||||
ret
|
||||
; 49b6e (12:5b6e)
|
||||
|
||||
Unknown_49b6e: ; 49b6e
|
||||
.sinewave: ; 49b6e
|
||||
sine_wave $100
|
||||
; 49bae
|
||||
|
||||
|
10
main.asm
10
main.asm
@ -2230,24 +2230,24 @@ _Sine:: ; 84d9
|
||||
cp %100000
|
||||
jr nc, .negative
|
||||
|
||||
call Function84ef
|
||||
call .ApplySineWave
|
||||
ld a, h
|
||||
ret
|
||||
|
||||
.negative
|
||||
and %011111
|
||||
call Function84ef
|
||||
call .ApplySineWave
|
||||
ld a, h
|
||||
xor -1
|
||||
inc a
|
||||
ret
|
||||
; 84ef
|
||||
|
||||
Function84ef: ; 84ef
|
||||
.ApplySineWave: ; 84ef
|
||||
ld e, a
|
||||
ld a, d
|
||||
ld d, 0
|
||||
ld hl, SineWave
|
||||
ld hl, .sinewave
|
||||
rept 2
|
||||
add hl, de
|
||||
endr
|
||||
@ -2269,7 +2269,7 @@ endr
|
||||
ret
|
||||
; 850b
|
||||
|
||||
SineWave: ; 850b
|
||||
.sinewave: ; 850b
|
||||
; A $20-word table representing a sine wave.
|
||||
; 90 degrees is index $10 at a base amplitude of $100.
|
||||
sine_wave $100
|
||||
|
24
wram.asm
24
wram.asm
@ -3053,24 +3053,34 @@ w5_d192:: ds 1
|
||||
w5_d193:: ds 1
|
||||
w5_d194:: ds 1
|
||||
w5_d195:: ds 1
|
||||
|
||||
ds 106
|
||||
|
||||
LYOverridesBackup:: ; d200
|
||||
ds SCREEN_HEIGHT_PX
|
||||
LYOverridesBackupEnd::
|
||||
|
||||
ds $100 - SCREEN_HEIGHT_PX
|
||||
|
||||
|
||||
SECTION "Battle Animations", WRAMX, BANK [5]
|
||||
SECTION "Battle Animations", WRAMX [$d300], BANK [5]
|
||||
|
||||
w5_d300:: ds 10
|
||||
|
||||
ActiveAnimObjects:: ; d30a
|
||||
ds 4 * 40
|
||||
battle_anim_struct: MACRO
|
||||
; Placeholder until we can figure out what it all means
|
||||
ds $18
|
||||
endm
|
||||
|
||||
ds 80
|
||||
ActiveAnimObjects:: ; d30a
|
||||
AnimObject01:: battle_anim_struct AnimObject01
|
||||
AnimObject02:: battle_anim_struct AnimObject02
|
||||
AnimObject03:: battle_anim_struct AnimObject03
|
||||
AnimObject04:: battle_anim_struct AnimObject04
|
||||
AnimObject05:: battle_anim_struct AnimObject05
|
||||
AnimObject06:: battle_anim_struct AnimObject06
|
||||
AnimObject07:: battle_anim_struct AnimObject07
|
||||
AnimObject08:: battle_anim_struct AnimObject08
|
||||
AnimObject09:: battle_anim_struct AnimObject09
|
||||
AnimObject10:: battle_anim_struct AnimObject10
|
||||
ActiveAnimObjectsEnd:: ; d3aa
|
||||
|
||||
ActiveBGEffects:: ; d3fa
|
||||
ds 4 * 5
|
||||
|
Loading…
x
Reference in New Issue
Block a user