From: Thomas Debesse Date: Sat, 27 Jan 2018 21:13:14 +0000 (+0100) Subject: another way to do 265c42d X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=58812aef5e5e22dfb864edf85bd4de2f3fd2c803;p=xonotic%2Fnetradiant.git another way to do 265c42d --- diff --git a/tools/quake3/q3data/3dslib.c b/tools/quake3/q3data/3dslib.c index 7419a749..3e37f5e4 100644 --- a/tools/quake3/q3data/3dslib.c +++ b/tools/quake3/q3data/3dslib.c @@ -47,7 +47,7 @@ static int ReadString( FILE *fp, char *buffer ){ return bytesRead; } -static int ReadChunkAndLength( FILE *fp, short *chunk, long *len ){ +static int ReadChunkAndLength( FILE *fp, unsigned short *chunk, long *len ){ if ( fread( chunk, sizeof( short ), 1, fp ) != 1 ) { return 0; } @@ -58,7 +58,7 @@ static int ReadChunkAndLength( FILE *fp, short *chunk, long *len ){ } static void LoadMapName( FILE *fp, char *buffer, int thisChunkLen ){ - short chunkID; + unsigned short chunkID; long chunkLen; long bytesRead = 0; @@ -82,7 +82,7 @@ static void LoadMapName( FILE *fp, char *buffer, int thisChunkLen ){ static void LoadMaterialList( FILE *fp, long thisChunkLen, _3DSMaterial_t *pMat ){ long chunkLen; - short chunkID; + unsigned short chunkID; long bytesRead = 0; _3DSMaterial_t mat; char curdir[1024]; @@ -230,7 +230,7 @@ static void LoadMeshMaterialGroup( FILE *fp, long thisChunkLen, _3DSMeshMaterial static void LoadNamedTriObject( FILE *fp, long thisChunkLen, _3DSTriObject_t *pTO ){ long chunkLen; - short chunkID; + unsigned short chunkID; int i = 0; long bytesRead = 0; _3DSTriObject_t triObj; @@ -347,7 +347,7 @@ static void LoadNamedTriObject( FILE *fp, long thisChunkLen, _3DSTriObject_t *pT static void LoadNamedObject( FILE *fp, long thisChunkLen, _3DSNamedObject_t *pNO ){ long chunkLen; - short chunkID; + unsigned short chunkID; int i = 0; long bytesRead = 0; char name[100]; @@ -391,7 +391,7 @@ static void LoadNamedObject( FILE *fp, long thisChunkLen, _3DSNamedObject_t *pNO } static void LoadEditChunk( FILE *fp, long thisChunkLen, _3DSEditChunk_t *pEC ){ - short chunkID; + unsigned short chunkID; long chunkLen; long bytesRead = 0; _3DSEditChunk_t editChunk; @@ -451,7 +451,7 @@ static void LoadEditChunk( FILE *fp, long thisChunkLen, _3DSEditChunk_t *pEC ){ static void Load3DS( const char *filename, _3DS_t *p3DS, qboolean verbose ){ FILE *fp; - short chunkID; + unsigned short chunkID; long chunkLen; _3DSEditChunk_t editChunk; diff --git a/tools/quake3/q3data/3dslib.h b/tools/quake3/q3data/3dslib.h index 89ceea69..8a8a34c4 100644 --- a/tools/quake3/q3data/3dslib.h +++ b/tools/quake3/q3data/3dslib.h @@ -88,52 +88,52 @@ typedef struct _3DSEditChunk_t editChunk; } _3DS_t; -#define _3DS_CHUNK_NULL ((short) 0x0000) -#define _3DS_CHUNK_UNKNOWN0 ((short) 0x0001) -#define _3DS_CHUNK_M3D_VERSION ((short) 0x0002) -#define _3DS_CHUNK_M3D_KFVERSION ((short) 0x0005) -#define _3DS_CHUNK_COLOR_F ((short) 0x0010) -#define _3DS_CHUNK_COLOR_24 ((short) 0x0011) -#define _3DS_CHUNK_LIN_COLOR_24 ((short) 0x0012) -#define _3DS_CHUNK_LIN_COLOR_F ((short) 0x0013) -#define _3DS_CHUNK_INT_PERCENTAGE ((short) 0x0030) -#define _3DS_CHUNK_FLOAT_PERCENT ((short) 0x0031) -#define _3DS_CHUNK_MASTER_SCALE ((short) 0x0100) -#define _3DS_CHUNK_CHUNK_TYPE ((short) 0x0995) -#define _3DS_CHUNK_CHUNK_UNIQUE ((short) 0x0996) -#define _3DS_CHUNK_NOT_CHUNK ((short) 0x0997) -#define _3DS_CHUNK_CONTAINER ((short) 0x0998) -#define _3DS_CHUNK_IS_CHUNK ((short) 0x0999) -#define _3DS_CHUNK_C_SXP_SELFI_MASKDATA ((short) 0x0c3c) - -#define _3DS_CHUNK_BITMAP ((short) 0x1100) -#define _3DS_CHUNK_USE_BITMAP ((short) 0x1101) -#define _3DS_CHUNK_SOLID_BGND ((short) 0x1200) -#define _3DS_CHUNK_USE_SOLID_BGND ((short) 0x1201) - -#define _3DS_CHUNK_EDIT ((short) 0x3d3d) -#define _3DS_CHUNK_MESH_VERSION ((short) 0x3d3e) - -#define _3DS_CHUNK_NAMED_OBJECT ((short) 0x4000) -#define _3DS_CHUNK_NAMED_TRI_OBJECT ((short) 0x4100) -#define _3DS_CHUNK_POINT_ARRAY ((short) 0x4110) -#define _3DS_CHUNK_POINT_FLAG_ARRAY ((short) 0x4111) -#define _3DS_CHUNK_FACE_ARRAY ((short) 0x4120) -#define _3DS_CHUNK_MSH_MAT_GROUP ((short) 0x4130) -#define _3DS_CHUNK_TEX_VERTS ((short) 0x4140) -#define _3DS_CHUNK_SMOOTH_GROUP ((short) 0x4150) -#define _3DS_CHUNK_MESH_MATRIX ((short) 0x4160) -#define _3DS_CHUNK_MAGIC ((short) 0x4d4d) - -#define _3DS_CHUNK_MAT_NAME ((short) 0xa000) -#define _3DS_CHUNK_TEXMAP ((short) 0xa200) -#define _3DS_CHUNK_SPECMAP ((short) 0xa204) -#define _3DS_CHUNK_OPACMAP ((short) 0xa210) -#define _3DS_CHUNK_REFLMAP ((short) 0xa220) -#define _3DS_CHUNK_BUMPMAP ((short) 0xa230) -#define _3DS_CHUNK_MAT_MAPNAME ((short) 0xa300) -#define _3DS_CHUNK_MAT_LIST ((short) 0xafff) - -#define _3DS_CHUNK_KEYFRAME_DATA ((short) 0xb000) +#define _3DS_CHUNK_NULL 0x0000 +#define _3DS_CHUNK_UNKNOWN0 0x0001 +#define _3DS_CHUNK_M3D_VERSION 0x0002 +#define _3DS_CHUNK_M3D_KFVERSION 0x0005 +#define _3DS_CHUNK_COLOR_F 0x0010 +#define _3DS_CHUNK_COLOR_24 0x0011 +#define _3DS_CHUNK_LIN_COLOR_24 0x0012 +#define _3DS_CHUNK_LIN_COLOR_F 0x0013 +#define _3DS_CHUNK_INT_PERCENTAGE 0x0030 +#define _3DS_CHUNK_FLOAT_PERCENT 0x0031 +#define _3DS_CHUNK_MASTER_SCALE 0x0100 +#define _3DS_CHUNK_CHUNK_TYPE 0x0995 +#define _3DS_CHUNK_CHUNK_UNIQUE 0x0996 +#define _3DS_CHUNK_NOT_CHUNK 0x0997 +#define _3DS_CHUNK_CONTAINER 0x0998 +#define _3DS_CHUNK_IS_CHUNK 0x0999 +#define _3DS_CHUNK_C_SXP_SELFI_MASKDATA 0x0c3c + +#define _3DS_CHUNK_BITMAP 0x1100 +#define _3DS_CHUNK_USE_BITMAP 0x1101 +#define _3DS_CHUNK_SOLID_BGND 0x1200 +#define _3DS_CHUNK_USE_SOLID_BGND 0x1201 + +#define _3DS_CHUNK_EDIT 0x3d3d +#define _3DS_CHUNK_MESH_VERSION 0x3d3e + +#define _3DS_CHUNK_NAMED_OBJECT 0x4000 +#define _3DS_CHUNK_NAMED_TRI_OBJECT 0x4100 +#define _3DS_CHUNK_POINT_ARRAY 0x4110 +#define _3DS_CHUNK_POINT_FLAG_ARRAY 0x4111 +#define _3DS_CHUNK_FACE_ARRAY 0x4120 +#define _3DS_CHUNK_MSH_MAT_GROUP 0x4130 +#define _3DS_CHUNK_TEX_VERTS 0x4140 +#define _3DS_CHUNK_SMOOTH_GROUP 0x4150 +#define _3DS_CHUNK_MESH_MATRIX 0x4160 +#define _3DS_CHUNK_MAGIC 0x4d4d + +#define _3DS_CHUNK_MAT_NAME 0xa000 +#define _3DS_CHUNK_TEXMAP 0xa200 +#define _3DS_CHUNK_SPECMAP 0xa204 +#define _3DS_CHUNK_OPACMAP 0xa210 +#define _3DS_CHUNK_REFLMAP 0xa220 +#define _3DS_CHUNK_BUMPMAP 0xa230 +#define _3DS_CHUNK_MAT_MAPNAME 0xa300 +#define _3DS_CHUNK_MAT_LIST 0xafff + +#define _3DS_CHUNK_KEYFRAME_DATA 0xb000 void _3DS_LoadPolysets( const char *filename, polyset_t **ppPSET, int *numpsets, qboolean verbose );