diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index b36ab8450..2592633dd 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -3070,7 +3070,7 @@ void CL_SetSolidEntities (void) { state = &pak->entities[i]; - if (state->modelindex<0) + if (state->modelindex <= 0) continue; if (!cl.model_precache[state->modelindex]) continue; diff --git a/engine/client/cl_plugin.inc b/engine/client/cl_plugin.inc index 472f99641..4ee15fb96 100644 --- a/engine/client/cl_plugin.inc +++ b/engine/client/cl_plugin.inc @@ -67,10 +67,10 @@ int VARGS Plug_Media_ShowFrameRGBA_32(void *offset, unsigned int mask, const lon void *src = VM_POINTER(arg[0]); int srcwidth = VM_LONG(arg[1]); int srcheight = VM_LONG(arg[2]); - int x = VM_LONG(arg[3]); - int y = VM_LONG(arg[4]); - int width = VM_LONG(arg[5]); - int height = VM_LONG(arg[6]); +// int x = VM_LONG(arg[3]); +// int y = VM_LONG(arg[4]); +// int width = VM_LONG(arg[5]); +// int height = VM_LONG(arg[6]); if (qrenderer <= 0) return 0; diff --git a/engine/client/m_items.c b/engine/client/m_items.c index c0f6001d1..34fd50b3b 100644 --- a/engine/client/m_items.c +++ b/engine/client/m_items.c @@ -126,7 +126,8 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu) { if (menu->selecteditem != option) { - S_LocalSound ("misc/menu1.wav"); + if (!option->common.noselectionsound) + S_LocalSound ("misc/menu1.wav"); menu->selecteditem = option; } if (menu->cursoritem) diff --git a/engine/client/menu.h b/engine/client/menu.h index 24e8b5dee..df86bbb75 100644 --- a/engine/client/menu.h +++ b/engine/client/menu.h @@ -124,7 +124,8 @@ typedef struct { //must be first of each structure type. int posy; int width; int height; - qboolean iszone; + qboolean noselectionsound:1; + qboolean iszone:1; qboolean ishidden; union menuoption_s *next; } menucommon_t; diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 1df08a969..d167e8625 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -1076,7 +1076,7 @@ static void PF_R_SetViewFlag(progfuncs_t *prinst, struct globalvars_s *pr_global break; case VF_DRAWWORLD: - r_refdef.flags = r_refdef.flags&~Q2RDF_NOWORLDMODEL | (*p?0:Q2RDF_NOWORLDMODEL); + r_refdef.flags = (r_refdef.flags&~Q2RDF_NOWORLDMODEL) | (*p?0:Q2RDF_NOWORLDMODEL); break; case VF_ENGINESBAR: csqc_drawsbar = *p; @@ -1299,7 +1299,7 @@ static trace_t CS_Trace_Toss (csqcedict_t *tossent, csqcedict_t *ignore) float gravity; vec3_t move, end; trace_t trace; - float maxvel = Cvar_Get("sv_maxvelocity", "2000", 0, "CSQC physics")->value; +// float maxvel = Cvar_Get("sv_maxvelocity", "2000", 0, "CSQC physics")->value; vec3_t origin, velocity; @@ -1898,7 +1898,7 @@ static void PF_cs_getplayerkey (progfuncs_t *prinst, struct globalvars_s *pr_glo else if (!strcmp(keyname, "entertime")) //packet loss { ret = PF_TempStr(prinst); - sprintf(ret, "%i", cl.players[pnum].entertime); + sprintf(ret, "%i", (int)cl.players[pnum].entertime); } else { diff --git a/engine/client/snd_linux.c b/engine/client/snd_linux.c index bb106936a..4a15f27aa 100644 --- a/engine/client/snd_linux.c +++ b/engine/client/snd_linux.c @@ -12,11 +12,11 @@ static int tryrates[] = { 11025, 22051, 44100, 8000 }; -static void OSS_SetUnderWater(qboolean underwater) //simply a stub. Any ideas how to actually implement this properly? +static void OSS_SetUnderWater(soundcardinfo_t *sc, qboolean underwater) //simply a stub. Any ideas how to actually implement this properly? { } -static int OSS_GetDMAPos(soundcardinfo_t *sc) +static unsigned int OSS_GetDMAPos(soundcardinfo_t *sc) { struct count_info count; @@ -69,8 +69,6 @@ static int OSS_InitCard(soundcardinfo_t *sc, int cardnum) char *snddev = NULL; cvar_t *devname; - soundcardinfo_t *ec; - devname = Cvar_Get(va("snd_devicename%i", cardnum+1), cardnum?"":"/dev/dsp", 0, "Sound controls"); snddev = devname->string; diff --git a/engine/client/zqtp.c b/engine/client/zqtp.c index 058367d03..c20afa0ad 100644 --- a/engine/client/zqtp.c +++ b/engine/client/zqtp.c @@ -1988,7 +1988,7 @@ int TP_CategorizeMessage (char *s, int *offset, player_info_t **plr) if (!flags) // search for fake player { - if (name = strstr(s, ": ")) // use name as temp + if ((name = strstr(s, ": "))) // use name as temp { *offset = (name - s) + 2; flags = TPM_FAKED; @@ -2775,7 +2775,7 @@ static void TP_FindPoint (void) { continue; if ( - state->modelindex == cl_playerindex && ISDEAD(state->frame) || + (state->modelindex == cl_playerindex && ISDEAD(state->frame)) || state->modelindex == cl_h_playerindex ) continue; diff --git a/engine/common/common.c b/engine/common/common.c index 04b1b24e4..f99e5079a 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -1145,7 +1145,7 @@ char *MSG_ReadStringLine (void) float MSG_ReadCoord (void) { - coorddata c = {0}; + coorddata c = {{0}}; MSG_ReadData(&c, sizeofcoord); return MSG_FromCoord(c, sizeofcoord); } diff --git a/engine/common/fs.c b/engine/common/fs.c index 50dadd2e3..925c6109f 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -269,7 +269,7 @@ vfsfile_t *VFSOS_Open(char *osname, char *mode) vfsfile_t *FSOS_OpenVFS(void *handle, flocation_t *loc, char *mode) { char diskname[MAX_OSPATH]; - _snprintf(diskname, sizeof(diskname), "%s/%s", handle, loc->rawname); + _snprintf(diskname, sizeof(diskname), "%s/%s", (char*)handle, loc->rawname); return VFSOS_Open(diskname, mode); } @@ -359,13 +359,18 @@ void FSOS_ReadFile(void *handle, flocation_t *loc, char *buffer) fread(buffer, 1, loc->len, f); fclose(f); } +int FSOS_EnumerateFiles (void *handle, char *match, int (*func)(char *, int, void *), void *parm) +{ + return Sys_EnumerateFiles(handle, match, func, parm); +} + searchpathfuncs_t osfilefuncs = { FSOS_PrintPath, FSOS_ClosePath, FSOS_BuildHash, FSOS_FLocate, FSOS_ReadFile, - Sys_EnumerateFiles, + FSOS_EnumerateFiles, NULL, NULL, FSOS_OpenVFS @@ -620,10 +625,10 @@ vfsfile_t *FSPAK_OpenVFS(void *handle, flocation_t *loc, char *mode) if (strcmp(mode, "rb")) return NULL; //urm, unable to write/append - + vfs = Z_Malloc(sizeof(vfspack_t)); - vfs->parentpak = ((pack_t*)handle); + vfs->parentpak = pack; vfs->parentpak->references++; vfs->startpos = loc->offset; @@ -657,7 +662,9 @@ searchpathfuncs_t packfilefuncs = { void *com_pathforfile; //fread and stuff is preferable if null +#ifndef ZEXPORT #define ZEXPORT VARGS +#endif #ifdef AVAIL_ZLIB #ifdef _WIN32 @@ -1486,7 +1493,7 @@ out: } else Con_Printf("Failed\n"); -*/ +*/ if (returntype == FSLFRT_IFFOUND) return len != -1; else if (returntype == FSLFRT_LENGTH) @@ -1599,7 +1606,7 @@ qboolean Sys_PathProtection(char *pattern) if (strchr(pattern, '\\')) { char *s; - while(s = strchr(pattern, '\\')) + while((s = strchr(pattern, '\\'))) *s = '/'; Con_Printf("Warning: \\ charactures in filename %s\n", pattern); } diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index 256b5afa7..6de938653 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -45,7 +45,7 @@ void SWMod_LoadLighting (lump_t *l); void Q2BSP_SetHullFuncs(hull_t *hull); qboolean CM_Trace(model_t *model, int forcehullnum, int frame, vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, trace_t *trace); -int Q2BSP_PointContents(model_t *mod, vec3_t p); +unsigned int Q2BSP_PointContents(model_t *mod, vec3_t p); qbyte areabits[MAX_Q2MAP_AREAS/8]; @@ -77,7 +77,7 @@ void CalcSurfaceExtents (msurface_t *s) maxs[0] = maxs[1] = -99999; tex = s->texinfo; - + for (i=0 ; inumedges ; i++) { e = loadmodel->surfedges[s->firstedge+i]; @@ -85,10 +85,10 @@ void CalcSurfaceExtents (msurface_t *s) v = &loadmodel->vertexes[loadmodel->edges[e].v[0]]; else v = &loadmodel->vertexes[loadmodel->edges[-e].v[1]]; - + for (j=0 ; j<2 ; j++) { - val = v->position[0] * tex->vecs[j][0] + + val = v->position[0] * tex->vecs[j][0] + v->position[1] * tex->vecs[j][1] + v->position[2] * tex->vecs[j][2] + tex->vecs[j][3]; @@ -100,7 +100,7 @@ void CalcSurfaceExtents (msurface_t *s) } for (i=0 ; i<2 ; i++) - { + { bmins[i] = floor(mins[i]/16); bmaxs[i] = ceil(maxs[i]/16); @@ -371,15 +371,15 @@ int numleaffaces; int PlaneTypeForNormal ( vec3_t normal ) { vec_t ax, ay, az; - -// NOTE: should these have an epsilon around 1.0? + +// NOTE: should these have an epsilon around 1.0? if ( normal[0] >= 1.0) return PLANE_X; if ( normal[1] >= 1.0 ) return PLANE_Y; if ( normal[2] >= 1.0 ) return PLANE_Z; - + ax = fabs( normal[0] ); ay = fabs( normal[1] ); az = fabs( normal[2] ); @@ -428,7 +428,7 @@ qboolean BoundsIntersect (vec3_t mins1, vec3_t maxs1, vec3_t mins2, vec3_t maxs2 #define VectorAvg(a,b,c) ((c)[0]=((a)[0]+(b)[0])*0.5f,(c)[1]=((a)[1]+(b)[1])*0.5f, (c)[2]=((a)[2]+(b)[2])*0.5f) #define Vector4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3]) #define Vector4Scale(in,scale,out) ((out)[0]=(in)[0]*scale,(out)[1]=(in)[1]*scale,(out)[2]=(in)[2]*scale,(out)[3]=(in)[3]*scale) -#define Vector4Add(a,b,c) ((c)[0]=(((a[0])+(b[0]))),(c)[1]=(((a[1])+(b[1]))),(c)[2]=(((a[2])+(b[2]))),(c)[3]=(((a[3])+(b[3])))) +#define Vector4Add(a,b,c) ((c)[0]=(((a[0])+(b[0]))),(c)[1]=(((a[1])+(b[1]))),(c)[2]=(((a[2])+(b[2]))),(c)[3]=(((a[3])+(b[3])))) /* =============== @@ -544,7 +544,7 @@ void Patch_Evaluate ( const vec4_t *p, const int *numcp, const int *tess, vec4_t for ( v = 0; v < num_patches[1]; v++ ) { - // last patch has one more row + // last patch has one more row if ( v < num_patches[1] - 1 ) { num_tess[1] = tess[1]; } else { @@ -565,13 +565,13 @@ void Patch_Evaluate ( const vec4_t *p, const int *numcp, const int *tess, vec4_t index[2] = index[1] + numcp[0]; // current 3x3 patch control points - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; i++ ) { Vector4Copy ( p[index[0]+i], pv[i][0] ); Vector4Copy ( p[index[1]+i], pv[i][1] ); Vector4Copy ( p[index[2]+i], pv[i][2] ); } - + t = 0.0f; tvec = dest + v * tess[1] * dstpitch + u * tess[0]; @@ -762,7 +762,8 @@ void CM_CreatePatch ( q3cpatch_t *patch, int numverts, const vec3_t *verts, int for (i = 0; i < numverts; i++) VectorCopy(verts[i], pointss[i]); // fill in - Patch_Evaluate ( pointss, patch_cp, step, points ); +//gcc warns without this cast + Patch_Evaluate ( (const vec4_t *)pointss, patch_cp, step, points ); /* for (i = 0; i < numverts; i++) { @@ -879,7 +880,8 @@ void CM_CreatePatchesForLeafs (void) map_leafpatches[numleafpatches] = numpatches; checkout[k] = numpatches++; - CM_CreatePatch ( patch, face->numverts, map_verts + face->firstvert, face->patch_cp ); +//gcc warns without this cast + CM_CreatePatch ( patch, face->numverts, (const vec3_t *)map_verts + face->firstvert, face->patch_cp ); } leaf->contents |= patch->surface->c.value; @@ -1070,15 +1072,15 @@ void *Mod_LoadWall(char *name) in = (qbyte *)tex+tex->offsets[0]; //shrink mips. for (j = 0; j < tex->height; j+=2) //we could convert mip[1], but shrinking is probably faster. - for (i = 0; i < tex->width; i+=2) + for (i = 0; i < tex->width; i+=2) *out++ = in[i + tex->width*j]; for (j = 0; j < tex->height; j+=4) - for (i = 0; i < tex->width; i+=4) + for (i = 0; i < tex->width; i+=4) *out++ = in[i + tex->width*j]; for (j = 0; j < tex->height; j+=8) - for (i = 0; i < tex->width; i+=8) + for (i = 0; i < tex->width; i+=8) *out++ = in[i + tex->width*j]; } } @@ -1157,15 +1159,15 @@ void *Mod_LoadWall(char *name) in = (qbyte *)tex+tex->offsets[0]; //shrink mips. for (j = 0; j < tex->height; j+=2) //we could convert mip[1], but shrinking is probably faster. - for (i = 0; i < tex->width; i+=2) + for (i = 0; i < tex->width; i+=2) *out++ = in[i + tex->width*j]; for (j = 0; j < tex->height; j+=4) - for (i = 0; i < tex->width; i+=4) + for (i = 0; i < tex->width; i+=4) *out++ = in[i + tex->width*j]; for (j = 0; j < tex->height; j+=8) - for (i = 0; i < tex->width; i+=8) + for (i = 0; i < tex->width; i+=8) *out++ = in[i + tex->width*j]; } } @@ -1196,7 +1198,7 @@ void CMod_LoadTexInfo (lump_t *l) //yes I know these load from the same place Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); out = Hunk_AllocName ( count*sizeof(*out), loadname); - + loadmodel->textures = Hunk_AllocName(sizeof(texture_t *)*count, loadname); texcount = 0; @@ -1300,7 +1302,7 @@ void CalcSurfaceExtents (msurface_t *s) maxs[0] = maxs[1] = -99999; tex = s->texinfo; - + for (i=0 ; inumedges ; i++) { e = loadmodel->surfedges[s->firstedge+i]; @@ -1308,10 +1310,10 @@ void CalcSurfaceExtents (msurface_t *s) v = &loadmodel->vertexes[loadmodel->edges[e].v[0]]; else v = &loadmodel->vertexes[loadmodel->edges[-e].v[1]]; - + for (j=0 ; j<2 ; j++) { - val = v->position[0] * tex->vecs[j][0] + + val = v->position[0] * tex->vecs[j][0] + v->position[1] * tex->vecs[j][1] + v->position[2] * tex->vecs[j][2] + tex->vecs[j][3]; @@ -1323,7 +1325,7 @@ void CalcSurfaceExtents (msurface_t *s) } for (i=0 ; i<2 ; i++) - { + { bmins[i] = floor(mins[i]/16); bmaxs[i] = ceil(maxs[i]/16); @@ -1362,13 +1364,13 @@ void CMod_LoadFaces (lump_t *l) for ( surfnum=0 ; surfnumfirstedge = LittleLong(in->firstedge); - out->numedges = LittleShort(in->numedges); + out->numedges = LittleShort(in->numedges); out->flags = 0; planenum = LittleShort(in->planenum); side = LittleShort(in->side); if (side) - out->flags |= SURF_PLANEBACK; + out->flags |= SURF_PLANEBACK; out->plane = loadmodel->planes + planenum; @@ -1389,7 +1391,7 @@ void CMod_LoadFaces (lump_t *l) #endif CalcSurfaceExtents (out); - + // lighting info for (i=0 ; isamples = loadmodel->lightdata + i/3; - + // set the drawing flags - + if (out->texinfo->flags & SURF_WARP) { out->flags |= SURF_DRAWTURB; @@ -1419,7 +1421,7 @@ void CMod_LoadFaces (lump_t *l) out->texturemins[i] = -8192; } } - + } } #endif @@ -1445,7 +1447,7 @@ void CMod_LoadNodes (lump_t *l) int child; mnode_t *out; int i, j, count; - + in = (void *)(cmod_base + l->fileofs); if (l->filelen % sizeof(*in)) Host_Error ("MOD_LoadBmodel: funny lump size"); @@ -1502,7 +1504,7 @@ void CMod_LoadBrushes (lump_t *l) q2dbrush_t *in; q2cbrush_t *out; int i, count; - + in = (void *)(cmod_base + l->fileofs); if (l->filelen % sizeof(*in)) Host_Error ("MOD_LoadBmodel: funny lump size"); @@ -1535,7 +1537,7 @@ void CMod_LoadLeafs (lump_t *l) mleaf_t *out; q2dleaf_t *in; int count; - + in = (void *)(cmod_base + l->fileofs); if (l->filelen % sizeof(*in)) Host_Error ("MOD_LoadBmodel: funny lump size"); @@ -1547,7 +1549,7 @@ void CMod_LoadLeafs (lump_t *l) if (count > MAX_Q2MAP_PLANES) Host_Error ("Map has too many planes"); - out = map_leafs; + out = map_leafs; numleafs = count; numclusters = 0; @@ -1557,7 +1559,7 @@ void CMod_LoadLeafs (lump_t *l) for ( i=0 ; iminmaxs[j] = LittleShort (in->mins[j]); @@ -1606,7 +1608,7 @@ void CMod_LoadPlanes (lump_t *l) dplane_t *in; int count; int bits; - + in = (void *)(cmod_base + l->fileofs); if (l->filelen % sizeof(*in)) Host_Error ("MOD_LoadBmodel: funny lump size"); @@ -1618,7 +1620,7 @@ void CMod_LoadPlanes (lump_t *l) if (count >= MAX_Q2MAP_PLANES) Host_Error ("Map has too many planes"); - out = map_planes; + out = map_planes; numplanes = count; @@ -1652,7 +1654,7 @@ void CMod_LoadLeafBrushes (lump_t *l) int *out; unsigned short *in; int count; - + in = (void *)(cmod_base + l->fileofs); if (l->filelen % sizeof(*in)) Host_Error ("MOD_LoadBmodel: funny lump size"); @@ -1693,7 +1695,7 @@ void CMod_LoadBrushSides (lump_t *l) if (count > MAX_Q2MAP_BRUSHSIDES) Host_Error ("Map has too many planes"); - out = map_brushsides; + out = map_brushsides; numbrushsides = count; for ( i=0 ; ifileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->marksurfaces = out; loadmodel->nummarksurfaces = count; @@ -2053,10 +2055,10 @@ void CModRBSP_LoadVertexes (lump_t *l) void CModQ3_LoadIndexes (lump_t *l) -{ +{ int i, count; int *in, *out; - + in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); @@ -2065,7 +2067,7 @@ void CModQ3_LoadIndexes (lump_t *l) Host_Error ("MOD_LoadBmodel: bad surfedges count in %s: %i", loadmodel->name, count); - out = Hunk_AllocName ( count*sizeof(*out), loadmodel->name ); + out = Hunk_AllocName ( count*sizeof(*out), loadmodel->name ); map_surfindexes = out; map_numsurfindexes = count; @@ -2240,7 +2242,7 @@ glpoly_t *GL_MeshToGLPoly(mesh_t *mesh) int numindx; if (!mesh) return NULL; - + numindx = mesh->numindexes; ret = NULL; @@ -2314,7 +2316,7 @@ mesh_t *GL_CreateMeshForPatch (model_t *mod, int patchwidth, int patchheight, in } // find the degree of subdivision in the u and v directions - Patch_GetFlatness ( subdivlevel, map_verts+firstvert, patch_cp, flat ); + Patch_GetFlatness ( subdivlevel, (const vec3_t *)map_verts+firstvert, patch_cp, flat ); // allocate space for mesh step[0] = (1 << flat[0]); @@ -2340,11 +2342,11 @@ mesh_t *GL_CreateMeshForPatch (model_t *mod, int patchwidth, int patchheight, in mesh->patchHeight = size[1]; // fill in - Patch_Evaluate ( points, patch_cp, step, points2 ); - Patch_Evaluate ( colors, patch_cp, step, colors2 ); - Patch_Evaluate ( normals, patch_cp, step, normals2 ); - Patch_Evaluate ( lm_st, patch_cp, step, lm_st2 ); - Patch_Evaluate ( tex_st, patch_cp, step, tex_st2 ); + Patch_Evaluate ( (const vec4_t *)points, patch_cp, step, points2 ); + Patch_Evaluate ( (const vec4_t *)colors, patch_cp, step, colors2 ); + Patch_Evaluate ( (const vec4_t *)normals, patch_cp, step, normals2 ); + Patch_Evaluate ( (const vec4_t *)lm_st, patch_cp, step, lm_st2 ); + Patch_Evaluate ( (const vec4_t *)tex_st, patch_cp, step, tex_st2 ); for (i = 0; i < numverts; i++) { @@ -2367,8 +2369,8 @@ mesh_t *GL_CreateMeshForPatch (model_t *mod, int patchwidth, int patchheight, in indexes[1] = p + size[0]; indexes[2] = p + 1; - if ( !VectorCompare(mesh->xyz_array[indexes[0]], mesh->xyz_array[indexes[1]]) && - !VectorCompare(mesh->xyz_array[indexes[0]], mesh->xyz_array[indexes[2]]) && + if ( !VectorCompare(mesh->xyz_array[indexes[0]], mesh->xyz_array[indexes[1]]) && + !VectorCompare(mesh->xyz_array[indexes[0]], mesh->xyz_array[indexes[2]]) && !VectorCompare(mesh->xyz_array[indexes[1]], mesh->xyz_array[indexes[2]]) ) { indexes += 3; numindexes += 3; @@ -2378,8 +2380,8 @@ mesh_t *GL_CreateMeshForPatch (model_t *mod, int patchwidth, int patchheight, in indexes[1] = p + size[0]; indexes[2] = p + size[0] + 1; - if ( !VectorCompare(mesh->xyz_array[indexes[0]], mesh->xyz_array[indexes[1]]) && - !VectorCompare(mesh->xyz_array[indexes[0]], mesh->xyz_array[indexes[2]]) && + if ( !VectorCompare(mesh->xyz_array[indexes[0]], mesh->xyz_array[indexes[1]]) && + !VectorCompare(mesh->xyz_array[indexes[0]], mesh->xyz_array[indexes[2]]) && !VectorCompare(mesh->xyz_array[indexes[1]], mesh->xyz_array[indexes[2]]) ) { indexes += 3; numindexes += 3; @@ -2446,13 +2448,13 @@ void CModQ3_LoadRFaces (lump_t *l, qboolean useshaders) int numverts, numindexes; int fv; - mesh_t *mesh; + mesh_t *mesh; in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadmodel->name ); + out = Hunk_AllocName ( count*sizeof(*out), loadmodel->name ); pl = Hunk_AllocName (count*sizeof(*pl), loadmodel->name);//create a new array of planes for speed. loadmodel->surfaces = out; @@ -2591,13 +2593,13 @@ void CModRBSP_LoadRFaces (lump_t *l, qboolean useshaders) int fv; mesh_t *mesh; - + in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadmodel->name ); + out = Hunk_AllocName ( count*sizeof(*out), loadmodel->name ); pl = Hunk_AllocName (count*sizeof(*pl), loadmodel->name);//create a new array of planes for speed. loadmodel->surfaces = out; @@ -2714,18 +2716,18 @@ continue; #endif void CModQ3_LoadLeafFaces (lump_t *l) -{ +{ int i, j, count; int *in; int *out; - + in = (void *)(cmod_base + l->fileofs); if (l->filelen % sizeof(*in)) Host_Error ("MOD_LoadBmodel: funny lump size"); count = l->filelen / sizeof(*in); - if (count > MAX_Q2MAP_LEAFFACES) - Host_Error ("Map has too many leaffaces"); + if (count > MAX_Q2MAP_LEAFFACES) + Host_Error ("Map has too many leaffaces"); out = BZ_Malloc ( count*sizeof(*out) ); map_leaffaces = out; @@ -2753,7 +2755,7 @@ void CModQ3_LoadNodes (lump_t *l) if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); if (count > MAX_MAP_NODES) Host_Error("Too many nodes on map"); @@ -2768,7 +2770,7 @@ void CModQ3_LoadNodes (lump_t *l) out->minmaxs[j] = LittleLong (in->mins[j]); out->minmaxs[3+j] = LittleLong (in->maxs[j]); } - + p = LittleLong(in->plane); out->plane = loadmodel->planes + p; @@ -2799,7 +2801,7 @@ void CModQ3_LoadBrushes (lump_t *l) q2cbrush_t *out; int i, count; int shaderref; - + in = (void *)(cmod_base + l->fileofs); if (l->filelen % sizeof(*in)) Host_Error ("MOD_LoadBmodel: funny lump size"); @@ -2828,7 +2830,7 @@ void CModQ3_LoadLeafs (lump_t *l) q3dleaf_t *in; int count; q2cbrush_t *brush; - + in = (void *)(cmod_base + l->fileofs); if (l->filelen % sizeof(*in)) Host_Error ("MOD_LoadBmodel: funny lump size"); @@ -2841,7 +2843,7 @@ void CModQ3_LoadLeafs (lump_t *l) if (count > MAX_MAP_LEAFS) Host_Error("Too many leaves on map"); - out = map_leafs; + out = map_leafs; numleafs = count; numclusters = 0; @@ -2907,23 +2909,23 @@ void CModQ3_LoadLeafs (lump_t *l) } void CModQ3_LoadPlanes (lump_t *l) -{ +{ int i, j; mplane_t *out; Q3PLANE_t *in; int count; - + in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = map_planes;//Hunk_AllocName ( count*2*sizeof(*out), loadname); + out = map_planes;//Hunk_AllocName ( count*2*sizeof(*out), loadname); if (count > MAX_MAP_PLANES) Host_Error("Too many planes on map"); numplanes = count; - + loadmodel->planes = out; loadmodel->numplanes = count; @@ -2945,7 +2947,7 @@ void CModQ3_LoadLeafBrushes (lump_t *l) int *out; int *in; int count; - + in = (void *)(cmod_base + l->fileofs); if (l->filelen % sizeof(*in)) Host_Error ("MOD_LoadBmodel: funny lump size"); @@ -2981,7 +2983,7 @@ void CModQ3_LoadBrushSides (lump_t *l) if (count > MAX_Q2MAP_BRUSHSIDES) Host_Error ("Map has too many planes"); - out = map_brushsides; + out = map_brushsides; numbrushsides = count; for ( i=0 ; i MAX_Q2MAP_BRUSHSIDES) Host_Error ("Map has too many planes"); - out = map_brushsides; + out = map_brushsides; numbrushsides = count; for ( i=0 ; ifileofs); if (l->filelen % sizeof(*in)) Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - grid = Hunk_AllocName (sizeof(q3lightgridinfo_t) + count*sizeof(*out), loadmodel->name ); + grid = Hunk_AllocName (sizeof(q3lightgridinfo_t) + count*sizeof(*out), loadmodel->name ); grid->lightgrid = (dq3gridlight_t*)(grid+1); out = grid->lightgrid; @@ -3099,7 +3101,7 @@ void CModRBSP_LoadLightgrid (lump_t *elements, lump_t *indexes) icount = indexes->filelen / sizeof(*iin); ecount = elements->filelen / sizeof(*ein); - grid = Hunk_AllocName (sizeof(q3lightgridinfo_t) + ecount*sizeof(*eout) + icount*sizeof(*iout), loadmodel->name ); + grid = Hunk_AllocName (sizeof(q3lightgridinfo_t) + ecount*sizeof(*eout) + icount*sizeof(*iout), loadmodel->name ); grid->rbspelements = (rbspgridlight_t*)((char *)grid); grid->rbspindexes = (unsigned short*)((char *)grid + ecount*sizeof(*eout)); eout = grid->rbspelements; @@ -3301,12 +3303,12 @@ void Q2BSP_MarkLights (dlight_t *light, int bit, mnode_t *node) float dist; msurface_t *surf; int i; - + if (node->contents != -1) { mleaf_t *leaf = (mleaf_t *)node; msurface_t **mark; - + i = leaf->nummarksurfaces; mark = leaf->firstmarksurface; while(i--!=0) @@ -3324,7 +3326,7 @@ void Q2BSP_MarkLights (dlight_t *light, int bit, mnode_t *node) splitplane = node->plane; dist = DotProduct (light->origin, splitplane->normal) - splitplane->dist; - + if (dist > light->radius) { Q2BSP_MarkLights (light, bit, node->children[0]); @@ -3335,7 +3337,7 @@ void Q2BSP_MarkLights (dlight_t *light, int bit, mnode_t *node) Q2BSP_MarkLights (light, bit, node->children[1]); return; } - + // mark the polygons surf = cl.worldmodel->surfaces + node->firstsurface; for (i=0 ; inumsurfaces ; i++, surf++) @@ -3361,13 +3363,13 @@ void GLR_Q2BSP_StainNode (mnode_t *node, float *parms) float dist; msurface_t *surf; int i; - + if (node->contents != -1) - return; + return; splitplane = node->plane; dist = DotProduct ((parms+1), splitplane->normal) - splitplane->dist; - + if (dist > (*parms)) { GLR_Q2BSP_StainNode (node->children[0], parms); @@ -3400,13 +3402,13 @@ void SWR_Q2BSP_StainNode (mnode_t *node, float *parms) float dist; msurface_t *surf; int i; - + if (node->contents != -1) - return; + return; splitplane = node->plane; dist = DotProduct ((parms+1), splitplane->normal) - splitplane->dist; - + if (dist > (*parms)) { SWR_Q2BSP_StainNode (node->children[0], parms); @@ -3788,7 +3790,7 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned break; #endif default: - Sys_Error("Bad internal renderer on q2 map load\n"); + Sys_Error("Bad internal renderer on q2 map load\n"); } } @@ -3839,7 +3841,7 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned mod = loadmodel; bm = CM_InlineModel (name); - + mod->hulls[0].firstclipnode = bm->headnode; mod->hulls[j].available = true; @@ -3853,7 +3855,7 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned mod->hulls[j].available = false; Q2BSP_SetHullFuncs(&mod->hulls[j]); } - + VectorCopy (bm->maxs, mod->maxs); VectorCopy (bm->mins, mod->mins); #ifndef SERVERONLY @@ -4023,7 +4025,7 @@ void CM_InitBoxHull (void) p->signbits = 0; VectorClear (p->normal); p->normal[i>>1] = -1; - } + } } @@ -4073,7 +4075,7 @@ int CM_PointLeafnum_r (model_t *mod, vec3_t p, int num) { node = mod->nodes + num; plane = node->plane; - + if (plane->type < 3) d = p[plane->type] - plane->dist; else @@ -4126,7 +4128,7 @@ void CM_BoxLeafnums_r (model_t *mod, int nodenum) leaf_list[leaf_count++] = -1 - nodenum; return; } - + node = &mod->nodes[nodenum]; plane = node->plane; // s = BoxOnPlaneSide (leaf_mins, leaf_maxs, plane); @@ -4210,7 +4212,7 @@ int CM_PointContents (model_t *mod, vec3_t p) if ( (contents & brush->contents) == brush->contents ) { continue; } - + brushside = &map_brushsides[brush->firstbrushside]; for ( j = 0; j < brush->numsides; j++, brushside++ ) { @@ -4218,7 +4220,7 @@ int CM_PointContents (model_t *mod, vec3_t p) break; } - if (j == brush->numsides) + if (j == brush->numsides) contents |= brush->contents; } @@ -4243,7 +4245,7 @@ int CM_TransformedPointContents (model_t *mod, vec3_t p, int headnode, vec3_t or VectorSubtract (p, origin, p_l); // rotate start and end into the models frame of reference - if (headnode != box_headnode && + if (headnode != box_headnode && (angles[0] || angles[1] || angles[2]) ) { AngleVectors (angles, forward, right, up); @@ -4839,7 +4841,7 @@ return; frac = 0; if (frac > 1) frac = 1; - + midf = p1f + (p2f - p1f)*frac; for (i=0 ; i<3 ; i++) mid[i] = p1[i] + frac*(p2[i] - p1[i]); @@ -4852,7 +4854,7 @@ return; frac2 = 0; if (frac2 > 1) frac2 = 1; - + midf = p1f + (p2f - p1f)*frac2; for (i=0 ; i<3 ; i++) mid[i] = p1[i] + frac2*(p2[i] - p1[i]); @@ -5049,7 +5051,7 @@ trace_t CM_TransformedBoxTrace (model_t *mod, vec3_t start, vec3_t end, VectorSubtract (end, origin, end_l); // rotate start and end into the models frame of reference - if (mod != &box_model && + if (mod != &box_model && (angles[0] || angles[1] || angles[2]) ) rotated = true; else @@ -5127,7 +5129,7 @@ qbyte *Mod_Q2DecompressVis (qbyte *in, model_t *model) qbyte *out; int row; - row = (model->vis->numclusters+7)>>3; + row = (model->vis->numclusters+7)>>3; out = decompressed; if (!in) @@ -5137,7 +5139,7 @@ qbyte *Mod_Q2DecompressVis (qbyte *in, model_t *model) *out++ = 0xff; row--; } - return decompressed; + return decompressed; } do @@ -5147,7 +5149,7 @@ qbyte *Mod_Q2DecompressVis (qbyte *in, model_t *model) *out++ = *in++; continue; } - + c = in[1]; in += 2; while (c) @@ -5156,7 +5158,7 @@ qbyte *Mod_Q2DecompressVis (qbyte *in, model_t *model) c--; } } while (out - decompressed < row); - + return decompressed; } @@ -5176,7 +5178,7 @@ void CM_DecompressVis (qbyte *in, qbyte *out) qbyte *out_p; int row; - row = (numclusters+7)>>3; + row = (numclusters+7)>>3; out_p = out; if (!in || !numvisibility) @@ -5186,7 +5188,7 @@ void CM_DecompressVis (qbyte *in, qbyte *out) *out_p++ = 0xff; row--; } - return; + return; } do @@ -5196,7 +5198,7 @@ void CM_DecompressVis (qbyte *in, qbyte *out) *out_p++ = *in++; continue; } - + c = in[1]; in += 2; if ((out_p - out) + c > row) @@ -5514,7 +5516,7 @@ qboolean Q2BSP_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, return true; return false; }*/ -int Q2BSP_PointContents(model_t *mod, vec3_t p) +unsigned int Q2BSP_PointContents(model_t *mod, vec3_t p) { int pc, ret = FTECONTENTS_EMPTY; pc = CM_PointContents (mod, p); diff --git a/engine/common/log.c b/engine/common/log.c index 402b02595..7434bfca1 100644 --- a/engine/common/log.c +++ b/engine/common/log.c @@ -18,39 +18,39 @@ int COM_FileSize(char *path); extern char gamedirfile[]; // table of readable characters, same as ezquake -char readable[256] = +char readable[256] = { - '.', '_', '_', '_', '_', '.', '_', '_', - '_', '_', '\n', '_', '\n', '>', '.', '.', - '[', ']', '0', '1', '2', '3', '4', '5', - '6', '7', '8', '9', '.', '_', '_', '_', - ' ', '!', '\"', '#', '$', '%', '&', '\'', - '(', ')', '*', '+', ',', '-', '.', '/', - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', ':', ';', '<', '=', '>', '?', - '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', - 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', - 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', - 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', - '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', - 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', - 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', - 'x', 'y', 'z', '{', '|', '}', '~', '_', - '_', '_', '_', '_', '_', '.', '_', '_', - '_', '_', '_', '_', '_', '>', '.', '.', - '[', ']', '0', '1', '2', '3', '4', '5', - '6', '7', '8', '9', '.', '_', '_', '_', - ' ', '!', '\"', '#', '$', '%', '&', '\'', - '(', ')', '*', '+', ',', '-', '.', '/', - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', ':', ';', '<', '=', '>', '?', - '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', - 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', - 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', - 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', - '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', - 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', - 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + '.', '_', '_', '_', '_', '.', '_', '_', + '_', '_', '\n', '_', '\n', '>', '.', '.', + '[', ']', '0', '1', '2', '3', '4', '5', + '6', '7', '8', '9', '.', '_', '_', '_', + ' ', '!', '\"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '{', '|', '}', '~', '_', + '_', '_', '_', '_', '_', '.', '_', '_', + '_', '_', '_', '_', '_', '>', '.', '.', + '[', ']', '0', '1', '2', '3', '4', '5', + '6', '7', '8', '9', '.', '_', '_', '_', + ' ', '!', '\"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', '_' }; @@ -95,7 +95,7 @@ void Con_Log (char *s) d = gamedirfile; if (log_dir.string[0]) d = log_dir.string; - + f = "qconsole"; if (log_name.string[0]) f = log_name.string; @@ -159,7 +159,7 @@ void Con_Log (char *s) f = va("%s/%s.log",d,f); // temp string in va() // file rotation - if (log_rotate_size.value >= 4096 && log_rotate_files.value >= 1) + if (log_rotate_size.value >= 4096 && log_rotate_files.value >= 1) { int x; vfsfile_t *fi; @@ -180,7 +180,7 @@ void Con_Log (char *s) char oldf[MAX_OSPATH]; i = log_rotate_files.value; - + // unlink file at the top of the chain _snprintf(oldf, sizeof(oldf)-1, "%s.%i", f, i); FS_Remove(oldf, FS_BASE); @@ -248,4 +248,4 @@ void Log_Init(void) if (COM_CheckParm("-condebug")) Cvar_ForceSet(&log_enable, "1"); -} \ No newline at end of file +} diff --git a/engine/common/mathlib.c b/engine/common/mathlib.c index dc16acec3..d95909bdf 100644 --- a/engine/common/mathlib.c +++ b/engine/common/mathlib.c @@ -641,7 +641,7 @@ fixed16_t Invert24To16(fixed16_t val) -void VectorTransform (const vec3_t in1, const float in2[3][4], vec3_t out) +void VectorTransform (const vec3_t in1, matrix3x4 in2, vec3_t out) { out[0] = DotProduct(in1, in2[0]) + in2[0][3]; out[1] = DotProduct(in1, in2[1]) + in2[1][3]; diff --git a/engine/common/mathlib.h b/engine/common/mathlib.h index 976075749..1ea76f9dc 100644 --- a/engine/common/mathlib.h +++ b/engine/common/mathlib.h @@ -71,9 +71,13 @@ int Q_log2(int val); float ColorNormalize (vec3_t in, vec3_t out); void MakeNormalVectors (vec3_t forward, vec3_t right, vec3_t up); +typedef float matrix3x4[3][4]; +typedef float matrix3x3[3][3]; + void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]); void R_ConcatRotationsPad (float in1[3][4], float in2[3][4], float out[3][4]); -void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]); +void R_ConcatTransforms (matrix3x4 in1, matrix3x4 in2, matrix3x4 out); +void VectorTransform(const vec3_t in1, matrix3x4 in2, vec3_t out); void FloorDivMod (double numer, double denom, int *quotient, int *rem); diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index 530d614fc..66c00b25a 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -479,7 +479,7 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate) #ifdef HUFFNETWORK if (chan->compress) { - int oldsize = send.cursize; + //int oldsize = send.cursize; Huff_CompressPacket(&send, (chan->sock == NS_CLIENT)?10:8); // Con_Printf("%i becomes %i\n", oldsize, send.cursize); // Huff_DecompressPacket(&send, (chan->sock == NS_CLIENT)?10:8); diff --git a/engine/common/q1bsp.c b/engine/common/q1bsp.c index 92e233bda..63015d212 100644 --- a/engine/common/q1bsp.c +++ b/engine/common/q1bsp.c @@ -26,10 +26,10 @@ static int Q1_HullPointContents (hull_t *hull, int num, vec3_t p) { if (num < hull->firstclipnode || num > hull->lastclipnode) Sys_Error ("SV_HullPointContents: bad node number"); - + node = hull->clipnodes + num; plane = hull->planes + node->planenum; - + if (plane->type < 3) d = p[plane->type] - plane->dist; else @@ -39,7 +39,7 @@ static int Q1_HullPointContents (hull_t *hull, int num, vec3_t p) else num = node->children[0]; } - + return num; } #else @@ -95,7 +95,7 @@ qboolean Q1BSP_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, t1 = DotProduct (plane->normal, p1) - plane->dist; t2 = DotProduct (plane->normal, p2) - plane->dist; } - + #if 1 if (t1 >= 0 && t2 >= 0) return Q1BSP_RecursiveHullCheck (hull, node->children[0], p1f, p2f, p1, p2, trace); @@ -136,15 +136,15 @@ qboolean Q1BSP_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, return false; } #endif - + if (Q1_HullPointContents (hull, node->children[side^1], mid) != Q1CONTENTS_SOLID) // go past the node return Q1BSP_RecursiveHullCheck (hull, node->children[side^1], midf, p2f, mid, p2, trace); - + if (trace->allsolid) return false; // never got out of the solid area - + //================== // the other side of the node is solid, this is the impact point //================== @@ -208,7 +208,7 @@ void Q1BSP_SetHullFuncs(hull_t *hull) // hull->funcs.HullPointContents = Q1BSP_HullPointContents; } -int Q1BSP_PointContents(model_t *model, vec3_t point) +unsigned int Q1BSP_PointContents(model_t *model, vec3_t point) { return Q1BSP_HullPointContents(&model->hulls[0], point); } @@ -292,13 +292,13 @@ void Q1BSP_MarkLights (dlight_t *light, int bit, mnode_t *node) float dist; msurface_t *surf; int i; - + if (node->contents < 0) - return; + return; splitplane = node->plane; dist = DotProduct (light->origin, splitplane->normal) - splitplane->dist; - + if (dist > light->radius) { Q1BSP_MarkLights (light, bit, node->children[0]); @@ -309,7 +309,7 @@ void Q1BSP_MarkLights (dlight_t *light, int bit, mnode_t *node) Q1BSP_MarkLights (light, bit, node->children[1]); return; } - + // mark the polygons surf = currentmodel->surfaces + node->firstsurface; for (i=0 ; inumsurfaces ; i++, surf++) @@ -701,9 +701,9 @@ void Q1BSP_ClipDecalToNodes (fragmentdecal_t *dec, mnode_t *node) float dist; msurface_t *surf; int i; - + if (node->contents < 0) - return; + return; splitplane = node->plane; dist = DotProduct (dec->center, splitplane->normal) - splitplane->dist; @@ -875,7 +875,7 @@ void SV_Q1BSP_AddToFatPVS (model_t *mod, vec3_t org, mnode_t *node) } return; } - + plane = node->plane; d = DotProduct (org, plane->normal) - plane->dist; if (d > 8) @@ -916,7 +916,7 @@ qboolean Q1BSP_EdictInFatPVS(model_t *mod, edict_t *ent) for (i=0 ; i < ent->num_leafs ; i++) if (fatpvs[ent->leafnums[i] >> 3] & (1 << (ent->leafnums[i]&7) )) return true; //we might be able to see this one. - + return false; //none of this ents leafs were visible, so neither is the ent. } @@ -936,7 +936,7 @@ void Q1BSP_RFindTouchedLeafs (edict_t *ent, mnode_t *node) if (node->contents == Q1CONTENTS_SOLID) return; - + // add an efrag if the node is a leaf if ( node->contents < 0) @@ -951,19 +951,19 @@ void Q1BSP_RFindTouchedLeafs (edict_t *ent, mnode_t *node) leafnum = leaf - sv.worldmodel->leafs - 1; ent->leafnums[ent->num_leafs] = leafnum; - ent->num_leafs++; + ent->num_leafs++; return; } - + // NODE_MIXED splitplane = node->plane; sides = BOX_ON_PLANE_SIDE(ent->v->absmin, ent->v->absmax, splitplane); - + // recurse down the contacted sides if (sides & 1) Q1BSP_RFindTouchedLeafs (ent, node->children[0]); - + if (sides & 2) Q1BSP_RFindTouchedLeafs (ent, node->children[1]); } @@ -995,7 +995,7 @@ qbyte *Q1BSP_DecompressVis (qbyte *in, model_t *model, qbyte *decompressed) qbyte *out; int row; - row = (model->numleafs+7)>>3; + row = (model->numleafs+7)>>3; out = decompressed; #if 0 @@ -1008,7 +1008,7 @@ qbyte *Q1BSP_DecompressVis (qbyte *in, model_t *model, qbyte *decompressed) *out++ = 0xff; row--; } - return decompressed; + return decompressed; } do @@ -1018,7 +1018,7 @@ qbyte *Q1BSP_DecompressVis (qbyte *in, model_t *model, qbyte *decompressed) *out++ = *in++; continue; } - + c = in[1]; in += 2; while (c) @@ -1028,7 +1028,7 @@ qbyte *Q1BSP_DecompressVis (qbyte *in, model_t *model, qbyte *decompressed) } } while (out - decompressed < row); #endif - + return decompressed; } @@ -1059,9 +1059,9 @@ int Q1BSP_LeafnumForPoint (model_t *model, vec3_t p) mnode_t *node; float d; mplane_t *plane; - + if (!model) - { + { Sys_Error ("Mod_PointInLeaf: bad model"); } if (!model->nodes) @@ -1079,7 +1079,7 @@ int Q1BSP_LeafnumForPoint (model_t *model, vec3_t p) else node = node->children[1]; } - + return 0; // never reached } @@ -1121,4 +1121,4 @@ void Q1BSP_SetModelFuncs(model_t *mod) mod->funcs.LeafPVS = Q1BSP_LeafnumPVS; mod->funcs.Trace = Q1BSP_Trace; mod->funcs.PointContents = Q1BSP_PointContents; -} \ No newline at end of file +} diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index 261c909db..21d52e0e3 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -3119,7 +3119,6 @@ static void *Q1_LoadSkins (daliasskintype_t *pskintype, qboolean alpha) static void *Q1_LoadSkins (daliasskintype_t *pskintype, qboolean alpha) { extern cvar_t gl_bump; - extern int gl_bumpmappingpossible; galiastexnum_t *texnums; char skinname[MAX_QPATH]; int i; @@ -4264,8 +4263,8 @@ void GL_LoadQ3Model(model_t *mod, void *buffer) { #ifndef Q3SHADERS char name[1024]; -#endif extern int gl_bumpmappingpossible; +#endif char shadname[1024]; skin = Hunk_Alloc((LittleLong(surf->numShaders)+externalskins)*((sizeof(galiasskin_t)+sizeof(galiastexnum_t)))); @@ -5161,7 +5160,6 @@ galiasinfo_t *GLMod_ParseMD5MeshModel(char *buffer) int numjoints = 0; int nummeshes = 0; qboolean foundjoints = false; - int meshnum = 0; int i; galiasbone_t *bones = NULL; @@ -5499,11 +5497,6 @@ galiasinfo_t *GLMod_ParseMD5MeshModel(char *buffer) void GLMod_LoadMD5MeshModel(model_t *mod, void *buffer) { - int numjoints = 0; - int nummeshes = 0; - qboolean foundjoints = false; - int meshnum = 0; - galiasinfo_t *root; int hunkstart, hunkend, hunktotal; @@ -5757,10 +5750,6 @@ frames test/idle1.md5anim void GLMod_LoadCompositeAnim(model_t *mod, void *buffer) { #define EXPECT(x) buffer = COM_Parse(buffer); if (strcmp(com_token, x)) Sys_Error("MD5MESH: expected %s", x); - int numjoints = 0; - int nummeshes = 0; - qboolean foundjoints = false; - int meshnum = 0; int i; char *file; diff --git a/engine/gl/gl_bloom.c b/engine/gl/gl_bloom.c index 3d6b81390..180d24b7b 100644 --- a/engine/gl/gl_bloom.c +++ b/engine/gl/gl_bloom.c @@ -589,4 +589,5 @@ void R_BloomBlend (void)//refdef_t *fd, meshlist_t *meshlist ) qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -} \ No newline at end of file +} + diff --git a/engine/gl/gl_heightmap.c b/engine/gl/gl_heightmap.c index 54bf154d8..8a5cd73d7 100644 --- a/engine/gl/gl_heightmap.c +++ b/engine/gl/gl_heightmap.c @@ -172,7 +172,7 @@ void GL_DrawHeightmapModel (entity_t *e) } } } -int Heightmap_PointContentsHM(heightmap_t *hm, float clipmipsz, vec3_t org) +unsigned int Heightmap_PointContentsHM(heightmap_t *hm, float clipmipsz, vec3_t org) { float x, y; float z, tz; @@ -268,7 +268,7 @@ int Heightmap_PointContentsHM(heightmap_t *hm, float clipmipsz, vec3_t org) return FTECONTENTS_EMPTY; } -int Heightmap_PointContents(model_t *model, vec3_t org) +unsigned int Heightmap_PointContents(model_t *model, vec3_t org) { heightmap_t *hm = model->terrain; return Heightmap_PointContentsHM(hm, 0, org); diff --git a/engine/gl/gl_hlmdl.c b/engine/gl/gl_hlmdl.c index 236d2ca9a..25a2a6533 100644 --- a/engine/gl/gl_hlmdl.c +++ b/engine/gl/gl_hlmdl.c @@ -24,8 +24,6 @@ */ #include "model_hl.h" -void VectorTransform (const vec3_t in1, const float in2[3][4], vec3_t out); - void QuaternionGLMatrix(float x, float y, float z, float w, vec4_t *GLM) { GLM[0][0] = 1 - 2 * y * y - 2 * z * z; @@ -68,7 +66,7 @@ void QuaternionGLAngle(const vec3_t angles, vec4_t quaternion) -float transform_matrix[128][3][4]; /* Vertex transformation matrix */ +matrix3x4 transform_matrix[128]; /* Vertex transformation matrix */ void GL_Draw_HL_AliasFrame(short *order, vec3_t *transformed, float tex_w, float tex_h); diff --git a/engine/gl/gl_ppl.c b/engine/gl/gl_ppl.c index 8bca462d8..006e4672d 100644 --- a/engine/gl/gl_ppl.c +++ b/engine/gl/gl_ppl.c @@ -140,8 +140,8 @@ typedef struct { #define MAXARRAYVERTS 2048 static surfvertexarray_t varray_v[MAXARRAYVERTS]; static unsigned int varray_i[MAXARRAYVERTS]; -static unsigned int varray_i_forward[MAXARRAYVERTS]; -static unsigned int varray_i_polytotri[MAXARRAYVERTS]; //012 023 034 045... +//static unsigned int varray_i_forward[MAXARRAYVERTS]; +//static unsigned int varray_i_polytotri[MAXARRAYVERTS]; //012 023 034 045... int varray_ic; int varray_vc; @@ -2076,7 +2076,6 @@ void PPL_DrawEnt(entity_t *e, void *parm) void PPL_BaseEntTextures(void) { - extern qboolean r_inmirror; extern model_t *currentmodel; int i; diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index 85bafe1fa..a757cedf4 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -838,7 +838,7 @@ void GLR_AddDecals(vec3_t org) //================================================================================== -void GLR_DrawSprite(entity_t *e, void *parm) +void GLR_DrawSprite(void *e, void *parm) { qglEnd(); currententity = e; @@ -887,6 +887,13 @@ void GLR_DrawEntitiesOnList (void) R_DrawRailCore(currententity); continue; #endif + case RT_MODEL: //regular model + break; + case RT_PORTALSURFACE: + continue; //this doesn't do anything anyway, does it? + default: + case RT_POLY: //these are a little painful, we need to do them some time... just not yet. + continue; } if (currententity->flags & Q2RF_BEAM) { diff --git a/engine/http/webgen.c b/engine/http/webgen.c index 025f1c495..1b11ec7af 100644 --- a/engine/http/webgen.c +++ b/engine/http/webgen.c @@ -25,7 +25,7 @@ void IWeb_MoreGeneratedResize(int newsize) ob = IWeb_GenerationBuffer; IWeb_GenerationBuffer = BZ_Malloc(sizeof(IWeb_GenerationBuffer) + newsize); - + IWeb_GenerationBuffer->data = (char *)(IWeb_GenerationBuffer+1); if (ob) { @@ -256,7 +256,7 @@ void IWeb_GenerateIndexFile (char *parms, char *content, int contentlength) // } // else *o = 0; - + IWeb_Generate(""); IWeb_Generate(key); @@ -274,7 +274,7 @@ void IWeb_GenerateIndexFile (char *parms, char *content, int contentlength) if (*s) s++; - + IWeb_Generate(""); IWeb_Generate(value); IWeb_Generate(""); @@ -331,7 +331,7 @@ typedef struct { int pos; } vfsgen_t; -int VFSGen_ReadBytes(vfsfile_t *f, char *buffer, int bytes) +int VFSGen_ReadBytes(vfsfile_t *f, void *buffer, int bytes) { vfsgen_t *g = (vfsgen_t*)f; if (bytes + g->pos >= g->buffer->len) @@ -347,7 +347,7 @@ int VFSGen_ReadBytes(vfsfile_t *f, char *buffer, int bytes) return bytes; } -int VFSGen_WriteBytes(vfsfile_t *f, char *buffer, int bytes) +int VFSGen_WriteBytes(vfsfile_t *f, void *buffer, int bytes) { Sys_Error("VFSGen_WriteBytes: Readonly\n"); return 0; @@ -364,13 +364,13 @@ qboolean VFSGen_Seek(vfsfile_t *f, unsigned long newpos) return true; } -int VFSGen_Tell(vfsfile_t *f) +unsigned long VFSGen_Tell(vfsfile_t *f) { vfsgen_t *g = (vfsgen_t*)f; return g->pos; } -int VFSGen_GetLen(vfsfile_t *f) +unsigned long VFSGen_GetLen(vfsfile_t *f) { vfsgen_t *g = (vfsgen_t*)f; return g->buffer->len; diff --git a/engine/qclib/pr_edict.c b/engine/qclib/pr_edict.c index 00dc4c237..6f19f2f3e 100644 --- a/engine/qclib/pr_edict.c +++ b/engine/qclib/pr_edict.c @@ -2623,7 +2623,7 @@ retry: pr_types[i].num_parms = PRLittleLong(current_progstate->types[i].num_parms); pr_types[i].ofs = PRLittleLong(current_progstate->types[i].ofs); pr_types[i].size = PRLittleLong(current_progstate->types[i].size); - pr_types[i].name = (string_t)PRLittleLong((long)current_progstate->types[i].name); + pr_types[i].name = (char *)PRLittleLong((long)current_progstate->types[i].name); #endif pr_types[i].name += stringadjust; } diff --git a/engine/qclib/progslib.h b/engine/qclib/progslib.h index 76f1cf4ce..300cde1cc 100644 --- a/engine/qclib/progslib.h +++ b/engine/qclib/progslib.h @@ -64,7 +64,7 @@ struct progfuncs_s { void (*EntFree) (progfuncs_t *prinst, struct edict_s *ed); struct edict_s *(*EDICT_NUM) (progfuncs_t *prinst, unsigned int n); //get the nth edict - int (*NUM_FOR_EDICT) (progfuncs_t *prinst, struct edict_s *e); //so you can find out what that 'n' will be + unsigned int (*NUM_FOR_EDICT) (progfuncs_t *prinst, struct edict_s *e); //so you can find out what that 'n' will be void (*SetGlobalEdict) (progfuncs_t *prinst, struct edict_s *ed, int ofs); //set a global to an edict (partially obsolete) diff --git a/engine/server/sv_sys_unix.c b/engine/server/sv_sys_unix.c index 35162dfe0..84fa8ce02 100644 --- a/engine/server/sv_sys_unix.c +++ b/engine/server/sv_sys_unix.c @@ -568,7 +568,7 @@ it to the host command processor */ char *Sys_ConsoleInput (void) { - char text[256]; + static char text[256]; int len; if (sys_linebuffer.modified) diff --git a/engine/server/svq3_game.c b/engine/server/svq3_game.c index eaa80e97a..7b6019187 100644 --- a/engine/server/svq3_game.c +++ b/engine/server/svq3_game.c @@ -1674,10 +1674,9 @@ int BL_FRead( void *buffer, int len, fileHandle_t f ) //{ // return VMUI_FWrite(buffer, len, f, Z_TAG_BOTLIB); //} -int BL_FCloseFile( fileHandle_t f ) +void BL_FCloseFile( fileHandle_t f ) { VMUI_fclose((int)f, Z_TAG_BOTLIB); - return 0; } //int BL_Seek( fileHandle_t f ) //{