Basic Questions & Answers thread

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

  1. Inferno

    Inferno

    Member
    14
    3
    3
    Sonic 1 Definitive
    SonMapED isn't really used for plane mappings (aka, the mapping type for the title screen logo in Sonic 1). There are other programs for this which I will now list for you:
    PlaneED (outdated, similarly to SonMapED): http://info.sonicretro.org/PlaneEd
    Captain PlaneED (updated PlaneED): https://forums.sonicretro.org/index.php?threads/captain-planeed.35372/
    SonPLN (part of the SonLVL suite): http://sonicresearch.org/community/index.php?threads/sonpln.5734/
    DON'T try to decompress the file if you are using the above tools, they will load the Enigma-compressed mappings. This is likely where you went wrong with PlaneED, or you failed to use it properly (don't blame you, OG PlaneED is cumbersome at times).
     
  2. Rufus_Iskv

    Rufus_Iskv

    Member
    4
    0
    1
    Russia
    Thank you for replying, but that isn't what I wanted to do. I didn't want to edit mappings for the title screen, I wanted to change how distinct tiles look (draw something on the logo, basically), for which I need a decompressed mapping file, so I wouldn't have to edit each tile one-by-one. Is there a way I can get a regular mapping file for the title screen?
     
  3. Inferno

    Inferno

    Member
    14
    3
    3
    Sonic 1 Definitive
    No, as far as I know, there is no way. You'll have to go about it with plane mappings.
     
  4. E-122-Psi

    E-122-Psi

    Member
    2,023
    132
    43
    Okay, has anyone here experience fixing the vertical scrolling for Hidden Palace? I wanna get the slope working properly.
     
  5. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,445
    79
    28
    SonLVL
    I did something like that in Knuckles' Emerald Hunt. What I did was when you reach the section with the wrapping, you turn off water and set the camera Y bounds to -$100 and $800, then when you leave, set everything back to normal. This code goes under LevEvents_HPZ:
    Code (Text):
    1.  
    2.     cmpi.w   #$1900,(Camera_X_pos).w
    3.    blo.s   +
    4.    cmpi.w   #$1C00,(Camera_X_pos).w
    5.    bhs.s   +
    6.    move.w   #-$100,(Camera_Min_Y_pos).w
    7.    move.w   #$800,(Camera_Max_Y_pos).w
    8.    move.w   #$800,(Camera_Max_Y_pos_now).w
    9.    move.b   #0,(Water_flag).w
    10.    andi.w   #$3FF,(Camera_BG_Y_pos).w
    11.    rts
    12. +
    13.    clr.w   (Camera_Min_Y_pos).w
    14.    move.w   #$720,(Camera_Max_Y_pos).w
    15.    move.w   #$720,(Camera_Max_Y_pos_now).w
    16.    move.b   #1,(Water_flag).w
    There's also an issue with the background scrolling not accommodating vertical wrapping, which required the whole routine to be rewritten:
    Code (Text):
    1.  
    2. SwScrl_HPZ:
    3.    move.w   (Camera_X_pos_diff).w,d4
    4.    ext.l   d4
    5.    asl.l   #6,d4
    6.    moveq   #2,d6
    7.    bsr.w   SetHorizScrollFlagsBG
    8.    move.w   (Camera_Y_pos_diff).w,d5
    9.    ext.l   d5
    10.    asl.l   #7,d5
    11.    moveq   #6,d6
    12.    bsr.w   SetVertiScrollFlagsBG
    13.    move.w   (Camera_BG_Y_pos).w,(Vscroll_Factor_BG).w
    14.    lea   (TempArray_LayerDef).w,a1
    15.    move.w   (Camera_X_pos).w,d2
    16.    neg.w   d2
    17.    move.w   d2,d0
    18.    asr.w   #1,d0
    19.  
    20.    move.w   #7,d1
    21. -   move.w   d0,(a1)+
    22.    dbf   d1,-
    23.  
    24.    move.w   d2,d0
    25.    asr.w   #3,d0
    26.    sub.w   d2,d0
    27.    ext.l   d0
    28.    asl.l   #3,d0
    29.    divs.w   #8,d0
    30.    ext.l   d0
    31.    asl.l   #4,d0
    32.    asl.l   #8,d0
    33.    moveq   #0,d3
    34.    move.w   d2,d3
    35.    asr.w   #1,d3
    36.    lea   (TempArray_LayerDef+$60).w,a2
    37.    swap   d3
    38.    add.l   d0,d3
    39.    swap   d3
    40.    move.w   d3,(a1)+
    41.    move.w   d3,(a1)+
    42.    move.w   d3,(a1)+
    43.    move.w   d3,-(a2)
    44.    move.w   d3,-(a2)
    45.    move.w   d3,-(a2)
    46.    swap   d3
    47.    add.l   d0,d3
    48.    swap   d3
    49.    move.w   d3,(a1)+
    50.    move.w   d3,(a1)+
    51.    move.w   d3,-(a2)
    52.    move.w   d3,-(a2)
    53.    swap   d3
    54.    add.l   d0,d3
    55.    swap   d3
    56.    move.w   d3,(a1)+
    57.    move.w   d3,-(a2)
    58.    swap   d3
    59.    add.l   d0,d3
    60.    swap   d3
    61.    move.w   d3,(a1)+
    62.    move.w   d3,-(a2)
    63.    move.w   (Camera_BG_X_pos).w,d0
    64.    neg.w   d0
    65.  
    66.    move.w   #$19,d1
    67. -   move.w   d0,(a1)+
    68.    dbf   d1,-
    69.  
    70.    adda.w   #$E,a1
    71.    move.w   d2,d0
    72.    asr.w   #1,d0
    73.  
    74.    move.w   #$17,d1
    75. -   move.w   d0,(a1)+
    76.    dbf   d1,-
    77.  
    78.    moveq   #$7E,d3
    79.    lea   (TempArray_LayerDef).w,a2
    80.    move.w   (Camera_BG_Y_pos).w,d4
    81.    move.w   d4,d2
    82.    lsr.w   #3,d4
    83.    and.w   d3,d4
    84.    lea   (Horiz_Scroll_Buf).w,a1
    85.    move.w   #bytesToXcnt(Horiz_Scroll_Buf_End-Horiz_Scroll_Buf,$40),d1
    86.    move.w   #((Horiz_Scroll_Buf_End-Horiz_Scroll_Buf)/4)-$10,d5
    87.    move.w   (Camera_X_pos).w,d0
    88.    neg.w   d0
    89.    swap   d0
    90.    andi.w   #$F,d2
    91.    add.w   d2,d5
    92.    add.w   d2,d2
    93.    move.w   (a2,d4.w),d0
    94.    addq.w   #2,d4
    95.    and.w   d3,d4
    96.    jmp   +(pc,d2.w)
    97. ;----------------------------------------------------------------------------
    98.  
    99. -   subi.w   #$10,d5
    100.    move.w   (a2,d4.w),d0
    101.    addq.w   #2,d4
    102.    and.w   d3,d4
    103.  
    104. +   rept 16
    105.    move.l   d0,(a1)+
    106.     endm
    107.    dbf   d1,-
    108.  
    109.    subq.w   #1,d5
    110.    bcs.s   +
    111.    move.w   (a2,d4.w),d0
    112. -   move.l   d0,(a1)+
    113.    dbf   d5,-
    114. +
    115.    rts
     
  6. E-122-Psi

    E-122-Psi

    Member
    2,023
    132
    43
    What's BytesToXcnt? I can translate the others to raw entries for the Xenowhirl edit but I this seems to be new.
     
  7. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,445
    79
    28
    SonLVL
    Like bytesToLcnt/bytesToWcnt, but it divides by a second parameter ($40) instead of 2 or 4.
     
  8. E-122-Psi

    E-122-Psi

    Member
    2,023
    132
    43
    Okay, but how would I code that in for the Xenowhirl asm?
     
  9. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,445
    79
    28
    SonLVL
    ((Horiz_Scroll_Buf_End-Horiz_Scroll_Buf)/$40)-1
     
  10. E-122-Psi

    E-122-Psi

    Member
    2,023
    132
    43
    Still not recognised. I tried it's byte equivalent in Xenowhirl with (($400-Horiz_Scroll_Buf)/$40)-1 but it just froze the game upon loading the level.
     
  11. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,445
    79
    28
    SonLVL
    If $400 is the size of the buffer, then just put $3F in.
     
  12. E-122-Psi

    E-122-Psi

    Member
    2,023
    132
    43
    Still just freezes the game. Hold on, is this right?

    Code (Text):
    1.  
    2. ; ===========================================================================
    3. ; unused...
    4. ; loc_CBA0:
    5. SwScrl_HPZ:
    6.    move.w   ($FFFFEEB0).w,d4
    7.    ext.l   d4
    8.    asl.l   #6,d4
    9.    moveq   #2,d6
    10.    bsr.w   sub_D904
    11.    move.w   ($FFFFEEB2).w,d5
    12.    ext.l   d5
    13.    asl.l   #7,d5
    14.    moveq   #6,d6
    15.    bsr.w   sub_D938
    16.    move.w   ($FFFFEE0C).w,($FFFFF618).w
    17.    lea   ($FFFFA800).w,a1
    18.    move.w   (Camera_X_pos).w,d2
    19.    neg.w   d2
    20.    move.w   d2,d0
    21.    asr.w   #1,d0
    22.  
    23.    move.w   #7,d1
    24. -   move.w   d0,(a1)+
    25.    dbf   d1,-
    26.  
    27.    move.w   d2,d0
    28.    asr.w   #3,d0
    29.    sub.w   d2,d0
    30.    ext.l   d0
    31.    asl.l   #3,d0
    32.    divs.w   #8,d0
    33.    ext.l   d0
    34.    asl.l   #4,d0
    35.    asl.l   #8,d0
    36.    moveq   #0,d3
    37.    move.w   d2,d3
    38.    asr.w   #1,d3
    39.    lea   ($FFFFA860).w,a2
    40.    swap   d3
    41.    add.l   d0,d3
    42.    swap   d3
    43.    move.w   d3,(a1)+
    44.    move.w   d3,(a1)+
    45.    move.w   d3,(a1)+
    46.    move.w   d3,-(a2)
    47.    move.w   d3,-(a2)
    48.    move.w   d3,-(a2)
    49.    swap   d3
    50.    add.l   d0,d3
    51.    swap   d3
    52.    move.w   d3,(a1)+
    53.    move.w   d3,(a1)+
    54.    move.w   d3,-(a2)
    55.    move.w   d3,-(a2)
    56.    swap   d3
    57.    add.l   d0,d3
    58.    swap   d3
    59.    move.w   d3,(a1)+
    60.    move.w   d3,-(a2)
    61.    swap   d3
    62.    add.l   d0,d3
    63.    swap   d3
    64.    move.w   d3,(a1)+
    65.    move.w   d3,-(a2)
    66.    move.w   ($FFFFEE08).w,d0
    67.    neg.w   d0
    68.  
    69.    move.w   #$19,d1
    70. -   move.w   d0,(a1)+
    71.    dbf   d1,-
    72.  
    73.    adda.w   #$E,a1
    74.    move.w   d2,d0
    75.    asr.w   #1,d0
    76.  
    77.    move.w   #$17,d1
    78. -   move.w   d0,(a1)+
    79.    dbf   d1,-
    80.  
    81.    moveq   #$7E,d3
    82.    lea   ($FFFFA800).w,a2
    83.    move.w   ($FFFFEE0C).w,d4
    84.    move.w   d4,d2
    85.    lsr.w   #3,d4
    86.    and.w   d3,d4
    87.    lea   (Horiz_Scroll_Buf).w,a1
    88.    move.w   #(($3F-Horiz_Scroll_Buf)/$40)-1,d1
    89.    move.w   #(($3F-Horiz_Scroll_Buf)/4)-$10,d5
    90.    move.w   (Camera_X_pos).w,d0
    91.    neg.w   d0
    92.    swap   d0
    93.    andi.w   #$F,d2
    94.    add.w   d2,d5
    95.    add.w   d2,d2
    96.    move.w   (a2,d4.w),d0
    97.    addq.w   #2,d4
    98.    and.w   d3,d4
    99.    jmp   +(pc,d2.w)
    100. ;----------------------------------------------------------------------------
    101.  
    102. -   subi.w   #$10,d5
    103.    move.w   (a2,d4.w),d0
    104.    addq.w   #2,d4
    105.    and.w   d3,d4
    106.  
    107. +   rept 16
    108.    move.l   d0,(a1)+
    109.     endm
    110.    dbf   d1,-
    111.  
    112.    subq.w   #1,d5
    113.    bcs.s   +
    114.    move.w   (a2,d4.w),d0
    115. -   move.l   d0,(a1)+
    116.    dbf   d5,-
    117. +
    118.    rts
    119. ; ===========================================================================
    120. ; loc_CC66:
    121. SwScrl_OOZ:
    122.     move.w    ($FFFFEEB0).w,d0
    123.     ext.l    d0
     
  13. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,445
    79
    28
    SonLVL
    No, just replace Horiz_Scroll_Buf_End-Horiz_Scroll_Buf with $400 on both lines. I actually missed the second one there.
     
  14. E-122-Psi

    E-122-Psi

    Member
    2,023
    132
    43
    I think that got it working. Thanx. :D

    The background seems to cut off in places where it transitions, though since this is similar to a previous issue when going to far in the level, I take it it's a case of adding background chunks in plane B to loop it properly.
     
  15. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,445
    79
    28
    SonLVL
    Yeah, I just filled the whole plane with copies of the background in SonLVL.