don't click here

Basic Questions & Answers thread

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

  1. flamewing

    flamewing

    Emerald Hunter Tech Member
    1,161
    65
    28
    France
    Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
    The insta-shield makes Sonic's radius a bit bigger and makes Sonic invincible for collisions with badniks and projectiles.
     
  2. E-122-Psi

    E-122-Psi

    Member
    2,470
    612
    93
    Okay tried out the fixes.

    1. The hammer fix works just fine, thanks. :D

    2. The shield edit works, however the animations for double jump moves still play when double tapping. I'm guessing these play instead of the insta shield due to the elemental ones overwriting it, something I really should have thought of in hindsight. Would it maybe be more ethical to just uncomment the shield coding's bsr completely so as to work like Tails and Knuckles, and make a radius change from scratch like I did for the previous games?

    3. I've been getting an odd asm error. I've been trying to edit the ICZIceCube data to react to other animations and flags however I keep getting this error whenever I try it:

    >>>sonic3k.asm(198479): error: addressing mode not allowed on 68000
    >>> jmp Child_DrawTouch_Sprite(pc)
    >>>sonic3k.asm(198479): error: addressing mode not allowed here
    >>> jmp Child_DrawTouch_Sprite(pc)

    4. Does anyone know where the coding for the upside down Egg Capsules are, unlike the normal ones they can only be activated in spin animations so I'll need to edit that, but I can't find the obj data anywhere.
     
  3. Try getting rid of the (pc)
     
  4. Tiddles

    Tiddles

    Diamond Dust Tech Member
    471
    0
    0
    Leicester, England
    Get in an accident and wake up in 1973
    Yeah, sorry if I didn't make that clear - the shield art/map/DPLC will replace where the instashield would normally go, and just activating the animation won't switch to Insta. Sonic actually has an instashield object at all times where another shield ins't present to manage the animation and PLC.

    My solution for the classic shield was to override its call to Animate_Sprite and set up some custom code to swap in the instashield anim/DPLC when necessary, and then swap back. The solution ended up looking particularly ugly though.

    Both types are controlled by Obj_81, but I couldn't see at a glance how it decides which kind appears.
     
  5. E-122-Psi

    E-122-Psi

    Member
    2,470
    612
    93
    Yeah that doesn't sound the most effecient. Okay, screw it then. Is there a way to turn off the double jump shield stuff altogether to work like Tails and Knuckles? I tried uncommenting the bsrs of the insta shield coding but for some reason it took away the press sensitivity to the player's jump height.

    By the way, as I've been programming I've came to this strange glitch. When I enter Mushroom Hill or Carnival Night as Sonic alone, there is no Tails, he just falls into the level. Even stranger, when I select Tails, he appears with a second version of himself flying him in. This doesn't occur for Sonic and Tails mode nor do problems occur it for other Tails appearances like the Marble Garden boss. My guess is I've edited a bit of coding for player recognition for the intros, but I can't backtrack what I've done anywhere. Any idea where the coding is for player recognition for the level intros is so I can try find it? (If it exists for other levels too this would be useful as I want Amy to load with Tails route in some other levels like Angel Island and Icecap).
     
  6. Tiddles

    Tiddles

    Diamond Dust Tech Member
    471
    0
    0
    Leicester, England
    Get in an accident and wake up in 1973
    It's efficient enough, it's just horrible to read and work with because of all the weird edge cases. :)
    It also results in the instashield graphics replacing the main shield rather than overlaying it because of the shared VRAM. As it happens, that works pretty well with the classic shield. I don't know that it would with the elementals.

    If you want to stop the shields from running their animations, within the double-jump code we were tweaking before, look for any lines that set $FFFFCD08. From the shield's point of view this is $20(a0), I.e. it sets the animation. That should keep them from kicking up rough.

    As for the CNZ/MHZ error, I managed to recreate this by changing the line at loc_68D8 from
    Code (Text):
    1. cmpi.w  #1,(Player_mode).w
    to
    Code (Text):
    1. cmpi.w  #2,(Player_mode).w
    .
    So you probably want to change that back to #1 if it's set differently.
     
  7. E-122-Psi

    E-122-Psi

    Member
    2,470
    612
    93
    Yep, it's me again...

    Those fixes have been placed in and work fine. Thanks again...but I've managed to screw up again *shot*

    Recently I've been editing the spring mechanics, and now for some reason all the forward and diagonal springs have disappeared in game. Any idea why this has happened?

    EDIT: Never mind, Fixed it. I must have been using a flag used in the spring data for the hammer recognition that cancelled them out.
     
  8. I bet you guys get this quite a lot, but I searched 'freeze', 'not responding', and 'lock up' with no luck.

    I can't open up any levels to edit in SonED2. I ran the split txt file on my clean Sonic 2 ROM, but when I try and open up a level in the Project folder, nothing happens. SonED2 just freezes and goes all [not responding] when I click on it.

    I have Windows 7 Ultimate 64-bit with 2.00 GB of RAM, if that helps any.
     
  9. RetroKoH

    RetroKoH

    Member
    1,662
    22
    18
    Project Sonic 8x16
    Ok... I got bored, and wanted to take a hiatus from my fangame. So I took up learning hacking... and I decided, I wanted to learn how to hex edit, and learn the ins and outs of how it works. I am picking things up just fine, all is well. It's a LOT easier than it looks once you give it a try.

    SO, I am, to some people's knowledge, writing my own hex editor program using GML, that is meant to be used to hack Sonic 1-3K. I've only been at it for a week, and already I have an early palette editor that works perfectly. ROM tested... everything. (I'm not giving it out to everyone... only some select people to test for bugs for me. I will publicly release a more complete editor later on) Things are going good. Now I want to expand this to tile editing (I'm taking baby steps...) NOW, I understand how to edit uncompressed art... That is easy enough... each 8x8 tile being 1 nybble, and each nybble's value is equal to a position on the palette line... I get that.

    The part I am having trouble with now, is editing the zone art. You know... those bits of art that get put together into 16x16 blocks, and placed into 128x128 (or 256x256 for Sonic's 1 & CD) metatiles. I'm having trouble, because it is compressed. I am aware of what Nemesis compression is... but I don't know EXACTLY how to work around it... So, my question is...

    Can I find someone who could teach me how to hex edit the compressed art? (OR just PM me with a direction to a tutorial of sorts.) I've looked this up on SEGA Retro... and I still feel stumped. Basically I'm looking for a tutor OR tutorial.

    Any help is appreciated.
     
  10. flamewing

    flamewing

    Emerald Hunter Tech Member
    1,161
    65
    28
    France
    Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
    The best way to edit compressed art is: decompress, edit uncompressed, recompress. All other ways lead to madness; particularly since Nemesis format compresses sequences of nibbles into sequences of bits.
     
  11. Blastfrog

    Blastfrog

    See ya starside. Member
    I don't want to stay terrible at ASM, I want to learn and improve so I can do things on my own, so if you answer the following, please explain what is happening in the code and how to better navigate it instead of just doing it for me. I understand how ASM itself works, it's just the Sonic engine itself I'm not too familiar with.

    What's the best way to make the player only lose 20 rings when they're hit in the 2007 disassembly of S2? (Don't question the game design choice, I'm repurposing the rings) I've looked at the code, and being ASM illiterate for the most part, am not sure what to do.

    HurtCharacter:
    move.w (Ring_count).w,d0
    cmpa.w #MainCharacter,a0
    beq.s loc_3F88C
    tst.w (Two_player_mode).w
    beq.s Hurt_Sidekick
    move.w (Ring_count_2P).w,d0

    What is the line highlighted in red doing? If I'm interpreting it correctly, I assume that this is doing something like telling the HUD to update how many rings it says you have, due to the order the Ring_count and the number appear in (why would a RAM address be this short though? aren't they usually a bit longer?). If that's the case, then where is the code that clears the ring count?


    Also, could I have an explanation of how the HurtCharacter routine works in general? Like, a description of what each line does or something. Thanks.
     
  12. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    It's storing the number of rings, which is contained in Ring_Count into d0. This is used later in the next part of the code that test for d0, in which either loads the rings or kills sonic.

    Code (Text):
    1. ; loc_3F878:
    2. HurtSonic:
    3.         move.w  (Ring_count).w,d0       ; Move/Store the Ring_count into d0
    4.     cmpa.w  #MainCharacter,a0       ; Is this Sonic?
    5.     beq.s   loc_3F88C               ; If yes, continue to loc_3F88C
    6.     tst.w   (Two_player_mode).w     ; Test if this is 2P mode
    7.     beq.s   Hurt_Sidekick           ; If yes, continue to the routine that handles Tails getting hurt
    8.     move.w  (Ring_count_2P).w,d0    ; Move/Store Ring_count_2P into d0
    9.  
    10. loc_3F88C:
    11.     btst    #0,status_secondary(a0) ; Does Sonic have a shield?
    12.     bne.s   Hurt_Shield             ; if he does, continue to the routine that handles getting hurt with a shield on
    13.     tst.w   d0                      ; Does Sonic have any rings?
    14.     beq.w   KillCharacter           ; If not, Kill him!
    15.     jsr (SingleObjLoad).l       ; Run SingleObjLoad
    16.     bne.s   Hurt_Shield
    17.     _move.b #$37,0(a1)              ; load the scattering ringsobj
    18.     move.w  x_pos(a0),x_pos(a1)     ; match the loading x_pos of the object to Sonic's
    19.     move.w  y_pos(a0),y_pos(a1)     ; match the loading y_pos of the object to Sonic's
    20.     move.w  a0,parent(a1)
    I quickly commented that little bit. Hope it helps a little.


    Edit: I suppose if you wanted to make the scattering rings ALWAYS spawn 20, you could go to Obj_37_sub_0 and add
    move.w $14,(Ring_count).w

    right underneath it.
     
  13. Aerosol

    Aerosol

    Not here. Moderator
    11,163
    573
    93
    Not where I want to be.
    Sonic (?): Coming summer of 2055...?
    Here's a general 68k asm question.

    Logic statements always fuck me up. How does one go about making decisions with asm? "If x = y, do z" sort of things.
     
  14. Ravenfreak

    Ravenfreak

    2 Edgy 4 U Tech Member
    3,077
    176
    43
    O'Fallon Mo
    Sonic 1 Game Gear Disassembly
    In 68k assembler, this is what an if else statement could look like : (note this code is from Sonic & Knuckles' Spindash routine in the latest S3k disassembly, and yes they share that code. :v:)
    Code (ASM):
    1. move.b  (Ctrl_1_pressed_logical).w,d0 ; get joypad 1's input
    2.         andi.b  #$70,d0                       ; was either A,B,orC pressed? (If a,b,c was pressed)
    3.         beq.w   locret_11C5C                  ; if not, skip over this step  (else branch)
    4.         move.b  #9,$20(a0)                    ; otherwise play Spindash animation (do Spindash)
    5.                 move.w  #$FFAB,d0
    6.         jsr (Play_Sound_2).l                   ; play revved up sfx
    I hope this helps a bit. :)
     
  15. Aerosol

    Aerosol

    Not here. Moderator
    11,163
    573
    93
    Not where I want to be.
    Sonic (?): Coming summer of 2055...?
    I see. andi.b sets the Z bit to clear. If it doesn't set the Z bit to clear, then beq.w picks that up and branches to locret_11C5C. I don't understand which conditions andi.b would clear the Z bit under, though. The 68000 instruction set PDF I'm reading doesn't make that clear, exactly.

    edit: I've been skipping words in my sentences all day today. Goddamn.

    edit2: I think I understand. the result of andi.b would be 0000 0000 if not a single button was pressed. That's what clears the Z bit of the CCR, right? Similarly, if the result of andi.w was 0000 0000 0000 0000, the Z bit of the CCR would clear. But if it was something like 0000 0000 0001 0000, the Z bit would be set, and beq.w would be ignored, since the Z bit was set.

    Is my understanding flawed?

    edit3: Okay I get it, I totally get it. Is there a reason why this isn't done, however?

    andi.b #$70,d0
    bne.w (label where the spindash code is)
    [continue from locret_11C5C]
     
  16. I bet you guys get this quite a lot, but I searched 'freeze', 'open', 'not responding', and 'lock up' with no luck.

    I can't open up any levels to edit in SonED2. I ran the split txt file on my clean Sonic 2 ROM, but when I try and open up a level in the Project folder, nothing happens. SonED2 just freezes and goes all [not responding] when I click on it.

    I have Windows 7 Ultimate 64-bit with 2.00 GB of RAM, if that helps any.
     
  17. Knucklez

    Knucklez

    I love 2B 'n' ass. Member
    687
    21
    18
    I'm sure we do, especially when you post the same exact post you did a week ago..
     
  18. Aerosol

    Aerosol

    Not here. Moderator
    11,163
    573
    93
    Not where I want to be.
    Sonic (?): Coming summer of 2055...?
    Well, this topic doesn't get a lot of posts in it, even when tech members pop in. I guess he just figured that nobody saw it yet.
     
  19. Ravenfreak

    Ravenfreak

    2 Edgy 4 U Tech Member
    3,077
    176
    43
    O'Fallon Mo
    Sonic 1 Game Gear Disassembly
    Because then it would branch to locret_11C5C (which contains just a rts), and the next part of the code handles revving up the spindash. So it'd mess up the spindash code, and the player wouldn't be able to charge the spindash.
     
  20. Aerosol

    Aerosol

    Not here. Moderator
    11,163
    573
    93
    Not where I want to be.
    Sonic (?): Coming summer of 2055...?
    I see. I guess there is a way to rearrange all of the spindash code so that you can test to see if one of the buttons IS being pressed with bne rather than testing to see if they aren't being pressed with beq, but it was a lot simpler for them to test with beq and code the spindash that way, right?