An object is an entity in the game that is usually represented with sprites.
All memory in wram bank 1 is dedicated to storing memory for objects (4 kilobytes total). Each object has a dedicated 64 bytes of memory in this region.
There are a few different "classes" or types of objects. To help improve the speed of accessing objects, each class resides in a specific area of memory; in this way, the low byte of a particular class of objects is always the same, so the address of a particular variable can be determined with a simple register load, and no addition or indexing is required.
See include/structs.s for the memory layouts of objects.
|Object type||Memory region||Slots (values for x)||Object description|
|Special object||dx00-dx3f||0-1||Link, animal companion, maple, raft. Link is always in slot 0 (d000-d03f).|
|Parent item||dx00-dx3f||2-5||These aren't normally drawn to the screen, but they act as sort of state-holders when using an item.|
|Item||dx00-dx3f||6-f||Swords, projectiles; anything that can damage or interact with an enemy.|
|Interaction||dx40-dx7f||0-f||Very general; these can be non-hostile entities like npcs, or they may not be drawn at all, instead existing only as scripts to carry out a sequence of events.|
|Enemy||dx80-dxbf||0-f||Hostile entities; these objects generally react when Link or an item collides with them.|
|Part||dxc0-dxff||0-f||Frequently used as an enemy's weapon or projectile, so they can cause damage to Link; but this is also a mish-mash of various things, including owl statues.|
Placing objects in ZOLE
When placing objects in ZOLE's interface, it has a number of "objects types" that indirectly relate to the object types listed above:
|Conditional||Conditionally disables subsequent objects based on the value of |
|No-value interaction||Creates an interaction object with the given ID.|
|Double-value interaction||Creates an interaction object with the given ID and Y/X values. (Sometimes the object will convert the "Y" value to a "Y/X" value, and use the given value of "X" for a different purpose.)|
|Object pointer||A pointer to more object data. ZOLE doesn't know how to follow this, though.|
|Boss object pointer||A pointer to object data that will be ignored if bit 7 of the room flags is set. Used in boss rooms.|
|Anti-boss object pointer||A pointer to object data that will be ignored unless bit 7 of the room flags is set. Doesn't appear to be used?|
|Random-position enemy||Creates an enemy with the given ID at a random position. Also takes a byte for flags (misleadingly called "quantity"; see below for explanation).|
|Specific-position enemy||Creates an enemy with the given ID at a specific position. Also takes a byte for flags.|
|Owl Statue/Trigger/Switch||Creates a part object with the given ID and position.|
|Quadruple-value object||Creates an object of type "interaction" (0), "enemy" (1), or "part" (2). The "unknown" field gets written to the object's "var03" which may be used in various ways depending on the object.|
|Item drop||Causes an item to drop at the specified position when a tile (ie. a bush) is destroyed there. See below for what the flags do. (This is actually a specific kind of "enemy" object.)|
The "quantity" value for enemies, and "flags" value for item drops, actually serve a few purposes:
|0||Always respawn||If set, this enemy always respawns when reentering the room; otherwise, the game will remember when it's been killed for a little bit.
Applies to both enemy types, as well as "item drops" (so certain kinds of item drops may not respawn immediately).
|1||Doesn't count as enemy||If set, this enemy doesn't count toward |
(Note: setting this bit won't prevent the enemy from decreasing wNumEnemies when killed, if it's the type of enemy that's coded to do so.)
|2||Goes anywhere||If set, randomly-placed enemies may go anywhere; the game does not reject solid walls, holes, etc. (Random-enemy objects only.)|
|5-7||Quantity||The number of enemies to randomly spawn. Random-enemy objects only.|