Basic Questions and Answers Thread

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

  1. EasterBanana

    EasterBanana Newcomer Trialist

    Joined:
    Jul 22, 2014
    Messages:
    9
    Location:
    In the R of SSRG.
    Thanks, banana brother !  :laugh:
     
  2. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    A little bit of a trivial question, but I'd like to know. Basically, what decides in which direction (left or right) Sonic is being bounced to when he's getting hit by an enemy, spikes, or harming objects?
     
    Last edited by a moderator: Sep 1, 2014
  3. LooneyDude

    LooneyDude Back after a long absence! Member

    Joined:
    Feb 1, 2014
    Messages:
    277
    Location:
    EVERYWHERE
    When it's bumper, I think it just reverses his direction.
     
  4. Shockwave

    Shockwave 3 Time Stones Member

    Joined:
    Dec 18, 2013
    Messages:
    121
    Location:
    LA, CA
    It should be this:



    Hurt_Reverse:
    move.w 8(a0),d0


    cmp.w 8(a2),d0


    bcs.s Hurt_ChkSpikes ; if Sonic is left of the object, branch


    neg.w $10(a0) ; if Sonic is right of the object, reverse


    Hurt_ChkSpikes:
     
  5. ThomasThePencil

    ThomasThePencil resident psycho Member

    Joined:
    Jan 29, 2013
    Messages:
    910
    Location:
    the united states. where else?
    This is what decides it (it's done like this in all 3 games):


    move.w 8(a0),d0
    cmp.w 8(a2),d0
    bcs.s Hurt_ChkSpikes ; if Sonic is left of the object, branch
    neg.w $10(a0) ; if Sonic is right of the object, reverse

    :v

    edit: Damn, ninja'd by Shockwave :U
     
    Last edited by a moderator: Sep 1, 2014
  6. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    So if he was touched by the left side of the object he bounces to the left direction and vice versa. Huh, I always thought the direction he's facing to has something to do with it. But okay, thanks!
     
  7. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    416
    Location:
    Town Creek, AL
    in sonic 1, after hitting a signpost & standing at the edge of the screen, Sonic got through act, yet you can control him, whereas anywhere else = controls locked & move sonic to the right. Where in the GotThrough code is the edge of screen detection?
     
  8. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    loc_EC70 should be what you're looking for.


    Sign_SonicRun: ; Routine 6
    tst.w (v_debuguse).w ; is debug mode on?
    bne.w locret_ECEE ; if yes, branch
    btst #1,(v_player+obStatus).w
    bne.s loc_EC70
    move.b #1,(f_lockctrl).w ; lock controls
    move.w #btnR<<8,(v_jpadhold2).w ; make Sonic run to the right

    loc_EC70:
    tst.b (v_player).w
    beq.s loc_EC86
    move.w (v_player+obX).w,d0
    move.w (v_limitright2).w,d1
    addi.w #$128,d1
    cmp.w d1,d0
    bcs.s locret_ECEE

    loc_EC86:

    The flaw in logic is pretty obvious.
     
  9. amphobius

    amphobius spreader of the pink text Member

    Joined:
    Feb 24, 2008
    Messages:
    970
    Location:
    United Kingdom
    I have a VRAM dump - but how would I go about making one for Sonic 1?
     
  10. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    It might be possible to use selbi's text code generator tool, but I'm not sure if that properly handles the backwards references (with labels rather than raw numbers).
     
  11. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    I have changed almost every one of Sonic's sprites, including changing his walk cycle from Sonic 2's 8 frames to Sonic 1/CD's 6 frames. I have applied this change to Sonic's animation routine to fix slope issues


    SAnim_WalkRun:
    ...
    tst.b (Super_Sonic_flag).w
    bne.s SAnim_Super
    lea (SonAni_Run).l,a1 ; use running animation
    cmpi.w #$600,d2 ; is Sonic at running speed?
    bcc.s + ; use running animation
    lea (SonAni_Walk).l,a1 ; if yes, branch
    move.b d0,d1 <----
    lsr.b #1,d1 <----
    add.b d1,d0 <----

    I have also changed Super Sonic's walk cycle to 6 frames. I have also changed the same lines to fix any slope issue when Super


    SAnim_Super:
    lea (SupSonAni_Run).l,a1 ; use fast animation
    cmpi.w #$800,d2 ; is Sonic moving fast?
    bcc.s SAnim_SuperRun ; if yes, branch
    lea (SupSonAni_Walk).l,a1 ; use slower animation
    move.b d0,d1 ;<---- Added this line
    lsr.b #1,d1 ;<---- This one too
    add.b d1,d0 ;<---- Changed from d0,d0 to d1,d0
    bra.s SAnim_SuperWalk

    And this line:



    SAnim_SuperRun:
        lsr.b    #1,d0
    ; loc_1B4C8:
    SAnim_SuperWalk:
        move.b    d0,d3
        moveq    #0,d1
        move.b    anim_frame(a0),d1
        move.b    1(a1,d1.w),d0
        cmpi.b    #-1,d0
        bne.s    +
        move.b    #0,anim_frame(a0)
        move.b    1(a1),d0
    +
        move.b    d0,mapping_frame(a0)
        add.b    d3,mapping_frame(a0)
        move.b    ($FFFFFE05).w,d1
        andi.b    #3,d1
        bne.s    +
        cmpi.b    #-$4B,mapping_frame(a0)
        bcc.s    +
        addi.b    #$18,mapping_frame(a0) <---- Changed $20 to $18


    The only problem now is that Super Sonic's Run animation is buggy and flashes to the wrong frame, when at certain angles this crashes the game due to there not being a frame where it is looking for one. I have no idea how to fix this and help would be greatly appreciated.

    EDIT: Fixed this by looking through the GitHub Disassembly and finding these lines:


    cmpi.b #$B5,mapping_frame(a0)
    bhs.s + 
    Changing the $B5 to the corresponding frame for my sprites and replacing the old lines from the 2007 disassembly.
     
    Last edited by a moderator: Sep 3, 2014
  12. Devon

    Devon Down you're going... down you're going... Member

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    As some of you may know, I am working on a hack for Sega CD. I need help.

    I'm trying to add a 3D effect, like in Sonic CD's special stages, but I don't know how I'm going to get started with that. Can any of you give me pointers on 3D for Sega CD? I'm not looking for code, just how it works on Sega CD.
     
  13. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    The Mega CD has a custom ASIC graphics chip, the purpose of this chip is to supply it with the graphics, and scaline/rotation/repsosition information, and it'll process. It'll dump out the result graphics, which then need to be copied to the Mega Drive's VDP VRAM. This chip does not supply mappings data. You must supply this yourself and plan ahead ensuring the mappings are in VRAM in the appropriate place(s).
     
    Last edited by a moderator: Sep 4, 2014
  14. Devon

    Devon Down you're going... down you're going... Member

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    How would I provide the data for the chip to work with? (If you need to provide code, that's fine.)
     
    Last edited by a moderator: Sep 4, 2014
  15. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    I apologise if my answer seemed vague, but it had to be vague. If I were to supply the answer here in this thread, in several weeks time we'll have an influx of hacks containing poorly operating 3D effects. And I gotta tell ya' I've had enough of fishing through shit hacks to get to half decent ones.

    There are enough documents out there that could answer your question if you looked for them, and while I do not wish to make it difficult for you, I feel it is the only appropriate way of filtering out the lazy, procrastinating, and leaching individuals (who couldn't put together a bearable game if their life depended on it), from those with a real tendency to press forwards positively.
     
    Last edited by a moderator: Sep 4, 2014
  16. OrdosAlpha

    OrdosAlpha RIGHT! Naebody move! Root Admin

    Joined:
    Aug 5, 2007
    Messages:
    1,793
    Location:
    Glasgow, Scotland
    I wouldn't say it was a vague answer.
     
  17. Devon

    Devon Down you're going... down you're going... Member

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    I understand your reasoning. I'll see what I can do then.
     
  18. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    I've tried to get the S2 text code generator to work in my hack multiple times. I'm using the Github Disasm, and figured out that the appropriate tutorial for it was the HG one. When I tried to build it, I was bombarded by various errors saying "symbol undefined", despite the fact that they seem to be defined. The error log is listed below.

    S2.log
     
  19. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    So, the labels Obj34_MapUnc_147BA and Obj3A_MapUnc_14CBC both exist in your ASM? What do the lines they're on look like?
     
    Last edited by a moderator: Sep 4, 2014
  20. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    Wow. I just realized that the tutorial had them commented out :p

    It seems to work okay now.

    Edit: How do you edit Sonic 2's level select tex? I can't find where the text could be in the ASM, and google has not helped me at all.
     
    Last edited by a moderator: Sep 4, 2014