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,902
    Location:
    italy
    The main problem is that the 1-up uses a sound effect (which doesn't stop the main music), while the emerald uses a song (which stops the main music). I can't look at the disassembly right now, but you should look at what the emerald collection routine does, because it resumes the music afterwards, so there's probably some code you should borrow for the 1-up as well.
     
    Tanman Tanner and EMK-20218 like this.
  2. Prilix

    Prilix A normal romhacker In Limbo

    Joined:
    Sep 19, 2017
    Messages:
    20
    Location:
    Argentina
    Thanks C:
     
  3. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    I'm not actually familiarized with the Sonic 8-bit games coding and structure, but I suppose you could take a look into the emerald counting routine, so you could make the level song to restart after the 1UP music exactly as the chaos emerald do when you grab one.
     
  4. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    116
    Location:
    Buffalo, New York
    Thank you for the suggestion. I assumed based on an earlier comment that it worked similar to 16-bit games, where the play-regular-music routine was in the sound file itself. I'm currently checking the disassembly in an attempt to find the emerald collection routine.

    UPDATE: I found it, I figured out how it does it, but here's the problem: in order for the music to play without instantly being canceled out by VF_Engine_ChangeLevelMusic, a custom version of wait_1s that I made called wait_3s has to be used. The problem? The emerald music won't play unless the CPU was halted, even if a wait of 3 seconds is done.
    Here's a snippet of code that I used.
    Code:
    IncrementRingCounter:
    LABEL_25C3:
        ld    a, (RingCounter)
        add   a, $01
        daa
        ld    (RingCounter), a
        ;check for 100 rings
        or    a
        jr    nz, Engine_UpdateRingCounterSprites
        ;we have 100 rings; increment life counter
        ld    hl, LifeCounter
        inc   (hl)
        call  Engine_CapLifeCounterValue
        ld    a, Music_Emerald
        ld    (Sound_MusicTrigger1), a
        wait_3s
        call    VF_Engine_ChangeLevelMusic
    What I want the game to do is not halt the CPU to play this song, but rather stop the previous music, play this, then once the song stops, play the old song again.
    Additionally, I can't add the change music routine to the 1-up/ring monitor's 1-up collection routine without an overflow error occurring.

    Here's the new problemish in action:

    Notice how Sonic stops but the timer doesn't.
     
    Last edited: Jun 27, 2018
  5. RouRouRou

    RouRouRou Ain't no fun if the aliens can't have none. Member

    Joined:
    Nov 20, 2016
    Messages:
    97
    So I've made all my zone's names have alliteration, (Like the names of CD's zones, Floral Fields, Cold Crystal, Molten Metro etc.) but I've run into a problem.

    I want to rename Cold Crystal Zone to Rocky Ruin Zone, but I just remembered that one zone already uses the letter R. (Robotic Rampage.)

    Are you fine with two zones using the letter R in their names? I'm considering that if I can figure out how bosses work correctly, I might add a boss rush zone called either Cosmic Chaos or Neo Nightmare. That is in the future though, I just want to work on finishing zones up at the moment.

    I've realised that using alliteration in zone names is harder than it looks, so this may give me relief.

    Answers and opinions appreciated. Thanks in advance!

    Edit: The reason I changed the name is because I like Rocky Ruin WAY better than Cold Crystal.

    Edit 2: Well, it seems that having Rocky Ruin and Robotic Rampage is okay. What relief, thanks!
     
    Last edited: Jul 1, 2018
  6. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    Sonic 3D Blast had Green Grove and Gene Gadget, so...
     
  7. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    116
    Location:
    Buffalo, New York
    I'd see no problem at all with that.
     
  8. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    116
    Location:
    Buffalo, New York
    Hey guys! It's been a while since I've made a post about my Sonic 3 & Knuckles ROM Hack, which I ported back to the SSRG splash screen version (which was edited off of an earlier version of the GitHub disassembly) and placed in this error handler and followed the instructions, and I'm getting a weird error.
    Code:
    sonic3k.asm(28): error: variables cannot be redefined as constants
    SONIC3_COMPLETE
    Sonic3_Complete = 1
    If I do something like this
    Code:
    NumberOne = 1
    Sonic3_Complete = NumberOne
    It stops erroring with that, but then spams out a bunch of "addressing mode is not allowed in 68000" errors.
    Could someone explain to me why this is happening?

    EDIT: I decided to use the modern version and I'll tinker around with the SSRG to make it work.
    EDIT 2: Followed the instructions that they did in their version, and it just goes to the SEGA Screen instead of jumping to the SSRG screen first.
    I learned some interesting stuff though...
    Code:
    GameModes:    dc.l Sega_Screen        ;   0
            dc.l Title_Screen        ;   4
            dc.l Level            ;   8
            dc.l Level            ;  $C
            dc.l JumpToSegaScreen        ; $10
            dc.l ContinueScreen        ; $14
            dc.l JumpToSegaScreen        ; $18
            dc.l LevelSelect_S2Options    ; $1C
            dc.l S3Credits            ; $20
            dc.l LevelSelect_S2Options    ; $24
            dc.l LevelSelect_S2Options    ; $28
            dc.l BlueSpheresTitle        ; $2C
            dc.l BlueSpheresResults        ; $30
            dc.l SpecialStage        ; $34
            dc.l Competition_Menu        ; $38
            dc.l Competition_PlayerSelect    ; $3C
            dc.l Competition_LevelSelect    ; $40
            dc.l Competition_Results    ; $44
            dc.l SpecialStage_Results    ; $48
            dc.l SaveScreen            ; $4C
            dc.l TimeAttack_Records        ; $50
            dc.l SSRGScreen            ; $54
    This skips over it in the GitHub version. (This is what it shows in the original splash screen disasm and what I'm using right now)
    Code:
    GameModes:    dc.l SSRGScreen        ;   0
            dc.l Title_Screen        ;   4
            dc.l Level            ;   8
            dc.l Level            ;  $C
            dc.l JumpToSegaScreen        ; $10
            dc.l ContinueScreen        ; $14
            dc.l JumpToSegaScreen        ; $18
            dc.l LevelSelect_S2Options    ; $1C
            dc.l S3Credits            ; $20
            dc.l LevelSelect_S2Options    ; $24
            dc.l LevelSelect_S2Options    ; $28
            dc.l BlueSpheresTitle        ; $2C
            dc.l BlueSpheresResults        ; $30
            dc.l SpecialStage        ; $34
            dc.l Competition_Menu        ; $38
            dc.l Competition_PlayerSelect    ; $3C
            dc.l Competition_LevelSelect    ; $40
            dc.l Competition_Results    ; $44
            dc.l SpecialStage_Results    ; $48
            dc.l SaveScreen            ; $4C
            dc.l TimeAttack_Records        ; $50
            dc.l Sega_Screen            ; $54
    This makes the SSRG screen play first, and that's basically it.
    Code:
    GameModes:    dc.l Sega_Screen        ;   0
            dc.l SSRGScreen            ; $54
            dc.l Title_Screen        ;   4
            dc.l Level            ;   8
            dc.l Level            ;  $C
            dc.l JumpToSegaScreen        ; $10
            dc.l ContinueScreen        ; $14
            dc.l JumpToSegaScreen        ; $18
            dc.l LevelSelect_S2Options    ; $1C
            dc.l S3Credits            ; $20
            dc.l LevelSelect_S2Options    ; $24
            dc.l LevelSelect_S2Options    ; $28
            dc.l BlueSpheresTitle        ; $2C
            dc.l BlueSpheresResults        ; $30
            dc.l SpecialStage        ; $34
            dc.l Competition_Menu        ; $38
            dc.l Competition_PlayerSelect    ; $3C
            dc.l Competition_LevelSelect    ; $40
            dc.l Competition_Results    ; $44
            dc.l SpecialStage_Results    ; $48
            dc.l SaveScreen            ; $4C
            dc.l TimeAttack_Records        ; $50
     
    This makes the SSRGScreen routine repeatedly call itself back, making the SSRG splash screen repeatedly restart from start to finish. It'd be a nice presentation demo... not so much a good way to launch my Sonic 3 ROM Hack.

    EDIT 3: Is there a way to make the SSRG splash screen show up with the GitHub disasm? Do I need to alter SSRG.asm to jump to the SEGA screen or is there an easier way?
     
    Last edited: Jul 3, 2018
  9. Devon

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

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    If I recall, SONIC3_COMPLETE is set in the actual build script, so you don't need to define it in the actual code.
     
  10. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    There seems to be a feature of sorts that prevents players from interacting with rings or other objects immediately after getting hurt. While this is perfectly fine for the regular game, this has turned into a serious problem for me, as it makes this possible:


    The only solution I can think of is to go back to using my old, embarrassing collision code I used before I knew how collision flags worked:
    Code:
        ;code to check if player should be hurt
    
        ;x check
        move.w (MainCharacter+x_pos).w,$30(a0)
        addi.w #24,$30(a0);add 10 to stored player position
        cmp.w    $30(a0),d0    ;check if P1 is in object x position range (1)
        bgt.s Obj62_main_move    ;if not, branch to move routine
        addi.w #-40,$30(a0) ;subtract 20 (A in hex) from stored player position
        cmp.w    $30(a0),d0    ;check if P1 is in object x position range (1)
        blt.s Obj62_main_move ;if not, branch to move routine
    
        ;y check
        move.w (MainCharacter+y_pos).w,$30(a0)
        addi.w #32,$30(a0);add 10 to stored player position
        cmp.w    $30(a0),d1    ;check if P1 is in object y position range (1)
        bgt.s Obj62_main_move    ;if not, branch to move routine
        addi.w #-32,$30(a0) ;subtract 10 (A in hex) from stored player position
        cmp.w    $30(a0),d1    ;check if P1 is in object y position range (1)
        blt.s Obj62_main_move ;if not, branch to move routine
        lea    (MainCharacter).w,a1 ; a1=character
        bsr.w    Touch_ChkHurt2
    
    Surely the engine has a more elegant solution to this problem, I just don't know what it is.
     
  11. Devon

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

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    The game doesn't run TouchResponse when Sonic is not in the "normal" state.

    One pretty simple and hackish solution you can do is modify Touch_Loop to check if Sonic is in the "normal" state, and if not, only allow specific collision IDs to affect him. With the case of just allowing the laser, we can just do this:
    Code:
        move.b    collision_flags(a1),d0
        cmpi.b    #2,routine(a0)
        beq.s    +
        cmpi.b    #[YOUR ID HERE],d0
        bne.s    Touch_NextObj
    +    tst.b    d0
        bne.w    Touch_Width
    Now, what I recommend you then do is set the collision type of the laser to "special", by ORing it with $C0. Then in Touch_Special, add a check for the collision ID already ANDed with $3F, and have it branch to KillCharacter (or even HurtCharacter if you prefer), which doesn't account for invulnerability.

    The final thing left to do to get the basic functionality working is to actually call TouchResponse somewhere in Obj01_Hurt_Normal.

    It may also be desirable to not have TouchResponse call Touch_Rings, Check_CNZ_Bumpers, and Touch_Boss when Sonic is hurt. To do so, just add a check for Sonic's routine at the start of TouchResponse, and have it branch to where "move.w x_pos(a0),d2" is.

    There may be a better solution out there, but this is just one.
     
    Niko, ProjectFM and Pacca like this.
  12. Prilix

    Prilix A normal romhacker In Limbo

    Joined:
    Sep 19, 2017
    Messages:
    20
    Location:
    Argentina
    Hi,How do I add the SSRG Splash Screen in sonic 1?
     
  13. Spanner

    Spanner The Tool Member

    Joined:
    Aug 9, 2007
    Messages:
    2,570
  14. Prilix

    Prilix A normal romhacker In Limbo

    Joined:
    Sep 19, 2017
    Messages:
    20
    Location:
    Argentina
    Thanks you :)
     
  15. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    How do I debug AS spitting out hundreds of "addressing mode not allowed on 68000" errors? adding 4 measly lines of code is doing this, and all the errors are no where near the added code, and have nothing to do with it. I've noticed it do similar things with other seemingly harmless actions (like copying the disassembly to another computer; git confirmed it was the same, but AS gave errors on one computer and not the other). Are there any work arounds?
     
  16. its boomer

    its boomer Newcomer Member

    Joined:
    Jan 4, 2016
    Messages:
    17
    Location:
    Gornyak/Russia
    Can you tell me how to make it possible to play only one character in sth 2? I mean, take away, like, Tails, so they can't play. Only Sonic.
     
  17. Devon

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

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    Set the "player mode" to 1 to play as Sonic alone. Set it to 2 to play as Tails alone.
     
  18. its boomer

    its boomer Newcomer Member

    Joined:
    Jan 4, 2016
    Messages:
    17
    Location:
    Gornyak/Russia
    Is it possible for Tails to be completely excluded from the game?
     
  19. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    edit: it looks like I was wrong, trash please
     
    Last edited: Jul 8, 2018
  20. Devon

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

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    The easiest method would be to just put an "rts" right under the Obj02 (Tails) and Obj05 (Tails' tails) objects. Though, if you also want to save ROM space and such, go to the object list and replace the Obj02 and Obj05 labels there with a null object label, and then delete the code and data for Obj02 and Obj05. You can also track down references to the "Sidekick" object and delete them and any related code to them.
     
    AkumaYin likes this.