Sonic 1-squared is an enhanced version of the original Sonic the Hedgehog game engine. Various changes are planned to make editing the game easier.
- The player's Chaos Emerald count is stored as a bitfield instead of a list. It's a longword, so there can be up to 32 Emeralds.
LoadPerZone
subroutine consolidates all pointers and parameters for zones and acts. This simplifies the process of adding levels. (incomplete)LoadPerCharacter
subroutine does the same for the Sonic object, palette and life icon, allowing for extra characters.LoadPerDemo
loads the level number, demo data, character and start position for all demos, including those during the credits.- Rewritten level select routine to be more customisable. It now uses standard ASCII, and supports multiple columns (which are automatically generated based on the lines-per-column setting).
- The hidden Japanese credits, "try again" and "end" screens have been given their own gamemodes, which are accessible through the level select.
- The HUD has new debug features, including a CPU cycle usage indicator (displayed as two arrows on the left side of the screen - red for VBlank overflow and yellow for overall usage), sprite counter ($50 is max) and camera x/y position.
- 6 button support.
v_joypad_hold_actual_xyz
contains the status of the X/Y/Z/Mode buttons.
SlowPLC
subroutine loads Kosinski-compressed graphics over several frames.UncPLC
subroutine load uncompressed graphics at any time. This complementsSlowPLC
by loading graphics during a level. Both this andSlowPLC
use the DMA queue.- DMA queue system for loading uncompressed graphics.
- Animated level graphics use a script instead of being hard-coded. The exception is Marble Zone's magma, which works somewhat differently to other animations.
- Palette cycling uses a script.
- Water palettes are generated in-game by the
WaterFilter
subroutine, instead of being hardcoded. - Fading to black/white is controlled by a brightness variable, and no longer requires a "next" palette. This simplifies loading new palettes.
- Sprites can be hidden with the variables
v_spritemask_height
andv_spritemask_pos
. - Sonic's sprites are loaded from a PNG spritesheet using HiveMap.
- Modified the way animation works to save 2 bytes in RAM per object. The high bit of
ost_anim
now serves as an update flag instead ofost_anim_restart
. - Object scratch RAM is assigned automatically with
rsobj
macro. If you attempt to use more RAM than is available ($40 bytes), assembly will fail. ost_id
is now a longword pointer instead of a single byte (as is the case in Sonic 3 & Knuckles). This allows for unlimited object types, and slightly improves performance.ost_frame
extended to a word (ost_frame_hi
), allowing objects to have up to 8,192 distinct frames of animation.ost_displaywidth
extended to a word (ost_displaywidth_hi
), allowing for objects wider than 256px to remain visible when partially off screen.ost_width
andost_height
extended to words (ost_width_hi
andost_height_hi
).- Sprite mappings use 6 bytes per piece instead of 5, and the piece count is a word instead of a byte. This ensures the data is always aligned to even.
ost_parent
contains the parent object's OST address (shortened to a word), if thesaveparent
was useded when the child object was created.getparent
will set the parent object asa1
. CallingDeleteFamily
will delete an object as well as any objects which have it set as their parent.ost_linked
is similar toost_parent
.getlinked
will set the linked object asa1
.DeleteFamily
won't delete linked objects.ost_col_width
andost_col_height
set an object's hitbox forReactToItem
instead of using a table.ost_col_width_extra
andost_col_height_extra
(bytes) set a secondary hitbox for enemies with spikes (e.g. Yadrin) in the top left corner of the standard hitbox. Setting either value as negative moves the hitbox to the opposite corner. Unlike usual width and height settings, the value is for the diameter of the hitbox, not just the radius.ost_status
now includesstatus_pointy_bit
for spikes and similar objects. It causes a different sound to play when Sonic is harmed by the object.ost_subsprite
contains the address of a subsprite table. Subsprites are additional sprite pieces that are not part of the object's mappings. CallFindFreeSub
to assign a subsprite table to the current object, andgetsubsprite
to set that table asa2
. Subsprites use the same format as sprite mappings, except the VRAM setting is absolute instead of relative toost_tile
.ost_priority
is now a word that points to the sprite queue directly, which slightly improves performance.- Monitor icons load only as needed, allowing for up to 256 unique monitor types (with a maximum of 8 loaded at any one time).
- Monitors can be broken from below if they are already on the ground.
- Each title card has its own PLC, so only letters that are used need to be loaded. Title cards are automatically centered by the
autocard
macro. Title card mappings are also automated, and can use sprite mappings more efficiently by joining two letters together as a single sprite. - GHZ/SLZ loops use an object instead of being hard-coded. The object reads Sonic's position within the loop and updates the level layout accordingly.
- Pushable blocks can be moved by standing on top of them and pushing against a wall. The player can use this to retrieve a block if it's stuck next to a wall.
- Debug mode has been rewritten with more features, including info overlays for Sonic and the nearest object (similar to those in the Sonic Physics Guide). The controls are as follows:
- B - Toggle between Sonic and object.
- C (as object) - Place an object.
- Hold A (as object) - Select an object with left/right. The previous and next objects are now visible. Toggle x/yflip with down/up respectively.
- X - Target overlay to current nearest object. This is not automatically updated until the targeted object despawns.
- Y - Toggle between displaying x/y position, x/y speed and angle/routine numbers.
- Z - Toggle between displaying actual width/height and hitbox width/height.
- Mode - Toggle hide all overlays. Overlays use approximately 5% of available CPU cycles, so hiding them provides a more accurate reading of CPU usage.
- Sonic ducks when down is pressed if he's moving slowly.
- Spikes no longer kill Sonic immediately after losing rings. Add $80 to the subtype to restore the original lethal behaviour.
- Sonic's mirrored sprites are no longer misaligned by 1 pixel. This was most obvious when pushing a wall to the left.
- Scrolling to the left is limited to 16 pixels per frame, as it previously was only when scrolling right.
- Sonic is no longer killed by the screen not scrolling down fast enough. This was a problem on the S-tunnels in Green Hill Zone.
- flamewing for mdcomp.
- vladikcomper for the advanced error handler.
- Devon for the optimised CalcAngle routine.
- OrionNavattan for various optimisations.
- Brainulator for some display bugfixes.