Actions

SCHG How-to

Difference between revisions of "Extend the level index past $10 in Sonic 2"

From Sonic Retro

(Replaced content with "the guide is removed because the original author sucks")
m (Reverted edits by Kram1024 (Talk) to last revision by Silent.creature)
Line 1: Line 1:
the guide is removed because the original author sucks
+
==Initial Notes and Revisions Done==
 +
''(Original guide by [[kram]], current revision that fixes major bugs and extends properly by [[GARY 'M 9]])''
 +
 
 +
''(Updated again by [[kram]], adding back custom titlecard mappings howto, due to guide being unfinished, thus finally fixing the "ZONE ZONE" bug.  Replace all the empty levels with your new ones.)''
 +
 
 +
''(Updated by [[silent.creature]], fixing some code within the procedures)''
 +
 
 +
'''WARNING:'''  Unless you are working with Xenowhirl's 2007 Sonic 2 disassembly, I strongly recommend you [[SCHG_How-to:Port_Sonic_1's_Sound_Driver_to_Sonic_2|port the Sonic 1 sound driver]] first before proceeding.  A lot of major data shifting will occur in this tutorial and it '''will''' make the rom size a '''lot''' bigger than it was before.  This '''will''' break the Sonic 2 or even Sonic 2 beta sound driver; thus, you definitely want Sonic 1 sound driver due to the fact that it can take the shifting and still work properly.
 +
However, if you are using Xenowhirl's 2007 Sonic 2 disassembly, it is not necessary to port any other sound driver, since it uses disassembled Z80 code which automatically references the correct locations and can thus work properly even if there are massive location shifts.
 +
 
 +
You probably noticed that all the indexes in the game stop at $10 and when you try to extend them, by extending the Main Level Load Blocks index, you get weird glitches and crashes. It means you haven't extended all the indexes that need to be extended.
 +
 
 +
We will initially extend the indexes for $20 zones, but we show that this can be extended to any number between $11 and $7F. (I didn't tried $80 and more because of the ROM cartridge size, but I think it is possible.) You will see frequently the variable-label ''NumberOfZones'', just to explain this. Please define it or substitute it to its desired value.
 +
 
 +
==Extending the Titlecard index==
 +
===Extending Main Configuration indexes===
 +
We need to allocate more card indexes for our new zone. To do this, we find:
 +
 
 +
<asm>
 +
Obj34_TitleCardData:
 +
dc.b    8,    0, $80, $1B
 +
dc.w $240, $120, $B8
 +
 
 +
dc.b  $A,  $11, $40, $1C
 +
dc.w  $28, $148, $D0
 +
 
 +
dc.b  $C,  $12, $18, $1C
 +
dc.w  $68, $188, $D0
 +
 
 +
dc.b    2,    0,  0,  0
 +
dc.w    0,    0,  0
 +
 
 +
dc.b    4,  $15, $48,  8
 +
dc.w $2A8, $168,$120
 +
 
 +
dc.b    6,  $16,  8, $15
 +
dc.w  $80,  $F0, $F0
 +
</asm>
 +
 
 +
and change this to:
 +
<asm>
 +
Obj34_TitleCardData:
 +
dc.b    8,    0, $80, $1B ; this is the zone string start index and  placement
 +
dc.w $240, $120, $B8
 +
 
 +
dc.b  $A,  NumberOfZones+1, $40, $1C ; "ZONE" string index number and placement
 +
dc.w  $28, $148, $D0
 +
 
 +
dc.b  $C,  NumberOfZones+2, $18, $1C ; act number start index and placement
 +
dc.w  $68, $188, $D0
 +
 
 +
dc.b    2,    0,  0,  0 ; this part of the titlecard is totally unknown, colored backdrop possibly
 +
dc.w    0,    0,  0
 +
 
 +
dc.b    4,  NumberOfZones+5, $48,  8 ; red strip edge index and placement
 +
dc.w $2A8, $168,$120
 +
 
 +
dc.b    6,  NumberOfZones+6,  8, $15 ; red "Sonic The Hedgehog" string and placement
 +
dc.w  $80,  $F0, $F0
 +
</asm>
 +
 
 +
Where ''NumberOfZones'' is the total number of zones you want in the game. As we said before, we will work with $20 zones.
 +
 
 +
Now, find:
 +
<asm>
 +
loc_13DEE:
 +
    jsr      sub_13D10(pc)
 +
    move.b    (Current_Zone).w,d0
 +
    cmpi.b    #$10,d0
 +
    beq.s    BranchTo9_DeleteObject
 +
    cmpi.b    #6,d0
 +
    beq.s    BranchTo9_DeleteObject
 +
    cmpi.b    #$E,d0
 +
    beq.s    BranchTo9_DeleteObject
 +
    move.b    (Current_Act).w,d1
 +
    addi.b    #$12,d1
 +
    cmpi.b    #5,d0
 +
    bne.s    loc_13E18
 +
    moveq    #$14,d1
 +
</asm>
 +
 
 +
and change it to:
 +
<asm>
 +
loc_13DEE:
 +
    jsr      sub_13D10(pc)
 +
    move.b    (Current_Zone).w,d0
 +
    cmpi.b    #$10,d0
 +
    beq.s    BranchTo9_DeleteObject
 +
    cmpi.b    #6,d0
 +
    beq.s    BranchTo9_DeleteObject
 +
    cmpi.b    #$E,d0
 +
    beq.s    BranchTo9_DeleteObject
 +
    move.b    (Current_Act).w,d1
 +
    addi.b    #NumberOfZones+2,d1                  ; Act number mappings (Act 1)
 +
    cmpi.b    #5,d0
 +
    bne.s    loc_13E18
 +
    moveq    #NumberOfZones+4,d1                  ; Act number mappings (Act 3).  Used for drawing MTZ (0x05) titlecard only
 +
</asm>
 +
 
 +
Now we have the offset data of where to load the mappings for the titlecards shifted so that we can now start working on updating the mappings and not have that strange "ZONE ZONE" bug that [[GARY 'M 9]] left behind and I intended to correct.
 +
 
 +
Next, another thing I wanted to see others correct.  this time, I will explain why I changed byte_15820 into a 16-bit relative offset index as opposed to it staying as a byte-by-byte relative offset that does not point correctly, and to appropriately handle the string data in word_15832, as well as allow that string data to be properly represented.  This time I will make it even clearer too.
 +
 
 +
Next off, in this part of the hack the first thing before converting to a better manageable datatype, we want to replace the byte_15820 handler with a better one.
 +
 
 +
Look for:
 +
<asm>
 +
; loc_157D2:
 +
LoadTitleCard:
 +
bsr.s LoadTitleCard0
 +
moveq #0,d0
 +
move.b (Current_Zone).w,d0
 +
move.b byte_15820(pc,d0.w),d0
 +
lea word_15832(pc),a0
 +
lea (a0,d0.w),a0
 +
move.l #$7BC00002,d0
 +
</asm>
 +
 
 +
and we want to replace it with:
 +
<asm>
 +
; loc_157D2:
 +
LoadTitleCard:
 +
bsr.s LoadTitleCard0
 +
moveq #0,d0
 +
move.b (Current_Zone).w,d0
 +
add.w d0,d0
 +
move.w Off_Titlecardtext(pc,d0.w),d0
 +
lea Off_Titlecardtext(pc,d0.w),a0
 +
move.l #$7BC00002,d0
 +
</asm>
 +
 
 +
That takes care of the loader, now time to update the string data.
 +
 
 +
find:
 +
<asm>
 +
; unknown
 +
byte_15820:
 +
dc.b  0,  0,  0,  0,$10,$10,$98,$20,$2C,  0,$3C,$46,$58,$68,$A8,$7A
 +
dc.b $8A,  0 ; 16
 +
; unknown
 +
word_15832:
 +
dc.w $2A06,$3804,    4,$2604, $C04,$1804,$1C02,$FFFF
 +
dc.w $2A06,$4004,$3804,$3004,$2604,$1C02,$3C04,$FFFF; 8
 +
dc.w $1804,$1C02,$2604,$4004,$3004,$FFFF,$1804,$1C02; 16
 +
dc.w  $C04,$3004,    4,$2604, $804,$FFFF,$1C02,$2604; 24
 +
dc.w  $804,    4,$FFFF,$2A06,$5604,$3C04,$4004,$1C02; 32
 +
dc.w  $804,    4,$4804,$FFFF, $804,    4,$3C04,$1C02; 40
 +
dc.w $1404,$1804,$4004,$FFFF, $804,$1804,$2A06,$1C02; 48
 +
dc.w 4,$2604,$3004,$4004,$FFFF,    4,$3404,$4404; 56
 +
dc.w $4004,$1C02, $804,$3804,$FFFF,$3C04,$2204,$5604; 64
 +
dc.w  $804,$1804,    4,$FFFF,$4C06,$1C02,$1404,$1004; 72
 +
dc.w $3804,$4004,$3C04,$FFFF, $C04,    4,$4004,$1804; 80
 +
dc.w $1404,$FFFF ; 88
 +
</asm>
 +
 
 +
and replace it with:
 +
<asm>
 +
;byte_15820
 +
Off_Titlecardtext:
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 00
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 01
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 02
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 03
 +
dc.w  Text_MTZ-Off_Titlecardtext ; MTZ Titlecard 04
 +
dc.w  Text_MTZ-Off_Titlecardtext ; MTZ Titlecard 05
 +
dc.w  Text_WFZ-Off_Titlecardtext ; WFZ Titlecard 06
 +
dc.w  Text_HTZ-Off_Titlecardtext ; HTZ Titlecard 07
 +
dc.w  Text_HPZ-Off_Titlecardtext ; EHZ Titlecard 08
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 09
 +
dc.w  Text_OOZ-Off_Titlecardtext ; OOZ Titlecard 0A
 +
dc.w  Text_MCZ-Off_Titlecardtext ; MCZ Titlecard 0B
 +
dc.w  Text_CNZ-Off_Titlecardtext ; CNZ Titlecard 0C
 +
dc.w  Text_CPZ-Off_Titlecardtext ; CPZ Titlecard 0D
 +
dc.w  Text_DEZ-Off_Titlecardtext ; DEZ Titlecard 0E
 +
dc.w  Text_ARZ-Off_Titlecardtext ; ARZ Titlecard 0F
 +
dc.w  Text_SCZ-Off_Titlecardtext ; SCZ Titlecard 10
 +
dc.w  Text_GHZ-Off_Titlecardtext ; EHZ Titlecard 11
 +
dc.w  Text_GHZ-Off_Titlecardtext ; EHZ Titlecard 12
 +
dc.w  Text_WPZ-Off_Titlecardtext ; EHZ Titlecard 13
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 14
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 15
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 16
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 17
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 18
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 19
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 1A
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 1B
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 1C
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 1D
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 1E
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 1F
 +
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 20
 +
 
 +
;word_15832
 +
Text_EHZ: dc.w $2A06,$3804,$0004,$2604,$0C04,$1804,$1C02 ; 'MRALDHI'
 +
  dc.w $FFFF ; '<EOF>'
 +
Text_MTZ: dc.w $2A06,$4004,$3804,$3004,$2604,$1C02,$3C04 ; 'MTRPLIS'
 +
  dc.w $FFFF ; '<EOF>'
 +
Text_WFZ: dc.w $4C06,$1C02,$1404,$1004,$3804,$4004,$3C04 ; 'WIGFRTS'
 +
  dc.w $FFFF ; '<EOF>'
 +
Text_HTZ: dc.w $1804,$1C02,$2604,$4004,$3004 ; 'HILTP'
 +
  dc.w $FFFF ; '<EOF>'
 +
Text_HPZ: dc.w $1804,$1C02,$0C04,$3004,$0004,$2604,$0804 ; 'HIDPALCE'
 +
  dc.w $FFFF ; '<EOF>'
 +
Text_OOZ: dc.w $1C02,$2604,$0804,$0004 ; 'ILCAN'
 +
  dc.w $FFFF ; '<EOF>'
 +
Text_MCZ: dc.w $2A06,$5604,$3C04,$4004,$1C02,$0804,$0004,$4804 ; 'MYSTICAV'
 +
  dc.w $FFFF ; '<EOF>'
 +
Text_CNZ: dc.w $0804,$0004,$3C04,$1C02,$1404,$1804,$4004 ; 'CASIGHT'
 +
  dc.w $FFFF ; '<EOF>'
 +
Text_CPZ: dc.w $0804,$1804,$2A06,$1C02,$0004,$2604,$3004,$4004 ; 'CHMICALPT'
 +
  dc.w $FFFF ; '<EOF>'
 +
Text_DEZ: dc.w $0C04,$0004,$4004,$1804,$1404 ; 'DATHG'
 +
  dc.w $FFFF ; '<EOF>'
 +
Text_ARZ: dc.w $0004,$3404,$4404,$4004,$1C02,$0804,$3804 ; 'AQUTICR'
 +
  dc.w $FFFF ; '<EOF>'
 +
Text_SCZ: dc.w $3C04,$2204,$5604,$0804,$1804,$0004,$3C04 ; 'SKYCHAS'
 +
  dc.w $FFFF ; '<EOF>'
 +
</asm>
 +
 
 +
''Point Fix'': This data manager, as implemented, doesn't work with a byte-string data. If you tried to use that byte-string data, you've noticed weird names. For example, Emerald Hill became Emepqrs T?rr.
 +
 
 +
This adds the basic card configuration to our new levels. You can freely edit the entries of this table to suit your needs.
 +
 
 +
===Extending Specific Data Configuration===
 +
Now, find:
 +
<asm>
 +
; -------------------------------------------------------------------------------
 +
; sprite mappings
 +
; -------------------------------------------------------------------------------
 +
Obj34_MapUnc_147BA: BINCLUDE "mappings/sprite/obj34.bin"
 +
; -------------------------------------------------------------------------------
 +
</asm>
 +
 
 +
If you check the routine of Obj34, you will see this is called from anywhere it is in the ROM. Thus, we can shift this data to another place we can edit it without any code interference. I can suggest you two locations for editing: the first is the end of the disassembly. The second is the end of the header. We will use here the end of disassembly.
 +
 
 +
Now, comment that line above and put this at the end of your disassembly:
 +
<asm>
 +
; -------------------------------------------------------------------------------
 +
; sprite mappings
 +
; -------------------------------------------------------------------------------
 +
Obj34_MapUnc_147BA:
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 00
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 01
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 02
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 03
 +
dc.w Titlecard_MTZ-Obj34_MapUnc_147BA ; MTZ 04
 +
dc.w Titlecard_MTZ-Obj34_MapUnc_147BA ; MTZ 05
 +
dc.w Titlecard_WFZ-Obj34_MapUnc_147BA ; WFZ 06
 +
dc.w Titlecard_HTZ-Obj34_MapUnc_147BA ; HTZ 07
 +
dc.w Titlecard_HTZ-Obj34_MapUnc_147BA ; HTZ 08
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 09
 +
dc.w Titlecard_OOZ-Obj34_MapUnc_147BA ; OOZ 0A
 +
dc.w Titlecard_MCZ-Obj34_MapUnc_147BA ; MCZ 0B
 +
dc.w Titlecard_CNZ-Obj34_MapUnc_147BA ; CNZ 0C
 +
dc.w Titlecard_CPZ-Obj34_MapUnc_147BA ; CPZ 0D
 +
dc.w Titlecard_DEZ-Obj34_MapUnc_147BA ; DEZ 0E
 +
dc.w Titlecard_ARZ-Obj34_MapUnc_147BA ; ARZ 0F
 +
dc.w Titlecard_SCZ-Obj34_MapUnc_147BA ; SCZ 10
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 11
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 12
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 13
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 14
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 15
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 16
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 17
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 18
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 19
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 1A
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 1B
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 1C
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 1D
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 1E
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 1F
 +
dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 20
 +
dc.w T_ZONE-Obj34_MapUnc_147BA ; "ZONE"
 +
dc.w T_ACT1-Obj34_MapUnc_147BA ; "1"
 +
dc.w T_ACT2-Obj34_MapUnc_147BA ; "2"
 +
dc.w T_ACT3-Obj34_MapUnc_147BA ; "3"
 +
dc.w T_STH-Obj34_MapUnc_147BA ; "SONIC THE HEDGEHOG"
 +
dc.w T_STRIPEDGE-Obj34_MapUnc_147BA ; ">"
 +
 
 +
TitleCard_EHZ:
 +
dc.w $b ; number of letters
 +
dc.w $0005, $8580, $82C0, $FFC0 ;E
 +
dc.w $0009, $85DE, $82EF, $FFD0 ;M
 +
dc.w $0005, $8580, $82C0, $FFE8 ;E
 +
dc.w $0005, $85E4, $82F2, $FFF8 ;R
 +
dc.w $0005, $85E8, $82F4, $0008 ;A
 +
dc.w $0005, $85EC, $82F6, $0018 ;L
 +
dc.w $0005, $85F0, $82F8, $0028 ;D
 +
 +
dc.w $0005, $85F4, $82FA, $0048 ;H
 +
dc.w $0001, $85F8, $82F2, $0058 ;I
 +
dc.w $0005, $85EC, $82F6, $0060 ;L
 +
dc.w $0005, $85EC, $82F6, $0070 ;L
 +
 +
 +
TitleCard_MTZ:
 +
dc.w $a ; number of letters
 +
dc.w $0009, $85DE, $82EF, $FFE0 ;M
 +
dc.w $0005, $8580, $82C0, $FFF8 ;E
 +
dc.w $0005, $85E4, $82F2, $0008 ;T
 +
dc.w $0005, $85E8, $82F4, $0018 ;R
 +
dc.w $0005, $8588, $82C4, $0028 ;O
 +
dc.w $0005, $85EC, $82F6, $0038 ;P
 +
dc.w $0005, $8588, $82C4, $0048 ;O
 +
dc.w $0005, $85F0, $82F8, $0058 ;L
 +
dc.w $0001, $85F4, $82FA, $0068 ;I
 +
dc.w $0005, $85F6, $82FB, $0070 ;S
 +
 +
TitleCard_WFZ:
 +
dc.w $c ; number of letters
 +
dc.w $0009, $85DE, $82EF, $FFB0 ;W
 +
dc.w $0001, $85E4, $82F2, $FFC8 ;I
 +
dc.w $0005, $8584, $82C2, $FFD0 ;N
 +
dc.w $0005, $85E6, $82F3, $FFE0 ;G
 +
 +
dc.w $0005, $85EA, $82F5, $0000 ;F
 +
dc.w $0005, $8588, $82C4, $0010 ;O
 +
dc.w $0005, $85EE, $82F7, $0020 ;R
 +
dc.w $0005, $85F2, $82F9, $0030 ;T
 +
dc.w $0005, $85EE, $82F7, $0040 ;R
 +
dc.w $0005, $8580, $82C0, $0050 ;E
 +
dc.w $0005, $85F6, $82FB, $0060 ;S
 +
dc.w $0005, $85F6, $82FB, $0070 ;S
 +
 +
TitleCard_HTZ:
 +
dc.w $7 ; number of letters
 +
dc.w $0005, $85DE, $82EF, $0008 ;H
 +
dc.w $0001, $85E2, $82F1, $0018 ;I
 +
dc.w $0005, $85E4, $82F2, $0020 ;L
 +
dc.w $0005, $85E4, $82F2, $0030 ;L
 +
 +
dc.w $0005, $85E8, $82F4, $0050 ;T
 +
dc.w $0005, $8588, $82C4, $0060 ;O
 +
dc.w $0005, $85EC, $82F6, $0070 ;P
 +
 +
TitleCard_HPZ:
 +
dc.w $c ; number of letters
 +
dc.w $0005, $85DE, $82EF, $FFB8 ;H
 +
dc.w $0001, $85E2, $82F1, $FFC8 ;I
 +
dc.w $0005, $85E4, $82F2, $FFD0 ;D
 +
dc.w $0005, $85E4, $82F2, $FFE0 ;D
 +
dc.w $0005, $8580, $82C0, $FFF0 ;E
 +
dc.w $0005, $8584, $82C4, $0000 ;N
 +
 +
dc.w $0005, $85E8, $82F4, $0020 ;P
 +
dc.w $0005, $85EC, $82F6, $0030 ;A
 +
dc.w $0005, $85F0, $82F8, $0040 ;L
 +
dc.w $0005, $85EC, $82F6, $0050 ;A
 +
dc.w $0005, $85F4, $82FA, $0060 ;C
 +
dc.w $0005, $8580, $82C0, $0070 ;E
 +
 +
TitleCard_OOZ:
 +
dc.w $8 ; number of letters
 +
dc.w $0005, $8588, $82C4, $FFF8 ;O
 +
dc.w $0001, $85DE, $82EF, $0008 ;I
 +
dc.w $0005, $85E0, $82F0, $0010 ;L
 +
 +
dc.w $0005, $8588, $82C4, $0030 ;O
 +
dc.w $0005, $85E4, $82F2, $0040 ;C
 +
dc.w $0005, $8580, $82C0, $0050 ;E
 +
dc.w $0005, $85E8, $82F4, $0060 ;A
 +
dc.w $0005, $8584, $82C2, $0070 ;N
 +
 +
TitleCard_MCZ:
 +
dc.w $a ; number of letters
 +
dc.w $0009, $85DE, $82EF, $FFD0 ;M
 +
dc.w $0005, $85E4, $82F2, $FFE8 ;Y
 +
dc.w $0005, $85E8, $82F4, $FFF8 ;S
 +
dc.w $0005, $85EC, $82F6, $0008 ;T
 +
dc.w $0001, $85F0, $82F8, $0018 ;I
 +
dc.w $0005, $85F2, $82F9, $0020 ;C
 +
 +
dc.w $0005, $85F2, $82F9, $0040 ;C
 +
dc.w $0005, $85F6, $82FB, $0050 ;A
 +
dc.w $0005, $85FA, $82FD, $0060 ;V
 +
dc.w $0005, $8580, $82C0, $0070 ;E
 +
 +
TitleCard_CNZ:
 +
dc.w $b ; number of letters
 +
dc.w $0005, $85DE, $82EF, $FFD0 ;C
 +
dc.w $0005, $85E2, $82F1, $FFE0 ;A
 +
dc.w $0005, $85E6, $82F3, $FFF0 ;S
 +
dc.w $0001, $85EA, $82F5, $0000 ;I
 +
dc.w $0005, $8584, $82C2, $0008 ;N
 +
dc.w $0005, $8588, $82C4, $0018 ;O
 +
 +
dc.w $0005, $8584, $82C2, $0038 ;N
 +
dc.w $0001, $85EA, $82F5, $0048 ;I
 +
dc.w $0005, $85EC, $82F6, $0050 ;G
 +
dc.w $0005, $85F0, $82F8, $0060 ;H
 +
dc.w $0005, $85F4, $82FA, $0070 ;T
 +
 +
TitleCard_CPZ:
 +
dc.w $d ; number of letters
 +
dc.w $0005, $85DE, $82EF, $FFA0 ;C
 +
dc.w $0005, $85E2, $82F1, $FFB0 ;H
 +
dc.w $0005, $8580, $82C0, $FFC0 ;E
 +
dc.w $0009, $85E6, $82F3, $FFD0 ;M
 +
dc.w $0001, $85EC, $82F6, $FFE8 ;I
 +
dc.w $0005, $85DE, $82EF, $FFF0 ;C
 +
dc.w $0005, $85EE, $82F7, $0000 ;A
 +
dc.w $0005, $85F2, $82F9, $0010 ;L
 +
 +
dc.w $0005, $85F6, $82FB, $0030 ;P
 +
dc.w $0005, $85F2, $82F9, $0040 ;L
 +
dc.w $0005, $85EE, $82F7, $0050 ;A
 +
dc.w $0005, $8584, $82C2, $0060 ;N
 +
dc.w $0005, $85FA, $82FD, $0070 ;T
 +
 +
TitleCard_DEZ:
 +
dc.w $8 ; number of letters
 +
dc.w $0005, $85DE, $82EF, $FFF0 ;D
 +
dc.w $0005, $8580, $82C0, $0000 ;E
 +
dc.w $0005, $85E2, $82F1, $0010 ;A
 +
dc.w $0005, $85E6, $82F3, $0020 ;T
 +
dc.w $0005, $85EA, $82F5, $0030 ;H
 +
 +
dc.w $0005, $8580, $82C0, $0050 ;E
 +
dc.w $0005, $85EE, $82F7, $0060 ;G
 +
dc.w $0005, $85EE, $82F7, $0070 ;G
 +
 +
TitleCard_ARZ:
 +
dc.w $b ; number of letters
 +
dc.w $0005, $85DE, $82EF, $FFD0 ;A
 +
dc.w $0005, $85E2, $82F1, $FFE0 ;Q
 +
dc.w $0005, $85E6, $82F3, $FFF0 ;U
 +
dc.w $0005, $85DE, $82EF, $0000 ;A
 +
dc.w $0005, $85EA, $82F5, $0010 ;T
 +
dc.w $0001, $85EE, $82F7, $0020 ;I
 +
dc.w $0005, $85F0, $82F8, $0028 ;C
 +
 +
dc.w $0005, $85F4, $82FA, $0048 ;R
 +
dc.w $0005, $85E6, $82F3, $0058 ;U
 +
dc.w $0001, $85EE, $82F7, $0068 ;I
 +
dc.w $0005, $8584, $82C2, $0070 ;N
 +
 +
TitleCard_SCZ:
 +
dc.w $8 ; number of letters
 +
dc.w $0005, $85DE, $82EF, $FFF0 ;S
 +
dc.w $0005, $85E2, $82F1, $0000 ;K
 +
dc.w $0005, $85E6, $82F3, $0010 ;Y
 +
 +
dc.w $0005, $85EA, $82F5, $0030 ;C
 +
dc.w $0005, $85EE, $82F7, $0040 ;H
 +
dc.w $0005, $85F2, $82F7, $0050 ;A
 +
dc.w $0005, $85DE, $82EF, $0060 ;S
 +
dc.w $0005, $8580, $82C0, $0070 ;E
 +
 +
T_ZONE:
 +
dc.w $4 ; number of letters
 +
dc.w $0005, $858C, $82C6, $0000 ;Z
 +
dc.w $0005, $8588, $82C4, $0010 ;O
 +
dc.w $0005, $8584, $82C2, $0020 ;N
 +
dc.w $0005, $8580, $82C0, $0030 ;E
 +
 +
T_ACT1:
 +
dc.w $1 ; number of letters
 +
dc.w $0007, $A590, $A2C8, $0000 ;1
 +
 +
T_ACT2:
 +
dc.w $1 ; number of letters
 +
dc.w $000B, $A598, $A2CC, $0000 ;2
 +
 +
T_ACT3:
 +
dc.w $1 ; number of letters
 +
dc.w $000B, $A5A4, $A2D2, $0000 ;3
 +
 +
T_STH:
 +
dc.w $5 ; number of letters
 +
dc.w $000D, $85B0, $82DE, $FFB8 ;SONI
 +
dc.w $000D, $85B8, $82DC, $FFD8 ;C TH
 +
dc.w $000D, $85C0, $82E0, $FFF8 ;E HE
 +
dc.w $000D, $85C8, $82E4, $0018 ;DGEH
 +
dc.w $0005, $85D0, $82E8, $0038 ;OG
 +
 +
T_STRIPEDGE:
 +
dc.w $7 ; number of letters
 +
dc.w $9003, $85D4, $82EA, $0000 ;>
 +
dc.w $B003, $85D4, $82EA, $0000 ;>
 +
dc.w $D003, $85D4, $82EA, $0000 ;>
 +
dc.w $F003, $85D4, $82EA, $0000 ;>
 +
dc.w $1003, $85D4, $82EA, $0000 ;>
 +
dc.w $3003, $85D4, $82EA, $0000 ;>
 +
dc.w $5003, $85D4, $82EA, $0000 ;>
 +
; ==================================================================
 +
</asm>
 +
 
 +
To avoid alignment problems, add this line before and after the code above:
 +
 
 +
<asm>
 +
    align $200
 +
</asm>
 +
 
 +
==Extending the Palette Cycle information==
 +
Now we want to locate:
 +
<asm>
 +
; off_19F4:
 +
PalCycle:
 +
dc.w PalCycle_EHZ - PalCycle ; 0
 +
dc.w PalCycle_Null - PalCycle ; 1
 +
dc.w PalCycle_Level2 - PalCycle ; 2
 +
dc.w PalCycle_Null - PalCycle ; 3
 +
dc.w PalCycle_MTZ - PalCycle ; 4
 +
dc.w PalCycle_MTZ - PalCycle ; 5
 +
dc.w PalCycle_WFZ - PalCycle ; 6
 +
dc.w PalCycle_HTZ - PalCycle ; 7
 +
dc.w PalCycle_HPZ - PalCycle ; 8
 +
dc.w PalCycle_Null - PalCycle ; 9
 +
dc.w PalCycle_OOZ - PalCycle ; 10
 +
dc.w PalCycle_MCZ - PalCycle ; 11
 +
dc.w PalCycle_CNZ - PalCycle ; 12
 +
dc.w PalCycle_CPZ - PalCycle ; 13
 +
dc.w PalCycle_CPZ - PalCycle ; 14
 +
dc.w PalCycle_ARZ - PalCycle ; 15
 +
dc.w PalCycle_WFZ - PalCycle ; 16
 +
</asm>
 +
 
 +
and replace it with:
 +
<asm>
 +
; off_19F4:
 +
PalCycle:
 +
dc.w PalCycle_EHZ - PalCycle ; 00
 +
dc.w PalCycle_Null - PalCycle ; 01
 +
dc.w PalCycle_Level2 - PalCycle ; 02
 +
dc.w PalCycle_Null - PalCycle ; 03
 +
dc.w PalCycle_MTZ - PalCycle ; 04
 +
dc.w PalCycle_MTZ - PalCycle ; 05
 +
dc.w PalCycle_WFZ - PalCycle ; 06
 +
dc.w PalCycle_HTZ - PalCycle ; 07
 +
dc.w PalCycle_HPZ - PalCycle ; 08
 +
dc.w PalCycle_Null - PalCycle ; 09
 +
dc.w PalCycle_OOZ - PalCycle ; 0A
 +
dc.w PalCycle_MCZ - PalCycle ; 0B
 +
dc.w PalCycle_CNZ - PalCycle ; 0C
 +
dc.w PalCycle_CPZ - PalCycle ; 0D
 +
dc.w PalCycle_CPZ - PalCycle ; 0E
 +
dc.w PalCycle_ARZ - PalCycle ; 0F
 +
dc.w PalCycle_WFZ - PalCycle ; 10
 +
dc.w PalCycle_Null - PalCycle ; 11
 +
dc.w PalCycle_Null - PalCycle ; 12
 +
dc.w PalCycle_Null - PalCycle ; 13
 +
dc.w PalCycle_Null - PalCycle ; 14
 +
dc.w PalCycle_Null - PalCycle ; 15
 +
dc.w PalCycle_Null - PalCycle ; 16
 +
dc.w PalCycle_Null - PalCycle ; 17
 +
dc.w PalCycle_Null - PalCycle ; 18
 +
dc.w PalCycle_Null - PalCycle ; 19
 +
dc.w PalCycle_Null - PalCycle ; 1A
 +
dc.w PalCycle_Null - PalCycle ; 1B
 +
dc.w PalCycle_Null - PalCycle ; 1C
 +
dc.w PalCycle_Null - PalCycle ; 1D
 +
dc.w PalCycle_Null - PalCycle ; 1E
 +
dc.w PalCycle_Null - PalCycle ; 1F
 +
dc.w PalCycle_Null - PalCycle ; 20
 +
</asm>
 +
 
 +
That inserts empty slots for the cycling palettes of out new levels.
 +
 
 +
==Extending the static palette list==
 +
Next we locate:
 +
<asm>
 +
PalPointers:
 +
palptr Pal_SEGA,  Normal_palette, $1F
 +
palptr Pal_Title, Normal_palette_line2, 7
 +
palptr Pal_UNK1,  Normal_palette, $1F
 +
palptr Pal_BGND,  Normal_palette, $F
 +
palptr Pal_EHZ,  Normal_palette_line2, $17
 +
palptr Pal_EHZ,  Normal_palette_line2, $17
 +
palptr Pal_WZ,    Normal_palette_line2, $17
 +
palptr Pal_EHZ,  Normal_palette_line2, $17
 +
palptr Pal_MTZ,  Normal_palette_line2, $17
 +
palptr Pal_MTZ,  Normal_palette_line2, $17
 +
palptr Pal_WFZ,  Normal_palette_line2, $17
 +
palptr Pal_HTZ,  Normal_palette_line2, $17
 +
palptr Pal_HPZ,  Normal_palette_line2, $17
 +
palptr Pal_EHZ,  Normal_palette_line2, $17
 +
palptr Pal_OOZ,  Normal_palette_line2, $17
 +
palptr Pal_MCZ,  Normal_palette_line2, $17
 +
palptr Pal_CNZ,  Normal_palette_line2, $17
 +
palptr Pal_CPZ,  Normal_palette_line2, $17
 +
palptr Pal_DEZ,  Normal_palette_line2, $17
 +
palptr Pal_ARZ,  Normal_palette_line2, $17
 +
palptr Pal_SCZ,  Normal_palette_line2, $17
 +
palptr Pal_HPZ_U, Normal_palette, $1F
 +
palptr Pal_CPZ_U, Normal_palette, $1F
 +
palptr Pal_ARZ_U, Normal_palette, $1F
 +
palptr Pal_SS,    Normal_palette, $17
 +
palptr Pal_UNK2,  Normal_palette_line2, 7
 +
palptr Pal_UNK3,  Normal_palette_line2, 7
 +
palptr Pal_SS1,  Normal_palette_line4, 7
 +
palptr Pal_SS2,  Normal_palette_line4, 7
 +
palptr Pal_SS3,  Normal_palette_line4, 7
 +
palptr Pal_SS4,  Normal_palette_line4, 7
 +
palptr Pal_SS5,  Normal_palette_line4, 7
 +
palptr Pal_SS6,  Normal_palette_line4, 7
 +
palptr Pal_SS7,  Normal_palette_line4, 7
 +
palptr Pal_UNK4,  Normal_palette_line4, 7
 +
palptr Pal_UNK5,  Normal_palette_line4, 7
 +
palptr Pal_UNK6,  Normal_palette_line4, 7
 +
palptr Pal_OOZ_B, Normal_palette_line2, 7
 +
palptr Pal_Menu,  Normal_palette, $1F
 +
palptr Pal_UNK7,  Normal_palette, $1F  ; palette index $27.
 +
 
 +
; ----------------------------------------------------------------------------
 +
</asm>
 +
 
 +
We all know that the palettes are directly addressed here. It means the index above can detect palettes anywhere in the ROM.
 +
This label, PalPointers, is called directly. We can, then, move this table to any location we want it in the ROM. Put this after:
 +
 
 +
<asm>
 +
    EndOfHeader:
 +
</asm>
 +
 
 +
And after this table, put the following line to avoid alignment errors:
 +
 
 +
<asm>
 +
    align $200
 +
</asm>
 +
 
 +
You can add more indexes to this table this way:
 +
<asm>
 +
palptr Palette,  Normal_palette_line2, $17
 +
</asm>
 +
 
 +
for a normal level palette, and, for a underwater level palette, you will add the normal palette for that level and its underwater palette.
 +
<asm>
 +
palptr UnderwaterPalette,  Normal_palette_line, $1F
 +
</asm>
 +
 
 +
You must only have attention when adding more palettes to don't overflow the palette index (yes, it is possible to have 255 palettes...).
 +
 
 +
==Extending Zone Procedures and Scripts==
 +
Now we need to add the zone scripts.
 +
 
 +
Find:
 +
<asm>
 +
PLC_DYNANM: ; Zone ID
 +
dc.w Dynamic_Normal-PLC_DYNANM ; $00
 +
dc.w Animated_EHZ-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM ; $01
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM ; $02
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM ; $03
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Normal-PLC_DYNANM ; $04
 +
dc.w Animated_MTZ-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Normal-PLC_DYNANM ; $05
 +
dc.w Animated_MTZ-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM ; $06
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_HTZ-PLC_DYNANM ; $07
 +
dc.w Animated_HTZ-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Normal-PLC_DYNANM ; $08
 +
dc.w Animated_OOZ-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM ; $09
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Normal-PLC_DYNANM ; $0A
 +
dc.w Animated_OOZ2-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM ; $0B
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_CNZ-PLC_DYNANM ; $0C
 +
dc.w Animated_CNZ-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Normal-PLC_DYNANM ; $0D
 +
dc.w Animated_CPZ-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Normal-PLC_DYNANM ; $0F
 +
dc.w Animated_DEZ-PLC_DYNANM
 +
 
 +
dc.w Dynamic_ARZ-PLC_DYNANM ; $10
 +
dc.w Animated_ARZ-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM ; $11
 +
dc.w Animated_Null-PLC_DYNANM ; yes, level $11
 +
</asm>
 +
 
 +
and add to the end of it:
 +
<asm>
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
 
 +
dc.w Dynamic_Null-PLC_DYNANM
 +
dc.w Animated_Null-PLC_DYNANM
 +
</asm>
 +
 
 +
This creates scripts for the new levels. To make complex animations (like the HPZ pulsing ball) you will need to create a Anim*level*.bin and add it to the Anim*level*.bin files and add it to the animated pattern mappings. See the section below.
 +
 
 +
==Extending Animated Pattern Mappings==
 +
Find:
 +
<asm>
 +
AnimPatMaps:
 +
dc.w APM16_EHZ - AnimPatMaps ;  0
 +
dc.w APM_Null - AnimPatMaps  ;  1
 +
dc.w APM_Null - AnimPatMaps  ;  2
 +
dc.w APM_Null - AnimPatMaps  ;  3
 +
dc.w APM16_MTZ - AnimPatMaps ;  4
 +
dc.w APM16_MTZ - AnimPatMaps ;  5
 +
dc.w APM_Null - AnimPatMaps  ;  6
 +
dc.w APM16_EHZ - AnimPatMaps ;  7
 +
dc.w APM_HPZ - AnimPatMaps  ;  8
 +
dc.w APM_Null - AnimPatMaps  ;  9
 +
dc.w APM_OOZ - AnimPatMaps  ; $A
 +
dc.w APM_Null - AnimPatMaps  ; $B
 +
dc.w APM_CNZ - AnimPatMaps  ; $C
 +
dc.w APM_CPZ - AnimPatMaps  ; $D
 +
dc.w APM_DEZ - AnimPatMaps  ; $E
 +
dc.w APM_ARZ - AnimPatMaps  ; $F
 +
dc.w APM_Null - AnimPatMaps  ;$10
 +
</asm>
 +
 
 +
then add this to the end of this index:
 +
<asm>
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
dc.w APM_Null - AnimPatMaps
 +
</asm>
 +
 
 +
then edit and change as needed. Add the new .bin files to below here:
 +
<asm>
 +
; byte_40372:
 +
APM16_EHZ: BINCLUDE "mappings/16x16/AnimEHZ.bin"
 +
 
 +
; byte_403EE:
 +
APM16_MTZ: BINCLUDE "mappings/16x16/AnimMTZ.bin"
 +
 
 +
; byte_404C2:
 +
APM_HPZ: BINCLUDE "mappings/16x16/AnimHPZ.bin"
 +
 
 +
; byte_405B6:
 +
APM_OOZ: BINCLUDE "mappings/16x16/AnimOOZ.bin"
 +
 
 +
; byte_4061A:
 +
APM_CNZ: BINCLUDE "mappings/16x16/AnimCNZ.bin"
 +
 
 +
; byte_406BE:
 +
APM_CNZ2P: BINCLUDE "mappings/16x16/AnimCNZ2P.bin"
 +
 
 +
; byte_40762:
 +
APM_CPZ: BINCLUDE "mappings/16x16/AnimCPZ.bin"
 +
 
 +
; byte_4076E:
 +
APM_DEZ: BINCLUDE "mappings/16x16/AnimDEZ.bin"
 +
 
 +
; byte_4077A:
 +
APM_ARZ: BINCLUDE "mappings/16x16/AnimARZ.bin"
 +
 
 +
; byte_407BE:
 +
APM_Null: dc.w  0
 +
</asm>
 +
 
 +
and fit this table to suit your needs, creating the necessary load queries for them. (If so, you need to know what you're doing here.)
 +
 
 +
==Extending the 1 Player and 2 Player music playlists==
 +
To avoid some code-breaking problems (branches), we will fix this using a different way.
 +
 
 +
Go to EndOfHeader. If you are really following this tutorial, you've put a PalPointers table there. You will add between those two labels the following procedure:
 +
<asm>
 +
DefineLevelBGM:
 +
moveq    #0,d0
 +
move.b    (Current_Zone).w,d0
 +
lea    (NormalMusicList).l,a1
 +
tst.w    (Two_Player_Mode).w
 +
beq.s    PlayNormalMusic
 +
lea    (MusicList2PMode).l,a1
 +
 
 +
PlayNormalMusic:
 +
move.b    (a1,d0.w),d0
 +
move.w    d0,(Level_Music).w
 +
bsr.w    JTR_PlayMusic
 +
jmp    Level_TtlCard
 +
rts
 +
 
 +
JTR_PlayMusic:
 +
jmp    PlayMusic
 +
rts
 +
 
 +
NormalMusicList:
 +
    dc.b    $82    ;00
 +
    dc.b    $82    ;01
 +
    dc.b    $82    ;02
 +
    dc.b    $82    ;03
 +
    dc.b    $85    ;04
 +
    dc.b    $85    ;05
 +
    dc.b    $8F    ;06
 +
    dc.b    $86    ;07
 +
    dc.b    $90    ;08
 +
    dc.b    $82    ;09
 +
    dc.b    $84    ;0A
 +
    dc.b    $8B    ;0B
 +
    dc.b    $89    ;0C
 +
    dc.b    $8E    ;0D
 +
    dc.b    $8A    ;0E
 +
    dc.b    $87    ;0F
 +
    dc.b    $8D    ;10
 +
    dc.b    $82    ;11
 +
    dc.b    $82    ;12
 +
    dc.b    $82    ;13
 +
    dc.b    $82    ;14
 +
    dc.b    $82    ;15
 +
    dc.b    $82    ;16
 +
    dc.b    $82    ;17
 +
    dc.b    $82    ;18
 +
    dc.b    $82    ;19
 +
    dc.b    $82    ;1A
 +
    dc.b    $82    ;1B
 +
    dc.b    $82    ;1C
 +
    dc.b    $82    ;1D
 +
    dc.b    $82    ;1E
 +
    dc.b    $82    ;1F
 +
    dc.b    $82    ;20
 +
 
 +
    align 4
 +
 
 +
MusicList2PMode:
 +
    dc.b    $8C    ;00
 +
    dc.b    $82    ;01
 +
    dc.b    $82    ;02
 +
    dc.b    $82    ;03
 +
    dc.b    $85    ;04
 +
    dc.b    $85    ;05
 +
    dc.b    $8F    ;06
 +
    dc.b    $86    ;07
 +
    dc.b    $90    ;08
 +
    dc.b    $82    ;09
 +
    dc.b    $84    ;0A
 +
    dc.b    $83    ;0B
 +
    dc.b    $88    ;0C
 +
    dc.b    $8E    ;0D
 +
    dc.b    $8A    ;0E
 +
    dc.b    $87    ;0F
 +
    dc.b    $8D    ;10
 +
    dc.b    $82    ;11
 +
    dc.b    $82    ;12
 +
    dc.b    $82    ;13
 +
    dc.b    $82    ;14
 +
    dc.b    $82    ;15
 +
    dc.b    $82    ;16
 +
    dc.b    $82    ;17
 +
    dc.b    $82    ;18
 +
    dc.b    $82    ;19
 +
    dc.b    $82    ;1A
 +
    dc.b    $82    ;1B
 +
    dc.b    $82    ;1C
 +
    dc.b    $82    ;1D
 +
    dc.b    $82    ;1E
 +
    dc.b    $82    ;1F
 +
    dc.b    $82    ;20
 +
 
 +
    align $200
 +
</asm>
 +
 
 +
Now, go to Level_GetBGM. You will see this:
 +
<asm>
 +
; loc_40AE:
 +
Level_GetBgm:
 +
tst.w (Demo_mode_flag).w
 +
bmi.s loc_4114
 +
moveq #0,d0
 +
move.b (Current_Zone).w,d0
 +
lea MusicList(pc),a1
 +
tst.w (Two_player_mode).w
 +
beq.s Level_PlayBgm
 +
lea MusicList2(pc),a1
 +
</asm>
 +
 
 +
and replace it with:
 +
<asm>
 +
; loc_40AE:
 +
Level_GetBgm:
 +
tst.w (Demo_mode_flag).w
 +
bmi.s loc_4114
 +
jmp    DefineLevelBGM
 +
</asm>
 +
 
 +
==Extending the demo list==
 +
now we will prepare everything so that we can put in new demo files for our new levels.
 +
 
 +
find:
 +
<asm>; off_4948:
 +
DemoScriptPointers:
 +
dc.l Demo_EHZ ; $00
 +
dc.l Demo_EHZ ; $01
 +
dc.l Demo_EHZ ; $02
 +
dc.l Demo_EHZ ; $03
 +
dc.l Demo_EHZ ; $04
 +
dc.l Demo_EHZ ; $05
 +
dc.l Demo_EHZ ; $06
 +
dc.l Demo_EHZ ; $07
 +
dc.l Demo_EHZ ; $08
 +
dc.l Demo_EHZ ; $09
 +
dc.l Demo_EHZ ; $0A
 +
dc.l Demo_EHZ ; $0B
 +
dc.l Demo_CNZ ; $0C
 +
dc.l Demo_CPZ ; $0D
 +
dc.l Demo_EHZ ; $0E
 +
dc.l Demo_ARZ ; $0F
 +
dc.l Demo_EHZ ; $10
 +
</asm>
 +
 
 +
and insert after it:
 +
<asm>
 +
dc.l Demo_EHZ ; $11
 +
dc.l Demo_EHZ ; $12
 +
dc.l Demo_EHZ ; $13
 +
dc.l Demo_EHZ ; $14
 +
dc.l Demo_EHZ ; $15
 +
dc.l Demo_EHZ ; $16
 +
dc.l Demo_EHZ ; $17
 +
dc.l Demo_EHZ ; $18
 +
dc.l Demo_EHZ ; $19
 +
dc.l Demo_EHZ ; $1A
 +
dc.l Demo_EHZ ; $1B
 +
dc.l Demo_EHZ ; $1C
 +
dc.l Demo_EHZ ; $1D
 +
dc.l Demo_EHZ ; $1E
 +
dc.l Demo_EHZ ; $1F
 +
dc.l Demo_EHZ ; $20
 +
</asm>
 +
 
 +
==Extending the Collision index==
 +
You would want solidity in your new zones, wouldn't you?  Here we will extend the solidity list so that our extra levels can have solid ground for that blue hedgehog to walk on.
 +
 
 +
Well. We will fit, first, the collision procedure. This way, we can merge both tables into only one.
 +
 
 +
Find:
 +
<asm>
 +
LoadCollisionIndexes:
 +
moveq #0,d0
 +
move.b (Current_Zone).w,d0
 +
lsl.w #2,d0
 +
move.l #Primary_Collision,(Collision_addr).w
 +
move.w d0,-(sp)
 +
movea.l Off_ColP(pc,d0.w),a0
 +
lea (Primary_Collision).w,a1
 +
bsr.w KosDec
 +
move.w (sp)+,d0
 +
movea.l Off_ColS(pc,d0.w),a0
 +
lea (Secondary_Collision).w,a1
 +
bra.w KosDec
 +
</asm>
 +
 
 +
Now, replace it with this:
 +
<asm>
 +
moveq #0,d0
 +
move.b (Current_Zone).w,d0
 +
add.w    #1,d0; =pointer index: 1.
 +
add.w    d0,d0; =x2
 +
add.w    d0,d0; =x4
 +
add.w    d0,d0; =x8
 +
 
 +
move.l #Primary_Collision,(Collision_addr).w
 +
 
 +
movea.l Off_ColP(pc,d0.w),a0
 +
lea (Primary_Collision).w,a1
 +
bsr.w KosDec
 +
 
 +
movea.l Off_ColS(pc,d0.w),a0
 +
lea (Secondary_Collision).w,a1
 +
bsr.w KosDec
 +
</asm>
 +
 
 +
To fit the merged table with the existing labels, we will start indexing at pointer 1 instead of pointer 0. Now, we will create the new table.
 +
 
 +
Change:
 +
<asm>
 +
; ===========================================================================
 +
; ---------------------------------------------------------------------------
 +
; Pointers to primary collision indexes
 +
 
 +
; Contains an array of pointers to the primary collision index data for each
 +
; level. 1 pointer for each level, pointing the primary collision index.
 +
; ---------------------------------------------------------------------------
 +
Off_ColP:
 +
dc.l ColP_EHZHTZ
 +
dc.l Off_Level ; 1
 +
dc.l ColP_MTZ ; 2
 +
dc.l Off_Level ; 3
 +
dc.l ColP_MTZ ; 4
 +
dc.l ColP_MTZ ; 5
 +
dc.l ColP_WFZSCZ ; 6
 +
dc.l ColP_EHZHTZ ; 7
 +
dc.l ColP_OOZ ; 8
 +
dc.l Off_Level ; 9
 +
dc.l ColP_OOZ ; 10
 +
dc.l ColP_MCZ ; 11
 +
dc.l ColP_CNZ ; 12
 +
dc.l ColP_CPZDEZ ; 13
 +
dc.l ColP_CPZDEZ ; 14
 +
dc.l ColP_ARZ ; 15
 +
dc.l ColP_WFZSCZ ; 16
 +
dc.l ColP_EHZHTZ ;$11
 +
dc.l ColP_EHZHTZ ;$12
 +
dc.l ColP_EHZHTZ ;$13
 +
dc.l ColP_EHZHTZ ;$14
 +
dc.l ColP_EHZHTZ ;$15
 +
dc.l ColP_EHZHTZ ;$16
 +
dc.l ColP_EHZHTZ ;$17
 +
dc.l ColP_EHZHTZ ;$18
 +
dc.l ColP_EHZHTZ ;$19
 +
dc.l ColP_EHZHTZ ;$1A
 +
dc.l ColP_EHZHTZ ;$1B
 +
dc.l ColP_EHZHTZ ;$1C
 +
dc.l ColP_EHZHTZ ;$1D
 +
dc.l ColP_EHZHTZ ;$1E
 +
dc.l ColP_EHZHTZ ;$1F
 +
dc.l ColP_EHZHTZ ;$20
 +
; ---------------------------------------------------------------------------
 +
; Pointers to secondary collision indexes
 +
 
 +
; Contains an array of pointers to the secondary collision index data for
 +
; each level. 1 pointer for each level, pointing the secondary collision
 +
; index.
 +
; ---------------------------------------------------------------------------
 +
Off_ColS:
 +
dc.l ColS_EHZHTZ
 +
dc.l Off_Level ; 1
 +
dc.l ColP_MTZ ; 2
 +
dc.l Off_Level ; 3
 +
dc.l ColP_MTZ ; 4
 +
dc.l ColP_MTZ ; 5
 +
dc.l ColS_WFZSCZ ; 6
 +
dc.l ColS_EHZHTZ ; 7
 +
dc.l ColP_OOZ ; 8
 +
dc.l Off_Level ; 9
 +
dc.l ColP_OOZ ; 10
 +
dc.l ColP_MCZ ; 11
 +
dc.l ColS_CNZ ; 12
 +
dc.l ColS_CPZDEZ ; 13
 +
dc.l ColS_CPZDEZ ; 14
 +
dc.l ColS_ARZ ; 15
 +
dc.l ColS_WFZSCZ ; 16
 +
dc.l ColS_EHZHTZ ;$11
 +
dc.l ColS_EHZHTZ ;$12
 +
dc.l ColS_EHZHTZ ;$13
 +
dc.l ColS_EHZHTZ ;$14
 +
dc.l ColS_EHZHTZ ;$15
 +
dc.l ColS_EHZHTZ ;$16
 +
dc.l ColS_EHZHTZ ;$17
 +
dc.l ColS_EHZHTZ ;$18
 +
dc.l ColS_EHZHTZ ;$19
 +
dc.l ColS_EHZHTZ ;$1A
 +
dc.l ColS_EHZHTZ ;$1B
 +
dc.l ColS_EHZHTZ ;$1C
 +
dc.l ColS_EHZHTZ ;$1D
 +
dc.l ColS_EHZHTZ ;$1E
 +
dc.l ColS_EHZHTZ ;$1F
 +
dc.l ColS_EHZHTZ ;$20
 +
</asm>
 +
 
 +
To:
 +
<asm>
 +
Off_ColP:
 +
dc.l    0
 +
Off_ColS:
 +
dc.l    0
 +
CollisionData: ; this label is unnecessary, but we will use this just for educational issues.
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;00
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;01
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;02
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;03
 +
dc.l ColP_MTZ, ColP_MTZ ;04
 +
dc.l ColP_MTZ, ColP_MTZ ;05
 +
dc.l ColP_WFZSCZ, ColS_WFZSCZ ;06
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;07
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;08
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;09
 +
dc.l ColP_OOZ, ColP_OOZ ;0A
 +
dc.l ColP_MCZ, ColP_MCZ ;0B
 +
dc.l ColP_CNZ, ColS_CNZ ;0C
 +
dc.l ColP_CPZ, ColS_CPZ ;0D
 +
dc.l ColP_CPZ, ColS_CPZ ;0E
 +
dc.l ColP_ARZ, ColS_ARZ ;0F
 +
dc.l ColP_WFZSCZ, ColS_WFZSCZ ;10
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;11
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;12
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;13
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;14
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;15
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;16
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;17
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;18
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;19
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;1A
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;1B
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;1C
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;1D
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;1E
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;1F
 +
dc.l ColP_EHZHTZ, ColS_EHZHTZ ;20
 +
</asm>
 +
 
 +
Of course, you can get rid of Off_ColP and Off_ColS labels and indexes by commenting the line:
 +
 
 +
<asm>
 +
add.w    #1,d0
 +
</asm>
 +
 
 +
Changing Off_ColP to CollisionData and Off_ColS to CollisionData+4 in the procedure above.
 +
 
 +
==Extending Rings Index==
 +
Instead of doing the word-offset table, we will make a dynamic call routine, like collisions.
 +
Of course, we won´t work with compressed ring placement.
 +
 
 +
We find, initially:
 +
<asm>
 +
loc_172A4:
 +
clearRAM Ring_Positions,$600
 +
; d0 = 0
 +
lea ($FFFFEF80).w,a1
 +
move.w #bytesToLcnt($40),d1
 +
- move.l d0,(a1)+
 +
dbf d1,-
 +
 
 +
moveq #0,d5
 +
moveq #0,d0
 +
move.w (Current_ZoneAndAct).w,d0
 +
ror.b #1,d0
 +
lsr.w #6,d0
 +
lea (Off_Rings).l,a1
 +
move.w (a1,d0.w),d0
 +
lea (a1,d0.w),a1
 +
lea ($FFFFE806).w,a2
 +
 
 +
loc_172E0:
 +
</asm>
 +
 
 +
And change it to:
 +
<asm>
 +
loc_172A4:
 +
jmp CarregarAneis
 +
rts
 +
 
 +
loc_172E0:
 +
</asm>
 +
 
 +
Now, we put the following routine at a good place:
 +
<asm>
 +
align $40
 +
 
 +
CarregarAneis:
 +
clearRAM Ring_Positions,$600
 +
; d0 = 0
 +
lea ($FFFFEF80).w,a1
 +
move.w #bytesToLcnt($40),d1
 +
- move.l d0,(a1)+
 +
dbf d1,-
 +
 
 +
moveq #0,d5
 +
moveq #0,d0
 +
; convert zone/act data for an useable format, sequential
 +
move.w (Current_ZoneAndAct).w,d0
 +
 
 +
ror.b #1,d0
 +
lsr.w #6,d0 ;this yields an 8-byte jump.
 +
add.l d0,d0
 +
 
 +
movea.l RingData(pc,d0.l),a1 ; this allows ring data anywhere in the ROM.
 +
lea ($FFFFE806).w,a2
 +
jmp loc_172E0
 +
rts
 +
 +
RingData:
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;00
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;01
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;02
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;03
 +
dc.l Rings_MTZ_1, Rings_MTZ_2 ;04
 +
dc.l Rings_MTZ_3, Rings_MTZ_3 ;05
 +
dc.l Rings_WFZ_1, Rings_WFZ_1 ;06
 +
dc.l Rings_HTZ_1, Rings_HTZ_2 ;07
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;08
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;09
 +
dc.l Rings_OOZ_1, Rings_OOZ_2 ;0A
 +
dc.l Rings_MCZ_1, Rings_MCZ_2 ;0B
 +
dc.l Rings_CNZ_1, Rings_CNZ_2 ;0C
 +
dc.l Rings_CPZ_1, Rings_CPZ_2 ;0D
 +
dc.l Rings_DEZ_1, Rings_DEZ_1 ;0E
 +
dc.l Rings_ARZ_1, Rings_ARZ_2 ;0F
 +
dc.l Rings_SCZ_1, Rings_SCZ_1 ;10
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;11
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;12
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;13
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;14
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;15
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;16
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;17
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;18
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;19
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;1A
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;1B
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;1C
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;1D
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;1E
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;1F
 +
dc.l Rings_EHZ_1, Rings_EHZ_2 ;20
 +
 
 +
align $80
 +
</asm>
 +
 
 +
You can put this before PalPointers, if you relocated that table as described before.
 +
 
 +
This routine directly calls the desired ring placement, with no need of attaching them to the table, like the word-offset index does.
 +
 
 +
==Extending the object index==
 +
 
 +
We will make a similar extension for objects. Look for:
 +
<asm>
 +
loc_17AB8:
 +
addq.b #2,(Obj_placement_routine).w
 +
move.w (Current_ZoneAndAct).w,d0 ; If level == $0F (ARZ)...
 +
ror.b #1,d0 ; then this yields $87...
 +
lsr.w #6,d0 ; and this yields $0002.
 +
lea (Off_Objects).l,a0 ; Next, we load the first pointer in the object layout list pointer index,
 +
movea.l a0,a1 ; then copy it for quicker use later.
 +
adda.w (a0,d0.w),a0 ; (Point1 * 2) + $0002
 +
tst.w (Two_player_mode).w ; skip if not in 2-player vs mode
 +
beq.s loc_17AF0
 +
cmpi.b #$C,(Current_Zone).w ; skip if not Casino Night Zone
 +
bne.s loc_17AF0
 +
lea (Objects_CNZ1_2P).l,a0 ; CNZ 1 2-player object layout
 +
tst.b (Current_Act).w ; skip if not past act 1
 +
beq.s loc_17AF0
 +
lea (Objects_CNZ2_2P).l,a0 ; CNZ 2 2-player object layout
 +
 
 +
loc_17AF0:
 +
</asm>
 +
 
 +
And change that to:
 +
<asm>
 +
loc_17AB8:
 +
jmp CarregarObjetos
 +
rts
 +
 
 +
loc_17AF0:
 +
</asm>
 +
 
 +
Now, put this routine into a good place. If you relocated PalPointers like described before, put this before PalPointers:
 +
<asm>
 +
align $40
 +
 +
CarregarObjetos:
 +
addq.b #2,(Obj_placement_routine).w
 +
 
 +
moveq #0,d0
 +
move.w (Current_ZoneAndAct).w,d0 ; If level == $0F (ARZ)...
 +
ror.b #1,d0
 +
lsr.w #6,d0
 +
add.l d0,d0
 +
movea.l ObjPosData(pc,d0.l),a0
 +
movea.l a0,a1
 +
 +
tst.w (Two_player_mode).w ; skip if not in 2-player vs mode
 +
beq.s loc_017AF0
 +
cmpi.b #$C,(Current_Zone).w ; skip if not Casino Night Zone
 +
bne.s loc_017AF0
 +
lea (Objects_CNZ1_2P).l,a0 ; CNZ 1 2-player object layout
 +
tst.b (Current_Act).w ; skip if not past act 1
 +
beq.s loc_017AF0
 +
lea (Objects_CNZ2_2P).l,a0 ; CNZ 2 2-player object layout
 +
 
 +
loc_017AF0:
 +
jmp loc_17AF0
 +
rts
 +
 +
ObjPosData:
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;00
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;01
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;02
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;03
 +
dc.l Objects_MTZ_1, Objects_MTZ_2 ;04
 +
dc.l Objects_MTZ_3, Objects_MTZ_3 ;05
 +
dc.l Objects_WFZ_1, Objects_WFZ_1 ;06
 +
dc.l Objects_HTZ_1, Objects_HTZ_2 ;07
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;08
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;09
 +
dc.l Objects_OOZ_1, Objects_OOZ_2 ;0A
 +
dc.l Objects_MCZ_1, Objects_MCZ_2 ;0B
 +
dc.l Objects_CNZ_1, Objects_CNZ_2 ;0C
 +
dc.l Objects_CPZ_1, Objects_CPZ_2 ;0D
 +
dc.l Objects_DEZ_1, Objects_DEZ_1 ;0E
 +
dc.l Objects_ARZ_1, Objects_ARZ_2 ;0F
 +
dc.l Objects_SCZ_1, Objects_SCZ_1 ;10
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;11
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;12
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;13
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;14
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;15
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;16
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;17
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;18
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;19
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;1A
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;1B
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;1C
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;1D
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;1E
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;1F
 +
dc.l Objects_EHZ_1, Objects_EHZ_2 ;20
 +
 
 +
align $80
 +
</asm>
 +
 
 +
==Extending tiles and patterns index==
 +
===Subsection Test===
 +
Find:
 +
<asm>
 +
;----------------------------------------------------------------------------------
 +
; EHZ 16x16 block mappings (Kosinski compression) ; was: (Kozinski compression)
 +
BM16_EHZ: BINCLUDE "mappings/16x16/EHZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; EHZ/HTZ main level patterns (Kosinski compression)
 +
; ArtKoz_95C24:
 +
ArtKos_EHZ: BINCLUDE "art/kosinski/EHZ_HTZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; HTZ 16x16 block mappings (Kosinski compression)
 +
BM16_HTZ: BINCLUDE "mappings/16x16/HTZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; HTZ pattern suppliment to EHZ level patterns (Kosinski compression)
 +
; ArtKoz_98AB4:
 +
ArtKos_HTZ: BINCLUDE "art/kosinski/HTZ_Supp.bin"
 +
;-----------------------------------------------------------------------------------
 +
; EHZ/HTZ 128x128 block mappings (Kosinski compression)
 +
BM128_EHZ: BINCLUDE "mappings/128x128/EHZ_HTZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; MTZ 16x16 block mappings (Kosinski compression)
 +
BM16_MTZ: BINCLUDE "mappings/16x16/MTZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; MTZ main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_MTZ: BINCLUDE "art/kosinski/MTZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; MTZ 128x128 block mappings (Kosinski compression)
 +
BM128_MTZ: BINCLUDE "mappings/128x128/MTZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; OOZ 16x16 block mappings (Kosinski compression)
 +
BM16_OOZ: BINCLUDE "mappings/16x16/OOZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; OOZ main level patterns (Kosinski compression)
 +
; ArtKoz_A4204:
 +
ArtKos_OOZ: BINCLUDE "art/kosinski/OOZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; OOZ 128x128 block mappings (Kosinski compression)
 +
BM128_OOZ: BINCLUDE "mappings/128x128/OOZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; MCZ 16x16 block mappings (Kosinski compression)
 +
BM16_MCZ: BINCLUDE "mappings/16x16/MCZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; MCZ main level patterns (Kosinski compression)
 +
; ArtKoz_A9D74:
 +
ArtKos_MCZ: BINCLUDE "art/kosinski/MCZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; MCZ 128x128 block mappings (Kosinski compression)
 +
BM128_MCZ: BINCLUDE "mappings/128x128/MCZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; CNZ 16x16 block mappings (Kosinski compression)
 +
BM16_CNZ: BINCLUDE "mappings/16x16/CNZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; CNZ main level patterns (Kosinski compression)
 +
; ArtKoz_B0894:
 +
ArtKos_CNZ: BINCLUDE "art/kosinski/CNZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; CNZ 128x128 block mappings (Kosinski compression)
 +
BM128_CNZ: BINCLUDE "mappings/128x128/CNZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; CPZ/DEZ 16x16 block mappings (Kosinski compression)
 +
BM16_CPZ: BINCLUDE "mappings/16x16/CPZ_DEZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; CPZ/DEZ main level patterns (Kosinski compression)
 +
; ArtKoz_B6174:
 +
ArtKos_CPZ: BINCLUDE "art/kosinski/CPZ_DEZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; CPZ/DEZ 128x128 block mappings (Kosinski compression)
 +
BM128_CPZ: BINCLUDE "mappings/128x128/CPZ_DEZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; ARZ 16x16 block mappings (Kosinski compression)
 +
BM16_ARZ: BINCLUDE "mappings/16x16/ARZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; ARZ main level patterns (Kosinski compression)
 +
; ArtKoz_BCC24:
 +
ArtKos_ARZ: BINCLUDE "art/kosinski/ARZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; ARZ 128x128 block mappings (Kosinski compression)
 +
BM128_ARZ: BINCLUDE "mappings/128x128/ARZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; WFZ/SCZ 16x16 block mappings (Kosinski compression)
 +
BM16_WFZ: BINCLUDE "mappings/16x16/WFZ_SCZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; WFZ/SCZ main level patterns (Kosinski compression)
 +
; ArtKoz_C5004:
 +
ArtKos_SCZ: BINCLUDE "art/kosinski/WFZ_SCZ.bin"
 +
;-----------------------------------------------------------------------------------
 +
; WFZ pattern suppliment to SCZ tiles (Kosinski compression)
 +
; ArtKoz_C7EC4:
 +
ArtKos_WFZ: BINCLUDE "art/kosinski/WFZ_Supp.bin"
 +
;-----------------------------------------------------------------------------------
 +
; WFZ/SCZ 128x128 block mappings (Kosinski compression)
 +
BM128_WFZ: BINCLUDE "mappings/128x128/WFZ_SCZ.bin"
 +
</asm>
 +
 
 +
then add this to the end:
 +
<asm>
 +
;-----------------------------------------------------------------------------------
 +
; Lev_11 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_11: BINCLUDE "mappings/16x16/Lev_11.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_11 main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_11: BINCLUDE "art/kosinski/Lev_11.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_11 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_11: BINCLUDE "mappings/128x128/Lev_11.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_12 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_12: BINCLUDE "mappings/16x16/Lev_12.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_12 main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_12: BINCLUDE "art/kosinski/Lev_12.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_12 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_12: BINCLUDE "mappings/128x128/Lev_12.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_13 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_13: BINCLUDE "mappings/16x16/Lev_13.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_13 main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_13: BINCLUDE "art/kosinski/Lev_13.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_13 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_13: BINCLUDE "mappings/128x128/Lev_13.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_14 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_14: BINCLUDE "mappings/16x16/Lev_14.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_14 main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_14: BINCLUDE "art/kosinski/Lev_14.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_14 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_14: BINCLUDE "mappings/128x128/Lev_14.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_15 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_15: BINCLUDE "mappings/16x16/Lev_15.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_15 main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_15: BINCLUDE "art/kosinski/Lev_15.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_15 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_15: BINCLUDE "mappings/128x128/Lev_15.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_16 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_16: BINCLUDE "mappings/16x16/Lev_16.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_16 main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_16: BINCLUDE "art/kosinski/Lev_16.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_16 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_16: BINCLUDE "mappings/128x128/Lev_16.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_17 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_17: BINCLUDE "mappings/16x16/Lev_17.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_17 main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_17: BINCLUDE "art/kosinski/Lev_17.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_17 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_17: BINCLUDE "mappings/128x128/Lev_17.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_18 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_18: BINCLUDE "mappings/16x16/Lev_18.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_18 main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_18: BINCLUDE "art/kosinski/Lev_18.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_18 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_18: BINCLUDE "mappings/128x128/Lev_18.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_19 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_19: BINCLUDE "mappings/16x16/Lev_19.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_19 main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_19: BINCLUDE "art/kosinski/Lev_19.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_19 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_19: BINCLUDE "mappings/128x128/Lev_19.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1A 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_1A: BINCLUDE "mappings/16x16/Lev_1A.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1A main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_1A: BINCLUDE "art/kosinski/Lev_1A.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1A 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_1A: BINCLUDE "mappings/128x128/Lev_1A.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1B 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_1B: BINCLUDE "mappings/16x16/Lev_1B.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1B main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_1B: BINCLUDE "art/kosinski/Lev_1B.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1B 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_1B: BINCLUDE "mappings/128x128/Lev_1B.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1C 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_1C: BINCLUDE "mappings/16x16/Lev_1C.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1C main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_1C: BINCLUDE "art/kosinski/Lev_1C.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1C 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_1C: BINCLUDE "mappings/128x128/Lev_1C.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1D 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_1D: BINCLUDE "mappings/16x16/Lev_1D.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1D main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_1D: BINCLUDE "art/kosinski/Lev_1D.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1D 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_1D: BINCLUDE "mappings/128x128/Lev_1D.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1E 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_1E: BINCLUDE "mappings/16x16/Lev_1E.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1E main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_1E: BINCLUDE "art/kosinski/Lev_1E.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1E 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_1E: BINCLUDE "mappings/128x128/Lev_1E.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1F 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_1F: BINCLUDE "mappings/16x16/Lev_1F.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1F main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_1F: BINCLUDE "art/kosinski/Lev_1F.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_1F 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_1F: BINCLUDE "mappings/128x128/Lev_1F.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_20 16x16 block mappings (Kosinski compression)
 +
BM16_Lev_20: BINCLUDE "mappings/16x16/Lev_20.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_20 main level patterns (Kosinski compression)
 +
; ArtKoz_9DB64:
 +
ArtKos_Lev_20: BINCLUDE "art/kosinski/Lev_20.bin"
 +
;-----------------------------------------------------------------------------------
 +
; Lev_20 128x128 block mappings (Kosinski compression)
 +
BM128_Lev_20: BINCLUDE "mappings/128x128/Lev_20.bin"
 +
</asm>
 +
 
 +
Then add optional pattern supplements to suit your hack's needs.
 +
 
 +
Now find:
 +
<asm>
 +
LevelArtPointers:
 +
levartptrs  4,  5,  4, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ;  0 ; EHZ  ; EMERALD HILL ZONE
 +
levartptrs  6,  7,  5, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ;  1 ; LEV1 ; LEVEL 1 (UNUSED)
 +
levartptrs  8,  9,  6, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ;  2 ; LEV2 ; LEVEL 2 (UNUSED)
 +
levartptrs  $A, $B,  7, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ;  3 ; LEV3 ; LEVEL 3 (UNUSED)
 +
levartptrs  $C, $D,  8, ArtKos_MTZ, BM16_MTZ, BM128_MTZ ;  4 ; MTZ  ; METROPOLIS ZONE ACTS 1 & 2
 +
levartptrs  $C, $D,  8, ArtKos_MTZ, BM16_MTZ, BM128_MTZ ;  5 ; MTZ3 ; METROPOLIS ZONE ACT 3
 +
levartptrs $10,$11, $A, ArtKos_SCZ, BM16_WFZ, BM128_WFZ ;  6 ; WFZ  ; WING FORTRESS ZONE
 +
levartptrs $12,$13, $B, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ;  7 ; HTZ  ; HILL TOP ZONE
 +
levartptrs $14,$15, $C,  BM16_OOZ,  BM16_OOZ,  BM16_OOZ ;  8 ; HPZ  ; HIDDEN PALACE ZONE (UNUSED)
 +
levartptrs $16,$17, $D, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ;  9 ; LEV9 ; LEVEL 9 (UNUSED)
 +
levartptrs $18,$19, $E, ArtKos_OOZ, BM16_OOZ, BM128_OOZ ;  $A ; OOZ  ; OIL OCEAN ZONE
 +
levartptrs $1A,$1B, $F, ArtKos_MCZ, BM16_MCZ, BM128_MCZ ;  $B ; MCZ  ; MYSTIC CAVE ZONE
 +
levartptrs $1C,$1D,$10, ArtKos_CNZ, BM16_CNZ, BM128_CNZ ;  $C ; CNZ  ; CASINO NIGHT ZONE
 +
levartptrs $1E,$1F,$11, ArtKos_CPZ, BM16_CPZ, BM128_CPZ ;  $D ; CPZ  ; CHEMICAL PLANT ZONE
 +
levartptrs $20,$21,$12, ArtKos_CPZ, BM16_CPZ, BM128_CPZ ;  $E ; DEZ  ; DEATH EGG ZONE
 +
levartptrs $22,$23,$13, ArtKos_ARZ, BM16_ARZ, BM128_ARZ ;  $F ; ARZ  ; AQUATIC RUIN ZONE
 +
levartptrs $24,$25,$14, ArtKos_SCZ, BM16_WFZ, BM128_WFZ ; $10 ; SCZ  ; SKY CHASE ZONE
 +
</asm>
 +
 
 +
then add this to the end:
 +
<asm>
 +
levartptrs  $26,  $27,  $15, ArtKos_Lev_11, BM16_Lev_11, BM128_Lev_11 ;  0 ; Lev_11  ; LEV_11 ZONE
 +
levartptrs  $28,  $29,  $16, ArtKos_Lev_12, BM16_Lev_12, BM128_Lev_12 ;  0 ; Lev_12  ; LEV_12 ZONE
 +
levartptrs  $2A,  $2B,  $17, ArtKos_Lev_13, BM16_Lev_13, BM128_Lev_13 ;  0 ; Lev_13  ; LEV_13 ZONE
 +
levartptrs  $2C,  $2D,  $18, ArtKos_Lev_14, BM16_Lev_14, BM128_Lev_14 ;  0 ; Lev_14  ; LEV_14 ZONE
 +
levartptrs  $2E,  $2F,  $19, ArtKos_Lev_15, BM16_Lev_15, BM128_Lev_15 ;  0 ; Lev_15  ; LEV_15 ZONE
 +
levartptrs  $30,  $31,  $1A, ArtKos_Lev_16, BM16_Lev_16, BM128_Lev_16 ;  0 ; Lev_16  ; LEV_16 ZONE
 +
levartptrs  $32,  $33,  $1B, ArtKos_Lev_17, BM16_Lev_17, BM128_Lev_17 ;  0 ; Lev_17  ; LEV_17 ZONE
 +
levartptrs  $34,  $35,  $1C, ArtKos_Lev_18, BM16_Lev_18, BM128_Lev_18 ;  0 ; Lev_18  ; LEV_18 ZONE
 +
levartptrs  $36,  $37,  $1D, ArtKos_Lev_19, BM16_Lev_19, BM128_Lev_19 ;  0 ; Lev_19  ; LEV_19 ZONE
 +
levartptrs  $38,  $39,  $1E, ArtKos_Lev_1A, BM16_Lev_1A, BM128_Lev_1A ;  0 ; Lev_1A  ; LEV_1A ZONE
 +
levartptrs  $3A,  $3B,  $1F, ArtKos_Lev_1B, BM16_Lev_1B, BM128_Lev_1B ;  0 ; Lev_1B  ; LEV_1B ZONE
 +
levartptrs  $3C,  $3D,  $20, ArtKos_Lev_1C, BM16_Lev_1C, BM128_Lev_1C ;  0 ; Lev_1C  ; LEV_1C ZONE
 +
levartptrs  $3E,  $3F,  $21, ArtKos_Lev_1D, BM16_Lev_1D, BM128_Lev_1D ;  0 ; Lev_1D  ; LEV_1D ZONE
 +
levartptrs  $40,  $41,  $22, ArtKos_Lev_1E, BM16_Lev_1E, BM128_Lev_1E ;  0 ; Lev_1E  ; LEV_1E ZONE
 +
levartptrs  $42,  $43,  $23, ArtKos_Lev_1F, BM16_Lev_1F, BM128_Lev_1F ;  0 ; Lev_1F  ; LEV_1F ZONE
 +
levartptrs  $44,  $45,  $24, ArtKos_Lev_20, BM16_Lev_20, BM128_Lev_20 ;  0 ; Lev_20  ; LEV_20 ZONE
 +
</asm>
 +
 
 +
After this is added, you possibly need to add loading queries to the texture load index. Create the .bin files and you're finished.
 +
 
 +
==Extending level and tile layout indexes==
 +
Now you need to extend the layout index and we're done extending most level essentials.
 +
 
 +
Find:
 +
<asm>
 +
Off_Level:
 +
dc.w Level_EHZ1-Off_Level
 +
dc.w Level_EHZ2-Off_Level; 1
 +
dc.w Level_EHZ1-Off_Level; 2
 +
dc.w Level_EHZ1-Off_Level; 3
 +
dc.w Level_EHZ1-Off_Level; 4
 +
dc.w Level_EHZ1-Off_Level; 5
 +
dc.w Level_EHZ1-Off_Level; 6
 +
dc.w Level_EHZ1-Off_Level; 7
 +
dc.w Level_MTZ1-Off_Level; 8
 +
dc.w Level_MTZ2-Off_Level; 9
 +
dc.w Level_MTZ3-Off_Level; 10
 +
dc.w Level_MTZ3-Off_Level; 11
 +
dc.w Level_WFZ-Off_Level; 12
 +
dc.w Level_WFZ-Off_Level; 13
 +
dc.w Level_HTZ1-Off_Level; 14
 +
dc.w Level_HTZ2-Off_Level; 15
 +
dc.w Level_OOZ1-Off_Level; 16
 +
dc.w Level_OOZ1-Off_Level; 17
 +
dc.w Level_EHZ1-Off_Level; 18
 +
dc.w Level_EHZ1-Off_Level; 19
 +
dc.w Level_OOZ1-Off_Level; 20
 +
dc.w Level_OOZ2-Off_Level; 21
 +
dc.w Level_MCZ1-Off_Level; 22
 +
dc.w Level_MCZ2-Off_Level; 23
 +
dc.w Level_CNZ1-Off_Level; 24
 +
dc.w Level_CNZ2-Off_Level; 25
 +
dc.w Level_CPZ1-Off_Level; 26
 +
dc.w Level_CPZ2-Off_Level; 27
 +
dc.w Level_DEZ-Off_Level; 28
 +
dc.w Level_DEZ-Off_Level; 29
 +
dc.w Level_ARZ1-Off_Level; 30
 +
dc.w Level_ARZ2-Off_Level; 31
 +
dc.w Level_SCZ-Off_Level; 32
 +
dc.w Level_SCZ-Off_Level; 33
 +
</asm>
 +
 
 +
and add this to the end:
 +
<asm>
 +
dc.w Level_Lev11_1-Off_Level
 +
dc.w Level_Lev11_2-Off_Level
 +
dc.w Level_Lev12_1-Off_Level
 +
dc.w Level_Lev12_2-Off_Level
 +
dc.w Level_Lev13_1-Off_Level
 +
dc.w Level_Lev13_2-Off_Level
 +
dc.w Level_Lev14_1-Off_Level
 +
dc.w Level_Lev14_2-Off_Level
 +
dc.w Level_Lev15_1-Off_Level
 +
dc.w Level_Lev15_2-Off_Level
 +
dc.w Level_Lev16_1-Off_Level
 +
dc.w Level_Lev16_2-Off_Level
 +
dc.w Level_Lev17_1-Off_Level
 +
dc.w Level_Lev17_2-Off_Level
 +
dc.w Level_Lev18_1-Off_Level
 +
dc.w Level_Lev18_2-Off_Level
 +
dc.w Level_Lev19_1-Off_Level
 +
dc.w Level_Lev19_2-Off_Level
 +
dc.w Level_Lev1A_1-Off_Level
 +
dc.w Level_Lev1A_2-Off_Level
 +
dc.w Level_Lev1B_1-Off_Level
 +
dc.w Level_Lev1B_2-Off_Level
 +
dc.w Level_Lev1C_1-Off_Level
 +
dc.w Level_Lev1C_2-Off_Level
 +
dc.w Level_Lev1D_1-Off_Level
 +
dc.w Level_Lev1D_2-Off_Level
 +
dc.w Level_Lev1E_1-Off_Level
 +
dc.w Level_Lev1E_2-Off_Level
 +
dc.w Level_Lev1F_1-Off_Level
 +
dc.w Level_Lev1F_2-Off_Level
 +
dc.w Level_Lev20_1-Off_Level
 +
dc.w Level_Lev20_2-Off_Level
 +
</asm>
 +
 
 +
Then find:
 +
<asm>
 +
;---------------------------------------------------------------------------------------
 +
; EHZ act 1 level layout (Kosinski compression)
 +
Level_EHZ1: BINCLUDE "level/layout/EHZ_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; EHZ act 2 level layout (Kosinski compression)
 +
Level_EHZ2: BINCLUDE "level/layout/EHZ_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; MTZ act 1 level layout (Kosinski compression)
 +
Level_MTZ1: BINCLUDE "level/layout/MTZ_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; MTZ act 2 level layout (Kosinski compression)
 +
Level_MTZ2: BINCLUDE "level/layout/MTZ_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; MTZ act 3 level layout (Kosinski compression)
 +
Level_MTZ3: BINCLUDE "level/layout/MTZ_3.bin"
 +
;---------------------------------------------------------------------------------------
 +
; WFZ level layout (Kosinski compression)
 +
Level_WFZ: BINCLUDE "level/layout/WFZ.bin"
 +
;---------------------------------------------------------------------------------------
 +
; HTZ act 1 level layout (Kosinski compression)
 +
Level_HTZ1: BINCLUDE "level/layout/HTZ_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; HTZ act 2 level layout (Kosinski compression)
 +
Level_HTZ2: BINCLUDE "level/layout/HTZ_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; OOZ act 1 level layout (Kosinski compression)
 +
Level_OOZ1: BINCLUDE "level/layout/OOZ_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; OOZ act 2 level layout (Kosinski compression)
 +
Level_OOZ2: BINCLUDE "level/layout/OOZ_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; MCZ act 1 level layout (Kosinski compression)
 +
Level_MCZ1: BINCLUDE "level/layout/MCZ_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; MCZ act 2 level layout (Kosinski compression)
 +
Level_MCZ2: BINCLUDE "level/layout/MCZ_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; CNZ act 1 level layout (Kosinski compression)
 +
Level_CNZ1: BINCLUDE "level/layout/CNZ_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; CNZ act 2 level layout (Kosinski compression)
 +
Level_CNZ2: BINCLUDE "level/layout/CNZ_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; CPZ act 1 level layout (Kosinski compression)
 +
Level_CPZ1: BINCLUDE "level/layout/CPZ_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; CPZ act 2 level layout (Kosinski compression)
 +
Level_CPZ2: BINCLUDE "level/layout/CPZ_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; DEZ level layout (Kosinski compression)
 +
Level_DEZ: BINCLUDE "level/layout/DEZ.bin"
 +
;---------------------------------------------------------------------------------------
 +
; ARZ act 1 level layout (Kosinski compression)
 +
Level_ARZ1: BINCLUDE "level/layout/ARZ_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; ARZ act 2 level layout (Kosinski compression)
 +
Level_ARZ2: BINCLUDE "level/layout/ARZ_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; SCZ level layout (Kosinski compression)
 +
Level_SCZ: BINCLUDE "level/layout/SCZ.bin"
 +
</asm>
 +
 
 +
then add this at the end:
 +
<asm>
 +
;---------------------------------------------------------------------------------------
 +
; Lev11 act 1 level layout (Kosinski compression)
 +
Level_Lev11_1: BINCLUDE "level/layout/Lev11_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev11 act 2 level layout (Kosinski compression)
 +
Level_Lev11_2: BINCLUDE "level/layout/Lev11_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev12_1 level layout (Kosinski compression)
 +
Level_Lev12_1: BINCLUDE "level/layout/Lev12_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev12_2 level layout (Kosinski compression)
 +
Level_Lev12_1: BINCLUDE "level/layout/Lev12_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev13_1 level layout (Kosinski compression)
 +
Level_Lev13_1: BINCLUDE "level/layout/Lev13_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev13_2 level layout (Kosinski compression)
 +
Level_Lev13_2: BINCLUDE "level/layout/Lev13_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev14_1 level layout (Kosinski compression)
 +
Level_Lev14_1: BINCLUDE "level/layout/Lev14_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev14_2 level layout (Kosinski compression)
 +
Level_Lev14_2: BINCLUDE "level/layout/Lev14_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev15_1 level layout (Kosinski compression)
 +
Level_Lev15_1: BINCLUDE "level/layout/Lev15_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev15_2 level layout (Kosinski compression)
 +
Level_Lev15_2: BINCLUDE "level/layout/Lev15_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev16_1 level layout (Kosinski compression)
 +
Level_Lev16_1: BINCLUDE "level/layout/Lev16_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev16_2 level layout (Kosinski compression)
 +
Level_Lev16_2: BINCLUDE "level/layout/Lev16_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev17_1 level layout (Kosinski compression)
 +
Level_Lev17_1: BINCLUDE "level/layout/Lev17_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev17_2 level layout (Kosinski compression)
 +
Level_Lev17_2: BINCLUDE "level/layout/Lev17_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev18_1 level layout (Kosinski compression)
 +
Level_Lev18_1: BINCLUDE "level/layout/Lev18_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev18_2 level layout (Kosinski compression)
 +
Level_Lev18_2: BINCLUDE "level/layout/Lev18_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev19_1 level layout (Kosinski compression)
 +
Level_Lev19_1: BINCLUDE "level/layout/Lev19_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev19_2 level layout (Kosinski compression)
 +
Level_Lev19_2: BINCLUDE "level/layout/Lev19_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev1A_1 level layout (Kosinski compression)
 +
Level_Lev1A_1: BINCLUDE "level/layout/Lev1A_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev1A_2 level layout (Kosinski compression)
 +
Level_Lev1A_2: BINCLUDE "level/layout/Lev1A_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev1B_1 level layout (Kosinski compression)
 +
Level_Lev1B_1: BINCLUDE "level/layout/Lev1B_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev1B_2 level layout (Kosinski compression)
 +
Level_Lev1B_2: BINCLUDE "level/layout/Lev1B_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev1C_1 level layout (Kosinski compression)
 +
Level_Lev1C_1: BINCLUDE "level/layout/Lev1C_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev1C_2 level layout (Kosinski compression)
 +
Level_Lev1C_2: BINCLUDE "level/layout/Lev1C_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev1D_1 level layout (Kosinski compression)
 +
Level_Lev1D_1: BINCLUDE "level/layout/Lev1D_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev1D_2 level layout (Kosinski compression)
 +
Level_Lev1D_2: BINCLUDE "level/layout/Lev1D_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev1E_1 level layout (Kosinski compression)
 +
Level_Lev1E_1: BINCLUDE "level/layout/Lev1E_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev1E_2 level layout (Kosinski compression)
 +
Level_Lev1E_2: BINCLUDE "level/layout/Lev1E_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev1F_1 level layout (Kosinski compression)
 +
Level_Lev1F_1: BINCLUDE "level/layout/Lev1F_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev1F_2 level layout (Kosinski compression)
 +
Level_Lev1F_2: BINCLUDE "level/layout/Lev1F_2.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev20_1 level layout (Kosinski compression)
 +
Level_Lev20_1: BINCLUDE "level/layout/Lev20_1.bin"
 +
;---------------------------------------------------------------------------------------
 +
; Lev20_2 level layout (Kosinski compression)
 +
Level_Lev20_2: BINCLUDE "level/layout/Lev20_2.bin"
 +
</asm>
 +
 
 +
Now create the .bin files.
 +
 
 +
==Extending the definition of act 2 (setting up our new levels so that they can have bosses in other words)==
 +
just being able to use sign posts in your new levels can be boring after a while, so we will make those changes so that we can put custom bosses in our new levels, actually extending the sprite pointer list is not within the scope of the tutorial, though highly recommended.
 +
 
 +
find:
 +
<asm>SetLevelEndType:
 +
move.w #0,(Level_Has_Signpost).w ; set level type to non-signpost
 +
tst.w (Two_player_mode).w ; is it two-player competitive mode?
 +
bne.s LevelEnd_SetSignpost ; if yes, branch
 +
cmpi.w #$001,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if EHZ2, return
 +
cmpi.w #$500,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if MTZ3, return
 +
cmpi.w #$600,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if WFZ, return
 +
cmpi.w #$701,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if HTZ2, return
 +
cmpi.w #$A01,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if OOZ2, return
 +
cmpi.w #$B01,(Current_ZoneAndAct).w
 +
beq.s return_4C46 ; if MCZ2, return
 +
cmpi.w #$C01,(Current_ZoneAndAct).w
 +
beq.s return_4C46 ; if CNZ2, return
 +
cmpi.w #$D01,(Current_ZoneAndAct).w
 +
beq.s return_4C46 ; if CPZ2, return
 +
cmpi.w #$E00,(Current_ZoneAndAct).w
 +
beq.s return_4C46 ; if DEZ, return
 +
cmpi.w #$F01,(Current_ZoneAndAct).w
 +
beq.s return_4C46 ; if ARZ2, return
 +
cmpi.w #$1000,(Current_ZoneAndAct).w
 +
beq.s return_4C46 ; if SCZ, return
 +
</asm>
 +
we will change it to:
 +
<asm>
 +
JmpTo_LevelEnd_SetSignpost
 +
jmp LevelEnd_SetSignpost
 +
 
 +
SetLevelEndType:
 +
move.w #0,(Level_Has_Signpost).w ; set level type to non-signpost
 +
tst.w (Two_player_mode).w ; is it two-player competitive mode?
 +
bne.s JmpTo_LevelEnd_SetSignpost ; if yes, branch
 +
cmpi.w #$001,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if EHZ2, return
 +
cmpi.w #$101,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if LZ2, return
 +
cmpi.w #$201,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if WZ2, return
 +
cmpi.w #$301,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if DHZ2, return
 +
cmpi.w #$500,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if MTZ3, return
 +
cmpi.w #$600,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if WFZ, return
 +
cmpi.w #$701,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if HTZ2, return
 +
cmpi.w #$801,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if HPZ2, return
 +
cmpi.w #$901,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if GCZ2, return
 +
cmpi.w #$A01,(Current_ZoneAndAct).w
 +
beq.w return_4C46 ; if OOZ2, return
 +
bra.s SetLevelEndType2
 +
 
 +
return_4C46:
 +
rts
 +
 
 +
SetLevelEndType2:
 +
cmpi.w #$B01,(Current_ZoneAndAct).w
 +
beq.s return2_4C46 ; if MCZ2, return
 +
cmpi.w #$C01,(Current_ZoneAndAct).w
 +
beq.s return2_4C46 ; if CNZ2, return
 +
cmpi.w #$D01,(Current_ZoneAndAct).w
 +
beq.s return2_4C46 ; if CPZ2, return
 +
cmpi.w #$E00,(Current_ZoneAndAct).w
 +
beq.s return2_4C46 ; if DEZ, return
 +
cmpi.w #$F01,(Current_ZoneAndAct).w
 +
beq.s return2_4C46 ; if ARZ2, return
 +
cmpi.w #$1000,(Current_ZoneAndAct).w
 +
beq.s return2_4C46 ; if SCZ, return
 +
cmpi.w #$1000,(Current_ZoneAndAct).w
 +
beq.s return2_4C46 ; if SCZ, return
 +
cmpi.w #$1101,(Current_ZoneAndAct).w
 +
beq.s return2_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$1201,(Current_ZoneAndAct).w
 +
beq.s return2_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$1301,(Current_ZoneAndAct).w
 +
beq.s return2_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$1401,(Current_ZoneAndAct).w
 +
bra.s SetLevelEndType3
 +
 
 +
return2_4C46:
 +
rts
 +
 
 +
SetLevelEndType3:
 +
beq.s return3_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$1501,(Current_ZoneAndAct).w
 +
beq.s return3_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$1601,(Current_ZoneAndAct).w
 +
beq.s return3_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$1701,(Current_ZoneAndAct).w
 +
beq.s return3_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$1801,(Current_ZoneAndAct).w
 +
beq.s return3_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$1901,(Current_ZoneAndAct).w
 +
beq.s return3_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$1A01,(Current_ZoneAndAct).w
 +
beq.s return3_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$1B01,(Current_ZoneAndAct).w
 +
beq.s return3_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$1C01,(Current_ZoneAndAct).w
 +
beq.s return3_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$1D01,(Current_ZoneAndAct).w
 +
beq.s return3_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$1E01,(Current_ZoneAndAct).w
 +
beq.s return3_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$1F01,(Current_ZoneAndAct).w
 +
beq.s return3_4C46 ; if one of our new levels in act 2, return
 +
cmpi.w #$2001,(Current_ZoneAndAct).w
 +
beq.s return3_4C46 ; if one of our new levels in act 2, return
 +
 
 +
; loc_4C40:
 +
LevelEnd_SetSignpost:
 +
move.w #1,(Level_Has_Signpost).w ; set level type to signpost
 +
 
 +
return3_4C46:
 +
rts
 +
</asm>
 +
 
 +
==Extend Level Size Array==
 +
our levels need a size, right?  This part of the guide gives us just that.
 +
 
 +
what we need to find is:
 +
<asm>
 +
WrdArr_LvlSize:
 +
dc.w $0, $29A0, $0, $320 ; $00  ; EHZ act 2
 +
dc.w $0, $2940, $0, $420 ; EHZ act 2
 +
dc.w $0, $3FFF, $0, $720 ; $01
 +
dc.w $0, $3FFF, $0, $720
 +
dc.w $0, $3FFF, $0, $720 ; $02
 +
dc.w $0, $3FFF, $0, $720
 +
dc.w $0, $3FFF, $0, $720 ; $03
 +
dc.w $0, $3FFF, $0, $720
 +
dc.w $0, $2280, -$100, $800 ; $04 ; MTZ act 1
 +
dc.w $0, $1E80, -$100, $800 ; MTZ act 2
 +
dc.w $0, $2A80, -$100, $800 ; $05 ; MTZ act 3
 +
dc.w $0, $3FFF, -$100, $800
 +
dc.w $0, $3FFF, $0, $720 ; $06 ; WFZ
 +
dc.w $0, $3FFF, $0, $720
 +
dc.w $0, $2800, $0, $720 ; $07 ; HTZ act 1
 +
dc.w $0, $3280, $0, $720 ; HTZ act 2
 +
dc.w $0, $3FFF, $0, $720 ; $08
 +
dc.w $0, $3FFF, $0, $720
 +
dc.w $0, $3FFF, $0, $720 ; $09
 +
dc.w $0, $3FFF, $0, $720
 +
dc.w $0, $2F80, $0, $680 ; $0A ; OOZ act 1
 +
dc.w $0, $2D00, $0, $680 ; OOZ act 2
 +
dc.w $0, $2380, $3C0, $720 ; $0B ; MCZ act 1
 +
dc.w $0, $3FFF, $60, $720 ; MCZ act 2
 +
dc.w $0, $27A0, $0, $720 ; $0C ; CNZ act 1
 +
dc.w $0, $2A80, $0, $720 ; CNZ act 2
 +
dc.w $0, $2780, $0, $720 ; $0D ; CPZ act 1
 +
dc.w $0, $2A80, $0, $720 ; CPZ act 2
 +
dc.w $0, $1000, $C8, $C8 ; $0F ; DEZ
 +
dc.w $0, $1000,  $C8, $C8
 +
dc.w $0, $28C0, $200, $600 ; $10 ; ARZ act 1
 +
dc.w $0, $3FFF, $180, $710 ; ARZ act 2
 +
dc.w $0, $3FFF, $0, $000 ; $11 ; SCZ
 +
dc.w $0, $3FFF, $0, $720
 +
</asm>
 +
 
 +
and we will change it to:
 +
<asm>
 +
WrdArr_LvlSize:
 +
dc.w $0, $29A0, $0, $320 ; $00  ; EHZ act 2
 +
dc.w $0, $2940, $0, $420 ; EHZ act 2
 +
dc.w $0, $3FFF, $0, $720 ; $01
 +
dc.w $0, $3FFF, $0, $720
 +
dc.w $0, $3FFF, $0, $720 ; $02
 +
dc.w $0, $3FFF, $0, $720
 +
dc.w $0, $3FFF, $0, $720 ; $03
 +
dc.w $0, $3FFF, $0, $720
 +
dc.w $0, $2280, -$100, $800 ; $04 ; MTZ act 1
 +
dc.w $0, $1E80, -$100, $800 ; MTZ act 2
 +
dc.w $0, $2A80, -$100, $800 ; $05 ; MTZ act 3
 +
dc.w $0, $3FFF, -$100, $800
 +
dc.w $0, $3FFF, $0, $720 ; $06 ; WFZ
 +
dc.w $0, $3FFF, $0, $720
 +
dc.w $0, $2800, $0, $720 ; $07 ; HTZ act 1
 +
dc.w $0, $3280, $0, $720 ; HTZ act 2
 +
dc.w $0, $3FFF, $0, $720 ; $08
 +
dc.w $0, $3FFF, $0, $720
 +
dc.w $0, $3FFF, $0, $720 ; $09
 +
dc.w $0, $3FFF, $0, $720
 +
dc.w $0, $2F80, $0, $680 ; $0A ; OOZ act 1
 +
dc.w $0, $2D00, $0, $680 ; OOZ act 2
 +
dc.w $0, $2380, $3C0, $720 ; $0B ; MCZ act 1
 +
dc.w $0, $3FFF, $60, $720 ; MCZ act 2
 +
dc.w $0, $27A0, $0, $720 ; $0C ; CNZ act 1
 +
dc.w $0, $2A80, $0, $720 ; CNZ act 2
 +
dc.w $0, $2780, $0, $720 ; $0D ; CPZ act 1
 +
dc.w $0, $2A80, $0, $720 ; CPZ act 2
 +
dc.w $0, $1000, $C8, $C8 ; $0E ; DEZ
 +
dc.w $0, $1000,  $C8, $C8
 +
dc.w $0, $28C0, $200, $600 ; $0F ; ARZ act 1
 +
dc.w $0, $3FFF, $180, $710 ; ARZ act 2
 +
dc.w $0, $3FFF, $0, $000 ; $10 ; SCZ
 +
dc.w $0, $3FFF, $0, $720
 +
dc.w $0, $3FFF, $0, $720 ; $11 ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $12 ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $13 ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $14 ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $15 ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $16 ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $17 ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $18 ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $19 ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $1A ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $1B ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $1C ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $1D ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $1E ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $1F ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
dc.w $0, $3FFF, $0, $720 ; $20 ;one of our new levels (act 1)
 +
dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2)
 +
</asm>
 +
 
 +
==Extending the Start Location Index==
 +
Sonic has to start somewhere right?
 +
 
 +
Find this:
 +
<asm>
 +
WrdArr_StartLoc:
 +
dc.w $60, $28F ; $00
 +
dc.w $60, $2AF
 +
dc.w $60, $28F ; $01
 +
dc.w $60, $2AF
 +
dc.w $60, $1AC ; $02
 +
dc.w $60, $1AC
 +
dc.w $60, $28F ; $03
 +
dc.w $60, $2AF
 +
dc.w $60, $28C ; $04
 +
dc.w $60, $5EC
 +
dc.w $60, $20C ; $05
 +
dc.w $60, $2AF
 +
dc.w $60, $4CC ; $06
 +
dc.w $1E0, $4CC
 +
dc.w $60, $3EF ; $07
 +
dc.w $60, $6AF
 +
dc.w $230, $1AC ; $08
 +
dc.w $230, $1AC
 +
dc.w $60, $28F ; $09
 +
dc.w $60, $2AF
 +
dc.w $60, $6AC ; $0A
 +
dc.w $60, $56C
 +
dc.w $60, $6AC ; $0B
 +
dc.w $60, $5AC
 +
dc.w $60, $2AC ; $0C
 +
dc.w $60, $58C
 +
dc.w $60, $1EC ; $0D
 +
dc.w $60, $12C
 +
dc.w $60, $12D ; $0E
 +
dc.w $60, $12D
 +
dc.w $60, $37E ; $0F
 +
dc.w $60, $37E
 +
dc.w $120, $70 ; $10
 +
dc.w $140, $70
 +
</asm>
 +
 
 +
then add this to the end:
 +
<asm>
 +
dc.w 0, 0 ; $11
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $12
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $13
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $14
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $15
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $16
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $17
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $18
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $19
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $1A
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $1B
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $1C
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $1D
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $1E
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $1F
 +
dc.w 0, 0
 +
dc.w 0, 0 ; $20
 +
dc.w 0, 0
 +
</asm>
 +
 
 +
then replace the 0s with the desired x and y co-ordinance.
 +
 
 +
==Notes==
 +
All new .bin files need to be created in order for the ROM to build. If something doesn't load correctly (besides new animated patterns that you have just made by youself, only major things like ROM crashes) please don't hesitate to ask for help and/or get it working and edit this article. (Like the title cards being broken for levels past $10)
 +
 
 +
[[Category:SCHG How-tos|Extend the level index past $10 in Sonic 2]]

Revision as of 12:33, 4 July 2011

Initial Notes and Revisions Done

(Original guide by kram, current revision that fixes major bugs and extends properly by GARY 'M 9)

(Updated again by kram, adding back custom titlecard mappings howto, due to guide being unfinished, thus finally fixing the "ZONE ZONE" bug. Replace all the empty levels with your new ones.)

(Updated by silent.creature, fixing some code within the procedures)

WARNING: Unless you are working with Xenowhirl's 2007 Sonic 2 disassembly, I strongly recommend you port the Sonic 1 sound driver first before proceeding. A lot of major data shifting will occur in this tutorial and it will make the rom size a lot bigger than it was before. This will break the Sonic 2 or even Sonic 2 beta sound driver; thus, you definitely want Sonic 1 sound driver due to the fact that it can take the shifting and still work properly. However, if you are using Xenowhirl's 2007 Sonic 2 disassembly, it is not necessary to port any other sound driver, since it uses disassembled Z80 code which automatically references the correct locations and can thus work properly even if there are massive location shifts.

You probably noticed that all the indexes in the game stop at $10 and when you try to extend them, by extending the Main Level Load Blocks index, you get weird glitches and crashes. It means you haven't extended all the indexes that need to be extended.

We will initially extend the indexes for $20 zones, but we show that this can be extended to any number between $11 and $7F. (I didn't tried $80 and more because of the ROM cartridge size, but I think it is possible.) You will see frequently the variable-label NumberOfZones, just to explain this. Please define it or substitute it to its desired value.

Extending the Titlecard index

Extending Main Configuration indexes

We need to allocate more card indexes for our new zone. To do this, we find:

<asm> Obj34_TitleCardData: dc.b 8, 0, $80, $1B dc.w $240, $120, $B8

dc.b $A, $11, $40, $1C dc.w $28, $148, $D0

dc.b $C, $12, $18, $1C dc.w $68, $188, $D0

dc.b 2, 0, 0, 0 dc.w 0, 0, 0

dc.b 4, $15, $48, 8 dc.w $2A8, $168,$120

dc.b 6, $16, 8, $15 dc.w $80, $F0, $F0 </asm>

and change this to: <asm> Obj34_TitleCardData: dc.b 8, 0, $80, $1B ; this is the zone string start index and placement dc.w $240, $120, $B8

dc.b $A, NumberOfZones+1, $40, $1C ; "ZONE" string index number and placement dc.w $28, $148, $D0

dc.b $C, NumberOfZones+2, $18, $1C ; act number start index and placement dc.w $68, $188, $D0

dc.b 2, 0, 0, 0 ; this part of the titlecard is totally unknown, colored backdrop possibly dc.w 0, 0, 0

dc.b 4, NumberOfZones+5, $48, 8 ; red strip edge index and placement dc.w $2A8, $168,$120

dc.b 6, NumberOfZones+6, 8, $15 ; red "Sonic The Hedgehog" string and placement dc.w $80, $F0, $F0 </asm>

Where NumberOfZones is the total number of zones you want in the game. As we said before, we will work with $20 zones.

Now, find: <asm> loc_13DEE:

   jsr       sub_13D10(pc)
   move.b    (Current_Zone).w,d0
   cmpi.b    #$10,d0
   beq.s     BranchTo9_DeleteObject
   cmpi.b    #6,d0
   beq.s     BranchTo9_DeleteObject
   cmpi.b    #$E,d0
   beq.s     BranchTo9_DeleteObject
   move.b    (Current_Act).w,d1
   addi.b    #$12,d1
   cmpi.b    #5,d0
   bne.s     loc_13E18
   moveq     #$14,d1

</asm>

and change it to: <asm> loc_13DEE:

   jsr       sub_13D10(pc)
   move.b    (Current_Zone).w,d0
   cmpi.b    #$10,d0
   beq.s     BranchTo9_DeleteObject
   cmpi.b    #6,d0
   beq.s     BranchTo9_DeleteObject
   cmpi.b    #$E,d0
   beq.s     BranchTo9_DeleteObject
   move.b    (Current_Act).w,d1
   addi.b    #NumberOfZones+2,d1                  ; Act number mappings (Act 1)
   cmpi.b    #5,d0
   bne.s     loc_13E18
   moveq     #NumberOfZones+4,d1                  ; Act number mappings (Act 3).  Used for drawing MTZ (0x05) titlecard only

</asm>

Now we have the offset data of where to load the mappings for the titlecards shifted so that we can now start working on updating the mappings and not have that strange "ZONE ZONE" bug that GARY 'M 9 left behind and I intended to correct.

Next, another thing I wanted to see others correct. this time, I will explain why I changed byte_15820 into a 16-bit relative offset index as opposed to it staying as a byte-by-byte relative offset that does not point correctly, and to appropriately handle the string data in word_15832, as well as allow that string data to be properly represented. This time I will make it even clearer too.

Next off, in this part of the hack the first thing before converting to a better manageable datatype, we want to replace the byte_15820 handler with a better one.

Look for: <asm>

loc_157D2

LoadTitleCard: bsr.s LoadTitleCard0 moveq #0,d0 move.b (Current_Zone).w,d0 move.b byte_15820(pc,d0.w),d0 lea word_15832(pc),a0 lea (a0,d0.w),a0 move.l #$7BC00002,d0 </asm>

and we want to replace it with: <asm>

loc_157D2

LoadTitleCard: bsr.s LoadTitleCard0 moveq #0,d0 move.b (Current_Zone).w,d0 add.w d0,d0 move.w Off_Titlecardtext(pc,d0.w),d0 lea Off_Titlecardtext(pc,d0.w),a0 move.l #$7BC00002,d0 </asm>

That takes care of the loader, now time to update the string data.

find: <asm>

unknown

byte_15820: dc.b 0, 0, 0, 0,$10,$10,$98,$20,$2C, 0,$3C,$46,$58,$68,$A8,$7A dc.b $8A, 0 ; 16

unknown

word_15832: dc.w $2A06,$3804, 4,$2604, $C04,$1804,$1C02,$FFFF dc.w $2A06,$4004,$3804,$3004,$2604,$1C02,$3C04,$FFFF; 8 dc.w $1804,$1C02,$2604,$4004,$3004,$FFFF,$1804,$1C02; 16 dc.w $C04,$3004, 4,$2604, $804,$FFFF,$1C02,$2604; 24 dc.w $804, 4,$FFFF,$2A06,$5604,$3C04,$4004,$1C02; 32 dc.w $804, 4,$4804,$FFFF, $804, 4,$3C04,$1C02; 40 dc.w $1404,$1804,$4004,$FFFF, $804,$1804,$2A06,$1C02; 48 dc.w 4,$2604,$3004,$4004,$FFFF, 4,$3404,$4404; 56 dc.w $4004,$1C02, $804,$3804,$FFFF,$3C04,$2204,$5604; 64 dc.w $804,$1804, 4,$FFFF,$4C06,$1C02,$1404,$1004; 72 dc.w $3804,$4004,$3C04,$FFFF, $C04, 4,$4004,$1804; 80 dc.w $1404,$FFFF ; 88 </asm>

and replace it with: <asm>

byte_15820

Off_Titlecardtext: dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 00 dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 01 dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 02 dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 03 dc.w Text_MTZ-Off_Titlecardtext ; MTZ Titlecard 04 dc.w Text_MTZ-Off_Titlecardtext ; MTZ Titlecard 05 dc.w Text_WFZ-Off_Titlecardtext ; WFZ Titlecard 06 dc.w Text_HTZ-Off_Titlecardtext ; HTZ Titlecard 07 dc.w Text_HPZ-Off_Titlecardtext ; EHZ Titlecard 08 dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 09 dc.w Text_OOZ-Off_Titlecardtext ; OOZ Titlecard 0A dc.w Text_MCZ-Off_Titlecardtext ; MCZ Titlecard 0B dc.w Text_CNZ-Off_Titlecardtext ; CNZ Titlecard 0C dc.w Text_CPZ-Off_Titlecardtext ; CPZ Titlecard 0D dc.w Text_DEZ-Off_Titlecardtext ; DEZ Titlecard 0E dc.w Text_ARZ-Off_Titlecardtext ; ARZ Titlecard 0F dc.w Text_SCZ-Off_Titlecardtext ; SCZ Titlecard 10 dc.w Text_GHZ-Off_Titlecardtext ; EHZ Titlecard 11 dc.w Text_GHZ-Off_Titlecardtext ; EHZ Titlecard 12 dc.w Text_WPZ-Off_Titlecardtext ; EHZ Titlecard 13 dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 14 dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 15 dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 16 dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 17 dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 18 dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 19 dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 1A dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 1B dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 1C dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 1D dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 1E dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 1F dc.w Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 20

word_15832

Text_EHZ: dc.w $2A06,$3804,$0004,$2604,$0C04,$1804,$1C02 ; 'MRALDHI' dc.w $FFFF ; '<EOF>' Text_MTZ: dc.w $2A06,$4004,$3804,$3004,$2604,$1C02,$3C04 ; 'MTRPLIS' dc.w $FFFF ; '<EOF>' Text_WFZ: dc.w $4C06,$1C02,$1404,$1004,$3804,$4004,$3C04 ; 'WIGFRTS' dc.w $FFFF ; '<EOF>' Text_HTZ: dc.w $1804,$1C02,$2604,$4004,$3004 ; 'HILTP' dc.w $FFFF ; '<EOF>' Text_HPZ: dc.w $1804,$1C02,$0C04,$3004,$0004,$2604,$0804 ; 'HIDPALCE' dc.w $FFFF ; '<EOF>' Text_OOZ: dc.w $1C02,$2604,$0804,$0004 ; 'ILCAN' dc.w $FFFF ; '<EOF>' Text_MCZ: dc.w $2A06,$5604,$3C04,$4004,$1C02,$0804,$0004,$4804 ; 'MYSTICAV' dc.w $FFFF ; '<EOF>' Text_CNZ: dc.w $0804,$0004,$3C04,$1C02,$1404,$1804,$4004 ; 'CASIGHT' dc.w $FFFF ; '<EOF>' Text_CPZ: dc.w $0804,$1804,$2A06,$1C02,$0004,$2604,$3004,$4004 ; 'CHMICALPT' dc.w $FFFF ; '<EOF>' Text_DEZ: dc.w $0C04,$0004,$4004,$1804,$1404 ; 'DATHG' dc.w $FFFF ; '<EOF>' Text_ARZ: dc.w $0004,$3404,$4404,$4004,$1C02,$0804,$3804 ; 'AQUTICR' dc.w $FFFF ; '<EOF>' Text_SCZ: dc.w $3C04,$2204,$5604,$0804,$1804,$0004,$3C04 ; 'SKYCHAS' dc.w $FFFF ; '<EOF>' </asm>

Point Fix: This data manager, as implemented, doesn't work with a byte-string data. If you tried to use that byte-string data, you've noticed weird names. For example, Emerald Hill became Emepqrs T?rr.

This adds the basic card configuration to our new levels. You can freely edit the entries of this table to suit your needs.

Extending Specific Data Configuration

Now, find: <asm>

-------------------------------------------------------------------------------
sprite mappings
-------------------------------------------------------------------------------

Obj34_MapUnc_147BA: BINCLUDE "mappings/sprite/obj34.bin"

-------------------------------------------------------------------------------

</asm>

If you check the routine of Obj34, you will see this is called from anywhere it is in the ROM. Thus, we can shift this data to another place we can edit it without any code interference. I can suggest you two locations for editing: the first is the end of the disassembly. The second is the end of the header. We will use here the end of disassembly.

Now, comment that line above and put this at the end of your disassembly: <asm>

-------------------------------------------------------------------------------
sprite mappings
-------------------------------------------------------------------------------

Obj34_MapUnc_147BA: dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 00 dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 01 dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 02 dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 03 dc.w Titlecard_MTZ-Obj34_MapUnc_147BA ; MTZ 04 dc.w Titlecard_MTZ-Obj34_MapUnc_147BA ; MTZ 05 dc.w Titlecard_WFZ-Obj34_MapUnc_147BA ; WFZ 06 dc.w Titlecard_HTZ-Obj34_MapUnc_147BA ; HTZ 07 dc.w Titlecard_HTZ-Obj34_MapUnc_147BA ; HTZ 08 dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 09 dc.w Titlecard_OOZ-Obj34_MapUnc_147BA ; OOZ 0A dc.w Titlecard_MCZ-Obj34_MapUnc_147BA ; MCZ 0B dc.w Titlecard_CNZ-Obj34_MapUnc_147BA ; CNZ 0C dc.w Titlecard_CPZ-Obj34_MapUnc_147BA ; CPZ 0D dc.w Titlecard_DEZ-Obj34_MapUnc_147BA ; DEZ 0E dc.w Titlecard_ARZ-Obj34_MapUnc_147BA ; ARZ 0F dc.w Titlecard_SCZ-Obj34_MapUnc_147BA ; SCZ 10 dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 11 dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 12 dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 13 dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 14 dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 15 dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 16 dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 17 dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 18 dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 19 dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 1A dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 1B dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 1C dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 1D dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 1E dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 1F dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 20 dc.w T_ZONE-Obj34_MapUnc_147BA ; "ZONE" dc.w T_ACT1-Obj34_MapUnc_147BA ; "1" dc.w T_ACT2-Obj34_MapUnc_147BA ; "2" dc.w T_ACT3-Obj34_MapUnc_147BA ; "3" dc.w T_STH-Obj34_MapUnc_147BA ; "SONIC THE HEDGEHOG" dc.w T_STRIPEDGE-Obj34_MapUnc_147BA ; ">"

TitleCard_EHZ: dc.w $b ; number of letters dc.w $0005, $8580, $82C0, $FFC0 ;E dc.w $0009, $85DE, $82EF, $FFD0 ;M dc.w $0005, $8580, $82C0, $FFE8 ;E dc.w $0005, $85E4, $82F2, $FFF8 ;R dc.w $0005, $85E8, $82F4, $0008 ;A dc.w $0005, $85EC, $82F6, $0018 ;L dc.w $0005, $85F0, $82F8, $0028 ;D

dc.w $0005, $85F4, $82FA, $0048 ;H dc.w $0001, $85F8, $82F2, $0058 ;I dc.w $0005, $85EC, $82F6, $0060 ;L dc.w $0005, $85EC, $82F6, $0070 ;L


TitleCard_MTZ: dc.w $a ; number of letters dc.w $0009, $85DE, $82EF, $FFE0 ;M dc.w $0005, $8580, $82C0, $FFF8 ;E dc.w $0005, $85E4, $82F2, $0008 ;T dc.w $0005, $85E8, $82F4, $0018 ;R dc.w $0005, $8588, $82C4, $0028 ;O dc.w $0005, $85EC, $82F6, $0038 ;P dc.w $0005, $8588, $82C4, $0048 ;O dc.w $0005, $85F0, $82F8, $0058 ;L dc.w $0001, $85F4, $82FA, $0068 ;I dc.w $0005, $85F6, $82FB, $0070 ;S

TitleCard_WFZ: dc.w $c ; number of letters dc.w $0009, $85DE, $82EF, $FFB0 ;W dc.w $0001, $85E4, $82F2, $FFC8 ;I dc.w $0005, $8584, $82C2, $FFD0 ;N dc.w $0005, $85E6, $82F3, $FFE0 ;G

dc.w $0005, $85EA, $82F5, $0000 ;F dc.w $0005, $8588, $82C4, $0010 ;O dc.w $0005, $85EE, $82F7, $0020 ;R dc.w $0005, $85F2, $82F9, $0030 ;T dc.w $0005, $85EE, $82F7, $0040 ;R dc.w $0005, $8580, $82C0, $0050 ;E dc.w $0005, $85F6, $82FB, $0060 ;S dc.w $0005, $85F6, $82FB, $0070 ;S

TitleCard_HTZ: dc.w $7 ; number of letters dc.w $0005, $85DE, $82EF, $0008 ;H dc.w $0001, $85E2, $82F1, $0018 ;I dc.w $0005, $85E4, $82F2, $0020 ;L dc.w $0005, $85E4, $82F2, $0030 ;L

dc.w $0005, $85E8, $82F4, $0050 ;T dc.w $0005, $8588, $82C4, $0060 ;O dc.w $0005, $85EC, $82F6, $0070 ;P

TitleCard_HPZ: dc.w $c ; number of letters dc.w $0005, $85DE, $82EF, $FFB8 ;H dc.w $0001, $85E2, $82F1, $FFC8 ;I dc.w $0005, $85E4, $82F2, $FFD0 ;D dc.w $0005, $85E4, $82F2, $FFE0 ;D dc.w $0005, $8580, $82C0, $FFF0 ;E dc.w $0005, $8584, $82C4, $0000 ;N

dc.w $0005, $85E8, $82F4, $0020 ;P dc.w $0005, $85EC, $82F6, $0030 ;A dc.w $0005, $85F0, $82F8, $0040 ;L dc.w $0005, $85EC, $82F6, $0050 ;A dc.w $0005, $85F4, $82FA, $0060 ;C dc.w $0005, $8580, $82C0, $0070 ;E

TitleCard_OOZ: dc.w $8 ; number of letters dc.w $0005, $8588, $82C4, $FFF8 ;O dc.w $0001, $85DE, $82EF, $0008 ;I dc.w $0005, $85E0, $82F0, $0010 ;L

dc.w $0005, $8588, $82C4, $0030 ;O dc.w $0005, $85E4, $82F2, $0040 ;C dc.w $0005, $8580, $82C0, $0050 ;E dc.w $0005, $85E8, $82F4, $0060 ;A dc.w $0005, $8584, $82C2, $0070 ;N

TitleCard_MCZ: dc.w $a ; number of letters dc.w $0009, $85DE, $82EF, $FFD0 ;M dc.w $0005, $85E4, $82F2, $FFE8 ;Y dc.w $0005, $85E8, $82F4, $FFF8 ;S dc.w $0005, $85EC, $82F6, $0008 ;T dc.w $0001, $85F0, $82F8, $0018 ;I dc.w $0005, $85F2, $82F9, $0020 ;C

dc.w $0005, $85F2, $82F9, $0040 ;C dc.w $0005, $85F6, $82FB, $0050 ;A dc.w $0005, $85FA, $82FD, $0060 ;V dc.w $0005, $8580, $82C0, $0070 ;E

TitleCard_CNZ: dc.w $b ; number of letters dc.w $0005, $85DE, $82EF, $FFD0 ;C dc.w $0005, $85E2, $82F1, $FFE0 ;A dc.w $0005, $85E6, $82F3, $FFF0 ;S dc.w $0001, $85EA, $82F5, $0000 ;I dc.w $0005, $8584, $82C2, $0008 ;N dc.w $0005, $8588, $82C4, $0018 ;O

dc.w $0005, $8584, $82C2, $0038 ;N dc.w $0001, $85EA, $82F5, $0048 ;I dc.w $0005, $85EC, $82F6, $0050 ;G dc.w $0005, $85F0, $82F8, $0060 ;H dc.w $0005, $85F4, $82FA, $0070 ;T

TitleCard_CPZ: dc.w $d ; number of letters dc.w $0005, $85DE, $82EF, $FFA0 ;C dc.w $0005, $85E2, $82F1, $FFB0 ;H dc.w $0005, $8580, $82C0, $FFC0 ;E dc.w $0009, $85E6, $82F3, $FFD0 ;M dc.w $0001, $85EC, $82F6, $FFE8 ;I dc.w $0005, $85DE, $82EF, $FFF0 ;C dc.w $0005, $85EE, $82F7, $0000 ;A dc.w $0005, $85F2, $82F9, $0010 ;L

dc.w $0005, $85F6, $82FB, $0030 ;P dc.w $0005, $85F2, $82F9, $0040 ;L dc.w $0005, $85EE, $82F7, $0050 ;A dc.w $0005, $8584, $82C2, $0060 ;N dc.w $0005, $85FA, $82FD, $0070 ;T

TitleCard_DEZ: dc.w $8 ; number of letters dc.w $0005, $85DE, $82EF, $FFF0 ;D dc.w $0005, $8580, $82C0, $0000 ;E dc.w $0005, $85E2, $82F1, $0010 ;A dc.w $0005, $85E6, $82F3, $0020 ;T dc.w $0005, $85EA, $82F5, $0030 ;H

dc.w $0005, $8580, $82C0, $0050 ;E dc.w $0005, $85EE, $82F7, $0060 ;G dc.w $0005, $85EE, $82F7, $0070 ;G

TitleCard_ARZ: dc.w $b ; number of letters dc.w $0005, $85DE, $82EF, $FFD0 ;A dc.w $0005, $85E2, $82F1, $FFE0 ;Q dc.w $0005, $85E6, $82F3, $FFF0 ;U dc.w $0005, $85DE, $82EF, $0000 ;A dc.w $0005, $85EA, $82F5, $0010 ;T dc.w $0001, $85EE, $82F7, $0020 ;I dc.w $0005, $85F0, $82F8, $0028 ;C

dc.w $0005, $85F4, $82FA, $0048 ;R dc.w $0005, $85E6, $82F3, $0058 ;U dc.w $0001, $85EE, $82F7, $0068 ;I dc.w $0005, $8584, $82C2, $0070 ;N

TitleCard_SCZ: dc.w $8 ; number of letters dc.w $0005, $85DE, $82EF, $FFF0 ;S dc.w $0005, $85E2, $82F1, $0000 ;K dc.w $0005, $85E6, $82F3, $0010 ;Y

dc.w $0005, $85EA, $82F5, $0030 ;C dc.w $0005, $85EE, $82F7, $0040 ;H dc.w $0005, $85F2, $82F7, $0050 ;A dc.w $0005, $85DE, $82EF, $0060 ;S dc.w $0005, $8580, $82C0, $0070 ;E

T_ZONE: dc.w $4 ; number of letters dc.w $0005, $858C, $82C6, $0000 ;Z dc.w $0005, $8588, $82C4, $0010 ;O dc.w $0005, $8584, $82C2, $0020 ;N dc.w $0005, $8580, $82C0, $0030 ;E

T_ACT1: dc.w $1 ; number of letters dc.w $0007, $A590, $A2C8, $0000 ;1

T_ACT2: dc.w $1 ; number of letters dc.w $000B, $A598, $A2CC, $0000 ;2

T_ACT3: dc.w $1 ; number of letters dc.w $000B, $A5A4, $A2D2, $0000 ;3

T_STH: dc.w $5 ; number of letters dc.w $000D, $85B0, $82DE, $FFB8 ;SONI dc.w $000D, $85B8, $82DC, $FFD8 ;C TH dc.w $000D, $85C0, $82E0, $FFF8 ;E HE dc.w $000D, $85C8, $82E4, $0018 ;DGEH dc.w $0005, $85D0, $82E8, $0038 ;OG

T_STRIPEDGE: dc.w $7 ; number of letters dc.w $9003, $85D4, $82EA, $0000 ;> dc.w $B003, $85D4, $82EA, $0000 ;> dc.w $D003, $85D4, $82EA, $0000 ;> dc.w $F003, $85D4, $82EA, $0000 ;> dc.w $1003, $85D4, $82EA, $0000 ;> dc.w $3003, $85D4, $82EA, $0000 ;> dc.w $5003, $85D4, $82EA, $0000 ;>

==================================================================

</asm>

To avoid alignment problems, add this line before and after the code above:

<asm>

   align $200

</asm>

Extending the Palette Cycle information

Now we want to locate: <asm>

off_19F4

PalCycle: dc.w PalCycle_EHZ - PalCycle ; 0 dc.w PalCycle_Null - PalCycle ; 1 dc.w PalCycle_Level2 - PalCycle ; 2 dc.w PalCycle_Null - PalCycle ; 3 dc.w PalCycle_MTZ - PalCycle ; 4 dc.w PalCycle_MTZ - PalCycle ; 5 dc.w PalCycle_WFZ - PalCycle ; 6 dc.w PalCycle_HTZ - PalCycle ; 7 dc.w PalCycle_HPZ - PalCycle ; 8 dc.w PalCycle_Null - PalCycle ; 9 dc.w PalCycle_OOZ - PalCycle ; 10 dc.w PalCycle_MCZ - PalCycle ; 11 dc.w PalCycle_CNZ - PalCycle ; 12 dc.w PalCycle_CPZ - PalCycle ; 13 dc.w PalCycle_CPZ - PalCycle ; 14 dc.w PalCycle_ARZ - PalCycle ; 15 dc.w PalCycle_WFZ - PalCycle ; 16 </asm>

and replace it with: <asm>

off_19F4

PalCycle: dc.w PalCycle_EHZ - PalCycle ; 00 dc.w PalCycle_Null - PalCycle ; 01 dc.w PalCycle_Level2 - PalCycle ; 02 dc.w PalCycle_Null - PalCycle ; 03 dc.w PalCycle_MTZ - PalCycle ; 04 dc.w PalCycle_MTZ - PalCycle ; 05 dc.w PalCycle_WFZ - PalCycle ; 06 dc.w PalCycle_HTZ - PalCycle ; 07 dc.w PalCycle_HPZ - PalCycle ; 08 dc.w PalCycle_Null - PalCycle ; 09 dc.w PalCycle_OOZ - PalCycle ; 0A dc.w PalCycle_MCZ - PalCycle ; 0B dc.w PalCycle_CNZ - PalCycle ; 0C dc.w PalCycle_CPZ - PalCycle ; 0D dc.w PalCycle_CPZ - PalCycle ; 0E dc.w PalCycle_ARZ - PalCycle ; 0F dc.w PalCycle_WFZ - PalCycle ; 10 dc.w PalCycle_Null - PalCycle ; 11 dc.w PalCycle_Null - PalCycle ; 12 dc.w PalCycle_Null - PalCycle ; 13 dc.w PalCycle_Null - PalCycle ; 14 dc.w PalCycle_Null - PalCycle ; 15 dc.w PalCycle_Null - PalCycle ; 16 dc.w PalCycle_Null - PalCycle ; 17 dc.w PalCycle_Null - PalCycle ; 18 dc.w PalCycle_Null - PalCycle ; 19 dc.w PalCycle_Null - PalCycle ; 1A dc.w PalCycle_Null - PalCycle ; 1B dc.w PalCycle_Null - PalCycle ; 1C dc.w PalCycle_Null - PalCycle ; 1D dc.w PalCycle_Null - PalCycle ; 1E dc.w PalCycle_Null - PalCycle ; 1F dc.w PalCycle_Null - PalCycle ; 20 </asm>

That inserts empty slots for the cycling palettes of out new levels.

Extending the static palette list

Next we locate: <asm> PalPointers: palptr Pal_SEGA, Normal_palette, $1F palptr Pal_Title, Normal_palette_line2, 7 palptr Pal_UNK1, Normal_palette, $1F palptr Pal_BGND, Normal_palette, $F palptr Pal_EHZ, Normal_palette_line2, $17 palptr Pal_EHZ, Normal_palette_line2, $17 palptr Pal_WZ, Normal_palette_line2, $17 palptr Pal_EHZ, Normal_palette_line2, $17 palptr Pal_MTZ, Normal_palette_line2, $17 palptr Pal_MTZ, Normal_palette_line2, $17 palptr Pal_WFZ, Normal_palette_line2, $17 palptr Pal_HTZ, Normal_palette_line2, $17 palptr Pal_HPZ, Normal_palette_line2, $17 palptr Pal_EHZ, Normal_palette_line2, $17 palptr Pal_OOZ, Normal_palette_line2, $17 palptr Pal_MCZ, Normal_palette_line2, $17 palptr Pal_CNZ, Normal_palette_line2, $17 palptr Pal_CPZ, Normal_palette_line2, $17 palptr Pal_DEZ, Normal_palette_line2, $17 palptr Pal_ARZ, Normal_palette_line2, $17 palptr Pal_SCZ, Normal_palette_line2, $17 palptr Pal_HPZ_U, Normal_palette, $1F palptr Pal_CPZ_U, Normal_palette, $1F palptr Pal_ARZ_U, Normal_palette, $1F palptr Pal_SS, Normal_palette, $17 palptr Pal_UNK2, Normal_palette_line2, 7 palptr Pal_UNK3, Normal_palette_line2, 7 palptr Pal_SS1, Normal_palette_line4, 7 palptr Pal_SS2, Normal_palette_line4, 7 palptr Pal_SS3, Normal_palette_line4, 7 palptr Pal_SS4, Normal_palette_line4, 7 palptr Pal_SS5, Normal_palette_line4, 7 palptr Pal_SS6, Normal_palette_line4, 7 palptr Pal_SS7, Normal_palette_line4, 7 palptr Pal_UNK4, Normal_palette_line4, 7 palptr Pal_UNK5, Normal_palette_line4, 7 palptr Pal_UNK6, Normal_palette_line4, 7 palptr Pal_OOZ_B, Normal_palette_line2, 7 palptr Pal_Menu, Normal_palette, $1F palptr Pal_UNK7, Normal_palette, $1F  ; palette index $27.

----------------------------------------------------------------------------

</asm>

We all know that the palettes are directly addressed here. It means the index above can detect palettes anywhere in the ROM. This label, PalPointers, is called directly. We can, then, move this table to any location we want it in the ROM. Put this after:

<asm>

   EndOfHeader:

</asm>

And after this table, put the following line to avoid alignment errors:

<asm>

   align $200

</asm>

You can add more indexes to this table this way: <asm> palptr Palette, Normal_palette_line2, $17 </asm>

for a normal level palette, and, for a underwater level palette, you will add the normal palette for that level and its underwater palette. <asm> palptr UnderwaterPalette, Normal_palette_line, $1F </asm>

You must only have attention when adding more palettes to don't overflow the palette index (yes, it is possible to have 255 palettes...).

Extending Zone Procedures and Scripts

Now we need to add the zone scripts.

Find: <asm> PLC_DYNANM: ; Zone ID dc.w Dynamic_Normal-PLC_DYNANM ; $00 dc.w Animated_EHZ-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM ; $01 dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM ; $02 dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM ; $03 dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Normal-PLC_DYNANM ; $04 dc.w Animated_MTZ-PLC_DYNANM

dc.w Dynamic_Normal-PLC_DYNANM ; $05 dc.w Animated_MTZ-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM ; $06 dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_HTZ-PLC_DYNANM ; $07 dc.w Animated_HTZ-PLC_DYNANM

dc.w Dynamic_Normal-PLC_DYNANM ; $08 dc.w Animated_OOZ-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM ; $09 dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Normal-PLC_DYNANM ; $0A dc.w Animated_OOZ2-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM ; $0B dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_CNZ-PLC_DYNANM ; $0C dc.w Animated_CNZ-PLC_DYNANM

dc.w Dynamic_Normal-PLC_DYNANM ; $0D dc.w Animated_CPZ-PLC_DYNANM

dc.w Dynamic_Normal-PLC_DYNANM ; $0F dc.w Animated_DEZ-PLC_DYNANM

dc.w Dynamic_ARZ-PLC_DYNANM ; $10 dc.w Animated_ARZ-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM ; $11 dc.w Animated_Null-PLC_DYNANM ; yes, level $11 </asm>

and add to the end of it: <asm> dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM

dc.w Dynamic_Null-PLC_DYNANM dc.w Animated_Null-PLC_DYNANM </asm>

This creates scripts for the new levels. To make complex animations (like the HPZ pulsing ball) you will need to create a Anim*level*.bin and add it to the Anim*level*.bin files and add it to the animated pattern mappings. See the section below.

Extending Animated Pattern Mappings

Find: <asm> AnimPatMaps: dc.w APM16_EHZ - AnimPatMaps ; 0 dc.w APM_Null - AnimPatMaps  ; 1 dc.w APM_Null - AnimPatMaps  ; 2 dc.w APM_Null - AnimPatMaps  ; 3 dc.w APM16_MTZ - AnimPatMaps ; 4 dc.w APM16_MTZ - AnimPatMaps ; 5 dc.w APM_Null - AnimPatMaps  ; 6 dc.w APM16_EHZ - AnimPatMaps ; 7 dc.w APM_HPZ - AnimPatMaps  ; 8 dc.w APM_Null - AnimPatMaps  ; 9 dc.w APM_OOZ - AnimPatMaps  ; $A dc.w APM_Null - AnimPatMaps  ; $B dc.w APM_CNZ - AnimPatMaps  ; $C dc.w APM_CPZ - AnimPatMaps  ; $D dc.w APM_DEZ - AnimPatMaps  ; $E dc.w APM_ARZ - AnimPatMaps  ; $F dc.w APM_Null - AnimPatMaps  ;$10 </asm>

then add this to the end of this index: <asm> dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps dc.w APM_Null - AnimPatMaps </asm>

then edit and change as needed. Add the new .bin files to below here: <asm>

byte_40372

APM16_EHZ: BINCLUDE "mappings/16x16/AnimEHZ.bin"

byte_403EE

APM16_MTZ: BINCLUDE "mappings/16x16/AnimMTZ.bin"

byte_404C2

APM_HPZ: BINCLUDE "mappings/16x16/AnimHPZ.bin"

byte_405B6

APM_OOZ: BINCLUDE "mappings/16x16/AnimOOZ.bin"

byte_4061A

APM_CNZ: BINCLUDE "mappings/16x16/AnimCNZ.bin"

byte_406BE

APM_CNZ2P: BINCLUDE "mappings/16x16/AnimCNZ2P.bin"

byte_40762

APM_CPZ: BINCLUDE "mappings/16x16/AnimCPZ.bin"

byte_4076E

APM_DEZ: BINCLUDE "mappings/16x16/AnimDEZ.bin"

byte_4077A

APM_ARZ: BINCLUDE "mappings/16x16/AnimARZ.bin"

byte_407BE

APM_Null: dc.w 0 </asm>

and fit this table to suit your needs, creating the necessary load queries for them. (If so, you need to know what you're doing here.)

Extending the 1 Player and 2 Player music playlists

To avoid some code-breaking problems (branches), we will fix this using a different way.

Go to EndOfHeader. If you are really following this tutorial, you've put a PalPointers table there. You will add between those two labels the following procedure: <asm> DefineLevelBGM: moveq #0,d0 move.b (Current_Zone).w,d0 lea (NormalMusicList).l,a1 tst.w (Two_Player_Mode).w beq.s PlayNormalMusic lea (MusicList2PMode).l,a1

PlayNormalMusic: move.b (a1,d0.w),d0 move.w d0,(Level_Music).w bsr.w JTR_PlayMusic jmp Level_TtlCard rts

JTR_PlayMusic: jmp PlayMusic rts

NormalMusicList:

   dc.b    $82    ;00
   dc.b    $82    ;01
   dc.b    $82    ;02
   dc.b    $82    ;03
   dc.b    $85    ;04
   dc.b    $85    ;05
   dc.b    $8F    ;06
   dc.b    $86    ;07
   dc.b    $90    ;08
   dc.b    $82    ;09
   dc.b    $84    ;0A
   dc.b    $8B    ;0B
   dc.b    $89    ;0C
   dc.b    $8E    ;0D
   dc.b    $8A    ;0E
   dc.b    $87    ;0F
   dc.b    $8D    ;10
   dc.b    $82    ;11
   dc.b    $82    ;12
   dc.b    $82    ;13
   dc.b    $82    ;14
   dc.b    $82    ;15
   dc.b    $82    ;16
   dc.b    $82    ;17
   dc.b    $82    ;18
   dc.b    $82    ;19
   dc.b    $82    ;1A
   dc.b    $82    ;1B
   dc.b    $82    ;1C
   dc.b    $82    ;1D
   dc.b    $82    ;1E
   dc.b    $82    ;1F
   dc.b    $82    ;20
   align 4

MusicList2PMode:

   dc.b    $8C    ;00
   dc.b    $82    ;01
   dc.b    $82    ;02
   dc.b    $82    ;03
   dc.b    $85    ;04
   dc.b    $85    ;05
   dc.b    $8F    ;06
   dc.b    $86    ;07
   dc.b    $90    ;08
   dc.b    $82    ;09
   dc.b    $84    ;0A
   dc.b    $83    ;0B
   dc.b    $88    ;0C
   dc.b    $8E    ;0D
   dc.b    $8A    ;0E
   dc.b    $87    ;0F
   dc.b    $8D    ;10
   dc.b    $82    ;11
   dc.b    $82    ;12
   dc.b    $82    ;13
   dc.b    $82    ;14
   dc.b    $82    ;15
   dc.b    $82    ;16
   dc.b    $82    ;17
   dc.b    $82    ;18
   dc.b    $82    ;19
   dc.b    $82    ;1A
   dc.b    $82    ;1B
   dc.b    $82    ;1C
   dc.b    $82    ;1D
   dc.b    $82    ;1E
   dc.b    $82    ;1F
   dc.b    $82    ;20
   align $200

</asm>

Now, go to Level_GetBGM. You will see this: <asm>

loc_40AE

Level_GetBgm: tst.w (Demo_mode_flag).w bmi.s loc_4114 moveq #0,d0 move.b (Current_Zone).w,d0 lea MusicList(pc),a1 tst.w (Two_player_mode).w beq.s Level_PlayBgm lea MusicList2(pc),a1 </asm>

and replace it with: <asm>

loc_40AE

Level_GetBgm: tst.w (Demo_mode_flag).w bmi.s loc_4114 jmp DefineLevelBGM </asm>

Extending the demo list

now we will prepare everything so that we can put in new demo files for our new levels.

find: <asm>; off_4948: DemoScriptPointers: dc.l Demo_EHZ ; $00 dc.l Demo_EHZ ; $01 dc.l Demo_EHZ ; $02 dc.l Demo_EHZ ; $03 dc.l Demo_EHZ ; $04 dc.l Demo_EHZ ; $05 dc.l Demo_EHZ ; $06 dc.l Demo_EHZ ; $07 dc.l Demo_EHZ ; $08 dc.l Demo_EHZ ; $09 dc.l Demo_EHZ ; $0A dc.l Demo_EHZ ; $0B dc.l Demo_CNZ ; $0C dc.l Demo_CPZ ; $0D dc.l Demo_EHZ ; $0E dc.l Demo_ARZ ; $0F dc.l Demo_EHZ ; $10 </asm>

and insert after it: <asm> dc.l Demo_EHZ ; $11 dc.l Demo_EHZ ; $12 dc.l Demo_EHZ ; $13 dc.l Demo_EHZ ; $14 dc.l Demo_EHZ ; $15 dc.l Demo_EHZ ; $16 dc.l Demo_EHZ ; $17 dc.l Demo_EHZ ; $18 dc.l Demo_EHZ ; $19 dc.l Demo_EHZ ; $1A dc.l Demo_EHZ ; $1B dc.l Demo_EHZ ; $1C dc.l Demo_EHZ ; $1D dc.l Demo_EHZ ; $1E dc.l Demo_EHZ ; $1F dc.l Demo_EHZ ; $20 </asm>

Extending the Collision index

You would want solidity in your new zones, wouldn't you? Here we will extend the solidity list so that our extra levels can have solid ground for that blue hedgehog to walk on.

Well. We will fit, first, the collision procedure. This way, we can merge both tables into only one.

Find: <asm> LoadCollisionIndexes: moveq #0,d0 move.b (Current_Zone).w,d0 lsl.w #2,d0 move.l #Primary_Collision,(Collision_addr).w move.w d0,-(sp) movea.l Off_ColP(pc,d0.w),a0 lea (Primary_Collision).w,a1 bsr.w KosDec move.w (sp)+,d0 movea.l Off_ColS(pc,d0.w),a0 lea (Secondary_Collision).w,a1 bra.w KosDec </asm>

Now, replace it with this: <asm> moveq #0,d0 move.b (Current_Zone).w,d0 add.w #1,d0; =pointer index: 1. add.w d0,d0; =x2 add.w d0,d0; =x4 add.w d0,d0; =x8

move.l #Primary_Collision,(Collision_addr).w

movea.l Off_ColP(pc,d0.w),a0 lea (Primary_Collision).w,a1 bsr.w KosDec

movea.l Off_ColS(pc,d0.w),a0 lea (Secondary_Collision).w,a1 bsr.w KosDec </asm>

To fit the merged table with the existing labels, we will start indexing at pointer 1 instead of pointer 0. Now, we will create the new table.

Change: <asm>

===========================================================================
---------------------------------------------------------------------------
Pointers to primary collision indexes
Contains an array of pointers to the primary collision index data for each
level. 1 pointer for each level, pointing the primary collision index.
---------------------------------------------------------------------------

Off_ColP: dc.l ColP_EHZHTZ dc.l Off_Level ; 1 dc.l ColP_MTZ ; 2 dc.l Off_Level ; 3 dc.l ColP_MTZ ; 4 dc.l ColP_MTZ ; 5 dc.l ColP_WFZSCZ ; 6 dc.l ColP_EHZHTZ ; 7 dc.l ColP_OOZ ; 8 dc.l Off_Level ; 9 dc.l ColP_OOZ ; 10 dc.l ColP_MCZ ; 11 dc.l ColP_CNZ ; 12 dc.l ColP_CPZDEZ ; 13 dc.l ColP_CPZDEZ ; 14 dc.l ColP_ARZ ; 15 dc.l ColP_WFZSCZ ; 16 dc.l ColP_EHZHTZ ;$11 dc.l ColP_EHZHTZ ;$12 dc.l ColP_EHZHTZ ;$13 dc.l ColP_EHZHTZ ;$14 dc.l ColP_EHZHTZ ;$15 dc.l ColP_EHZHTZ ;$16 dc.l ColP_EHZHTZ ;$17 dc.l ColP_EHZHTZ ;$18 dc.l ColP_EHZHTZ ;$19 dc.l ColP_EHZHTZ ;$1A dc.l ColP_EHZHTZ ;$1B dc.l ColP_EHZHTZ ;$1C dc.l ColP_EHZHTZ ;$1D dc.l ColP_EHZHTZ ;$1E dc.l ColP_EHZHTZ ;$1F dc.l ColP_EHZHTZ ;$20

---------------------------------------------------------------------------
Pointers to secondary collision indexes
Contains an array of pointers to the secondary collision index data for
each level. 1 pointer for each level, pointing the secondary collision
index.
---------------------------------------------------------------------------

Off_ColS: dc.l ColS_EHZHTZ dc.l Off_Level ; 1 dc.l ColP_MTZ ; 2 dc.l Off_Level ; 3 dc.l ColP_MTZ ; 4 dc.l ColP_MTZ ; 5 dc.l ColS_WFZSCZ ; 6 dc.l ColS_EHZHTZ ; 7 dc.l ColP_OOZ ; 8 dc.l Off_Level ; 9 dc.l ColP_OOZ ; 10 dc.l ColP_MCZ ; 11 dc.l ColS_CNZ ; 12 dc.l ColS_CPZDEZ ; 13 dc.l ColS_CPZDEZ ; 14 dc.l ColS_ARZ ; 15 dc.l ColS_WFZSCZ ; 16 dc.l ColS_EHZHTZ ;$11 dc.l ColS_EHZHTZ ;$12 dc.l ColS_EHZHTZ ;$13 dc.l ColS_EHZHTZ ;$14 dc.l ColS_EHZHTZ ;$15 dc.l ColS_EHZHTZ ;$16 dc.l ColS_EHZHTZ ;$17 dc.l ColS_EHZHTZ ;$18 dc.l ColS_EHZHTZ ;$19 dc.l ColS_EHZHTZ ;$1A dc.l ColS_EHZHTZ ;$1B dc.l ColS_EHZHTZ ;$1C dc.l ColS_EHZHTZ ;$1D dc.l ColS_EHZHTZ ;$1E dc.l ColS_EHZHTZ ;$1F dc.l ColS_EHZHTZ ;$20 </asm>

To: <asm> Off_ColP: dc.l 0 Off_ColS: dc.l 0 CollisionData: ; this label is unnecessary, but we will use this just for educational issues. dc.l ColP_EHZHTZ, ColS_EHZHTZ ;00 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;01 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;02 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;03 dc.l ColP_MTZ, ColP_MTZ ;04 dc.l ColP_MTZ, ColP_MTZ ;05 dc.l ColP_WFZSCZ, ColS_WFZSCZ ;06 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;07 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;08 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;09 dc.l ColP_OOZ, ColP_OOZ ;0A dc.l ColP_MCZ, ColP_MCZ ;0B dc.l ColP_CNZ, ColS_CNZ ;0C dc.l ColP_CPZ, ColS_CPZ ;0D dc.l ColP_CPZ, ColS_CPZ ;0E dc.l ColP_ARZ, ColS_ARZ ;0F dc.l ColP_WFZSCZ, ColS_WFZSCZ ;10 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;11 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;12 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;13 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;14 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;15 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;16 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;17 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;18 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;19 dc.l ColP_EHZHTZ, ColS_EHZHTZ ;1A dc.l ColP_EHZHTZ, ColS_EHZHTZ ;1B dc.l ColP_EHZHTZ, ColS_EHZHTZ ;1C dc.l ColP_EHZHTZ, ColS_EHZHTZ ;1D dc.l ColP_EHZHTZ, ColS_EHZHTZ ;1E dc.l ColP_EHZHTZ, ColS_EHZHTZ ;1F dc.l ColP_EHZHTZ, ColS_EHZHTZ ;20 </asm>

Of course, you can get rid of Off_ColP and Off_ColS labels and indexes by commenting the line:

<asm> add.w #1,d0 </asm>

Changing Off_ColP to CollisionData and Off_ColS to CollisionData+4 in the procedure above.

Extending Rings Index

Instead of doing the word-offset table, we will make a dynamic call routine, like collisions. Of course, we won´t work with compressed ring placement.

We find, initially: <asm> loc_172A4: clearRAM Ring_Positions,$600 ; d0 = 0 lea ($FFFFEF80).w,a1 move.w #bytesToLcnt($40),d1 - move.l d0,(a1)+ dbf d1,-

moveq #0,d5 moveq #0,d0 move.w (Current_ZoneAndAct).w,d0 ror.b #1,d0 lsr.w #6,d0 lea (Off_Rings).l,a1 move.w (a1,d0.w),d0 lea (a1,d0.w),a1 lea ($FFFFE806).w,a2

loc_172E0: </asm>

And change it to: <asm> loc_172A4: jmp CarregarAneis rts

loc_172E0: </asm>

Now, we put the following routine at a good place: <asm> align $40

CarregarAneis: clearRAM Ring_Positions,$600 ; d0 = 0 lea ($FFFFEF80).w,a1 move.w #bytesToLcnt($40),d1 - move.l d0,(a1)+ dbf d1,-

moveq #0,d5 moveq #0,d0 ; convert zone/act data for an useable format, sequential move.w (Current_ZoneAndAct).w,d0

ror.b #1,d0 lsr.w #6,d0 ;this yields an 8-byte jump. add.l d0,d0

movea.l RingData(pc,d0.l),a1 ; this allows ring data anywhere in the ROM. lea ($FFFFE806).w,a2 jmp loc_172E0 rts

RingData: dc.l Rings_EHZ_1, Rings_EHZ_2 ;00 dc.l Rings_EHZ_1, Rings_EHZ_2 ;01 dc.l Rings_EHZ_1, Rings_EHZ_2 ;02 dc.l Rings_EHZ_1, Rings_EHZ_2 ;03 dc.l Rings_MTZ_1, Rings_MTZ_2 ;04 dc.l Rings_MTZ_3, Rings_MTZ_3 ;05 dc.l Rings_WFZ_1, Rings_WFZ_1 ;06 dc.l Rings_HTZ_1, Rings_HTZ_2 ;07 dc.l Rings_EHZ_1, Rings_EHZ_2 ;08 dc.l Rings_EHZ_1, Rings_EHZ_2 ;09 dc.l Rings_OOZ_1, Rings_OOZ_2 ;0A dc.l Rings_MCZ_1, Rings_MCZ_2 ;0B dc.l Rings_CNZ_1, Rings_CNZ_2 ;0C dc.l Rings_CPZ_1, Rings_CPZ_2 ;0D dc.l Rings_DEZ_1, Rings_DEZ_1 ;0E dc.l Rings_ARZ_1, Rings_ARZ_2 ;0F dc.l Rings_SCZ_1, Rings_SCZ_1 ;10 dc.l Rings_EHZ_1, Rings_EHZ_2 ;11 dc.l Rings_EHZ_1, Rings_EHZ_2 ;12 dc.l Rings_EHZ_1, Rings_EHZ_2 ;13 dc.l Rings_EHZ_1, Rings_EHZ_2 ;14 dc.l Rings_EHZ_1, Rings_EHZ_2 ;15 dc.l Rings_EHZ_1, Rings_EHZ_2 ;16 dc.l Rings_EHZ_1, Rings_EHZ_2 ;17 dc.l Rings_EHZ_1, Rings_EHZ_2 ;18 dc.l Rings_EHZ_1, Rings_EHZ_2 ;19 dc.l Rings_EHZ_1, Rings_EHZ_2 ;1A dc.l Rings_EHZ_1, Rings_EHZ_2 ;1B dc.l Rings_EHZ_1, Rings_EHZ_2 ;1C dc.l Rings_EHZ_1, Rings_EHZ_2 ;1D dc.l Rings_EHZ_1, Rings_EHZ_2 ;1E dc.l Rings_EHZ_1, Rings_EHZ_2 ;1F dc.l Rings_EHZ_1, Rings_EHZ_2 ;20

align $80 </asm>

You can put this before PalPointers, if you relocated that table as described before.

This routine directly calls the desired ring placement, with no need of attaching them to the table, like the word-offset index does.

Extending the object index

We will make a similar extension for objects. Look for: <asm> loc_17AB8: addq.b #2,(Obj_placement_routine).w move.w (Current_ZoneAndAct).w,d0 ; If level == $0F (ARZ)... ror.b #1,d0 ; then this yields $87... lsr.w #6,d0 ; and this yields $0002. lea (Off_Objects).l,a0 ; Next, we load the first pointer in the object layout list pointer index, movea.l a0,a1 ; then copy it for quicker use later. adda.w (a0,d0.w),a0 ; (Point1 * 2) + $0002 tst.w (Two_player_mode).w ; skip if not in 2-player vs mode beq.s loc_17AF0 cmpi.b #$C,(Current_Zone).w ; skip if not Casino Night Zone bne.s loc_17AF0 lea (Objects_CNZ1_2P).l,a0 ; CNZ 1 2-player object layout tst.b (Current_Act).w ; skip if not past act 1 beq.s loc_17AF0 lea (Objects_CNZ2_2P).l,a0 ; CNZ 2 2-player object layout

loc_17AF0: </asm>

And change that to: <asm> loc_17AB8: jmp CarregarObjetos rts

loc_17AF0: </asm>

Now, put this routine into a good place. If you relocated PalPointers like described before, put this before PalPointers: <asm> align $40

CarregarObjetos: addq.b #2,(Obj_placement_routine).w

moveq #0,d0 move.w (Current_ZoneAndAct).w,d0 ; If level == $0F (ARZ)... ror.b #1,d0 lsr.w #6,d0 add.l d0,d0 movea.l ObjPosData(pc,d0.l),a0 movea.l a0,a1

tst.w (Two_player_mode).w ; skip if not in 2-player vs mode beq.s loc_017AF0 cmpi.b #$C,(Current_Zone).w ; skip if not Casino Night Zone bne.s loc_017AF0 lea (Objects_CNZ1_2P).l,a0 ; CNZ 1 2-player object layout tst.b (Current_Act).w ; skip if not past act 1 beq.s loc_017AF0 lea (Objects_CNZ2_2P).l,a0 ; CNZ 2 2-player object layout

loc_017AF0: jmp loc_17AF0 rts

ObjPosData: dc.l Objects_EHZ_1, Objects_EHZ_2 ;00 dc.l Objects_EHZ_1, Objects_EHZ_2 ;01 dc.l Objects_EHZ_1, Objects_EHZ_2 ;02 dc.l Objects_EHZ_1, Objects_EHZ_2 ;03 dc.l Objects_MTZ_1, Objects_MTZ_2 ;04 dc.l Objects_MTZ_3, Objects_MTZ_3 ;05 dc.l Objects_WFZ_1, Objects_WFZ_1 ;06 dc.l Objects_HTZ_1, Objects_HTZ_2 ;07 dc.l Objects_EHZ_1, Objects_EHZ_2 ;08 dc.l Objects_EHZ_1, Objects_EHZ_2 ;09 dc.l Objects_OOZ_1, Objects_OOZ_2 ;0A dc.l Objects_MCZ_1, Objects_MCZ_2 ;0B dc.l Objects_CNZ_1, Objects_CNZ_2 ;0C dc.l Objects_CPZ_1, Objects_CPZ_2 ;0D dc.l Objects_DEZ_1, Objects_DEZ_1 ;0E dc.l Objects_ARZ_1, Objects_ARZ_2 ;0F dc.l Objects_SCZ_1, Objects_SCZ_1 ;10 dc.l Objects_EHZ_1, Objects_EHZ_2 ;11 dc.l Objects_EHZ_1, Objects_EHZ_2 ;12 dc.l Objects_EHZ_1, Objects_EHZ_2 ;13 dc.l Objects_EHZ_1, Objects_EHZ_2 ;14 dc.l Objects_EHZ_1, Objects_EHZ_2 ;15 dc.l Objects_EHZ_1, Objects_EHZ_2 ;16 dc.l Objects_EHZ_1, Objects_EHZ_2 ;17 dc.l Objects_EHZ_1, Objects_EHZ_2 ;18 dc.l Objects_EHZ_1, Objects_EHZ_2 ;19 dc.l Objects_EHZ_1, Objects_EHZ_2 ;1A dc.l Objects_EHZ_1, Objects_EHZ_2 ;1B dc.l Objects_EHZ_1, Objects_EHZ_2 ;1C dc.l Objects_EHZ_1, Objects_EHZ_2 ;1D dc.l Objects_EHZ_1, Objects_EHZ_2 ;1E dc.l Objects_EHZ_1, Objects_EHZ_2 ;1F dc.l Objects_EHZ_1, Objects_EHZ_2 ;20

align $80 </asm>

Extending tiles and patterns index

Subsection Test

Find: <asm>

----------------------------------------------------------------------------------
EHZ 16x16 block mappings (Kosinski compression) ; was
(Kozinski compression)

BM16_EHZ: BINCLUDE "mappings/16x16/EHZ.bin"

-----------------------------------------------------------------------------------
EHZ/HTZ main level patterns (Kosinski compression)
ArtKoz_95C24

ArtKos_EHZ: BINCLUDE "art/kosinski/EHZ_HTZ.bin"

-----------------------------------------------------------------------------------
HTZ 16x16 block mappings (Kosinski compression)

BM16_HTZ: BINCLUDE "mappings/16x16/HTZ.bin"

-----------------------------------------------------------------------------------
HTZ pattern suppliment to EHZ level patterns (Kosinski compression)
ArtKoz_98AB4

ArtKos_HTZ: BINCLUDE "art/kosinski/HTZ_Supp.bin"

-----------------------------------------------------------------------------------
EHZ/HTZ 128x128 block mappings (Kosinski compression)

BM128_EHZ: BINCLUDE "mappings/128x128/EHZ_HTZ.bin"

-----------------------------------------------------------------------------------
MTZ 16x16 block mappings (Kosinski compression)

BM16_MTZ: BINCLUDE "mappings/16x16/MTZ.bin"

-----------------------------------------------------------------------------------
MTZ main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_MTZ: BINCLUDE "art/kosinski/MTZ.bin"

-----------------------------------------------------------------------------------
MTZ 128x128 block mappings (Kosinski compression)

BM128_MTZ: BINCLUDE "mappings/128x128/MTZ.bin"

-----------------------------------------------------------------------------------
OOZ 16x16 block mappings (Kosinski compression)

BM16_OOZ: BINCLUDE "mappings/16x16/OOZ.bin"

-----------------------------------------------------------------------------------
OOZ main level patterns (Kosinski compression)
ArtKoz_A4204

ArtKos_OOZ: BINCLUDE "art/kosinski/OOZ.bin"

-----------------------------------------------------------------------------------
OOZ 128x128 block mappings (Kosinski compression)

BM128_OOZ: BINCLUDE "mappings/128x128/OOZ.bin"

-----------------------------------------------------------------------------------
MCZ 16x16 block mappings (Kosinski compression)

BM16_MCZ: BINCLUDE "mappings/16x16/MCZ.bin"

-----------------------------------------------------------------------------------
MCZ main level patterns (Kosinski compression)
ArtKoz_A9D74

ArtKos_MCZ: BINCLUDE "art/kosinski/MCZ.bin"

-----------------------------------------------------------------------------------
MCZ 128x128 block mappings (Kosinski compression)

BM128_MCZ: BINCLUDE "mappings/128x128/MCZ.bin"

-----------------------------------------------------------------------------------
CNZ 16x16 block mappings (Kosinski compression)

BM16_CNZ: BINCLUDE "mappings/16x16/CNZ.bin"

-----------------------------------------------------------------------------------
CNZ main level patterns (Kosinski compression)
ArtKoz_B0894

ArtKos_CNZ: BINCLUDE "art/kosinski/CNZ.bin"

-----------------------------------------------------------------------------------
CNZ 128x128 block mappings (Kosinski compression)

BM128_CNZ: BINCLUDE "mappings/128x128/CNZ.bin"

-----------------------------------------------------------------------------------
CPZ/DEZ 16x16 block mappings (Kosinski compression)

BM16_CPZ: BINCLUDE "mappings/16x16/CPZ_DEZ.bin"

-----------------------------------------------------------------------------------
CPZ/DEZ main level patterns (Kosinski compression)
ArtKoz_B6174

ArtKos_CPZ: BINCLUDE "art/kosinski/CPZ_DEZ.bin"

-----------------------------------------------------------------------------------
CPZ/DEZ 128x128 block mappings (Kosinski compression)

BM128_CPZ: BINCLUDE "mappings/128x128/CPZ_DEZ.bin"

-----------------------------------------------------------------------------------
ARZ 16x16 block mappings (Kosinski compression)

BM16_ARZ: BINCLUDE "mappings/16x16/ARZ.bin"

-----------------------------------------------------------------------------------
ARZ main level patterns (Kosinski compression)
ArtKoz_BCC24

ArtKos_ARZ: BINCLUDE "art/kosinski/ARZ.bin"

-----------------------------------------------------------------------------------
ARZ 128x128 block mappings (Kosinski compression)

BM128_ARZ: BINCLUDE "mappings/128x128/ARZ.bin"

-----------------------------------------------------------------------------------
WFZ/SCZ 16x16 block mappings (Kosinski compression)

BM16_WFZ: BINCLUDE "mappings/16x16/WFZ_SCZ.bin"

-----------------------------------------------------------------------------------
WFZ/SCZ main level patterns (Kosinski compression)
ArtKoz_C5004

ArtKos_SCZ: BINCLUDE "art/kosinski/WFZ_SCZ.bin"

-----------------------------------------------------------------------------------
WFZ pattern suppliment to SCZ tiles (Kosinski compression)
ArtKoz_C7EC4

ArtKos_WFZ: BINCLUDE "art/kosinski/WFZ_Supp.bin"

-----------------------------------------------------------------------------------
WFZ/SCZ 128x128 block mappings (Kosinski compression)

BM128_WFZ: BINCLUDE "mappings/128x128/WFZ_SCZ.bin" </asm>

then add this to the end: <asm>

-----------------------------------------------------------------------------------
Lev_11 16x16 block mappings (Kosinski compression)

BM16_Lev_11: BINCLUDE "mappings/16x16/Lev_11.bin"

-----------------------------------------------------------------------------------
Lev_11 main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_11: BINCLUDE "art/kosinski/Lev_11.bin"

-----------------------------------------------------------------------------------
Lev_11 128x128 block mappings (Kosinski compression)

BM128_Lev_11: BINCLUDE "mappings/128x128/Lev_11.bin"

-----------------------------------------------------------------------------------
Lev_12 16x16 block mappings (Kosinski compression)

BM16_Lev_12: BINCLUDE "mappings/16x16/Lev_12.bin"

-----------------------------------------------------------------------------------
Lev_12 main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_12: BINCLUDE "art/kosinski/Lev_12.bin"

-----------------------------------------------------------------------------------
Lev_12 128x128 block mappings (Kosinski compression)

BM128_Lev_12: BINCLUDE "mappings/128x128/Lev_12.bin"

-----------------------------------------------------------------------------------
Lev_13 16x16 block mappings (Kosinski compression)

BM16_Lev_13: BINCLUDE "mappings/16x16/Lev_13.bin"

-----------------------------------------------------------------------------------
Lev_13 main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_13: BINCLUDE "art/kosinski/Lev_13.bin"

-----------------------------------------------------------------------------------
Lev_13 128x128 block mappings (Kosinski compression)

BM128_Lev_13: BINCLUDE "mappings/128x128/Lev_13.bin"

-----------------------------------------------------------------------------------
Lev_14 16x16 block mappings (Kosinski compression)

BM16_Lev_14: BINCLUDE "mappings/16x16/Lev_14.bin"

-----------------------------------------------------------------------------------
Lev_14 main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_14: BINCLUDE "art/kosinski/Lev_14.bin"

-----------------------------------------------------------------------------------
Lev_14 128x128 block mappings (Kosinski compression)

BM128_Lev_14: BINCLUDE "mappings/128x128/Lev_14.bin"

-----------------------------------------------------------------------------------
Lev_15 16x16 block mappings (Kosinski compression)

BM16_Lev_15: BINCLUDE "mappings/16x16/Lev_15.bin"

-----------------------------------------------------------------------------------
Lev_15 main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_15: BINCLUDE "art/kosinski/Lev_15.bin"

-----------------------------------------------------------------------------------
Lev_15 128x128 block mappings (Kosinski compression)

BM128_Lev_15: BINCLUDE "mappings/128x128/Lev_15.bin"

-----------------------------------------------------------------------------------
Lev_16 16x16 block mappings (Kosinski compression)

BM16_Lev_16: BINCLUDE "mappings/16x16/Lev_16.bin"

-----------------------------------------------------------------------------------
Lev_16 main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_16: BINCLUDE "art/kosinski/Lev_16.bin"

-----------------------------------------------------------------------------------
Lev_16 128x128 block mappings (Kosinski compression)

BM128_Lev_16: BINCLUDE "mappings/128x128/Lev_16.bin"

-----------------------------------------------------------------------------------
Lev_17 16x16 block mappings (Kosinski compression)

BM16_Lev_17: BINCLUDE "mappings/16x16/Lev_17.bin"

-----------------------------------------------------------------------------------
Lev_17 main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_17: BINCLUDE "art/kosinski/Lev_17.bin"

-----------------------------------------------------------------------------------
Lev_17 128x128 block mappings (Kosinski compression)

BM128_Lev_17: BINCLUDE "mappings/128x128/Lev_17.bin"

-----------------------------------------------------------------------------------
Lev_18 16x16 block mappings (Kosinski compression)

BM16_Lev_18: BINCLUDE "mappings/16x16/Lev_18.bin"

-----------------------------------------------------------------------------------
Lev_18 main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_18: BINCLUDE "art/kosinski/Lev_18.bin"

-----------------------------------------------------------------------------------
Lev_18 128x128 block mappings (Kosinski compression)

BM128_Lev_18: BINCLUDE "mappings/128x128/Lev_18.bin"

-----------------------------------------------------------------------------------
Lev_19 16x16 block mappings (Kosinski compression)

BM16_Lev_19: BINCLUDE "mappings/16x16/Lev_19.bin"

-----------------------------------------------------------------------------------
Lev_19 main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_19: BINCLUDE "art/kosinski/Lev_19.bin"

-----------------------------------------------------------------------------------
Lev_19 128x128 block mappings (Kosinski compression)

BM128_Lev_19: BINCLUDE "mappings/128x128/Lev_19.bin"

-----------------------------------------------------------------------------------
Lev_1A 16x16 block mappings (Kosinski compression)

BM16_Lev_1A: BINCLUDE "mappings/16x16/Lev_1A.bin"

-----------------------------------------------------------------------------------
Lev_1A main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_1A: BINCLUDE "art/kosinski/Lev_1A.bin"

-----------------------------------------------------------------------------------
Lev_1A 128x128 block mappings (Kosinski compression)

BM128_Lev_1A: BINCLUDE "mappings/128x128/Lev_1A.bin"

-----------------------------------------------------------------------------------
Lev_1B 16x16 block mappings (Kosinski compression)

BM16_Lev_1B: BINCLUDE "mappings/16x16/Lev_1B.bin"

-----------------------------------------------------------------------------------
Lev_1B main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_1B: BINCLUDE "art/kosinski/Lev_1B.bin"

-----------------------------------------------------------------------------------
Lev_1B 128x128 block mappings (Kosinski compression)

BM128_Lev_1B: BINCLUDE "mappings/128x128/Lev_1B.bin"

-----------------------------------------------------------------------------------
Lev_1C 16x16 block mappings (Kosinski compression)

BM16_Lev_1C: BINCLUDE "mappings/16x16/Lev_1C.bin"

-----------------------------------------------------------------------------------
Lev_1C main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_1C: BINCLUDE "art/kosinski/Lev_1C.bin"

-----------------------------------------------------------------------------------
Lev_1C 128x128 block mappings (Kosinski compression)

BM128_Lev_1C: BINCLUDE "mappings/128x128/Lev_1C.bin"

-----------------------------------------------------------------------------------
Lev_1D 16x16 block mappings (Kosinski compression)

BM16_Lev_1D: BINCLUDE "mappings/16x16/Lev_1D.bin"

-----------------------------------------------------------------------------------
Lev_1D main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_1D: BINCLUDE "art/kosinski/Lev_1D.bin"

-----------------------------------------------------------------------------------
Lev_1D 128x128 block mappings (Kosinski compression)

BM128_Lev_1D: BINCLUDE "mappings/128x128/Lev_1D.bin"

-----------------------------------------------------------------------------------
Lev_1E 16x16 block mappings (Kosinski compression)

BM16_Lev_1E: BINCLUDE "mappings/16x16/Lev_1E.bin"

-----------------------------------------------------------------------------------
Lev_1E main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_1E: BINCLUDE "art/kosinski/Lev_1E.bin"

-----------------------------------------------------------------------------------
Lev_1E 128x128 block mappings (Kosinski compression)

BM128_Lev_1E: BINCLUDE "mappings/128x128/Lev_1E.bin"

-----------------------------------------------------------------------------------
Lev_1F 16x16 block mappings (Kosinski compression)

BM16_Lev_1F: BINCLUDE "mappings/16x16/Lev_1F.bin"

-----------------------------------------------------------------------------------
Lev_1F main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_1F: BINCLUDE "art/kosinski/Lev_1F.bin"

-----------------------------------------------------------------------------------
Lev_1F 128x128 block mappings (Kosinski compression)

BM128_Lev_1F: BINCLUDE "mappings/128x128/Lev_1F.bin"

-----------------------------------------------------------------------------------
Lev_20 16x16 block mappings (Kosinski compression)

BM16_Lev_20: BINCLUDE "mappings/16x16/Lev_20.bin"

-----------------------------------------------------------------------------------
Lev_20 main level patterns (Kosinski compression)
ArtKoz_9DB64

ArtKos_Lev_20: BINCLUDE "art/kosinski/Lev_20.bin"

-----------------------------------------------------------------------------------
Lev_20 128x128 block mappings (Kosinski compression)

BM128_Lev_20: BINCLUDE "mappings/128x128/Lev_20.bin" </asm>

Then add optional pattern supplements to suit your hack's needs.

Now find: <asm> LevelArtPointers: levartptrs 4, 5, 4, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ; 0 ; EHZ  ; EMERALD HILL ZONE levartptrs 6, 7, 5, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ; 1 ; LEV1 ; LEVEL 1 (UNUSED) levartptrs 8, 9, 6, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ; 2 ; LEV2 ; LEVEL 2 (UNUSED) levartptrs $A, $B, 7, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ; 3 ; LEV3 ; LEVEL 3 (UNUSED) levartptrs $C, $D, 8, ArtKos_MTZ, BM16_MTZ, BM128_MTZ ; 4 ; MTZ  ; METROPOLIS ZONE ACTS 1 & 2 levartptrs $C, $D, 8, ArtKos_MTZ, BM16_MTZ, BM128_MTZ ; 5 ; MTZ3 ; METROPOLIS ZONE ACT 3 levartptrs $10,$11, $A, ArtKos_SCZ, BM16_WFZ, BM128_WFZ ; 6 ; WFZ  ; WING FORTRESS ZONE levartptrs $12,$13, $B, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ; 7 ; HTZ  ; HILL TOP ZONE levartptrs $14,$15, $C, BM16_OOZ, BM16_OOZ, BM16_OOZ ; 8 ; HPZ  ; HIDDEN PALACE ZONE (UNUSED) levartptrs $16,$17, $D, ArtKos_EHZ, BM16_EHZ, BM128_EHZ ; 9 ; LEV9 ; LEVEL 9 (UNUSED) levartptrs $18,$19, $E, ArtKos_OOZ, BM16_OOZ, BM128_OOZ ; $A ; OOZ  ; OIL OCEAN ZONE levartptrs $1A,$1B, $F, ArtKos_MCZ, BM16_MCZ, BM128_MCZ ; $B ; MCZ  ; MYSTIC CAVE ZONE levartptrs $1C,$1D,$10, ArtKos_CNZ, BM16_CNZ, BM128_CNZ ; $C ; CNZ  ; CASINO NIGHT ZONE levartptrs $1E,$1F,$11, ArtKos_CPZ, BM16_CPZ, BM128_CPZ ; $D ; CPZ  ; CHEMICAL PLANT ZONE levartptrs $20,$21,$12, ArtKos_CPZ, BM16_CPZ, BM128_CPZ ; $E ; DEZ  ; DEATH EGG ZONE levartptrs $22,$23,$13, ArtKos_ARZ, BM16_ARZ, BM128_ARZ ; $F ; ARZ  ; AQUATIC RUIN ZONE levartptrs $24,$25,$14, ArtKos_SCZ, BM16_WFZ, BM128_WFZ ; $10 ; SCZ  ; SKY CHASE ZONE </asm>

then add this to the end: <asm> levartptrs $26, $27, $15, ArtKos_Lev_11, BM16_Lev_11, BM128_Lev_11 ; 0 ; Lev_11  ; LEV_11 ZONE levartptrs $28, $29, $16, ArtKos_Lev_12, BM16_Lev_12, BM128_Lev_12 ; 0 ; Lev_12  ; LEV_12 ZONE levartptrs $2A, $2B, $17, ArtKos_Lev_13, BM16_Lev_13, BM128_Lev_13 ; 0 ; Lev_13  ; LEV_13 ZONE levartptrs $2C, $2D, $18, ArtKos_Lev_14, BM16_Lev_14, BM128_Lev_14 ; 0 ; Lev_14  ; LEV_14 ZONE levartptrs $2E, $2F, $19, ArtKos_Lev_15, BM16_Lev_15, BM128_Lev_15 ; 0 ; Lev_15  ; LEV_15 ZONE levartptrs $30, $31, $1A, ArtKos_Lev_16, BM16_Lev_16, BM128_Lev_16 ; 0 ; Lev_16  ; LEV_16 ZONE levartptrs $32, $33, $1B, ArtKos_Lev_17, BM16_Lev_17, BM128_Lev_17 ; 0 ; Lev_17  ; LEV_17 ZONE levartptrs $34, $35, $1C, ArtKos_Lev_18, BM16_Lev_18, BM128_Lev_18 ; 0 ; Lev_18  ; LEV_18 ZONE levartptrs $36, $37, $1D, ArtKos_Lev_19, BM16_Lev_19, BM128_Lev_19 ; 0 ; Lev_19  ; LEV_19 ZONE levartptrs $38, $39, $1E, ArtKos_Lev_1A, BM16_Lev_1A, BM128_Lev_1A ; 0 ; Lev_1A  ; LEV_1A ZONE levartptrs $3A, $3B, $1F, ArtKos_Lev_1B, BM16_Lev_1B, BM128_Lev_1B ; 0 ; Lev_1B  ; LEV_1B ZONE levartptrs $3C, $3D, $20, ArtKos_Lev_1C, BM16_Lev_1C, BM128_Lev_1C ; 0 ; Lev_1C  ; LEV_1C ZONE levartptrs $3E, $3F, $21, ArtKos_Lev_1D, BM16_Lev_1D, BM128_Lev_1D ; 0 ; Lev_1D  ; LEV_1D ZONE levartptrs $40, $41, $22, ArtKos_Lev_1E, BM16_Lev_1E, BM128_Lev_1E ; 0 ; Lev_1E  ; LEV_1E ZONE levartptrs $42, $43, $23, ArtKos_Lev_1F, BM16_Lev_1F, BM128_Lev_1F ; 0 ; Lev_1F  ; LEV_1F ZONE levartptrs $44, $45, $24, ArtKos_Lev_20, BM16_Lev_20, BM128_Lev_20 ; 0 ; Lev_20  ; LEV_20 ZONE </asm>

After this is added, you possibly need to add loading queries to the texture load index. Create the .bin files and you're finished.

Extending level and tile layout indexes

Now you need to extend the layout index and we're done extending most level essentials.

Find: <asm> Off_Level: dc.w Level_EHZ1-Off_Level dc.w Level_EHZ2-Off_Level; 1 dc.w Level_EHZ1-Off_Level; 2 dc.w Level_EHZ1-Off_Level; 3 dc.w Level_EHZ1-Off_Level; 4 dc.w Level_EHZ1-Off_Level; 5 dc.w Level_EHZ1-Off_Level; 6 dc.w Level_EHZ1-Off_Level; 7 dc.w Level_MTZ1-Off_Level; 8 dc.w Level_MTZ2-Off_Level; 9 dc.w Level_MTZ3-Off_Level; 10 dc.w Level_MTZ3-Off_Level; 11 dc.w Level_WFZ-Off_Level; 12 dc.w Level_WFZ-Off_Level; 13 dc.w Level_HTZ1-Off_Level; 14 dc.w Level_HTZ2-Off_Level; 15 dc.w Level_OOZ1-Off_Level; 16 dc.w Level_OOZ1-Off_Level; 17 dc.w Level_EHZ1-Off_Level; 18 dc.w Level_EHZ1-Off_Level; 19 dc.w Level_OOZ1-Off_Level; 20 dc.w Level_OOZ2-Off_Level; 21 dc.w Level_MCZ1-Off_Level; 22 dc.w Level_MCZ2-Off_Level; 23 dc.w Level_CNZ1-Off_Level; 24 dc.w Level_CNZ2-Off_Level; 25 dc.w Level_CPZ1-Off_Level; 26 dc.w Level_CPZ2-Off_Level; 27 dc.w Level_DEZ-Off_Level; 28 dc.w Level_DEZ-Off_Level; 29 dc.w Level_ARZ1-Off_Level; 30 dc.w Level_ARZ2-Off_Level; 31 dc.w Level_SCZ-Off_Level; 32 dc.w Level_SCZ-Off_Level; 33 </asm>

and add this to the end: <asm> dc.w Level_Lev11_1-Off_Level dc.w Level_Lev11_2-Off_Level dc.w Level_Lev12_1-Off_Level dc.w Level_Lev12_2-Off_Level dc.w Level_Lev13_1-Off_Level dc.w Level_Lev13_2-Off_Level dc.w Level_Lev14_1-Off_Level dc.w Level_Lev14_2-Off_Level dc.w Level_Lev15_1-Off_Level dc.w Level_Lev15_2-Off_Level dc.w Level_Lev16_1-Off_Level dc.w Level_Lev16_2-Off_Level dc.w Level_Lev17_1-Off_Level dc.w Level_Lev17_2-Off_Level dc.w Level_Lev18_1-Off_Level dc.w Level_Lev18_2-Off_Level dc.w Level_Lev19_1-Off_Level dc.w Level_Lev19_2-Off_Level dc.w Level_Lev1A_1-Off_Level dc.w Level_Lev1A_2-Off_Level dc.w Level_Lev1B_1-Off_Level dc.w Level_Lev1B_2-Off_Level dc.w Level_Lev1C_1-Off_Level dc.w Level_Lev1C_2-Off_Level dc.w Level_Lev1D_1-Off_Level dc.w Level_Lev1D_2-Off_Level dc.w Level_Lev1E_1-Off_Level dc.w Level_Lev1E_2-Off_Level dc.w Level_Lev1F_1-Off_Level dc.w Level_Lev1F_2-Off_Level dc.w Level_Lev20_1-Off_Level dc.w Level_Lev20_2-Off_Level </asm>

Then find: <asm>

---------------------------------------------------------------------------------------
EHZ act 1 level layout (Kosinski compression)

Level_EHZ1: BINCLUDE "level/layout/EHZ_1.bin"

---------------------------------------------------------------------------------------
EHZ act 2 level layout (Kosinski compression)

Level_EHZ2: BINCLUDE "level/layout/EHZ_2.bin"

---------------------------------------------------------------------------------------
MTZ act 1 level layout (Kosinski compression)

Level_MTZ1: BINCLUDE "level/layout/MTZ_1.bin"

---------------------------------------------------------------------------------------
MTZ act 2 level layout (Kosinski compression)

Level_MTZ2: BINCLUDE "level/layout/MTZ_2.bin"

---------------------------------------------------------------------------------------
MTZ act 3 level layout (Kosinski compression)

Level_MTZ3: BINCLUDE "level/layout/MTZ_3.bin"

---------------------------------------------------------------------------------------
WFZ level layout (Kosinski compression)

Level_WFZ: BINCLUDE "level/layout/WFZ.bin"

---------------------------------------------------------------------------------------
HTZ act 1 level layout (Kosinski compression)

Level_HTZ1: BINCLUDE "level/layout/HTZ_1.bin"

---------------------------------------------------------------------------------------
HTZ act 2 level layout (Kosinski compression)

Level_HTZ2: BINCLUDE "level/layout/HTZ_2.bin"

---------------------------------------------------------------------------------------
OOZ act 1 level layout (Kosinski compression)

Level_OOZ1: BINCLUDE "level/layout/OOZ_1.bin"

---------------------------------------------------------------------------------------
OOZ act 2 level layout (Kosinski compression)

Level_OOZ2: BINCLUDE "level/layout/OOZ_2.bin"

---------------------------------------------------------------------------------------
MCZ act 1 level layout (Kosinski compression)

Level_MCZ1: BINCLUDE "level/layout/MCZ_1.bin"

---------------------------------------------------------------------------------------
MCZ act 2 level layout (Kosinski compression)

Level_MCZ2: BINCLUDE "level/layout/MCZ_2.bin"

---------------------------------------------------------------------------------------
CNZ act 1 level layout (Kosinski compression)

Level_CNZ1: BINCLUDE "level/layout/CNZ_1.bin"

---------------------------------------------------------------------------------------
CNZ act 2 level layout (Kosinski compression)

Level_CNZ2: BINCLUDE "level/layout/CNZ_2.bin"

---------------------------------------------------------------------------------------
CPZ act 1 level layout (Kosinski compression)

Level_CPZ1: BINCLUDE "level/layout/CPZ_1.bin"

---------------------------------------------------------------------------------------
CPZ act 2 level layout (Kosinski compression)

Level_CPZ2: BINCLUDE "level/layout/CPZ_2.bin"

---------------------------------------------------------------------------------------
DEZ level layout (Kosinski compression)

Level_DEZ: BINCLUDE "level/layout/DEZ.bin"

---------------------------------------------------------------------------------------
ARZ act 1 level layout (Kosinski compression)

Level_ARZ1: BINCLUDE "level/layout/ARZ_1.bin"

---------------------------------------------------------------------------------------
ARZ act 2 level layout (Kosinski compression)

Level_ARZ2: BINCLUDE "level/layout/ARZ_2.bin"

---------------------------------------------------------------------------------------
SCZ level layout (Kosinski compression)

Level_SCZ: BINCLUDE "level/layout/SCZ.bin" </asm>

then add this at the end: <asm>

---------------------------------------------------------------------------------------
Lev11 act 1 level layout (Kosinski compression)

Level_Lev11_1: BINCLUDE "level/layout/Lev11_1.bin"

---------------------------------------------------------------------------------------
Lev11 act 2 level layout (Kosinski compression)

Level_Lev11_2: BINCLUDE "level/layout/Lev11_2.bin"

---------------------------------------------------------------------------------------
Lev12_1 level layout (Kosinski compression)

Level_Lev12_1: BINCLUDE "level/layout/Lev12_1.bin"

---------------------------------------------------------------------------------------
Lev12_2 level layout (Kosinski compression)

Level_Lev12_1: BINCLUDE "level/layout/Lev12_2.bin"

---------------------------------------------------------------------------------------
Lev13_1 level layout (Kosinski compression)

Level_Lev13_1: BINCLUDE "level/layout/Lev13_1.bin"

---------------------------------------------------------------------------------------
Lev13_2 level layout (Kosinski compression)

Level_Lev13_2: BINCLUDE "level/layout/Lev13_2.bin"

---------------------------------------------------------------------------------------
Lev14_1 level layout (Kosinski compression)

Level_Lev14_1: BINCLUDE "level/layout/Lev14_1.bin"

---------------------------------------------------------------------------------------
Lev14_2 level layout (Kosinski compression)

Level_Lev14_2: BINCLUDE "level/layout/Lev14_2.bin"

---------------------------------------------------------------------------------------
Lev15_1 level layout (Kosinski compression)

Level_Lev15_1: BINCLUDE "level/layout/Lev15_1.bin"

---------------------------------------------------------------------------------------
Lev15_2 level layout (Kosinski compression)

Level_Lev15_2: BINCLUDE "level/layout/Lev15_2.bin"

---------------------------------------------------------------------------------------
Lev16_1 level layout (Kosinski compression)

Level_Lev16_1: BINCLUDE "level/layout/Lev16_1.bin"

---------------------------------------------------------------------------------------
Lev16_2 level layout (Kosinski compression)

Level_Lev16_2: BINCLUDE "level/layout/Lev16_2.bin"

---------------------------------------------------------------------------------------
Lev17_1 level layout (Kosinski compression)

Level_Lev17_1: BINCLUDE "level/layout/Lev17_1.bin"

---------------------------------------------------------------------------------------
Lev17_2 level layout (Kosinski compression)

Level_Lev17_2: BINCLUDE "level/layout/Lev17_2.bin"

---------------------------------------------------------------------------------------
Lev18_1 level layout (Kosinski compression)

Level_Lev18_1: BINCLUDE "level/layout/Lev18_1.bin"

---------------------------------------------------------------------------------------
Lev18_2 level layout (Kosinski compression)

Level_Lev18_2: BINCLUDE "level/layout/Lev18_2.bin"

---------------------------------------------------------------------------------------
Lev19_1 level layout (Kosinski compression)

Level_Lev19_1: BINCLUDE "level/layout/Lev19_1.bin"

---------------------------------------------------------------------------------------
Lev19_2 level layout (Kosinski compression)

Level_Lev19_2: BINCLUDE "level/layout/Lev19_2.bin"

---------------------------------------------------------------------------------------
Lev1A_1 level layout (Kosinski compression)

Level_Lev1A_1: BINCLUDE "level/layout/Lev1A_1.bin"

---------------------------------------------------------------------------------------
Lev1A_2 level layout (Kosinski compression)

Level_Lev1A_2: BINCLUDE "level/layout/Lev1A_2.bin"

---------------------------------------------------------------------------------------
Lev1B_1 level layout (Kosinski compression)

Level_Lev1B_1: BINCLUDE "level/layout/Lev1B_1.bin"

---------------------------------------------------------------------------------------
Lev1B_2 level layout (Kosinski compression)

Level_Lev1B_2: BINCLUDE "level/layout/Lev1B_2.bin"

---------------------------------------------------------------------------------------
Lev1C_1 level layout (Kosinski compression)

Level_Lev1C_1: BINCLUDE "level/layout/Lev1C_1.bin"

---------------------------------------------------------------------------------------
Lev1C_2 level layout (Kosinski compression)

Level_Lev1C_2: BINCLUDE "level/layout/Lev1C_2.bin"

---------------------------------------------------------------------------------------
Lev1D_1 level layout (Kosinski compression)

Level_Lev1D_1: BINCLUDE "level/layout/Lev1D_1.bin"

---------------------------------------------------------------------------------------
Lev1D_2 level layout (Kosinski compression)

Level_Lev1D_2: BINCLUDE "level/layout/Lev1D_2.bin"

---------------------------------------------------------------------------------------
Lev1E_1 level layout (Kosinski compression)

Level_Lev1E_1: BINCLUDE "level/layout/Lev1E_1.bin"

---------------------------------------------------------------------------------------
Lev1E_2 level layout (Kosinski compression)

Level_Lev1E_2: BINCLUDE "level/layout/Lev1E_2.bin"

---------------------------------------------------------------------------------------
Lev1F_1 level layout (Kosinski compression)

Level_Lev1F_1: BINCLUDE "level/layout/Lev1F_1.bin"

---------------------------------------------------------------------------------------
Lev1F_2 level layout (Kosinski compression)

Level_Lev1F_2: BINCLUDE "level/layout/Lev1F_2.bin"

---------------------------------------------------------------------------------------
Lev20_1 level layout (Kosinski compression)

Level_Lev20_1: BINCLUDE "level/layout/Lev20_1.bin"

---------------------------------------------------------------------------------------
Lev20_2 level layout (Kosinski compression)

Level_Lev20_2: BINCLUDE "level/layout/Lev20_2.bin" </asm>

Now create the .bin files.

Extending the definition of act 2 (setting up our new levels so that they can have bosses in other words)

just being able to use sign posts in your new levels can be boring after a while, so we will make those changes so that we can put custom bosses in our new levels, actually extending the sprite pointer list is not within the scope of the tutorial, though highly recommended.

find: <asm>SetLevelEndType: move.w #0,(Level_Has_Signpost).w ; set level type to non-signpost tst.w (Two_player_mode).w ; is it two-player competitive mode? bne.s LevelEnd_SetSignpost ; if yes, branch cmpi.w #$001,(Current_ZoneAndAct).w beq.w return_4C46 ; if EHZ2, return cmpi.w #$500,(Current_ZoneAndAct).w beq.w return_4C46 ; if MTZ3, return cmpi.w #$600,(Current_ZoneAndAct).w beq.w return_4C46 ; if WFZ, return cmpi.w #$701,(Current_ZoneAndAct).w beq.w return_4C46 ; if HTZ2, return cmpi.w #$A01,(Current_ZoneAndAct).w beq.w return_4C46 ; if OOZ2, return cmpi.w #$B01,(Current_ZoneAndAct).w beq.s return_4C46 ; if MCZ2, return cmpi.w #$C01,(Current_ZoneAndAct).w beq.s return_4C46 ; if CNZ2, return cmpi.w #$D01,(Current_ZoneAndAct).w beq.s return_4C46 ; if CPZ2, return cmpi.w #$E00,(Current_ZoneAndAct).w beq.s return_4C46 ; if DEZ, return cmpi.w #$F01,(Current_ZoneAndAct).w beq.s return_4C46 ; if ARZ2, return cmpi.w #$1000,(Current_ZoneAndAct).w beq.s return_4C46 ; if SCZ, return </asm> we will change it to: <asm> JmpTo_LevelEnd_SetSignpost jmp LevelEnd_SetSignpost

SetLevelEndType: move.w #0,(Level_Has_Signpost).w ; set level type to non-signpost tst.w (Two_player_mode).w ; is it two-player competitive mode? bne.s JmpTo_LevelEnd_SetSignpost ; if yes, branch cmpi.w #$001,(Current_ZoneAndAct).w beq.w return_4C46 ; if EHZ2, return cmpi.w #$101,(Current_ZoneAndAct).w beq.w return_4C46 ; if LZ2, return cmpi.w #$201,(Current_ZoneAndAct).w beq.w return_4C46 ; if WZ2, return cmpi.w #$301,(Current_ZoneAndAct).w beq.w return_4C46 ; if DHZ2, return cmpi.w #$500,(Current_ZoneAndAct).w beq.w return_4C46 ; if MTZ3, return cmpi.w #$600,(Current_ZoneAndAct).w beq.w return_4C46 ; if WFZ, return cmpi.w #$701,(Current_ZoneAndAct).w beq.w return_4C46 ; if HTZ2, return cmpi.w #$801,(Current_ZoneAndAct).w beq.w return_4C46 ; if HPZ2, return cmpi.w #$901,(Current_ZoneAndAct).w beq.w return_4C46 ; if GCZ2, return cmpi.w #$A01,(Current_ZoneAndAct).w beq.w return_4C46 ; if OOZ2, return bra.s SetLevelEndType2

return_4C46: rts

SetLevelEndType2: cmpi.w #$B01,(Current_ZoneAndAct).w beq.s return2_4C46 ; if MCZ2, return cmpi.w #$C01,(Current_ZoneAndAct).w beq.s return2_4C46 ; if CNZ2, return cmpi.w #$D01,(Current_ZoneAndAct).w beq.s return2_4C46 ; if CPZ2, return cmpi.w #$E00,(Current_ZoneAndAct).w beq.s return2_4C46 ; if DEZ, return cmpi.w #$F01,(Current_ZoneAndAct).w beq.s return2_4C46 ; if ARZ2, return cmpi.w #$1000,(Current_ZoneAndAct).w beq.s return2_4C46 ; if SCZ, return cmpi.w #$1000,(Current_ZoneAndAct).w beq.s return2_4C46 ; if SCZ, return cmpi.w #$1101,(Current_ZoneAndAct).w beq.s return2_4C46 ; if one of our new levels in act 2, return cmpi.w #$1201,(Current_ZoneAndAct).w beq.s return2_4C46 ; if one of our new levels in act 2, return cmpi.w #$1301,(Current_ZoneAndAct).w beq.s return2_4C46 ; if one of our new levels in act 2, return cmpi.w #$1401,(Current_ZoneAndAct).w bra.s SetLevelEndType3

return2_4C46: rts

SetLevelEndType3: beq.s return3_4C46 ; if one of our new levels in act 2, return cmpi.w #$1501,(Current_ZoneAndAct).w beq.s return3_4C46 ; if one of our new levels in act 2, return cmpi.w #$1601,(Current_ZoneAndAct).w beq.s return3_4C46 ; if one of our new levels in act 2, return cmpi.w #$1701,(Current_ZoneAndAct).w beq.s return3_4C46 ; if one of our new levels in act 2, return cmpi.w #$1801,(Current_ZoneAndAct).w beq.s return3_4C46 ; if one of our new levels in act 2, return cmpi.w #$1901,(Current_ZoneAndAct).w beq.s return3_4C46 ; if one of our new levels in act 2, return cmpi.w #$1A01,(Current_ZoneAndAct).w beq.s return3_4C46 ; if one of our new levels in act 2, return cmpi.w #$1B01,(Current_ZoneAndAct).w beq.s return3_4C46 ; if one of our new levels in act 2, return cmpi.w #$1C01,(Current_ZoneAndAct).w beq.s return3_4C46 ; if one of our new levels in act 2, return cmpi.w #$1D01,(Current_ZoneAndAct).w beq.s return3_4C46 ; if one of our new levels in act 2, return cmpi.w #$1E01,(Current_ZoneAndAct).w beq.s return3_4C46 ; if one of our new levels in act 2, return cmpi.w #$1F01,(Current_ZoneAndAct).w beq.s return3_4C46 ; if one of our new levels in act 2, return cmpi.w #$2001,(Current_ZoneAndAct).w beq.s return3_4C46 ; if one of our new levels in act 2, return

loc_4C40

LevelEnd_SetSignpost: move.w #1,(Level_Has_Signpost).w ; set level type to signpost

return3_4C46: rts </asm>

Extend Level Size Array

our levels need a size, right? This part of the guide gives us just that.

what we need to find is: <asm> WrdArr_LvlSize: dc.w $0, $29A0, $0, $320 ; $00  ; EHZ act 2 dc.w $0, $2940, $0, $420 ; EHZ act 2 dc.w $0, $3FFF, $0, $720 ; $01 dc.w $0, $3FFF, $0, $720 dc.w $0, $3FFF, $0, $720 ; $02 dc.w $0, $3FFF, $0, $720 dc.w $0, $3FFF, $0, $720 ; $03 dc.w $0, $3FFF, $0, $720 dc.w $0, $2280, -$100, $800 ; $04 ; MTZ act 1 dc.w $0, $1E80, -$100, $800 ; MTZ act 2 dc.w $0, $2A80, -$100, $800 ; $05 ; MTZ act 3 dc.w $0, $3FFF, -$100, $800 dc.w $0, $3FFF, $0, $720 ; $06 ; WFZ dc.w $0, $3FFF, $0, $720 dc.w $0, $2800, $0, $720 ; $07 ; HTZ act 1 dc.w $0, $3280, $0, $720 ; HTZ act 2 dc.w $0, $3FFF, $0, $720 ; $08 dc.w $0, $3FFF, $0, $720 dc.w $0, $3FFF, $0, $720 ; $09 dc.w $0, $3FFF, $0, $720 dc.w $0, $2F80, $0, $680 ; $0A ; OOZ act 1 dc.w $0, $2D00, $0, $680 ; OOZ act 2 dc.w $0, $2380, $3C0, $720 ; $0B ; MCZ act 1 dc.w $0, $3FFF, $60, $720 ; MCZ act 2 dc.w $0, $27A0, $0, $720 ; $0C ; CNZ act 1 dc.w $0, $2A80, $0, $720 ; CNZ act 2 dc.w $0, $2780, $0, $720 ; $0D ; CPZ act 1 dc.w $0, $2A80, $0, $720 ; CPZ act 2 dc.w $0, $1000, $C8, $C8 ; $0F ; DEZ dc.w $0, $1000, $C8, $C8 dc.w $0, $28C0, $200, $600 ; $10 ; ARZ act 1 dc.w $0, $3FFF, $180, $710 ; ARZ act 2 dc.w $0, $3FFF, $0, $000 ; $11 ; SCZ dc.w $0, $3FFF, $0, $720 </asm>

and we will change it to: <asm> WrdArr_LvlSize: dc.w $0, $29A0, $0, $320 ; $00  ; EHZ act 2 dc.w $0, $2940, $0, $420 ; EHZ act 2 dc.w $0, $3FFF, $0, $720 ; $01 dc.w $0, $3FFF, $0, $720 dc.w $0, $3FFF, $0, $720 ; $02 dc.w $0, $3FFF, $0, $720 dc.w $0, $3FFF, $0, $720 ; $03 dc.w $0, $3FFF, $0, $720 dc.w $0, $2280, -$100, $800 ; $04 ; MTZ act 1 dc.w $0, $1E80, -$100, $800 ; MTZ act 2 dc.w $0, $2A80, -$100, $800 ; $05 ; MTZ act 3 dc.w $0, $3FFF, -$100, $800 dc.w $0, $3FFF, $0, $720 ; $06 ; WFZ dc.w $0, $3FFF, $0, $720 dc.w $0, $2800, $0, $720 ; $07 ; HTZ act 1 dc.w $0, $3280, $0, $720 ; HTZ act 2 dc.w $0, $3FFF, $0, $720 ; $08 dc.w $0, $3FFF, $0, $720 dc.w $0, $3FFF, $0, $720 ; $09 dc.w $0, $3FFF, $0, $720 dc.w $0, $2F80, $0, $680 ; $0A ; OOZ act 1 dc.w $0, $2D00, $0, $680 ; OOZ act 2 dc.w $0, $2380, $3C0, $720 ; $0B ; MCZ act 1 dc.w $0, $3FFF, $60, $720 ; MCZ act 2 dc.w $0, $27A0, $0, $720 ; $0C ; CNZ act 1 dc.w $0, $2A80, $0, $720 ; CNZ act 2 dc.w $0, $2780, $0, $720 ; $0D ; CPZ act 1 dc.w $0, $2A80, $0, $720 ; CPZ act 2 dc.w $0, $1000, $C8, $C8 ; $0E ; DEZ dc.w $0, $1000, $C8, $C8 dc.w $0, $28C0, $200, $600 ; $0F ; ARZ act 1 dc.w $0, $3FFF, $180, $710 ; ARZ act 2 dc.w $0, $3FFF, $0, $000 ; $10 ; SCZ dc.w $0, $3FFF, $0, $720 dc.w $0, $3FFF, $0, $720 ; $11 ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $12 ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $13 ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $14 ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $15 ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $16 ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $17 ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $18 ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $19 ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $1A ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $1B ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $1C ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $1D ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $1E ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $1F ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) dc.w $0, $3FFF, $0, $720 ; $20 ;one of our new levels (act 1) dc.w $0, $3FFF, $0, $720 ;one of our new levels (act 2) </asm>

Extending the Start Location Index

Sonic has to start somewhere right?

Find this: <asm> WrdArr_StartLoc: dc.w $60, $28F ; $00 dc.w $60, $2AF dc.w $60, $28F ; $01 dc.w $60, $2AF dc.w $60, $1AC ; $02 dc.w $60, $1AC dc.w $60, $28F ; $03 dc.w $60, $2AF dc.w $60, $28C ; $04 dc.w $60, $5EC dc.w $60, $20C ; $05 dc.w $60, $2AF dc.w $60, $4CC ; $06 dc.w $1E0, $4CC dc.w $60, $3EF ; $07 dc.w $60, $6AF dc.w $230, $1AC ; $08 dc.w $230, $1AC dc.w $60, $28F ; $09 dc.w $60, $2AF dc.w $60, $6AC ; $0A dc.w $60, $56C dc.w $60, $6AC ; $0B dc.w $60, $5AC dc.w $60, $2AC ; $0C dc.w $60, $58C dc.w $60, $1EC ; $0D dc.w $60, $12C dc.w $60, $12D ; $0E dc.w $60, $12D dc.w $60, $37E ; $0F dc.w $60, $37E dc.w $120, $70 ; $10 dc.w $140, $70 </asm>

then add this to the end: <asm> dc.w 0, 0 ; $11 dc.w 0, 0 dc.w 0, 0 ; $12 dc.w 0, 0 dc.w 0, 0 ; $13 dc.w 0, 0 dc.w 0, 0 ; $14 dc.w 0, 0 dc.w 0, 0 ; $15 dc.w 0, 0 dc.w 0, 0 ; $16 dc.w 0, 0 dc.w 0, 0 ; $17 dc.w 0, 0 dc.w 0, 0 ; $18 dc.w 0, 0 dc.w 0, 0 ; $19 dc.w 0, 0 dc.w 0, 0 ; $1A dc.w 0, 0 dc.w 0, 0 ; $1B dc.w 0, 0 dc.w 0, 0 ; $1C dc.w 0, 0 dc.w 0, 0 ; $1D dc.w 0, 0 dc.w 0, 0 ; $1E dc.w 0, 0 dc.w 0, 0 ; $1F dc.w 0, 0 dc.w 0, 0 ; $20 dc.w 0, 0 </asm>

then replace the 0s with the desired x and y co-ordinance.

Notes

All new .bin files need to be created in order for the ROM to build. If something doesn't load correctly (besides new animated patterns that you have just made by youself, only major things like ROM crashes) please don't hesitate to ask for help and/or get it working and edit this article. (Like the title cards being broken for levels past $10)