Basic Questions and Answers Thread

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

  1. Stdh

    Stdh Active Member Member

    Joined:
    Jan 11, 2021
    Messages:
    30
    Location:
    the netherlands
    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:
    132
    Location:
    Sky Base Zone, South 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:
    424
    Location:
    Western New York, 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:
    132
    Location:
    Sky Base Zone, South 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:
    424
    Location:
    Western New York, 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:
    132
    Location:
    Sky Base Zone, South 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:
    7
    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. Deactivated Account

    Deactivated Account Well-Known Member Exiled

    Joined:
    Aug 26, 2016
    Messages:
    244
    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 the homing attack addict Member

    Joined:
    Sep 24, 2020
    Messages:
    34
    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:
    7
    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:
    912
    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 Sorra like this.
  12. Speems

    Speems Well-Known Member Member

    Joined:
    Mar 14, 2017
    Messages:
    83
    Location:
    Rochester Hills, MI
    Something I've seen in some hacks in when the HUD slides in when the level fades in, and slides out when you touch the signpost. This is something I want to port to my hack although I don't know how to do this. How should this be accomplished? Doesn't matter if it's each piece sliding in (Score, Time, Rings, Lives, respectively coming in) or all the pieces sliding in at once, I'd just like an answer to my question.
     
  13. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    373
    It is easy to get every bit of the HUD to slide in and out. I assume you need to set the x-axis to the HUD to 0 to make new slide in and out codes. So for Obj21_Main (HUD_Main for GitHub), you need to change the second line to this:
    Code:
            move.w  #0,8(a0)    ; DW: It was at $90 originally
    This makes sure the x-coordinates to the HUD start at 0. From there, you should make a new routine to set the HUD to slide in. You need to set checks to if the HUD is x-coordinate to 90 and, if not, to make the HUD move to that position. Now I know you want to give this a go for yourself so I advise checking the best possible code to move the HUD. Regrading moving out, it's the same thing as moving the HUD in, except you need to make a branch to GotThroughAct and apply checks to the HUD object to make it move back to 0. I hope this gives you a clear image of how it works, and hopefully, you should successfully implement it.
     
    Last edited: May 19, 2021
    TheInvisibleSun likes this.
  14. Speems

    Speems Well-Known Member Member

    Joined:
    Mar 14, 2017
    Messages:
    83
    Location:
    Rochester Hills, MI
    Problem is, my disassembly has the Sonic CD centiseconds ported and it wiped out that line. And (I hate to be rude but...) there's also the fact you didn't really answer my question in its entirety. All you said was to tell the HUD to be positioned to the left off-screen. Plus I also got very confused as soon as I was trying to find the right code. Kinda frustrating that way ngl
     
  15. TheInvisibleSun

    TheInvisibleSun Visible Member

    Joined:
    Jul 2, 2013
    Messages:
    424
    Location:
    Western New York, USA
    He was nice enough to give you a helpful answer, so it would behoove you to at least read it thoroughly. It doesn't look like he missed any part of your question, but even if he did, you were at least given a starting point, and it would be cool if you were a little less impatient (and more appreciative and graceful) with any followup questions.
     
    DeltaWooloo likes this.
  16. Speems

    Speems Well-Known Member Member

    Joined:
    Mar 14, 2017
    Messages:
    83
    Location:
    Rochester Hills, MI
    I'm sorry, I tend to lash like that when impatient or frustrated. It's just that I couldn't figure out the right lines of code to bring in that's what led to that happening to begin with.
     
  17. SuperSayian Zrise

    SuperSayian Zrise Well-Known Member Exiled

    Joined:
    May 10, 2021
    Messages:
    78
    I have something that's really bothering me. And it's that how do I change the life icon on the HUD? I wanted to do it for my hack but don't know how to edit it. Because, I know how to change the score, time, and rings and there's no guide I could find. Also if your wondering I'm doing this for my hack and will appreciate it even more if I can also get help on how to edit the life icon in the monitor. Thanks.
     
  18. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    It's funny that you figured out how to edit the HUD first, most people, myself included, figured out the life icon first and only learned how to edit the HUD mappings later on! In the sonic 2 disassemblies, the artwork for the life counter is in art/nemesis/Sonic lives counter.bin or art/nemesis/Tails life counter.bin, for each character of course. In the Sonic 1 github disassembly, the life icon is stored in artnem/HUD - Life Counter Icon.bin. Don't recall exactly where the mappings are, but its' easy enough to edit the icon without them, it's a pretty small and simple art file. Just open the artfile in your favorite mappings editor (SonMapEd or Flex2, I recommend the latter but the former can work too), arrange the life icon tiles together, then edit/import over the icon however you like. And Sonic Team thought ahead in regards to the Life Monitor, at least in Sonic 2; it just reuses the life icon artwork from the HUD, so editing the one file will affect both. I think Sonic 1 does that too, although I can't be entirely sure, its' been awhile since I worked with Sonic 1. In case it doesn't, the monitor art is in artnem/Monitors.bin, and the mapping are in _maps/Monitor.asm
     
  19. SuperSayian Zrise

    SuperSayian Zrise Well-Known Member Exiled

    Joined:
    May 10, 2021
    Messages:
    78
    for hivebrain? just wondering because my hack is hivebrain 68k
    thanks for help though! :)
    edit: found it
    edit2: works in game! :)
     
    Last edited: May 22, 2021
  20. shadow saturn 6343

    shadow saturn 6343 Newcomer Trialist

    Joined:
    Apr 7, 2021
    Messages:
    7
    Location:
    colombia
    Well, the other time, doing my hack, I finished changing Sonic's sprites and then I went to change the sonic sign at the end of the level, and when I do so when I reach the end of green hill the game turns blue the whole screen can help in this I am new to hacking I do not know much about this; I thank anyone who wants to respond to this publication