The object definition table has 44 entries, two of which are empty.
Index | Img | Name | Notes |
---|---|---|---|
$00 | Narrow pyramid | ||
$01 | Tall box | ||
$02 | Slow Tank | ||
$03 | Projectile | Cannon shell | |
$04 | Rear tread #0 | Tank tread on Slow Tank | |
$05 | Rear tread #1 | ||
$06 | Rear tread #2 | ||
$07 | Rear tread #3 | ||
$08 | Front tread #0 | ||
$09 | Front tread #1 | ||
$0a | Front tread #2 | ||
$0b | Front tread #3 | ||
$0c | Wide pyramid | ||
$0d | Radar dish | Placed on Slow Tank; rotates | |
$0e | Projectile explosion | Single vertex; uses special draw command | |
$0f | Short box | ||
$10 | Chunk #0 (tank) | ||
$11 | Chunk #1 (tank) | ||
$12 | Chunk #2 (tank) | ||
$13 | Radar (tank chunk) | (same as $0d) Super Tank gets an extra $14 instead |
|
$14 | Chunk #1 (tank) | (same as $11) | |
$15 | Chunk #0 (tank) | (same as $10) | |
$16 | Missile | ||
$17 | Logo "Ba" | Pre-tilted | |
$18 | Chunk #1 (missile) | (same as $11) | |
$19 | Chunk #4 (missile) | ||
$1a | Chunk #0 (missile) | (same as $10) | |
$1b | Chunk #5 (missile) | ||
$1c | Chunk #0 (missile) | (same as $10) | |
$1d | Chunk #4 (missile) | (same as $19) | |
$1e | Logo "ttle" | ||
$1f | Logo "Zone" | ||
$20 | Saucer | ||
$21 | Super Tank | ||
$22 | (empty slot) | ||
$23 | (empty slot) | ||
$24 | Spatter #0 | Drops from missiles | |
$25 | Spatter #1 | ||
$26 | Spatter #2 | ||
$27 | Spatter #3 | ||
$28 | Spatter #4 | ||
$29 | Spatter #5 | ||
$2a | Spatter #6 | ||
$2b | Spatter #7 |
The numbering may seem a bit haphazard at first, but there is some method to the madness. Note in particular that the shapes from $10-1f are the only ones that can appear above ground level. A set of 8 height values is used for objects with types $10-17 and $18-1f. Since we don't show tank chunks and missile chunks at the same time, and explosions have exactly one of each object type, they don't conflict. The only time objects from both sets are on-screen at the same time is for the logo, but the three parts of the logo are drawn from a common center point, and we don't show a missile while we're showing the logo. Note also that we can specify the altitude of the logo chunks by setting only two values, since "Ba" and "Zone" use the same value.
Shapes can only rotate about the Y axis. The tank turret chunk and logo pieces are pre-rotated in the shape definition. (If you rotate the logo 76 degrees about the X axis it will face squarely toward the viewer.)
Objects are defined in two parts: a list of vertices, and a list of drawing commands. Drawing commands are used in place of a simple list of edges to optimize the beam movement.
A table of vertex data addresses starts at $388e, followed by the vertex data itself. Note this is in the AVG ROM. Only the vertex data for the logo pieces is in the game ROM address space. The format is straightforward: a data length byte, followed by 16-bit X/Y/Z coordinates. There's a bit of weirdness in terms of how the axes are defined, and the X/Z coordinates are doubled to make the math box calculations come out right, but no special encoding is used for the numbers.
The drawing commands are a little more complicated. The table of shape command addresses starts at $7472, and the drawing code is at $5c5c. Each byte has a 3-bit command and a 5-bit vertex index. (Note this limits objects to 32 vertices; the vertex transform code further limits it to 26.)
The commands are:
The drawing code generates screen X/Y coordinates for all vertices. The drawing commands generally start with command 3 (move to center then move to vertex); after that, it's necessary to subtract vertex coordinates to generate the relative motion required for AVG.
Command #5 is used exclusively for the projectile explosion. Shape $0e is an object with a single vertex. The vertex is transformed like any other shape, which provides the center point for the explosion. The explosion particles are rendered with AVG commands, scaled by distance. This approach is less expensive than the similar effect used for the missile splatter.
Each game frame, the game generates a list of visible objects at $200 and displays them ($5946). The process works like this:
Copyright 2020 by Andy McFadden