diff --git a/engine/client/cd_sdl.c b/engine/client/cd_sdl.c index 534841c56..46c5d8ca7 100644 --- a/engine/client/cd_sdl.c +++ b/engine/client/cd_sdl.c @@ -56,11 +56,11 @@ void CDAudio_Play(int track, qboolean looping) { if (!enabled) return; - + if (!cdValid) { CDAudio_GetAudioDiskInfo(); - if (!cdValid) + if (!cdValid) return; } @@ -74,8 +74,8 @@ void CDAudio_Play(int track, qboolean looping) if (playing) { - if (playTrack == track) - return; + if (playTrack == track) + return; CDAudio_Stop(); } @@ -100,7 +100,7 @@ void CDAudio_Stop(void) { if (!enabled) return; - + if (!playing) return; @@ -132,7 +132,7 @@ void CDAudio_Resume(void) { if (!enabled) return; - + if (!cdValid) return; @@ -268,7 +268,7 @@ static void CD_f (void) } } -/* + LONG CDAudio_MessageHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (lParam != wDeviceID) @@ -302,7 +302,7 @@ LONG CDAudio_MessageHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; } -*/ + void BGMVolume_Callback(struct cvar_s *var, char *oldvalue) { diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index b203c8f34..49194f175 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -1409,7 +1409,7 @@ void SCR_DrawLoading (void) char *s; int qdepth; int h2depth; - int mtype = M_GameType(); + //int mtype = M_GameType(); //unused variable y = vid.height/2; qdepth = COM_FDepthFile("gfx/loading.lmp", true); @@ -1636,7 +1636,7 @@ SCR_SetUpToDrawConsole void SCR_SetUpToDrawConsole (void) { #ifdef TEXTEDITOR - extern qboolean editoractive; + //extern qboolean editoractive; //unused variable #endif if (scr_drawloading) return; // never a console with loading plaque diff --git a/engine/client/clq3_parse.c b/engine/client/clq3_parse.c index 88366d964..2f4c83ef9 100644 --- a/engine/client/clq3_parse.c +++ b/engine/client/clq3_parse.c @@ -194,8 +194,8 @@ static void CLQ3_ParsePacketEntities( clientSnap_t *oldframe, clientSnap_t *newf { oldstate = &ccs.parseEntities[(oldframe->firstEntity + numentities) & PARSE_ENTITIES_MASK]; oldnum = oldstate->number; - } - } + } + } if( oldnum == newnum ) { @@ -267,7 +267,7 @@ void CLQ3_ParseSnapshot(void) // If the frame is delta compressed from data that we // no longer have available, we must suck up the rest of - // the frame, but not use it, then ask for a non-compressed message + // the frame, but not use it, then ask for a non-compressed message delta = MSG_ReadByte(); if(delta) { @@ -601,7 +601,7 @@ void CLQ3_ParseGameState(void) char buffer[2048]; strcpy(buffer, va("cp %i ", cl.servercount)); FSQ3_GenerateClientPacksList(buffer, sizeof(buffer), ccs.fs_key); - CLQ3_SendClientCommand(buffer); + CLQ3_SendClientCommand("%s", buffer); // warning: format not a string literal and no format arguments } // load cgame, etc @@ -658,7 +658,7 @@ void CLQ3_ParseServerMessage (void) } SHOWNET(va("%i", cmd)); - + // other commands switch(cmd) { @@ -708,13 +708,13 @@ qboolean CLQ3_Netchan_Process(void) net_message.packing = SZ_HUFFMAN; net_message.currentbit = 32; - lastClientCommandNum = MSG_ReadLong(); + lastClientCommandNum = MSG_ReadLong(); sequence = LittleLong(*(int *)net_message.data); // restore buffer state net_message.currentbit = bit; msg_readcount = readcount; - + // calculate bitmask bitmask = sequence ^ cls.challenge; string = ccs.clientCommands[lastClientCommandNum & TEXTCMD_MASK]; @@ -802,7 +802,7 @@ static void MSG_WriteDeltaKey( sizebuf_t *msg, int key, int from, int to, int bi MSG_WriteBits( msg, 0, 1 ); return; // unchanged } - + MSG_WriteBits( msg, 1, 1 ); MSG_WriteBits( msg, to ^ key, bits ); } @@ -943,7 +943,7 @@ void CLQ3_SendCmd(usercmd_t *cmd) ccs.snap.serverMessageNum != ccs.serverMessageNum) MSG_WriteBits(&msg, clcq3_nodeltaMove, 8); // no compression else - MSG_WriteBits(&msg, clcq3_move, 8); + MSG_WriteBits(&msg, clcq3_move, 8); // write cmdcount MSG_WriteBits(&msg, cmdcount, 8); diff --git a/engine/client/console.c b/engine/client/console.c index 75e91f239..fc66248b7 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -273,7 +273,7 @@ void QT_Create(char *command) int ret; qt = Z_Malloc(sizeof(*qt)); - + memset(&sa,0,sizeof(sa)); sa.nLength=sizeof(sa); sa.bInheritHandle=true; @@ -291,20 +291,20 @@ void QT_Create(char *command) qt->pipeoutih = StdOut[1]; qt->pipeinih = StdIn[1]; - if (!DuplicateHandle(GetCurrentProcess(), StdIn[0], - GetCurrentProcess(), &qt->pipein, 0, - FALSE, // not inherited + if (!DuplicateHandle(GetCurrentProcess(), StdIn[0], + GetCurrentProcess(), &qt->pipein, 0, + FALSE, // not inherited DUPLICATE_SAME_ACCESS)) qt->pipein = StdIn[0]; else - CloseHandle(StdIn[0]); - if (!DuplicateHandle(GetCurrentProcess(), StdOut[0], - GetCurrentProcess(), &qt->pipeout, 0, - FALSE, // not inherited + CloseHandle(StdIn[0]); + if (!DuplicateHandle(GetCurrentProcess(), StdOut[0], + GetCurrentProcess(), &qt->pipeout, 0, + FALSE, // not inherited DUPLICATE_SAME_ACCESS)) qt->pipeout = StdOut[0]; else - CloseHandle(StdOut[0]); + CloseHandle(StdOut[0]); SUInf.hStdInput = qt->pipeinih; SUInf.hStdOutput = qt->pipeoutih; @@ -371,7 +371,7 @@ void Con_ToggleConsole_f (void) } else key_dest = key_console; - + Con_ClearNotify (); } @@ -391,7 +391,7 @@ void Con_ToggleChat_f (void) } else key_dest = key_console; - + Con_ClearNotify (); } @@ -459,7 +459,7 @@ void Cmd_ConActivate_f(void) if (con) Con_SetActive(con); } - + /* ================ Con_ClearNotify @@ -468,12 +468,12 @@ Con_ClearNotify void Con_ClearNotify (void) { int i; - + for (i=0 ; i 0) x = lhs; - + lhs = x - lhs + left; for (cchar = maskedtext; cchar < cursor; cchar++) { @@ -1013,9 +1013,9 @@ void Con_DrawNotify (void) Font_EndString(font_conchar); } -//send all the stuff that was con_printed to sys_print. +//send all the stuff that was con_printed to sys_print. //This is so that system consoles in windows can scroll up and have all the text. -void Con_PrintToSys(void) +void Con_PrintToSys(void) { console_t *curcon = &con_main; conline_t *l; @@ -1048,7 +1048,7 @@ static int Con_DrawProgress(int left, int right, int y) int barwidth, barleft; float progresspercent = 0; *progresspercenttext = 0; - + // draw the download bar // figure out width if (cls.downloadmethod) @@ -1100,7 +1100,7 @@ static int Con_DrawProgress(int left, int right, int y) txt = progresstext; x = 0; - COM_ParseFunString(CON_WHITEMASK, txt, dlbar, sizeof(dlbar), false); + COM_ParseFunString(CON_WHITEMASK, txt, dlbar, sizeof(dlbar), false); for (i = 0; dlbar[i]; ) { x += Font_CharWidth(dlbar[i]); @@ -1454,7 +1454,7 @@ char *Con_CopyConsole(void) l = selstartline; cur = (conchar_t*)(l+1) + selstartoffset; finalendoffset = selendoffset; - + if (selstartline == selendline) { if (selstartoffset+1 == finalendoffset) @@ -1527,7 +1527,7 @@ void Con_NotifyBox (char *text) // during startup for sound / cd warnings Con_Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n"); - Con_Printf (text); + Con_Printf ("%s", text); Con_Printf ("Press a key.\n"); Con_Printf("\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n"); diff --git a/engine/client/in_sdl.c b/engine/client/in_sdl.c index ebb168bb5..a93bec20f 100644 --- a/engine/client/in_sdl.c +++ b/engine/client/in_sdl.c @@ -294,6 +294,10 @@ void IN_ReInit (void) void IN_Init (void) { + #ifdef IN_XFLIP + cvar_t in_xflip = SCVAR("in_xflip", "0"); + #endif + #ifdef IN_XFLIP Cvar_Register (&in_xflip, "Input Controls"); #endif @@ -349,4 +353,24 @@ void IN_Commands (void) //used to Cbuf_AddText joystick button events in windows } +/* +=========== +IN_UpdateClipCursor +=========== +*/ +void IN_UpdateClipCursor (void) +{ + if (mouseinitialized && mouseactive && !dinput) + { + ClipCursor (&window_rect); + } +} + +void IN_RawInput_Read(HANDLE in_device_handle) +{ +} + +static int MapKey (int vkey) +{ +} \ No newline at end of file diff --git a/engine/client/m_options.c b/engine/client/m_options.c index 6c6f44c80..796192fff 100644 --- a/engine/client/m_options.c +++ b/engine/client/m_options.c @@ -260,7 +260,7 @@ void M_Menu_Audio_f (void) { menu_t *menu; int cursorpositionY; - extern cvar_t nosound, precache, snd_leftisright, snd_khz, snd_eax, snd_speakers, ambient_level, bgmvolume, snd_playersoundvolume, ambient_fade, cl_staticsounds, snd_inactive, _snd_mixahead, snd_usemultipledevices, snd_noextraupdate, snd_show, bgmbuffer; + extern cvar_t nosound, precache, snd_leftisright, snd_khz, snd_eax, snd_speakers, ambient_level, bgmvolume, snd_playersoundvolume, ambient_fade, cl_staticsounds, snd_inactive, _snd_mixahead, snd_usemultipledevices, snd_noextraupdate, bgmbuffer; extern cvar_t cl_voip_play, cl_voip_send; static const char *soundqualityoptions[] = { @@ -1128,6 +1128,7 @@ void M_Menu_Shadow_Lighting_f (void) MC_AddWhiteText(menu, 16, y, " ", false); y+=8; y+=8; + MC_AddSlider(menu, 16, y, " Shadows", &r_shadows,0,2,1); y+=8; //MC_AddSlider(menu, 16, y, " Light Map Mode", &gl_lightmapmode,0,2,1); y+=8; MC_AddSlider(menu, 16, y, " Light Map Saturation", &r_lightmap_saturation,0,1,0.1); y+=8; MC_AddCheckBox(menu, 16, y, " Dynamic Lighting", &r_dynamic,0); y+=8; diff --git a/engine/client/net_master.c b/engine/client/net_master.c index 8b1313c89..7d5445213 100644 --- a/engine/client/net_master.c +++ b/engine/client/net_master.c @@ -220,6 +220,16 @@ qboolean Master_ServerIsGreater(serverinfo_t *a, serverinfo_t *b) return Master_CompareInteger(a->tl, b->tl, SLIST_TEST_LESS); case SLKEY_TOOMANY: break; + + // warning: enumeration value SLKEY_* not handled in switch + case SLKEY_MOD: + case SLKEY_PROTOCOL: + case SLKEY_NUMBOTS: + case SLKEY_NUMHUMANS: + case SLKEY_QCSTATUS: + case SLKEY_ISFAVORITE: + break; + } return false; } @@ -560,7 +570,7 @@ int Master_KeyForName(char *keyname) } } Q_strncpyz(slist_keyname[slist_customkeys], keyname, MAX_INFO_KEY); - + slist_customkeys++; return slist_customkeys-1 + SLKEY_CUSTOM; @@ -771,7 +781,7 @@ qboolean Master_LoadMasterList (char *filename, int defaulttype, int depth) default: Master_AddMaster(line, servertype, name); } - + } } VFS_CLOSE(f); @@ -979,7 +989,7 @@ int NET_CheckPollSockets(void) } if (c == M2C_MASTER_REPLY) //qw master reply. - { + { CL_MasterListParse(NA_IP, SS_GENERICQUAKEWORLD, false); continue; } @@ -1021,7 +1031,7 @@ int NET_CheckPollSockets(void) CL_ReadServerInfo(va("\\hostname\\%s\\map\\%s\\maxclients\\%i\\clients\\%i", name, map, maxusers, users), MT_SINGLENQ, false); } #endif - continue; + continue; } return 0; } @@ -1072,7 +1082,7 @@ void SListOptionChanged(serverinfo_t *newserver) } //we don't know all the info, so send a request for it. selectedserver.detail = newserver->moreinfo = Z_Malloc(sizeof(serverdetailedinfo_t)); - + newserver->moreinfo->numplayers = newserver->players; strcpy(newserver->moreinfo->info, ""); Info_SetValueForKey(newserver->moreinfo->info, "hostname", newserver->name, sizeof(newserver->moreinfo->info)); @@ -1149,7 +1159,7 @@ void MasterInfo_ProcessHTTPQW(struct dl_download *dl) //don't try sending to servers we don't support void MasterInfo_Request(master_t *mast, qboolean evenifwedonthavethefiles) { - static int mastersequence; + //static int mastersequence; // warning: unused variable mastersequence if (!mast) return; switch(mast->type) @@ -1233,14 +1243,14 @@ void MasterInfo_WriteServers(void) serverinfo_t *server; vfsfile_t *mf, *qws; char adr[MAX_ADR_SIZE]; - + mf = FS_OpenVFS("masters.txt", "wt", FS_ROOT); if (!mf) { Con_Printf("Couldn't write masters.txt"); return; } - + for (mast = master; mast; mast=mast->next) { switch(mast->type) @@ -1298,14 +1308,14 @@ void MasterInfo_WriteServers(void) else VFS_PUTS(mf, va("%s\t%s\t%s\n", NET_AdrToString(adr, sizeof(adr), mast->adr), typename, mast->name)); } - + if (slist_writeserverstxt.value) qws = FS_OpenVFS("servers.txt", "wt", FS_ROOT); else qws = NULL; if (qws) VFS_PUTS(mf, va("\n%s\t%s\t%s\n\n", "file servers.txt", "favorite:qw", "personal server list")); - + for (server = firstserver; server; server = server->next) { if (server->special & SS_FAVORITE) @@ -1322,11 +1332,11 @@ void MasterInfo_WriteServers(void) VFS_PUTS(mf, va("%s\t%s\t%s\n", NET_AdrToString(adr, sizeof(adr), server->adr), "favorite:qw", server->name)); } } - + if (qws) VFS_CLOSE(qws); - - + + VFS_CLOSE(mf); } @@ -1429,7 +1439,7 @@ void CL_QueryServers(void) { static int poll; int op; - serverinfo_t *server; + serverinfo_t *server; extern cvar_t sb_hidequake2; extern cvar_t sb_hidequake3; @@ -1437,7 +1447,7 @@ void CL_QueryServers(void) extern cvar_t sb_hidequakeworld; op = poll; - + for (server = firstserver; op>0 && server; server=server->next, op--); @@ -1489,7 +1499,7 @@ void CL_QueryServers(void) poll++; return; } - + poll = 0; } @@ -1574,7 +1584,7 @@ int CL_ReadServerInfo(char *msg, int servertype, qboolean favorite) char *token; char *nl; - char *name; + char *name; int ping; int len; serverinfo_t *info; @@ -1844,6 +1854,17 @@ void CL_MasterListParse(netadrtype_t adrtype, int type, qboolean slashpad) for (i = 0; i < adrlen; i++) ((qbyte *)&info->adr.address)[i] = MSG_ReadByte(); break; + + // warning: enumeration value NA_* not handled in switch + case NA_INVALID: + case NA_LOOPBACK: + case NA_BROADCAST_IP: + case NA_BROADCAST_IP6: + case NA_BROADCAST_IPX: + case NA_TCP: + case NA_TCPV6: + case NA_IRC: + break; } p1 = MSG_ReadByte(); @@ -1871,7 +1892,7 @@ void CL_MasterListParse(netadrtype_t adrtype, int type, qboolean slashpad) last = info; Master_ResortServer(info); - } + } } firstserver = last; diff --git a/engine/client/p_script.c b/engine/client/p_script.c index f5b72722b..ff34315ca 100644 --- a/engine/client/p_script.c +++ b/engine/client/p_script.c @@ -120,7 +120,7 @@ typedef struct beamseg_s { struct beamseg_s *next; // next in beamseg list - particle_t *p; + particle_t *p; int flags; // flags for beamseg vec3_t dir; @@ -188,7 +188,7 @@ typedef struct part_type_s { float veladd; //scale the incoming velocity by this much float orgadd; //spawn the particle this far along its velocity direction float spawnvel, spawnvelvert; //spawn the particle with a velocity based upon its spawn type (generally so it flies outwards) - + float s1, t1, s2, t2; //texture coords float texsstride; //addition for s for each random slot. int randsmax; //max times the stride can be added @@ -280,9 +280,9 @@ static void PScript_DrawParticleTypes (void (*texturedparticles)(int count, part #ifndef TYPESONLY -//triangle fan sparks use these. -static double sint[7] = {0.000000, 0.781832, 0.974928, 0.433884, -0.433884, -0.974928, -0.781832}; -static double cost[7] = {1.000000, 0.623490, -0.222521, -0.900969, -0.900969, -0.222521, 0.623490}; +//triangle fan sparks use these. // defined but not used +//static double sint[7] = {0.000000, 0.781832, 0.974928, 0.433884, -0.433884, -0.974928, -0.781832}; +//static double cost[7] = {1.000000, 0.623490, -0.222521, -0.900969, -0.900969, -0.222521, 0.623490}; #define crand() (rand()%32767/16383.5f-1) @@ -352,7 +352,7 @@ static part_type_t *part_run_list; static struct { char *oldn; char *newn; -} legacynames[] = +} legacynames[] = { {"t_rocket", "TR_ROCKET"}, {"te_explosion", "TE_EXPLOSION"}, @@ -520,7 +520,7 @@ static void P_LoadTexture(part_type_t *ptype, qboolean warn) } else ptype->looks.shader = NULL; - + if (!ptype->looks.shader) { /*okay, so no shader, generate a shader that matches the legacy/shaderless mode*/ @@ -1887,7 +1887,7 @@ static void P_LoadParticleSet(char *name, qboolean first) { char *file; int i; - int restrictlevel = Cmd_FromGamecode() ? RESTRICT_SERVER : RESTRICT_LOCAL; + int restrictlevel = Cmd_FromGamecode() ? RESTRICT_SERVER : RESTRICT_LOCAL; /*set up a default*/ if (first && !*name) @@ -2307,7 +2307,7 @@ static void PScript_EffectSpawned(part_type_t *ptype, vec3_t org, vec3_t dir) dl->channelfade[2] = ptype->dl_decay[2]; } if (ptype->stain_radius) - R_AddStain(org, ptype->stain_rgb[0], ptype->stain_rgb[1], ptype->stain_rgb[2], ptype->stain_radius); + R_AddStain(org, ptype->stain_rgb[0], ptype->stain_rgb[1], ptype->stain_rgb[2], ptype->stain_radius); } int Q1BSP_ClipDecal(vec3_t center, vec3_t normal, vec3_t tangent, vec3_t tangent2, float size, float **out); @@ -3669,7 +3669,7 @@ static void GL_DrawTexturedParticle(int count, particle_t **plist, plooks_t *typ else scale = 0.25 + scale * 0.001; } - + Vector4Copy(p->rgba, pscriptcolours[pscriptmesh.numvertexes+0]); Vector4Copy(p->rgba, pscriptcolours[pscriptmesh.numvertexes+1]); Vector4Copy(p->rgba, pscriptcolours[pscriptmesh.numvertexes+2]); @@ -3780,7 +3780,7 @@ static void GL_DrawLineSparkParticle(int count, particle_t **plist, plooks_t *ty APPLYBLEND(type->blendmode); qglShadeModel(GL_SMOOTH); qglBegin(GL_LINES); - + while (count--) { p = *plist++; @@ -3827,7 +3827,7 @@ static void GL_DrawTexturedSparkParticle(int count, particle_t **plist, plooks_t Vector2Set(pscripttexcoords[pscriptmesh.numvertexes+2], p->s2, p->t2); Vector2Set(pscripttexcoords[pscriptmesh.numvertexes+3], p->s2, p->t1); - + if (type->stretch) { VectorMA(p->org, type->stretch, p->vel, o2); diff --git a/engine/client/r_surf.c b/engine/client/r_surf.c index d81dd7914..35a5742f4 100644 --- a/engine/client/r_surf.c +++ b/engine/client/r_surf.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -84,7 +84,7 @@ void Surf_RebuildLightmap_Callback (struct cvar_s *var, char *oldvalue) //radius, x y z, r g b void Surf_StainSurf (msurface_t *surf, float *parms) -{ +{ int sd, td; float dist, rad, minlight; float change; @@ -130,8 +130,8 @@ void Surf_StainSurf (msurface_t *surf, float *parms) local[1] = DotProduct (impact, tex->vecs[1]) + tex->vecs[1][3]; local[0] -= surf->texturemins[0]; - local[1] -= surf->texturemins[1]; - + local[1] -= surf->texturemins[1]; + for (t = 0 ; tcontents < 0) - return; + return; splitplane = node->plane; dist = DotProduct ((parms+1), splitplane->normal) - splitplane->dist; - + if (dist > (*parms)) { Surf_StainNode (node->children[0], parms); @@ -226,7 +226,7 @@ void Surf_AddStain(vec3_t org, float red, float green, float blue, float radius) for (i=1 ; i< pmove.numphysent ; i++) //0 is world... { - pe = &pmove.physents[i]; + pe = &pmove.physents[i]; if (pe->model && pe->model->surfaces == cl.worldmodel->surfaces) { parms[1] = org[0] - pe->origin[0]; @@ -293,7 +293,7 @@ void Surf_LessenStains(void) surf->cached_dlight=-1;//nice hack here... smax = (surf->extents[0]>>4)+1; - tmax = (surf->extents[1]>>4)+1; + tmax = (surf->extents[1]>>4)+1; stain = lightmap[surf->lightmaptexturenum]->stainmaps; stain += (surf->light_t * LMBLOCK_WIDTH + surf->light_s) * 3; @@ -317,7 +317,7 @@ void Surf_LessenStains(void) *stain = 255; stain++; - } + } } } } @@ -399,6 +399,8 @@ static void Surf_AddDynamicLights (msurface_t *surf) } } +// warning: Surf_AddDynamicLightNorms defined but not used +/* static void Surf_AddDynamicLightNorms (msurface_t *surf) { int lnum; @@ -470,6 +472,7 @@ static void Surf_AddDynamicLightNorms (msurface_t *surf) } } } +*/ #ifdef PEXT_LIGHTSTYLECOL static void Surf_AddDynamicLightsColours (msurface_t *surf) @@ -539,8 +542,8 @@ static void Surf_AddDynamicLightsColours (msurface_t *surf) else dist = td + (sd>>1); if (dist < minlight) - { - blocklights[t*smax + s] += 2*sin(dist/10+cl.time*20)*(rad - dist)*256 * cl_dlights[lnum].colour[0]*3; + { + blocklights[t*smax + s] += 2*sin(dist/10+cl.time*20)*(rad - dist)*256 * cl_dlights[lnum].colour[0]*3; greenblklights[t*smax + s] += 2*sin(M_PI/3+dist/10+cl.time*20)*(rad - dist)*256 * cl_dlights[lnum].colour[1]*3; blueblklights[t*smax + s] += 2*sin(2*M_PI/3+dist/10+cl.time*20)*(rad - dist)*256 * cl_dlights[lnum].colour[2]*3; } @@ -565,8 +568,8 @@ static void Surf_AddDynamicLightsColours (msurface_t *surf) else dist = td + (sd>>1); if (dist < minlight) - { - bl[0] += (rad - dist)*r; + { + bl[0] += (rad - dist)*r; bl[1] += (rad - dist)*g; bl[2] += (rad - dist)*b; } @@ -693,7 +696,7 @@ store: dest += 3; bnorm+=3; } - } + } } enum lm_mode @@ -751,11 +754,11 @@ static void Surf_StoreLightmap(qbyte *dest, int smax, int tmax, unsigned int shi dest[2] = r; dest[3] = 255; - dest += 4; + dest += 4; } if (stainsrc) stainsrc += (LMBLOCK_WIDTH - smax)*3; - } + } break; /* case bgra4: @@ -800,24 +803,24 @@ static void Surf_StoreLightmap(qbyte *dest, int smax, int tmax, unsigned int shi dest[0] = b; dest[3] = 255; - dest += 4; + dest += 4; } if (stainsrc) stainsrc += (LMBLOCK_WIDTH - smax)*3; - } + } break; */ case rgb3_os: stride = LMBLOCK_WIDTH*3 - (smax*3); bl = blocklights; - + for (i=0 ; i> shift; g = *bl++ >> shift; - b = *bl++ >> shift; + b = *bl++ >> shift; if (stainsrc) // merge in stain { @@ -839,11 +842,11 @@ static void Surf_StoreLightmap(qbyte *dest, int smax, int tmax, unsigned int shi dest[0] = r; dest[1] = g; dest[2] = b; - dest += 3; + dest += 3; } if (stainsrc) stainsrc += (LMBLOCK_WIDTH - smax)*3; - } + } break; case lum: stride = LMBLOCK_WIDTH; @@ -882,7 +885,7 @@ static void Surf_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, int maps; unsigned *bl; - int stride = LMBLOCK_WIDTH*lightmap_bytes; + //int stride = LMBLOCK_WIDTH*lightmap_bytes; //warning: unused variable stride shift += 7; // increase to base value surf->cached_dlight = (surf->dlightframe == r_framecount); @@ -897,7 +900,7 @@ static void Surf_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, Con_Printf("Lightmap too large\n"); return; } - + if (currentmodel->deluxdata) Surf_BuildDeluxMap(surf, deluxdest); @@ -979,7 +982,7 @@ static void Surf_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, } } else if (currentmodel->engineflags & MDLF_RGBLIGHTING) //rgb - { + { for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ; maps++) { @@ -1084,7 +1087,7 @@ static void Surf_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, Surf_StoreLightmap(dest, smax, tmax, shift, bgr3, stainsrc); */ } - else + else { Surf_StoreLightmap(dest, smax, tmax, shift, rgb3_os, stainsrc); } @@ -1183,7 +1186,7 @@ void Surf_RenderDynamicLightmaps (msurface_t *fa) //surfaces with lightmaps that do not animate, supposedly if (fa->texinfo->flags & (TI_SKY|TI_TRANS33|TI_TRANS66|TI_WARP)) return; - + // check for lightmap modification if (!fa->samples) { @@ -1368,7 +1371,7 @@ static qbyte *R_MarkLeafSurfaces_Q1 (void) int shift; vis = R_CalcVis_Q1(); - + for (i=0 ; inumleafs ; i++) { if (vis[i>>3] & (1<<(i&7))) @@ -1547,7 +1550,7 @@ static void Surf_RecursiveQ2WorldNode (mnode_t *node) return; if (R_CullBox (node->minmaxs, node->minmaxs+3)) return; - + // if a leaf node, draw stuff if (node->contents != -1) { @@ -1817,7 +1820,7 @@ void Surf_SetupFrame(void) { } else if (r_viewleaf->contents == Q1CONTENTS_EMPTY) - { //look down a bit + { //look down a bit VectorCopy (r_origin, temp); temp[2] -= 16; leaf = RMod_PointInLeaf (cl.worldmodel, temp); @@ -1828,7 +1831,7 @@ void Surf_SetupFrame(void) } else if (r_viewleaf->contents <= Q1CONTENTS_WATER && r_viewleaf->contents >= Q1CONTENTS_LAVA) { //in water, look up a bit. - + VectorCopy (r_origin, temp); temp[2] += 16; leaf = RMod_PointInLeaf (cl.worldmodel, temp); @@ -1839,7 +1842,7 @@ void Surf_SetupFrame(void) } else r_viewleaf2 = NULL; - + if (r_viewleaf) V_SetContentsColor (r_viewleaf->contents); } @@ -2139,7 +2142,7 @@ static int Surf_LM_AllocBlock (int w, int h, int *x, int *y, shader_t *shader) { if (texnum == numlightmaps) //allocate 4 more lightmap slots. not much memory usage, but we don't want any caps here. { - lightmap = BZ_Realloc(lightmap, sizeof(*lightmap)*(numlightmaps+4)); + lightmap = BZ_Realloc(lightmap, sizeof(*lightmap)*(numlightmaps+4)); lightmap[numlightmaps+0] = NULL; lightmap[numlightmaps+1] = NULL; lightmap[numlightmaps+2] = NULL; @@ -2220,19 +2223,19 @@ static int Surf_LM_FillBlock (int texnum, int w, int h, int x, int y) int i, l; while (texnum >= numlightmaps) //allocate 4 more lightmap slots. not much memory usage, but we don't want any caps here. { - lightmap = BZ_Realloc(lightmap, sizeof(*lightmap)*(numlightmaps+4)); + lightmap = BZ_Realloc(lightmap, sizeof(*lightmap)*(numlightmaps+4)); lightmap[numlightmaps+0] = NULL; lightmap[numlightmaps+1] = NULL; lightmap[numlightmaps+2] = NULL; lightmap[numlightmaps+3] = NULL; - lightmap_textures = BZ_Realloc(lightmap_textures, sizeof(*lightmap_textures)*(numlightmaps+4)); + lightmap_textures = BZ_Realloc(lightmap_textures, sizeof(*lightmap_textures)*(numlightmaps+4)); lightmap_textures[numlightmaps+0] = R_AllocNewTexture(LMBLOCK_WIDTH, LMBLOCK_HEIGHT); lightmap_textures[numlightmaps+1] = R_AllocNewTexture(LMBLOCK_WIDTH, LMBLOCK_HEIGHT); lightmap_textures[numlightmaps+2] = R_AllocNewTexture(LMBLOCK_WIDTH, LMBLOCK_HEIGHT); lightmap_textures[numlightmaps+3] = R_AllocNewTexture(LMBLOCK_WIDTH, LMBLOCK_HEIGHT); - deluxmap_textures = BZ_Realloc(deluxmap_textures, sizeof(*deluxmap_textures)*(numlightmaps+4)); + deluxmap_textures = BZ_Realloc(deluxmap_textures, sizeof(*deluxmap_textures)*(numlightmaps+4)); deluxmap_textures[numlightmaps+0] = R_AllocNewTexture(LMBLOCK_WIDTH, LMBLOCK_HEIGHT); deluxmap_textures[numlightmaps+1] = R_AllocNewTexture(LMBLOCK_WIDTH, LMBLOCK_HEIGHT); deluxmap_textures[numlightmaps+2] = R_AllocNewTexture(LMBLOCK_WIDTH, LMBLOCK_HEIGHT); @@ -2519,13 +2522,13 @@ void Surf_BuildLightmaps (void) switch(qrenderer) { -#ifdef D3DQUAKE case QR_DIRECT3D: +#ifdef D3DQUAKE /*always bgra, hope your card supports it*/ lightmap_bytes = 4; lightmap_bgra = true; - break; #endif + break; #ifdef GLQUAKE case QR_OPENGL: /*favour bgra if the gpu supports it, otherwise use rgb only if it'll be used*/ @@ -2550,6 +2553,8 @@ void Surf_BuildLightmaps (void) lightmap_bytes = 1; break; #endif + case QR_NONE: + break; } for (j=1 ; jloopstart = inloopstart * scale; - SND_ResampleStream (data, - inrate, - inwidth, - inchannels, - insamps, - sc->data, - sc->speed, - sc->width, - sc->numchannels, + SND_ResampleStream (data, + inrate, + inwidth, + inchannels, + insamps, + sc->data, + sc->speed, + sc->width, + sc->numchannels, snd_linearresample.ival); } @@ -768,6 +768,7 @@ sfxcache_t *S_LoadSound (sfx_t *s) qbyte *data; sfxcache_t *sc; int i; + size_t result; char *name = s->name; @@ -796,7 +797,7 @@ sfxcache_t *S_LoadSound (sfx_t *s) if (*name == '\\') *name = '/'; name++; - } + } name = unixname; #endif @@ -804,7 +805,7 @@ sfxcache_t *S_LoadSound (sfx_t *s) { com_filesize = COM_filelength(f); data = Hunk_TempAlloc (com_filesize); - fread(data, 1, com_filesize, f); + result = fread(data, 1, com_filesize, f); //do something with result fclose(f); } else @@ -977,7 +978,7 @@ unsigned int FindChunk(char *name) void DumpChunks(void) { char str[5]; - + str[4] = 0; data_p=iff_data; do @@ -1008,7 +1009,7 @@ wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength) if (!wav) return info; - + iff_data = wav; iff_end = wav + wavlength; wavname = name; @@ -1069,7 +1070,7 @@ wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength) info.loopstart = -1; // find data chunk - chunklen = FindChunk("data"); + chunklen = FindChunk("data"); if (!chunklen) { Con_Printf("Missing data chunk in %s\n", name); @@ -1097,6 +1098,6 @@ wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength) } info.dataofs = data_p - wav; - + return info; } diff --git a/engine/client/snd_sdl.c b/engine/client/snd_sdl.c index e8364c024..46560019d 100644 --- a/engine/client/snd_sdl.c +++ b/engine/client/snd_sdl.c @@ -14,6 +14,30 @@ //FIXME: One thing I saw in quakeforge was that quakeforge basically leaves the audio locked except for a really short period of time. //An interesting idea, which ensures the driver can only paint in a small time-frame. this would possibly allow lower latency painting. +/* +================== +S_BlockSound +================== +*/ +//all devices +void S_BlockSound (void) +{ + soundcardinfo_t *sc; + wavhandle_t *wh; + + snd_blocked++; + + for (sc = sndcardinfo; sc; sc=sc->next) + { + if (sc->Submit == WAV_Submit && !sc->inactive_sound) + { + wh = sc->handle; + if (snd_blocked == 1) + waveOutReset (wh->hWaveOut); + } + } +} + static void SSDL_Shutdown(soundcardinfo_t *sc) { Con_Printf("Shutdown SDL sound\n"); diff --git a/engine/client/sys_linux.c b/engine/client/sys_linux.c index 6070be838..76f523933 100644 --- a/engine/client/sys_linux.c +++ b/engine/client/sys_linux.c @@ -341,6 +341,7 @@ int Sys_DebugLog(char *file, char *fmt, ...) va_list argptr; static char data[1024]; int fd; + size_t result; va_start(argptr, fmt); _vsnprintf (data,sizeof(data)-1, fmt, argptr); @@ -353,7 +354,7 @@ int Sys_DebugLog(char *file, char *fmt, ...) fd = open(file, O_WRONLY | O_CREAT | O_APPEND, 0666); if (fd) { - write(fd, data, strlen(data)); + result = write(fd, data, strlen(data)); // do something with result close(fd); return 0; } @@ -462,7 +463,7 @@ static void *game_library; void Sys_UnloadGame(void) { - if (game_library) + if (game_library) { dlclose(game_library); game_library = 0; @@ -477,13 +478,14 @@ void *Sys_GetGameAPI(void *parms) char curpath[MAX_OSPATH]; char *searchpath; const char *gamename = "gamei386.so"; + size_t result; void *ret; - getcwd(curpath, sizeof(curpath)); + result = getcwd(curpath, sizeof(curpath)); // do something with result? Con_DPrintf("Searching for %s\n", gamename); - + searchpath = 0; while((searchpath = COM_NextPath(searchpath))) { @@ -682,7 +684,7 @@ qboolean Sys_GetDesktopParameters(int *width, int *height, int *bpp, int *refres Display *xtemp; int scr; - + xtemp = XOpenDisplay(NULL); if (!xtemp) @@ -724,11 +726,11 @@ void *Sys_CreateThread(int (*func)(void *), void *args, int stacksize) { pthread_t *thread; pthread_attr_t attr; - + thread = (pthread_t *)malloc(sizeof(pthread_t)); if (!thread) return NULL; - + pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); if (stacksize < PTHREAD_STACK_MIN) @@ -746,7 +748,7 @@ void *Sys_CreateThread(int (*func)(void *), void *args, int stacksize) void Sys_WaitOnThread(void *thread) { - pthread_join((pthread_t *)thread, NULL); + pthread_join((pthread_t *)thread, NULL); free(thread); } @@ -754,7 +756,7 @@ void Sys_WaitOnThread(void *thread) void *Sys_CreateMutex(void) { pthread_mutex_t *mutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); - + if (mutex && !pthread_mutex_init(mutex, NULL)) return mutex; return NULL; @@ -793,36 +795,36 @@ void *Sys_CreateConditional(void) condvar_t *condv; pthread_mutex_t *mutex; pthread_cond_t *cond; - + condv = (condvar_t *)malloc(sizeof(condvar_t)); if (!condv) return NULL; - + mutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); if (!mutex) return NULL; - + cond = (pthread_cond_t *)malloc(sizeof(pthread_cond_t)); if (!cond) return NULL; - + if (!pthread_mutex_init(mutex, NULL)) { if (!pthread_cond_init(cond, NULL)) { condv->cond = cond; condv->mutex = mutex; - + return (void *)condv; } else pthread_mutex_destroy(mutex); } - + free(cond); free(mutex); free(condv); - return NULL; + return NULL; } qboolean Sys_LockConditional(void *condv) @@ -853,7 +855,7 @@ qboolean Sys_ConditionBroadcast(void *condv) void Sys_DestroyConditional(void *condv) { condvar_t *cv = (condvar_t *)condv; - + pthread_cond_destroy(cv->cond); pthread_mutex_destroy(cv->mutex); free(cv->cond); diff --git a/engine/client/view.c b/engine/client/view.c index 4055938bd..34924597d 100644 --- a/engine/client/view.c +++ b/engine/client/view.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "winquake.h" +#include // for isdigit(); + #ifdef FISH void R_RenderView_fisheye(void); cvar_t ffov = SCVAR("ffov", "0"); @@ -117,21 +119,21 @@ float V_CalcRoll (vec3_t angles, vec3_t velocity) float sign; float side; float value; - + AngleVectors (angles, forward, right, up); side = DotProduct (velocity, right); sign = side < 0 ? -1 : 1; side = fabs(side); - + value = cl_rollangle.value; if (side < cl_rollspeed.value) side = side * value / cl_rollspeed.value; else side = value; - + return side*sign; - + } @@ -146,7 +148,7 @@ float V_CalcBob (int pnum) static double bobtime[MAX_SPLITS]; static float bob[MAX_SPLITS]; float cycle; - + if (cl.spectator) return 0; @@ -174,7 +176,7 @@ float V_CalcBob (int pnum) else if (bob[pnum] < -7) bob[pnum] = -7; return bob[pnum]; - + } @@ -218,7 +220,7 @@ If the user is adjusting pitch manually, either with lookup/lookdown, mlook and mouse, or klook and keyboard, pitch drifting is constantly stopped. Drifting is enabled when the center view key is hit, mlook is released and -lookspring is non 0, or when +lookspring is non 0, or when =============== */ void V_DriftPitch (int pnum) @@ -239,14 +241,14 @@ void V_DriftPitch (int pnum) cl.driftmove[pnum] = 0; else cl.driftmove[pnum] += host_frametime; - + if ( cl.driftmove[pnum] > v_centermove.value) { V_StartPitchDrift (pnum); } return; } - + delta = 0 - cl.viewangles[pnum][PITCH]; if (!delta) @@ -257,7 +259,7 @@ void V_DriftPitch (int pnum) move = host_frametime * cl.pitchvel[pnum]; cl.pitchvel[pnum] += host_frametime * v_centerspeed.value; - + //Con_Printf ("move: %f (%f)\n", move, host_frametime); if (delta > 0) @@ -285,14 +287,14 @@ void V_DriftPitch (int pnum) /* -============================================================================== - - PALETTE FLASHES - -============================================================================== -*/ - - +============================================================================== + + PALETTE FLASHES + +============================================================================== +*/ + + cshift_t cshift_empty = { {130,80,50}, 0 }; cshift_t cshift_water = { {130,80,50}, 128 }; cshift_t cshift_slime = { {0,25,5}, 150 }; @@ -314,14 +316,14 @@ float hw_blend[4]; // rgba 0.0 - 1.0 void BuildGammaTable (float g) { int i, inf; - + if (g == 1.0) { for (i=0 ; i<256 ; i++) gammatable[i] = i; return; } - + for (i=0 ; i<256 ; i++) { inf = 255 * pow ( (i+0.5)/255.5 , g ) + 0.5; @@ -352,7 +354,7 @@ void BuildGammaTable (float g, float c) if (inf < 0) inf = 0; else if (inf > 255) - inf = 255; + inf = 255; gammatable[i] = inf; } } @@ -384,7 +386,7 @@ void V_ParseDamage (int pnum) vec3_t forward, right, up; float side; float count; - + armor = MSG_ReadByte (); blood = MSG_ReadByte (); for (i=0 ; i<3 ; i++) @@ -405,7 +407,7 @@ void V_ParseDamage (int pnum) if (cl.cshifts[CSHIFT_DAMAGE].percent > 150) cl.cshifts[CSHIFT_DAMAGE].percent = 150; - if (armor > blood) + if (armor > blood) { cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 200; cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = 100; @@ -429,12 +431,12 @@ void V_ParseDamage (int pnum) // VectorSubtract (from, cl.simorg[pnum], from); VectorNormalize (from); - + AngleVectors (cl.simangles[pnum], forward, right, up); side = DotProduct (from, right); v_dmg_roll[pnum] = count*side*v_kickroll.value; - + side = DotProduct (from, forward); v_dmg_pitch[pnum] = count*side*v_kickpitch.value; @@ -638,7 +640,7 @@ void GLV_CalcBlend (float *hw_blend) memset(sw_blend, 0, sizeof(float)*4); //don't apply it to the server, we'll blend the two later if the user has no hardware gamma (if they do have it, we use just the server specified value) This way we avoid winnt users having a cheat with flashbangs and stuff. - for (j=0 ; j yaw) yaw = oldyaw - move; } - + if (pitch > oldpitch) { if (oldpitch + move < pitch) @@ -822,7 +824,7 @@ void CalcGunAngle (int pnum) if (oldpitch - move > pitch) pitch = oldpitch - move; } - + oldyaw = yaw; oldpitch = pitch; @@ -1005,7 +1007,7 @@ void V_CalcRefdef (int pnum) bob=v_viewheight.value; else bob = V_CalcBob (pnum); - + // refresh position from simulated origin VectorCopy (cl.simorg[pnum], r_refdef.vieworg); @@ -1077,7 +1079,7 @@ void V_CalcRefdef (int pnum) // v_viewheight only affects the view if the player is alive r_refdef.vieworg[2] += bob; } - + // set up gun position AngleVectors (view->angles, forward, right, up); CalcGunAngle (pnum); @@ -1306,13 +1308,13 @@ void V_RenderPlayerViews(int plnum) if (cls.protocol == CP_NETQUAKE) view_message->weaponframe = cl.stats[0][STAT_WEAPONFRAME]; #endif - cl.simangles[plnum][ROLL] = 0; // FIXME @@@ + cl.simangles[plnum][ROLL] = 0; // FIXME @@@ DropPunchAngle (plnum); if (cl.intermission) { // intermission / finale rendering - V_CalcIntermissionRefdef (plnum); + V_CalcIntermissionRefdef (plnum); } else { @@ -1353,7 +1355,7 @@ void V_RenderPlayerViews(int plnum) #ifdef SIDEVIEWS /* //adjust main view height to strip off the rearviews at the top if (vsecwidth >= 1) - { + { r_refdef.vrect.y -= vsecheight; r_refdef.vrect.height += vsecheight; } @@ -1405,8 +1407,8 @@ void V_RenderPlayerViews(int plnum) if (e) { float s; - memcpy(r_refdef.viewangles, e->angles, sizeof(vec3_t)); - memcpy(r_refdef.vieworg, e->origin, sizeof(vec3_t)); + memcpy(r_refdef.viewangles, e->angles, sizeof(vec3_t)); + memcpy(r_refdef.vieworg, e->origin, sizeof(vec3_t)); // cl.viewentity = cl.viewentity2; // s = (realtime - e->lerptime)*10; @@ -1440,7 +1442,7 @@ void V_RenderPlayerViews(int plnum) } r_refdef.vrect = oldrect; - memcpy(r_refdef.viewangles, oldangles, sizeof(vec3_t)); + memcpy(r_refdef.viewangles, oldangles, sizeof(vec3_t)); memcpy(r_refdef.vieworg, oldposition, sizeof(vec3_t)); r_refdef.fov_x = ofx; r_refdef.fov_y = ofy; @@ -1512,7 +1514,7 @@ void V_Init (void) #ifdef SIDEVIEWS int i; #endif - Cmd_AddCommand ("v_cshift", V_cshift_f); + Cmd_AddCommand ("v_cshift", V_cshift_f); Cmd_AddCommand ("bf", V_BonusFlash_f); // Cmd_AddCommand ("centerview", V_StartPitchDrift); diff --git a/engine/client/zqtp.c b/engine/client/zqtp.c index 5bbcf8b9a..5e2bf02e1 100644 --- a/engine/client/zqtp.c +++ b/engine/client/zqtp.c @@ -202,7 +202,7 @@ typedef struct tvars_s { vec3_t pointorg; char pointloc[MAX_LOC_NAME]; int droppedweapon; - char lastdroploc[MAX_LOC_NAME]; + char lastdroploc[MAX_LOC_NAME]; int last_numenemies; int numenemies; @@ -234,8 +234,8 @@ typedef struct item_vis_s { vec3_t up; vec3_t entorg; float radius; - vec3_t dir; - float dist; + vec3_t dir; + float dist; } item_vis_t; @@ -389,7 +389,7 @@ static char *Macro_DroppedWeapon (void) return Weapon_NumToString(vars.droppedweapon); } -static char *Macro_Weapons (void) { +static char *Macro_Weapons (void) { macro_buf[0] = 0; if (cl.stats[SP][STAT_ITEMS] & IT_LIGHTNING) @@ -408,7 +408,7 @@ static char *Macro_Weapons (void) { MacroBuf_strcat_with_separator (tp_name_sg.string); if (cl.stats[SP][STAT_ITEMS] & IT_AXE) MacroBuf_strcat_with_separator (tp_name_axe.string); -// if (!macro_buf[0]) +// if (!macro_buf[0]) // strlcpy(macro_buf, tp_name_none.string, sizeof(macro_buf)); return macro_buf; @@ -442,7 +442,7 @@ static char *Macro_WeaponNum (void) static int _Macro_BestWeapon (void) { int i; - char *t[] = {tp_weapon_order.string, "78654321", NULL}, **s; + char *t[] = {tp_weapon_order.string, "78654321", NULL}, **s; for (s = t; *s; s++) { @@ -472,7 +472,7 @@ static char *Macro_BestAmmo (void) { switch (_Macro_BestWeapon()) { - case IT_SHOTGUN: case IT_SUPER_SHOTGUN: + case IT_SHOTGUN: case IT_SUPER_SHOTGUN: sprintf(macro_buf, "%i", cl.stats[0][STAT_SHELLS]); return macro_buf; @@ -765,6 +765,8 @@ static char *Macro_demoplayback (void) { switch (cls.demoplayback) { + case DPB_EZTV: // warning: enumeration value DPB_EZTV not handled in switch + break; case DPB_NONE: return "0"; case DPB_QUAKEWORLD: @@ -808,7 +810,7 @@ static char *Macro_Match_Name (void) else if (i > 2) { // FFA return va ("%s ffa - %s", - TP_PlayerName(), + TP_PlayerName(), TP_MapName()); } else @@ -886,14 +888,14 @@ static char *Macro_MyStatus_LED(void) for (count = 1; *s; s++) if (*s == separator[0]) count++; - } + } if (count == 0) Q_snprintfz(macro_buf, sizeof(macro_buf), "%s", tp_name_status_green.string); else if (count <= 1) Q_snprintfz(macro_buf, sizeof(macro_buf), "%s", tp_name_status_yellow.string); else - Q_snprintfz(macro_buf, sizeof(macro_buf), "%s", tp_name_status_red.string); + Q_snprintfz(macro_buf, sizeof(macro_buf), "%s", tp_name_status_red.string); return macro_buf; } @@ -919,7 +921,7 @@ static void CountNearbyPlayers(qboolean dead) state = cl.frames[cl.oldparsecount & UPDATE_MASK].playerstate; info = cl.players; - for (i = 0; i < MAX_CLIENTS; i++, info++, state++) { + for (i = 0; i < MAX_CLIENTS; i++, info++, state++) { if (i != cl.playernum[0] && state->messagenum == cl.oldparsecount && !info->spectator && !ISDEAD(state->frame)) { if (cl.teamplay && !strcmp(info->team, TP_PlayerTeam())) vars.numfriendlies++; @@ -1005,7 +1007,7 @@ static char *Macro_LastPointAtLoc (void) if (!vars.pointtime || realtime - vars.pointtime > TP_POINT_EXPIRE_TIME) Q_strncpyz (macro_buf, tp_name_nothing.string, sizeof(macro_buf)); else - Q_snprintfz (macro_buf, sizeof(macro_buf), "%s %s %s", vars.pointname, tp_name_at.string, vars.pointloc[0] ? vars.pointloc : Macro_Location()); + Q_snprintfz (macro_buf, sizeof(macro_buf), "%s %s %s", vars.pointname, tp_name_at.string, vars.pointloc[0] ? vars.pointloc : Macro_Location()); return macro_buf; } @@ -1037,13 +1039,13 @@ static char *Macro_LastSeenPowerup(void) Q_strncatz2(macro_buf, tp_name_quad.string); if (vars.enemy_powerups & TP_PENT) { - if (macro_buf[0]) + if (macro_buf[0]) Q_strncatz2(macro_buf, tp_name_separator.string); Q_strncatz2(macro_buf, tp_name_pent.string); } if (vars.enemy_powerups & TP_RING) { - if (macro_buf[0]) + if (macro_buf[0]) Q_strncatz2(macro_buf, tp_name_separator.string); Q_strncatz2(macro_buf, tp_name_ring.string); } @@ -1220,7 +1222,7 @@ static char *TP_ParseMacroString (char *s) sprintf (mbuf, "%s:%i", macro_string, cl.stats[SP][STAT_ARMOR]); macro_string = mbuf; break; - + case 'h': if (cl.stats[SP][STAT_HEALTH] >= 50) sprintf (macro_buf, "%i", cl.stats[SP][STAT_HEALTH]); @@ -1228,7 +1230,7 @@ static char *TP_ParseMacroString (char *s) sprintf (macro_buf, "\x10%i\x11", cl.stats[SP][STAT_HEALTH]); macro_string = macro_buf; break; - + case 'p': case 'P': macro_string = Macro_Powerups(); @@ -1238,9 +1240,9 @@ static char *TP_ParseMacroString (char *s) mbuf[0] = 0; macro_string = mbuf; break; - + // todo: %[w], %[b] - + default: buf[i++] = *s++; continue; @@ -1252,7 +1254,7 @@ static char *TP_ParseMacroString (char *s) s += 4; // skip %[] continue; } - + // check %a, etc if (*s == '%') { @@ -1270,18 +1272,18 @@ static char *TP_ParseMacroString (char *s) case 'l': macro_string = Macro_Location(); break; case 'L': macro_string = Macro_Last_Location(); break; case 'm': macro_string = Macro_LastTookOrPointed(); break; - + case 'o': macro_string = Macro_CountNearbyFriendlyPlayers(); break; case 'e': macro_string = Macro_CountNearbyEnemyPlayers(); break; case 'O': macro_string = Macro_Count_Last_NearbyFriendlyPlayers(); break; case 'E': macro_string = Macro_Count_Last_NearbyEnemyPlayers(); break; - - case 'P': + + case 'P': case 'p': macro_string = Macro_Powerups(); break; - case 'q': macro_string = Macro_LastSeenPowerup(); break; + case 'q': macro_string = Macro_LastSeenPowerup(); break; // case 'r': macro_string = Macro_LastReportedLoc(); break; - case 's': macro_string = Macro_EnemyStatus_LED(); break; - case 'S': macro_string = Macro_TF_Skin(); break; + case 's': macro_string = Macro_EnemyStatus_LED(); break; + case 'S': macro_string = Macro_TF_Skin(); break; case 't': macro_string = Macro_PointNameAtLocation(); break; case 'u': macro_string = Macro_Need(); break; case 'w': macro_string = Macro_WeaponAndAmmo(); break; @@ -1289,7 +1291,7 @@ static char *TP_ParseMacroString (char *s) case 'X': macro_string = Macro_Took(); break; case 'y': macro_string = Macro_PointLocation(); break; case 'Y': macro_string = Macro_TookLoc(); break; - default: + default: buf[i++] = *s++; continue; } @@ -1386,7 +1388,7 @@ static char *TP_ParseFunChars (char *s, qbool chat) s += 2; continue; } -skip: +skip: *out++ = *s++; } *out = 0; @@ -1511,7 +1513,7 @@ char *TP_LocationName (vec3_t location) vec3_t vec; static qbool recursive; static char buf[MAX_LOC_NAME]; - + if (!loc_numentries || (cls.state != ca_active)) return tp_name_someplace.string; @@ -1611,7 +1613,7 @@ static void TP_MsgTrigger_f (void) Com_Printf ("trigger string too long\n"); return; } - + trig = TP_FindTrigger (name); if (!trig) { @@ -1933,7 +1935,7 @@ static void TP_TeamColor_f (void) else { bottom = TP_ForceColour(Cmd_Argv(2)); } - + // if (top != cl_teamtopcolor || bottom != cl_teambottomcolor) { cl_teamtopcolor = top; @@ -2073,7 +2075,7 @@ int TP_CategorizeMessage (char *s, int *offset, player_info_t **plr) { // no team messages in teamplay 0, except for our own if (cl.spectator) - { + { unsigned int track = Cam_TrackNum(0); if (i == track || ( cl.teamplay && !strcmp(cl.players[track].team, player->team)) ) @@ -2117,7 +2119,7 @@ int TP_CategorizeMessage (char *s, int *offset, player_info_t **plr) // symbolic names used in tp_took, tp_pickup, tp_point commands char *pknames[] = {"quad", "pent", "ring", "suit", "ra", "ya", "ga", "mh", "health", "lg", "rl", "gl", "sng", "ng", "ssg", "pack", -"cells", "rockets", "nails", "shells", "flag", +"cells", "rockets", "nails", "shells", "flag", "teammate", "enemy", "eyes", "sentry", "disp", "runes"}; #define it_quad (1 << 0) @@ -2229,7 +2231,7 @@ static void FlagCommand (int *flags, int defaultflags) { flag = (1<packet_entities; bestdist = 100.0f; @@ -2553,7 +2555,7 @@ static void ExecTookTrigger (char *s, int flag, vec3_t org) pkflags_dmm = pkflags; tookflags_dmm = tookflags; - + if (!cl.teamfortress && cl.deathmatch >= 1 && cl.deathmatch <= 4) { if (cl.deathmatch == 4) { pkflags_dmm &= ~(it_ammo|it_weapons); @@ -3131,7 +3133,7 @@ void TP_StatChanged (int stat, int value) cl.frames[cl.validsequence&UPDATE_MASK].playerstate[cl.playernum[SP]].origin); } } - + if (!cl.spectator && cl.teamfortress && ~value & vars.items & (IT_KEY1|IT_KEY2)) { vars.lastdrop_time = realtime; @@ -3271,7 +3273,7 @@ qbool TP_FilterMessage (char *s) // strip the filter from message if (i && s[i-1] == ' ') { // there's a space just before the filter, remove it - // so that soundtriggers like ^blah #att work + // so that soundtriggers like ^blah #att work s[i-1] = '\n'; s[i] = 0; } else { @@ -3458,7 +3460,7 @@ void CL_Say (qboolean team, char *extra) CL_PrintChat(&cl.players[cl.playernum[SP]], NULL, text, plrflags); } - + //strip out the extra markup for (s = sendtext, d = sendtext; *s; s++, d++) { @@ -3477,7 +3479,7 @@ void CL_Say (qboolean team, char *extra) break; d--; } - + else *d = *s; } @@ -3486,7 +3488,7 @@ void CL_Say (qboolean team, char *extra) //mark the message so that we ignore it when we get the echo. strlcat (sendtext, va("\x7f!%c", 'A'+cl.playernum[0]), sizeof(sendtext)); } - + #ifdef Q3CLIENT if (cls.protocol == CP_QUAKE3) CLQ3_SendClientCommand("%s %s%s", team ? "say_team" : "say", extra?extra:"", sendtext); diff --git a/engine/common/cmd.c b/engine/common/cmd.c index b66f42c52..b9f202c77 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -1100,6 +1100,7 @@ char *Cmd_ExpandCvar(char *cvarname, int maxaccesslevel, int *len) char *fixup = NULL, fixval=0; cvar_t *var; static char temp[12]; + size_t result; namestart = cvarname; if (*cvarname == '{') @@ -1117,7 +1118,7 @@ char *Cmd_ExpandCvar(char *cvarname, int maxaccesslevel, int *len) fixval = *fixup; } - strtol(cvarname, &end, 10); + result = strtol(cvarname, &end, 10); // do something with result if (fixval && *end == '\0') //only expand $0 if its actually ${0} - this avoids conflicting with the $0 macro { //purely numerical ret = Cmd_Argv(atoi(cvarname)); @@ -1303,7 +1304,7 @@ char *Cmd_ExpandStringArguments (char *data, char *dest, int destlen) str = NULL; old_len = 0; } - + if (str) { // check buffer size @@ -2815,7 +2816,7 @@ void Cmd_Condump_f(void) filename = va("%s", filename); COM_DefaultExtension(filename, ".txt", MAX_QPATH); - + f = FS_OpenVFS (filename, "wb", FS_GAME); if (!f) { diff --git a/engine/common/com_mesh.c b/engine/common/com_mesh.c index 0aa4ccd84..d595659d0 100644 --- a/engine/common/com_mesh.c +++ b/engine/common/com_mesh.c @@ -493,7 +493,7 @@ static float Alias_CalculateSkeletalNormals(galiasinfo_t *model) VectorSubtract(xyz[idx[2]], xyz[idx[1]], d2); angle = acos(DotProduct(d1, d2)/(Length(d1)*Length(d2))); VectorMA(normals[mvert[idx[1]]], angle, tn, normals[mvert[idx[1]]]); - + VectorSubtract(xyz[idx[0]], xyz[idx[2]], d1); VectorSubtract(xyz[idx[1]], xyz[idx[2]], d2); angle = acos(DotProduct(d1, d2)/(Length(d1)*Length(d2))); @@ -767,7 +767,7 @@ float *Alias_GetBonePositions(galiasinfo_t *inf, framestate_t *fstate, float *bu galiasgroup_t *g1, *g2; - galiasbone_t *bones = (galiasbone_t *)((char*)inf+inf->ofsbones); + //galiasbone_t *bones = (galiasbone_t *)((char*)inf+inf->ofsbones); //unsed variable if (buffersize < inf->numbones) return NULL; @@ -897,7 +897,7 @@ vec3_t *tempNormals; void R_LightArraysByte_BGR(vecV_t *coords, byte_vec4_t *colours, int vertcount, vec3_t *normals) { - extern cvar_t r_vertexdlights; + //extern cvar_t r_vertexdlights; //unused int i; int c; float l; @@ -948,7 +948,7 @@ void R_LightArrays(vecV_t *coords, avec4_t *colours, int vertcount, vec3_t *norm int i; float l; - float *lightdir = currententity->light_dir; + //float *lightdir = currententity->light_dir; //unused variable if (!currententity->light_range[0] && !currententity->light_range[1] && !currententity->light_range[2]) { @@ -1031,7 +1031,7 @@ void R_LightArrays(vecV_t *coords, avec4_t *colours, int vertcount, vec3_t *norm static void R_LerpFrames(mesh_t *mesh, galiaspose_t *p1, galiaspose_t *p2, float lerp, qbyte alpha, float expand, qboolean nolightdir) { - extern cvar_t r_nolerp, r_nolightdir; + extern cvar_t r_nolerp; // r_nolightdir is unused float blerp = 1-lerp; int i; vecV_t *p1v, *p2v; @@ -1880,7 +1880,9 @@ static void *Alias_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremap daliasinterval_t *intervals; float sinter; +#ifndef SERVERONLY vec3_t *normals, *svec, *tvec; +#endif vecV_t *verts; int aliasframesize; @@ -3603,7 +3605,7 @@ qboolean Mod_LoadQ3Model(model_t *mod, void *buffer) externalskins = LittleLong(surf->numShaders); if (externalskins) { - extern int gl_bumpmappingpossible; + //extern int gl_bumpmappingpossible; // unused variable char shadname[1024]; skin = Hunk_Alloc((LittleLong(surf->numShaders)+externalskins)*((sizeof(galiasskin_t)+sizeof(texnums_t)))); @@ -4200,7 +4202,7 @@ qboolean Mod_LoadPSKModel(model_t *mod, void *buffer) unsigned int num_animinfo=0, num_animkeys=0; int hunkstart, hunkend, hunktotal; - extern cvar_t temp1; + //extern cvar_t temp1; //unused variable /*load the psk*/ while (pos < com_filesize && !fail) @@ -4430,7 +4432,7 @@ qboolean Mod_LoadPSKModel(model_t *mod, void *buffer) } hunkstart = Hunk_LowMark (); - + gmdl = Hunk_Alloc(sizeof(*gmdl)*num_matt); /*bones!*/ @@ -5199,7 +5201,7 @@ galiasinfo_t *Mod_ParseMD5MeshModel(char *buffer) float *vpos = NULL, *tcoord = NULL, *vnorm = NULL, *vtang = NULL; unsigned char *vbone = NULL, *vweight = NULL; unsigned int type, fmt, size, offset; - + varray = (struct iqmvertexarray*)(buffer + h->ofs_vertexarrays); for (i = 0; i < h->num_vertexarrays; i++) { diff --git a/engine/common/common.c b/engine/common/common.c index 0a8c6cc15..0b60e7d1a 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -3015,6 +3015,7 @@ void COM_InitArgv (int argc, const char **argv) //not allowed to tprint { qboolean safe; int i; + size_t result; FILE *f; @@ -3028,7 +3029,7 @@ void COM_InitArgv (int argc, const char **argv) //not allowed to tprint fseek(f, 0, SEEK_SET); buffer = (char*)malloc(len+1); - fread(buffer, 1, len, f); + result = fread(buffer, 1, len, f); // do something with result buffer[len] = '\0'; while (*buffer && (argc < MAX_NUM_ARGVS)) diff --git a/engine/common/cvar.c b/engine/common/cvar.c index 09c9dcc78..4adba90a7 100644 --- a/engine/common/cvar.c +++ b/engine/common/cvar.c @@ -172,7 +172,23 @@ void Cvar_List_f (void) int gnum, i, num = 0; int listflags = 0, cvarflags = 0; char strtmp[512]; - + static char *cvarlist_help = +"cvarlist list all cvars matching given parameters\n" +"Syntax: cvarlist [-FLdhlrv] [-f flag] [-g group] [cvar]\n" +" -F shows cvar flags\n" +" -L shows latched values\n" +" -a shows cvar alternate names\n" +" -d shows default cvar values\n" +" -f shows only cvars with a matching flag, more than one -f can be used\n" +" -g shows only cvar groups using wildcards in group\n" +" -h shows this help message\n" +" -l shows cvar restriction levels\n" +" -r removes group and list headers\n" +" -v shows current values\n" +" cvar indicates the cvar to show, wildcards (*,?) accepted\n" +"Cvar flags are:" +; + gsearch = search = NULL; for (i = 1; i < Cmd_Argc(); i++) { @@ -253,20 +269,7 @@ void Cvar_List_f (void) break; case 'h': // list options - Con_Printf("cvarlist list all cvars matching given parameters\n" - "Syntax: cvarlist [-FLdhlrv] [-f flag] [-g group] [cvar]\n" - " -F shows cvar flags\n" - " -L shows latched values\n" - " -a shows cvar alternate names\n" - " -d shows default cvar values\n" - " -f shows only cvars with a matching flag, more than one -f can be used\n" - " -g shows only cvar groups using wildcards in group\n" - " -h shows this help message\n" - " -l shows cvar restriction levels\n" - " -r removes group and list headers\n" - " -v shows current values\n" - " cvar indicates the cvar to show, wildcards (*,?) accepted\n" - "Cvar flags are:"); + Con_Printf("%s", cvarlist_help); for (num = 1; num <= CVAR_LASTFLAG; num <<= 1) { @@ -329,7 +332,7 @@ void Cvar_List_f (void) Q_strncpyz(strtmp, cmd->name2, 512); Q_strlwr(strtmp); if (!wildcmp(search, strtmp)) - continue; + continue; } else continue; @@ -353,8 +356,8 @@ void Cvar_List_f (void) Con_Printf("(%i) ", cmd->restriction); // print cvar name - Con_Printf(cmd->name); - + Con_Printf("%s", cmd->name); + // print current value if (listflags & CLF_VALUES) { @@ -373,9 +376,9 @@ void Cvar_List_f (void) // print cvar flags if (listflags & CLF_FLAGS) { - for (i = 1; i <= CVAR_LASTFLAG; i <<= 1) + for (i = 1; i <= CVAR_LASTFLAG; i <<= 1) { - if (i & cmd->flags) + if (i & cmd->flags) { var = Cvar_FlagToName(i); if (var) @@ -458,7 +461,7 @@ void Cvar_Reset_f (void) Con_Printf("Invalid option for cvarreset\nUse cvarreset -h for help\n"); return; } - } + } } else search = var; @@ -509,7 +512,7 @@ void Cvar_Reset_f (void) Q_strncpyz(strtmp, cmd->name2, 512); Q_strlwr(strtmp); if (!wildcmp(search, strtmp)) - continue; + continue; } else continue; diff --git a/engine/common/fs_stdio.c b/engine/common/fs_stdio.c index fbd0a3868..3eb501ef4 100644 --- a/engine/common/fs_stdio.c +++ b/engine/common/fs_stdio.c @@ -214,11 +214,13 @@ static qboolean FSSTDIO_FLocate(void *handle, flocation_t *loc, const char *file static void FSSTDIO_ReadFile(void *handle, flocation_t *loc, char *buffer) { FILE *f; + size_t result; + f = fopen(loc->rawname, "rb"); if (!f) //err... return; fseek(f, loc->offset, SEEK_SET); - fread(buffer, 1, loc->len, f); + result = fread(buffer, 1, loc->len, f); // do soemthing with result fclose(f); } static int FSSTDIO_EnumerateFiles (void *handle, const char *match, int (*func)(const char *, int, void *), void *parm) diff --git a/engine/common/fs_zip.c b/engine/common/fs_zip.c index cd995e5ee..0e5487439 100644 --- a/engine/common/fs_zip.c +++ b/engine/common/fs_zip.c @@ -2,7 +2,10 @@ #include "fs.h" #ifdef AVAIL_ZLIB -#define ZEXPORT VARGS + +#ifndef ZEXPORT + #define ZEXPORT VARGS +#endif #include typedef struct { diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index dfa6db2e2..048a0f96b 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -815,7 +815,7 @@ static void CM_CreatePatch( q3cpatch_t *patch, q2mapsurface_t *shaderref, const if( size[0] <= 0 || size[1] <= 0 ) return; - data = BZ_Malloc( size[0] * size[1] * sizeof( vecV_t ) + + data = BZ_Malloc( size[0] * size[1] * sizeof( vecV_t ) + ( size[0]-1 ) * ( size[1]-1 ) * 2 * ( sizeof( q2cbrush_t ) + 32 * sizeof( mplane_t ) ) ); points = ( vecV_t * )data; data += size[0] * size[1] * sizeof( vecV_t ); @@ -4384,7 +4384,7 @@ unsigned int CM_NativeContents(struct model_s *model, int hulloverride, int fram if ( (contents & brush->contents) == brush->contents ) { continue; } - + brushside = brush->brushside; for ( j = 0; j < brush->numsides; j++, brushside++ ) { @@ -4392,7 +4392,7 @@ unsigned int CM_NativeContents(struct model_s *model, int hulloverride, int fram break; } - if (j == brush->numsides) + if (j == brush->numsides) contents |= brush->contents; } } @@ -5660,7 +5660,9 @@ and recalculates the area connections */ void CM_ReadPortalState (FILE *f) { - fread (portalopen, 1, sizeof(portalopen), f); + size_t result; + + result = fread (portalopen, 1, sizeof(portalopen), f); // do something with result FloodAreaConnections (); } diff --git a/engine/common/log.c b/engine/common/log.c index 2a2b10d38..8375f83b9 100644 --- a/engine/common/log.c +++ b/engine/common/log.c @@ -277,8 +277,8 @@ void SV_LogPlayer(client_t *cl, char *msg) return; //don't log botclients snprintf(line, sizeof(line), - "%s\\%s\\%i\\%s\\%s\\%i%s\n", - msg, cl->name, cl->userid, + "%s\\%s\\%i\\%s\\%s\\%i%s\n", + msg, cl->name, cl->userid, NET_BaseAdrToString(remote_adr, sizeof(remote_adr), cl->netchan.remote_address), (cl->realip_status > 0 ? NET_BaseAdrToString(realip_adr, sizeof(realip_adr), cl->realip) : "??"), cl->netchan.remote_address.port, cl->userinfo); @@ -311,7 +311,7 @@ void Log_Logfile_f (void) if (log_name[LOG_CONSOLE].string[0]) f = log_name[LOG_CONSOLE].string; - Con_Printf(va("Logging to %s/%s.log.\n", d, f)); + Con_Printf("%s", va("Logging to %s/%s.log.\n", d, f)); Cvar_SetValue(&log_enable[LOG_CONSOLE], 1); } diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c index d3224e495..a6c90042b 100644 --- a/engine/common/net_wins.c +++ b/engine/common/net_wins.c @@ -329,7 +329,7 @@ qboolean NET_AddressSmellsFunny(netadr_t a) case NA_IPX: return false; #endif - + case NA_LOOPBACK: return false; @@ -360,19 +360,19 @@ char *NET_AdrToString (char *s, int len, netadr_t a) case NA_IP: if (a.port) { - snprintf (s, len, "%i.%i.%i.%i:%i", - a.address.ip[0], - a.address.ip[1], - a.address.ip[2], - a.address.ip[3], + snprintf (s, len, "%i.%i.%i.%i:%i", + a.address.ip[0], + a.address.ip[1], + a.address.ip[2], + a.address.ip[3], ntohs(a.port)); } else { - snprintf (s, len, "%i.%i.%i.%i", - a.address.ip[0], - a.address.ip[1], - a.address.ip[2], + snprintf (s, len, "%i.%i.%i.%i", + a.address.ip[0], + a.address.ip[1], + a.address.ip[2], a.address.ip[3]); } break; @@ -429,7 +429,7 @@ char *NET_AdrToString (char *s, int len, netadr_t a) } } - snprintf (p, len-strlen(s), "]:%i", + snprintf (p, len-strlen(s), "]:%i", ntohs(a.port)); break; #endif @@ -480,8 +480,8 @@ char *NET_BaseAdrToString (char *s, int len, netadr_t a) { case NA_BROADCAST_IP: case NA_IP: - snprintf (s, len, "%i.%i.%i.%i", - a.address.ip[0], + snprintf (s, len, "%i.%i.%i.%i", + a.address.ip[0], a.address.ip[1], a.address.ip[2], a.address.ip[3]); @@ -531,7 +531,7 @@ char *NET_BaseAdrToString (char *s, int len, netadr_t a) #ifdef USEIPX case NA_BROADCAST_IPX: case NA_IPX: - snprintf (s, len, "%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x", + snprintf (s, len, "%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x", a.address.ipx[0], a.address.ipx[1], a.address.ipx[2], @@ -620,7 +620,7 @@ qboolean NET_StringToSockaddr (const char *s, struct sockaddr_qstorage *sadr) char *port; char dupbase[256]; int len; - + memset(&udp6hint, 0, sizeof(udp6hint)); udp6hint.ai_family = 0;//Any... we check for AF_INET6 or 4 udp6hint.ai_socktype = SOCK_DGRAM; @@ -693,7 +693,7 @@ dblbreak: if (strlen(s) >= sizeof(copy)-1) return false; - + strcpy (copy, s); // strip off a trailing :port if present for (colon = copy ; *colon ; colon++) @@ -802,7 +802,7 @@ qboolean NET_StringToAdr (const char *s, netadr_t *a) } // NET_IntegerToMask: given a source address pointer, a mask address pointer, and -// desired number of bits, fills the mask pointer with given bits +// desired number of bits, fills the mask pointer with given bits // (bits < 0 will always fill all bits) void NET_IntegerToMask (netadr_t *a, netadr_t *amask, int bits) { @@ -861,9 +861,9 @@ void NET_IntegerToMask (netadr_t *a, netadr_t *amask, int bits) } #endif break; -#ifdef USEIPX case NA_IPX: case NA_BROADCAST_IPX: +#ifdef USEIPX n = amask->address.ipx; if (i > 80) i = 80; @@ -884,6 +884,12 @@ void NET_IntegerToMask (netadr_t *a, netadr_t *amask, int bits) break; case NA_LOOPBACK: break; + // warning: enumeration value NA_* not handled in switch + case NA_TCP: + case NA_TCPV6: + case NA_IRC: + break; + } } @@ -912,8 +918,8 @@ int ParsePartialIPv4(const char *s, netadr_t *a) if (colon) // no colons before periods (probably invalid anyway) return 0; else if (bits >= 32) // only 32 bits in ipv4 - return 0; - else if (*(s+1) == '.') + return 0; + else if (*(s+1) == '.') return 0; else if (*(s+1) == '\0') break; // don't add more bits to the mask for x.x., etc @@ -958,7 +964,7 @@ qboolean NET_StringToAdrMasked (const char *s, netadr_t *a, netadr_t *amask) if (!ParsePartialIPv4(t, a) && !NET_StringToAdr(t, a)) return false; spoint++; - + c = spoint; if (!*c) return false; @@ -1091,7 +1097,7 @@ qboolean NET_CompareAdrMasked(netadr_t a, netadr_t b, netadr_t mask) #ifdef IRCCONNECT case NA_IRC: - //masks are not supported, match explicitly + //masks are not supported, match explicitly if (strcmp(a.address.irc.user, b.address.irc.user)) return false; break; @@ -1363,7 +1369,7 @@ qboolean FTENET_AddToCollection(ftenet_connections_t *col, const char *name, con if (col->conn[i]->ChangeLocalAddress(col->conn[i], address)) return true; } - + col->conn[i]->Close(col->conn[i]); col->conn[i] = NULL; break; @@ -2134,7 +2140,7 @@ qboolean FTENET_IRCConnect_GetPacket(ftenet_generic_connection_t *gcon) cvar_t *ircuser = Cvar_Get("ircuser", "none", 0, "IRC Connect"); cvar_t *irchost = Cvar_Get("irchost", "none", 0, "IRC Connect"); cvar_t *ircnick = Cvar_Get("ircnick", "ftesv", 0, "IRC Connect"); - cvar_t *ircchannel = Cvar_Get("ircchannel", "#ftetest", 0, "IRC Connect"); + //cvar_t *ircchannel = Cvar_Get("ircchannel", "#ftetest", 0, "IRC Connect"); //warning: unused variable ircchannel cvar_t *ircsomething = Cvar_Get("ircsomething", "moo", 0, "IRC Connect"); cvar_t *ircclientaddr = Cvar_Get("ircclientaddr", "127.0.0.1", 0, "IRC Connect"); @@ -2266,7 +2272,7 @@ qboolean FTENET_IRCConnect_GetPacket(ftenet_generic_connection_t *gcon) net_from.address.irc.channel[0] = 0; } } - + while(*s == ' ') s++; @@ -2339,7 +2345,7 @@ qboolean FTENET_IRCConnect_GetPacket(ftenet_generic_connection_t *gcon) else if (*s >= '0' && *s <= '9') psize += *s - '0'; s++; - + psize*=16; if (*s >= 'a' && *s <= 'f') psize += *s - 'a' + 10; @@ -2385,7 +2391,7 @@ qboolean FTENET_IRCConnect_GetPacket(ftenet_generic_connection_t *gcon) break; //ignore these - case '\n': + case '\n': case '\r': case '\0': //this one doesn't have to be ignored. break; @@ -2397,7 +2403,7 @@ qboolean FTENET_IRCConnect_GetPacket(ftenet_generic_connection_t *gcon) } s++; } - + if (st->inlen > psize || psize >= sizeof(net_message_buffer) ) { st->inlen = 0; @@ -2462,7 +2468,7 @@ qboolean FTENET_IRCConnect_GetPacket(ftenet_generic_connection_t *gcon) } send(con->generic.thesocket, "\r\n", 2, 0); break; - case 0: + case 0: //non-numerical event. break; } @@ -2631,7 +2637,7 @@ struct ftenet_generic_connection_s *FTENET_IRCConnect_EstablishConnection(qboole if (!NET_StringToAdr(address, &adr)) return NULL; //couldn't resolve the name - + newcon = Z_Malloc(sizeof(*newcon)); if (newcon) @@ -2706,7 +2712,7 @@ int NET_LocalAddressForRemote(ftenet_connections_t *collection, netadr_t *remote if (!remote->connum) return 0; - if (!collection->conn[remote->connum-1]) + if (!collection->conn[remote->connum-1]) return 0; if (!collection->conn[remote->connum-1]->GetLocalAddress) @@ -3203,11 +3209,11 @@ void SVNET_AddPort(void) FTENET_AddToCollection(svs.sockets, NULL, s, FTENET_UDP6_EstablishConnection, true); break; #endif -#ifdef USEIPX case NA_IPX: +#ifdef USEIPX FTENET_AddToCollection(svs.sockets, NULL, s, FTENET_IPX_EstablishConnection, true); - break; #endif + break; #ifdef IRCCONNECT case NA_IRC: FTENET_AddToCollection(svs.sockets, NULL, s, FTENET_IRCConnect_EstablishConnection, true); @@ -3223,6 +3229,13 @@ void SVNET_AddPort(void) break; #endif #endif + // warning: enumeration value NA_* not handled in switch + case NA_INVALID: + case NA_LOOPBACK: + case NA_BROADCAST_IP: + case NA_BROADCAST_IP6: + case NA_BROADCAST_IPX: + break; } } #endif diff --git a/engine/common/qvm.c b/engine/common/qvm.c index 6ab197fb8..549908099 100644 --- a/engine/common/qvm.c +++ b/engine/common/qvm.c @@ -129,7 +129,7 @@ dllhandle_t *QVM_LoadDLL(const char *name, void **vmMain, sys_calldll_t syscall) { break; } - + snprintf (fname, sizeof(fname), "%s/%s", gpath, dllname_anycpu); Con_DPrintf("Loading native: %s\n", fname); diff --git a/engine/common/translate.c b/engine/common/translate.c index 0f9ca4a47..0e7a454f8 100644 --- a/engine/common/translate.c +++ b/engine/common/translate.c @@ -3,7 +3,7 @@ #undef malloc #undef free -static char *defaultlanguagetext = +static char *defaultlanguagetext = "STL_LANGUAGENAME \"English\"\n" "TL_NL \"\\n\"\n" "TL_STNL \"%s\\n\"\n" @@ -312,7 +312,7 @@ void TranslateReset(void) s++; } - fputc('"', F); + fputc('"', F); } else fprintf(F, "\"%s\"", trans->english); @@ -454,7 +454,7 @@ void TranslateReset(void) s2++; } // strcpy(trans->foreign, fore); - goto next; + goto next; } else if (*s == '\\') //skip s++; @@ -464,7 +464,7 @@ void TranslateReset(void) else if (*s == '\\') //skip s++; s++; - } + } } else if (*s == '\\') //skip s++; @@ -540,7 +540,7 @@ char *languagetext[STL_MAXSTL][MAX_LANGUAGES]; void TL_ParseLanguage (char *name, char *data, int num) //this is one of the first functions to be called. so it mustn't use any quake subsystem routines { - int i; + int i; char *s; s = data; @@ -554,8 +554,8 @@ void TL_ParseLanguage (char *name, char *data, int num) //this is one of the fir { if (!strcmp(com_token, langtext(i, 0))) //lang 0 is actually the string names. break; - } - + } + s = COM_ParseCString(s); if (i == STL_MAXSTL) //silently ignore - allow other servers or clients to add stuff continue; @@ -571,6 +571,7 @@ void TL_LoadLanguage (char *name, char *shortname, int num) //this is one of the FILE *f; int size; char *buffer; + size_t result; f = fopen(va("%s.trl", shortname), "rb"); if (!f) @@ -580,7 +581,7 @@ void TL_LoadLanguage (char *name, char *shortname, int num) //this is one of the fseek(f, 0, SEEK_SET); buffer = malloc(size+1); buffer[size] = '\0'; - fread(buffer, 1, size, f); + result = fread(buffer, 1, size, f); // do something with result fclose(f); TL_ParseLanguage(name, buffer, num); @@ -630,7 +631,7 @@ char *TL_ExpandToCString(char *in) in++; } *out = '\0'; - + return buffer; } char *TL_ExpandToDoubleCString(char *in) //TL_ExpandToCString twice @@ -659,7 +660,7 @@ char *TL_ExpandToDoubleCString(char *in) //TL_ExpandToCString twice in++; } *out = '\0'; - + return TL_ExpandToCString(buffer); } void TL_WriteTLHeader(void) @@ -691,7 +692,7 @@ void TL_InitLanguages(void) #include "translate.h" #undef NAME /* - #define ENGLISH(i, s) (languagetext[i][1] = s) + #define ENGLISH(i, s) (languagetext[i][1] = s) #undef ENGLISH */ TL_ParseLanguage("English", defaultlanguagetext, 1); diff --git a/engine/d3d/d3d_image.c b/engine/d3d/d3d_image.c index cf5369d02..ffc8f897d 100644 --- a/engine/d3d/d3d_image.c +++ b/engine/d3d/d3d_image.c @@ -209,7 +209,7 @@ static LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_32(d3dtexture_t *tex, unsigned in return NULL; } */ - + nwidth = width; nheight = height; D3D9_RoundDimensions(&nwidth, &nheight, !(flags & IF_NOMIPMAP)); @@ -370,6 +370,24 @@ texid_t D3D9_LoadTexture (char *identifier, int width, int height, enum uploadfm return r_nulltex; } break; + case TF_INVALID: + case TF_RGBA32: + case TF_BGRA32: + case TF_RGBX32: + case TF_RGB24: + case TF_BGR24_FLIP: + case TF_SOLID8: + case TF_TRANS8: + case TF_HEIGHT8: + case TF_HEIGHT8PAL: + case TF_H2_T7G1: + case TF_H2_TRANS8_0: + case TF_H2_T4A4: + case TF_PALETTES: + case TF_8PAL24: + case TF_8PAL32: + break; + } tex = d3d_lookup_texture(identifier); diff --git a/engine/d3d/vid_d3d.c b/engine/d3d/vid_d3d.c index 90acdb6c9..d356cbda2 100644 --- a/engine/d3d/vid_d3d.c +++ b/engine/d3d/vid_d3d.c @@ -325,7 +325,7 @@ static LRESULT WINAPI D3D9_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA // JACK: This is the mouse wheel with the Intellimouse // Its delta is either positive or neg, and we generate the proper // Event. - case WM_MOUSEWHEEL: + case WM_MOUSEWHEEL: if (!vid_initializing) { if ((short) HIWORD(wParam) > 0) @@ -413,7 +413,7 @@ static LRESULT WINAPI D3D9_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA case MM_MCINOTIFY: lRet = CDAudio_MessageHandler (hWnd, uMsg, wParam, lParam); break; - + default: /* pass all unhandled messages to DefWindowProc */ lRet = DefWindowProc (hWnd, uMsg, wParam, lParam); @@ -440,8 +440,8 @@ static void resetD3D9(void) - - + + //IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRENDERSTATE_DITHERENABLE, FALSE); @@ -527,7 +527,7 @@ static qboolean initD3D9Device(HWND hWnd, rendererstate_t *info, unsigned int de pD3DDev9 = NULL; // create a device class using this information and information from the d3dpp stuct - err = IDirect3D9_CreateDevice(pD3D, + err = IDirect3D9_CreateDevice(pD3D, devno, devtype, hWnd, @@ -674,7 +674,7 @@ static qboolean D3D9_VID_Init(rendererstate_t *info, unsigned char *palette) wstyle = 0; else wstyle = WS_OVERLAPPEDWINDOW; - + rect.left = rect.top = 0; rect.right = info->width; rect.bottom = info->height; @@ -689,10 +689,10 @@ static qboolean D3D9_VID_Init(rendererstate_t *info, unsigned char *palette) - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); } ShowWindow(mainwindow, SW_NORMAL); @@ -813,7 +813,7 @@ static char *(D3D9_VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevi { if (!FAILED(IDirect3DSurface9_GetDesc(backbuf, &desc))) if (desc.Format == D3DFMT_X8R8G8B8 || desc.Format == D3DFMT_A8R8G8B8) - if (!FAILED(IDirect3DDevice9_CreateOffscreenPlainSurface(pD3DDev9, + if (!FAILED(IDirect3DDevice9_CreateOffscreenPlainSurface(pD3DDev9, desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &surf, NULL)) ) @@ -850,7 +850,7 @@ static char *(D3D9_VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevi } IDirect3DSurface9_Release(backbuf); } - + return ret; } static void (D3D9_VID_SetWindowCaption) (char *msg) @@ -934,7 +934,7 @@ static void (D3D9_SCR_UpdateScreen) (void) scr_disabled_for_loading = false; } else - { + { IDirect3DDevice9_BeginScene(pD3DDev9); scr_drawloading = true; SCR_DrawLoading (); @@ -975,7 +975,7 @@ static void (D3D9_SCR_UpdateScreen) (void) if (key_dest == key_console) Con_DrawConsole(vid_conheight.value/2, false); - GL_EndRendering (); + GL_EndRendering (); GL_DoSwap(); RSpeedEnd(RSPEED_TOTALREFRESH); return; diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index 4ce81b12e..735f7a2bb 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -225,7 +225,7 @@ static texnums_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, galiascolourmapped_t *cm; char hashname[512]; -// if (e->scoreboard->skin->cachedbpp +// if (e->scoreboard->skin->cachedbpp /* if (cls.protocol == CP_QUAKE2) { @@ -343,7 +343,7 @@ static texnums_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, texnums->base = e->scoreboard->skin->tex_base; return texnums; } - + cm->texnum.base = R_LoadHiResTexture(e->scoreboard->skin->name, "skins", IF_NOALPHA); return &cm->texnum; } @@ -450,9 +450,9 @@ static texnums_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, for(i=0;i<256;i++) { translate32[i] = d_8to24rgbtable[i]; - if (tc > 0 && (colorA[i] != 255)) + if (tc > 0 && (colorA[i] != 255)) translate32[i] = d_8to24rgbtable[sourceA[i]]; - if (bc > 0 && (colorB[i] != 255)) + if (bc > 0 && (colorB[i] != 255)) translate32[i] = d_8to24rgbtable[sourceB[i]]; } translate32[0] = 0; @@ -843,7 +843,7 @@ static qboolean R_CalcModelLighting(entity_t *e, model_t *clmodel) if ((e->model->flags & EF_ROTATE) && cl.hexen2pickups) { - shadelight[0] = shadelight[1] = shadelight[2] = + shadelight[0] = shadelight[1] = shadelight[2] = ambientlight[0] = ambientlight[1] = ambientlight[2] = 128+sin(cl.servertime*4)*64; } if ((e->drawflags & MLS_MASKIN) == MLS_ABSLIGHT) @@ -1938,6 +1938,11 @@ void BE_GenModelBatches(batch_t **batches) case mod_sprite: R_Sprite_GenerateBatch(ent, batches, R_DB_Sprite); break; + // warning: enumeration value mod_* not handled in switch + case mod_dummy: + case mod_halflife: + case mod_heightmap: + break; } break; case RT_SPRITE: diff --git a/engine/gl/gl_shader.c b/engine/gl/gl_shader.c index c0291555d..f746b0393 100644 --- a/engine/gl/gl_shader.c +++ b/engine/gl/gl_shader.c @@ -844,7 +844,7 @@ struct sbuiltin_s int apiver; char name[MAX_QPATH]; char *body; -} sbuiltins[] = +} sbuiltins[] = { #ifdef GLQUAKE /*a quick note on glsl versions: @@ -1187,7 +1187,7 @@ struct sbuiltin_s " vec4 fb = texture2D(s_t3, tc);\n" " col.rgb = mix(col.rgb, fb.rgb, fb.a);\n" "#endif\n" - " gl_FragColor = col * e_colourident;\n" + " gl_FragColor = col * e_colourident;\n" "}\n" "#endif\n" }, @@ -1251,7 +1251,7 @@ struct sbuiltin_s " vec4 fb = texture2D(s_t3, tc);\n" " col.rgb = mix(col.rgb, fb.rgb, fb.a);\n" "#endif\n" - " gl_FragColor = col * e_colourident;\n" + " gl_FragColor = col * e_colourident;\n" "}\n" "#endif\n" }, @@ -1441,7 +1441,7 @@ static void Shader_ProgAutoFields(program_t *prog, char **cvarfnames) cvar = Cvar_FindVar(tmpname); if (!cvar) continue; - cvar->flags |= CVAR_SHADERSYSTEM; + cvar->flags |= CVAR_SHADERSYSTEM; for (p = 0; p < PERMUTATIONS; p++) { if (!prog->handle[p].glsl) @@ -2276,7 +2276,7 @@ static void Shaderpass_Scale ( shader_t *shader, shaderpass_t *pass, char **ptr { tcmod->args[0] = atof(token); } - + while (**ptr == ' ' || **ptr == '\t') *ptr+=1; if (**ptr == ',') @@ -2543,7 +2543,7 @@ static void Shader_MakeCache ( char *path ) cache->hash_next = shader_hash[key]; cache->path = path; cache->offset = ptr - buf; - Com_sprintf ( cache->name, MAX_QPATH, token ); + Com_sprintf ( cache->name, MAX_QPATH, "%s", token ); // warning: format not a string literal and no format arguments shader_hash[key] = cache; ptr = Shader_Skip ( ptr ); @@ -4012,7 +4012,7 @@ static qboolean Shader_ParseShader(char *shortname, char *usename, shader_t *s) Shader_Free(s); memset ( s, 0, sizeof( shader_t ) ); - Com_sprintf ( s->name, MAX_QPATH, usename ); + Com_sprintf ( s->name, MAX_QPATH, "%s",usename ); // warning: format not a string literal and no format arguments Hash_Add(&shader_active_hash, s->name, s, &s->bucket); Shader_ReadShader(s, file); @@ -4131,9 +4131,9 @@ static int R_LoadShader ( char *name, shader_gen_t *defaultgen, const char *gena if (defaultgen) { memset(s, 0, sizeof(shader_t)); - Com_sprintf(s->name, MAX_QPATH, shortname); + Com_sprintf(s->name, MAX_QPATH, "%s", shortname); // warning: format not a string literal and no format arguments if (!strcmp(shortname, "textures/common/clip")) - Shader_DefaultScript(shortname, s, + Shader_DefaultScript(shortname, s, "{\n" "surfaceparm nodraw\n" "surfaceparm nodlight\n" @@ -4218,7 +4218,7 @@ void Shader_DoReload(void) s->generator = defaultgen; s->genargs = genargs; - Com_sprintf ( s->name, MAX_QPATH, shortname ); + Com_sprintf ( s->name, MAX_QPATH, "%s", shortname ); // warning: format not a string literal and no format arguments Hash_Add(&shader_active_hash, s->name, s, &s->bucket); R_BuildDefaultTexnums(&oldtn, s); } diff --git a/engine/gl/gl_shadow.c b/engine/gl/gl_shadow.c index e3ad24602..601304cda 100644 --- a/engine/gl/gl_shadow.c +++ b/engine/gl/gl_shadow.c @@ -72,7 +72,7 @@ static void SHM_End (void) if (sh_shmesh->maxindicies != i) { sh_shmesh->maxindicies = i; - sh_shmesh->indicies = BZ_Realloc(sh_shmesh->indicies, i * sizeof(*sh_shmesh->indicies)); + sh_shmesh->indicies = BZ_Realloc(sh_shmesh->indicies, i * sizeof(*sh_shmesh->indicies)); } //add the extra triangles for (i = 0; i < sh_vertnum; i+=4) @@ -310,7 +310,7 @@ static void SHM_RecursiveWorldNodeQ1_r (dlight_t *dl, mnode_t *node) if (dl->origin[c] - dl->radius > node->minmaxs[3+c]) return; } - + // if a leaf node, draw stuff if (node->contents < 0) { @@ -497,7 +497,7 @@ static void SHM_RecursiveWorldNodeQ2_r (dlight_t *dl, mnode_t *node) if (dl->origin[c] - dl->radius > node->minmaxs[3+c]) return; } - + // if a leaf node, draw stuff if (node->contents != -1) { @@ -1564,7 +1564,8 @@ static void Sh_DrawShadowMapLight(dlight_t *l, vec3_t colour, qbyte *vvis) - +// warning: Sh_WorldLightingPass defined but not used +/* static void Sh_WorldLightingPass(void) { msurface_t *s; @@ -1590,6 +1591,7 @@ static void Sh_WorldLightingPass(void) RQuantAdd(RQUANT_LITFACES, s->mesh->numindexes); } } +*/ /* draws faces facing the light @@ -1701,7 +1703,7 @@ static void Sh_DrawBrushModelShadow(dlight_t *dl, entity_t *e) qglVertex3f (v2[0]+v4[0], v2[1]+v4[1], v2[2]+v4[2]); qglEnd(); } - + //back //the same applies as earlier qglBegin(GL_POLYGON); @@ -1890,7 +1892,7 @@ static qboolean Sh_DrawStencilLight(dlight_t *dl, vec3_t colour, qbyte *vvis) qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL); }*/ #endif - + if (qglStencilOpSeparateATI) { qglClearStencil(0); diff --git a/engine/gl/gl_warp.c b/engine/gl/gl_warp.c index 5ac3ed238..959d8cace 100644 --- a/engine/gl/gl_warp.c +++ b/engine/gl/gl_warp.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -121,7 +121,7 @@ static vec3_t skyclip[6] = { {0,-1,1}, {0,1,1}, {1,0,1}, - {-1,0,1} + {-1,0,1} }; // 1 = s, 2 = t, 3 = 2048 @@ -459,7 +459,7 @@ static void R_DrawSkyMesh(batch_t *batch, mesh_t *m, shader_t *shader) { static entity_t skyent; batch_t b; - float time = cl.gametime+realtime-cl.gametimemark; + //float time = cl.gametime+realtime-cl.gametimemark; //warning: unused variable time float skydist = gl_skyboxdist.value; if (skydist<1) diff --git a/engine/qclib/pr_edict.c b/engine/qclib/pr_edict.c index 3606bede0..7bbae0dc1 100644 --- a/engine/qclib/pr_edict.c +++ b/engine/qclib/pr_edict.c @@ -1055,7 +1055,7 @@ pbool ED_ParseEpair (progfuncs_t *progfuncs, void *base, ddefXX_t *key, char *s, string_t st; dfunction_t *func; - int type; + int type = 0; // warning about beign used without initializing it switch(structtype) { @@ -1215,7 +1215,7 @@ char *ED_ParseEdict (progfuncs_t *progfuncs, char *data, edictrun_t *ent) if (!data) { printf ("ED_ParseEntity: EOF without closing brace\n"); - return NULL; + return NULL; } if (qcc_token[0] == '}') @@ -2678,7 +2678,7 @@ retry: { int j; qtest_function_t qtfunc = ((qtest_function_t*)fnc)[i]; - + fnc[i].first_statement = PRLittleLong (qtfunc.first_statement); fnc[i].parm_start = PRLittleLong (qtfunc.parm_start); fnc[i].s_name = (string_t)PRLittleLong (qtfunc.s_name); diff --git a/engine/qclib/pr_exec.c b/engine/qclib/pr_exec.c index 02ccf9335..3e2601034 100644 --- a/engine/qclib/pr_exec.c +++ b/engine/qclib/pr_exec.c @@ -624,7 +624,7 @@ int PR_ToggleBreakpoint(progfuncs_t *progfuncs, char *filename, int linenum, int unsigned int i; int pn = pr_typecurrent; dfunction_t *f; - int op; + int op = 0; //warning about not being initialized before use for (pn = 0; (unsigned)pn < maxprogs; pn++) { @@ -843,7 +843,7 @@ void PR_ExecuteCode (progfuncs_t *progfuncs, int s) { eval_t *t, *swtch=NULL; - int swtchtype; + int swtchtype = 0; //warning about not being initialized before use dstatement16_t *st16; dstatement32_t *st32; dfunction_t *newf; diff --git a/engine/qclib/qcc_pr_comp.c b/engine/qclib/qcc_pr_comp.c index cd3e24af2..6e04b89c6 100644 --- a/engine/qclib/qcc_pr_comp.c +++ b/engine/qclib/qcc_pr_comp.c @@ -219,13 +219,13 @@ QCC_opcode_t pr_opcodes[] = {6, "==", "EQ_S", 5, ASSOC_LEFT, &type_string, &type_string, &type_float}, {6, "==", "EQ_E", 5, ASSOC_LEFT, &type_entity, &type_entity, &type_float}, {6, "==", "EQ_FNC", 5, ASSOC_LEFT, &type_function, &type_function, &type_float}, - + {6, "!=", "NE_F", 5, ASSOC_LEFT, &type_float, &type_float, &type_float}, {6, "!=", "NE_V", 5, ASSOC_LEFT, &type_vector, &type_vector, &type_float}, {6, "!=", "NE_S", 5, ASSOC_LEFT, &type_string, &type_string, &type_float}, {6, "!=", "NE_E", 5, ASSOC_LEFT, &type_entity, &type_entity, &type_float}, {6, "!=", "NE_FNC", 5, ASSOC_LEFT, &type_function, &type_function, &type_float}, - + {6, "<=", "LE", 5, ASSOC_LEFT, &type_float, &type_float, &type_float}, {6, ">=", "GE", 5, ASSOC_LEFT, &type_float, &type_float, &type_float}, {6, "<", "LT", 5, ASSOC_LEFT, &type_float, &type_float, &type_float}, @@ -255,31 +255,31 @@ QCC_opcode_t pr_opcodes[] = {6, "=", "STOREP_FNC", 6, ASSOC_RIGHT, &type_pointer, &type_function, &type_function}, {6, "", "RETURN", -1, ASSOC_LEFT, &type_float, &type_void, &type_void}, - + {6, "!", "NOT_F", -1, ASSOC_LEFT, &type_float, &type_void, &type_float}, {6, "!", "NOT_V", -1, ASSOC_LEFT, &type_vector, &type_void, &type_float}, {6, "!", "NOT_S", -1, ASSOC_LEFT, &type_vector, &type_void, &type_float}, {6, "!", "NOT_ENT", -1, ASSOC_LEFT, &type_entity, &type_void, &type_float}, {6, "!", "NOT_FNC", -1, ASSOC_LEFT, &type_function, &type_void, &type_float}, - + {6, "", "IF", -1, ASSOC_RIGHT, &type_float, NULL, &type_void}, {6, "", "IFNOT", -1, ASSOC_RIGHT, &type_float, NULL, &type_void}, - + // calls returns REG_RETURN {6, "", "CALL0", -1, ASSOC_LEFT, &type_function, &type_void, &type_void}, {6, "", "CALL1", -1, ASSOC_LEFT, &type_function, &type_void, &type_void}, - {6, "", "CALL2", -1, ASSOC_LEFT, &type_function, &type_void, &type_void}, - {6, "", "CALL3", -1, ASSOC_LEFT, &type_function, &type_void, &type_void}, + {6, "", "CALL2", -1, ASSOC_LEFT, &type_function, &type_void, &type_void}, + {6, "", "CALL3", -1, ASSOC_LEFT, &type_function, &type_void, &type_void}, {6, "", "CALL4", -1, ASSOC_LEFT, &type_function, &type_void, &type_void}, {6, "", "CALL5", -1, ASSOC_LEFT, &type_function, &type_void, &type_void}, {6, "", "CALL6", -1, ASSOC_LEFT, &type_function, &type_void, &type_void}, {6, "", "CALL7", -1, ASSOC_LEFT, &type_function, &type_void, &type_void}, {6, "", "CALL8", -1, ASSOC_LEFT, &type_function, &type_void, &type_void}, - + {6, "", "STATE", -1, ASSOC_LEFT, &type_float, &type_float, &type_void}, - + {6, "", "GOTO", -1, ASSOC_RIGHT, NULL, &type_void, &type_void}, - + {6, "&&", "AND", 7, ASSOC_LEFT, &type_float, &type_float, &type_float}, {6, "||", "OR", 7, ASSOC_LEFT, &type_float, &type_float, &type_float}, @@ -346,8 +346,8 @@ QCC_opcode_t pr_opcodes[] = //Later are additions by DMW. {7, "", "CALL1H", -1, ASSOC_LEFT, &type_function, &type_vector, &type_void}, - {7, "", "CALL2H", -1, ASSOC_LEFT, &type_function, &type_vector, &type_vector}, - {7, "", "CALL3H", -1, ASSOC_LEFT, &type_function, &type_vector, &type_vector}, + {7, "", "CALL2H", -1, ASSOC_LEFT, &type_function, &type_vector, &type_vector}, + {7, "", "CALL3H", -1, ASSOC_LEFT, &type_function, &type_vector, &type_vector}, {7, "", "CALL4H", -1, ASSOC_LEFT, &type_function, &type_vector, &type_vector}, {7, "", "CALL5H", -1, ASSOC_LEFT, &type_function, &type_vector, &type_vector}, {7, "", "CALL6H", -1, ASSOC_LEFT, &type_function, &type_vector, &type_vector}, @@ -361,7 +361,7 @@ QCC_opcode_t pr_opcodes[] = {7, "+", "ADD_I", 4, ASSOC_LEFT, &type_integer, &type_integer, &type_integer}, {7, "+", "ADD_FI", 4, ASSOC_LEFT, &type_float, &type_integer, &type_float}, {7, "+", "ADD_IF", 4, ASSOC_LEFT, &type_integer, &type_float, &type_float}, - + {7, "-", "SUB_I", 4, ASSOC_LEFT, &type_integer, &type_integer, &type_integer}, {7, "-", "SUB_FI", 4, ASSOC_LEFT, &type_float, &type_integer, &type_float}, {7, "-", "SUB_IF", 4, ASSOC_LEFT, &type_integer, &type_float, &type_float}, @@ -469,7 +469,7 @@ QCC_opcode_t pr_opcodes[] = {7, "!=", "NE_IF", 5, ASSOC_LEFT, &type_integer, &type_float, &type_integer}, {7, "!=", "NE_FI", 5, ASSOC_LEFT, &type_float, &type_float, &type_integer}, - + @@ -702,7 +702,7 @@ QCC_opcode_t *opcodeprioritized[TOP_PRIORITY+1][128] = &pr_opcodes[OP_EQ_I], &pr_opcodes[OP_EQ_IF], &pr_opcodes[OP_EQ_FI], - + &pr_opcodes[OP_NE_F], &pr_opcodes[OP_NE_V], &pr_opcodes[OP_NE_S], @@ -711,7 +711,7 @@ QCC_opcode_t *opcodeprioritized[TOP_PRIORITY+1][128] = &pr_opcodes[OP_NE_I], &pr_opcodes[OP_NE_IF], &pr_opcodes[OP_NE_FI], - + &pr_opcodes[OP_LE], &pr_opcodes[OP_LE_I], &pr_opcodes[OP_LE_IF], @@ -999,7 +999,7 @@ pbool QCC_OPCodeValid(QCC_opcode_t *op) case OP_LOADA_FNC: case OP_LOADA_V: return false; //DPFIXME: DP does not bounds check these properly. I won't generate them. - + case OP_CONV_ITOF: case OP_CONV_FTOI: return true; //these look fine. @@ -1021,7 +1021,7 @@ pbool QCC_OPCodeValid(QCC_opcode_t *op) case OP_IFNOT_S: case OP_IF_S: return true; - + case OP_IFNOT_F: //added, but not in dp yet case OP_IF_F: return false; @@ -1099,7 +1099,7 @@ static int QCC_ShouldConvert(QCC_def_t *var, etype_t wanted) if (var->type->type == ev_pointer && var->type->aux_type) { if (var->type->aux_type->type == ev_float && wanted == ev_integer) - return OP_CP_FTOI; + return OP_CP_FTOI; if (var->type->aux_type->type == ev_integer && wanted == ev_float) return OP_CP_ITOF; @@ -1147,7 +1147,7 @@ QCC_def_t *QCC_SupplyConversion(QCC_def_t *var, etype_t wanted) if (o <= 0) //no conversion return var; - + return QCC_PR_Statement(&pr_opcodes[o], var, NULL, NULL); //conversion return value } @@ -1196,7 +1196,7 @@ gofs_t QCC_GetFreeOffsetSpace(unsigned int size) prev = fofs; } } - + ofs = numpr_globals; numpr_globals+=size; @@ -1255,7 +1255,7 @@ static QCC_def_t *QCC_GetTemp(QCC_type_t *type) #endif var_c = (void *)qccHunkAlloc (sizeof(QCC_def_t)); - memset (var_c, 0, sizeof(QCC_def_t)); + memset (var_c, 0, sizeof(QCC_def_t)); var_c->type = type; var_c->name = "temp"; @@ -1285,7 +1285,7 @@ static QCC_def_t *QCC_GetTemp(QCC_type_t *type) t->size = type->size; t->next = functemps; functemps = t; - + t->ofs = QCC_GetFreeOffsetSpace(t->size); numtemps+=t->size; @@ -1388,7 +1388,7 @@ static void QCC_LockActiveTemps(void) t->scope = pr_scope; t = t->next; } - + } static void QCC_LockTemp(QCC_def_t *d) @@ -1641,7 +1641,7 @@ QCC_def_t *QCC_PR_Statement ( QCC_opcode_t *op, QCC_def_t *var_a, QCC_def_t *var // } // //can't convert the left componant of an assignment operation // if (var_b && var_b->type && var_b->type != op->type_b->type) -// var_b = QCC_SupplyConversion(var_b, op->type_b->type->type); +// var_b = QCC_SupplyConversion(var_b, op->type_b->type->type); } } @@ -2024,7 +2024,7 @@ QCC_def_t *QCC_PR_Statement ( QCC_opcode_t *op, QCC_def_t *var_a, QCC_def_t *var } } simplestore=false; - + statement = &statements[numstatements]; numstatements++; @@ -2214,7 +2214,7 @@ QCC_def_t *QCC_PR_Statement ( QCC_opcode_t *op, QCC_def_t *var_a, QCC_def_t *var QCC_FreeTemp(var_c); statement = &statements[numstatements]; numstatements++; - + QCC_FreeTemp(var_a); QCC_FreeTemp(var_b); @@ -2391,7 +2391,7 @@ QCC_def_t *QCC_PR_Statement ( QCC_opcode_t *op, QCC_def_t *var_a, QCC_def_t *var if (statements[st].op == OP_ADDRESS) if (statements[st].c == var_b->ofs) break; - + if ((statements[st].op >= OP_CALL0 && statements[st].op <= OP_CALL8) || (statements[st].op >= OP_CALL1H && statements[st].op <= OP_CALL8H)) need_lock = true; @@ -2447,8 +2447,8 @@ QCC_def_t *QCC_PR_Statement ( QCC_opcode_t *op, QCC_def_t *var_a, QCC_def_t *var op = &pr_opcodes[OP_STOREP_V]; - - + + QCC_FreeTemp(var_c); var_c = NULL; QCC_FreeTemp(var_b); @@ -2464,7 +2464,7 @@ QCC_def_t *QCC_PR_Statement ( QCC_opcode_t *op, QCC_def_t *var_a, QCC_def_t *var if (outstatement) *outstatement = statement; - + statement_linenums[statement-statements] = pr_source_line; statement->op = op - pr_opcodes; statement->a = var_a ? var_a->ofs : 0; @@ -2536,7 +2536,7 @@ QCC_dstatement_t *QCC_PR_SimpleStatement( int op, int var_a, int var_b, int var_ void QCC_PR_Statement3 ( QCC_opcode_t *op, QCC_def_t *var_a, QCC_def_t *var_b, QCC_def_t *var_c, int force) { - QCC_dstatement_t *statement; + QCC_dstatement_t *statement; if (!force && !QCC_OPCodeValid(op)) { @@ -2545,9 +2545,9 @@ void QCC_PR_Statement3 ( QCC_opcode_t *op, QCC_def_t *var_a, QCC_def_t *var_b, Q QCC_PR_ParseError(ERR_BADEXTENSION, "Opcode \"%s|%s\" not valid for target\n", op->name, op->opname); } - statement = &statements[numstatements]; + statement = &statements[numstatements]; numstatements++; - + statement_linenums[statement-statements] = pr_source_line; statement->op = op - pr_opcodes; statement->a = var_a ? var_a->ofs : 0; @@ -2612,7 +2612,7 @@ QCC_def_t *QCC_PR_ParseImmediate (void) } } else if (pr_immediate_type == type_integer) - { + { if ( G_INT(cn->ofs) == pr_immediate._int ) { QCC_PR_Lex (); @@ -2629,7 +2629,7 @@ QCC_def_t *QCC_PR_ParseImmediate (void) return cn; } } - else + else QCC_PR_ParseError (ERR_BADIMMEDIATETYPE, "weird immediate type"); } @@ -2650,9 +2650,9 @@ QCC_def_t *QCC_PR_ParseImmediate (void) if (pr_immediate_type == type_string) pr_immediate.string = QCC_CopyString (pr_immediate_string); - + memcpy (qcc_pr_globals + cn->ofs, &pr_immediate, 4*type_size[pr_immediate_type->type]); - + QCC_PR_Lex (); return cn; @@ -2666,7 +2666,7 @@ void QCC_PrecacheSound (QCC_def_t *e, int ch) if (e->type->type != ev_string) return; - + if (!e->ofs || e->temp || !e->constant) return; n = G_STRING(e->ofs); @@ -2693,9 +2693,9 @@ void QCC_PrecacheModel (QCC_def_t *e, int ch) if (e->type->type != ev_string) return; - + if (!e->ofs || e->temp || !e->constant) - return; + return; n = G_STRING(e->ofs); if (!*n) return; @@ -2729,9 +2729,9 @@ void QCC_SetModel (QCC_def_t *e) if (e->type->type != ev_string) return; - + if (!e->ofs || e->temp || !e->constant) - return; + return; n = G_STRING(e->ofs); if (!*n) return; @@ -2756,7 +2756,7 @@ void QCC_PrecacheTexture (QCC_def_t *e, int ch) if (e->type->type != ev_string) return; - + if (!e->ofs || e->temp || !e->constant) return; n = G_STRING(e->ofs); @@ -2783,7 +2783,7 @@ void QCC_PrecacheFile (QCC_def_t *e, int ch) if (e->type->type != ev_string) return; - + if (!e->ofs || e->temp || !e->constant) return; n = G_STRING(e->ofs); @@ -2866,7 +2866,7 @@ QCC_def_t *QCC_PR_GenerateFunctionCall (QCC_def_t *func, QCC_def_t *arglist[], i } else np = t->num_parms; - + if (strchr(func->name, ':') && laststatement && statements[laststatement-1].op == OP_LOAD_FNC && statements[laststatement-1].c == func->ofs) { //we're entering OO code with a different self. //eg: other.touch(self) @@ -2975,7 +2975,7 @@ QCC_def_t *QCC_PR_GenerateFunctionCall (QCC_def_t *func, QCC_def_t *arglist[], i } } } - + //restore the class owner if (oself) QCC_PR_SimpleStatement(OP_STORE_ENT, oself->ofs, d->ofs, 0, false); @@ -3034,7 +3034,7 @@ PR_ParseFunctionCall */ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could have no name set if it's a field call. { - QCC_def_t *e, *d, *old, *oself, *out; + QCC_def_t *e, *d, *old = {0}, *oself, *out; // warning: old may be used uninitialized in this function int arg; QCC_type_t *t, *p; int extraparms=false; @@ -3097,7 +3097,7 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could out = QCC_GetTemp(type_float); else out = &def_ret; - + if (e) { if (d) @@ -3123,7 +3123,7 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could } else old = NULL; - + if (e) { if (d) @@ -3146,7 +3146,7 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could QCC_FreeTemp(QCC_PR_Statement(&pr_opcodes[OP_GOTO], 0, 0, &st)); st->a = 3; } - + t = QCC_PR_Statement(&pr_opcodes[OP_SUB_F], e, d, NULL); QCC_PR_SimpleStatement(OP_MUL_F, OFS_RETURN, t->ofs, OFS_RETURN, false); QCC_FreeTemp(t); @@ -3227,7 +3227,7 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could out = QCC_GetTemp(type_vector); else out = &def_ret; - + if (e) { if (d) @@ -3253,7 +3253,7 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could } else old = NULL; - + if (e) { if (d) @@ -3274,15 +3274,15 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could QCC_PR_SimpleStatement(OP_GOTO, 3, 0, 0, false); } - + t = QCC_GetTemp(type_float); QCC_PR_SimpleStatement(OP_SUB_F, d->ofs+2, e->ofs+2, t->ofs, false); QCC_PR_SimpleStatement(OP_MUL_F, OFS_RETURN, t->ofs, OFS_RETURN+2, false); QCC_FreeTemp(t); QCC_PR_SimpleStatement(OP_ADD_F, OFS_RETURN, d->ofs+2, OFS_RETURN+2, false); - - + + QCC_PR_SimpleStatement(OP_CALL0, func->ofs, 0, 0, false); if ((!d->constant || !e->constant) && G_FLOAT(d->ofs) >= G_FLOAT(d->ofs)) @@ -3298,7 +3298,7 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could QCC_PR_SimpleStatement(OP_GOTO, 3, 0, 0, false); } - + t = QCC_GetTemp(type_float); QCC_PR_SimpleStatement(OP_SUB_F, d->ofs+1, e->ofs+1, t->ofs, false); QCC_PR_SimpleStatement(OP_MUL_F, OFS_RETURN, t->ofs, OFS_RETURN+1, false); @@ -3321,7 +3321,7 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could QCC_PR_SimpleStatement(OP_GOTO, 3, 0, 0, false); } - + t = QCC_GetTemp(type_float); QCC_PR_SimpleStatement(OP_SUB_F, d->ofs, e->ofs, t->ofs, false); QCC_PR_SimpleStatement(OP_MUL_F, OFS_RETURN, t->ofs, OFS_RETURN, false); @@ -3401,7 +3401,7 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could QCC_PR_Expect(")"); } - + if (def_ret.temp->used) { old = QCC_GetTemp(def_ret.type); @@ -3444,7 +3444,7 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could return d; } - + def_ret.type = rettype; return &def_ret; } @@ -3665,7 +3665,7 @@ int typechecks; QCC_def_t *QCC_MakeIntDef(int value) { QCC_def_t *cn; - + // check for a constant with the same value for (cn=pr.def_head.next ; cn ; cn=cn->next) { @@ -3680,9 +3680,9 @@ QCC_def_t *QCC_MakeIntDef(int value) typechecks++; if ( G_INT(cn->ofs) == value ) - { + { return cn; - } + } } // allocate a new one @@ -3700,9 +3700,9 @@ QCC_def_t *QCC_MakeIntDef(int value) // copy the immediate to the global area cn->ofs = QCC_GetFreeOffsetSpace (type_size[type_integer->type]); - - G_INT(cn->ofs) = value; - + + G_INT(cn->ofs) = value; + return cn; } @@ -3710,7 +3710,7 @@ QCC_def_t *QCC_MakeIntDef(int value) QCC_def_t *QCC_MakeVectorDef(float a, float b, float c) { QCC_def_t *cn; - + // check for a constant with the same value for (cn=pr.def_head.next ; cn ; cn=cn->next) { @@ -3727,9 +3727,9 @@ QCC_def_t *QCC_MakeVectorDef(float a, float b, float c) if ( G_FLOAT(cn->ofs+0) == a && G_FLOAT(cn->ofs+1) == b && G_FLOAT(cn->ofs+2) == c) - { + { return cn; - } + } } // allocate a new one @@ -3747,7 +3747,7 @@ QCC_def_t *QCC_MakeVectorDef(float a, float b, float c) // copy the immediate to the global area cn->ofs = QCC_GetFreeOffsetSpace (type_size[type_vector->type]); - + G_FLOAT(cn->ofs+0) = a; G_FLOAT(cn->ofs+1) = b; G_FLOAT(cn->ofs+2) = c; @@ -3788,11 +3788,11 @@ QCC_def_t *QCC_MakeFloatDef(float value) // copy the immediate to the global area cn->ofs = QCC_GetFreeOffsetSpace (type_size[type_integer->type]); - + Hash_AddKey(&floatconstdefstable, fi.i, cn, qccHunkAlloc(sizeof(bucket_t))); - - G_FLOAT(cn->ofs) = value; - + + G_FLOAT(cn->ofs) = value; + return cn; } @@ -3822,13 +3822,13 @@ QCC_def_t *QCC_MakeStringDef(char *value) // copy the immediate to the global area cn->ofs = QCC_GetFreeOffsetSpace (type_size[type_integer->type]); - + string = QCC_CopyString (value); pHash_Add(&stringconstdefstable, strings+string, cn, qccHunkAlloc(sizeof(bucket_t))); - - G_INT(cn->ofs) = string; - + + G_INT(cn->ofs) = string; + return cn; } @@ -3935,7 +3935,7 @@ void QCC_PR_EmitFieldsForMembers(QCC_type_t *clas) ft = QCC_PR_FindType(ft); sprintf(membername, "__f_%s_%i", ft->name, ++basictypefield[mt->type]); f = QCC_PR_GetDef(ft, membername, NULL, true, 1, true); - + for (o = 0; o < m->type->size; o++) ((int *)qcc_pr_globals)[o+a*mt->size+m->ofs] = ((int *)qcc_pr_globals)[o+f->ofs]; @@ -4037,7 +4037,7 @@ void QCC_PR_EmitClassFromFunction(QCC_def_t *scope, char *tname) if (!virt) QCC_Error(ERR_INTERNAL, "spawn function was not defined\n"); QCC_PR_SimpleStatement(OP_CALL0, virt->ofs, 0, 0, false); //calling convention doesn't come into it. - + QCC_FreeTemp(QCC_PR_Statement(&pr_opcodes[OP_STORE_ENT], &def_ret, ed, NULL)); ed->references = 1; //there may be no functions. @@ -4083,7 +4083,7 @@ QCC_def_t *QCC_PR_ParseValue (QCC_type_t *assumeclass, pbool allowarrayassign) int i; char membername[2048]; - + // if the token is an immediate, allocate a constant for it if (pr_token_type == tt_immediate) return QCC_PR_ParseImmediate (); @@ -4128,7 +4128,7 @@ QCC_def_t *QCC_PR_ParseValue (QCC_type_t *assumeclass, pbool allowarrayassign) // look through the defs od = d = QCC_PR_GetDef (NULL, name, pr_scope, false, 0, false); - + if (!d) { if ( (!strcmp(name, "random" )) || @@ -4171,12 +4171,12 @@ reloop: QCC_type_t *newtype; if (ao) { - numstatements--; //remove the last statement + numstatements--; //remove the last statement nd = QCC_PR_Expression (TOP_PRIORITY, 0); QCC_PR_Expect("]"); - if (d->type->size != 1) //we need to multiply it to find the offset. + if (d->type->size != 1) //we need to multiply it to find the offset. { if (ao->type->type == ev_integer) nd = QCC_PR_Statement(&pr_opcodes[OP_MUL_I], nd, QCC_MakeIntDef(d->type->size), NULL); //get add part @@ -4253,7 +4253,7 @@ reloop: nd = QCC_PR_Statement(&pr_opcodes[OP_LOADA_V], d, ao, NULL); //get pointer to precise def. break; case ev_entity: - nd = QCC_PR_Statement(&pr_opcodes[OP_LOADA_ENT], d, ao, NULL); //get pointer to precise def. + nd = QCC_PR_Statement(&pr_opcodes[OP_LOADA_ENT], d, ao, NULL); //get pointer to precise def. break; case ev_field: nd = QCC_PR_Statement(&pr_opcodes[OP_LOADA_FLD], d, ao, NULL); //get pointer to precise def. @@ -4396,7 +4396,7 @@ reloop: def_parms[0].type = type_float; funcretr = QCC_PR_GetDef(type_function, qcva("ArrayGet*%s", d->name), NULL, true, 1, false); - + args[0] = ao; nd = QCC_PR_GenerateFunctionCall(funcretr, args, 1); nd->type = d->type->aux_type; @@ -4456,7 +4456,7 @@ reloop: nd = QCC_PR_Statement(&pr_opcodes[OP_LOADA_V], d, QCC_PR_Statement (&pr_opcodes[OP_CONV_FTOI], ao, 0, NULL), NULL); //get pointer to precise def. break; case ev_entity: - nd = QCC_PR_Statement(&pr_opcodes[OP_LOADA_ENT], d, QCC_PR_Statement (&pr_opcodes[OP_CONV_FTOI], ao, 0, NULL), NULL); //get pointer to precise def. + nd = QCC_PR_Statement(&pr_opcodes[OP_LOADA_ENT], d, QCC_PR_Statement (&pr_opcodes[OP_CONV_FTOI], ao, 0, NULL), NULL); //get pointer to precise def. break; case ev_field: nd = QCC_PR_Statement(&pr_opcodes[OP_LOADA_FLD], d, QCC_PR_Statement (&pr_opcodes[OP_CONV_FTOI], ao, 0, NULL), NULL); //get pointer to precise def. @@ -4484,7 +4484,7 @@ reloop: } else QCC_PR_ParseError(ERR_BADARRAYINDEXTYPE, "Array offset is not of integer or float type"); - + d->type = newtype; goto reloop; } @@ -4508,7 +4508,7 @@ reloop: d = od; nd = QCC_MakeIntDef(type->ofs); - ao = QCC_PR_Statement(&pr_opcodes[OP_ADD_I], ao, nd, NULL); //get add part + ao = QCC_PR_Statement(&pr_opcodes[OP_ADD_I], ao, nd, NULL); //get add part //so that we may offset it and readd it. } @@ -4526,7 +4526,7 @@ reloop: nd = QCC_PR_Statement(&pr_opcodes[OP_LOADP_V], d, ao, NULL); //get pointer to precise def. break; case ev_entity: - nd = QCC_PR_Statement(&pr_opcodes[OP_LOADP_ENT], d, ao, NULL); //get pointer to precise def. + nd = QCC_PR_Statement(&pr_opcodes[OP_LOADP_ENT], d, ao, NULL); //get pointer to precise def. break; case ev_field: nd = QCC_PR_Statement(&pr_opcodes[OP_LOADP_FLD], d, ao, NULL); //get pointer to precise def. @@ -4548,7 +4548,7 @@ reloop: QCC_PR_ParseError(ERR_NOVALIDOPCODES, "No op available. Try assembler"); nd = NULL; break; - } + } d=nd; break; @@ -4558,7 +4558,7 @@ reloop: for (j = type->num_parms; j;j--) type++; } - } + } if (!i) QCC_PR_ParseError (ERR_MEMBERNOTVALID, "\"%s\" is not a member of \"%s\"", pr_token, od->type->name); @@ -4582,7 +4582,7 @@ reloop: d = od; nd = QCC_MakeIntDef(type->ofs); - ao = QCC_PR_Statement(&pr_opcodes[OP_ADD_I], ao, nd, NULL); //get add part + ao = QCC_PR_Statement(&pr_opcodes[OP_ADD_I], ao, nd, NULL); //get add part //so that we may offset it and readd it. } @@ -4600,7 +4600,7 @@ reloop: nd = QCC_PR_Statement(&pr_opcodes[OP_LOADA_V], d, ao, NULL); //get pointer to precise def. break; case ev_entity: - nd = QCC_PR_Statement(&pr_opcodes[OP_LOADA_ENT], d, ao, NULL); //get pointer to precise def. + nd = QCC_PR_Statement(&pr_opcodes[OP_LOADA_ENT], d, ao, NULL); //get pointer to precise def. break; case ev_field: nd = QCC_PR_Statement(&pr_opcodes[OP_LOADA_FLD], d, ao, NULL); //get pointer to precise def. @@ -4622,7 +4622,7 @@ reloop: QCC_PR_ParseError(ERR_NOVALIDOPCODES, "No op available. Try assembler"); nd = NULL; break; - } + } d=nd; break; @@ -4632,7 +4632,7 @@ reloop: for (j = type->num_parms; j;j--) type++; } - } + } if (!i) QCC_PR_ParseError (ERR_MEMBERNOTVALID, "\"%s\" is not a member of \"%s\"", pr_token, od->type->name); @@ -4652,7 +4652,7 @@ reloop: break; } } -*/ +*/ if (!keyword_class) return d; @@ -4687,7 +4687,7 @@ reloop: case ev_field: d = QCC_PR_Statement(&pr_opcodes[OP_LOAD_FLD], d, field, NULL); nd = (void *)qccHunkAlloc (sizeof(QCC_def_t)); - memset (nd, 0, sizeof(QCC_def_t)); + memset (nd, 0, sizeof(QCC_def_t)); nd->type = field->type->aux_type; nd->ofs = d->ofs; nd->temp = d->temp; @@ -4704,7 +4704,7 @@ reloop: { //complicated for a typecast d = QCC_PR_Statement(&pr_opcodes[OP_LOAD_FNC], d, field, NULL); nd = (void *)qccHunkAlloc (sizeof(QCC_def_t)); - memset (nd, 0, sizeof(QCC_def_t)); + memset (nd, 0, sizeof(QCC_def_t)); nd->type = field->type->aux_type; nd->ofs = d->ofs; nd->temp = d->temp; @@ -4721,7 +4721,7 @@ reloop: else QCC_PR_IncludeChunk(".", false, NULL); } - } + } return d; } @@ -4782,7 +4782,7 @@ QCC_def_t *QCC_PR_Term (void) } return e; } - + if (QCC_PR_CheckToken ("!")) { e = QCC_PR_Expression (NOT_PRIORITY, EXPR_DISALLOW_COMMA|EXPR_WARN_ABOVE_1); @@ -4927,7 +4927,7 @@ QCC_def_t *QCC_PR_Term (void) } return e2; } - + if (QCC_PR_CheckToken ("(")) { if (QCC_PR_CheckKeyword(keyword_float, "float")) //check for type casts @@ -4946,7 +4946,7 @@ QCC_def_t *QCC_PR_Term (void) QCC_PR_ParseWarning (0, "Not all vars make sence as floats"); e2 = (void *)qccHunkAlloc (sizeof(QCC_def_t)); - memset (e2, 0, sizeof(QCC_def_t)); + memset (e2, 0, sizeof(QCC_def_t)); e2->type = type_float; e2->ofs = e->ofs; e2->constant = true; @@ -4962,7 +4962,7 @@ QCC_def_t *QCC_PR_Term (void) QCC_PR_Expect (")"); e = QCC_PR_Term(); e2 = (void *)qccHunkAlloc (sizeof(QCC_def_t)); - memset (e2, 0, sizeof(QCC_def_t)); + memset (e2, 0, sizeof(QCC_def_t)); e2->type = classtype; e2->ofs = e->ofs; e2->constant = true; @@ -5022,7 +5022,7 @@ int QCC_canConv(QCC_def_t *from, etype_t to) return 1; } } - + /* if (from->type->type == ev_pointer && from->type->aux_type->type == to) return 1; @@ -5205,10 +5205,10 @@ QCC_def_t *QCC_PR_Expression (int priority, int exprflags) } else type_c = ev_void; - + oldop = op; bestop = NULL; - numconversions = 32767; + numconversions = 32767; while (op) { if (!(type_c != ev_void && type_c != (*op->type_c)->type)) @@ -5265,7 +5265,7 @@ QCC_def_t *QCC_PR_Expression (int priority, int exprflags) if (c == 0)//can't get less conversions than 0... break; } - } + } else break; } @@ -5326,13 +5326,13 @@ QCC_def_t *QCC_PR_Expression (int priority, int exprflags) } else e = QCC_PR_Statement (op, e, e2, NULL); - + if (type_c != ev_void/* && type_c != ev_string*/) // field access gets type from field e->type = e2->type->aux_type; if (priority > 1 && exprflags & EXPR_WARN_ABOVE_1) QCC_PR_ParseWarning(0, "You may wish to add brackets after that ! operator"); - + break; } if (!op) @@ -5477,7 +5477,7 @@ QCC_def_t *QCC_PR_Expression (int priority, int exprflags) QCC_FreeTemp(e); return QCC_PR_Expression(TOP_PRIORITY, exprflags); } - + return e; } @@ -5554,7 +5554,7 @@ void QCC_PR_ParseStatement (void) } return; } - + if (QCC_PR_CheckKeyword(keyword_return, "return")) { /*if (pr_classtype) @@ -5593,7 +5593,7 @@ void QCC_PR_ParseStatement (void) QCC_PR_Expect (";"); return; } - + if (QCC_PR_CheckKeyword(keyword_while, "while")) { continues = num_continues; @@ -5736,7 +5736,7 @@ void QCC_PR_ParseStatement (void) if (breaks != num_breaks) { for(i = breaks; i < num_breaks; i++) - { + { patch1 = &statements[pr_breaks[i]]; statements[pr_breaks[i]].a = &statements[numstatements] - patch1; } @@ -5814,10 +5814,10 @@ void QCC_PR_ParseStatement (void) return; } - + if (QCC_PR_CheckKeyword(keyword_local, "local")) { - QCC_type_t *functionsclasstype = pr_classtype; + QCC_type_t *functionsclasstype = pr_classtype; // if (locals_end != numpr_globals) //is this breaking because of locals? // QCC_PR_ParseWarning("local vars after temp vars\n"); QCC_PR_ParseDefs (NULL); @@ -5861,7 +5861,7 @@ void QCC_PR_ParseStatement (void) QCC_PR_Expect(";"); return; } - + if (QCC_PR_CheckKeyword(keyword_if, "if")) { pbool negate = QCC_PR_CheckKeyword(keyword_not, "not"); @@ -5980,7 +5980,7 @@ void QCC_PR_ParseStatement (void) //default: // break; //} - + //to // x = CONDITION, goto start @@ -5998,7 +5998,7 @@ void QCC_PR_ParseStatement (void) //x is emitted in an opcode, stored as a register that we cannot access later. //it should be possible to nest these. - + switchtype = e->type; switch(switchtype->type) { @@ -6034,7 +6034,7 @@ void QCC_PR_ParseStatement (void) QCC_FreeTemp(QCC_PR_Statement (&pr_opcodes[OP_GOTO], e, 0, &patch1)); QCC_PR_Expect (")"); //close bracket is after we save the statement to mem (so debugger does not show the if statement as being on the line after - + oldst = numstatements; QCC_PR_ParseStatement (); @@ -6167,7 +6167,7 @@ void QCC_PR_ParseStatement (void) patch3->b = &statements[pr_cases[i]] - patch3; } } - } + } } if (defaultcase>=0) { @@ -6433,7 +6433,7 @@ void QCC_PR_ParseState (void) if (s1->type->type != ev_float || def->type->type != ev_float) QCC_PR_ParseError(ERR_STATETYPEMISMATCH, "state type mismatch"); - + if (QCC_OPCodeValid(&pr_opcodes[OP_CSTATE])) QCC_FreeTemp(QCC_PR_Statement (&pr_opcodes[OP_CSTATE], s1, def, NULL)); @@ -6487,7 +6487,7 @@ void QCC_PR_ParseState (void) QCC_UnFreeTemp(frame); if (cycle_wrapped) QCC_FreeTemp(QCC_PR_Statement(&pr_opcodes[OP_STORE_F], QCC_MakeFloatDef(1), cycle_wrapped, NULL)); - + //self.frame = frame happens with the normal state opcode. QCC_FreeTemp(QCC_PR_Statement (&pr_opcodes[OP_STATE], frame, pr_scope, NULL)); @@ -6496,20 +6496,20 @@ void QCC_PR_ParseState (void) } return; } - + if (pr_token_type != tt_immediate || pr_immediate_type != type_float) QCC_PR_ParseError (ERR_STATETYPEMISMATCH, "state frame must be a number"); s1 = QCC_PR_ParseImmediate (); - + QCC_PR_CheckToken (","); name = QCC_PR_ParseName (); pr_scope = NULL; def = QCC_PR_GetDef (type_function, name, NULL, true, 1, false); pr_scope = sc; - + QCC_PR_Expect ("]"); - + QCC_FreeTemp(QCC_PR_Statement (&pr_opcodes[OP_STATE], s1, def, NULL)); } @@ -6592,7 +6592,7 @@ void QCC_PR_ParseAsm(void) } } else - { + { if (pr_opcodes[op].type_a != &type_void) a = QCC_PR_ParseValue(pr_classtype, false); else @@ -6608,7 +6608,7 @@ void QCC_PR_ParseAsm(void) QCC_PR_Statement3(&pr_opcodes[op], a, b, c, true); } - + QCC_PR_Expect(";"); return; } @@ -6841,7 +6841,7 @@ void QCC_CheckForDeadAndMissingReturns(int first, int last, int rettype) if (statements[last-1].op == OP_DONE) last--; //don't want the done - + if (rettype != ev_void) if (statements[last-1].op != OP_RETURN) { @@ -7107,7 +7107,7 @@ void QCC_Marshal_Locals(int first, int laststatement) locals_start = MAX_REGS; locals_end = newofs; - + optres_locals_marshalling+=newofs-MAX_REGS; for (local = pr.localvars; local; local = local->nextlocal) @@ -7273,7 +7273,7 @@ QCC_function_t *QCC_PR_ParseImmediateStatements (QCC_type_t *type) if (type->num_parms < 0) QCC_PR_ParseError (ERR_FUNCTIONWITHVARGS, "QC function with variable arguments and function body"); - + f->builtin = 0; // // define the parms @@ -7871,7 +7871,7 @@ QCC_def_t *QCC_PR_DummyDef(QCC_type_t *type, char *name, QCC_def_t *scope, int a strcpy (def->name, newname); def->type = type; - def->scope = scope; + def->scope = scope; def->saved = saved; // if (arraysize>1) @@ -7889,7 +7889,7 @@ QCC_def_t *QCC_PR_DummyDef(QCC_type_t *type, char *name, QCC_def_t *scope, int a { int partnum; QCC_type_t *parttype; - parttype = type->param; + parttype = type->param; for (partnum = 0; partnum < type->num_parms; partnum++) { switch (parttype->type) @@ -7909,7 +7909,7 @@ QCC_def_t *QCC_PR_DummyDef(QCC_type_t *type, char *name, QCC_def_t *scope, int a case ev_float: case ev_string: case ev_entity: - case ev_field: + case ev_field: case ev_pointer: case ev_integer: case ev_struct: @@ -7927,7 +7927,7 @@ QCC_def_t *QCC_PR_DummyDef(QCC_type_t *type, char *name, QCC_def_t *scope, int a break; } parttype=parttype->next; - } + } } else if (type->type == ev_vector) { //do the vector thing. @@ -8217,7 +8217,7 @@ QCC_def_t *QCC_PR_DummyFieldDef(QCC_type_t *type, char *name, QCC_def_t *scope, strcpy (def->name, newname); def->type = type; - def->scope = scope; + def->scope = scope; def->ofs = QCC_GetFreeOffsetSpace(1); ((int *)qcc_pr_globals)[def->ofs] = *fieldofs; @@ -8302,7 +8302,7 @@ QCC_def_t *QCC_PR_DummyFieldDef(QCC_type_t *type, char *name, QCC_def_t *scope, type = parttype; parttype=parttype->next; - } + } } } @@ -8333,7 +8333,7 @@ void QCC_PR_ParseDefs (char *classname) QCC_def_t *def, *d; QCC_function_t *f; QCC_dfunction_t *df; - int i; + int i = 0; // warning: i may be used uninitialized in this function pbool shared=false; pbool isstatic=defaultstatic; pbool externfnc=false; @@ -8869,7 +8869,7 @@ void QCC_PR_ParseDefs (char *classname) } //check for an array - + if ( QCC_PR_CheckToken ("[") ) { char *oldprfile = pr_file_p; @@ -8983,7 +8983,7 @@ void QCC_PR_ParseDefs (char *classname) def->references++; if (!def->initialized && shared) //shared count as initiialised - { + { def->shared = shared; def->initialized = true; } @@ -9128,7 +9128,7 @@ void QCC_PR_ParseDefs (char *classname) } continue; } - + else if (type->type == ev_function) { if (isvar) @@ -9235,7 +9235,7 @@ void QCC_PR_ParseDefs (char *classname) { df->parm_size[i] = parm->size; } - + continue; } @@ -9250,7 +9250,7 @@ void QCC_PR_ParseDefs (char *classname) def->constant = false; // if (constant) // QCC_PR_ParseError("const used on a struct isn't useful"); - + //FIXME: should do this recursivly QCC_PR_Expect("{"); for (arraypart = 0; arraypart < arraysize; arraypart++) @@ -9349,7 +9349,7 @@ void QCC_PR_ParseDefs (char *classname) d->ofs = def->ofs+arraypart*type->size+parttype->ofs+i; */ - G_INT(def->ofs+arraypart*type->size+parttype->ofs+i) = 0; + G_INT(def->ofs+arraypart*type->size+parttype->ofs+i) = 0; } QCC_PR_Expect("}"); } @@ -9397,7 +9397,7 @@ void QCC_PR_ParseDefs (char *classname) } break; default: - QCC_PR_ParseError(ERR_TYPEINVALIDINSTRUCT, "type %i not valid in a struct", parttype->type); + QCC_PR_ParseError(ERR_TYPEINVALIDINSTRUCT, "type %i not valid in a struct", parttype->type); QCC_PR_Lex(); break; } @@ -9643,7 +9643,7 @@ void QCC_PR_ParseDefs (char *classname) def->constant = isconstant; } - + } while (QCC_PR_CheckToken (",")); if (type->type == ev_function) @@ -9663,7 +9663,7 @@ compiles the 0 terminated text, adding defintions to the pr structure ============ */ pbool QCC_PR_CompileFile (char *string, char *filename) -{ +{ jmp_buf oldjb; if (!pr.memory) QCC_Error (ERR_INTERNAL, "PR_CompileFile: Didn't clear"); @@ -9671,7 +9671,7 @@ pbool QCC_PR_CompileFile (char *string, char *filename) QCC_PR_ClearGrabMacros (); // clear the frame macros compilingfile = filename; - + if (opt_filenames) { optres_filenames += strlen(filename); @@ -9720,11 +9720,11 @@ pbool QCC_PR_CompileFile (char *string, char *filename) } pr_scope = NULL; // outside all functions - + QCC_PR_ParseDefs (NULL); } memcpy(&pr_parse_abort, &oldjb, sizeof(oldjb)); - + return (pr_error_count == 0); } diff --git a/engine/qclib/qcc_pr_lex.c b/engine/qclib/qcc_pr_lex.c index 4c9f16b10..6427d684a 100644 --- a/engine/qclib/qcc_pr_lex.c +++ b/engine/qclib/qcc_pr_lex.c @@ -231,8 +231,8 @@ pbool QCC_PR_SimpleGetToken (void); int ParsePrecompilerIf(void) { CompilerConstant_t *c; - int eval; - char *start = pr_file_p; + int eval = 0; + //char *start = pr_file_p; //warning: unused variable start if (!QCC_PR_SimpleGetToken()) { if (*pr_file_p == '(') @@ -830,7 +830,7 @@ pbool QCC_PR_Precompiler(void) { #define MAXSOURCEFILESLIST 8 extern char sourcefileslist[MAXSOURCEFILESLIST][1024]; - extern int currentsourcefile; + //extern int currentsourcefile; // warning: unused variable currentsourcefile extern int numsourcefiles; int i; diff --git a/engine/qclib/qccmain.c b/engine/qclib/qccmain.c index 18300d010..694d1149e 100644 --- a/engine/qclib/qccmain.c +++ b/engine/qclib/qccmain.c @@ -278,6 +278,7 @@ void QCC_BspModels (void) char *m; char cmd[1024]; char name[256]; + size_t result; p = QCC_CheckParm ("-bspmodels"); if (!p) @@ -285,7 +286,7 @@ void QCC_BspModels (void) if (p == myargc-1) QCC_Error (ERR_BADPARMS, "-bspmodels must preceed a game directory"); gamedir = myargv[p+1]; - + for (i=0 ; istrings ; s--) if (!strcmp(s, str)) return s-strings; - + old = strofs; strcpy (strings+strofs, str); strofs += strlen(str)+1; @@ -341,7 +342,7 @@ int QCC_CopyDupBackString (char *str) void QCC_PrintStrings (void) { int i, l, j; - + for (i=0 ; ireferences = h; - - + + if (!h) h = 1; if (comp_x) @@ -882,7 +883,7 @@ strofs = (strofs+3)&~3; printf ("%6i numfielddefs (%i unique) (of %i)\n", numfielddefs, pr.size_fields, MAX_FIELDS); printf ("%6i numpr_globals (of %i)\n", numpr_globals, MAX_REGS); } - + if (!*destfile) strcpy(destfile, "progs.dat"); if (verbose) @@ -901,7 +902,7 @@ strofs = (strofs+3)&~3; progs.numstrings = strofs; if (progs.blockscompressed&16) - { + { SafeWrite (h, &len, sizeof(int)); //save for later len = QC_encode(progfuncs, strofs*sizeof(char), 2, (char *)strings, h); //write i = SafeSeek (h, 0, SEEK_CUR); @@ -940,9 +941,9 @@ strofs = (strofs+3)&~3; statements[i].b = PRLittleLong/*PRLittleShort*/(statements[i].b); statements[i].c = PRLittleLong/*PRLittleShort*/(statements[i].c); } - + if (progs.blockscompressed&1) - { + { SafeWrite (h, &len, sizeof(int)); //save for later len = QC_encode(progfuncs, numstatements*sizeof(QCC_dstatement32_t), 2, (char *)statements, h); //write i = SafeSeek (h, 0, SEEK_CUR); @@ -997,9 +998,9 @@ strofs = (strofs+3)&~3; else statements16[i].c = (unsigned short)PRLittleShort((unsigned short)statements[i].c); } - + if (progs.blockscompressed&1) - { + { SafeWrite (h, &len, sizeof(int)); //save for later len = QC_encode(progfuncs, numstatements*sizeof(QCC_dstatement16_t), 2, (char *)statements16, h); //write i = SafeSeek (h, 0, SEEK_CUR); @@ -1058,7 +1059,7 @@ strofs = (strofs+3)&~3; } if (progs.blockscompressed&8) - { + { SafeWrite (h, &len, sizeof(int)); //save for later len = QC_encode(progfuncs, numfunctions*sizeof(QCC_dfunction_t), 2, (char *)functions, h); //write i = SafeSeek (h, 0, SEEK_CUR); @@ -1104,7 +1105,7 @@ strofs = (strofs+3)&~3; } if (progs.blockscompressed&2) - { + { SafeWrite (h, &len, sizeof(int)); //save for later len = QC_encode(progfuncs, numglobaldefs*sizeof(QCC_ddef_t), 2, (char *)qcc_globals, h); //write i = SafeSeek (h, 0, SEEK_CUR); @@ -1127,7 +1128,7 @@ strofs = (strofs+3)&~3; } if (progs.blockscompressed&4) - { + { SafeWrite (h, &len, sizeof(int)); //save for later len = QC_encode(progfuncs, numfielddefs*sizeof(QCC_ddef_t), 2, (char *)fields, h); //write i = SafeSeek (h, 0, SEEK_CUR); @@ -1153,7 +1154,7 @@ strofs = (strofs+3)&~3; } if (progs.blockscompressed&2) - { + { SafeWrite (h, &len, sizeof(int)); //save for later len = QC_encode(progfuncs, numglobaldefs*sizeof(QCC_ddef16_t), 2, (char *)qcc_globals16, h); //write i = SafeSeek (h, 0, SEEK_CUR); @@ -1176,7 +1177,7 @@ strofs = (strofs+3)&~3; } if (progs.blockscompressed&4) - { + { SafeWrite (h, &len, sizeof(int)); //save for later len = QC_encode(progfuncs, numfielddefs*sizeof(QCC_ddef16_t), 2, (char *)fields16, h); //write i = SafeSeek (h, 0, SEEK_CUR); @@ -1199,7 +1200,7 @@ strofs = (strofs+3)&~3; ((int *)qcc_pr_globals)[i] = PRLittleLong (((int *)qcc_pr_globals)[i]); if (progs.blockscompressed&32) - { + { SafeWrite (h, &len, sizeof(int)); //save for later len = QC_encode(progfuncs, numpr_globals*4, 2, (char *)qcc_pr_globals, h); //write i = SafeSeek (h, 0, SEEK_CUR); @@ -1209,7 +1210,7 @@ strofs = (strofs+3)&~3; SafeSeek(h, i, SEEK_SET); } else - SafeWrite (h, qcc_pr_globals, numpr_globals*4); + SafeWrite (h, qcc_pr_globals, numpr_globals*4); if (types) for (i=0 ; inext) { if (d->type->type != ev_field) @@ -1421,13 +1422,13 @@ char *QCC_PR_ValueString (etype_t type, void *val) static char line[256]; QCC_def_t *def; QCC_dfunction_t *f; - + switch (type) { case ev_string: sprintf (line, "%s", QCC_PR_String(strings + *(int *)val)); break; - case ev_entity: + case ev_entity: sprintf (line, "entity %i", *(int *)val); break; case ev_function: @@ -1460,7 +1461,7 @@ char *QCC_PR_ValueString (etype_t type, void *val) sprintf (line, "bad type %i", type); break; } - + return line; } @@ -1478,7 +1479,7 @@ padded to 20 field width QCC_def_t *def; void *val; static char line[128]; - + val = (void *)&qcc_pr_globals[ofs]; def = pr_global_defs[ofs]; if (!def) @@ -1486,12 +1487,12 @@ padded to 20 field width sprintf (line,"%i(?""?""?)", ofs); else sprintf (line,"%i(%s)", ofs, def->name); - + i = strlen(line); for ( ; i<16 ; i++) strcat (line," "); strcat (line," "); - + return line; } @@ -1502,7 +1503,7 @@ char *QCC_PR_GlobalString (gofs_t ofs) QCC_def_t *def; void *val; static char line[128]; - + val = (void *)&qcc_pr_globals[ofs]; def = pr_global_defs[ofs]; if (!def) @@ -1514,12 +1515,12 @@ char *QCC_PR_GlobalString (gofs_t ofs) } else sprintf (line,"%i(%s)", ofs, def->name); - + i = strlen(line); for ( ; i<16 ; i++) strcat (line," "); strcat (line," "); - + return line; }*/ @@ -1541,12 +1542,12 @@ PR_PrintStatement /*void QCC_PR_PrintStatement (QCC_dstatement_t *s) { int i; - + printf ("%4i : %4i : %s ", (int)(s - statements), statement_linenums[s-statements], pr_opcodes[s->op].opname); i = strlen(pr_opcodes[s->op].opname); for ( ; i<10 ; i++) printf (" "); - + if (s->op == OP_IF || s->op == OP_IFNOT) printf ("%sbranch %i",QCC_PR_GlobalString(s->a),s->b); else if (s->op == OP_GOTO) @@ -1579,7 +1580,7 @@ PR_PrintDefs /*void QCC_PR_PrintDefs (void) { QCC_def_t *d; - + for (d=pr.def_head.next ; d ; d=d->next) QCC_PR_PrintOfs (d->ofs); }*/ @@ -1593,7 +1594,7 @@ QCC_type_t *QCC_PR_NewType (char *name, int basictype) qcc_typeinfo[numtypeinfos].name = name; qcc_typeinfo[numtypeinfos].num_parms = 0; qcc_typeinfo[numtypeinfos].param = NULL; - qcc_typeinfo[numtypeinfos].size = type_size[basictype]; + qcc_typeinfo[numtypeinfos].size = type_size[basictype]; numtypeinfos++; @@ -1614,7 +1615,7 @@ void QCC_PR_BeginCompilation (void *memory, int memsize) extern struct freeoffset_s *freeofs; int i; char name[16]; - + pr.memory = memory; pr.max_memory = memsize; @@ -1623,20 +1624,20 @@ void QCC_PR_BeginCompilation (void *memory, int memsize) QCC_PR_ResetErrorScope(); pr_scope = NULL; -/* numpr_globals = RESERVED_OFS; - +/* numpr_globals = RESERVED_OFS; + for (i=0 ; inext) { @@ -1848,7 +1849,7 @@ static void Add3(char *p, unsigned short *crc, char *file) { char *s; for(s=p;*s;s++) - QCC_CRC_ProcessByte(crc, *s); + QCC_CRC_ProcessByte(crc, *s); } #define ADD3(p) Add3(p, &crc, file) @@ -1864,7 +1865,7 @@ unsigned short QCC_PR_WriteProgdefs (char *filename) file[0] = '\0'; QCC_CRC_Init (&crc); - + // print global vars until the first field is defined //ADD: crc and dump @@ -1879,7 +1880,7 @@ unsigned short QCC_PR_WriteProgdefs (char *filename) ADD2("File generated by FTEQCC, relevent for engine modding only, the generated crc must be the same as your engine expects."); ADD(" */\n\ntypedef struct"); ADD2(" globalvars_s"); - ADD(qcva("\n{")); + ADD(qcva("\n{")); ADD2("\tint pad;\n" "\tint ofs_return[3];\n" //makes it easier with the get globals func "\tint ofs_parm0[3];\n" @@ -1897,7 +1898,7 @@ unsigned short QCC_PR_WriteProgdefs (char *filename) break; if (d->ofstype->type) { case ev_float: @@ -1934,10 +1935,10 @@ unsigned short QCC_PR_WriteProgdefs (char *filename) { if (!strcmp (d->name, "end_sys_fields")) break; - + if (d->type->type != ev_field) continue; - + switch (d->type->aux_type->type) { case ev_float: @@ -1977,7 +1978,7 @@ unsigned short QCC_PR_WriteProgdefs (char *filename) if (d->type->type != ev_field) continue; if (f) - ADD2(",\n"); + ADD2(",\n"); ADD2(qcva("\t{%i,\t%i,\t\"%s\"}",G_INT(d->ofs), d->type->aux_type->type, d->name)); f = 1; } @@ -2063,14 +2064,14 @@ unsigned short QCC_PR_WriteProgdefs (char *filename) int i; QCC_dstatement_t *ds; QCC_dfunction_t *df; - + for (i=0 ; ifirst_statement; while (1) @@ -2149,7 +2150,7 @@ void QCC_CreatePath (char *path) { /* char *ofs; - + for (ofs = path+1 ; *ofs ; ofs++) { if (*ofs == '/') @@ -2180,12 +2181,12 @@ void QCC_PackFile (char *src, char *name) #if 1 char *f; #else - int in; + int in; int count; char buf[4096]; #endif - + if ( (qbyte *)pf - (qbyte *)pfiles > sizeof(pfiles) ) QCC_Error (ERR_TOOMANYPAKFILES, "Too many files in pak file"); @@ -2218,7 +2219,7 @@ void QCC_PackFile (char *src, char *name) printf ("%64s : %7i\n", pf->name, remaining); packbytes += remaining; - + while (remaining) { if (remaining < sizeof(buf)) @@ -2249,15 +2250,15 @@ void QCC_CopyFile (char *src, char *dest) int in, out; int remaining, count; char buf[4096]; - + print ("%s to %s\n", src, dest); in = SafeOpenRead (src); remaining = filelength (in); - + QCC_CreatePath (dest); out = SafeOpenWrite (dest, remaining+10); - + while (remaining) { if (remaining < sizeof(buf)) @@ -2270,7 +2271,7 @@ void QCC_CopyFile (char *src, char *dest) } close (in); - SafeClose (out); + SafeClose (out); */ } @@ -2302,7 +2303,7 @@ void _QCC_CopyFiles (int blocknum, int copytype, char *srcdir, char *destdir) for (i=0 ; i= argc-1 || argv[p+1][0] == '-') p = QCC_CheckParm ("-srcfile"); if (p && p < argc-1 ) - sprintf (qccmprogsdat, "%s", argv[p+1]); + sprintf (qccmprogsdat, "%s", argv[p+1]); else { //look for a preprogs.src... :o) sprintf (qccmprogsdat, "preprogs.src"); @@ -3118,7 +3119,7 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string)); printf ("Source file: %s\n", qccmprogsdat); if (QCC_LoadFile (qccmprogsdat, (void *)&qccmsrc) == -1) - { + { return; } } @@ -3151,7 +3152,7 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string)); } if (*qcc_token == '#') - { + { void StartNewStyleCompile(void); newstyle: newstylesource = true; @@ -3175,7 +3176,7 @@ newstyle: #ifndef QCCONLY p=0; - s2 = strcpy(destfile2, destfile); + s2 = strcpy(destfile2, destfile); if (!strncmp(s2, "./", 2)) s2+=2; else @@ -3237,7 +3238,7 @@ newstyle: } printf ("outputfile: %s\n", destfile); - + pr_dumpasm = false; currentchunk = NULL; @@ -3323,7 +3324,7 @@ void QCC_ContinueCompile(void) QCC_Error (ERR_PARSEERRORS, "Errors have occured\n"); } void QCC_FinishCompile(void) -{ +{ pbool donesomething; int crc; // int p; @@ -3331,7 +3332,7 @@ void QCC_FinishCompile(void) if (setjmp(pr_parse_abort)) QCC_Error(ERR_INTERNAL, ""); - + if (!QCC_PR_FinishCompilation ()) { QCC_Error (ERR_PARSEERRORS, "compilation errors"); @@ -3364,10 +3365,10 @@ void QCC_FinishCompile(void) // write progdefs.h crc = QCC_PR_WriteProgdefs ("progdefs.h"); - + // write data file donesomething = QCC_WriteData (crc); - + // regenerate bmodels if -bspmodels QCC_BspModels (); @@ -3426,7 +3427,7 @@ void QCC_FinishCompile(void) printf("optres_test1 %i\n", optres_test1); if (optres_test2) printf("optres_test2 %i\n", optres_test2); - + printf("numtemps %i\n", numtemps); } if (!flag_msvcstyle) @@ -3507,7 +3508,7 @@ void new_QCC_ContinueCompile(void) } pr_scope = NULL; // outside all functions - + QCC_PR_ParseDefs (NULL); } @@ -3570,12 +3571,12 @@ void new_QCC_ContinueCompile(void) QCC_PR_ClearGrabMacros (); // clear the frame macros compilingfile = filename; - + pr_file_p = qccmsrc2; s_file = QCC_CopyString (filename); pr_source_line = 0; - + QCC_PR_NewLine (); QCC_PR_Lex (); // read first token @@ -3588,16 +3589,16 @@ void new_QCC_ContinueCompile(void) return false; QCC_PR_SkipToSemicolon (); if (pr_token_type == tt_eof) - return false; + return false; } pr_scope = NULL; // outside all functions - + QCC_PR_ParseDefs (); } } return (pr_error_count == 0); - + }*/ diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index a373f7f08..96efdeba4 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -205,7 +205,7 @@ pbool ED_CanFree (edict_t *ed) ed->v->classname = 0; - if (pr_imitatemvdsv.value) + if (pr_imitatemvdsv.value) { ed->v->health = 0; ed->v->nextthink = -1; @@ -520,7 +520,7 @@ void PR_LoadGlabalStruct(void) static float writeonly; static float dimension_send_default; static float zero_default; - static vec3_t vecwriteonly; + //static vec3_t vecwriteonly; // 523:16: warning: unused variable vecwriteonly int i; int *v; nqglobalvars_t *pr_globals = pr_nqglobal_struct; @@ -576,7 +576,7 @@ void PR_LoadGlabalStruct(void) globalfloat (false, cycle_wrapped); globalfloat (false, dimension_send); - + globalfloat (false, clientcommandframe); globalfloat (false, input_timelength); globalvec_ (false, input_angles); @@ -600,19 +600,19 @@ void PR_LoadGlabalStruct(void) if (!((nqglobalvars_t*)pr_globals)->V_trace_plane_normal) { ((nqglobalvars_t*)pr_globals)->V_trace_plane_normal = (vec3_t *)PR_FindGlobal(svprogfuncs, "trace_normal", 0); - if (!((nqglobalvars_t*)pr_globals)->V_trace_plane_normal) + if (!((nqglobalvars_t*)pr_globals)->V_trace_plane_normal) SV_Error("Could not find export trace_plane_normal in progs\n"); } if (!((nqglobalvars_t*)pr_globals)->V_trace_endpos) { ((nqglobalvars_t*)pr_globals)->V_trace_endpos = (vec3_t *)PR_FindGlobal(svprogfuncs, "trace_impact", 0); - if (!((nqglobalvars_t*)pr_globals)->V_trace_endpos) + if (!((nqglobalvars_t*)pr_globals)->V_trace_endpos) SV_Error("Could not find export trace_endpos in progs\n"); } if (!((nqglobalvars_t*)pr_globals)->trace_fraction) { ((nqglobalvars_t*)pr_globals)->trace_fraction = (float *)PR_FindGlobal(svprogfuncs, "trace_frac", 0); - if (!((nqglobalvars_t*)pr_globals)->trace_fraction) + if (!((nqglobalvars_t*)pr_globals)->trace_fraction) SV_Error("Could not find export trace_fraction in progs\n"); } ensurefloat(serverflags, zero_default); @@ -1620,7 +1620,7 @@ qboolean PR_UserCmd(char *s) //ktpro bug warning: //admin + judge. I don't know the exact rules behind this bug, so I just ban the entire command //I can't be arsed detecting ktpro specifically, so assume we're always running ktpro - + if (!strncmp(s, "admin", 5) || !strncmp(s, "judge", 5)) { Con_Printf("Blocking potentially unsafe ktpro command: %s\n", s); @@ -3515,7 +3515,7 @@ static void QCBUILTIN PF_precache_model (progfuncs_t *prinst, struct globalvars_ char *s; s = PR_GetStringOfs(prinst, OFS_PARM0); - + G_INT(OFS_RETURN) = G_INT(OFS_PARM0); PF_precache_model_Internal(prinst, s); @@ -3580,6 +3580,8 @@ void QCBUILTIN PF_precache_vwep_model (progfuncs_t *prinst, struct globalvars_s } } +// warning: PF_svcoredump defined but not used +/* static void QCBUILTIN PF_svcoredump (progfuncs_t *prinst, struct globalvars_s *pr_globals) { int size = 1024*1024*8; @@ -3588,6 +3590,7 @@ static void QCBUILTIN PF_svcoredump (progfuncs_t *prinst, struct globalvars_s *p COM_WriteFile("ssqccore.txt", buffer, size); BZ_Free(buffer); } +*/ static void QCBUILTIN PF_sv_movetogoal (progfuncs_t *prinst, struct globalvars_s *pr_globals) { @@ -5044,6 +5047,8 @@ static void QCBUILTIN PF_newstring(progfuncs_t *prinst, struct globalvars_s *pr_ RETURN_SSTRING(s+8); } +// warning: PF_strcatp defined but not used +/* static void QCBUILTIN PF_strcatp(progfuncs_t *prinst, struct globalvars_s *pr_globals) { char *buf = PR_GetStringOfs(prinst, OFS_PARM0); char *add = PR_GetStringOfs(prinst, OFS_PARM1); @@ -5066,7 +5071,10 @@ static void QCBUILTIN PF_strcatp(progfuncs_t *prinst, struct globalvars_s *pr_gl G_INT(OFS_RETURN) = G_INT(OFS_PARM0); } +*/ +// warning: PF_redstring defined but not used +/* static void QCBUILTIN PF_redstring(progfuncs_t *prinst, struct globalvars_s *pr_globals) { char *string = PR_GetStringOfs(prinst, OFS_PARM0), *s; @@ -5078,6 +5086,7 @@ static void QCBUILTIN PF_redstring(progfuncs_t *prinst, struct globalvars_s *pr_ RETURN_TSTRING(buf); } +*/ #ifdef SVCHAT void SV_Chat(char *filename, float starttag, edict_t *edict); @@ -5134,7 +5143,7 @@ void PF_sqlconnect (progfuncs_t *prinst, struct globalvars_s *pr_globals) if (!driver[0]) driver = sql_driver.string; - + G_FLOAT(OFS_RETURN) = SQL_NewServer(driver, paramstr); } @@ -5191,14 +5200,14 @@ void PF_sqlclosequery (progfuncs_t *prinst, struct globalvars_s *pr_globals) { sqlserver_t *server; queryresult_t *qres; - + if (SQL_Available()) { server = SQL_GetServer(G_FLOAT(OFS_PARM0), false); if (server) { qres = SQL_GetQueryResult(server, G_FLOAT(OFS_PARM1)); - if (qres) + if (qres) { // TODO: partial resultset logic not implemented yet SQL_CloseResult(server, qres); @@ -5216,7 +5225,7 @@ void PF_sqlreadfield (progfuncs_t *prinst, struct globalvars_s *pr_globals) char *data; if (SQL_Available()) - { + { server = SQL_GetServer(G_FLOAT(OFS_PARM0), false); if (server) { @@ -5243,7 +5252,7 @@ void PF_sqlreadfloat (progfuncs_t *prinst, struct globalvars_s *pr_globals) char *data; if (SQL_Available()) - { + { server = SQL_GetServer(G_FLOAT(OFS_PARM0), false); if (server) { @@ -5276,7 +5285,7 @@ void PF_sqlerror (progfuncs_t *prinst, struct globalvars_s *pr_globals) if (*svprogfuncs->callargc == 2) { // query-specific error request if (server->active) // didn't check this earlier so check it now - { + { queryresult_t *qres = SQL_GetQueryResult(server, G_FLOAT(OFS_PARM1)); if (qres) { @@ -5323,7 +5332,7 @@ void PF_sqlescape (progfuncs_t *prinst, struct globalvars_s *pr_globals) void PF_sqlversion (progfuncs_t *prinst, struct globalvars_s *pr_globals) { sqlserver_t *server; - + if (SQL_Available()) { server = SQL_GetServer(G_FLOAT(OFS_PARM0), false); @@ -5776,39 +5785,39 @@ static void QCBUILTIN PF_strstr (progfuncs_t *prinst, struct globalvars_s *pr_gl RETURN_TSTRING(p); } -char readable2[256] = +char readable2[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', '{', '|', '}', '~', '_' }; @@ -6463,7 +6472,7 @@ enum /*internal effects, here for indexes*/ - + ce_teleporterbody_1, /*de-sheeped*/ ce_white_smoke_05, ce_white_smoke_10, @@ -6799,7 +6808,7 @@ static void QCBUILTIN PF_h2starteffect(progfuncs_t *prinst, struct globalvars_s } Con_Printf("FTE-H2 FIXME: Effect %i doesn't have an effect registered\nTell Spike!\n", efnum); - + #if 0 switch((int)G_FLOAT(OFS_PARM0)) @@ -8221,7 +8230,7 @@ static void QCBUILTIN PF_globalstat(progfuncs_t *prinst, struct globalvars_s *pr //EXT_CSQC_1 static void QCBUILTIN PF_runclientphys(progfuncs_t *prinst, struct globalvars_s *pr_globals) -{ +{ unsigned int i, n; extern vec3_t player_maxs, player_mins; extern qbyte playertouch[]; @@ -8709,7 +8718,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs {"setorigin", PF_setorigin, 2, 2, 2}, // void(entity e, vector o) setorigin = #2; {"setmodel", PF_setmodel, 3, 3, 3}, // void(entity e, string m) setmodel = #3; {"setsize", PF_setsize, 4, 4, 4}, // void(entity e, vector min, vector max) setsize = #4; - {"qtest_setabssize",PF_setsize, 5}, // void(entity e, vector min, vector max) setabssize = #5; + {"qtest_setabssize",PF_setsize, 5}, // void(entity e, vector min, vector max) setabssize = #5; {"lightstylestatic",PF_lightstylestatic,0, 0, 5, 5}, {"break", PF_break, 6, 6, 6}, // void() break = #6; {"random", PF_random, 7, 7, 7}, // float() random = #7; diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index 39646cc3a..1afc686e3 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -75,11 +75,12 @@ extern cvar_t sv_nomsec; static void SV_Physics_Toss (edict_t *ent); +// warning: SV_CheckAllEnts defined but not used /* ================ SV_CheckAllEnts ================ -*/ + static void SV_CheckAllEnts (void) { int e; @@ -102,6 +103,7 @@ static void SV_CheckAllEnts (void) Con_Printf ("entity in invalid position\n"); } } +*/ /* ================ @@ -1376,6 +1378,7 @@ static void SV_WallFriction (edict_t *ent, trace_t *trace) ent->v->velocity[1] = side[1] * (1 + d); } +// warning: SV_TryUnstick defined but not used /* ===================== SV_TryUnstick @@ -1387,7 +1390,7 @@ Try fixing by pushing one pixel in each direction. This is a hack, but in the interest of good gameplay... ====================== -*/ + static int SV_TryUnstick (edict_t *ent, vec3_t oldvel) { int i; @@ -1436,6 +1439,7 @@ static int SV_TryUnstick (edict_t *ent, vec3_t oldvel) VectorClear (ent->v->velocity); return 7; // still not moving } +*/ /* ===================== @@ -1797,7 +1801,7 @@ SV_RunEntity void SV_RunEntity (edict_t *ent) { edict_t *movechain; - vec3_t initial_origin,initial_angle; + vec3_t initial_origin = {0},initial_angle = {0}; // warning: initial_?[?] may be used uninitialized in this function if (ent->entnum > 0 && ent->entnum <= sv.allocated_client_slots) { //a client woo. @@ -2177,7 +2181,7 @@ qboolean SV_Physics (void) SV_RunEntity (ent); SV_RunNewmis (); - + if (ent->solidtype != ent->v->solid && !ent->isfree) { Con_DPrintf("Entity \"%s\" improperly changed solid type\n", PR_GetString(svprogfuncs, ent->v->classname)); diff --git a/engine/server/sv_rankin.c b/engine/server/sv_rankin.c index 40b92b595..6d4657e44 100644 --- a/engine/server/sv_rankin.c +++ b/engine/server/sv_rankin.c @@ -36,9 +36,14 @@ char rank_cvargroup[] = "server rankings"; void inline READ_PLAYERSTATS(int x, rankstats_t *os) { int i; + size_t result; fseek(rankfile, sizeof(rankfileheader_t)+sizeof(rankheader_t)+((x-1)*sizeof(rankinfo_t)), SEEK_SET); - fread(os, sizeof(rankstats_t), 1, rankfile); + result = fread(os, sizeof(rankstats_t), 1, rankfile); + + // ignoring return value of fread, declared with attribute warn_unused_result + if (result != 1) + fprintf(stderr, "fread() error in READ_PLAYERSTATS\n"); os->kills = swaplong(os->kills); os->deaths = swaplong(os->deaths); @@ -73,9 +78,15 @@ void inline WRITE_PLAYERSTATS(int x, rankstats_t *os) void inline READ_PLAYERHEADER(int x, rankheader_t *oh) { + size_t result; + fseek(rankfile, sizeof(rankfileheader_t)+((x-1)*sizeof(rankinfo_t)), SEEK_SET); - fread(oh, sizeof(rankheader_t), 1, rankfile); + result = fread(oh, sizeof(rankheader_t), 1, rankfile); + + // ignoring return value of fread, declared with attribute warn_unused_result + if (result != 1) + fprintf(stderr, "fread() error in WRITE_PLAYERSTATS\n"); oh->prev = swaplong(oh->prev); //score is held for convineance. oh->next = swaplong(oh->next); @@ -125,6 +136,7 @@ void inline WRITEHEADER(void) qboolean Rank_OpenRankings(void) { char syspath[MAX_OSPATH]; + size_t result; qboolean created; if (!rankfile) { @@ -150,7 +162,11 @@ qboolean Rank_OpenRankings(void) memset(&rankfileheader, 0, sizeof(rankfileheader)); fseek(rankfile, 0, SEEK_SET); - fread(&rankfileheader, sizeof(rankfileheader_t), 1, rankfile); + result = fread(&rankfileheader, sizeof(rankfileheader_t), 1, rankfile); + + // ignoring return value of fread, declared with attribute warn_unused_result + if (result != 1) + fprintf(stderr, "fread() error in Rank_OpenRankings\n"); rankfileheader.version = swaplong(rankfileheader.version); rankfileheader.usedslots = swaplong(rankfileheader.usedslots); diff --git a/engine/server/sv_sys_unix.c b/engine/server/sv_sys_unix.c index 209be873a..d2a355f23 100644 --- a/engine/server/sv_sys_unix.c +++ b/engine/server/sv_sys_unix.c @@ -104,6 +104,7 @@ int Sys_DebugLog(char *file, char *fmt, ...) va_list argptr; char data[1024]; int fd; + size_t result; va_start(argptr, fmt); _vsnprintf (data,sizeof(data)-1, fmt, argptr); @@ -115,7 +116,7 @@ int Sys_DebugLog(char *file, char *fmt, ...) fd = open(file, O_WRONLY | O_CREAT | O_APPEND, 0666); if (fd) { - write(fd, data, strlen(data)); + result = write(fd, data, strlen(data)); // do something with the result close(fd); return 0; } @@ -204,7 +205,7 @@ void ApplyColour(unsigned int chr) bg = (chr & CON_BGMASK) >> CON_BGSHIFT; fg = (chr & CON_FGMASK) >> CON_FGSHIFT; - + // don't handle intensive bit for background // as terminals differ too much in displaying \e[1;7;3?m bg &= 0x7; @@ -272,7 +273,7 @@ char coninput_text[256]; int coninput_len; void Sys_Printf (char *fmt, ...) { - va_list argptr; + va_list argptr; if (sys_nostdout.value) return; @@ -289,7 +290,7 @@ void Sys_Printf (char *fmt, ...) if (!sys_linebuffer.value) { int i; - + for (i = 0; i < coninput_len; i++) putch('\b'); putch('\b'); @@ -810,7 +811,7 @@ static void *game_library; void Sys_UnloadGame(void) { - if (game_library) + if (game_library) { dlclose(game_library); game_library = 0; @@ -825,10 +826,11 @@ void *Sys_GetGameAPI(void *parms) char curpath[MAX_OSPATH]; char *searchpath; const char *gamename = "gamei386.so"; + size_t result; void *ret; - getcwd(curpath, sizeof(curpath)); + result = getcwd(curpath, sizeof(curpath)); // do soemthing with the result searchpath = 0; while((searchpath = COM_NextPath(searchpath))) @@ -863,11 +865,11 @@ void *Sys_CreateThread(int (*func)(void *), void *args, int stacksize) { pthread_t *thread; pthread_attr_t attr; - + thread = (pthread_t *)malloc(sizeof(pthread_t)); if (!thread) return NULL; - + pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); if (stacksize < PTHREAD_STACK_MIN) @@ -885,7 +887,7 @@ void *Sys_CreateThread(int (*func)(void *), void *args, int stacksize) void Sys_WaitOnThread(void *thread) { - pthread_join((pthread_t *)thread, NULL); + pthread_join((pthread_t *)thread, NULL); free(thread); } @@ -893,7 +895,7 @@ void Sys_WaitOnThread(void *thread) void *Sys_CreateMutex(void) { pthread_mutex_t *mutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); - + if (mutex && !pthread_mutex_init(mutex, NULL)) return mutex; return NULL; @@ -932,36 +934,36 @@ void *Sys_CreateConditional(void) condvar_t *condv; pthread_mutex_t *mutex; pthread_cond_t *cond; - + condv = (condvar_t *)malloc(sizeof(condvar_t)); if (!condv) return NULL; - + mutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); if (!mutex) return NULL; - + cond = (pthread_cond_t *)malloc(sizeof(pthread_cond_t)); if (!cond) return NULL; - + if (!pthread_mutex_init(mutex, NULL)) { if (!pthread_cond_init(cond, NULL)) { condv->cond = cond; condv->mutex = mutex; - + return (void *)condv; } else pthread_mutex_destroy(mutex); } - + free(cond); free(mutex); free(condv); - return NULL; + return NULL; } qboolean Sys_LockConditional(void *condv) @@ -992,7 +994,7 @@ qboolean Sys_ConditionBroadcast(void *condv) void Sys_DestroyConditional(void *condv) { condvar_t *cv = (condvar_t *)condv; - + pthread_cond_destroy(cv->cond); pthread_mutex_destroy(cv->mutex); free(cv->cond); diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index 1268e4110..8b9bf9b47 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -968,7 +968,7 @@ void SV_Modellist_f (void) { char mname[MAX_QPATH]; char vweaplist[1024] = "//vwep"; - int pos = strlen(vweaplist); + //int pos = strlen(vweaplist); // warning: unused variable pos for (i = 0; sv.strings.vw_model_precache[i]; i++) { @@ -1613,7 +1613,7 @@ void SV_Begin_Core(client_t *split) pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, split->edict); G_FLOAT(OFS_PARM0) = split->csqcactive; //this arg is part of EXT_CSQC_1, but doesn't have to be supported by the mod PR_ExecuteProgram (svprogfuncs, pr_global_struct->ClientConnect); - + // actually spawn the player pr_global_struct->time = sv.world.physicstime; pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, split->edict); @@ -1758,12 +1758,12 @@ void SV_DarkPlacesDownloadChunk(client_t *cl, sizebuf_t *msg) if (cl->num_backbuf) return; - + size = 1024; //fixme if (size > cl->datagram.maxsize - cl->datagram.cursize) size = cl->datagram.maxsize - cl->datagram.cursize - 16; - + if (size > MAXDPDOWNLOADCHUNK) //don't clog it too much size = MAXDPDOWNLOADCHUNK; @@ -2253,7 +2253,7 @@ void SV_VoiceSendPacket(client_t *client, sizebuf_t *buf) send = false; if (ring->receiver[clno>>3] & (1<<(clno&3))) send = true; - + /*if you're spectating, you can hear whatever your tracked player can hear*/ if (host_client->spectator && host_client->spec_track) if (ring->receiver[(host_client->spec_track-1)>>3] & (1<<((host_client->spec_track-1)&3))) @@ -2312,7 +2312,7 @@ void SV_Voice_Ignore_f(void) case -1: host_client->voice_mute[other>>3] &= ~(1<<(other&3)); break; - case 0: + case 0: host_client->voice_mute[other>>3] ^= (1<<(other&3)); break; case 1: @@ -2534,7 +2534,7 @@ static int SV_LocateDownload(char *name, flocation_t *loc, char **replacementnam Con_Printf("Failed to read %s\n", pakname); } } - + if (protectedpak) { //if its in a pak file, don't allow downloads if we don't allow the contents of paks to be sent. if (!allow_download_pakcontents.value) @@ -2669,7 +2669,7 @@ void SV_BeginDownload_f(void) if (redirection) { //tell the client to download the new one. - ClientReliableWrite_Begin (host_client, ISQ2CLIENT(host_client)?svcq2_stufftext:svc_stufftext, 2+strlen(redirection)); + ClientReliableWrite_Begin (host_client, ISQ2CLIENT(host_client)?svcq2_stufftext:svc_stufftext, 2+strlen(redirection)); ClientReliableWrite_String (host_client, va("\ndownload \"%s\"\n", redirection)); } return; @@ -2853,7 +2853,7 @@ void SV_PushFloodProt(client_t *client) if (client->lastspoke) { - client->floodprotmessage -= (realtime - client->lastspoke) + client->floodprotmessage -= (realtime - client->lastspoke) * sv_floodprotect_messages.value / sv_floodprotect_interval.value; client->floodprotmessage = max(0, client->floodprotmessage); @@ -3118,7 +3118,7 @@ SV_Kill_f void SV_Kill_f (void) { float floodtime; - + #ifdef HLSERVER if (svs.gametype == GT_HALFLIFE) { @@ -3385,7 +3385,7 @@ void SV_SetInfo_f (void) Q_strncpyz(oldval, Info_ValueForKey(host_client->userinfo, Cmd_Argv(1)), MAX_INFO_STRING); #ifdef VM_Q1 - if (Q1QVM_UserInfoChanged(sv_player)) + if (Q1QVM_UserInfoChanged(sv_player)) return; #endif @@ -3995,7 +3995,7 @@ void Cmd_Observe_f (void) return; if (host_client->spectator) return; // already a spectator - + if (svs.gametype != GT_PROGS) { SV_PrintToClient(host_client, PRINT_HIGH, "Sorry, not implemented in this gamecode type. Try moaning at the dev team\n"); @@ -5394,7 +5394,7 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse) } else jumpable = false; - + #ifdef VM_Q1 if (svs.gametype == GT_Q1QVM) Q1QVM_PlayerPreThink(); diff --git a/engine/server/svq3_game.c b/engine/server/svq3_game.c index db48bbed7..fe7d338f6 100644 --- a/engine/server/svq3_game.c +++ b/engine/server/svq3_game.c @@ -231,7 +231,7 @@ static void Q3G_LinkEntity(q3sharedEntity_t *ent) else { // normal - VectorAdd(origin, ent->r.mins, ent->r.absmin); + VectorAdd(origin, ent->r.mins, ent->r.absmin); VectorAdd(origin, ent->r.maxs, ent->r.absmax); } @@ -341,7 +341,7 @@ static void Q3G_LinkEntity(q3sharedEntity_t *ent) else break; // crosses the node } - // link it in + // link it in InsertLinkBefore((link_t *)&sent->area, &node->solid_edicts); } @@ -371,7 +371,7 @@ static int SVQ3_EntitiesInBoxNode(areanode_t *node, vec3_t mins, vec3_t maxs, in if (node->axis >= 0) { - + if ( maxs[node->axis] > node->dist ) linkcount += SVQ3_EntitiesInBoxNode(node->children[0], mins, maxs, list+linkcount, maxcount-linkcount); if ( mins[node->axis] < node->dist ) @@ -439,7 +439,7 @@ static void SVQ3_Trace(q3trace_t *result, vec3_t start, vec3_t mins, vec3_t maxs if (ourowner == ENTITYNUM_WORLD) ourowner = -1; } - else + else ourowner = -1; @@ -516,7 +516,7 @@ static int SVQ3_PointContents(vec3_t pos, int entnum) if (ourowner == ENTITYNUM_WORLD) ourowner = -1; } - else + else ourowner = -1; for (i = SVQ3_EntitiesInBox(pos, pos, contactlist, sizeof(contactlist)/sizeof(contactlist[0]))-1; i >= 0; i--) @@ -598,7 +598,7 @@ typedef struct { int serverTime; int angles[3]; int buttons; - qbyte weapon; // weapon + qbyte weapon; // weapon signed char forwardmove, rightmove, upmove; } q3usercmd_t; #define CMD_MASK Q3UPDATE_MASK @@ -637,7 +637,7 @@ void SVQ3_SendServerCommand(client_t *cl, char *str) } return; } - + cl->num_server_commands++; Q_strncpyz(cl->server_commands[cl->num_server_commands & TEXTCMD_MASK], str, sizeof(cl->server_commands[0])); } @@ -776,7 +776,7 @@ static qintptr_t Q3G_SystemCalls(void *offset, unsigned int mask, qintptr_t fn, Cbuf_AddText(VM_POINTER(arg[1]), RESTRICT_SERVER); return 0; - + case G_FS_FOPEN_FILE: //fopen if ((int)arg[1] + 4 >= mask || VM_POINTER(arg[1]) < offset) break; //out of bounds. @@ -1250,7 +1250,7 @@ static qintptr_t Q3G_SystemCalls(void *offset, unsigned int mask, qintptr_t fn, return botlib->ai.BotChooseLTGItem(VM_LONG(arg[0]), VM_POINTER(arg[1]), VM_POINTER(arg[2]), VM_LONG(arg[3])); case BOTLIB_AI_CHOOSE_NBG_ITEM: //FIXME: validatepointer ? - return botlib->ai.BotChooseNBGItem(VM_LONG(arg[0]), VM_POINTER(arg[1]), VM_POINTER(arg[2]), VM_LONG(arg[3]), VM_POINTER(arg[4]), VM_FLOAT(arg[5])); + return botlib->ai.BotChooseNBGItem(VM_LONG(arg[0]), VM_POINTER(arg[1]), VM_POINTER(arg[2]), VM_LONG(arg[3]), VM_POINTER(arg[4]), VM_FLOAT(arg[5])); case BOTLIB_AI_TOUCHING_GOAL: return botlib->ai.BotTouchingGoal(VM_POINTER(arg[0]), VM_POINTER(arg[1])); case BOTLIB_AI_ITEM_GOAL_IN_VIS_BUT_NOT_VISIBLE: @@ -1359,7 +1359,7 @@ static qintptr_t Q3G_SystemCalls(void *offset, unsigned int mask, qintptr_t fn, case BOTLIB_AI_SET_AVOID_GOAL_TIME: botlib->ai.BotSetAvoidGoalTime(VM_LONG(arg[0]), VM_LONG(arg[1]), VM_FLOAT(arg[2])); return 0; - + case BOTLIB_AI_ADD_AVOID_SPOT: botlib->ai.BotAddAvoidSpot(VM_LONG(arg[0]), VM_POINTER(arg[1]), VM_FLOAT(arg[2]), VM_LONG(arg[3])); return 0; @@ -1525,7 +1525,7 @@ static int QDECL BL_FRead( void *buffer, int len, fileHandle_t f ) //int BL_FWrite( const void *buffer, int len, fileHandle_t f ) //{ // return VM_FWrite(buffer, len, f, Z_TAG_BOTLIB); -//} +//} static void QDECL BL_FCloseFile( fileHandle_t f ) { VM_fclose((int)f, Z_TAG_BOTLIB); @@ -1712,26 +1712,26 @@ qboolean SVQ3_InitGame(void) q3_sentities = Z_Malloc(sizeof(q3serverEntity_t)*MAX_GENTITIES); strcpy(buffer, svs.info); - Info_SetValueForKey(buffer, "map", "", sizeof(buffer)); - Info_SetValueForKey(buffer, "maxclients", "", sizeof(buffer)); - Info_SetValueForKey(buffer, "mapname", sv.name, sizeof(buffer)); - Info_SetValueForKey(buffer, "sv_maxclients", "32", sizeof(buffer)); + Info_SetValueForKey(buffer, "map", "", sizeof(buffer)); + Info_SetValueForKey(buffer, "maxclients", "", sizeof(buffer)); + Info_SetValueForKey(buffer, "mapname", sv.name, sizeof(buffer)); + Info_SetValueForKey(buffer, "sv_maxclients", "32", sizeof(buffer)); SVQ3_SetConfigString(0, buffer); Cvar_Set(Cvar_Get("sv_running", "0", 0, "Q3 compatability"), "1"); sysinfo[0] = '\0'; - Info_SetValueForKey(sysinfo, "sv_serverid", va("%i", svs.spawncount), MAX_SERVERINFO_STRING); - + Info_SetValueForKey(sysinfo, "sv_serverid", va("%i", svs.spawncount), MAX_SERVERINFO_STRING); + str = FS_GetPackHashes(buffer, sizeof(buffer), false); Info_SetValueForKey(sysinfo, "sv_paks", str, MAX_SERVERINFO_STRING); str = FS_GetPackNames(buffer, sizeof(buffer), false); Info_SetValueForKey(sysinfo, "sv_pakNames", str, MAX_SERVERINFO_STRING); - + str = FS_GetPackHashes(buffer, sizeof(buffer), true); Info_SetValueForKey(sysinfo, "sv_referencedPaks", str, MAX_SERVERINFO_STRING); - + str = FS_GetPackNames(buffer, sizeof(buffer), true); Info_SetValueForKey(sysinfo, "sv_referencedPakNames", str, MAX_SERVERINFO_STRING); @@ -1808,7 +1808,7 @@ void SVQ3_Netchan_Transmit( client_t *client, int length, qbyte *data ); void SVQ3_CreateBaseline(void) { q3sharedEntity_t *ent; - int entnum; + int entnum; if (q3_baselines) Z_Free(q3_baselines); @@ -1914,7 +1914,7 @@ void SVQ3_EmitPacketEntities(client_t *client, q3client_frame_t *from, q3client_ continue; } } - + MSG_WriteBits(msg, ENTITYNUM_NONE, GENTITYNUM_BITS); // end of packetentities } @@ -1967,12 +1967,12 @@ void SVQ3_WriteSnapshotToClient(client_t *client, sizebuf_t *msg) // snap->snapFlags |= SNAPFLAG_RATE_DELAYED; // client->surpressCount = 0; // } - + // write snapshot header MSG_WriteBits(msg, svcq3_snapshot, 8); MSG_WriteBits(msg, snap->serverTime, 32); MSG_WriteBits(msg, delta, 8); // what we are delta'ing from - + // write snapFlags MSG_WriteBits(msg, snap->flags, 8); @@ -2019,7 +2019,7 @@ static int VARGS SVQ3_QsortEntityStates( const void *arg1, const void *arg2 ) SV_Error("SV_QsortEntityStates: duplicated entity"); return 0; - + } static qboolean SVQ3_EntityIsVisible( q3sharedEntity_t *ent ) @@ -2078,7 +2078,7 @@ static qboolean SVQ3_EntityIsVisible( q3sharedEntity_t *ent ) // ignore if not touching a PV leaf // sent = SENTITY_FOR_GENTITY( ent ); - + // check area if (sent->areanum < 0 || !(areabits[sent->areanum >> 3] & (1 << (sent->areanum & 7)))) { @@ -2103,7 +2103,7 @@ static qboolean SVQ3_EntityIsVisible( q3sharedEntity_t *ent ) } */ - + if (sent->num_clusters == -1) { // too many leafs for individual check, go by headnode @@ -2128,7 +2128,7 @@ static qboolean SVQ3_EntityIsVisible( q3sharedEntity_t *ent ) return false; // not visible } } - + return true; } @@ -2272,7 +2272,7 @@ void SVQ3_BuildClientSnapshot( client_t *client ) if( !SVQ3_EntityIsVisible( ent ) ) continue; - // merge PVS if portal + // merge PVS if portal portalarea = CM_PointLeafnum(sv.world.worldmodel, ent->s.origin2); portalarea = CM_LeafArea(sv.world.worldmodel, portalarea); @@ -2290,7 +2290,7 @@ void SVQ3_BuildClientSnapshot( client_t *client ) continue; if( !SVQ3_EntityIsVisible( ent ) ) continue; - + if (ent->s.number != i) { Con_DPrintf( "FIXING ENT->S.NUMBER!!!\n" ); @@ -2339,13 +2339,13 @@ void SVQ3_BuildClientSnapshot( client_t *client ) q3_next_snapshot_entities++; } - - + + for (i = 0; i < snap->areabytes;i++) { //fix areabits, q2->q3 style.. snap->areabits[i]^=255; } - + } void SVQ3Q1_ConvertEntStateQ1ToQ3(entity_state_t *q1, q3entityState_t *q3) @@ -2448,24 +2448,24 @@ void SVQ3Q1_SendGamestateConfigstrings(sizebuf_t *msg) memset(cfgstr, 0, sizeof(cfgstr)); sysinfo[0] = 0; - Info_SetValueForKey(sysinfo, "sv_serverid", va("%i", svs.spawncount), sizeof(sysinfo)); - + Info_SetValueForKey(sysinfo, "sv_serverid", va("%i", svs.spawncount), sizeof(sysinfo)); + str = refpackcrcs;//FS_GetPackHashes(buffer, sizeof(buffer), false); Info_SetValueForKey(sysinfo, "sv_paks", str, sizeof(sysinfo)); str = refpacknames;//FS_GetPackNames(buffer, sizeof(buffer), false); Info_SetValueForKey(sysinfo, "sv_pakNames", str, sizeof(sysinfo)); - + str = refpackcrcs;//FS_GetPackHashes(buffer, sizeof(buffer), true); Info_SetValueForKey(sysinfo, "sv_referencedPaks", str, sizeof(sysinfo)); - + str = refpacknames;//FS_GetPackNames(buffer, sizeof(buffer), true); Info_SetValueForKey(sysinfo, "sv_referencedPakNames", str, sizeof(sysinfo)); Con_Printf("Sysinfo: %s\n", sysinfo); str = "0"; Info_SetValueForKey(sysinfo, "sv_pure", str, sizeof(sysinfo)); - + str = "qwoverq3"; Info_SetValueForKey(sysinfo, "fs_game", str, sizeof(sysinfo)); @@ -2573,6 +2573,11 @@ void SVQ3_SendGameState(client_t *client) } } break; + // warning: enumeration value GT_? not handled in switch + case GT_HALFLIFE: + case GT_QUAKE2: + case GT_MAX: + break; } // write svc_eom command @@ -2782,7 +2787,7 @@ void SVQ3_ParseUsercmd(client_t *client, qboolean delta) int key; int cmdCount; char *string; - + if(delta) { client->delta_sequence = client->last_sequence; @@ -2793,7 +2798,7 @@ void SVQ3_ParseUsercmd(client_t *client, qboolean delta) client->delta_sequence = -1; // client is asking for retransmit // client->snapLatency[client->last_sequence & (LATENCY_COUNTS-1)] = -1; } - + // read number of usercmds in a packet cmdCount = MSG_ReadBits(8); if(cmdCount < 1) @@ -3037,7 +3042,7 @@ void SVQ3_ParseClientMessage(client_t *client) { break; } - + switch(c) { default: