1 /* 2 * Copyright (C) Volition, Inc. 1999. All rights reserved. 3 * 4 * All source code herein is the property of Volition, Inc. You may not sell 5 * or otherwise commercially exploit the source or things you created based on the 6 * source. 7 * 8 */ 9 10 #ifndef _MODELSINC_H 11 #define _MODELSINC_H 12 13 14 class polymodel; 15 16 #ifndef MODEL_LIB 17 #pragma message ("This should only be used internally by the model library. See John if you think you need to include this elsewhere.") 18 #endif 19 20 #define OP_EOF 0 21 #define OP_DEFPOINTS 1 22 #define OP_FLATPOLY 2 23 #define OP_TMAPPOLY 3 24 #define OP_SORTNORM 4 25 #define OP_BOUNDBOX 5 26 27 // change header for freespace2 28 //#define FREESPACE1_FORMAT 29 #define FREESPACE2_FORMAT 30 #if defined( FREESPACE1_FORMAT ) 31 #elif defined ( FREESPACE2_FORMAT ) 32 #else 33 #error Neither FREESPACE1_FORMAT or FREESPACE2_FORMAT defined 34 #endif 35 36 // endianess will be handled by cfile and others now, little-endian should be default in all cases 37 38 // little-endian (Intel) IDs 39 #define POF_HEADER_ID 0x4f505350 // 'OPSP' (PSPO) POF file header 40 #if defined( FREESPACE1_FORMAT ) 41 // FREESPACE1 FORMAT 42 #define ID_OHDR 0x5244484f // RDHO (OHDR): POF file header 43 #define ID_SOBJ 0x4a424f53 // JBOS (SOBJ): Subobject header 44 #else 45 #define ID_OHDR 0x32524448 // 2RDH (HDR2): POF file header 46 #define ID_SOBJ 0x324a424f // 2JBO (OBJ2): Subobject header 47 #endif 48 #define ID_TXTR 0x52545854 // RTXT (TXTR): Texture filename list 49 #define ID_INFO 0x464e4950 // FNIP (PINF): POF file information, like command line, etc 50 #define ID_GRID 0x44495247 // DIRG (GRID): Grid information 51 #define ID_SPCL 0x4c435053 // LCPS (SPCL): Special object -- like a gun, missile, docking point, etc. 52 #define ID_PATH 0x48544150 // HTAP (PATH): A spline based path 53 #define ID_GPNT 0x544e5047 // TNPG (GPNT): gun points 54 #define ID_MPNT 0x544e504d // TNPM (MPNT): missile points 55 #define ID_DOCK 0x4b434f44 // KCOD (DOCK): docking points 56 #define ID_TGUN 0x4e554754 // NUGT (TGUN): turret gun points 57 #define ID_TMIS 0x53494d54 // SIMT (TMIS): turret missile points 58 #define ID_FUEL 0x4c455546 // LEUF (FUEL): thruster points 59 #define ID_SHLD 0x444c4853 // DLHS (SHLD): shield definition 60 #define ID_EYE 0x20455945 // EYE (EYE ): eye information 61 #define ID_INSG 0x47534e49 // GSNI (INSG): insignia information 62 #define ID_ACEN 0x4e454341 // NECA (ACEN): autocentering information 63 #define ID_GLOW 0x574f4c47 // WOLG (GLOW): glow points -Bobboau 64 #define ID_GLOX 0x584f4c47 // experimental glow points will be gone as soon as we get a proper pof editor -Bobboau 65 #define ID_SLDC 0x43444c53 // CDLS (SLDC): Shield Collision Tree 66 #define ID_SLC2 0x32434c53 // 2CLS (SLC2): Shield Collision Tree with ints instead of char - ShivanSpS 67 68 #define uw(p) (*((uint *) (p))) 69 #define w(p) (*((int *) (p))) 70 #define wp(p) ((int *) (p)) 71 #define vp(p) ((vec3d *) (p)) 72 #define fl(p) (*((float *) (p))) 73 74 extern int model_interp(matrix * orient, ubyte * data, polymodel * pm ); 75 76 // Creates the octants for a given polygon model 77 void model_octant_create( polymodel * pm ); 78 79 // frees the memory the octants use for a given polygon model 80 void model_octant_free( polymodel * pm ); 81 82 void model_calc_bound_box( vec3d *box, vec3d *big_mn, vec3d *big_mx); 83 84 void interp_clear_instance(); 85 86 // endian swapping stuff - tigital 87 void swap_bsp_data( polymodel *pm, void *model_ptr ); 88 89 // endian swapping stuff - kaz 90 void swap_sldc_data(ubyte *buffer); 91 92 extern vec3d **Interp_verts; 93 94 #endif 95