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:
    48
    Location:
    Buffalo, New York
    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. Pacca

    Pacca Level 1 inflatable otter thing Member

    Joined:
    Jul 5, 2014
    Messages:
    1,128
    Location:
    The Moon (again)
    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 Well-Known Member Member

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

    Tanner I play video games and do computer stuff! Member

    Joined:
    Dec 23, 2016
    Messages:
    48
    Location:
    Buffalo, New York
    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
  5. Pacca

    Pacca Level 1 inflatable otter thing Member

    Joined:
    Jul 5, 2014
    Messages:
    1,128
    Location:
    The Moon (again)
    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:
    838
    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:
    48
    Location:
    Buffalo, New York
    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:
    48
    Location:
    Buffalo, New York
    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:
    48
    Location:
    Buffalo, New York
    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 Well-Known Member Member

    Joined:
    Aug 26, 2013
    Messages:
    858
    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
    Natsumi, Tanner and TheInvisibleSun like this.
  12. TheCatman21

    TheCatman21 Newcomer Trialist

    Joined:
    Mar 15, 2017
    Messages:
    5
    I'm attempting to make a Mighty in Sonic 2 hack. In my hacking endeavors, I have added most of Mighty's sprites. However, I want to add Ray the Flying Squirrel over Tails. How would I be able to allow Ray to either run his own palette or use the secondary palette line?

    I don't want everything handed to me so just point me in the right direction.

    Also, I'm thinking about removing the Tails' tails object as well but I'm not entirely sure where to begin.
     
    Last edited: Aug 17, 2018
  13. Pacca

    Pacca Level 1 inflatable otter thing Member

    Joined:
    Jul 5, 2014
    Messages:
    1,128
    Location:
    The Moon (again)
    For starters, if you want Ray to use a unique palette (instead of using the same one as Mighty), you'll have to make him unable to follow Mighty in Sonic + Tails fashion, as neither can be on the same screen with the correct palette if they both need unique palettes. Furthermore, Using Palette Line 2 isn't exactly the best option either; it's loaded differently in every level, and is reserved for badniks and bosses.

    I'd recommend first trying to make his artwork use the existing palette line previously used by Sonic and Tails. At the end of it are two orange colors, which can be shifted into other shades of orange/tan/yellow without affecting the games artwork all that much. You might have to make some sacrifices to make it work (assuming Mighty is using all four of Sonics' blues, you might have to make Rays shoes red), and use some workarounds (Tails abuses the tan skin colors and the dark reds to give his art extra shading), but it could be possible.

    As for loading an alternate palette line, the main character palettes are loaded by the two lines after "Level_LoadPal:". Try adding another entry to PalPointers which points to your new palette file, and then adding more code to Level_LoadPal to check which character your playing as. From there, you could make it load a different palette depending on which character you've chosen.
     
  14. TheCatman21

    TheCatman21 Newcomer Trialist

    Joined:
    Mar 15, 2017
    Messages:
    5
    Ok I have started adjusting the palette for Ray to use Mighty's palette.
    This is what I have so far. ray.png
     
  15. Pacca

    Pacca Level 1 inflatable otter thing Member

    Joined:
    Jul 5, 2014
    Messages:
    1,128
    Location:
    The Moon (again)
    Is it possible to cut a priority DAC sample before it finishes in the Clone Driver V2? I have a DAC sound effect that's supposed to cut when the player releases a button, but there doesn't appear to be any way for me to do that, as far as I can see. Playing another priority DAC effect does nothing, and as far as I can tell, there doesn't seem to be a special value to cut the currently playing DAC; invalid DAC samples below $80 are exactly that, and just crash the PCM driver.
     
  16. Clownacy

    Clownacy Grumpy Staff

    Joined:
    Aug 15, 2014
    Messages:
    848
    Sending $80 to Mega PCM should cause it to stop the current sample. Sending anything below $80 pauses it - you unpause by sending a $00 afterwards.
     
    Pacca likes this.
  17. Tanner

    Tanner I play video games and do computer stuff! Member

    Joined:
    Dec 23, 2016
    Messages:
    48
    Location:
    Buffalo, New York
    I got a new question regarding Sonic 3 & Knuckles, now that I patched Blue Knuckles up.
    I want Blue Knuckles to go to Sonic's SSZ instead of Knuckles' SSZ.
    Now, what would I be looking at, would I be making a new label that checks to see if the player is 4 then branching it off to make him go to Sonic's SSZ, or does a label similar to what I'm talking about exists?
     
    Last edited: Aug 28, 2018
  18. Renegade

    Renegade RuthlessTheHooman Member

    Joined:
    Nov 20, 2016
    Messages:
    68
    Location:
    New York Desert
    I've been messing around with porting objects to Sonic 1, and I decided to try porting those point block things from Casino Night. (You touch them and they go from green to yellow to red.)

    Anyway, I updated the Object Pointers to have four more pointers, Obj8D, (The object I ported) Obj8E, Obj8F and Obj90.

    It went fine, but I try to put the object in SonLVL and it becomes a Signpost. (Obj0D)
    I tried to add it with debug mode but to no avail.

    What I'm asking is, how do I get the object to spawn in-game? I really want to start adding more objects to my hacks, and this was a good way to start. But without results I can't figure out if I'm porting things right or not.
    Thanks in advance.
     
  19. Novedicus

    Novedicus Well-Known Member Member

    Joined:
    Aug 26, 2013
    Messages:
    858
    In Sonic 1, level objects can only use IDs 01-7F. The most significant bit is used for a flag when loading objects in a level. If the flag is set, the object is assigned an entry in the "object respawn table", which is used to store and reload values for when objects despawn and respawn (primarily used to mark an object as "gone" to ensure it deletes itself if the game tries to load it if it was already destroyed before). If I recall, in Sonic 2 and 3K, they don't have that flag and just go assign an entry for every object anyways.

    As for a solution, the easiest would be to use an unused object ID below $80. But, if you end up running out of slots still, it may be worth seeing into removing that flag, or even doing something hackish like utilizing subtypes in other objects.
     
    Last edited: Sep 1, 2018
    MainMemory likes this.
  20. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    742
    Location:
    Portland, Maine
    You can also reassign objects that are normally spawned by level events and enemies such as boss objects and projectiles and reassign them to slots $80 or higher, then put your new objects in their place.
     
    MainMemory and Novedicus like this.