Jump to content


Photo

'Guardian Aura' Bug Fix and miscellaneous other patches


  • Please log in to reply
64 replies to this topic

#61 Norman Sword

Norman Sword

    Advanced Member

  • Member
  • PipPipPip
  • 149 posts

Posted 06 February 2018 - 08:16 PM

A flurry of posts whilst I sat with the above text in the editor.


  • IRF likes this

#62 IRF

IRF

    Advanced Member

  • Contributor
  • 3,882 posts

Posted 06 February 2018 - 08:34 PM

Thanks Norman - silly mistake I made using LD A,(HL) instead of LD A,L (picking up an actual value from the item table, rather than picking up the index pointing at that value).

I notice the little optimisation at the end of the item-filter loop as well. :)

Hopefully with those edits applied, the 128 room version will work too.

Edited by IRF, 04 March 2018 - 09:32 PM.


#63 IRF

IRF

    Advanced Member

  • Contributor
  • 3,882 posts

Posted 06 March 2018 - 11:00 AM

; this code moves the tile in hl down by one line

;
xor a
ld d,a
ld b,8
loop
ld e,(hl) ;the current line
or d ;the line above
ld (hl),d
ld d,e
inc h
djnz loop

;
; a=the accumalative value of the bits drawn

;

or a ;if a value exists then the floor is still collapsing

This permits a one pixel line to be moved down the screen


How about this slight rewrite of the loop:

xor a
ld d,a
ld b,8
loop
ld e,(hl) ;the current line
or d ;the line above
ld (hl),d
ld d,e
ld a,h
add a,c
ld h,a

djnz loop

Set C=01 beforehand for regular crumbling tiles, or C=FF for bashing away at wall tiles from below(?)


Edited by IRF, 08 March 2018 - 12:55 AM.


#64 IRF

IRF

    Advanced Member

  • Contributor
  • 3,882 posts

Posted 06 March 2018 - 11:44 AM

Also, HL has to start off pointing at the top pixel-row of the cell in the case of a crumbly, or start off pointing at the bottom pixel-row for bashing a wall tile.

Coming from 'Move Willy', HL starts off pointing at an attribute coordinate (#5Cxx or #5Dxx). Use PUSH and POP HL to preserve that address, for updating the attribute of the cell to Air once crumbling is complete.

For a wall tile, use a similar approach as the 'old' crumbly tile code, in order to point HL at the bottom pixel-row:

LD A,H
ADD A, #1B
OR #07
LD H,A

For a crumbly tile, point HL at the top pixel-row by using:

LD A,H
ADD A, #1B
AND #78
LD H,A

The command in bold can be a common entry point to a shared part of the code (if the C register is used to increment or decrement H as per my previous post).


Edited by IRF, 14 March 2018 - 09:08 AM.


#65 IRF

IRF

    Advanced Member

  • Contributor
  • 3,882 posts

Posted 12 March 2018 - 01:33 PM

How about this slight rewrite of the loop:

xor a
ld d,a
ld b,8
loop
ld e,(hl) ;the current line
or d ;the line above
ld (hl),d
ld d,e
EX AF, AF'
ld a,h
add a,c
ld h,a
EX AF, AF'

djnz loop

Set C=01 beforehand for regular crumbling tiles, or C=FF for bashing away at wall tiles from below(?)


Update: you would need to preserve A (e.g. by bookending the new code with two EX AF, AF' commands), so that after the loop has ended, A still holds a cumulative tally of all the infilled pixels in the cell.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users