diff --git a/engine/model.c b/engine/model.c index 73d1ded..ffc5bd7 100644 --- a/engine/model.c +++ b/engine/model.c @@ -26,15 +26,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "r_local.h" #ifdef QSB -#define MAX_MOD_KNOWN 4096 + #define MAX_MOD_KNOWN 4096 #else -#define MAX_MOD_KNOWN 256 + #define MAX_MOD_KNOWN 256 #endif + model_t mod_known[MAX_MOD_KNOWN]; -int mod_numknown; +int mod_numknown; // values for model_t's needload -#define NL_PRESENT 0 +#define NL_PRESENT 0 #define NL_NEEDS_LOADED 1 #define NL_UNREFERENCED 2 @@ -52,7 +53,8 @@ void Mod_ClearAll (void) for (i=0 , mod=mod_known ; ineedload = NL_UNREFERENCED; //FIX FOR CACHE_ALLOC ERRORS: - if (mod->type == mod_sprite) mod->cache.data = NULL; + if (mod->type == mod_sprite) + mod->cache.data = NULL; } } @@ -220,40 +222,20 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash) void R_LightsHere(vec3_t org, int radius, vec3_t color, int key) { - //entity_t *anty; dlight_t *dl; - int lnum = key; - -// Con_Printf("got fed %f %f %f %i %i\n", org[0], org[1], org[2], radius, key); - -// for (lnum=0 ; lnumorigin); VectorCopy (color, dl->color); VectorCopy (color, dl->flashcolor); - // dl->flashcolor[0] = 1; - // dl->flashcolor[1] = 1; - // dl->flashcolor[2] = 1; dl->flashcolor[3] = 0.1f; - // dl->color[0] = 1f; - // dl->color[1] = 1f; - // dl->color[2] = 1f; dl->unmark = 1; // important dl->radius = radius; - - - - //dl->radius = radius; dl->die = cl.time + 0xFFFFFF; - // dl->decay = 0; - - // R_FlareTest(org, 12, 23, 33, 255, 0, NULL); } +} -}; // Yoinked directly from FTEQW by Spike. We need to parse this just for coronas // only......or maybe...............point...................lightsbutthatsforanotherday @@ -266,7 +248,6 @@ void R_LoadRTLights(void) int style; vec3_t org; float radius; - char carbmarpnarm; float corona; vec3_t rgb; @@ -312,8 +293,8 @@ void R_LoadRTLights(void) // We got a corona, so let's make it happen. if (corona){ #ifdef DEBUG - Con_Printf("we got a %f %f %f %f %f %f %f %i %i %f in here\n", - org[0], org[1], org[2], radius, rgb[0], rgb[1], rgb[2], style, style, corona); + Con_Printf("[Corona] Placed at %f %f %f, RGB: %i,%i,%i\n", + org[0], org[1], org[2], (int)(rgb[0]*255), (int)(rgb[1]*255), (int)(rgb[2]*255)); #endif R_FlareTest(org,11,(int)(rgb[0] * 255),(int)(rgb[1] * 255),(int)(rgb[2] * 255),0,NULL); } @@ -332,14 +313,12 @@ extern cvar_t *temp2; void Mod_LoadTextures (lump_t *l) { - int i, j, pixels, num, max, altmax, ao; + int i, j, pixels, num, max, altmax; miptex_t *mt; texture_t *tx, *tx2; - int pb; texture_t *anims[10]; texture_t *altanims[10]; dmiptexlump_t *m; - qboolean alphaed; if (!l->filelen) { @@ -596,18 +575,14 @@ void Mod_LoadTextures (lump_t *l) // For the truecolor renderer only void Mod_LoadTextures32 (lump_t *l) { - int i, j, pixels, num, max, altmax, ao; + int i, j, pixels, num, max, altmax; miptex_t *mt; texture_t *tx, *tx2; texture_t *anims[10]; texture_t *altanims[10]; - int pb; dmiptexlump_t *m; - - pb = 4; - if (!l->filelen) { loadmodel->textures = NULL; @@ -669,10 +644,10 @@ void Mod_LoadTextures32 (lump_t *l) // Reading as 24bit strictly for 15bit dither mode - pixels = (mt->width*pb*mt->height)*85/64; + pixels = (mt->width*4*mt->height)*85/64; tx = Hunk_AllocName (sizeof(texture_t) +pixels, loadname ); - tx->pixbytes = pb; + tx->pixbytes = 4; loadmodel->textures[i] = tx; memcpy (tx->name, mt->name, sizeof(tx->name)); @@ -690,12 +665,9 @@ void Mod_LoadTextures32 (lump_t *l) } // NON HALFLIFE (Quake) Textures - else{ - { - // TODO: Upconvert Quake to 32-bit (should be easy, but i'm not debugging that right now) - int pb = 4; - - pixels = (mt->width*pb*mt->height)*85/64; + else + { + pixels = (mt->width*4*mt->height)*85/64; tx = Hunk_AllocName (sizeof(texture_t) +pixels, loadname ); tx->pixbytes = 4; @@ -707,14 +679,8 @@ void Mod_LoadTextures32 (lump_t *l) for (j=0 ; joffsets[j] = (mt->offsets[j]-sizeof(miptex_t))*4 + sizeof(texture_t); // the pixels immediately follow the structures - memcpy ( tx+1, W_ConvertWAD3TextureFTEQ(mt, &mt->width,&mt->height), pixels); + memcpy ( tx+1, W_ConvertWAD3TextureFTEQ(mt, &mt->width,&mt->height), pixels); } - - - - - - } if (!strncmp(mt->name,"sky",3)) R_InitSky (tx); } @@ -828,10 +794,10 @@ void Mod_LoadLighting (lump_t *l) { - int i, poo; - byte *in, *out, *data; + int i; + byte *data; byte d; - char litname[1024]; + char litname[MAX_QPATH]; loadedfile_t *fileinfo; // 2001-09-12 Returning information about loaded file by Maddes loadmodel->lightdata = NULL; @@ -847,6 +813,7 @@ void Mod_LoadLighting (lump_t *l) COM_StripExtension(loadmodel->name, litname); COM_DefaultExtension(litname, ".lit"); fileinfo = COM_LoadHunkFile(litname); + if (fileinfo) { Con_DPrintf("%s loaded from %s\n", litname, fileinfo->path->pack ? fileinfo->path->pack->filename : fileinfo->path->filename); @@ -1249,19 +1216,13 @@ void Mod_AvgPixel (model_t *mod, int skinnum, int count, byte *skin) int i; int vis; int pix; - int bestcolor; - int fullbright; - if (coloredlights){ -// mod->avgcol[0+skinnum] = 1; -// mod->avgcol[1+skinnum] = 1; -// mod->avgcol[2+skinnum] = 1; - return; - } - + if (coloredlights) + return; + vis = 0; r = g = b = 0; - fullbright = 0; + for (i=0 ; iversion); - if (version != 32) + if (version != 32) // for later if (version != SPRITE_VERSION) Sys_Error ("%s has wrong version number" "(%i should be %i)", mod->name, version, SPRITE_VERSION); - if (version == 32) - spr32 = 1; // yep it's a sprite32. - numframes = LittleLong (pin->numframes); size = sizeof (msprite_t) + (numframes - 1) * sizeof (psprite->frames);