Skip to navigation

Elite on the BBC Micro and NES

Drawing ships: FACE

[BBC Micro disc version, Ship blueprints B]

Name: FACE [Show more] Type: Macro Category: Drawing ships Summary: Macro definition for adding faces 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_ADDER uses FACE * SHIP_BOULDER uses FACE * SHIP_CANISTER uses FACE * SHIP_COBRA_MK_3 uses FACE * SHIP_DODO uses FACE * SHIP_ESCAPE_POD uses FACE * SHIP_KRAIT uses FACE * SHIP_MAMBA uses FACE * SHIP_PLATE uses FACE * SHIP_VIPER uses FACE * SHIP_WORM uses FACE

The following macro is used to build the ship blueprints: FACE normal_x, normal_y, normal_z, visibility See the deep dive on "Ship blueprints" for details of how faces are stored in the ship blueprints, and the deep dive on "Drawing ships" for information on how faces are used to draw 3D wireframe ships.
Arguments: normal_x The face normal's x-coordinate normal_y The face normal's y-coordinate normal_z The face normal's z-coordinate visibility The visibility distance, beyond which the edge is always shown
MACRO FACE normal_x, normal_y, normal_z, visibility IF normal_x < 0 s_x = 1 << 7 ELSE s_x = 0 ENDIF IF normal_y < 0 s_y = 1 << 6 ELSE s_y = 0 ENDIF IF normal_z < 0 s_z = 1 << 5 ELSE s_z = 0 ENDIF s = s_x + s_y + s_z + visibility ax = ABS(normal_x) ay = ABS(normal_y) az = ABS(normal_z) EQUB s, ax, ay, az ENDMACRO