Actions

SCHG

Sonic the Hedgehog 2 (16-bit)/Object Editing

From Sonic Retro

Revision as of 01:20, 18 February 2007 by Scarred Sun (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Sonic Community Hacking Guide
Sonic the Hedgehog 2 (16-bit)
Art
Objects
Levels
Text
Music
RAM
Miscellaneous

Object Editing

Sounds

If you change the "ring" sound effect, all objects using that sound will have the new sound. This may not be desired, however - you may have only wanted the Super Ring powerup to play the new sound. With this list, you can edit the sound effect that an object plays. If you change the sound for the Super Ring power-up, only the Super Ring will have the new sound. Note that you are not changing any sound effects - you are only changing which effect will play.

These notes are for those who don't want see the programming stuff of the objects to change its sounds.

To change the sound, first, take a value from the sound test (Ex: 1-up sound is $18) , add $80 to it and you get $98. This is the way you have to replace sounds (take a value from sound test, add $80 to it, and after that, insert the byte in the offset where you wish change the sound.)

Offset List

The following list is the offset where you will place the new sound. I not will make a list with the values and its respective sounds. Use the trick (explained above) and Sound Test. Of course you can place the objects in any level you want (see Object Placement below), I'm just saying the level the object is used in for a better description.

Level Description Offset
ALL Invincibility power-up $12A81
ALL Shield power-up $12A37
ALL Super Ring $129CD
ALL Lamp Post: $1F191
Casino Night Bumper $1F7F5
ALL Red and Yellow Springs Facing Up $18A69
ALL Red and Yellow Springs Facing Right $18BBF
ALL Red Spring Facing Down $18D63
Chemical Plant Speed booster $223DB
Chemical Plant Blue worm (The sound is repeated 3 Times.) $224EA
Aquatic Ruin Arrow launcher $257B7
Casino Night Slot machine cage $2BE1F
Casino Night Point cage $2BE6B
Hill Top Zip line $21E75
Casino Night Blue Bumper $2C577
Casino Night Green flipper $2B30B
Casino Night Orange flipper $2B3BF
Casino Night Impulse spring facing up $2AE4F
Wing Fortress Propellor (repeat infinitely) $3B3A3

Object Pointer List

See SCHG:Sonic 2/Object Editing/Pointers.

Sprite table (aka mappings)

Reference
The sprite table data can be expressed with this pseudocode:

struct spriteTablePiece{
  byte yPosition;
  byte shape;
  byte attributes1P;
  byte artOffset1P;
  byte attributes2P;
  byte artOffset2P;
  word xPosition;
};

struct spriteTableLenghth03{
  const word length == 3;
  spriteTablePiece table[3];
} spriteTable01;
  • The value of shape can range from $00 (1x1) to $0F (4x4). $01 is a 1x2 sprite, $02 is a 1x3 sprite, $04 is a 2x1 sprite, and so on.
  • attributes1P and attributes2P are bitfields that controls various sprite attributes:
Bit Attribute
3 Flip sprite horizontally
4 Flip sprite vertically
5 Palette line +1
6 Palette line +2
7 Keep sprite in forground
  • artOffset1P and artOffset2P control the offset from the object's base tile that the sprite should start reading from. For example, if the object's art started a tile $3F0, and artOffset1P was $06, then the sprite would start reading its art at $3F6.

Question: Are xPosition and yPosition offsets from the object's current position?

Object Placement

There are six bites in one object definition. The first two bytes are the X position of the object, and the next two bytes are the Y position. The 5th byte is the reference number on the object pointer list (see above), and the 6th byte is an optional declaration to use for defining that object's behavior and/or animation. This will depend on the object. See the level specific hacking info for the locations of the object lists.

The 6th byte, the object subtype, is loaded in the 28th byte of the SST of that object (see below).

Sonic Community Hacking Guide
General
SonED2 Manual | Subroutine Equivalency List
Game-Specific
Sonic the Hedgehog (16-bit) | Sonic the Hedgehog (8-bit) | Sonic CD (prototype 510) | Sonic CD | Sonic CD (PC) | Sonic CD (2011) | Sonic 2 (Simon Wai prototype) | Sonic 2 (16-bit) | Sonic 2 (Master System) | Sonic 3 | Sonic 3 & Knuckles | Chaotix | Sonic Jam | Sonic Jam 6 | Sonic Adventure | Sonic Adventure DX: Director's Cut | Sonic Adventure DX: PC | Sonic Adventure (2010) | Sonic Adventure 2 | Sonic Adventure 2: Battle | Sonic Adventure 2 (PC) | Sonic Heroes | Sonic Riders | Sonic the Hedgehog (2006) | Sonic & Sega All-Stars Racing | Sonic Unleashed (Xbox 360/PS3) | Sonic Colours | Sonic Generations | Sonic Forces
Technical information
Sonic Eraser | Sonic 2 (Nick Arcade prototype) | Sonic CD (prototype; 1992-12-04) | Dr. Robotnik's Mean Bean Machine | Sonic Triple Trouble | Tails Adventures | Sonic Crackers | Sonic 3D: Flickies' Island | Sonic & Knuckles Collection | Sonic R | Sonic Shuffle | Sonic Advance | Sonic Advance 3 | Sonic Battle | Shadow the Hedgehog | Sonic Rush | Sonic Classic Collection | Sonic Free Riders | Sonic Lost World
Legacy Guides
The Nemesis Hacking Guides The Esrael Hacking Guides
ROM: Sonic 1 | Sonic 2 | Sonic 2 Beta | Sonic 3

Savestate: Sonic 1 | Sonic 2 Beta/Final | Sonic 3

Sonic 1 (English / Portuguese) | Sonic 2 Beta (English / Portuguese) | Sonic 2 and Knuckles (English / Portuguese)
Move to Sega Retro
Number Systems (or scrap) | Assembly Hacking Guide | 68000 Instruction Set | 68000 ASM-to-Hex Code Reference | SMPS Music Hacking Guide | Mega Drive technical information