From 218ca90543758a20ac326e444ca0643174ca7384 Mon Sep 17 00:00:00 2001 From: Rebellion Developments Date: Thu, 16 Mar 2000 11:25:00 +0100 Subject: Import Aliens vs Predator - Gold (Build 116) Source code release, imported from: https://www.gamefront.com/games/aliens-vs-predator-3/file/avp-gold-complete-source-code All text files were converted to Unix format. --- 3dc/MSLHAND.C | 187 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 3dc/MSLHAND.C (limited to '3dc/MSLHAND.C') diff --git a/3dc/MSLHAND.C b/3dc/MSLHAND.C new file mode 100644 index 0000000..fe1e8ca --- /dev/null +++ b/3dc/MSLHAND.C @@ -0,0 +1,187 @@ +#include "3dc.h" + +#include "mslhand.h" + +#if PSX +#include "psx_inc.h" +#endif + +#define UseLocalAssert 1 +#include "ourasert.h" + +extern SHAPEHEADER * mainshapelist[]; + +static int begins[ MSLS_MAXSECTIONS ]; +static int ends[ MSLS_MAXSECTIONS ]; + +static int autodelete[ maxobjects ]; + +#define MSS_FREE (-1) + +static void EnsureInitialized(void) +{ + static int initialized = 0; + + if (!initialized) + { + int i; + + initialized = 1; + + for (i=0; i=0 ? ends[i] : 0; + } + + blockstart = ends[sect]; + /* can use a local assert here to fail on a mainshapelist overflow, otherwise return error code */ + LOCALASSERT(ends[sect] + num_shapes <= maxend); + if (ends[sect] + num_shapes > maxend ) return MSL_OVERFLOW; + ends[sect] += num_shapes; + + for (i=blockstart; ipoints) + { + if (*shp->points) free(*shp->points); + free(shp->points); + } + if (shp->sh_normals) + { + if (*shp->sh_normals) free(*shp->sh_normals); + free(shp->sh_normals); + } + if (shp->sh_vnormals) + { + if (*shp->sh_vnormals) free(*shp->sh_vnormals); + free(shp->sh_vnormals); + } + if (shp->sh_extraitemdata) + free(shp->sh_extraitemdata); + /* the items are allocated in one big bunch + // 9 int's per item (to make bsp simple) + // this should be changed if it is to be done + // a different way + */ + if (shp->items) + { + for (i=0; inumitems; i++) + { + if (shp->items[i][0] == 5 || shp->items[i][0] == 6) + { + int UVIndex = (shp->items[i][3] &0xffff0000) >> 16; + max_num_texs = max (max_num_texs, shp->items[i][3] &0x7fff); + if(shp->items[i][2]& iflag_txanim) + { + int j; + TXANIMHEADER** thlist=(TXANIMHEADER**)shp->sh_textures[UVIndex]; + for(j=1;thlist[j]!=0;j++) + { + int k; + TXANIMHEADER* th=thlist[j]; + for(k=0;ktxa_numframes;k++) + { + free(th->txa_framedata[k].txf_uvdata); + } + free (th->txa_framedata); + free (th); + } + free (thlist); + shp->sh_textures[UVIndex]=0; + } + else + { + free(shp->sh_textures[UVIndex]); + } + } + } + + free (*shp->items); + free (shp->items); + } + + if (shp->sh_textures) + { + free (shp->sh_textures); + } + + if (shp->sh_localtextures) + { + for (i=0; i<(max_num_texs+1); i++) + { + free (shp->sh_localtextures[i]); + } + free (shp->sh_localtextures); + } + + if (shp->sh_instruction) + free(shp->sh_instruction); + + free(shp); + } + mainshapelist[i]=0; + autodelete[i]=0; + } + + begins[sect]=MSS_FREE; + ends[sect]=MSS_FREE; + +#else + +printf("\nDo NOT call this function!\n"); +//GLOBALASSERT(1==0); + +#endif + +} -- cgit v1.3