<h2>Sprites and objects placement:</h2>
*Posted by Weird Person on May 21 2005.*
*Corrected by Sonic Hachelle-Bee.*

<h3>The sprites coordinates:</h3>
By making your sprites and objects placement with an hex editor, you see in run-time, how your sprites and objects will work in the game.

Enter the game in debug mode. There are many hexadecimal values, right?

<img src="http://www.sonicresearch.org/s2long/Miscellaneous/Sonic/SCHG/HackingCulT/Sprites/spritesplacement-001.png">

Piece of cake, right? Let's go to place our objects now!

Before I say everything, let's make a little exercise:

Look at this screenshot:

<img src="http://www.sonicresearch.org/s2long/Miscellaneous/Sonic/SCHG/HackingCulT/Sprites/spritesplacement-002.png">

As you can see, the object is at $0228 (X coordinate) and $027D (Y coordinate).

<h3>The sprites placement format:</h3>
For each sprite defined, it takes 6 bytes. There is a format:

XXXX FYYY TTSS

X: X coordinate of the object.
Y: Y coordinate of the object.
T: Object type, or object ID.
S: Object subparameter.
F: Sprite flag. The first nybble of the Y coordinate is always 0. Then, this nybble is used for something else. The sprite flag tells the initial direction of the sprite, and if the sprite respawns after being destroyed or not (usually, badnicks and monitors won't respawn). Here is a small table of values:

<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2"><tbody><tr><td style="background-color: rgb(034, 068, 034);" align="center" valign="middle">Sprite flag</td><td style="background-color: rgb(034, 068, 034);" align="center" valign="middle">Effect on the sprite</td></tr><tr><td align="center" valign="middle">0</td><td align="center" valign="middle">Normal</td></tr><tr><td align="center" valign="middle">2</td><td align="center" valign="middle">Horizontal flip</td></tr><tr><td align="center" valign="middle">4</td><td align="center" valign="middle">Vertical flip</td></tr><tr><td align="center" valign="middle">6</td><td align="center" valign="middle">Horizontal and vertical flip</td></tr><tr><td align="center" valign="middle">8</td><td align="center" valign="middle">Normal without respawn</td></tr><tr><td align="center" valign="middle">A</td><td align="center" valign="middle">Horizontal flip without respawn</td></tr><tr><td align="center" valign="middle">C</td><td align="center" valign="middle">Vertical flip without respawn</td></tr><tr><td align="center" valign="middle">E</td><td align="center" valign="middle">Horizontal and vertical flip without respawn</td></tr></tbody></table>

Reader: "What we have to do now?"
Now, we have to write these 6 bytes somewhere in the ROM. Each act of the game own a huge list where all sprites placement are stored. For Emerald Hill zone, this huge list of sprites begins at $E684A. Each 6 bytes is a new sprite. At the end of the list, you have FF FF 00 00 written.

As an example, let's take our red spring above. You can replace the first sprite (a coconut) by our spring by writing this:

02 28 02 7D 41 04

0228 is our X coordinate. 027D is our Y coordinate. 41 04 is a red spring facing up.
Let's take another example with a ring monitor:

02 28 82 7D 26 04

At the same place, a ring monitor should appear. Break it and go away. Then go back and verify that the monitor still broken. The sprite flag (8) disable the ability of the sprite to be respawned after being destroyed! Simple enough, isn't it?

Of course, you will want to place other sprites and objects. Here is a list of some objects you can place in every level (without having any graphical glitches):
<a href="http://www.hacking-cult.org/?r/4/72">Sprites and objects reference</a>

<h3>Sprites and objects addresses:</h3>
Now, here is the list of every addresses for every level, where to find the list of objects.
There is an offset index for each level (2 bytes for an act) located at $E6800.

<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2"><tbody><tr><td style="background-color: rgb(34, 68, 34);" align="center" valign="middle">Level</td><td style="background-color: rgb(34, 68, 34);" align="center" valign="middle">Act</td><td style="background-color: rgb(34, 68, 34);" align="center" valign="middle">Address for the list of sprites</td></tr><tr><td colspan="1" rowspan="2" align="center" valign="middle">Emerald Hill zone</td><td align="center" valign="middle">Act 1</td><td align="center" valign="middle">$E684A</td></tr><tr><td align="center" valign="middle">Act 2</td><td align="center" valign="middle">$E6B7A</td></tr><tr><td colspan="1" rowspan="3" align="center" valign="middle">Metropolis zone</td><td align="center" valign="middle">Act 1</td><td align="center" valign="middle">$E6F34</td></tr><tr><td align="center" valign="middle">Act 2</td><td align="center" valign="middle">$E73C0</td></tr><tr><td align="center" valign="middle">Act 3</td><td align="center" valign="middle">$E78EE</td></tr><tr><td colspan="1" rowspan="1" align="center" valign="middle">Wing Fortress zone</td><td align="center" valign="middle"></td><td align="center" valign="middle">$E7F48</td></tr><tr><td colspan="1" rowspan="2" align="center" valign="middle">Hill Top zone</td><td align="center" valign="middle">Act 1</td><td align="center" valign="middle">$E8302</td></tr><tr><td align="center" valign="middle">Act 2</td><td align="center" valign="middle">$E8668</td></tr><tr><td colspan="1" rowspan="2" align="center" valign="middle">Hidden Palace zone</td><td align="center" valign="middle">Act 1</td><td align="center" valign="middle">$E8C80</td></tr><tr><td align="center" valign="middle">Act 2</td><td align="center" valign="middle">$E8D94 (empty)</td></tr><tr><td colspan="1" rowspan="2" align="center" valign="middle">Oil Ocean zone</td><td align="center" valign="middle">Act 1</td><td align="center" valign="middle">$E8DA0</td></tr><tr><td align="center" valign="middle">Act 2</td><td align="center" valign="middle">$E9214</td></tr><tr><td colspan="1" rowspan="2" align="center" valign="middle">Mystic Cave zone</td><td align="center" valign="middle">Act 1</td><td align="center" valign="middle">$E968E</td></tr><tr><td align="center" valign="middle">Act 2</td><td align="center" valign="middle">$E99A0</td></tr><tr><td colspan="1" rowspan="2" align="center" valign="middle">Casino Night zone</td><td align="center" valign="middle">Act 1</td><td align="center" valign="middle">$E9D1E</td></tr><tr><td align="center" valign="middle">Act 2</td><td align="center" valign="middle">$EA3D8</td></tr><tr><td colspan="1" rowspan="2" align="center" valign="middle">Chemical Plant zone</td><td align="center" valign="middle">Act 1</td><td align="center" valign="middle">$EA9D2</td></tr><tr><td align="center" valign="middle">Act 2</td><td align="center" valign="middle">$EAD6E</td></tr><tr><td align="center" valign="middle">Death Egg zone</td><td align="center" valign="middle"></td><td align="center" valign="middle">$EB230</td></tr><tr><td colspan="1" rowspan="2" align="center" valign="middle">Aquatic Ruin zone</td><td align="center" valign="middle">Act 1</td><td align="center" valign="middle">$EB25A</td></tr><tr><td align="center" valign="middle">Act 2</td><td align="center" valign="middle">$EB6A4</td></tr><tr><td align="center" valign="middle">Sky Chase zone</td><td align="center" valign="middle"></td><td align="center" valign="middle">$EBBDE</td></tr><tr><td align="center" valign="middle">Unused space that you can use</td><td align="center" valign="middle"></td><td align="center" valign="middle">$EBD48 to $EBFFF</td></tr></tbody></table>