Basic Questions and Answers Thread

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

  1. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    I believe the animation script is recycled: the game just adds a certain number to whatever frame ID gets fetched from it.
     
    Last edited: Aug 31, 2016
  2. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    yeah, that's what I though, but in what asm file does the game adds the number?, I tried looking it up in sonic1.asm and even other animation files and I am not sure where to look anymore
     
    Last edited: Aug 31, 2016
  3. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    Well, look at the code that references the animation script: in S1 Git, Sonic's script is called Ani_Sonic. The only thing that uses Ani_Sonic is Sonic_Animate. Scroll down, and you see code used only when Sonic is walking/running/rolling, scroll further and you see Sonic's angle being converted and added to the current frame ID to make it point to the rotated sets of sprites.
     
  4. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    Oh, I was thinking incorrectly for asec there, I think I see what I need to do, i'll edit this comment if it works


    EDIT:
    ok, I noticed that basicly when sonic is in 45 degrees the game like you said adds a certain value to the sprite number. so basicly it skips to whatever sprite is located 6 after the flat floor one. so I decided to make sure my new sprites are also located the same way, and it works.....when sonic goes up a slope....idk what is wrong with going down a slope.
     
    Last edited: Aug 31, 2016
  5. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    Okay, so at the routine SAnim_WalkRun you can find these lines:
    Code:
            lsr.b    #4,d0        ; divide angle by $10
            andi.b   #6,d0        ; angle must be 0, 2, 4 or 6
    
    As the comments note, the value in d0 is 0, 2, 4 or 6. This is important in determining which sprites to use at which angle. Later on this happens:
    Code:
            lea      (SonAni_Walk).l,a1 ; use walking animation
            move.b   d0,d1   ; d0 and d1 = 0, 2, 4, or 6
            lsr.b    #1,d1       ; d1 = 0, 1, 2, or 3
            add.b    d1,d0     ; d0 = 0, 3, 6, or 9
    loc_13AB4:
            add.b    d0,d0     ; d0 = 0, 6, 12, or 18
    
    Here d0, which is either 0, 2, 4 or 6, is moved into d1 which is divided by 2 then added back into d0 which is then doubled. So at this point d0 can be 0, 6, 12, or 18. This number is added to the frame numbers seen in the animation script for Sonic's walking to make it display the correct sprite for the angle.

    What you need to do is have result number before the loc_13AB4, or whatever it's called in the Github version, be half the value of the number of frames that need to be added to get the right angled sprite. What I'd do is assume that d0 starts as 2, then you'd want it's value to be half the number of sprites in your walking cycle before the label.

    For example, Sonic 2 has 2 extra frames for Sonic's walking cycle. For this they changed the calculations to this:
    Code:
        lea    (SonAni_Walk).l,a1
        add.b    d0,d0   ; d0 = 0, 4, 8, or 12
    +
        add.b    d0,d0   ; d0 = 0, 8, 16 or 24
    
    As you can see it's a bit simpler as the only thing that needed to be done was to double d0 once before the label.
     
    Last edited: Aug 31, 2016
    Pacca likes this.
  6. Furby Man

    Furby Man Newcomer Trialist

    Joined:
    Aug 5, 2016
    Messages:
    18
    I've started working on my hack Sonic Vision again, and I want to change the names of the levels. Can someone please help me with this?
     
  7. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    There is a lot of information floating about this. It's easy to figure it out on your own or find this information online. So no, we will not help you with this.
     
  8. Furby Man

    Furby Man Newcomer Trialist

    Joined:
    Aug 5, 2016
    Messages:
    18
    alright, thank you.
     
    FireRat likes this.
  9. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Sonic 1 text code generator.

    You have 2 tool into this useful tool: Level Select Text code Editor, that allows you to edit the text in the level select, by load your menutext.bin and easily change the hex values!
    And the Zone Title Card editor, it's the same but with the Title cards you want, by generating an ASM code you can put under "Map_Obj34".
     
  10. NoneofyourBusiness

    NoneofyourBusiness Bag of plums. Member

    Joined:
    Apr 27, 2016
    Messages:
    126
    Location:
    The start
    Simple question, but is there a way to edit enemy hitboxes?
     
  11. GenesisDoes

    GenesisDoes What Nintendont Member

    Joined:
    Jan 2, 2016
    Messages:
    159
    Location:
    Pittsburgh, PA
    For which Sonic game?
    For Sonic 1, see byte $20 of the Object Status Table from the RAM Editing section of the SCHG.

    The mentioned lookup table, in Sonic 1 Github, is located in the file "_incobj/sub ReactToItem.asm", and is an array of 2 bytes for each collision entry (length in pixels, width in pixels for the collision). The S bits are the collision type, which fetch the appropriate collision size from the table. Just change byte $20 in the object's status RAM to the type of collision you want, and add/modify entries in the lookup table as needed.

    The table looks something like this (in Sonic 1 Github)

    [
    Code:
    @sizes:        ;   width, height
            dc.b  $14, $14        ; $01
            dc.b   $C, $14        ; $02
            dc.b  $14,  $C        ; $03
            dc.b    4, $10        ; $04
    
     
    NoneofyourBusiness likes this.
  12. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    If you edit the width and height variables of most objects, their hitboxes will be adjusted. Tails, for example, is set to be shorter with these variables, and the effects are noticeable in game. I've even made fake S2 motobugs by reducing the height of the drill bots in ARZ and swapping their sprite. I don't have the code in front of me, but a quick look at sonic retro or a disassemblies equates should make it easy to find these object values.
     
  13. NiphFM

    NiphFM Host of the Mega Drive Music Contest Member

    Joined:
    Jun 5, 2015
    Messages:
    430
    Location:
    Music Plant Zone
    notice me pls
    Seriously though, this is really, REALLY starting to annoy me, especially so close to the SHC deadline. Is anyone able to help?
     
  14. LuigiXHero

    LuigiXHero Well-Known Member Member

    Joined:
    Mar 22, 2014
    Messages:
    280
    Loop chunks is your loop id+$80

    Also not all the numbers in that file is actually used for loops that includes the spin tubes also, so make sure you edit the right part.

    (or you can just use sonic 128 lol)

    Maybe actually seeing the IDs might help:

    Replace the incbin with this if you want it to be in ASM instead of hex editing the bin:
    Code:
    LoopTileNums:  
            dc.b $B5 ; GHZ Loop 1 (Actual ID of chunk is $35, $35+$80=$B5)
            dc.b $7F ; GHZ Loop 2 (Unused)
            dc.b $1F ; GHZ Tunnel 1 (Actual ID of Chunk is $1F, no math needed)
            dc.b $20 ; GHZ Tunnel 2
    
            dc.b $7F ;LZ Loop 1 (Unused)
            dc.b $7F ;LZ Loop 2 (Unused)
            dc.b $7F ;LZ Tunnel 1 (Unused)
            dc.b $7F ;LZ Tunnel 2 (Unused)
    
            dc.b $7F ;MZ Loop 1 (Unused)
            dc.b $7F ;MZ Loop 2 (Unused)
            dc.b $7F ;MZ Tunnel 1 (Unused)
            dc.b $7F ;MZ Tunnel 2 (Unused)
    
            dc.b $AA ;SLZ Loop 1
            dc.b $B4 ;SLZ Loop 2
            dc.b $7F ;SLZ Tunnel 1 (Unused)
            dc.b $7F ;SLZ Tunnel 2 (Unused)
    
            dc.b $7F ;SYZ Loop 1 (Unused)
            dc.b $7F ;SYZ Loop 2 (Unused)
            dc.b $7F ;SYZ Tunnel 1 (Unused)
            dc.b $7F ;SYZ Tunnel 2 (Unused)
    
            dc.b $7F ;SBZ Loop 1 (Unused)
            dc.b $7F ;SBZ Loop 2 (Unused)
            dc.b $7F ;SBZ Tunnel 1 (Unused)
            dc.b $7F ;SBZ Tunnel 2 (Unused)
    
            dc.b $7F ;END? Loop 1 (Unused)
            dc.b $7F ;END? Loop 2 (Unused)
            dc.b $7F ;END? Tunnel 1 (Unused)
            dc.b $7F ;END? Tunnel 2 (Unused)
    
     
  15. NiphFM

    NiphFM Host of the Mega Drive Music Contest Member

    Joined:
    Jun 5, 2015
    Messages:
    430
    Location:
    Music Plant Zone
    I replaced the original "LoopTileNums" with this new code, and it doesn't work any better...
     
  16. LuigiXHero

    LuigiXHero Well-Known Member Member

    Joined:
    Mar 22, 2014
    Messages:
    280
    ... You have to edit the number to match your chunk ID...

    It's Your Chunk ID+$80...

    The only reason for that code in the previous post is to make the loop nums easier to understand.

    For example in default GHZ it's $35 so you add $80 which gives you $BF. You must've edited yours so must find what ID it is. So open up whatever level editor you have and select it. Somewhere it should tell you what ID it is. In sonlvl it's under the chunk in a box that will tell you what ID it is.

    [​IMG]

    Take that number and add $80 to it. That's 80 in hex btw.

    Also make sure you double click the chunk when you place them. If it doesn't have a yellow outline you forgot to double click it and it will not work.

    [​IMG]

    Note: For Spintubes they work without needing to add $80 or double clicking them.
     
    Last edited: Sep 6, 2016
  17. NiphFM

    NiphFM Host of the Mega Drive Music Contest Member

    Joined:
    Jun 5, 2015
    Messages:
    430
    Location:
    Music Plant Zone
    The only thing, I have not touched loop or tunnel chunk values at all...
     
  18. LuigiXHero

    LuigiXHero Well-Known Member Member

    Joined:
    Mar 22, 2014
    Messages:
    280
    If you deleted any chunks before chunk 35 then they got moved.

    Besides wouldn't it be smart to actually check to see if it's the original ID instead of just assuming?

    When something doesn't work, that means you check everything that's related....
     
  19. NiphFM

    NiphFM Host of the Mega Drive Music Contest Member

    Joined:
    Jun 5, 2015
    Messages:
    430
    Location:
    Music Plant Zone
    I just checked the values, and it's still $35 for the loop. I already have checked everything that I could think of that could possibly be causing the problem. I also really do not want to change disasms (again...), as I know that it'll be a pain and just make more work on top of what I already need to do.
     
  20. NoneofyourBusiness

    NoneofyourBusiness Bag of plums. Member

    Joined:
    Apr 27, 2016
    Messages:
    126
    Location:
    The start