dynlist_macros.h (11252B)
1 #ifndef GD_DYNLIST_MACROS_H 2 #define GD_DYNLIST_MACROS_H 3 4 /* DynListCmd Macros */ 5 6 /** 7 * Must be the first command in a dynlist. 8 */ 9 #define BeginList() \ 10 { 53716, {0}, {0}, {0.0, 0.0, 0.0} } 11 12 /** 13 * Must be the last command in a dynlist. 14 */ 15 #define EndList() \ 16 { 58, {0}, {0}, {0.0, 0.0, 0.0} } 17 18 /** 19 * If `enable` is TRUE, then subsequent object names are treated as integers 20 * rather than strings. 21 */ 22 #define UseIntegerNames(enable) \ 23 { 0, {0}, {(void *)(enable)}, {0.0, 0.0, 0.0} } 24 25 /** 26 * Set the initial position of the current object 27 * Supported Objs: joints, particles, nets, vertices, cameras 28 */ 29 #define SetInitialPosition(x, y, z) \ 30 { 1, {0}, {0}, {(x), (y), (z)} } 31 32 /** 33 * Set the relative position of the current object 34 * Supported Objs: joints, particles, vertices, cameras, labels 35 */ 36 #define SetRelativePosition(x, y, z) \ 37 { 2, {0}, {0}, {(x), (y), (z)} } 38 39 /** 40 * Set the world position of the current object 41 * Supported Objs: joints, nets, vertices, cameras, gadgets, views 42 */ 43 #define SetWorldPosition(x, y, z) \ 44 { 3, {0}, {0}, {(x), (y), (z)} } 45 46 /** 47 * Set the normal of the current object 48 * Supported Objs: vertices 49 */ 50 #define SetNormal(x, y, z) \ 51 { 4, {0}, {0}, {(x), (y), (z)} } 52 53 /** 54 * Set the scale of the current object 55 * Supported Objs: joints, particles, nets, gadgets, views, lights 56 */ 57 #define SetScale(x, y, z) \ 58 { 5, {0}, {0}, {(x), (y), (z)} } 59 60 /** 61 * Set the rotation of the current object 62 * Supported Objs: joints, nets 63 */ 64 #define SetRotation(x, y, z) \ 65 { 6, {0}, {0}, {(x), (y), (z)} } 66 67 /** 68 * Set the specified bits in the object's `drawFlags` field 69 * Supported Objs: all 70 */ 71 #define SetDrawFlag(flags) \ 72 { 7, {0}, {(void *)(flags)}, {0.0, 0.0, 0.0} } 73 74 /** 75 * Set the specified bits in the object specific flag 76 * Supported Objs: bones, joints, particles, shapes, nets, cameras, views, lights 77 */ 78 #define SetFlag(flags) \ 79 { 8, {0}, {(void *)(flags)}, {0.0, 0.0, 0.0} } 80 81 /** 82 * Clear the specified bits in the object specific flag 83 * Supported Objs: bones, joints, particles, nets, cameras 84 */ 85 #define ClearFlag(flags) \ 86 { 9, {0}, {(void *)(flags)}, {0.0, 0.0, 0.0} } 87 88 /** 89 * Set the friction vector of a Joint 90 * Supported Objs: joints 91 */ 92 #define SetFriction(x, y, z) \ 93 { 10, {0}, {0}, {(x), (y), (z)} } 94 95 /** 96 * Set the spring value of a Bone 97 * Supported Objs: bones 98 */ 99 #define SetSpring(spring) \ 100 { 11, {0}, {0}, {(spring), 0.0, 0.0} } 101 102 /** 103 * Jump to pointed dynlist. Once that list has finished processing, flow returns 104 * to the current list. 105 */ 106 #define CallList(list) \ 107 { 12, {(void *)(list)}, {0}, {0.0, 0.0, 0.0} } 108 109 /** 110 * Sets the object's color to one of the predefined colors (see draw_objects.h 111 * for the list of colors. 112 * Supported Objs: joints, particles, nets, faces, gadgets 113 */ 114 #define SetColourNum(colourNum) \ 115 { 13, {0}, {(void *)(colourNum)}, {0.0, 0.0, 0.0} } 116 117 /** 118 * Make an object of the specified type and name, and set it as the current 119 * object. 120 */ 121 #define MakeDynObj(type, name) \ 122 { 15, {(void *)(name)}, {(void *)(type)}, {0.0, 0.0, 0.0} } 123 124 /** 125 * Make a group that will contain all subsequently created objects once the 126 * EndGroup command is called. 127 */ 128 #define StartGroup(grpName) \ 129 { 16, {(void *)(grpName)}, {0}, {0.0, 0.0, 0.0} } 130 131 /** 132 * End a group. All objects created between StartGroup and EndGroup are added to 133 * the group. 134 */ 135 #define EndGroup(grpName) \ 136 { 17, {(void *)(grpName)}, {0}, {0.0, 0.0, 0.0} } 137 138 /** 139 * Add the current object to the specified group. 140 * Supported Objs: all 141 */ 142 #define AddToGroup(grpName) \ 143 { 18, {(void *)(grpName)}, {0}, {0.0, 0.0, 0.0} } 144 145 /** 146 * Set an object specific type flag. 147 * Supported Objs: groups, joints, particles, nets, materials, gadgets 148 */ 149 #define SetType(type) \ 150 { 19, {0}, {(void *)(type)}, {0.0, 0.0, 0.0} } 151 152 /** 153 * Set the current shape's material group to the specified group. 154 * Supported Objs: shapes 155 */ 156 #define SetMaterialGroup(mtlGrpName) \ 157 { 20, {(void *)(mtlGrpName)}, {0}, {0.0, 0.0, 0.0} } 158 159 /** 160 * Assign the specified group to the current object. The purpose of the group 161 * depends on the current object's type. For shapes, it sets the vertex data. 162 * For animators, it sets the animation data. For nets, it sets ???. For 163 * gadgets, it sets ???. 164 * Supported Objs: shapes, nets, gadgets, animators 165 */ 166 #define SetNodeGroup(grpName) \ 167 { 21, {(void *)(grpName)}, {0}, {0.0, 0.0, 0.0} } 168 169 /** 170 * Set the skin group of the current Net object with the vertices from the 171 * specified shape. 172 * Supported Objs: nets 173 */ 174 #define SetSkinShape(shapeName) \ 175 { 22, {(void *)(shapeName)}, {0}, {0.0, 0.0, 0.0} } 176 177 /** 178 * Set the plane (face) group of the current object. 179 * Supported Objs: shapes, nets 180 */ 181 #define SetPlaneGroup(planeGrpName) \ 182 { 23, {(void *)(planeGrpName)}, {0}, {0.0, 0.0, 0.0} } 183 184 /** 185 * Set the current object's shape, where `shapePtr` is a pointer to an 186 * `ObjShape`. 187 * Supported Objs: bones, joints, particles, nets, gadgets, lights 188 */ 189 #define SetShapePtrPtr(shapePtr) \ 190 { 24, {(void *)(shapePtr)}, {0}, {0.0, 0.0, 0.0} } 191 192 /** 193 * Set the current object's shape, where `shapeName` is the name of a shape 194 * object. 195 * Supported Objs: bones, joints, particles, nets, gadgets 196 */ 197 #define SetShapePtr(shapeName) \ 198 { 25, {(void *)(shapeName)}, {0}, {0.0, 0.0, 0.0} } 199 200 /** 201 * Set offset of the connected shape 202 * Supported Objs: joints 203 */ 204 #define SetShapeOffset(x, y, z) \ 205 { 26, {0}, {0}, {(x), (y), (z)} } 206 207 /** 208 * Set the center of gravity of the current Net object 209 * Supported Objs: nets 210 */ 211 #define SetCenterOfGravity(x, y, z) \ 212 { 27, {0}, {0}, {(x), (y), (z)} } 213 214 // TODO: 215 216 /* Link Object ID to the current dynobj */ 217 /* Supported Objs: groups, bones, faces, cameras, views, labels, animators */ 218 #define LinkWith(w1) \ 219 { 28, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } 220 221 /* Link Object pointer to the current dynobj */ 222 /* Supported Objs: groups, bones, faces, cameras, views, labels, animators */ 223 #define LinkWithPtr(w1) \ 224 { 29, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } 225 226 /** 227 * Set the specified object as the current object. 228 * Supported Objs: all 229 */ 230 #define UseObj(name) \ 231 { 30, {(void *)(name)}, {0}, {0.0, 0.0, 0.0} } 232 233 /** 234 * Set the current Net object's control type field. Control type is never used 235 * for anything, so this command effectively does nothing. 236 * Supported Objs: nets 237 */ 238 #define SetControlType(w2) \ 239 { 31, {0}, {(void *)(w2)}, {0.0, 0.0, 0.0} } 240 241 /** 242 * Set the weight percentage of the specified vertex controlled by the current 243 * Joint object. 244 * Supported Objs: joints 245 */ 246 #define SetSkinWeight(vtxNum, weight) \ 247 { 32, {0}, {(void *)(vtxNum)}, {(weight), 0.0, 0.0} } 248 249 /** 250 * Set the ambient color of the current Material object. 251 * Supported Objs: materials 252 */ 253 #define SetAmbient(r, g, b) \ 254 { 33, {0}, {0}, {(r), (g), (b)} } 255 256 /** 257 * Set the diffuse color of the current Material or Light object. 258 * Supported Objs: materials, lights 259 */ 260 #define SetDiffuse(r, g, b) \ 261 { 34, {0}, {0}, {(r), (g), (b)} } 262 263 /** 264 * Set the object specific ID field. 265 * Supported Objs: joints, vertices, materials, lights 266 */ 267 #define SetId(id) \ 268 { 35, {0}, {(void *)(id)}, {0.0, 0.0, 0.0} } 269 270 /** 271 * Set the material id of the current Face 272 * Supported Objs: faces 273 */ 274 #define SetMaterial(id) \ 275 { 36, {0}, {(void *)(id)}, {0.0, 0.0, 0.0} } 276 277 /** 278 * For all faces in the current Group, resolve their material IDs to actual 279 * `ObjMaterial`s. 280 * Supported Objs: groups 281 */ 282 #define MapMaterials(name) \ 283 { 37, {(void *)(name)}, {0}, {0.0, 0.0, 0.0} } 284 285 /** 286 * For all faces in the current Group, resolve their vertex indices to pointers 287 * to actual `ObjVertex`es. Calculate normals for all vertices in the the group 288 * specified by `name` 289 * Supported Objs: groups 290 */ 291 #define MapVertices(name) \ 292 { 38, {(void *)(name)}, {0}, {0.0, 0.0, 0.0} } 293 294 /** 295 * Stub command (does nothing). 296 * Supported Objs: joints 297 */ 298 #define Attach(name) \ 299 { 39, {(void *)(name)}, {0}, {0.0, 0.0, 0.0} } 300 301 /** 302 * Attach the current object to the specified object, using the specified flags. 303 * Supported Objs: joints, particles, nets, animators 304 */ 305 #define AttachTo(flags, name) \ 306 { 40, {(void *)(name)}, {(void *)(flags)}, {0.0, 0.0, 0.0} } 307 308 /** 309 * Set the point at which the current object is attached to its parent object 310 * Supported Objs: joints, particles, nets 311 */ 312 #define SetAttachOffset(x, y, z) \ 313 { 41, {0}, {0}, {(x), (y), (z)} } 314 315 /** 316 * Set a "suffix" to use with dynobj names. All commands that take a name as a 317 * parameter will have this suffix appended to the name. 318 */ 319 #define SetNameSuffix(suffix) \ 320 { 43, {(void *)(suffix)}, {0}, {0.0, 0.0, 0.0} } 321 322 /** 323 * Set the float paramter `param` to `value`. 324 * For Shapes, the following parameters are supported: 325 * PARM_F_ALPHA - the alpha (opacity) of the shape 326 * For Gadgets, the following parameters are supported: 327 * PARM_F_RANGE_MIN - the minimum value of the gadget 328 * PARM_F_RANGE_MAX - the maximum value of the gadget 329 * PARM_F_VARVAL - the current value of the gadget 330 * For Vertices, the following parameters are supported: 331 * PARM_F_ALPHA - the alpha (opacity) of the vertex 332 * Supported Objs: shapes, vertices, gadgets 333 */ 334 #define SetParamF(param, value) \ 335 { 44, {0}, {(void *)(param)}, {(value), 0.0, 0.0} } 336 337 /** 338 * Set pointer paramter `param` to `value` 339 * For Labels, the following parameters are supported: 340 * PARM_PTR_CHAR - the format string for the label text 341 * For Views, the following parameters are supported: 342 * PARM_PTR_CHAR - the name of the view 343 * For Faces, the following parameters are supported: 344 * PARM_PTR_OBJ_VTX - (not actually a pointer) index of a vertex created with `MakeVertex`. 345 * Supported Objs: faces, views, labels */ 346 #define SetParamPtr(param, value) \ 347 { 45, {(void *)(value)}, {(void *)(param)}, {0.0, 0.0, 0.0} } 348 349 /** 350 * Create a Net with the specified name, and add a group to it. 351 */ 352 #define MakeNetWithSubGroup(name) \ 353 { 46, {(void *)(name)}, {0}, {0.0, 0.0, 0.0} } 354 355 /** 356 * Make a Joint and attach it to the Net created with "MakeNetWithSubGroup". 357 */ 358 #define MakeAttachedJoint(name) \ 359 { 47, {(void *)(name)}, {0}, {0.0, 0.0, 0.0} } 360 361 /** 362 * End a Net that was created with "MakeNetWithSubGroup" 363 */ 364 #define EndNetWithSubGroup(name) \ 365 { 48, {(void *)(name)}, {0}, {0.0, 0.0, 0.0} } 366 367 /** 368 * Add a Vertex dynobj 369 */ 370 #define MakeVertex(x, y, z) \ 371 { 49, {0}, {0}, {(x), (y), (z)} } 372 373 /** 374 * Add a ValPtr dynobj 375 */ 376 #define MakeValPtr(id, flags, type, offset) \ 377 { 50, {(void *)(id)}, {(void *)(type)}, {(offset), (flags), 0.0} } 378 379 /** 380 * Set the texture of the current Material dynobj. Note that textures are not 381 * actually supported. 382 * Supported Objs: materials 383 */ 384 #define UseTexture(texture) \ 385 { 52, {0}, {(void *)(texture)}, {0.0, 0.0, 0.0} } 386 387 /** 388 * Stub command (does nothing). 389 * Supported Objs: vertices 390 */ 391 #define SetTextureST(s, t) \ 392 { 53, {0}, {0}, {(s), (t), 0.0} } 393 394 /* Make a new Net from Shape ID */ 395 #define MakeNetFromShape(shape) \ 396 { 54, {(void *)(shape)}, {0}, {0.0, 0.0, 0.0} } 397 398 /* Make a new Net from Shape double pointer PTR */ 399 #define MakeNetFromShapePtrPtr(w1) \ 400 { 55, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } 401 402 #endif // GD_DYNLIST_MACROS_H