Basic Questions and Answers Thread

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

  1. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    65
    Location:
    Buffalo, New York
    I have a small question.
    This is the Sonic-CD styled Spindash made by LuigiXHero. I found it in his "Free Assets Thread".
    Code:
    Sonic_SpinDash:
            btst    #0,$39(a0)
            bne.s    Sonic_SpinDashLaunch
            cmpi.b    #8,$1C(a0) ;check to see if your ducking
            bne.s    .return
            move.b    ($FFFFF603).w,d0
            andi.b    #%01110000,d0
            beq.w    .return
            move.b    #1,$1C(a0)
            move.w    #0,$3A(a0)
            sfx        sfx_SpindashRev,0,0,0
            jsr        (PlaySound_Special).l ; Play spindash charge sound
            addq.l    #4,sp
            bset    #0,$39(a0)
    
            bsr.w    Sonic_LevelBound
            bsr.w    Sonic_AnglePos
    
        .return:
            rts  
    ; ---------------------------------------------------------------------------
    
    Sonic_SpinDashLaunch:
            move.b    #2,$1C(a0) ;charging spindash animation (walking to running to spindash sprites)
            move.b    #$E,$16(a0)            ; Setup collision range
            move.b    ($FFFFF602).w,d0
            btst    #1,d0
            bne.w    Sonic_SpinDashCharge
            bclr    #0,$39(a0)    ; stop Dashing
            cmpi.b    #$1E,$3A(a0)    ; have we been charging long enough?
        ;   bne.s    Sonic_SpinDash_Stop_Sound
        ;    move.b    #2,$1C(a0)    ; launches here (spindash sprites)
            bset    #2,$22(a0)            ; set rolling bit
            move.b    #$E,$16(a0)            ; Setup collision range
            move.w    #1,$10(a0)    ; force X speed to nonzero for camera lag's benefit
            move.w    #$0A00,$14(a0)    ;Set sonic's speed
            move.w    $14(a0),d0
            subi.w    #$800,d0
            add.w    d0,d0
            andi.w    #$1F00,d0
            neg.w    d0
            addi.w    #$2000,d0
            ;move.w    d0,(v_cameralag).w
            btst    #0,$22(a0)
            beq.s    .dontflip
            neg.w    $14(a0)
        ;    jmp     Obj01_DoRoll
    
    .dontflip:
            ;bset    #2,$22(a0)
            bclr    #7,$22(a0)
            move.w    #$D3,d0
            jsr        (PlaySound_Special).l
            move.w    #$D4,d0
            jsr        (PlaySound_Special).l
            bra.w    Sonic_SpinDashResetScr
    ; ---------------------------------------------------------------------------
    
    Sonic_SpinDashCharge:                ; If still charging the dash...
            cmpi.b    #$1E,$3A(a0)
            beq.s    Sonic_SpinDashResetScr
            addi.b    #1,$3A(a0)
            jmp     Sonic_SpinDashResetScr
          
    ;Sonic_SpinDash_Stop_Sound:
           ; move.w    #$D3,d0
           ; jsr        (PlaySound_Special).l
           ; move.b    #$13,$16(a0)
    
    Sonic_SpinDashResetScr:
            addq.l    #4,sp            ; increase stack ptr
            cmpi.w    #$60,($FFFFF73E).w
            beq.s    .finish
            bcc.s    .skip
            addq.w    #4,($FFFFF73E).w
    
        .skip:
            subq.w    #2,($FFFFF73E).w
    
        .finish:
            bsr.w    Sonic_LevelBound
            bsr.w    Sonic_AnglePos
            rts
    
    I want to make the spindash work like the Sonic 3 spindash, where you can use it instantly after doing the button combination for it. What do I change in this code, because I can't figure out what's stopping it from being instantly released after pressing the button combination down.
     
  2. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    269
    Location:
    UK
    There's quite a detailed guide on how to add that type of spindash to Sonic 1 on Sonic Retro. Here's a link to the first part: LINK
     
    Tanman Tanner likes this.
  3. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,759
    Location:
    italy
    With that said, the "have we been charging long enough" comment gives a pretty strong clue about the system used to keep track of time...
     
    Tanman Tanner likes this.
  4. GenesisDoes

    GenesisDoes Well-Known Member Member

    Joined:
    Jan 2, 2016
    Messages:
    127
    Location:
    Pittsburgh, PA
    A few questions I have about Sonic 1:

    1. How does one setup Star Light Zone-styled bg deform layers? (I.e., top part of level in the stars has its own parallax per block, and below a certain scanline, the bottom part buildings scroll differently). I've been just using Selbi's parallax editor to handle deform layers at a single chunk high for now, but will need to learn how to do this manually for taller deform layers.

    2. How does one autoscroll certain bg parallax segments? For example, the clouds which constantly float towards the left in Palmtree Panic Zone in Sonic CD.
     
  5. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    772
    Location:
    Portland, Maine
    Aier, TheInvisibleSun and EMK-20218 like this.
  6. TurboAnimations

    TurboAnimations Newcomer Exiled

    Joined:
    Sep 11, 2018
    Messages:
    10
    I had this issue with SonMapEd when I was importing this image that looks like this.

    ghz totem.png

    I saved it, but when building the file, Green Hill Zone looks corrupted and the title screen too.

    Fusion_acxlBgxpI9.png
    Can somebody tell me how to fix this?
     
  7. Aier

    Aier "Aieru Dotsuto" Member

    Joined:
    Nov 10, 2018
    Messages:
    23
    Location:
    Gensokyo's Boundaries
    Woah buddy, you realldy did something there.
    If I recall correctly the tiles for every act in loaded in the vram,so you probably just imported the flower without deleting unused stuff if you're using SonLVL delete some unused tiles (like the beta totem) and import over it the art of flower, be careful little changes does a lot, I know that for experience : p
     
    MarkeyJester likes this.
  8. TurboAnimations

    TurboAnimations Newcomer Exiled

    Joined:
    Sep 11, 2018
    Messages:
    10
    Fusion_NpBFjc7UWL.png
    Thanks for the help! :D
     
  9. Iso Kilo

    Iso Kilo Local Idiot Member

    Joined:
    Oct 9, 2017
    Messages:
    121
    Location:
    Small Town in BC, Canada
    I'm working on a branch of the Hivebrain 2005 disassembly, and I wanted to add a little feature to the build.bat file. I'd like to get it to count how many times the ROM has been built. I was wondering how I would go about doing this.
     
  10. MarkeyJester

    MarkeyJester ! % # @ Member

    Joined:
    Jun 27, 2009
    Messages:
    2,698
    Code:
    @echo off
    set BuildCount=0
    
    if not exist "BatchSave.bin" goto NoLoad
    
    (
    set /p BuildCount=
    )<BatchSave.bin
    
    :NoLoad
    
    set /a BuildCount=%BuildCount%+1
    echo You have ran this %BuildCount% times
    
    (
    echo %BuildCount%
    )>BatchSave.bin
    
    pause
    This does the following...
    1. Creates a variable called "BuildCount" and sets it to 0 to begin with.
    2. Checks to see if a file called "BatchSave.bin" exists, if it does, it'll load the "BuildCount" number that was saved last time, if this file does NOT exist, it'll assume this is the first time you've ran the batch file, and will jump over the file loading code (the first curvy bracket segment).
    3. Increases the "BuildCount" number by +1 (obviously, if you've just started running it, 0 + 1 = 1).
    4. Prints a simple message telling you that number.
    5. Attempts to save the number to a file called "BatchSave.bin" so it can be loaded by the batch file the next time you run it.
    If you wish it so that it only increases the "BuildCount" number if the file was successfully assembled, then you can assemble the ROM, and then do an "if exist" on the assembled file, if there was an error with assembling the file, then assuming you deleted the file (or the assembler deletes the file) before assembling, that file should not exist, thus, you can jump over the +1 code (that line which has "set /a BuildCount=%BuildCount%+1") to prevent it from increasing the count (might as well skip over the message too).

    The variable is stored in the file as a string, ending in a 0x0D 0x0A return carriage.

    I hope this is successful for you.
     
  11. Iso Kilo

    Iso Kilo Local Idiot Member

    Joined:
    Oct 9, 2017
    Messages:
    121
    Location:
    Small Town in BC, Canada
    This isn't exactly my desired result, but it still works amazing! My intentions if you were curious were to change the actual file name of the ROM. Say like 'build1.bin', and then counts on from there. Thanks for the help regardless!

    Edit: I could actually use the BuildCount variable, which I can do on my own.
     
  12. MarkeyJester

    MarkeyJester ! % # @ Member

    Joined:
    Jun 27, 2009
    Messages:
    2,698
    Oh well, in that case, you should be able to:
    Code:
    "build%BuildCount%.bin"
    In the assemblers' arguments (but I think you've figured that out).
     
  13. TurboAnimations

    TurboAnimations Newcomer Exiled

    Joined:
    Sep 11, 2018
    Messages:
    10
    Hey Markey! Can you explain to me how did you increase Sonic's animation frames like that one mini hack you made called "Sonic 1 Smooth Edition"?
     
  14. Iso Kilo

    Iso Kilo Local Idiot Member

    Joined:
    Oct 9, 2017
    Messages:
    121
    Location:
    Small Town in BC, Canada
    It's pretty much just importing art and then making some adjustments. To start off, you're going to want these.
    Extending the tile, mapping and animation limit
    Making angled sprites work with the extra frames (Note that this is for S2 and will need minor adjustments)
    As for actual art, you're on your own. There should be plenty of guides and tools documenting art importing. I don't see why you would want to do this since the extra frames will take up a lot of space which could be put to better use.
     
  15. TurboAnimations

    TurboAnimations Newcomer Exiled

    Joined:
    Sep 11, 2018
    Messages:
    10
    Alright, thanks!
     
  16. Aier

    Aier "Aieru Dotsuto" Member

    Joined:
    Nov 10, 2018
    Messages:
    23
    Location:
    Gensokyo's Boundaries
    Dude, you must stop wasting your trialist posts like that, at this point you will be in "limbo" or "exiled", be careful
    Don't post short things like " Alright, thanks" "OK, fine" that's useless...

    Edit: Sorry, I had to do this, even if Misinko told you to stop, just don't reply with short messages
     
    Last edited: Mar 22, 2019
    Dj. Joker 27, EMK-20218 and Clownacy like this.
  17. EMK-20218

    EMK-20218 Eduardo Knuckles Member

    Joined:
    Aug 8, 2008
    Messages:
    993
    Location:
    Acapulco, Guaruj√°
    Yeah. I was going to do this before you did, but I figured this guy seems to not to be the kind of person who learns with the errors. He was alerted before but kept doing this. I'm completely with you on this.
     
    Dj. Joker 27 and Aier like this.
  18. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    65
    Location:
    Buffalo, New York
    Quick Question: What's the Sonic 1 AS Disassembly version of Hivebrain's "ShowVDPGraphics" routine? I'm trying to put Enigma Credits into my AS Disassembly, but it's throwing an error that it doesn't exist.
     
  19. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    269
    Location:
    UK
    I've checked and I believe that it's called TilemapToVRAM.
     
    Tanman Tanner likes this.
  20. Cofahi

    Cofahi Newcomer Trialist

    Joined:
    Dec 14, 2018
    Messages:
    5