Fix issues in review

This commit is contained in:
mid-kid 2019-02-16 19:08:34 +01:00
parent 80ece33e3e
commit 7d6befa181
6 changed files with 22 additions and 18 deletions

View File

@ -25,7 +25,7 @@
const BATTLEANIMSTRUCT_16 const BATTLEANIMSTRUCT_16
const BATTLEANIMSTRUCT_17 const BATTLEANIMSTRUCT_17
BATTLEANIMSTRUCT_LENGTH EQU const_value BATTLEANIMSTRUCT_LENGTH EQU const_value
NUM_ANIM_OBJECTS EQUS "(wActiveAnimObjectsEnd - wActiveAnimObjects) / BATTLEANIMSTRUCT_LENGTH" NUM_ANIM_OBJECTS EQU 10 ; see wActiveAnimObjects
; Start tile for battle animation graphics ; Start tile for battle animation graphics
BATTLEANIM_BASE_TILE EQU 7 * 7 ; Maximum size of a pokemon picture BATTLEANIM_BASE_TILE EQU 7 * 7 ; Maximum size of a pokemon picture
@ -818,7 +818,7 @@ BATTLEANIM_BASE_TILE EQU 7 * 7 ; Maximum size of a pokemon picture
const BG_EFFECT_STRUCT_BATTLE_TURN const BG_EFFECT_STRUCT_BATTLE_TURN
const BG_EFFECT_STRUCT_03 const BG_EFFECT_STRUCT_03
BG_EFFECT_STRUCT_LENGTH EQU const_value BG_EFFECT_STRUCT_LENGTH EQU const_value
NUM_BG_EFFECTS EQUS "(wActiveBGEffectsEnd - wActiveBGEffects) / BG_EFFECT_STRUCT_LENGTH" NUM_BG_EFFECTS EQU 5 ; see wActiveBGEffects
; battle palettes ; battle palettes
const_def const_def

View File

@ -89,7 +89,7 @@ BattleAnimOAMUpdate:
ld hl, wBattleAnimTempOAMFlags ld hl, wBattleAnimTempOAMFlags
ld a, [wBattleAnimTempFrameOAMFlags] ld a, [wBattleAnimTempFrameOAMFlags]
xor [hl] xor [hl]
and $e0 ; Keep priority, x flip and y flip flags. and PRIORITY | Y_FLIP | X_FLIP
ld [hl], a ld [hl], a
pop af pop af
@ -171,7 +171,7 @@ BattleAnimOAMUpdate:
or b or b
ld b, a ld b, a
ld a, [wBattleAnimTempPalette] ld a, [wBattleAnimTempPalette]
and $f and (PRIORITY | Y_FLIP | X_FLIP | OBP_NUM) ^ $ff
or b or b
ld [de], a ld [de], a
@ -203,7 +203,7 @@ InitBattleAnimBuffer:
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
and %10000000 and PRIORITY
ld [wBattleAnimTempOAMFlags], a ld [wBattleAnimTempOAMFlags], a
xor a xor a
ld [wBattleAnimTempFrameOAMFlags], a ld [wBattleAnimTempFrameOAMFlags], a

View File

@ -37,7 +37,7 @@ GetBattleAnimFrame:
push af push af
ld a, [hl] ld a, [hl]
push hl push hl
and %00111111 and (Y_FLIP << 1 | X_FLIP << 1) ^ $ff
ld hl, BATTLEANIMSTRUCT_DURATION ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc add hl, bc
ld [hl], a ld [hl], a
@ -55,6 +55,7 @@ GetBattleAnimFrame:
ld hl, BATTLEANIMSTRUCT_DURATION ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ld hl, BATTLEANIMSTRUCT_FRAME ld hl, BATTLEANIMSTRUCT_FRAME
add hl, bc add hl, bc
dec [hl] dec [hl]

View File

@ -315,8 +315,8 @@ UpdateAnimFrame:
AddOrSubtractY: AddOrSubtractY:
push hl push hl
ld a, [hl] ld a, [hl]
ld hl, wCurSpriteAddSubFlags ld hl, wCurSpriteOAMFlags
bit 6, [hl] bit OAM_Y_FLIP, [hl]
jr z, .ok jr z, .ok
; 8 - a ; 8 - a
add $8 add $8
@ -330,8 +330,8 @@ AddOrSubtractY:
AddOrSubtractX: AddOrSubtractX:
push hl push hl
ld a, [hl] ld a, [hl]
ld hl, wCurSpriteAddSubFlags ld hl, wCurSpriteOAMFlags
bit 5, [hl] ; x flip bit OAM_X_FLIP, [hl]
jr z, .ok jr z, .ok
; 8 - a ; 8 - a
add $8 add $8
@ -343,20 +343,20 @@ AddOrSubtractX:
ret ret
GetSpriteOAMAttr: GetSpriteOAMAttr:
ld a, [wCurSpriteAddSubFlags] ld a, [wCurSpriteOAMFlags]
ld b, a ld b, a
ld a, [hl] ld a, [hl]
xor b xor b
and $e0 and PRIORITY | Y_FLIP | X_FLIP
ld b, a ld b, a
ld a, [hl] ld a, [hl]
and $1f and (PRIORITY | Y_FLIP | X_FLIP) ^ $ff
or b or b
ret ret
InitSpriteAnimBuffer: InitSpriteAnimBuffer:
xor a xor a
ld [wCurSpriteAddSubFlags], a ld [wCurSpriteOAMFlags], a
ld hl, SPRITEANIMSTRUCT_TILE_ID ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc add hl, bc
ld a, [hli] ld a, [hli]
@ -436,7 +436,7 @@ GetSpriteAnimFrame:
push af push af
ld a, [hl] ld a, [hl]
push hl push hl
and $3f and (Y_FLIP << 1 | X_FLIP << 1) ^ $ff
ld hl, SPRITEANIMSTRUCT_DURATIONOFFSET ld hl, SPRITEANIMSTRUCT_DURATIONOFFSET
add hl, bc add hl, bc
add [hl] add [hl]
@ -446,9 +446,9 @@ GetSpriteAnimFrame:
pop hl pop hl
.okay .okay
ld a, [hl] ld a, [hl]
and $c0 and Y_FLIP << 1 | X_FLIP << 1 ; The << 1 is compensated in the "frame" macro
srl a srl a
ld [wCurSpriteAddSubFlags], a ld [wCurSpriteOAMFlags], a
pop af pop af
ret ret

View File

@ -174,3 +174,6 @@ limited_interpret_data EQUS "text_dots"
link_wait_button EQUS "text_linkwaitbutton" link_wait_button EQUS "text_linkwaitbutton"
current_day EQUS "text_today" current_day EQUS "text_today"
text_jump EQUS "text_far" text_jump EQUS "text_far"
; macros/scripts/battle_anims.asm
anim_clearsprites EQUS "anim_keepsprites"

View File

@ -263,7 +263,7 @@ wCurIcon:: db ; c3b6
wCurIconTile:: db wCurIconTile:: db
wSpriteAnimAddrBackup:: wSpriteAnimAddrBackup::
wSpriteAnimIDBuffer:: wSpriteAnimIDBuffer::
wCurSpriteAddSubFlags:: wCurSpriteOAMFlags::
dw dw
wCurAnimVTile:: db wCurAnimVTile:: db
wCurAnimXCoord:: db wCurAnimXCoord:: db