Basic Questions and Answers Thread

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

  1. GenesisDoes

    GenesisDoes Wizard of the Sonic Member

    Joined:
    Jan 2, 2016
    Messages:
    145
    Location:
    Pittsburgh, PA
    So I've just noticed that the Sonic 1 68k sound driver has the speed shoes' sped up music tempos hard coded in a LUT (At "SpeedUpIndex" label in s1.sounddriver.asm for S1 Github disasm). Any way I could optimize the sped up music code to automatically increment the current song's tempo by some constant instead of a LUT, like how Sonic 2's sound driver does this?
     
  2. LazloPsylus

    LazloPsylus The Railgun Retired Staff

    Joined:
    Nov 25, 2009
    Messages:
    Location:
    Academy City
    You *could*, but to be honest, the LUT may be faster, depending on the math needed to do the speed up. Familiarize yourself with how S2's Z80 SMPS does it, and see how much is involved. If there's more than a couple of operations, LUT's probably blowing it out of the water and S2's just using math to save space, not processing time.
     
  3. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    913
    Painto likes this.
  4. FохConED

    FохConED Join to Digital Resistance! Member

    Joined:
    Dec 13, 2014
    Messages:
    199
    Location:
    Konakovo
    Somebody can help with a bug? When falling a platform and receiving a loss (though it can occur at loading), rings can strange fly or there is something another and very strange.


    EDIT: Bug Fixed
     
    Last edited: Jul 8, 2016
  5. GenesisDoes

    GenesisDoes Wizard of the Sonic Member

    Joined:
    Jan 2, 2016
    Messages:
    145
    Location:
    Pittsburgh, PA
    Huh; I didn't know that.

    Back when I created a Sonic 2 hack many years ago, I utilized the Sonic 2 Clone Driver and applied a SCHG guide to have music from slots $00-$1F and $81-$9F, and hitting speed shoes would speed up all music (even in the expanded $81+ range), without having to expand the LUT to the new slots. Just verified that this is the case in my old Sonic 2 hack.

    My current Sonic 1 hack has music from $80-$9F and $E5+. Am looking to make the sound driver automatically adjust tempo for the new songs so I don't have to expand the LUT to $F2 (my last song) with a lot of dummy and hardcoded data.
     
  6. Clownacy

    Clownacy Well-Known Member Retired Staff

    Joined:
    Aug 15, 2014
    Messages:
    918
    It's was probably pure luck that your music just happened to be sped up. The speed shoes code was likely reading the code that lies beyond the LUT as raw data. Anyway, with S1's driver, automatically speeding up music is tricky, since the tempo algorithm isn't like S2's or S3K's: with those two, all you had to do was add/subtract $20 from the normal tempo to get the speed shoes variant, but if you compare S1's normal tempos to the sped-up versions, the difference in value varies wildly. S3K opted for a different way of speeding up music, without changing the tempo value, which was by updating the music tracks 8 (I think) times per frame. That same approach would probably work absolutely horribly on a 68k-based sound driver, so I wouldn't recommend that. My suggestion is to look into porting S2's/S3K's tempo algorithm, and then automatically add/sub $20 to the tempo when needed to speed up.
     
    Pacca and MarkeyJester like this.
  7. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,160
    Location:
    Limbo
    Is there a program that can open an image, identify all the unique colors in it, and put it into a simple color palette line? I've been googling for quite some time now, and I have been able to find anything that didn't just mash colors together, which obviously won't work in my case.
     
  8. LuigiXHero

    LuigiXHero Well-Known Member Member

    Joined:
    Mar 22, 2014
    Messages:
    279
    Paint Shop Pro 9 is what me and MainMemory use. It's kinda hard to find now though.
     
  9. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    890
    Location:
    Orono, Maine
    There's an indexed color option in Gimp that will generate a palette based on the colors of an image and it will keep any new colors from being put on the image.

    I think you choose Image > Mode > Indexed. Then you can view the palette in the palettes window.
     
    Pacca likes this.
  10. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,160
    Location:
    Limbo
    How can I move the spindash artwork? I can't find a clear place where I can change where it should load in VRAM.

    EDIT: Also, what would I need to do to make an object collide with sonic/tails like its' a badnik (explodes when rolling, injures player when not). I know its' simple, but I can't quite figure it out.
     
  11. TheStoneBanana

    TheStoneBanana The Bananaman Member

    Joined:
    Nov 27, 2013
    Messages:
    603
    Location:
    The Milky Way Galaxy
    Are you talking about the spindash dust? Because the actual spindash art itself is a part of Sonic's art, so it just loads where he is in VRAM.

    $20(a0) is the Collision Response for an object. Taking a page from the Retro Wiki, the format is like so (in binary):
    TTSS SSSS
    where T = the type and S = the size.
    What you are interested in is the type, where 0 = a standard enemy. So, basically, those first two bits there must always be clear for the object to act like a badnik. Do something like:
    Code:
     move.b #%00XXXXXX,$20(a0)
    to assure this. (make sure you put a valid size in binary where the X's are)
     
  12. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,160
    Location:
    Limbo
    Yes, I did mean the dust object, sorry for the vagueness :I Also, thanks for the second answer!
     
  13. redhotsonic

    redhotsonic Also known as RHS Retired Staff

    Joined:
    Aug 10, 2007
    Messages:
    2,970
    Location:
    England
    The dust is at "Obj08_LoadDustOrSplashArt:" (or loc_1DEE4: ). To change the VRAM location, it's:

    Code:
     move.w objoff_3C(a0),d4
    objoff_3C is holding the data for the VRAM location, which this gets set at "Obj08_Init:" (or loc_1DD36: ) :

    Code:
     move.w #$9380,objoff_3C(a0)
    This is for Sonic. You see it getting set again for Tails a few lines down:

    Code:
     move.w #$9180,objoff_3C(a0)
    Change these numbers to wherever you want the new location to be at.

    EDIT: Just to warn you though, although I'm sure you're already aware, that wherever you move it, it will take effect for the splash art too. Making you're own code to separate them though shouldn't be too much of a problem.
     
    Last edited: Jul 14, 2016
    Pacca likes this.
  14. ZeroInfinity

    ZeroInfinity Newcomer Trialist

    Joined:
    Oct 20, 2015
    Messages:
    6
    Location:
    Australia
    I really didn't want to have to ask for help on this, since I didn't want to look like a moron and my problem feels like it should be an easy fix, but here's goes...
    First off, I am VERY inexperienced at hacking, so please bare with my lack of knowledge and possible stupidity. Anyway, my problem has to do with a custom spring animation in Sonic 1 were Sonic enters a falling animation instead of his running animation. The falling animation is only 1 frame. It works for the most part, but if you keep bouncing on a spring, the animation sort of de-syncs and if you use a red spring or fall a long distance after using a spring, the frame will go back to the spring bounce frame before you hit the ground/cycle through both frames. I know I suck at explaining things, so here a gif:
    [​IMG]

    This feels like it should be easy to fix and it driving me CRAZY.
    Sorry for the long post and being stupid and being terrible at explaining things. Please don't hate me.
     
  15. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    540
    Location:
    France
    Try to make a "FE, 1, 0" at the end of this animation.
     
  16. ZeroInfinity

    ZeroInfinity Newcomer Trialist

    Joined:
    Oct 20, 2015
    Messages:
    6
    Location:
    Australia
    Tried that before. It makes him stay in the falling frame, even when you bounce on the spring again. Still, looks better than it was before. Might just stick with that.
     
  17. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Retired Staff

    Joined:
    Oct 7, 2011
    Messages:
    756
    Here is a simple fix for it. Stick that $FE, $01 at the end of the animation like suggested, but go to Obj41_BounceUp and change this line;
    Code:
            move.b    #$10,$1C(a1)    ; use "bouncing" animation
    to this
    Code:
            move.w    #$1000,$1C(a1)    ; use "bouncing" animation and reset animation flags
    What this will do, is rather than just say to the animation handler than indeed we are on the same animation, it will actually say that the last animation was not the bouncing animation, so it needs to start from the beginning. clearing byte $1D of any animated objects address space is equivalent of saying we need to restart animation (except with running animation, there you need a nonzero value). Whenever animation is playing, $1D will always be the same as $1C, and the animation code checks if its the case; if so, continue it normally, but if not, we need to restart it.
     
  18. jubbalub

    jubbalub Mania fanboy Member

    Joined:
    Dec 25, 2014
    Messages:
    285
    When I try to put the SSRG splash screen into my hack, I get a build error. Screenshot bc I can't find a log file.

    [​IMG]

    I'm not sure what went wrong.
     
    Last edited: Jul 15, 2016
  19. ZeroInfinity

    ZeroInfinity Newcomer Trialist

    Joined:
    Oct 20, 2015
    Messages:
    6
    Location:
    Australia
    Thanks a bunch. I figured might have had to change some line of code like that, but I really had no idea what exactly to look for and change. And coding stuff kind of intimidates me.
     
  20. Crash

    Crash Well-Known Member Member

    Joined:
    Jul 15, 2010
    Messages:
    302
    Location:
    Australia
    those are "branch out of range" errors, change the "bsr.w" in those lines to "jsr"