don't click here

Basic Questions & Answers thread

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

  1. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    How exactly did you go about fixing the demo exactly? Did you simply lock the controls, or did you use another method?

    Also, thank you Markey, I figured it was something that simple. =/
     
  2. RetroKoH

    RetroKoH

    Member
    1,662
    22
    18
    Project Sonic 8x16
    To do it, I used this HowTo: Guide.
    Again, I used the newest Retro disassembly and used the SVN disassembly method.

    I'm not exactly sure what it does. But from what I read it changed the value being read from $FFF604 to 602.

    I am starting to think it doesn't have to do with the button presses... as I retried the demo and it did this again with NO button press. It only happens on the demo with the first Crabmeat badnik. It doesn't happen in the Marble or Spring Yard demos... nor does it happen in normal gameplay. (Although normal gameplay has been modded to include an extra life per 50,000 pts.)
     
  3. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    Strange, I grabbed a fresh copy of the HG version, and I did not run across that issue. It most likely has to do with the edit you did to the 1-up bonus for 50,000 points.
     
  4. RetroKoH

    RetroKoH

    Member
    1,662
    22
    18
    Project Sonic 8x16
    Perhaps. I'll take another look at what I did to that section and get back to ya. All I did to it was remove the part of code where it checks the revision, and then checks the region... so that it would just occur normally. I have it working in game with 0 problems... but for some reason THAT ONE Crabmeat in GHZ demo only is doing this... Perhaps if it goes to Demo mode instead of game mode... something hasn't been cleared or set up correctly???
     
  5. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    I have a question reguarding the object I am working on, the Dash Rings from the modern games. You know, these things?.

    I've run into a slight issue I cannot seem to fix. If you simply jump into them, they work fine. However if I jumpdash into one, Sonic goes shooting off at some ridiculously insane speed.

    What would be a simply and effective way to clear Sonic's previous speed, and still have him shoot off as desired?

    Edit: here is the code that I am currently using to "shoot Sonic"

    Code (Text):
    1.         lea (MainCharacter).w,a1 ; a1=character
    2.         move.b  #2,$24(a0)           ; increase the routine counter
    3.         bclr    #0,status(a1)        ; turn him right
    4.        
    5.  
    6.     move.w #$A00,x_vel(a1)       ; move Sonic forward (X axis)
    7.     btst    #1,subtype(a0)       ; is the subtype 1?
    8.     beq.s   +                    ; if it is, skip move speed and turn delay timer
    9.     move.b  #-$2,y_vel(a1)       ; sends Sonic up a bit
    10.     bra     ++
    11. +
    12.         move.b  #-$47,y_vel(a1)
     
  6. 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)
    I think that you should be using 'move.w' instead of 'move.b' both times you set y_vel; unless you really want Sonic to shoot off at an insanely high speed upwards (that $47 there means that Sonic will shoot up at just under 11 times the speed of a normal jump) when bit 1 of subtype is set, in which case it is right. The code of the dash ring seems fine; the problem might actually be in the way that the jump dash code interacts with this. If there is a flag that causes the jump dash, you may want to clear it on the dash ring code and see what happens.
     
  7. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    Edit: Ok, your suggestion seems to work well. However, the line move.b #-$47,y_vel(a1) no longer shoots Sonic off at the desired 47 degree angle I originally intended.

    The jump dash speed still interacts with the dash ring speed, but to a much lower extent. Clearing the jump dash flag did not help. =/
     
  8. 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)
    Unless you rewrote the moving functions (or disabled them while the dash ring controls Sonic), there is no way that 'move.b #-$47,y_vel(a1)' causes Sonic to go off at a 47 degree angle unless you had a corresponding 'move.b #$42,x_vel(a1)' line. A 47-degree angle is very close to a 45-degree angle; at a 45-degree angle, x_vel and y_vel need to be equal in magnitude. The discrepancy in the values you were setting give you an angle of about 82 degrees.

    You may be having an issue with the jump flag, which adds a vertical speed limit upwards (unless you are holding a jump button); try also clearing the jumping flag ('clr.b jumping(a1)' in S2 disassemblies).
     
  9. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    I had to clear both the jumping flag and the walljump flag. Thank you for your assistance, flamewing. :)

    Edit: Ok, new issue. I can get subtype 0 and 1 to work just fine, but subtype 2 does not seem to be affected if I try to set it to do something different. =/
     
  10. Jimmy Hedgehog

    Jimmy Hedgehog

    Member
    1,728
    8
    18
    England - Slough
    Getting the motivation to continue old projects
    I've read through the working with objects guide, and I've gotten quite confused. Where on earth would I start with creating a new object by scratch in Sonic 1 (2005 Hivebrain)? And are there are free VRAM locations for something about the size as one signpost sprite? Not sure how much VRAM the "points from enemies" takes and I used some of that to extend Sonic's anyway.
     
  11. 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)
    Without seeing the code at hand, it is hard to guess what may be going wrong.
     
  12. Jimmy Hedgehog

    Jimmy Hedgehog

    Member
    1,728
    8
    18
    England - Slough
    Getting the motivation to continue old projects
    Thinking about this I feel I wasn't exactly very clear with what I said. All I need the object to do is simply show up, it doesn't need to do anything. Simply be placeable and be visible, nothing special. Why I can't even figure that out is beyond me.
     
  13. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,192
    404
    63
    Japan
    Open the file "_inc\Object pointers.asm"

    Code (Text):
    1. ; ---------------------------------------------------------------------------
    2. ; Object pointers
    3. ; ---------------------------------------------------------------------------
    4.     dc.l Obj01, ObjectFall, ObjectFall, ObjectFall
    5.     dc.l ObjectFall, ObjectFall, ObjectFall, Obj08
    6.     dc.l Obj09, Obj0A, Obj0B, Obj0C
    7.     ...
    Change the "ObjectFall" that is on the left side of "Obj08" to "Obj07" like so:

    Code (Text):
    1. ; ---------------------------------------------------------------------------
    2. ; Object pointers
    3. ; ---------------------------------------------------------------------------
    4.     dc.l Obj01, ObjectFall, ObjectFall, ObjectFall
    5.     dc.l ObjectFall, ObjectFall, Obj07, Obj08
    6.     dc.l Obj09, Obj0A, Obj0B, Obj0C
    7.     ...
    The "ObjectFall" slots are unused object slots, we have opened up slot 07 for usage, some code:

    Code (Text):
    1. ; ===========================================================================
    2. ; ---------------------------------------------------------------------------
    3. ; Object 07 - Simple Displaying/Animating Object
    4. ; ---------------------------------------------------------------------------
    5.  
    6. Obj07:
    7.         moveq   #$00,d0                 ; clear d0
    8.         move.b  $24(a0),d0              ; load routine counter
    9.         move.w  Obj07_List(pc,d0.w),d0          ; load correct add address
    10.         jmp Obj07_List(pc,d0.w)         ; add and jump to correct routine
    11.  
    12. ; ===========================================================================
    13. ; ---------------------------------------------------------------------------
    14. Obj07_List: dc.w    Obj07_Setup-Obj07_List          ; 00
    15.         dc.w    Obj07_Display-Obj07_List        ; 02
    16. ; ---------------------------------------------------------------------------
    17. ; ===========================================================================
    18. ; ---------------------------------------------------------------------------
    19. ; Routine to setup the object
    20. ; ---------------------------------------------------------------------------
    21.  
    22. Obj07_Setup:
    23.         addq.b  #$02,$24(a0)                ; increase routine counter (next routine will run next frame)
    24.         move.b  #%00000100,$01(a0)          ; set object as level-coordinated (not like a HUD)
    25.         move.w  #$0000,$02(a0)              ; set V-Ram read address (starting at tile 000)
    26.         move.l  #MapObj07,$04(a0)           ; set map list address
    27.         move.b  #$02,$18(a0)                ; set priority of display (00 Closest | 07 Furthest Away)
    28.         move.b  #$10,$19(a0)                ; set X draw out of screen distance (10 pixels from the centre of the object)
    29.         move.b  $28(a0),$1C(a0)             ; load object sub-type and set as animation to use
    30.  
    31. ; ===========================================================================
    32. ; ---------------------------------------------------------------------------
    33. ; Routine to set the object to display
    34. ; ---------------------------------------------------------------------------
    35.  
    36. Obj07_Display:
    37.         lea AniObj07(pc),a1             ; load animation script to run
    38.         jsr AnimateSprite               ; run animation script
    39.         moveq   #$FFFFFF80,d2               ; prepare and/add/sub value
    40.         move.w  $08(a0),d0              ; load X position
    41.         and.w   d2,d0                   ; keep in range of multiples of 80 pixels
    42.         move.w  ($FFFFF700).w,d1            ; load screen X position
    43.         add.w   d2,d1                   ; move back by 80 pixels (the deletion space is a distance outside the window area)
    44.         and.w   d2,d1                   ; keep in range of multiples of 80 pixels
    45.         sub.w   d1,d0                   ; subtract left void position from object position
    46.         cmpi.w  #$0280,d0               ; has the object gone outside the object loading space?
    47.         bhi.s   Obj07_Delete                ; if so, branch to delete the object
    48.         jmp DisplaySprite               ; save object for display
    49.  
    50. Obj07_Delete:
    51.         jmp DeleteObject                ; remove the object from the list and clean the ram space
    52.  
    53. ; ===========================================================================
    54. ; ---------------------------------------------------------------------------
    55. ; Animation script list for Object 07
    56. ; ---------------------------------------------------------------------------
    57. AniObj07:   dc.w    Ani07_Script00-AniObj07         ; 00
    58.         dc.w    Ani07_Script01-AniObj07         ; 01
    59. ; ---------------------------------------------------------------------------
    60. Ani07_Script00: dc.b    $07,$00,$01,$02,$03,$FF
    61. Ani07_Script01: dc.b    $03,$03,$02,$01,$00,$FF
    62. ; ---------------------------------------------------------------------------
    63.         even
    64. ; ---------------------------------------------------------------------------
    65. ; ===========================================================================
    66. ; ---------------------------------------------------------------------------
    67. ; Map list for Object 07
    68. ; ---------------------------------------------------------------------------
    69. MapObj07:   dc.w    Map07_Frame00-MapObj07          ; 00
    70.         dc.w    Map07_Frame01-MapObj07          ; 01
    71.         dc.w    Map07_Frame02-MapObj07          ; 02
    72.         dc.w    Map07_Frame03-MapObj07          ; 03
    73. ; ---------------------------------------------------------------------------
    74. Map07_Frame00:  dc.b    $01
    75.         dc.b    $F0,$0F,$00,$00,$F0
    76. Map07_Frame01:  dc.b    $01
    77.         dc.b    $F4,$0A,$20,$01,$F4
    78. Map07_Frame02:  dc.b    $01
    79.         dc.b    $F8,$05,$40,$02,$F8
    80. Map07_Frame03:  dc.b    $02
    81.         dc.b    $F8,$00,$60,$03,$F8
    82.         dc.b    $D8,$0F,$40,$00,$F0
    83. ; ---------------------------------------------------------------------------
    84.         even
    85. ; ---------------------------------------------------------------------------
    86. ; ===========================================================================
    This object will display 4 frames in an animated pattern using different palette lines each animation frame, it will choose a different animation depending on the sub-type you choose when placing it in the level.
     
  14. Jimmy Hedgehog

    Jimmy Hedgehog

    Member
    1,728
    8
    18
    England - Slough
    Getting the motivation to continue old projects
    Awesome thanks, got all that in and working alright. Though I'm not quite sure where I'd tell it to load it's art from a nemesis art file? I'm gonna keep looking of course, should probably look at other objects and see if I can figure it out.
     
  15. TehKaker

    TehKaker

    Member
    12
    0
    1
    Hello I'm Tehkaker, with a very simple question for you. I am doing an custom script for detecting collision on my objects, by reading this from the maps files (Sonic 1 format.). For now, I did want to do a test for this, making the object to delete if gets touched by Sonic, horizontally. But nothing happens. Here is my code, if you want to see:

    Code (Text):
    1. CustomColDetect:
    2.         movem.l d0-a6,-(sp)
    3.         moveq   #0,d0
    4.         move.b  $1A(a0),d0
    5.         lea (a0),a2
    6.         movea.l 4(a0),a1
    7.         movea.l 4(a0),a0
    8.         mulu.w  #2,d0
    9.         adda.w  d0,a0
    10.         adda.w  (a0),a1
    11.         moveq   #0,d0
    12.         move.b  (a1)+,d0    ;Read how many sprites in map
    13.         tst.b   d0
    14.         beq @ret
    15.         sub.b   #1,d0
    16.         lea (a1),a0
    17.     @loop:  moveq   #0,d4
    18.         moveq   #0,d5
    19.         moveq   #0,d6
    20.         moveq   #0,d2
    21.         moveq   #0,d3
    22.         moveq   #0,d1
    23.         moveq   #0,d4
    24.         moveq   #0,d7
    25.         move.b  (a1),d4
    26.         move.b  1(a1),d6
    27.         lea 4(a1),a1
    28.         move.b  (a1)+,d5
    29. ;D3, D2, D1, A3.
    30. ;d4, d5, starting pos.
    31. ;d2, d3, final pos.
    32. ;d1, d7, sonic pos.
    33.         add.w   8(a2),d4
    34.         add.w   $C(a2),d5
    35.         lea (@sprsizes).l,a3
    36.         mulu.w  #2,d6
    37.         adda.w  d6,a3
    38.         move.b  (a3)+,d2
    39.         move.b  (a3),d3
    40.         add.w   d4,d2
    41.         add.w   d5,d3
    42.         move.w  ($FFFFD008).w,d1
    43.         move.w  ($FFFFD00C).w,d7
    44.         cmp.w   d1,d2
    45.         bcs @chkcol
    46.     @cont:  dbf d0,@loop
    47.     @ret:   movem.l (sp)+,d0-a6
    48.         rts
    49.  
    50. @chkcol:
    51.         cmp.w   d1,d4
    52.         bcs @cont
    53.     ;   cmp.w   d7,d5
    54.     ;   bcs @cont
    55.     ;   cmp.w   d7,d3
    56.     ;   bcs @cont2
    57.     ;   bra @cont
    58.     @cont2: move.b  #0,(a2)
    59.         bra @ret
    60.  
    61. @sprsizes:  ; Size to assign.
    62.         ; FORMAT: Horiz pixels, Vert pixels.
    63.         dc.b    8, 8    ;$00
    64.         dc.b    8, 16   ;$01
    65.         dc.b    8, 24   ;$02
    66.         dc.b    8, 32   ;$03
    67.  
    68.         dc.b    16, 8   ;$04
    69.         dc.b    16, 16  ;$05
    70.         dc.b    16, 24  ;$06
    71.         dc.b    16, 32  ;$07
    72.  
    73.         dc.b    24, 8   ;$08
    74.         dc.b    24, 16  ;$09
    75.         dc.b    24, 24  ;$0A
    76.         dc.b    24, 32  ;$0B
    77.  
    78.         dc.b    32, 8   ;$0C
    79.         dc.b    32, 16  ;$0D
    80.         dc.b    32, 24  ;$0E
    81.         dc.b    32, 32  ;$0F
    82.         even
     
  16. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,192
    404
    63
    Japan
    I see what you're trying to do here and I'm actually sort of impressed with your attempt, you have a pretty good deal of understanding of Sonic 1's mapping format, and seem to use it to your advantage. The problems with your code that I found are;

    1. What is in a2 to begin with?

      I'm assuming that this is the Sonic object that is loaded into a2 before the routine is ran, have you made sure that the Sonic object is loaded to a2 before the routine? Why not load the Sonic object to a2 inside this routine itself?
    2. When you loaded the X and Y position of the individual sprites in the mapping list, you didn't add the object's X and Y positions to them.

      Remember, this object might be in the level at X and Y of 221F and 0340, and Sonic might be around the X and Y of 21C0 and 0340, but your mapping's X and Y positions can only be from 00 to 7F (right/down) and 80 to FF (left/up), add the object's X position to the sprite's X position, and the object's Y position to the sprite's Y position, this will get you the exact X and Y position in the level.
    3. Here is a fatal error you should be careful of:

      Code (Text):
      1.         move.b  (a3)+,d2
      2.         move.b  (a3),d3
      3.         add.w   d4,d2
      4.         add.w   d5,d3
      You have loaded a "byte" to d2 and d3, but then you add a word to d2 and d3, to explain the problem better, let's pretend that d2 contains 00009F31 to begin with:

      Code (Text):
      1.         move.b  (a3)+,d2
      We've loaded a byte, let's say it was "8" in this situation, d2 will now contain 00009F08. Next we add the word from d4 which we'll pretend is 0180:

      Code (Text):
      1.         add.w   d4,d2
      d2 will now contain A088, this is wrong, you only wanted the 08 to be added to it. the best way to fix this potential error, is by clearing d2 and d3 before loading the byte from a3:

      Code (Text):
      1.         moveq   #$00,d2
      2.         moveq   #$00,d3
      3.         move.b  (a3)+,d2
      4.         move.b  (a3),d3
      5.         add.w   d4,d2
      6.         add.w   d5,d3
      This will ensure that d2 and d3 contain 00000000 to begin with.
    Of course, why don't you simply use the normal touch response that Sonic 1 already has (and uses)? To be very fair, I know it doesn't read the mapping's exact positions, but does it need to?

    In general though, I think you're well on your way to creating some awesome code and making yourself a respectable presents in the scene, this stuff (although buggy) is rather decent.
     
  17. FraGag

    FraGag

    Tech Member
    REV01 initialises v_scorelife to 5000 when a demo starts:
    Code (ASM):
    1.  
    2. Demo_Level:
    3.         move.b  #3,(v_lives).w  ; set lives to 3
    4.         moveq   #0,d0
    5.         move.w  d0,(v_rings).w  ; clear rings
    6.         move.l  d0,(v_time).w   ; clear time
    7.         move.l  d0,(v_score).w  ; clear score
    8.         if Revision=0
    9.         else
    10.             move.l  #5000,(v_scorelife).w ; extra life is awarded at 50000 points
    11.         endc
    12.         rts
    13.  
    Make sure you have that line too. And while you're at it, make sure it's also there in LevSel_Level_SS.
     
  18. ManicRemix

    ManicRemix

    Fact: You're reading this Member
    17
    0
    0
    Hello.

    Just popping in with a quick question here, I have made a custom level in Sonic 1.

    All I simply wanted to do was to put it in Sonic 2 with the level converter.

    Although the Tiles are messed up badly, and the collision is greatly corrupted, while all objects are placec quite perfectly.

    Yes I understand Hex/Binary and all (Hex = Numbers being represented with a base of 16, adding A, B, C, D, E, & F, and Binary Being 1s and 0s.), but I do not get why my collision & tiles are not loading properly, perhaps I am inserting something in the wrong place.

    Either way, if somebody could give me a cheat sheet of which file is supposed to replace which file I'd appreciate it.

    Just to quickly introduce myself, I wrote the Sonic 2 Extra Characters guide, created the Mario Kart Wii Custom Tracks Jungle Island and SM64DS Bob-Omb Battlefield, and I am a programmer (Wrote KCL/COL2OBJ.exe, and I know much about BDL & BMD, like what the MDL3 Section implies)

    I am very interested in also helping out in this community, and using my knowledge of hex, binary, Java/C/Python here.
     
  19. MimSayne

    MimSayne

    Member
    So recently I've become interested in making custom music for Sonic 3&K. What tools/programs would be best for doing this? I have FL Studio but I also play around with trackers(?) every now and then.
     
  20. Aerosol

    Aerosol

    Not here. Moderator
    11,163
    573
    93
    Not where I want to be.
    Sonic (?): Coming summer of 2055...?
    How possible is it to port Sonic 1 and 2 levels over to Sonic 3&K? I know SonLVL only has read support for Sonic 3&K right now but is there a way to get that done?