summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authormid-kid <esteve.varela@gmail.com>2019-02-16 19:08:34 +0100
committermid-kid <esteve.varela@gmail.com>2019-02-16 19:08:34 +0100
commit7d6befa1816110c5518292d4c7cb8841a355dc79 (patch)
tree686d1698bfe28a93074e433ac12cfa81568d52d6 /engine
parent80ece33e3e847563188782b76107256fba53088d (diff)
Fix issues in review
Diffstat (limited to 'engine')
-rw-r--r--engine/battle_anims/core.asm6
-rw-r--r--engine/battle_anims/helpers.asm3
-rw-r--r--engine/gfx/sprites.asm22
3 files changed, 16 insertions, 15 deletions
diff --git a/engine/battle_anims/core.asm b/engine/battle_anims/core.asm
index 1a63b98e1..171816f38 100644
--- a/engine/battle_anims/core.asm
+++ b/engine/battle_anims/core.asm
@@ -89,7 +89,7 @@ BattleAnimOAMUpdate:
ld hl, wBattleAnimTempOAMFlags
ld a, [wBattleAnimTempFrameOAMFlags]
xor [hl]
- and $e0 ; Keep priority, x flip and y flip flags.
+ and PRIORITY | Y_FLIP | X_FLIP
ld [hl], a
pop af
@@ -171,7 +171,7 @@ BattleAnimOAMUpdate:
or b
ld b, a
ld a, [wBattleAnimTempPalette]
- and $f
+ and (PRIORITY | Y_FLIP | X_FLIP | OBP_NUM) ^ $ff
or b
ld [de], a
@@ -203,7 +203,7 @@ InitBattleAnimBuffer:
add hl, bc
ld a, [hl]
- and %10000000
+ and PRIORITY
ld [wBattleAnimTempOAMFlags], a
xor a
ld [wBattleAnimTempFrameOAMFlags], a
diff --git a/engine/battle_anims/helpers.asm b/engine/battle_anims/helpers.asm
index 127fe5412..64d43f032 100644
--- a/engine/battle_anims/helpers.asm
+++ b/engine/battle_anims/helpers.asm
@@ -37,7 +37,7 @@ GetBattleAnimFrame:
push af
ld a, [hl]
push hl
- and %00111111
+ and (Y_FLIP << 1 | X_FLIP << 1) ^ $ff
ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc
ld [hl], a
@@ -55,6 +55,7 @@ GetBattleAnimFrame:
ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc
ld [hl], a
+
ld hl, BATTLEANIMSTRUCT_FRAME
add hl, bc
dec [hl]
diff --git a/engine/gfx/sprites.asm b/engine/gfx/sprites.asm
index 76519eb62..79cd71671 100644
--- a/engine/gfx/sprites.asm
+++ b/engine/gfx/sprites.asm
@@ -315,8 +315,8 @@ UpdateAnimFrame:
AddOrSubtractY:
push hl
ld a, [hl]
- ld hl, wCurSpriteAddSubFlags
- bit 6, [hl]
+ ld hl, wCurSpriteOAMFlags
+ bit OAM_Y_FLIP, [hl]
jr z, .ok
; 8 - a
add $8
@@ -330,8 +330,8 @@ AddOrSubtractY:
AddOrSubtractX:
push hl
ld a, [hl]
- ld hl, wCurSpriteAddSubFlags
- bit 5, [hl] ; x flip
+ ld hl, wCurSpriteOAMFlags
+ bit OAM_X_FLIP, [hl]
jr z, .ok
; 8 - a
add $8
@@ -343,20 +343,20 @@ AddOrSubtractX:
ret
GetSpriteOAMAttr:
- ld a, [wCurSpriteAddSubFlags]
+ ld a, [wCurSpriteOAMFlags]
ld b, a
ld a, [hl]
xor b
- and $e0
+ and PRIORITY | Y_FLIP | X_FLIP
ld b, a
ld a, [hl]
- and $1f
+ and (PRIORITY | Y_FLIP | X_FLIP) ^ $ff
or b
ret
InitSpriteAnimBuffer:
xor a
- ld [wCurSpriteAddSubFlags], a
+ ld [wCurSpriteOAMFlags], a
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld a, [hli]
@@ -436,7 +436,7 @@ GetSpriteAnimFrame:
push af
ld a, [hl]
push hl
- and $3f
+ and (Y_FLIP << 1 | X_FLIP << 1) ^ $ff
ld hl, SPRITEANIMSTRUCT_DURATIONOFFSET
add hl, bc
add [hl]
@@ -446,9 +446,9 @@ GetSpriteAnimFrame:
pop hl
.okay
ld a, [hl]
- and $c0
+ and Y_FLIP << 1 | X_FLIP << 1 ; The << 1 is compensated in the "frame" macro
srl a
- ld [wCurSpriteAddSubFlags], a
+ ld [wCurSpriteOAMFlags], a
pop af
ret