Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    You did change the bsr in sonic1.asm right? it won't work if you change it in s1comb.asm.
     
  2. TheFurryFox

    TheFurryFox http://vyrissthevixen.deviantart.com/ Member

    Joined:
    Mar 19, 2011
    Messages:
    29
    Oh wow, it worked. Thanks guys. :D
     
  3. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    Just a note: You should learn these sought of errors and how to fix them,(These are common basic errors) so you don't need to ask us next time.
     
  4. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    I have a question!


    And an incredibly technical one as you will undoubtedly notice: In S1's original Labyrinth zone, there are three decorated blocks in the foreground and two in the background. Two blocks of the foreground are 32x32 pixels, and the third one is 32x16. Let's forget about that 32x16 block.


    One of the 32x32 blocks seems to be a fish, and in the background, there's a bigger version of that block, and it also looks like a fish.


    But the other one, looks (to me) like a bird in the foreground and a boar in the background. Problem: they have almost exactly the same design (same shapes everywhere), only the shadows are different (the one in the background mirrors half of its tiles, probably to save some VRAM).


    So the question is: in your opinion, is the second block representing a bird or a boar? or something else.


    (This is not a rhetorical question, I'd like to know for my hack).
     
  5. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    I would say a boar, the nose shape is different between the two. And the fg one definatly looks more like a bird, but I would sy the BG block is a boar hands down.
     
    Last edited by a moderator: Dec 5, 2011
  6. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    Nobody else? Well, I guess everybody thinks the same... I'll make a boar statue in the background then. I think the way things are perceived is more important than what they were meant to be anyway.


    Thanks.
     
  7. Psycho RFG

    Psycho RFG Well-Known Member Member

    Joined:
    Feb 22, 2011
    Messages:
    234
    I think the same, it looks like a boar to me.
     
  8. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    Hi I am trying to make it so that when Sonic destroys a Badnik, it drops a ring. This is my code:



    Code:
    
    Obj27_LoadAnimal:   ; XREF: Obj27_Index
    
      addq.b #2,$24(a0)
    
      bsr.w SingleObjLoad
    
      bne.s Obj27_Main
    
      move.b  #$01, ($FFFFFFFE)	 ; set the Badnik ring drop flag
    
      move.b #$37,0(a1) ; load bouncing ring object
    
      move.w 8(a0),8(a1)
    
      move.w $C(a0),$C(a1)
    
      move.w $3E(a0),$3E(a1)
    
    


    And:





    Code:
    
    Obj37_CountRings:   ; XREF: Obj37_Index
    
      movea.l a0,a1
    
      moveq #0,d5
    
      cmpi.b  #$01,($FFFFFFFE)	 ; is the Badnik ring flag set?
    
      bne.s   Obj37_MakeRings		   ;If yes, Branch to ring set code
    
      move.w ($FFFFFE20).w,d5 ; check number of rings you have
    
      moveq #32,d0
    
      cmp.w d0,d5  ; do you have 32 or more?
    
      bcs.s loc_9CDE ; if not, branch
    
      move.w d0,d5  ; if yes, set d5 to 32
    
    loc_9CDE:
    
      subq.w #1,d5
    
      move.w #$288,d4
    
      bra.s Obj37_MakeRings
    
    ; ===========================================================================
    
    Obj37_Loop:
    
      bsr.w SingleObjLoad
    
      bne.w Obj37_ResetCounter
    
    Obj37_MakeRings:   ; XREF: Obj37_CountRings
    
      cmpi.b  #$01,($FFFFFFFE)	 ; is the Badnik ring flag set?
    
      beq.s   Obj37_MakeRingsCont	   ; if not, carry on
    
      move.b  1,d0
    
    Obj37_MakeRingsCont:
    
      move.b #$37,0(a1) ; load bouncing ring object
    
      addq.b #2,$24(a1)
    
      move.b #8,$16(a1)
    
      move.b #8,$17(a1)
    
      move.w 8(a0),8(a1)
    
      move.w $C(a0),$C(a1)
    
      move.l #Map_obj25,4(a1)
    
      move.w #$27B2,2(a1)
    
      move.b #4,1(a1)
    
      move.b #3,$18(a1)
    
      move.b #$47,$20(a1)
    
      move.b #8,$19(a1)
    
      move.b #-1,($FFFFFEC6).w
    
      tst.w d4
    
      bmi.s loc_9D62
    
      move.w d4,d0
    
      bsr.w CalcSine
    
      move.w d4,d2
    
      lsr.w #8,d2
    
      asl.w d2,d0
    
      asl.w d2,d1
    
      move.w d0,d2
    
      move.w d1,d3
    
      addi.b #$10,d4
    
      bcc.s loc_9D62
    
      subi.w #$80,d4
    
      bcc.s loc_9D62
    
      move.w #$288,d4
    
      clr.b   ($FFFFFFFE)  ; Clear Badnik ring flag
    
    loc_9D62:
    
      move.w d2,$10(a1)
    
      move.w d3,$12(a1)
    
      neg.w d2
    
      neg.w d4
    
      dbf d5,Obj37_Loop ; repeat for number of rings (max 31)
    
    Obj37_ResetCounter:   ; XREF: Obj37_Loop
    
      cmpi.b  #$01,($FFFFFFFE)	 ; is the Badnik ring flag set?
    
      bne.s   Obj37_ChkDel	   ; if not, carry on
    
      move.w #0,($FFFFFE20).w ; reset number of rings to zero
    
    Obj37_ResetCounterCont:
    
      move.b #$80,($FFFFFE1D).w ; update ring counter
    
      move.b #0,($FFFFFE1B).w
    
      move.w #$C6,d0
    
      jsr (PlaySound_Special).l ; play ring loss sound
    
    
    This code makes it so that when you have 0 or more than 32 rings, Badniks drop 32 rings and when you have any othe number of rings, they drop that number. Also when they drop the rings the ring counter resets. Any hep would be apreciated

    [/CODE]
     
    Last edited by a moderator: Dec 10, 2011
  9. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    cookietheguineapig, nice effort on implementing a memory flag, but it looks like your branches are wrongly annotated and branch on the opposite conditions to what you want.



    cmpi.b #$01,($FFFFFFFE) ; is the Badnik ring flag set?
    bne.s Obj37_MakeRings ;If yes, Branch to ring set code



    BNE will branch if flag is NOT EQUAL to $01. I.e. if the flag is $00, BNE will work. I guess you don't want it. You would like to do something like this:



    tst.b ($FFFFFFFE).w ; is the Badnik ring flag set?
    bne.s Obj37_MakeRings ;If yes, Branch to ring set code



    In this case BNE branches if the memory value tested is NOT ZERO, so both annotations and code logic are correct now. The same for your later branch, replace CMPI to TST as well.


    The next questionable part is:



    move.b 1,d0



    As you missed the #, the assembler will choose (xxx).w addressing mode instead of immediate addressing. So, instead of moving value $01 to D0, this instruction will move the value from memory address $00000001.


    But actually, it doesn't affect the code, as D0 gets overwritten anyways, it's used to hold some temporary values during angles calculations.


    Infact, your code can work OK after some tweaking, but I would like to suggest an alternative (and much easier way). Once I did a very little guide for helping someone out on Russian forums. I think I may just repost it here as well (I posted this on RetroHack as well, as there was a topic on it):

    I hope it helps =)
     
    Last edited by a moderator: Dec 10, 2011
  10. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    Are you sure you want 32 rings to spawn when an enemie is destroyed? Do you understand the major implications of doing that?


    Not only would you hit the sprite limit, but you might also hit the object limit, the processing time limit, and god knows what else.


    Remember, these rings are an object each, and they each read the floor collision, they each take up a singular sprite, and if you were to hit 3 enemies in a row without collecting the 32 rings that were spawn (which is a likely case from a players point of view), that means 32 x 3 = 96.


    I strongly recommend that maybe you should think about this, you don't want a hack that people would rather not play because of extreme lag and game breaking =$
     
  11. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    Thank you very much vladikcomper, works perfectly. And Markey, I ment that I wanted 1 ring to drop (while testing my original code,I experinced soo much lag!).


    Also how would I go increasing the output of rings?
     
    Last edited by a moderator: Dec 10, 2011
  12. TheFurryFox

    TheFurryFox http://vyrissthevixen.deviantart.com/ Member

    Joined:
    Mar 19, 2011
    Messages:
    29
    Something I've been wondering is that every Sonic sprite can only use 23 tiles or 17 tiles (in hex) per frame. Is there anyway to exceed that amount? Like an example; Sonic standing pose using 35 tiles without showing the retarted score number tiles? (the score number that pops up when you destroy a badnik)
     
    Last edited by a moderator: Jan 6, 2012
  13. Crash

    Crash Well-Known Member Member

    Joined:
    Jul 15, 2010
    Messages:
    302
    Location:
    Australia
    You could either reload the score graphics when Sonic's animation is changed away from the standing animation, or the lazy way would be to just stop the score object from appearing.
     
  14. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    Ok small question, How do the main PLC work e.g.



    Code:
    
      dc.l Nem_GHZ_1st ; GHZ main patterns
    
      dc.w 0
    
      dc.l Nem_GHZ_2nd ; GHZ secondary patterns
    
      dc.w $39A0
    
    
    How are the numbers relevent to the art? Im asking because I want to add another badnik to the list

    [/CODE]
     
    Last edited by a moderator: Jan 7, 2012
  15. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    It's the address of the art data in VRAM. Say once uncompressed, art for GHZ_1st is 14752 bytes big, you need 14752 bytes in VRAM to have it ready to be shown on screen. So it begins at 0, and it ends at 14752, or in hexadecimal 39A0.


    So 39A0 is where the next set of tiles will have to be moved to in order to avoid overwriting the previous set of tiles.
     
    Last edited by a moderator: Jan 7, 2012
  16. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    Ah ok thanks, Now I have another problem:
    No signpost art has loaded and I havent touched the Patern Load cues so have no idea what is the problem.
     
    Last edited by a moderator: Jan 8, 2012
  17. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    Maybe you added rings or such destructible objects to the level and forgot to set their "remember state bit" or whatever the name. It often leads to such odd results.
     
  18. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    Nope nothing level wise has been added. I did change the lampost art a while back, but it was displaying fine.


    Edit: I did add custom art to the level select backgruond today via this, but I dont see how this would effect it.
     
    Last edited by a moderator: Jan 8, 2012
  19. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    Is the object really there but not showing, or not there at all? If it's there, you should still hear the sound when you touch it.


    If there doesn't seem to be anything, check the RAM in regen, from D800 to EFFF, every 40th byte (D040, D080, D0C0...) is an object id, see if there's a lamppost, its id is 79 (have Sonic where the lamppost should have been visible).


    If you made changes to the object, check them. You may also have mistakenly replaced a bra.w with a jsr or a bsr.w with a jmp while fixing out of range errors.
     
  20. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    The object is still there because it makes a sound. I havent touched the object at all.


    Edit: Its not loading in any zone. Mabye this is the problem:



    Code:
    
    PLC_Main: dc.w 4
    
      dc.l Nem_Lamp  ; lamppost
    
      dc.w $F400
    
      dc.l Nem_Hud  ; HUD
    
      dc.w $D940
    
      dc.l Nem_Lives  ; lives counter
    
      dc.w $FA80
    
      dc.l Nem_Ring  ; rings
    
      dc.w $F640
    
      dc.l Nem_Points  ; points from enemy
    
      dc.w $F2E0
    
    
    That don't look right.

    [/CODE]
     
    Last edited by a moderator: Jan 8, 2012