11 March 2016 - Forum Rules
Started by Ness, March 22, 2017, 11:43:34 AM
QuoteAFAIK there is no way to change the address indexes upon deflection (?).
Quote from: RhysOwens101 on March 22, 2017, 02:09:54 PMWhat's the hack gonna be called?
Quote from: Disch on March 22, 2017, 10:03:49 PMI don't see why there wouldn't be.Assuming the projectile data is just in an array somewhere, you'd just have to move the projectile's information to a different "slot" in the array once you deflect it.The easiest solution to this is probably to reserve slots 0-2 for player bullets (as they are now), reserve 3-5 for deflected bullets, and change the EFF8 routine to check indexes 0-5 instead of 0-2.
QuoteI'll keep digging, but how would you do it?
QuoteHowever, I am wondering if the shots would still be functionnal if its object ID is in a different index than the rest of its attributes.
QuoteSo is there any way to change the index itself for all in one go or would I have to manually change all addresses ?
LDA #srcptr_loSTA $10LDA #srcptr_hiSTA $11 ; $10 points to where the object data is nowLDA #dstptr_loSTA $12LDA #dstptr_hiSTA $13 ; $12 points to where you want to move the object data toLDY #$10-1 ; if you want to move $10 bytes of data, initialize to $10-1 = $Floop: LDA ($10),Y STA ($12),Y ; copy the bytes over DEY BPL loop; at this point, you'll want to "erase" the projectile from it's original position; which can probably be done by zeroing it's secondary ID (but that's a guess)LDY #whatever_index_is_the_secondary_IDLDA #0STA ($10),Y ; erase original projectile
QuoteI have no idea what you refer to with "srcptr_lo/hi" and "dstptr_lo/hi"
Quote from: Ness on March 23, 2017, 01:29:34 PMHere is the routine the game uses to reserve slots for enemies and their projectiles for the X register:
QuoteHowever this doesn't work at all. It looks like both routines work against each others? If we were to trust what the debugger shows, it doesn't load the original index.
LDA $0300,X ; What is 'X' at this point? I assume it's the slot that the projectile ; is currently in. In which case, this code would be getting the object ID ; of the projectile. Is that correct? JSR $BB65 ; This looks for an available slot to move the projectile to. Which is fine... ; but this routine trashes A.. so you've effectively lost your object ID. ; It also changes X, so you've lost the slot ID of the projectile you're interested inSTA $0300,X ; Again, since A was trashed by the above JSR, you're writing garbage here. ; also.. what if both slots 6 and 7 were occupied? You have to check the C flag ; to make sure there's space available. JSR $F15F ; ??? why are you looking for available space in slots 8+?
;; I assume X is the slot index of the projectile you want move/deflectTXA ; move that slot index to YTAY ; Y is now the "source" slot indexJSR $BB65 ; Look for a free slot to move this projectile to. ; X is now the "destination" slot index. BCS no_slots_available ; UNLESS C is set, in which case there are no free slots to move the ; projectile to. So skip the copy ; Now that we have source index (Y), and destination index (X),; start copying the information overLDA $0300,YSTA $0300,XLDA $0330,YSTA $0330,X ; ... etc ... ; do this for all the data that needs to be copied ; Once you've moved the projectile, you need to erase it from its original slotno_slots_available: ; <- also, have our above failure case here. If there are no slots available ; we'll end up just destroying the projectile instead of deflecting it.LDA #0STA $0300,Y ; zero the object ID (this seems to be all you need to free the slot)
Quote from: Ness on March 24, 2017, 07:30:27 AMAnyway - I gave your solution a try and it works. Thanks a lot!
Quote from: Ness on March 24, 2017, 12:25:58 PMI think I'll leave it like this for now and come back to it later, and I know it's a longshot in the dark here, but just in case would you a clue or an idea about that?
Page created in 0.077 seconds with 20 queries.