don't click here

Basic Questions & Answers thread

Discussion in 'Engineering & Reverse Engineering' started by Tweaker, May 29, 2008.

  1. GT Koopa

    GT Koopa

    Member
    2,021
    18
    18
    Elgin, IL
    Flicky Turncoat DX, T.L.W.S. Vs M.G.W.
    Should I get rid of the koopa tiles too? I have been replacing them after the girder tiles, where they used to be. Either way I can't check until friday, and that is only if I can get out of the house and go to the local library. I can't run the build program involving Sonic 2 at school anymore, which is a shame.
     
  2. SMTP

    SMTP

    Tech Member
    Just remove the girders altogether...
     
  3. GT Koopa

    GT Koopa

    Member
    2,021
    18
    18
    Elgin, IL
    Flicky Turncoat DX, T.L.W.S. Vs M.G.W.
    Yes, that came to me too. Back then I noticed that when encountering tiles on the low plane, the girder object would go right over them and that's a problem because I wanted to create the ol' blocking background wall AND have objects seen. I looked into removing it, found some interesting stuff but not exactly what I wanted. In the end I desided that I would only make the "inside" parts happen between whenever the girder doesn't show itself. (it is slow enough)
     
  4. Small question, where does Sonic 2 store its 'table' to tell what level to use what palette/underwater palette? I thought it was the palette pointer I added my palette but Nothing:


    Code (Text):
    1. ;----------------------------------------------------------------------------
    2. ; Palette pointers
    3. ; (PALETTE DESCRIPTOR ARRAY)
    4. ; This struct array defines the palette to use for each level.
    5. ;----------------------------------------------------------------------------
    6. (Other palettes and things, removed for the sake of this post)
    7. PalPtr_EHZ_U:   palptr Pal_EHZ_U, 0; Emerald Hill underwater pal

    It's probably the size that I have wrong, which is the '0', but I looked off ARZ's, and I don't really understand it <_<.



    So my question is is do I have the size right? And how do I get EHZ's water to use that palette instead of ARZ's?
     
  5. Spanner

    Spanner

    The Tool Member
    Random guess, but:
    Code (ASM):
    1.  
    2. Level_LoadPal:
    3.     moveq   #3,d0
    4.     bsr.w   PalLoad2    ; load Sonic's palette line
    5.     tst.b   (Water_flag).w  ; does level have water?
    6.     beq.s   Level_GetBgm    ; if not, branch
    7.     moveq   #$15,d0 ; palette number $15
    8.     cmpi.b  #8,(Current_Zone).w
    9.     beq.s   Level_WaterPal ; branch if level is HPZ
    10.     moveq   #$16,d0 ; palette number $16
    11.     cmpi.b  #$D,(Current_Zone).w
    12.     beq.s   Level_WaterPal ; branch if level is CPZ
    13.     moveq   #$17,d0 ; palette number $17
    Maybe adding to that may help.
     
  6. Thing is I don't see ARZ there...or is ARZ not there because it's the default?
     
  7. FraGag

    FraGag

    Tech Member
    Here's what it looks like in the svn disassembly:
    Code (ASM):
    1. Level_LoadPal:
    2.     moveq   #PalID_BGND,d0
    3.     bsr.w   PalLoad2    ; load Sonic's palette line
    4.     tst.b   (Water_flag).w  ; does level have water?
    5.     beq.s   Level_GetBgm    ; if not, branch
    6.     moveq   #PalID_HPZ_U,d0 ; palette number $15
    7.     cmpi.b  #hidden_palace_zone,(Current_Zone).w
    8.     beq.s   Level_WaterPal ; branch if level is HPZ
    9.     moveq   #PalID_CPZ_U,d0 ; palette number $16
    10.     cmpi.b  #chemical_plant_zone,(Current_Zone).w
    11.     beq.s   Level_WaterPal ; branch if level is CPZ
    12.     moveq   #PalID_ARZ_U,d0 ; palette number $17
    So yes, ARZ is the "default."
     
  8. Alright, well I added
    Code (Text):
    1.     cmpi.b  #emerald_hill_zone,(Current_Zone).w
    2.     beq.s   Level_WaterPal; branch if level is EHZ
    3.     moveq   #PalID_EHZ_U,d0; load EHZ's underwater pal
    underneath, however, where is PalID_ARZ_U defined? I searched in s2.asm and only came up with two results. Neither of which define.
     
  9. FraGag

    FraGag

    Tech Member
    It's defined in s2.constants.asm. Also, you're checking for the wrong zone ID; you should check for Aquatic Ruin instead of Emerald Hill.
     
  10. ALRIGHT. Everything works now: except one thing. The tiles that use the rotating palette—don't work underwater.


    Is there a way around this?
     
  11. FraGag

    FraGag

    Tech Member
    You'd need to edit PalCycle_EHZ. If you want to use the same colors underwater, you could change the code this way:
    Code (ASM):
    1. PalCycle_EHZ:
    2.     lea (CyclingPal_EHZ_ARZ_Water).l,a0
    3.     subq.w  #1,(PalCycle_Timer).w
    4.     bpl.s   +   ; rts
    5.     move.w  #7,(PalCycle_Timer).w
    6.     move.w  (PalCycle_Frame).w,d0
    7.     addq.w  #1,(PalCycle_Frame).w
    8.     andi.w  #3,d0
    9.     lsl.w   #3,d0
    10.     move.l  (a0,d0.w),(Normal_palette_line2+6).w
    11.     move.l  4(a0,d0.w),(Normal_palette_line2+$1C).w
    12.     move.l  (a0,d0.w),(Underwater_palette_line2+6).w
    13.     move.l  4(a0,d0.w),(Underwater_palette_line2+$1C).w
    14. +   rts
    15.  
    If you want different colors, add a lea (like the first instruction, only with a different label) before the move instructions that set the underwater colors. That data should be the same length as that labelled as CyclingPal_EHZ_ARZ_Water.
     
  12. Alright, now that that's working, my last and final question.


    I'm having some trouble figuring out PLCs (Sort of revisiting the area, trying again.)


    For example:

    PlrList_Ehz1: plrlistheader
    plreq $7500, ArtNem_WaterSurface2
    plreq $7600, ArtNem_EHZ_Bridge
    plreq $8200, ArtNem_HtzRock
    plreq $8500, ArtNem_Masher

    PlrList_Ehz1_End



    A few things go overwrite each other, the EHZ bridge and the HTZ rock for one, and the Masher and water surface.


    I've changed these values but then it completely becomes garbled.
    My question is is how do I figure out what I change it to to keep it from garbling <_<
     
  13. Jof

    Jof

    Member
    216
    0
    16
    Scotland
    Sonic Fantasy
    Ok, so I just ported the BG Rev01 additions to S1 as per the guide on the wiki. However, on running Build.bat, I get this error.

    Code (Text):
    1. s1comb.asm<6211> : Error 06052 : Branch offset <-34464> out of range at address
    2. 0
    3. s1comb.asm<6224> : Error 06052 : Branch offset <-34438> out of range at address
    4. 0
    I'm hopeless at ASM, so can anyone help me ?
     
  14. Spanner

    Spanner

    The Tool Member
    Go to those lines (most editors use Ctrl+G). As far as I remember these lines contain a bra or bsr, so change a bra to jmp and a bsr to jsr.
    If that doesn't work, I think it's something to do with the GHZ3 resize routine, so you may want to look there.
     
  15. Jof

    Jof

    Member
    216
    0
    16
    Scotland
    Sonic Fantasy
    Thanks for the help, however I'm still getting the same error no matter what I try.

    The thing is, in porting the code in the guide, I didn't touch Lines 6211 and 6224 (the TRY AGAIN and END screen main loop)

    However, 6211 does have a bsr.w, which I changed to jsr , but then I still get the same error code as before.

    I looked at GHZ3 resize, but I can't see anything. I'll post what I have:

    Code (Text):
    1. ; ===========================================================================
    2.  
    3. Resize_GHZ3:
    4.         moveq   #0,d0
    5.         move.b  ($FFFFF742).w,d0
    6.         move.w  off_6E4A(pc,d0.w),d0
    7.         jmp off_6E4A(pc,d0.w)
    8. ; ===========================================================================
    9. off_6E4A:   dc.w Resize_GHZ3main-off_6E4A
    10.         dc.w Resize_GHZ3boss-off_6E4A
    11.         dc.w Resize_GHZ3end-off_6E4A
    12. ; ===========================================================================
    13.  
    14. Resize_GHZ3main:
    15.         move.w  #$300,($FFFFF726).w
    16.         cmpi.w  #$380,($FFFFF700).w
    17.         bcs.s   locret_6E96
    18.         move.w  #$310,($FFFFF726).w
    19.         cmpi.w  #$960,($FFFFF700).w
    20.         bcs.s   locret_6E96
    21.         cmpi.w  #$280,($FFFFF704).w
    22.         bcs.s   loc_6E98
    23.         move.w  #$400,($FFFFF726).w
    24.         cmpi.w  #$1380,($FFFFF700).w
    25.         bcc.s   loc_6E8E
    26.         move.w  #$4C0,($FFFFF726).w
    27.         move.w  #$4C0,($FFFFF72E).w
    28.  
    29. loc_6E8E:
    30.         cmpi.w  #$1700,($FFFFF700).w
    31.         bcc.s   loc_6E98
    32.  
    33. locret_6E96:
    34.         rts
    35. ; ===========================================================================
    36.  
    37. loc_6E98:
    38.         move.w  #$300,($FFFFF726).w
    39.         addq.b  #2,($FFFFF742).w
    40.         rts
    41. ; ===========================================================================
    42.  
    43. Resize_GHZ3boss:
    44.         cmpi.w  #$960,($FFFFF700).w
    45.         bcc.s   loc_6EB0
    46.         subq.b  #2,($FFFFF742).w
    47.  
    48. loc_6EB0:
    49.         cmpi.w  #$2960,($FFFFF700).w
    50.         bcs.s   locret_6EE8
    51.         bsr.w   SingleObjLoad
    52.         bne.s   loc_6ED0
    53.         move.b  #$3D,0(a1); load GHZ boss   object
    54.         move.w  #$2A60,8(a1)
    55.         move.w  #$280,$C(a1)
    56.  
    57. loc_6ED0:
    58.         move.w  #$8C,d0
    59.         bsr.w   PlaySound; play boss music
    60.         move.b  #1,($FFFFF7AA).w; lock  screen
    61.         addq.b  #2,($FFFFF742).w
    62.         moveq   #$11,d0
    63.         bra.w   LoadPLC ; load boss patterns
    64. ; ===========================================================================
    65.  
    66. locret_6EE8:
    67.         rts
    68. ; ===========================================================================
    69.  
    70. Resize_GHZ3end:
    71.         move.w  ($FFFFF700).w,($FFFFF728).w
    72.         rts
    73. ; ===========================================================================
     
  16. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    485
    63
    italy
    Remove the .w and keep only the jsr
     
  17. Jof

    Jof

    Member
    216
    0
    16
    Scotland
    Sonic Fantasy
    Gah, Yeah, sorry, I quickly edited my post. I did that and still get the original 2 errors.

    Here are the two lines that appear to be giving me errors. They are the "jsr PauseGame", and the move.b at the TryAg_Exit

    Code (Text):
    1. ; ---------------------------------------------------------------------------
    2. ; "TRY AGAIN" and "END" screen main loop
    3. ; ---------------------------------------------------------------------------
    4. TryAg_MainLoop:
    5.         jsr PauseGame
    6.         move.b  #4,($FFFFF62A).w
    7.         bsr.w   DelayProgram
    8.         jsr ObjectsLoad
    9.         jsr BuildSprites
    10.         andi.b  #$80,($FFFFF605).w; is  Start button pressed?
    11.         bne.s   TryAg_Exit; if yes, branch
    12.         tst.w   ($FFFFF614).w; has 30 seconds elapsed?
    13.         beq.s   TryAg_Exit; if yes, branch
    14.         cmpi.b  #$1C,($FFFFF600).w
    15.         beq.s   TryAg_MainLoop
    16.  
    17. TryAg_Exit:
    18.         move.b  #0,($FFFFF600).w; go to Sega screen
    19.         rts
    20.  
    21. ; ===========================================================================
    Note: That first jsr was changed from the bsr.w
     
  18. SMTP

    SMTP

    Tech Member
    Its Lines 6211 and 6224 in S1comb.asm. Not S1.asm.

    So, find those lines in S1comb.asm and see what loc_xxxx they come under, and modify them in S1.asm.
     
  19. Peruant

    Peruant

    Just dropping in through gaps Member
    What are these "voices" I keep hearing about when it comes to music hacking?

    Also, I got a MPD24 Midi thing for this a while back and I'll be putting into use. Any good programs? I've got FL Studio , but a still a bit loss with everything.
     
  20. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    485
    63
    italy
    For some reason, FM instruments are called "voices".
    Don't ask me why, I find it weird too :p