don't click here

Basic Questions & Answers thread

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

  1. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,742
    338
    63
    SonLVL
    No, we can't help you without more information on exactly what you did, and possibly the code for those objects. But it looks like you're all out of posts now, so we can't help you anyway.
     
  2. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,613
    418
    63
    ALWAYS Sonic the Fighters
    I feel this is a dumb question but what determines animal type and direction in Sonic 1 when an enemy is destroyed at the code level? When do they disappear offscreen as well? Merely satisfying my own curiosity than interest in a hack by the way.
     
  3. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,742
    338
    63
    SonLVL
    In the code for the animal object, there is a table of indexes, with two per zone:
    Anml_VarIndex: dc.b 0, 5, 2, 3, 6, 3, 4, 5, 4, 1, 0, 1
    The game will randomly pick one of the two entries for the zone, and use that index to reference a table containing speeds and mappings:
    Code (Text):
    1. Anml_Variables: dc.w $FE00, $FC00
    2.         dc.l Map_Animal1
    3.         dc.w $FE00, $FD00   ; horizontal speed, vertical speed
    4.         dc.l Map_Animal2    ; mappings address
    5.         dc.w $FE80, $FD00
    6.         dc.l Map_Animal1
    7.         dc.w $FEC0, $FE80
    8.         dc.l Map_Animal2
    9.         dc.w $FE40, $FD00
    10.         dc.l Map_Animal3
    11.         dc.w $FD00, $FC00
    12.         dc.l Map_Animal2
    13.         dc.w $FD80, $FC80
    14.         dc.l Map_Animal3
    When the animal hits the ground for the first time, it checks bit 4 of the global frame counter, and if it's set, it negates the horizontal speed of the object.

    The art tiles used for animals in each level is determined by the level's Pattern Load Cue list.
     
  4. biggestsonicfan

    biggestsonicfan

    Model2wannaB Tech Member
    1,613
    418
    63
    ALWAYS Sonic the Fighters
    My inner Flickies are crying with happiness knowing what's in store when I finally *POOF*. Well explained, thank you for taking the time to elaborate on that for me.
     
  5. FrankyPants

    FrankyPants

    Member
    7
    0
    0
    Hello, I'm trying to add some light branding to a Sonic Mania level for my YouTube channel, and I'm having trouble finding places in the levels 16x16Tiles.gif palette for the extra colours I need for what I want to do. I think I might have found a few unused slots that all seem to be filled with black, but I want to make 100% sure that none of the level tiles are using those slots.

    Is anyone aware of any software I can use that will tell me exactly how many pixels in a gif use a particular reference in the colour palette?

    I've already figured out that lines 7 and 8 in the colour palette of 16x16Tiles.gif are safe to use for adding any extra colours I want to use that aren't already in GameConfig.bin, unless anyone else knows otherwise.

    Thanks!
     
  6. GavinHC

    GavinHC

    Member
    1
    0
    0
    Longwood, FL
    Currently working on a personal project
    Hello, everyone. Currently, I'm working on a personal ROM hack of Sonic 1 that I may release, yet I know barely anything besides bits and pieces that JoshWoakes has already helped me with, and things I've discovered myself. All I want to ask is: What is the best way to port music? I see recommendations of using xm2SMPS and other similar tools, but then I see others mentioning doing it by hand. I would appreciate thoughts.

    Apologies if anyone else has asked already.
     
  7. SonicoOurico

    SonicoOurico

    Member
    19
    0
    0
    I recently tried to make Tails carry Sonic as in Sonic 3.
    But I have 3 problems :(/>/>.
    1-Tails does not carry correctly Sonic
    2-The game crashes.
    3-Sonic and Tails do not display their animations.
    Here is the code:
    Tails_Carry_Sonic:
    tst.b (a2)
    beq.w loc_14534
    cmpi.b #4,routine(a1)
    bcc.w loc_14466
    btst #1,Status(a1)
    beq.w loc_1445A
    move.w ($FFFFF300).w,d1
    cmp.w x_vel(a1),d1
    bne.s loc_1445A
    move.w ($FFFFF400).w,d1
    cmp.w y_vel(a1),d1
    bne.s loc_14460
    tst.b obj_control(a1)
    bmi.s loc_1446A
    andi.b #$70,d0
    beq.w loc_14474
    clr.b obj_control(a1)
    clr.b (a2)
    move.b #$12,1(a2)
    andi.w #$F00,d0
    beq.w loc_14410
    move.b #$3C,1(a2)

    loc_14410: ; CODE XREF: Tails_Carry_Sonic+4Cj
    btst #$A,d0
    beq.s loc_1441C
    move.w #-$200,x_vel(a1)

    loc_1441C: ; CODE XREF: Tails_Carry_Sonic+5Aj
    btst #$B,d0
    beq.s loc_14428
    move.w #$200,x_vel(a1)

    loc_14428: ; CODE XREF: Tails_Carry_Sonic+66j
    move.w #-$380,y_vel(a1)
    bset #1,Status(a1)
    move.b #1,jumping(a1)
    move.b #$E,y_radius(a1)
    move.b #7,x_radius(a1)
    move.b #2,anim(a1)
    bset #2,Status(a1)
    bclr #4,Status(a1)
    rts
    ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

    loc_1445A: ; CODE XREF: Tails_Carry_Sonic+16j
    ; Tails_Carry_Sonic+22j
    move.w #-$100,y_vel(a1)

    loc_14460: ; CODE XREF: Tails_Carry_Sonic+2Cj
    move.b #0,jumping(a1)

    loc_14466: ; CODE XREF: Tails_Carry_Sonic+Cj
    clr.b obj_control(a1)

    loc_1446A: ; CODE XREF: Tails_Carry_Sonic+32j
    clr.b (a2)
    move.b #$3C,1(a2)
    rts
    ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

    loc_14474: ; CODE XREF: Tails_Carry_Sonic+38j
    move.w x_pos(a0),x_pos(a1)
    move.w y_pos(a0),y_pos(a1)
    addi.w #$1C,y_pos(a1)

    loc_14492: ; CODE XREF: Tails_Carry_Sonic+D0j
    andi.b #-4,render_flags(a1)
    andi.b #-2,Status(a1)
    move.b Status(a0),d0
    andi.b #1,d0
    or.b d0,render_flags(a1)
    or.b d0,Status(a1)

    loc_144BA: ; CODE XREF: Tails_Carry_Sonic+F8j
    subq.b #1,anim_frame_duration(a1)
    bpl.s loc_144F8
    move.b #$B,anim_frame_duration(a1)
    moveq #0,d1
    move.b anim_frame(a1),d1
    addq.b #1,anim_frame(a1)
    move.b byte_14522(pc,d1.w),d0
    cmpi.b #-1,d0
    bne.s loc_144E4
    move.b #0,anim_frame(a1)
    move.b byte_14522(pc),d0

    loc_144E4: ; CODE XREF: Tails_Carry_Sonic+11Ej
    move.b d0,mapping_frame(a1)
    moveq #0,d0
    move.b mapping_frame(a1),d0
    move.l a2,-(sp)
    jsr Tails_Carry_LoadPLC
    movea.l (sp)+,a2

    loc_144F8: ; CODE XREF: Tails_Carry_Sonic+104j
    move.w x_vel(a0),($FFFFB018).w
    move.w x_vel(a0),($FFFFF300).w
    move.w y_vel(a0),($FFFFB01A).w
    move.w y_vel(a0),($FFFFF400).w
    movem.l d0-a6,-(sp)
    lea (Maincharacter).w,a0
    bsr.w Sonic_DoLevelCollision
    movem.l (sp)+,d0-a6
    rts
    ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    byte_14522: dc.b $91 ; DATA XREF: Tails_Carry_Sonic+126t
    dc.b $91
    dc.b $90
    dc.b $90
    dc.b $90
    dc.b $90
    dc.b $90
    dc.b $90
    dc.b $92
    dc.b $92
    dc.b $92
    dc.b $92
    dc.b $92
    dc.b $92
    dc.b $91
    dc.b $91
    dc.b $FF
    dc.b 0
    ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

    loc_14534: ; CODE XREF: Tails_Carry_Sonic+2j
    tst.b 1(a2)
    beq.s loc_14542
    subq.b #1,1(a2)
    bne.w locret_1459C

    loc_14542: ; CODE XREF: Tails_Carry_Sonic+17Ej
    move.w x_pos(a1),d0
    sub.w x_pos(a0),d0
    addi.w #$10,d0
    cmpi.w #$20,d0
    bcc.w locret_1459C
    move.w y_pos(a1),d1
    sub.w y_pos(a0),d1
    subi.w #$20,d1

    loc_1456C: ; CODE XREF: Tails_Carry_Sonic+1ACj
    cmpi.w #$10,d1
    bcc.w locret_1459C
    tst.b obj_control(a1)
    bne.s locret_1459C
    cmpi.b #4,routine(a1)
    bcc.s locret_1459C
    tst.w (Debug_placement_mode).w
    bne.s locret_1459C
    tst.b Spindash_flag(a1)
    bne.s locret_1459C
    bsr.s sub_1459E
    moveq #$4A,d0
    jsr (Play_Sound_2).l
    move.b #1,(a2)

    locret_1459C: ; CODE XREF: Tails_Carry_Sonic+184j
    ; Tails_Carry_Sonic+198j ...
    rts
    ; End of function Tails_Carry_Sonic


    ; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ


    sub_1459E: ; CODE XREF: ROM:00013FEAp
    ; ROM:000140F6p ...
    clr.w x_vel(a1)
    clr.w y_vel(a1)
    clr.w inertia(a1)
    clr.w anim(a1)
    move.w x_pos(a0),x_pos(a1)
    move.w y_pos(a0),y_pos(a1)
    addi.w #$1C,y_pos(a1)
    move.w #$2200,anim(a1)
    move.b #0,anim_frame_duration(a1)
    move.b #0,anim_frame(a1)
    move.b #3,obj_control(a1)
    bset #1,Status(a1)
    bclr #4,Status(a1)
    move.b #0,spindash_flag(a1)
    andi.b #-4,render_flags(a1)
    andi.b #-2,Status(a1)
    move.b Status(a0),d0
    andi.b #1,d0
    or.b d0,render_flags(a1)
    or.b d0,Status(a1)
    move.w x_vel(a0),($FFFFF300).w
    move.w x_vel(a0),x_vel(a1)
    move.w y_vel(a0),($FFFFF400).w
    move.w y_vel(a0),y_vel(a1)
    eori.b #2,render_flags(a1)

    locret_14630: ; CODE XREF: sub_1459E+84j
    rts
    ; End of function sub_1459E
     
  8. Overlord

    Overlord

    Now playable in Smash Bros Ultimate Moderator
    19,239
    972
    93
    Long-term happiness
    Moved your seperate topic to the right place, collapsed the code down into a spoiler tag for readability.
     
  9. SonicoOurico

    SonicoOurico

    Member
    19
    0
    0
    I forgot to mention that the graphics are messed up and the game crashes
     
  10. Knucklez

    Knucklez

    I love 2B 'n' ass. Member
    687
    21
    18
    I figured I'd share this here since it may interest some people working on a simple S1 hack. I've never seen it addressed or mentioned by anyone.

    I've always been annoyed by the HUD being present in the GHZ end-of-game cutscene. So I figured out how to remove it to have a cleaner and more proper looking cutscene.

    Edit in sonic.asm of the current GitHub s1disasm:

    IN SECTION:

    Code (Text):
    1. End_LoadSonic:
    REMOVE THIS LINE OF CODE:

    Code (Text):
    1.         move.b  #id_HUD,(v_objspace+$40).w ; load HUD object
    That's it.
     
  11. Knucklez

    Knucklez

    I love 2B 'n' ass. Member
    687
    21
    18
    Is there a simple way to revert the HUD in S2K from italic to normal through the GitHub ktes2disasm? Like through the s2k.asm?
     
  12. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,742
    338
    63
    SonLVL
    The main HUD text and results text art are taken from the Sonic 2 ROM, so if you want to modify them, you'll have to repoint them to new art data in the KiS2 ROM. The HUD numbers start at byte_339946, you can replace all the dc.b statements with the files from Sonic 2. Then just edit the art in a tile editor.
     
  13. Knucklez

    Knucklez

    I love 2B 'n' ass. Member
    687
    21
    18
    Will do, thanks a lot. It's just an eyesore I've always wanted to fix on my own.
     
  14. SonicoOurico

    SonicoOurico

    Member
    19
    0
    0
    Does anyone know what I can do to fix the bug when Tails carry Sonic?
     
  15. SonicoOurico

    SonicoOurico

    Member
    19
    0
    0
    Sorry, actually I would send screenshots of the errors that are occurring.
    Here it is:
    [​IMG]
    [​IMG]
    In the first image the animation is not displayed, and in the second image the game crashes and colors change!
     
  16. Devon

    Devon

    I'm a loser, baby, so why don't you kill me? Tech Member
    1,248
    1,419
    93
    your mom
    What.
     
  17. Knucklez

    Knucklez

    I love 2B 'n' ass. Member
    687
    21
    18
    I'm working on an extensive bug/oversight-fixing hack of S1 using the current GitHub disasm.

    After I addressed the death boundary bug according to Markey's guide (to fall back to the bottom boundary), I encountered another boundary bug that can normally happen in only one location. At the highest orbinaut in SLZ1, you can replicate this every time. If you jump on top of the orbinaut with rings to get hurt, you bounce away hurt above the top boundary and get killed rather than remaining invulnerable. How do I fix this? I tried to replicate this by getting hurt below the boundary then jumping above it while invulnerable but it does nothing. Only during the hurt/falling animation do you get killed. Also, rings just disappear if they cross the top boundary.
     
  18. Devon

    Devon

    I'm a loser, baby, so why don't you kill me? Tech Member
    1,248
    1,419
    93
    your mom
    As for when Sonic is hurt, the issue lies here at Sonic_HurtStop:
    Code (Text):
    1. Sonic_HurtStop:
    2.         move.w  (v_limitbtm2).w,d0
    3.         addi.w  #$E0,d0
    4.         cmp.w   obY(a0),d0
    5.         bcs.w   KillSonic
    Namely, the BCS instruction, which is an unsigned branch rather than signed like it should. You'll want to change it into either a BLT or BMI instruction.

    As for the ring loss object, the issue lies here at @chkdel under RLoss_Bounce:
    Code (Text):
    1.     @chkdel:
    2.         tst.b   (v_ani3_time).w
    3.         beq.s   RLoss_Delete
    4.         move.w  (v_limitbtm2).w,d0
    5.         addi.w  #$E0,d0
    6.         cmp.w   obY(a0),d0  ; has object moved below level boundary?
    7.         bcs.s   RLoss_Delete    ; if yes, branch
    Same issue as before with the BCS instruction.
     
  19. Knucklez

    Knucklez

    I love 2B 'n' ass. Member
    687
    21
    18
    Worked to perfection. Thanks Ralakimus.

    I've got a rock solid and stable Sonic 1 here with over 50 fixes implemented and a few more to go before I'll consider a release.

    ...I might have more questions coming to the thread cause I'm still learning about branches and instructions in the code. I don't wanna just make up my own fixes without being entirely sure of what I'm inputting.
     
  20. SonicoOurico

    SonicoOurico

    Member
    19
    0
    0
    I will stop asking questions, otherwise I would be being very ambitious, I give up!