Basic Questions and Answers Thread

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

  1. Stdh

    Stdh Newcomer Trialist

    Joined:
    Jan 11, 2021
    Messages:
    6
    so ive been thinking to replace sbz3 to normal scrap brain instead of labyrinth zone act 4 i trought i could just replace the art but its littarly loading the same art as labyrinth
    is there a way to load the normal scrap brain art?
     
  2. Inferno

    Inferno Rom Hacker Member

    Joined:
    Oct 27, 2015
    Messages:
    77
    Location:
    Hidden Palace Zone, Westside Island
    Hello, I'm trying to get a properly spawning GHZ boss for GHZ2 in my hack. It all works perfectly... except the screen doesn't lock for some reason.
    Here's my DLE code for GHZ2:

    Code:
    DLE_GHZ2:
            moveq    #0,d0
            move.b    (v_dle_routine).w,d0
            move.w    GHZ2_Routines(pc,d0.w),d0
            jmp    GHZ2_Routines(pc,d0.w)
    ; ===========================================================================
    GHZ2_Routines:    dc.w DLE_GHZ2main-GHZ2_Routines ; 0
            dc.w DLE_GHZ2Hurt-GHZ2_Routines ; 2
            dc.w DLE_GHZ2Boss-GHZ2_Routines ; 4
            dc.w DLE_GHZ2end-GHZ2_Routines ; 6
    ; ===========================================================================
    
    DLE_GHZ2main:       
            move.w    #$200,(v_limitbtm1).w
            cmpi.w    #$B30,(v_screenposx).w
            bcs.s    locret_6E3A
            move.w    #$600,(v_limitbtm1).w
            
            cmpi.w     #$EE0,(v_player+obX).w
            bcs.s   locret_6E3A
            
            addq.b     #2,(v_dle_routine).w
            
            btst    #1,(v_player+obStatus).w
            bne.s   locret_6E3A
    
            
            move.b    #4,(v_player+obRoutine).w
            jsr    Sonic_ResetOnFloorRAM
            bset    #1,(v_player+obStatus).w ;
            move.w    #-$400,(v_player+obVelY).w ; Throw Sonic into the air.
            move.w    #$200,(v_player+obVelX).w ; Throw him forwards.
            clr.b   (v_player+spindash_flag).w ; Clear the Spindash flag.
            move.w    #0,(v_player+obInertia).w
            move.b    #id_Hurt,(v_player+obAnim).w ; Put into hurt animation.
            move.w    #sfx_Death,d0 ; Play sound.
            jsr    (PlaySound_Special).l
            
    locret_6E3A:
            rts
    
    ; ===========================================================================
    
    DLE_GHZ2Hurt:
            cmpi.w #$3C00,(v_screenposx).w
            blt.s  @rts
            
            move.w    #$700,(v_limitbtm1).w
            
            cmpi.w #$4E00,(v_screenposx).w
            blt.s  @rts
            move.w    #$800,(v_limitbtm1).w
            
            cmpi.w #$6A80,(v_screenposx).w
            blt.s  @rts
            move.w    #$200,(v_limitbtm1).w
            
            cmpi.w    #$7460,(v_screenposx).w
            blt.s   @rts       
            addq.b  #2,(v_dle_routine).w
            
    @rts:
            rts   
    ; ===========================================================================
    
    DLE_GHZ2Boss:
            jsr    FindFreeObj
            bne.s    @bossmusic
            move.b    #id_BossGreenHill,0(a1) ; load GHZ boss    object
            move.w    #$7560,obX(a1)
            move.w    #$180,obY(a1)
    
    @bossmusic:
            music    bgm_Boss,0,1,0    ; play boss music
            move.b    #1,(f_lockscreen).w ; lock screen
            addq.b    #2,(v_dle_routine).w
            moveq    #plcid_Boss,d0
            bra.w    AddPLC        ; load boss patterns
            
    @rts:
            rts   
    ; ===========================================================================
    
    DLE_GHZ2end:
            move.w    (v_screenposx).w,(v_limitleft2).w
            rts   
    ; ===========================================================================
    Am I missing something? I've checked other DLEs for Act 3s, and they are similar to what I currently have. I can't seem to find anything that'd cause this here that wouldn't with the original boss in the boss code itself.
     
  3. TheInvisibleSun

    TheInvisibleSun Visible Member

    Joined:
    Jul 2, 2013
    Messages:
    359
    Location:
    Buffalo, NY, USA
    As you may know, Scrap Brain Act 3 is internally a fourth Labyrinth Zone act; every zone in Sonic 1 has 4 act slots by default, but the only one that is used and has the relevant data is Labyrinth. You could use the unused Scrap Brain Act 4 slot, and have everything point to that, rather than the LZ4 slot. There is a tutorial for this somewhere that goes into detail about what this entails, but it doesn't take much.


    Does it not lock to the left nor the right, and everything else with the boss loads perfectly fine?

    Also, I'm not sure if this is affecting your code, but shouldn't that branch to AddPLC be a 'bsr' or 'jsr', as it is meant to come back?

    (Also Also, I'm not sure if (or why) this matters, but the routines usually use 'bcs' for the position checks, rather than blt. I'm sure it doesn't matter, but I could've sworn that I ended up having differing results between the two before. But you did say that everything else loads fine, so I'm assuming that this is a non-issue)

    What happens if you try to set (v_limitright2) to where you need it? Seems like a redundant thing to do, but it could be worth a shot.
     
    ProjectFM likes this.
  4. Inferno

    Inferno Rom Hacker Member

    Joined:
    Oct 27, 2015
    Messages:
    77
    Location:
    Hidden Palace Zone, Westside Island
    It locks to the left due to DLE_GHZ2end, but it never locks to the right. I was messing around with stuff, hence the blts. I'll try manually setting v_limitright2 alongside changing the AddPLC instruction back. Would have thought f_lockscreen would have handled these things...
     
  5. TheInvisibleSun

    TheInvisibleSun Visible Member

    Joined:
    Jul 2, 2013
    Messages:
    359
    Location:
    Buffalo, NY, USA
    Looking into this a little bit further, your DLE's might be conflicting with the boss code, as there are routines that do add to limitright there, so I would also check that out. In my hack, I added a level check that skips over those instructions if currently in the other act (in my case it was SBZ 1). I originally had it use different numbers/checks, but I eventually handled it in the DLE itself per vladikcomper's advice/instructions (probably because it is cleaner to do it that way?):

    Code:
    
    loc_179F6:                ; XREF: BGHZ_ShipIndex
            move.w    #$400,obVelX(a0)
            move.w    #-$40,obVelY(a0)
            cmpi.w    #(id_SBZ<<8)+0,(v_zone).w    ; is level SBZ1? - TIS
            beq.s    loc_17A10            ; if yes, don't touch something DLE should handle - TIS/vladikcomper
            cmpi.w    #$2AC0,(v_limitright2).w
            beq.w    loc_17A10
            addq.w    #2,(v_limitright2).w
            bra.s    loc_17A16
    ; ===========================================================================
    
    loc_17A10:
    ...
    
    Sorry it isn't a clear, concise solution, but I hope this at least helps you figure out what's going on!
     
  6. Inferno

    Inferno Rom Hacker Member

    Joined:
    Oct 27, 2015
    Messages:
    77
    Location:
    Hidden Palace Zone, Westside Island
    That's strange, then, considering that it doesn't normally conflict...

    Also, for some reason, the prison capsule just plain doesn't work, so there might be some relation there.

    EDIT: This approach does seem to work! Thanks.
     
    Last edited: Apr 27, 2021
    TheInvisibleSun likes this.
  7. shadow saturn 6343

    shadow saturn 6343 Newcomer Trialist

    Joined:
    Apr 7, 2021
    Messages:
    6
    Location:
    colombia
    hello SSRG, a few months ago a friend asked me to do a sonic 1 rom hack, this one is going quite well, until I wanted to edit the sonic from the title screen, here a problem occurs, the friend's avatar is this way,
    and when I am going to put it in sonmaped the palette looks bad without the real colors, can you help me with this, thanks
     

    Attached Files:

  8. Mr. Joker 27 Music prod.

    Mr. Joker 27 Music prod. Musician, composer, remixer. Member

    Joined:
    Aug 26, 2016
    Messages:
    182
    There is a guide on Sonic Retro for more info about your bug, and please, spell right and use the grammar how is my friend, is "Sonic 1, SonMapED and, can you help me with this if someone can or have time?". I guess there are more tools for make new sprites also.
     
  9. yami

    yami Newcomer Member

    Joined:
    Sep 24, 2020
    Messages:
    13
    Location:
    The Studio
    Your problem is simply that you're using the wrong palette line if you didn't know. This can easily be fixed by switching the palette line when you're making the art, then switching it back to the original one when you save it. I usually use Flex for this type of stuff, so I can't really help in the SME department, but I don't think it should be that hard to do.
     
  10. shadow saturn 6343

    shadow saturn 6343 Newcomer Trialist

    Joined:
    Apr 7, 2021
    Messages:
    6
    Location:
    colombia
    hello again, I am something new in sonic hacking, I already know how to edit levels and change sonic sprites, but I want to know how to change the background of the levels with soned2 or with another program I thank anyone who wants to respond to this post
     

    Attached Files:

  11. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    890
    Location:
    Orono, Maine
    SonLVL lets you import chunks, so you can delete the tiles, blocks, and chunks associated with the current background, create your own background in an image editor such as GIMP, change the fourth palette line to consist of the colors used in the background you made, and important the new background into SonLVL. Keep in mind that you only have so many unique 8x8 tiles you can work with and that things like palette cycling and background deformation may end up messing with how it looks in game, but if you focus on one thing at a time, so should be able to end up with some good results.
     
    Niko and Scrap Brain like this.