Skip to navigation

Drawing ships: VERTEX

[BBC Micro disc version, Ship blueprints O]

Name: VERTEX [Show more] Type: Macro Category: Drawing ships Summary: Macro definition for adding vertices to ship blueprints Deep dive: Ship blueprints
Context: See this macro in context in the source code References: This macro is used as follows: * SHIP_ASTEROID uses VERTEX * SHIP_CANISTER uses VERTEX * SHIP_COBRA_MK_1 uses VERTEX * SHIP_COBRA_MK_3 uses VERTEX * SHIP_CORIOLIS uses VERTEX * SHIP_ESCAPE_POD uses VERTEX * SHIP_KRAIT uses VERTEX * SHIP_MAMBA uses VERTEX * SHIP_PLATE uses VERTEX * SHIP_PYTHON_P uses VERTEX * SHIP_SPLINTER uses VERTEX * SHIP_VIPER uses VERTEX

The following macro is used to build the ship blueprints: VERTEX x, y, z, face1, face2, face3, face4, visibility See the deep dive on "Ship blueprints" for details of how vertices are stored in the ship blueprints, and the deep dive on "Drawing ships" for information on how vertices are used to draw 3D wireframe ships.
Arguments: x The vertex's x-coordinate y The vertex's y-coordinate z The vertex's z-coordinate face1 The number of face 1 associated with this vertex face2 The number of face 2 associated with this vertex face3 The number of face 3 associated with this vertex face4 The number of face 4 associated with this vertex visibility The visibility distance, beyond which the vertex is not shown
MACRO VERTEX x, y, z, face1, face2, face3, face4, visibility IF x < 0 s_x = 1 << 7 ELSE s_x = 0 ENDIF IF y < 0 s_y = 1 << 6 ELSE s_y = 0 ENDIF IF z < 0 s_z = 1 << 5 ELSE s_z = 0 ENDIF s = s_x + s_y + s_z + visibility f1 = face1 + (face2 << 4) f2 = face3 + (face4 << 4) ax = ABS(x) ay = ABS(y) az = ABS(z) EQUB ax, ay, az, s, f1, f2 ENDMACRO