Basic Questions and Answers Thread

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

  1. FruitcakeDog

    FruitcakeDog Newcomer Member

    Joined:
    May 28, 2020
    Messages:
    22
    Location:
    United Kingdom
    Done exactly what you said and it seems to work fine in that section. However, I've tried to fix up some of the other files which refer to the old IDs to replace any instance of 'id_*animationname*' with 'SonicAni_*animationname*' but every time I try to do so it says that the new ID names are illegal values.

    I've attached the current error log from my disassembly if it helps at all.
     

    Attached Files:

  2. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    Sorry, I went under the assumption that you were using the Hivebrain disassembly, which I'm more familiar with. The GitHub disassembly complicates things. I recommend leaving the ids alone and just changing the names that are different such as "SonAni_Spindash" pack to their Sonic 1 equivalents, such as "SonAni_Warp1". Then you need to add in the ptr labels in front of each entry in the table. Finally, add back in the list at the bottom of ids. So, pretty much just set _anim/Sonic.asm up to be the way it was in the base Sonic 1 disassembly. The part that matters is that the animation data itself is changed to match Sonic 2 Beta's frames.
     
    FruitcakeDog likes this.
  3. Angel X

    Angel X Well-Known Member Member

    Joined:
    Sep 15, 2017
    Messages:
    291
    Location:
    Italy
    Hello again...
    I have a serious problem, I wanted to test the new version of my hack, I press start and this happened:
    s1built004.jpg s1built001.jpg s1built000.jpg s1built003.jpg s1built002.jpg
    The floor is fucked up!
    Trust me, I don't know what happened.
    I made changes to the S monitor code but it didn't bother me until a few days ago.
    The last change I made was the modification of the special stages and another change of order of the levels.
    Anyone know what happened?
    Has this ever happened to you?
    EDIT:This only happens in GHZ.
     
    Last edited: Jul 2, 2020
  4. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    373
    EDIT: Please trash
     
    Last edited: May 1, 2022
  5. Devon

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

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    @TheChosenHacker That doesn't make any sense. Unless they changed GHZ's zone ID (which seems highly unlikely, to be honest) and forgot to fix the collision index table, the collision shouldn't mess up like that from a programming standpoint. More than likely just corrupted/overwritten data.
     
    Last edited: Jul 2, 2020
  6. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    116
    Location:
    Buffalo, New York
    How, exactly, did you do this? Did you alter GHZ's zone ID?
    As mentioned above, you have to modify the collision index table.
     
  7. Angel X

    Angel X Well-Known Member Member

    Joined:
    Sep 15, 2017
    Messages:
    291
    Location:
    Italy
    I'm afraid the problem is the position of the levels, this is the code:

    Code:
    LevelOrder:
        ; Green Hill Zone
        dc.b id_GHZ, 1    ; Act 1
        dc.b id_GHZ, 2    ; Act 2
        dc.b id_SLZ, 0    ; Act 3
        dc.b 0, 0
    
        ; Labyrinth Zone
        dc.b id_LZ, 1    ; Act 1
        dc.b id_LZ, 2    ; Act 2
        dc.b id_SBZ, 0
        dc.b 0, 0    ; Act 3
        dc.b id_SBZ, 2    ; Scrap Brain Zone Act 3
    
        ; Marble Zone
        dc.b id_MZ, 1    ; Act 1
        dc.b id_MZ, 2    ; Act 2
        dc.b id_LZ, 0    ; Act 3
        dc.b 0, 0
    
        ; Star Light Zone
        dc.b id_SLZ, 1    ; Act 1
        dc.b id_SLZ, 2    ; Act 2
        dc.b id_SYZ, 0    ; Act 3
        dc.b 0, 0
    
        ; Spring Yard Zone
        dc.b id_SYZ, 1    ; Act 1
        dc.b id_SYZ, 2    ; Act 2
        dc.b id_MZ, 0    ; Act 3
        dc.b 0, 0
    
        ; Scrap Brain Zone
        dc.b id_SBZ, 1    ; Act 1
        dc.b id_LZ, 3    ; Act 2
        dc.b id_LZ, 0    ; Final Zone
        dc.b 0, 0
        even
        zonewarning LevelOrder,8
    The new position is:
    1-GHZ
    2-SLZ
    3-SYZ
    4-MZ
    5-LZ
    6-SBZ
     
  8. Devon

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

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    In that case, it shouldn't have messed with the collision. Again, check to see if the collision files somehow corrupted.
     
  9. Angel X

    Angel X Well-Known Member Member

    Joined:
    Sep 15, 2017
    Messages:
    291
    Location:
    Italy
    I checked the file and it seems to be all right.
    Where should I check exactly?
    Forgive me for my too many questions:confused:
    EDIT:I don't think I've ever been so active in this forum!
     
  10. Psi

    Psi Well-Known Member Member

    Joined:
    Dec 20, 2014
    Messages:
    102
    Hey I've been trying to convert Hill Top Zone to split screen mode and I've gotten a fair way (see Random Hacks/Mini Projects thread) however I now have three roadblocks:

    1. The far background conflicts with some VRAM data split screen needs to function. I can move the tiles for the background (in Dynamic_HTZ) but not what VRAM address the game projects for them. Any idea what I have to edit here?

    2. I've tried to edit the levevents routine to avoid the boss and end the level just beforehand with an improvised signpost (much in the same way the proper 2 player levevent routines do). While the race will progress normally as Tails, it glitches out if you finish Act Two as Sonic. When you get to the area where the screen locks, Tails' screen will glitch to there, and sometimes cause a Game Over. I'm guessing this is 1 player data conflicting with this but I have no idea where to edit. No matter where I put the data it causes the same issue.

    Code:
    ; ---------------------------------------------------------------------------
    loc_HTZ_2P2:
        move.w    #$2D80,(Camera_Max_X_pos).w
        move.w    #$2D80,(Tails_Max_X_pos).w
    
        rts
    3. One more glitch is some objects loading in twos or threes such as Rexon and the airlifts. This seems to be because their loading distance is too far and going back and forth with a couple players causes several to spawn. Is there any sort of branch that can recognise if one of the same object is already in the exact same location and to not load another while it's there?

    To exemplify, here is the test ROM:

    https://cdn.discordapp.com/attachments/202861068224036864/727999266127347712/s2built.bin

    EDIT: Never mind question 2. Fixed it.
     
    Last edited: Jul 4, 2020
  11. Angel X

    Angel X Well-Known Member Member

    Joined:
    Sep 15, 2017
    Messages:
    291
    Location:
    Italy
    PROBLEM SOLVED
    Basically I replaced the collide folder with another one from my old version.
    There will be updates soon ...
     
  12. Giovanni

    Giovanni It's Joe-vanni, not Geo-vanni. Member

    Joined:
    Apr 16, 2015
    Messages:
    311
    Location:
    Italy
    I've made a hack that, when you beat bosses, instead of having you press the capsule, takes you to the next level. The hack is built on ReadySonic, and no changes have been made to the sound driver or the songs. The problem is that if I get to the boss with Speed Shoes, the music will be significantly slowed down. I will provide the piece of code that has been edited, along with footage of the hack in question.

    Code:
    3D Boss - Green Hill Zone (part 2).asm
    
    loc_179DA:
            subq.w    #8,obVelY(a0)
    
    loc_179F6:                ; XREF: BGHZ_ShipIndex
                    jmp     Got_NextLevel
     
  13. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    When music ID from 81 to 93 are played, a byte is collected from the array starting from "byte_71A94", these bytes are the new tempos for when you collect speed shoes, the tempo of the tune is swapped out for the respective byte. The problem is, this array only holds tempos for 81 to 88 (the Zones, invincible, and the 1-up theme), 89 to 93 are still collected, but instead are collected from the values at "MusicIndex" onwards, GHZ's pointer in the default Sonic 1 ROM is 000745DC, followed by LZ's which is 00074D44, followed by MZ's which is 00075194, etc, etc.

    So....

    When 89 is played, the byte 00 from GHZ's pointer is used as the tempo.
    When 8A is played, the byte 07 from GHZ's pointer is used as the tempo.
    When 8B is played, the byte 45 from GHZ's pointer is used as the tempo.
    When 8C is played, the byte DF from GHZ's pointer is used as the tempo.
    When 8D is played, the byte 00 from LZ's pointer is used as the tempo.
    When 8E is played, the byte 07 from LZ's pointer is used as the tempo.
    When 8F is played, the byte 4D from LZ's pointer is used as the tempo.
    When 90 is played, the byte 44 from LZ's pointer is used as the tempo.
    When 91 is played, the byte 00 from MZ's pointer is used as the tempo.
    When 92 is played, the byte 07 from MZ's pointer is used as the tempo.
    When 93 is played, the byte 51 from MZ's pointer is used as the tempo.

    Since you've reassembled the ROM, the data in the ROM is either larger or smaller and the music data is now in a different offset, and these pointers have now changed. The Boss theme 8C is not longer collecting DF, because the pointer has changed.

    The solution is to extend this array, and put the above bytes in there:
    Code:
    byte_71A94:	dc.b	$07,$72,$73,$26,$15,$08,$FF,$05,$00,$07,$45,$DC,$00,$07,$4D,$44,$00,$07,$51
    		even
    The above will ensure that the tempos are exactly like the original (even if they are purely accidental), but you can modify them any which way you want at least.
     
    Giovanni and ProjectFM like this.
  14. Inferno

    Inferno Rom Hacker Member

    Joined:
    Oct 27, 2015
    Messages:
    132
    Location:
    Sky Base Zone, South Island
    This might come off as begging, but, could anyone provide me any pointers as to how I could allow for the Sonic 2 level layout format (which S1 Project 128 uses) to have a larger level size limit (it's static size is the same as S1's max)? If I'd need to transfer over to another level layout format, that's fine. I really don't want to scrap my level plans.
     
    Last edited: Jul 14, 2020
  15. Giovanni

    Giovanni It's Joe-vanni, not Geo-vanni. Member

    Joined:
    Apr 16, 2015
    Messages:
    311
    Location:
    Italy
    Interesting how, without even declaring a proper tempo for 8C, they got a perfectly fine tempo in the final release.

    Thanks for your help, Markey!
     
  16. RandomName

    RandomName Newcomer Member

    Joined:
    Jun 3, 2020
    Messages:
    21
    Location:
    Russia
    How to add custom level data formats(object format, layout format, etc.) in sonLVL(editing source code or creating external program)? If via editing source code, then which classes are responsible for level data formats?
     
  17. Devon

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

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    @RandomName
    You can load custom level, object, and ring layout loaders in the SonLVL INI.

    For level layouts, you add this:
    Code:
    layoutfmt=Custom
    layoutcodefile=[PATH TO FILE]
    layoutcodetype=[NAMESPACE].[CLASS]
    With object layouts, it's the same deal, but with "objectfmt", "objectcodefile", and "objectcodetype". With ring layouts, "ringfmt", "ringcodefile", and "ringcodetype".

    You can find out how a layout is loaded by looking at the game specific ones here.

    In the case of Sonic 1, the layoutcodetype parameter in the INI would look like:
    Code:
    layoutcodetype=SonicRetro.SonLVL.API.S1.Layout
    @Inferno
    The game is hardcoded to handle the size that is has, so to change it, you'll need to edit the game code. Particularly, the areas where it references a chunk from the layout data. Take a look at LZWaterSlides, sub_6BD6, Sonic_Loops, and Floor_ChkTile.

    Basically, you'll wanna change the calculations to better fit the new size, and also make sure to fix the layout data to have those new sizes. Luckily, with Project 1 Two Eight, the layouts are stored in ROM instead of RAM (Sonic 2 decompresses the layouts into RAM), so you don't have to worry about RAM space, though, ROM space is still an issue to keep note of, of course.

    As for a better layout format for your needs, you may wanna take a look at Sonic 3's. What that layout format does is supply a list of pointers (which are unfortunately pretty much hardcoded to be at the level layout RAM) to each row of chunks at the start of the layout data, and with that, you can easily have a dynamic width and height per level. If you wanna look into porting that over, take a look at GetFloorPosition_FG, and then applying the game's logic for referencing a chunk at the same places as in Project 1 Two Eight, and maybe Load_Level if you want to know how Sonic 3 loads a layout.

    If you want to keep your layouts in ROM, but don't wanna bother with changing up the format a little, a quick hack would be to take the chunk row pointer you get from the list, subtracting $8000 (level layout RAM in Sonic 3 is at $FF8000, and each chunk row pointer is stored as a signed word), and then adding the base address of the layout data. Otherwise, you may wanna set up a custom layout loader like I mentioned above.
     
    Last edited: Jul 14, 2020
  18. Giovanni

    Giovanni It's Joe-vanni, not Geo-vanni. Member

    Joined:
    Apr 16, 2015
    Messages:
    311
    Location:
    Italy
    I have found 2 bugs.
    1) The Credits screen's top row shows garbage blocks
    2) LZ's demo now spawns Sonic at 0,0

    This time, however, I made changes to the Credits. More specifically, I added the "V" to the Credits art and mappings, and made it so the game doesn't check for Chaos Emeralds to display "End" at the end of the credits.
    Does anyone know how what could have caused this?

    This ROM is built on ReadySonic, and, while I used a cheat code to reach the credits, the glitches still happen even if I beat the game legitimately.

    Also note that I plan on adding more art to the Credits.
     
    Last edited: Jul 15, 2020
  19. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    The credits glitch is caused by the extra letter you've added. The font graphics fit perfectly in VRAM from B400 to BFFF, while plane A is indexed to C000 - CFFF, any extra tiles added to the font will spill over into plane A, and while you can display it as tile graphics, the VDP is also interpreting the pixels as tile mappings.

    Relocate the credits font to B000, you should have no repercussions in doing that.

    As for the LZ demo spawning at 0 x 0, I'm afraid there is not enough information to theorise the problem, you'll need to tell us more about what you might have done.
     
    Giovanni and Pacca like this.
  20. Tanman Tanner

    Tanman Tanner Well-Known Member Member

    Joined:
    Dec 23, 2016
    Messages:
    116
    Location:
    Buffalo, New York
    This might be a silly answer to the problem that might not fix anything, but did you adjust the position of the demo Sonic's spawn location in LZ via SonLVL or another level editor? Did you possibly delete the object? I'd assume it could default to the position 0,0 if the object was deleted when you were adjusting the act itself.