From 8bfb9ed7a798b869fac2033d21a611df94dc82e3 Mon Sep 17 00:00:00 2001 From: "Peter Helcmanovsky (Ped)" Date: Mon, 10 Feb 2020 10:01:16 +0100 Subject: [PATCH] .cleaning extensive part-related comments from Parts 5-9 before new changes --- SpecBong.asm | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/SpecBong.asm b/SpecBong.asm index 4d27f6d..46f46f4 100644 --- a/SpecBong.asm +++ b/SpecBong.asm @@ -203,8 +203,6 @@ GameLoop: ; adjust sprite attributes in memory pointlessly (in debug way) just to see some movement call SnowballsAI - ;------------------------------------------------------------------------------------- - ; Part 5 - adding controls to main character - just DEBUG free move around full PAPER IFDEF DISPLAY_PERFORMANCE_DEBUG_BORDER ; green border: to measure the player AI code performance ld a,4 @@ -212,6 +210,11 @@ GameLoop: ENDIF call ReadInputDevices call Player1MoveByControls + IFDEF DISPLAY_PERFORMANCE_DEBUG_BORDER + ; cyan border: to measure the collisions code performance + ld a,5 + out (ULA_P_FE),a + ENDIF call SnowballvsPlayerCollision IF 0 ; DEBUG wait for fire key after frame @@ -223,17 +226,9 @@ GameLoop: jr GameLoop ;------------------------------------------------------------------------------------- - ; Part 6 - writing + testing the collision detection player vs snowball (only player vs balls) - ; because only player vs balls is checked, there's no smart optimization like "buckets" - ; sorting first sprites into groups which may interact, etc... just simple O(N) loop - ; checking every ball against player position - ; (BTW I did use +-1px player movement to debug the collision code, if you are wondering) + ; the collision detection player vs snowball (only player vs balls) + SnowballvsPlayerCollision: - IFDEF DISPLAY_PERFORMANCE_DEBUG_BORDER - ; green border: to measure the collisions code performance - ld a,5 - out (ULA_P_FE),a - ENDIF ; read player position into registers ld ix,SprPlayer ld l,(ix+S_SPRITE_4B_ATTR.x) @@ -333,7 +328,7 @@ SnowballvsPlayerCollision: ret ;------------------------------------------------------------------------------------- - ; Part 7 - platforms collisions + ; platforms collisions ; These don't check the image pixels, but instead there are few columns accross ; the screen, and for each column there can be 8 platforms defined. These data are ; hand-tuned for the background image. Each column is 16px wide, so there are 16 columns @@ -387,10 +382,7 @@ GetPlatformPosUnder: ret ; return directly to caller with results in A and C ;------------------------------------------------------------------------------------- - ; "AI" subroutines - - ;------------------------------------------------------------------------------------- - ; Part 8 - player controls: left+right and jump+fall mechanics + ; "AI" subroutines - player movements Player1MoveByControls: ; update "cooldown" of controls if there's some delay needed @@ -466,8 +458,7 @@ Player1MoveByControls: ld b,a ; keep control bits around in B for controls checks ; H = -16 + min(PlatformY[-3], PlatformY[+3]), C = extras of right platform, L = posX, B = controls - ;------------------------------------------------------------------------------------- - ; Part 9 - ladder mechanics - check if already hangs on ladder + ; check if already hangs on ladder ld de,(Player1LadderData) ; current ladder top+tall info (E=top,D=tall) ld a,d or a @@ -529,8 +520,7 @@ Player1MoveByControls: ld a,b and (1< standing + climbing at top DB $80+10, $80+9, $80+9, $80+9, $80+9, $80+9, $80+9, $80+9 DB $80+8, $80+8, $80+8, $80+8, $80+8, $80+8, $80+8, $80+8 @@ -869,8 +859,7 @@ SprSnowballs: EQU Sprites + 0*S_SPRITE_4B_ATTR ; first snowball sprite SprPlayer: EQU Sprites + SNOWBALLS_CNT*S_SPRITE_4B_ATTR ; player sprite is here SprCollisionFx: EQU SprPlayer + S_SPRITE_4B_ATTR - ;------------------------------------------------------------------------------------- - ; Part 7 - platforms collisions - data of platforms and their heights + extras + ; platforms collisions - data of platforms and their heights + extras ALIGN 256 ; align for simpler calculation of address PlatformsCollisionData: ; the Y-coord of platforms are in sprite coordinates! (+32: 0..255)