@@ -294,6 +294,13 @@ _GetTileAndCoordsInFrontOfPlayer:
294294 ld [ wTileInFrontOfPlayer ], a
295295 ret
296296
297+ ; hPlayerFacing
298+ const_def
299+ const BIT_FACING_DOWN ; 0
300+ const BIT_FACING_UP ; 1
301+ const BIT_FACING_LEFT ; 2
302+ const BIT_FACING_RIGHT ; 3
303+
297304GetTileTwoStepsInFrontOfPlayer:
298305 xor a
299306 ldh [ hPlayerFacing ], a
@@ -306,7 +313,7 @@ GetTileTwoStepsInFrontOfPlayer:
306313 jr nz , .notFacingDown
307314; facing down
308315 ld hl , hPlayerFacing
309- set 0 , [ hl ]
316+ set BIT_FACING_DOWN , [ hl ]
310317 lda_coord 8 , 13
311318 inc d
312319 jr .storeTile
@@ -315,7 +322,7 @@ GetTileTwoStepsInFrontOfPlayer:
315322 jr nz , .notFacingUp
316323; facing up
317324 ld hl , hPlayerFacing
318- set 1 , [ hl ]
325+ set BIT_FACING_UP , [ hl ]
319326 lda_coord 8 , 5
320327 dec d
321328 jr .storeTile
@@ -324,7 +331,7 @@ GetTileTwoStepsInFrontOfPlayer:
324331 jr nz , .notFacingLeft
325332; facing left
326333 ld hl , hPlayerFacing
327- set 2 , [ hl ]
334+ set BIT_FACING_LEFT , [ hl ]
328335 lda_coord 4 , 9
329336 dec e
330337 jr .storeTile
@@ -333,7 +340,7 @@ GetTileTwoStepsInFrontOfPlayer:
333340 jr nz , .storeTile
334341; facing right
335342 ld hl , hPlayerFacing
336- set 3 , [ hl ]
343+ set BIT_FACING_RIGHT , [ hl ]
337344 lda_coord 12 , 9
338345 inc e
339346.storeTile
@@ -385,7 +392,7 @@ CheckForBoulderCollisionWithSprites:
385392 ld de , $ f
386393 ld hl , wSprite01StateData2MapY
387394 ldh a , [ hPlayerFacing ]
388- and $ 3 ; facing up or down?
395+ and ( 1 << BIT_FACING_UP) | ( 1 << BIT_FACING_DOWN)
389396 jr z , .pushingHorizontallyLoop
390397.pushingVerticallyLoop
391398 inc hl
@@ -396,6 +403,7 @@ CheckForBoulderCollisionWithSprites:
396403 ld a , [ hli ]
397404 ld b , a
398405 ldh a , [ hPlayerFacing ]
406+ assert BIT_FACING_DOWN == 0
399407 rrca
400408 jr c , .pushingDown
401409; pushing up
@@ -421,7 +429,7 @@ CheckForBoulderCollisionWithSprites:
421429 jr nz , .nextSprite2
422430 ld b , [ hl ]
423431 ldh a , [ hPlayerFacing ]
424- bit 2 , a
432+ bit BIT_FACING_LEFT , a
425433 jr nz , .pushingLeft
426434; pushing right
427435 ldh a , [ hPlayerXCoord ]
0 commit comments