Skip to content

Commit 3d4d6dd

Browse files
committed
remove use of ubyte like a combined expressions
1 parent b3e4c52 commit 3d4d6dd

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

enemy.p8

+5-2
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,12 @@ _move_down_else
428428

429429
sub draw() {
430430
; Look up sub-byte position
431+
431432
ubyte cur = enemyRef[EN_DIR]
432-
+ (not enemyRef[EN_SUBPOS] & main.TOPMOST) * 4
433-
+ (not enemyRef[EN_SUBPOS] & main.LEFTMOST) * 2
433+
if (enemyRef[EN_SUBPOS] & main.TOPMOST) == 0
434+
cur += 4
435+
if (enemyRef[EN_SUBPOS] & main.LEFTMOST) == 0
436+
cur += 2
434437

435438
ubyte tmp_x = enemyRef[EN_X]
436439
ubyte tmp_y = enemyRef[EN_Y]

explosion.p8

+4-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ explosion {
7272
; Find korrekt animation, first correct "step"
7373
ubyte gfx_ind = (explosionRef[EX_STAGE] - 1 ) * 8
7474
; Correct for nibble shift
75-
gfx_ind += (not explosionRef[EX_SUBPOS] & main.TOPMOST) * 4
76-
gfx_ind += (not explosionRef[EX_SUBPOS] & main.LEFTMOST) * 2
75+
if (explosionRef[EX_SUBPOS] & main.TOPMOST) == 0
76+
gfx_ind += 4
77+
if (explosionRef[EX_SUBPOS] & main.LEFTMOST) == 0
78+
gfx_ind += 2
7779

7880
; Convert first byte to two PETSCII chars and draw
7981
ubyte gfx_byte = gfx[gfx_ind]

0 commit comments

Comments
 (0)