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,757
    341
    63
    SonLVL
    Considering that the files are only posted in the Tech Lounge, you're probably right.
     
  2. Hanoch

    Hanoch

    Also known as TheKnock, Birashot Member
    491
    0
    0
    Israel
    everything
    Someone once told me that Cinossu released a guide on retrohack how to add a splash screen, but then retrohack died along with that guide.
     
  3. Polygon Jim

    Polygon Jim

    Eternal Tech Member
    0
    3
    0
    across town from Hinchy
    All the bitches.
    Various questions for Sonic 1 animations.

    1. How do I change what sprites the game loads for the different rotations? I can't find this in the animation script.
    2. How do I change the speed an animation plays at?
    3. For some reason my normal standing frame is using the second frame of the waiting animation, but I can't find anywhere in the animation script I could have fucked up Sonic's first frame because I can't find it on there, unless the standing frame is under wait for some reason.
     
  4. Animemaster

    Animemaster

    Prison bitch! Member
    346
    0
    0
    UK
    Sonic 1 Revelation
    Sonic.asm is the animations, the routine to load these animatons is sonic_animate.

    In sonic.asm look for say sonani_wait: and there should be a number or letter, like dc.b 7 or, dc.b $FF. Now these first numbers are the speed. So say you have it at 7, if you want it faster, then lower the number, and if you want it slower then increase the number. E.g: 1 really fast, $1F quite slow.

    Yes the standing sprite is included in sonani_wait: In an orignal rom its one, but if you altered it, then check sonmaped to see what frame it is and then change it to suit the animation script. Hope this helped.
     
  5. Spanner

    Spanner

    The Tool Member
    They were public for a short while before I decided to make them private. Cinossu is welcome to post them anywhere else if he wants to though.
     


  6. To use the code anyway. If you were to create your own code and import the art yourself—I don't see why not.
     
  7. Polygon Jim

    Polygon Jim

    Eternal Tech Member
    0
    3
    0
    across town from Hinchy
    All the bitches.

    I was able to fix the last two, but I still can't find the rotation frames.
     
  8. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,220
    472
    63
    Japan
    A few years back I spent weeks working on creating almost an exact replica, although I never finished creating it as my knowledge was still limited at the time, but even after all that work, I was told I wasn't allowed to use it, "full stop" (Even though it was incomplete), so I just deleted the fucking thing, and now that I am a Tech Member, I just don't feel my time's worth while to recreate such a screen, nor use one already provided in the tech lounge as MainMemory stated.

    Though if you want a specific location, "SAnim_WalkRun:" is the routine related to it, as it collects the angle and calcilates it based on sonic's circumstances, then later it gets added to the frame number, increasing the ID down to the other frames:

    add.b d3,$1A(a0) ; modify frame number

    EDIT: if you want the frame numbers for the other angles..

    Code (ASM):
    1. SonAni_Walk:    dc.b $FF, 8, 9, $A, $B, 6, 7, $FF
    6, 7, 8, 9, A, B, (are the normal frames)
    C, D, E, F, 10, 11, (45 degrees)
    12, 13, 14, 15, 16, 17, (90 degrees)
    18, 19, 1A, 1B, 1C, 1D, (135 degrees)

    Pretty much what Anime said, though the one's that start with $FF, are the ones that have their speed controlled by routines. Such as the walking which is controlled by "loc_13A78:"..

    Code (ASM):
    1.         move.w  $14(a0),d2  ; get Sonic's speed
    It collects the speed from here (Sonic's Ground Speed), makes the value positive, and checks for a speed amount of $0600, if it is higher, it'll be fourced to use the running animation, otherwise walking animation. It'll then negate it and add $0800, if it's a negative value, then the speed was higher than $0800, and the animation speed is set to it's maximum speed amount ($00), however if positive, it was lower than the speed of $0800, so the left byte is read from the speed and set as the frame duration, I.e. if the speed is $0600, then $06 is the speed set:

    Code (ASM):
    1. loc_13AC2:
    2.         lsr.w   #8,d2
    3.         move.b  d2,$1E(a0)  ; modify frame duration
    as seen here (d2 = the speed, negated + $0800), it's shifted right by 8 bits sending the left byte of the word to the right (or gets divided by $100, which ever one seems more logical), and is then set as the frame duration.

    Anime has more or less summed it up =)
     
  9. Tidbit

    Tidbit

    Member
    I have a SonmapED question. Okay I'm working on changing coconuts sprites, and after I import my new sprite, coconuts arms don't get replaced. I've tried deleting the arms tiles but that only garbles the sprites =/. Any ideas guys?
     
  10. MKAmeX

    MKAmeX

    Member
    279
    0
    16
    California
    Needlemouse, Sonic Boom, Graphic Design
    I'm not entirely sure, but I think it may have something to do with the animation script trying to load the arms as separate sprites. I remember replacing buzz bomber and the flames caused a similar problem.
    Play around with the script and remove what you don't need or something.
     
  11. Tidbit

    Tidbit

    Member
    Me + ASM = killer headache. I'll still give it a shot, im guessing all I have to search for is like obj_coconuts or something of the similar?
     
  12. MKAmeX

    MKAmeX

    Member
    279
    0
    16
    California
    Needlemouse, Sonic Boom, Graphic Design
    I'm not exactly a genius when it comes to ASM, so that should give you a clue as to how easy it is to work with Animation scripts. =P

    Anyway, yeah, search for 'coconuts', or his object ID equivalent (I think it's 9D, or something like that.)

    What you're looking for will be easy to spot, depending on the frames in SonMapEd. For example, if you have 5 frames in SonMapEd (I think there's always an empty 0 slot in front of the first frame, so 5 sprites would appear as 'frame 5/6' in SonMapEd), the animation script should not have any references to something higher than 5.

    The first byte is the speed (this was stated a few posts back), everything after that is a frame, and the last one is usually the byte that tells it to repeat, stop, etc.

    I'm not a technical person so I won't go into extreme details on all of this, and I'm probably wrong about that last part.
     
  13. Tidbit

    Tidbit

    Member
    I play around with it, and if I have to I'll just make new mappings and play it from there, but that would probably dish out a worse head ache lol.
     
  14. Polygon Jim

    Polygon Jim

    Eternal Tech Member
    0
    3
    0
    across town from Hinchy
    All the bitches.
    Code (Text):
    1. move.l    #$40000001,($C00004).l
    2. lea    (Nem_TitleFg).l,a0; load title    screen patterns
    3. bsr.w    NemDec
    4. move.l    #$60000001,($C00004).l
    5. lea    (Nem_TitleSonic).l,a0;    load Sonic title screen    patterns
    6. bsr.w    NemDec

    I'm reading this right when I say $40000001 is $4000 in vram and $60000001 is $6000 correct? I moved the Sonic title art to $7800 and he loads parts of the title banner. If I don't move Sonics art it loads it in place of the large text box at the top. I seem to have plenty of space left in VRAM for the character so I don't know what I'm doing wrong.
    [​IMG]
    [​IMG]
     
  15. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,220
    472
    63
    Japan
    Those values are correct, yes.

    Is the value #$78000001 sent to VDP when loading sonic's title art? Also asuming that your Sonic Title Object is still "Obj0E:", then is:

    Code (ASM):
    1.         move.w  #$2300,2(a0)
    ...This altered?

    It would be $7800 divided by 20 (Number of bytes per tile) so:

    Code (ASM):
    1.         move.w  #($7800/$20),$02(a0)
    ..or..

    Code (ASM):
    1.         move.w  #$03C0,$02(a0)
    ..though baring in mind that value could be $23C0, $43C0 or $63C0 depending on the palette line being used.

    If that's not the case, then I'm not sure, sorry.
     
  16. Tidbit

    Tidbit

    Member
    okay well, I finally found the coconuts code after some searching. Thing thing is I don't really see anything that relates to frames in the script.

    Here's the code.
    Code (ASM):
    1.  
    2. ; ===========================================================================
    3. ; ----------------------------------------------------------------------------
    4. ; Object 9D - Coconuts (monkey badnik) from EHZ
    5. ; ----------------------------------------------------------------------------
    6. ; Sprite_37BFA:
    7. Obj9D:
    8.     moveq    #0,d0
    9.     move.b    routine(a0),d0
    10.     move.w    off_37C08(pc,d0.w),d1
    11.     jmp    off_37C08(pc,d1.w)
    12. ; ===========================================================================
    13. off_37C08:
    14.     dc.w loc_37C10-off_37C08; 0
    15.     dc.w loc_37C1C-off_37C08; 2
    16.     dc.w Obj09_Climbing-off_37C08; 4
    17.     dc.w Obj09_Throwing-off_37C08; 6
    18. ; ===========================================================================
    19.  
    20. loc_37C10:
    21.     bsr.w    LoadSubObject
    22.     move.b    #$10,objoff_2A(a0)
    23.     rts
    24. ; ===========================================================================
    25.  
    26. loc_37C1C:
    27.     bsr.w    loc_366D6
    28.     bclr    #0,render_flags(a0)
    29.     bclr    #0,status(a0)
    30.     tst.w    d0
    31.     beq.s    +
    32.     bset    #0,render_flags(a0)
    33.     bset    #0,status(a0)
    34. +
    35.     addi.w    #$60,d2
    36.     cmpi.w    #$C0,d2
    37.     bcc.s    +
    38.     tst.b    objoff_2E(a0)
    39.     beq.s    loc_37C66
    40.     subq.b    #1,objoff_2E(a0)
    41. +
    42.     subq.b    #1,objoff_2A(a0)
    43.     bmi.s    +
    44.     bra.w    JmpTo39_MarkObjGone
    45. ; ---------------------------------------------------------------------------
    46. +    addq.b    #2,routine(a0)
    47.     bsr.w    loc_37C82
    48.     bra.w    JmpTo39_MarkObjGone
    49. ; ---------------------------------------------------------------------------
    50. loc_37C66:
    51.     move.b    #6,routine(a0)    ; Obj09_Throwing
    52.     move.b    #1,mapping_frame(a0)
    53.     move.b    #8,objoff_2A(a0)
    54.     move.b    #$20,objoff_2E(a0)
    55.     bra.w    JmpTo39_MarkObjGone
    56. ; ---------------------------------------------------------------------------
    57. loc_37C82:
    58.     move.w    objoff_2C(a0),d0
    59.     cmpi.w    #$C,d0
    60.     bcs.s    +
    61.     moveq    #0,d0
    62. +
    63.     lea    Obj09_ClimbData(pc,d0.w),a1
    64.     addq.w    #2,d0
    65.     move.w    d0,objoff_2C(a0)
    66.     move.b    (a1)+,y_vel(a0) ; climbing speed
    67.     move.b    (a1)+,objoff_2A(a0) ; time to spend moving at this speed
    68.     rts
    69. ; ===========================================================================
    70. ; byte_37CA2:
    71. Obj09_ClimbData:
    72.     dc.b  -1,$20
    73.     dc.b   1,$18    ; 2
    74.     dc.b  -1,$10    ; 4
    75.     dc.b   1,$28    ; 6
    76.     dc.b  -1,$20    ; 8
    77.     dc.b   1,$10    ; 10
    78. ; ===========================================================================
    79. ; loc_37CAE:
    80. Obj09_Climbing:
    81.     subq.b    #1,objoff_2A(a0)
    82.     beq.s    loc_37CC6
    83.     bsr.w    JmpTo26_ObjectMove
    84.     lea    (off_37D88).l,a1
    85.     bsr.w    JmpTo25_AnimateSprite
    86.     bra.w    JmpTo39_MarkObjGone
    87. ; ===========================================================================
    88.  
    89. loc_37CC6:
    90.     subq.b    #2,routine(a0)
    91.     move.b    #$10,objoff_2A(a0)
    92.     bra.w    JmpTo39_MarkObjGone
    93. ; ===========================================================================
    94. ; loc_37CD4:
    95. Obj09_Throwing:
    96.     moveq    #0,d0
    97.     move.b    routine_secondary(a0),d0
    98.     move.w    off_37CE6(pc,d0.w),d1
    99.     jsr    off_37CE6(pc,d1.w)
    100.     bra.w    JmpTo39_MarkObjGone
    101. ; ===========================================================================
    102. off_37CE6:
    103.     dc.w loc_37CEA-off_37CE6
    104.     dc.w loc_37D06-off_37CE6; 1
    105. ; ===========================================================================
    106.  
    107. loc_37CEA:
    108.     subq.b    #1,objoff_2A(a0)
    109.     bmi.s    +
    110.     rts
    111. ; ---------------------------------------------------------------------------
    112. +    addq.b    #2,routine_secondary(a0)
    113.     move.b    #8,objoff_2A(a0)
    114.     move.b    #2,mapping_frame(a0)
    115.     bra.w    loc_37D22
    116. ; ===========================================================================
    117.  
    118. loc_37D06:
    119.     subq.b    #1,objoff_2A(a0)
    120.     bmi.s    +
    121.     rts
    122. ; ---------------------------------------------------------------------------
    123. +    clr.b    routine_secondary(a0)
    124.     move.b    #4,routine(a0) ; Obj09_Climbing
    125.     move.b    #8,objoff_2A(a0)
    126.     bra.w    loc_37C82
    127. ; ===========================================================================
    128.  
    129. loc_37D22:
    130.     bsr.w    JmpTo19_SingleObjLoad
    131.     bne.s    return_37D74
    132.     _move.b    #$98,0(a1) ; load obj98
    133.     move.b    #3,mapping_frame(a1)
    134.     move.b    #$20,subtype(a1) ; <== Obj9D_SubObjData2
    135.     move.w    x_pos(a0),x_pos(a1)
    136.     move.w    y_pos(a0),y_pos(a1)
    137.     addi.w    #-$D,y_pos(a1)
    138.     moveq    #0,d0
    139.     btst    #0,render_flags(a0)
    140.     bne.s    loc_37D58
    141.     moveq    #4,d0
    142.  
    143. loc_37D58:
    144.     lea    word_37D76(pc,d0.w),a2
    145.     move.w    (a2)+,d0
    146.     add.w    d0,x_pos(a1)
    147.     move.w    (a2)+,x_vel(a1)
    148.     move.w    #-$100,y_vel(a1)
    149.     lea    Obj98_CoconutFall(pc),a2 ; set the routine used to move the projectile
    150.     move.l    a2,objoff_2A(a1)
    151.  
    152. return_37D74:
    153.     rts
    154. ; ===========================================================================
    155. word_37D76:
    156.     dc.w $FFF5
    157.     dc.w  $100    ; 1
    158.     dc.w    $B    ; 2
    159.     dc.w $FF00    ; 3
    160. ; off_37D7E:
    161. Obj9D_SubObjData:
    162.     dc.l Obj9D_Obj98_MapUnc_37D96
    163.     dc.w $3EE
    164.     dc.w $405
    165.     dc.w $C09
    166.  
    167. ; animation script
    168. off_37D88:
    169.     dc.w byte_37D8C-off_37D88
    170.     dc.w byte_37D90-off_37D88; 1
    171. byte_37D8C:
    172.     dc.b   5,  0,  1,$FF
    173. byte_37D90:
    174.     dc.b   9,  1,  2,  1,$FF
    175.     even
    176. ; ------------------------------------------------------------------------
    177. ; sprite mappings
    178. ; ------------------------------------------------------------------------
    179. Obj9D_Obj98_MapUnc_37D96:    BINCLUDE "mappings/sprite/obj9D.bin"
    Like I said above, I'm trying to remove coconuts arms from loading, or being used in any way.

    Code (ASM):
    1. ; ===========================================================================
    2. ; byte_37CA2:
    3. Obj09_ClimbData:
    4.     dc.b  -1,$20
    5.     dc.b   1,$18    ; 2
    6.     dc.b  -1,$10    ; 4
    7.     dc.b   1,$28    ; 6
    8.     dc.b  -1,$20    ; 8
    9.     dc.b   1,$10    ; 10
    10. ; ===========================================================================
    That code was the only thing I though relevant to which sprite is loaded or used, but like I said I have no clue what I'm doing when it comes to asm.
     
  17. Polygon Jim

    Polygon Jim

    Eternal Tech Member
    0
    3
    0
    across town from Hinchy
    All the bitches.
    Thanks, I forgot how to do that because I'm a durp.

    [​IMG]
     
  18. MKAmeX

    MKAmeX

    Member
    279
    0
    16
    California
    Needlemouse, Sonic Boom, Graphic Design
    Code (Text):
    1. ; animation script
    2. off_37D88:
    3.     dc.w byte_37D8C-off_37D88
    4.     dc.w byte_37D90-off_37D88; 1
    5. byte_37D8C:
    6.     dc.b   5,  0,  1,$FF
    7. byte_37D90:
    8.     dc.b   9,  1,  2,  1,$FF
    9.     even
    This is the animation script. I can't help you all that much because I don't really know what kind of frames you're using, but basically the

    "dc.b #,"

    part is the speed. The number will adjust your speed accordingly.

    the numbers "5, 0, 1," and "1, 2, 1," are the frames. You'll have to play with these numbers to make your own animations.

    And last the "$FF" part is the... Well this is telling it to repeat the animation when finished.


    I honestly don't know exactly what is wrong, but if you change the numbers around and the arms turn into other sprites, then you know should get an idea of what to do.
     
  19. Tidbit

    Tidbit

    Member
    That helps me out alot thanks for pointing out the script for me, im sure I'll be able to figure it out.
     
  20. FeliciaVal

    FeliciaVal

    Member
    693
    11
    18
    Spain
    I need a bit of help guys, I'm having trouble with my Sonic 1 hack: I have no idea how to make a palette for my character for Labyrinth Zone underwater. I tried messing up with HivePal to get colours right but I've never been able to do so. Could maybe someone help me on this?