Basic Questions and Answers Thread

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

  1. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,801
    Location:
    italy
    Yeah, that's weird, especially since they apparently did some effort to support BMPs in the first place, you can tell because Sonic isn't upside down (BMPs also store the rows backwards).
     
    ProjectFM and Iso Kilo like this.
  2. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    113
    Location:
    Buffalo, New York
    I'm guessing they probably gave up halfway through and favored PNG rather than BMP.
     
  3. Angel X

    Angel X Well-Known Member Member

    Joined:
    Sep 15, 2017
    Messages:
    89
    Location:
    Italy
    Hello guys,
    I'm here to ask two questions (about Sonic 1 GitHub).
    1-How do i constantly make sonic faster (as if he had the Power Sneakers);
    2-How do make sonic jump dash in any direction?
    I hope I haven't asked for too much:confused:
     
  4. Iso Kilo

    Iso Kilo Is it a fox? Is it a wolf? It's Kilo! Member

    Joined:
    Oct 9, 2017
    Messages:
    327
    Location:
    A warm and lovely place~
    You can find Sonic's speed variables in his initialization routine. The value does change, such as reverting from when he has the speed shoes, or getting in and out of water.
    As for the jump dash, it's a pretty big stretch to ask for, but S3K has a move just like it for Hyper Sonic, dig long enough and surely you could find, and port it.
     
  5. Scrap Brain

    Scrap Brain Now Iron Ruin Member

    Joined:
    Sep 18, 2020
    Messages:
    20
    Location:
    Sonic Drift 2 for the Sega Game Gear
    Question about Sonic 1 (Hivebrain): How do I add Sonic's CD spring animation? I've tired but the sprites are animated off center and I have no idea how to rotate them.
     
  6. Samey

    Samey Le Bored Hedgie Member

    Joined:
    May 3, 2017
    Messages:
    53
    So for the sprites being off center, what I did was I moved one half of the sprite to overlap the other.

    And the rotating is just a simple animation.
     
  7. DeltaWooloo

    DeltaWooloo A hacker, helper, friend and a Wooloo Member

    Joined:
    Aug 7, 2019
    Messages:
    220
  8. Scrap Brain

    Scrap Brain Now Iron Ruin Member

    Joined:
    Sep 18, 2020
    Messages:
    20
    Location:
    Sonic Drift 2 for the Sega Game Gear
    yeah I think I this is the issue
    upload_2020-9-21_12-50-17.png
    upload_2020-9-21_12-50-48.png
    the sprites are off center
    it looks like this in game
    upload_2020-9-21_12-52-42.png
    upload_2020-9-21_12-52-55.png
    and for the rotation, I'm sure it'd be simple if I knew how to do it.
    I probably should have tired to fix it before posting a reply but oh well
     

    Attached Files:

    Last edited: Sep 21, 2020
  9. Scrap Brain

    Scrap Brain Now Iron Ruin Member

    Joined:
    Sep 18, 2020
    Messages:
    20
    Location:
    Sonic Drift 2 for the Sega Game Gear
    So I got 2 of the sprites to be centered, but how do I get this one to be centered?
    upload_2020-9-21_13-15-0.png
    I can't cut the sprite off because then it'd look bad, and idk what the proper sprite mappings are because Sonic CD disassemblies might as well not exist.
    What can I do to avoid cutting off his right hand and having it be centered with the rest of the sprites?


    Update:
    The mapping was off center in sonmapED. I literally just had to press the left arrow key once to fix it.
     

    Attached Files:

    Last edited: Sep 22, 2020
  10. Iso Kilo

    Iso Kilo Is it a fox? Is it a wolf? It's Kilo! Member

    Joined:
    Oct 9, 2017
    Messages:
    327
    Location:
    A warm and lovely place~
    I recommend Flex 2 for editing mappings like this. It's much more visual.
     
    TheInvisibleSun and DeltaWooloo like this.
  11. Scrap Brain

    Scrap Brain Now Iron Ruin Member

    Joined:
    Sep 18, 2020
    Messages:
    20
    Location:
    Sonic Drift 2 for the Sega Game Gear
    upload_2020-9-21_15-35-19.png
    I've tried to use Flex 2 before and just got this error message so I'm gonna try to fix it by making sure I have the latest version of java installed.

    Edit:
    I reinstalled java and still got the same error message so I'll look up the error code and try to fix it that way.
    Another edit:
    I unfortunately seem to be totally unable to fix that error.
     
    Last edited: Sep 21, 2020
  12. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    888
    It's not a Java program, so reinstalling Java wouldn't do anything to it. You should probably post that in the Flex 2 thread, or message @snkenjoi.
     
  13. Scrap Brain

    Scrap Brain Now Iron Ruin Member

    Joined:
    Sep 18, 2020
    Messages:
    20
    Location:
    Sonic Drift 2 for the Sega Game Gear
    On a completely different note, my hack seems to be broken because I tried to edit the GHZ tiles. I separated the GHZ and title & ending tiles, but the game won't load the title screen unless I go to the level select with a save state, and Marble, Green Hill and Star Light refuse to load. I've noticed this was always directly after I imported the Palmtree Panic Good Future tiles into the game. I've also tried to import Sonic 2's art loader but that didn't work (I could have forgot to compress the files in Kosinski but idk). What am I doing wrong and how can I fix this error besides not editing Green Hill's art? (My dissam included if anyone wants to try to bug fix it I guess).

    EDIT:
    I've managed to get GHZ working but MZ and SLZ are iffy. The only way I can seem to get them to work is by loading their project files in SonED2 and saving but whenever I do that they don't load all of their tiles and fill the rest with the Title screen tiles.
     

    Attached Files:

    Last edited: Sep 22, 2020
  14. Psi

    Psi Well-Known Member Member

    Joined:
    Dec 20, 2014
    Messages:
    78
    Okay I'm likely gonna need someone experienced here cause this is a LONG bit of code.

    Basically I'm trying to make the breakable corks in HTZ destroy according to new animations ($23, 24 and 25, but primarily $23). So far they work okay in 1 player, but for some reason they're not consistent breaking in 2 player mode.

    As a secondary request I'd like to know where the routine is checking for the character running through a loop since I'd like the attack to be able to break the loop corks without doing so.

    WARNING: This code is a freaking mess due to twisting it here there and everywhere to try and make it work.

    Code:
    ; ----------------------------------------------------------------------------
    ; Object 2F - Smashable ground in Hill Top Zone
    ; ----------------------------------------------------------------------------
    ; Sprite_23300:
    Obj2F:
        moveq    #0,d0
        move.b    routine(a0),d0
        move.w    off_2330E(pc,d0.w),d1
        jmp    off_2330E(pc,d1.w)
    ; ===========================================================================
    off_2330E:
        dc.w loc_2331E-off_2330E
        dc.w loc_23368-off_2330E; 1
        dc.w loc_234DC-off_2330E; 2
    byte_23314:
        dc.b $24
        dc.b   0    ; 1
        dc.b $20    ; 2
        dc.b   2    ; 3
        dc.b $18    ; 4
        dc.b   4    ; 5
        dc.b $10    ; 6
        dc.b   6    ; 7
        dc.b   8    ; 8
        dc.b   8    ; 9
    ; ===========================================================================
    
    loc_2331E:
        addq.b    #2,routine(a0)
        move.l    #Obj2F_MapUnc_236FA,mappings(a0)
        move.w    #$C000,art_tile(a0)
        bsr.w    JmpTo18_Adjust2PArtPointer
        move.b    #4,render_flags(a0)
        move.b    #$10,width_pixels(a0)
        move.b    #4,priority(a0)
        cmpi.w    #3,(Player_Mode).l;is player ????
        bne.s    +
            move.b  #9,collision_flags(a0)
    +
        moveq    #0,d0
        move.b    subtype(a0),d0
        andi.w    #$1E,d0
        lea    byte_23314(pc,d0.w),a2
        move.b    (a2)+,y_radius(a0)
        move.b    (a2)+,mapping_frame(a0)
        move.b    #$20,y_radius(a0)
        bset    #4,render_flags(a0)
    
    loc_23368:
        cmpi.w    #3,(Player_Mode).l;is player ????
        bne.s    +
            tst.b $26(a0)
            bne.w loc_233F0
    +
        move.w    (Chain_Bonus_counter).w,objoff_38(a0)
        move.b    (MainCharacter+anim).w,objoff_32(a0)
        move.b    (Sidekick+anim).w,objoff_33(a0)
        moveq    #0,d1
        move.b    width_pixels(a0),d1
        addi.w    #$B,d1
        moveq    #0,d2
        move.b    y_radius(a0),d2
        move.w    d2,d3
        addq.w    #1,d3
        move.w    x_pos(a0),d4
        bsr.w    JmpTo3_SolidObject
    Obj2F_Auto:
        cmpi.w    #3,(Player_Mode).l;is player ????
        beq.s    Obj2F_NoHammerAttack
        cmpi.w    #2,(Player_Mode).l;is player Cream?
        beq.s    Obj2F_NoHammerAttack
        cmpi.b    #$23,(MainCharacter+anim).w    ; is hammer attack being performed?
        bne.s    Obj2F_NoHammerAttack        ; if not, branch
    Obj2F_AutoHammer:
        moveq    #0,d0            ; clear d0
        move.w    $8(a0),d0        ; load block's X-pos to d0
        sub.w    (MainCharacter+$8).w,d0    ; substract Amy's X-pos from it
        bpl.s    Obj2F_XPositive        ; if answer is positive, branch
        neg.w    d0            ; otherwise negate d0
    
    Obj2F_XPositive:
        cmpi.w    #$25,d0            ; is Amy within 25 pixels of the object (X-axis)?
        bge.s    Obj2F_NoHammerAttack    ; if not, branch
        moveq    #0,d0            ; clear d0
        move.w    $C(a0),d0        ; load block's Y-pos to d0
        sub.w    (MainCharacter+$C).w,d0    ; substract Amy's Y-pos from it 
        bpl.s    Obj2F_YPositive        ; if answer is positive, branch 
        neg.w    d0            ; otherwise negate d0
    
    Obj2F_YPositive:
        cmpi.w    #$25,d0            ; is Amy within 25 pixels of the object (Y-axis)?
        bge.s    Obj2F_NoHammerAttack    ; if not, branch
        bra.w    loc_233F0        ; otherwise smash object
    Obj2F_NoHammerAttack:
        move.b    status(a0),d0
        andi.b    #$18,d0
        bne.s    loc_233A4
    
    BranchTo_JmpTo9_MarkObjGone
        bra.w    JmpTo9_MarkObjGone
    ; ===========================================================================
    
    loc_233A4:
        cmpi.b    #$18,d0
        bne.s    loc_23408
        cmpi.b    #$23,objoff_32(a0)
        beq.s    Hammer_2F
    
    NonHammer_2F:
        cmpi.b    #2,objoff_32(a0)
        bne.s    loc_233C0
    Hammer_2F:
        tst.b    subtype(a0)
        bmi.s    loc_233F0
        cmpi.b    #$E,(MainCharacter+layer).w
        beq.s    loc_233F0
    
    loc_233C0:
        move.b    #$C,(MainCharacter+layer).w
        move.b    #$D,(MainCharacter+layer_plus).w
        cmpi.b    #2,objoff_33(a0)
        bne.s    loc_233E2
        tst.b    subtype(a0)
        bmi.s    loc_233F0
        cmpi.b    #$E,(Sidekick+layer).w
        beq.s    loc_233F0
    
    loc_233E2:
        move.b    #$C,(Sidekick+layer).w
        move.b    #$D,(Sidekick+layer_plus).w
        bra.s    BranchTo_JmpTo9_MarkObjGone
    ; ===========================================================================
    
    loc_233F0:
        lea    (MainCharacter).w,a1 ; a1=character
        move.b    objoff_32(a0),d0
        bsr.s    loc_2343E
        lea    (Sidekick).w,a1 ; a1=character
        move.b    objoff_33(a0),d0
        bsr.s    loc_2343E
        bra.w    loc_234A4
    ; ===========================================================================
    
    loc_23408:
        cmpi.b    #$23,objoff_32(a0)
        beq.s    loc_23408_Amy
        move.b    d0,d1
        andi.b    #8,d1
        beq.w    loc_23470
        cmpi.w    #3,(Player_Mode).l;is player ????
        beq.s    +
        cmpi.w    #2,(Player_Mode).l;is player Cream?
        beq.s    ++
    +
        cmpi.b    #$23,objoff_32(a0)
        beq.s    loc_23408_Amy
    +
        cmpi.b    #2,objoff_32(a0)
        bne.s    loc_23426
    loc_23408_Amy:
        tst.b    subtype(a0)
        bmi.s    loc_23436
        cmpi.b    #$E,(MainCharacter+layer).w
        beq.s    loc_23436
    
    loc_23426:
        move.b    #$C,(MainCharacter+layer).w
        move.b    #$D,(MainCharacter+layer_plus).w
        bra.w    BranchTo_JmpTo9_MarkObjGone
    ; ===========================================================================
    
    loc_23436:
        clr.b    ($FFFFFFA6).w
        lea    (MainCharacter).w,a1 ; a1=character
        bsr.s    loc_23444
        bra.w    loc_234A4
    ; ===========================================================================
    
    loc_2343E:
        cmpi.b    #$25,d0
        beq.s    loc_23444
        cmpi.b    #$24,d0
        beq.s    loc_23444
        cmpi.b    #$23,d0
        beq.s    loc_23444
        cmpi.b    #2,d0
        bne.s    loc_2345C
    
    loc_23444:
        bset    #2,status(a1)
        move.b    #$E,y_radius(a1)
        move.b    #7,x_radius(a1)
        move.b    #2,anim(a1)
    
    loc_2345C:
        cmpi.w    #3,(Player_Mode).l;is player ????
        beq.s    +
        cmpi.w    #2,(Player_Mode).l;is player Cream?
        beq.s    +
        cmpi.b    #$23,objoff_32(a0)
        beq.s    Hammer2FThrough
    +
        bset    #1,status(a1)
    Hammer2FThrough:
        bclr    #3,status(a1)
        move.b    #2,routine(a1)
        rts
    ; ===========================================================================
    
    loc_23470:
        andi.b    #$10,d0
        beq.w    BranchTo_JmpTo9_MarkObjGone
        cmpi.b    #2,objoff_33(a0)
        bne.s    loc_2348E
        tst.b    subtype(a0)
        bmi.s    loc_2349E
        cmpi.b    #$E,(Sidekick+layer).w
        beq.s    loc_2349E
    
    loc_2348E:
        move.b    #$C,(Sidekick+layer).w
        move.b    #$D,(Sidekick+layer_plus).w
        bra.w    BranchTo_JmpTo9_MarkObjGone
    ; ===========================================================================
    
    loc_2349E:
        lea    (Sidekick).w,a1 ; a1=character
        bsr.s    loc_23444
    
    loc_234A4:
        move.w    objoff_38(a0),(Chain_Bonus_counter).w
        andi.b    #-$19,status(a0)
        lea    (byte_234F2).l,a4
        moveq    #0,d0
        move.b    mapping_frame(a0),d0
        addq.b    #1,mapping_frame(a0)
        move.l    d0,d1
        add.w    d0,d0
        add.w    d0,d0
        lea    (a4,d0.w),a4
        neg.w    d1
        addi.w    #9,d1
        move.w    #$18,d2
        bsr.w    JmpTo_sub_15E18
        bsr.w    loc_236A8
    
    loc_234DC:
        bsr.w    JmpTo8_ObjectMove
        addi.w    #$18,y_vel(a0)
        tst.b    render_flags(a0)
        bpl.w    JmpTo22_DeleteObject
        bra.w    JmpTo12_DisplaySprite
    ; ===========================================================================
    byte_234F2:
        dc.b $FF
        dc.b   0    ; 1
        dc.b $F8    ; 2
        dc.b   0    ; 3
        dc.b   1    ; 4
        dc.b   0    ; 5
        dc.b $F8    ; 6
        dc.b   0    ; 7
        dc.b $FF    ; 8
        dc.b $20    ; 9
        dc.b $F9    ; 10
        dc.b   0    ; 11
        dc.b   0    ; 12
        dc.b $E0    ; 13
        dc.b $F9    ; 14
        dc.b   0    ; 15
        dc.b $FF    ; 16
        dc.b $40    ; 17
        dc.b $FA    ; 18
        dc.b   0    ; 19
        dc.b   0    ; 20
        dc.b $C0    ; 21
        dc.b $FA    ; 22
        dc.b   0    ; 23
        dc.b $FF    ; 24
        dc.b $60    ; 25
        dc.b $FB    ; 26
        dc.b   0    ; 27
        dc.b   0    ; 28
        dc.b $A0    ; 29
        dc.b $FB    ; 30
        dc.b   0    ; 31
        dc.b $FF    ; 32
        dc.b $80    ; 33
        dc.b $FC    ; 34
        dc.b   0    ; 35
        dc.b   0    ; 36
        dc.b $80    ; 37
        dc.b $FC    ; 38
        dc.b   0    ; 39
    ; ===========================================================================
     
  15. Iso Kilo

    Iso Kilo Is it a fox? Is it a wolf? It's Kilo! Member

    Joined:
    Oct 9, 2017
    Messages:
    327
    Location:
    A warm and lovely place~
    You can reference Sonic 1's loop code, since it checks for what chunk the player is on. Just instead of the single 256x256 chunk, you check for the 4 128x128 chunks.
    Code:
            lea    ($FFFFA400).w,a1
            move.b    (a1,d0.w),d1    ; d1 is    the 256x256 tile Sonic is currently on
            cmp.b    ($FFFFF7AE).w,d1
            beq.w    Obj01_ChkRoll
            cmp.b    ($FFFFF7AF).w,d1
            beq.w    Obj01_ChkRoll
            cmp.b    ($FFFFF7AC).w,d1
            beq.s    loc_13976
            cmp.b    ($FFFFF7AD).w,d1
            beq.s    loc_13966
            bclr    #6,1(a0)
            rts    
    Edit, probably not what you meant. Apologies.
     
  16. Scrap Brain

    Scrap Brain Now Iron Ruin Member

    Joined:
    Sep 18, 2020
    Messages:
    20
    Location:
    Sonic Drift 2 for the Sega Game Gear
    So I added a custom loop chunk to Labyrinth and it doesn't seem to be working. I made a copy with the second half of the collision and have flagged it as a loop in both SonEd2 and SonLVL, but it doesn't work in game. What am I doing wrong here and how can I make the loop work?
     
    Last edited: Sep 25, 2020
  17. Iso Kilo

    Iso Kilo Is it a fox? Is it a wolf? It's Kilo! Member

    Joined:
    Oct 9, 2017
    Messages:
    327
    Location:
    A warm and lovely place~
    Sonic 1 has a file called loopnums.bin that determines what is an S-tube and a loop. Refer to this guide.
    Alternatively you could use the pathswapper system in Sonic 2, 3, and K.
     
    Scrap Brain likes this.
  18. Scrap Brain

    Scrap Brain Now Iron Ruin Member

    Joined:
    Sep 18, 2020
    Messages:
    20
    Location:
    Sonic Drift 2 for the Sega Game Gear
    I've set the loop number for Labyrinth to the number of the chunk ID, and SonEd2 says it's a loop, but it doesn't work at all in game. Is there any way to add the pathswapper system from Sonic 2 or is there an easier method I could do to get it to work? (Code and SonEd2 screenshot for reference, using github disassam)

    Code:
    LoopTileNums:
    
    ;         loop    loop    tunnel    tunnel
    
        dc.b    $B5,    $7F,    $1F,    $20    ; Green Hill
        dc.b    $B2,    $7F,    $7F,    $7F    ; Labyrinth
        dc.b    $7F,    $7F,    $7F,    $7F    ; Marble
        dc.b    $AA,    $B4,    $7F,    $7F    ; Star Light
        dc.b    $7F,    $7F,    $7F,    $7F    ; Spring Yard
        dc.b    $7F,    $7F,    $7F,    $7F    ; Scrap Brain
        zonewarning LoopTileNums,4
        dc.b    $7F,    $7F,    $7F,    $7F    ; Ending (Green Hill)
    
            even
    upload_2020-9-25_15-54-54.png
     
  19. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,869
    Show us the collision of chunk 32 and 33 first =)

    EDIT: Of course, they run out of posts, and sent an email instead, but, I think it would be nice to have an answer to this question for future reference.

    [​IMG]

    This may or may not be the solution, but, this needs resolving anyway; these chunks need a thicker collision (especially the second one), and both need a thicker collision on the floor, this is just in-case Sonic happens to be moving or falling faster than $10 pixels.

    Additionally, the very corner blocks need a different angle:

    [​IMG]

    The very last block of the collision array is 100% solid, with an angle of FF, right before it you will find 4 other 100% solid blocks too, but each one will have a different angle; 20, 60, A0, and E0, these are specifically for angles/hills/loops.
     
    Last edited: Sep 27, 2020
  20. Scrap Brain

    Scrap Brain Now Iron Ruin Member

    Joined:
    Sep 18, 2020
    Messages:
    20
    Location:
    Sonic Drift 2 for the Sega Game Gear
    Yeah uh
    upload_2020-9-27_23-44-30.png
    upload_2020-9-27_23-45-10.png
    upload_2020-9-27_23-52-19.png
    it doesn't want to work. Any suggestions to get this loop working?


    EDIT: I got it working.
     
    Last edited: Sep 28, 2020
    Rivet likes this.