Basic Questions and Answers Thread

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

  1. Tanner

    Tanner I play video games and do computer stuff! Member

    Joined:
    Dec 23, 2016
    Messages:
    34
    Hey guys, been a few weeks since I've asked a question, and I got one dedicated for those who are Sonic 2 SMS ROM Hackers.
    I'm trying to alter the invincibility label to show instead of stars, make Sonic appear like Super Sonic. By that, I mean temporarily giving him the Super Sonic Palette, then once it's done, return to the blue blur Sonic. My problem is I can't figure out for the life of me what is the label that let's me do that.
    Here's my unfinished code for it:
    Code:
    Collision_Monitor_Invincibility:        ; $4866
        res   3, (hl)
        ld    a, Music_Invincibility
        ld    (Sound_MusicTrigger1), a
        ld    a, $02          ;power-up type = invincibility
        ld    (Player.PowerUp), a
        ld    hl, $0000
        ld    (Engine_PowerUpTimer), hl     ;timer
        ld    c, Super_Sonic ;summon the power of super
        ld    h, $00
    
    Super_Sonic: ;to-do
    I'm also not sure if ld c, Super_Sonic would be right if I'm trying to change Sonic's palette, because ld c, anything (from what I've seen in the disassembly) is for mounting sprites/objects to the player (such as invincibility stars).
     
    Last edited: Aug 8, 2018
  2. Pacguy

    Pacguy :3 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,092
    Location:
    Twinleaf Town
    Typically, when I run into a scenario like that, where I don't know where something is, I try to back track from what I do know. Presumably, you already know how to edit Sonics' palettes? If that's the case, just find where they're referenced in the disassembly, and then see where the name they're under is referenced.

    To use 16 bit Sonic 2 as an example, Sonics' pallete file in that disassembly is named "SonicAndTails.bin". Searching for that in the assembly brings up "Pal_BGND", which is referenced in a list by the name of "PalPointers". Searching up that name brings up a bunch of routines related solely to loading palettes, and I can find where they're referenced to get examples of how to use them.

    Admittedly, this method isn't perfect (in this case, the palettes are loaded using index numbers, which could be confusing in a weakly documented disassembly, and with weak names like "loc_XXXX" and widely referenced labels, things can get confusing), but it's worked quite well for me thus far, and should at least set you off in the right direction.


    And for a question of my own; what image importing options are their for plane mappings? Of the editors I know of, they aren't quite what I need. Planeed has no option for it what so ever, and RetroGraphicsToolkit insists on adding artifacts to straight forward pixelated images, even to areas that are nothing but one solid color.
     
    Last edited: Aug 8, 2018
  3. Novedicus

    Novedicus Some say that Heaven is Hell Member

    Joined:
    Aug 26, 2013
    Messages:
    810
    @Pacguy I use MainMemory's GetArt.NET to convert an image to plane mappings.
     
    Pacguy likes this.
  4. Tanner

    Tanner I play video games and do computer stuff! Member

    Joined:
    Dec 23, 2016
    Messages:
    34
    I'm back with a brand new problem. I got no luck, do I?

    Previously, the loops worked with no problem. Then I believe I altered something that had nothing to do with the loops nor Sonic's positioning, and this started showing up.
    The loops work, but it's basically bugged in how Sonic enters and exits it, similar to how it was in the Sonic 2 Autodemo.
    Because of the problem from yesterday and this new problem, I decided to open up a GitHub repo for anyone who wishes to see the code itself in an attempt to fix it.
    It's probably a small mistake that caused this, but like I usually say, "I have no idea what is causing it".
    https://github.com/TannerGhosen/s3t
    Feel free to make a pull request if you found the problem, and I'll approve it and download the solution.

    Problem Solved, it's called Version 1.1 is good enough for a begineer.
     
    Last edited: Aug 10, 2018 at 1:34 AM
  5. Pacguy

    Pacguy :3 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,092
    Location:
    Twinleaf Town
    I know it's a little late now, but using a git repository from the start is a great way to track down and examine annoying little issues like this. Being able to find the exact few changes that caused the problem can make things much easier.

    That said, I recently dealt with a similar issue that was difficult to track down. I ended up using ExamDiff to compare my disassembly to a vanilla one, and reverting every major change one at a time until the behavior was altered or fixed. Feel free to check out the answers to my previous question if you want other options for finding changes.
     
  6. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    806
    Git Bisect is the best tool for finding errors that were introduced during development. Everyone should learn how to use it.
     
    AkumaYin likes this.
  7. Tanner

    Tanner I play video games and do computer stuff! Member

    Joined:
    Dec 23, 2016
    Messages:
    34
    Yeah, I think I'll do that from now on.
     
  8. Tanner

    Tanner I play video games and do computer stuff! Member

    Joined:
    Dec 23, 2016
    Messages:
    34
    Hey guys, I got a question regarding the Sonic 3 & Knuckles disasm.
    What's the label(s) that handles the killzones for like Sonic going into Knuckles' area, and Knuckles going into Sonic's area?
    Why you might ask?
    Well I made Blue Knuckles into a character, BUT... the problem is he's technically Sonic, and Sonic can't go into Knuckles' area.
    I'm not positive if the same label(s) that handles the killzone for Sonic in Knuckles' area is the same as the one that handles Knuckles in Sonic's area, but if there two different labels, I'd like both of the names so I can just remove them (because who cares if you bother using debug to enter those areas anyhow).
     
  9. Tanner

    Tanner I play video games and do computer stuff! Member

    Joined:
    Dec 23, 2016
    Messages:
    34
    For once, I'm gonna be providing help instead of asking for it, since I've found the solution to a problem I had lately.
    For those who tried to use the SSRG Splash Screens with the most recent version of the Sonic & Knuckles Github Disassembly provided by our brother site SonicRetro, I have created a work around for those who are still making Sonic & Knuckles ROM Hacks and want to represent SSRG proud.
    The workaround is in this Gist.
    The only small issue is that this causes the demos that play to act goofy (as in, it doesn't appear like a proper player is playing it). I have yet to figure out why it happens, but it's not a severe problem for those who alter the levels of Sonic & Knuckles anyhow.
     
  10. Novedicus

    Novedicus Some say that Heaven is Hell Member

    Joined:
    Aug 26, 2013
    Messages:
    810
    In the original code, it does this:
    Code:
    Sega_Screen:
           move.b   #$54,(Game_mode).w
           rts
    
    Therefore, calling the splash screen.

    However, I do prefer how you did it, since the SEGA screen code is in the title screen code in S3K, therefore, making Sega_Screen pretty much useless to begin with. So, kudos to you on that.
     
  11. Painto

    Painto Samodzierżca Najdłuższego Kija Member

    Joined:
    Mar 24, 2014
    Messages:
    314
    Location:
    Poland
    In Sonic 3 & Knuckles there are 2 ways the game recognizes the character. They're mostly equally set, but used diferently. First one is character object specific. A byte in character's object RAM ($38(a0)) is set to either #0, #1 or #2 (respectively Sonic, Tails, Knuckles). These mostly are used for character specific actions, like for example breaking walls. Knuckles and Blue Knuckles use the same object so it isn't revelant here.
    There's also the second one, a RAM variable Player_mode and it's actually used for rest gameplay aspects, such as events, transformations palette cycles, start locations, etc. Like the other one is set to #0 (Sonic+Tails), #1 (Sonic only), #2 (Tails only) but also #3 (Knuckles) and, in this case, to #4 (Blue Knuckles). In the code, there are various checks like this one
    Code:
    cmpi.w    #3,(Player_mode).w
    Followed by a conditional branch, either beq.x or bne.x. Because of that it does things for Knuckles only if the value is exactly #3. Basically, in every place you want Blue Knuckles to have the same events as Knuckles, you change the beq to bge and bne to blt so it will perform these actions also then the value is bigger, like #4, #5, etc.

    The one you're looking for is located in Angel Island's Act 2 dynamic resizing. Technically, the "killzone" is under the bottom boundary, which results in instakill. There's loc_1C64E:, which depending on the Player_mode sets the correct resizes. As mentioned before, you should change the bne to blt. After that it should work like you want.
     
    Last edited: Aug 13, 2018 at 10:48 PM
    Natsumi, Tanner and TheInvisibleSun like this.