diff --git a/common/asm_draw.h b/common/asm_draw.h index 9e31b84..66edbea 100644 --- a/common/asm_draw.h +++ b/common/asm_draw.h @@ -11,7 +11,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. @@ -57,7 +57,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define spanpackage_t_tfrac 20 #define spanpackage_t_light 24 #define spanpackage_t_zi 28 -#define spanpackage_t_size 32 +#define spanpackage_t_size 32 // edge_t structure // !!! if this is changed, it must be changed in r_shared.h too !!! @@ -143,7 +143,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // !!! if this is changed, it must be changed in model.h too !!! #define mtri_facesfront 0 #define mtri_vertindex 4 -#define mtri_size 16 +#define mtri_size 16 // !!! if this changes, array indexing in !!! // !!! d_polysa.s must be changed to match !!! diff --git a/common/asm_i386.h b/common/asm_i386.h index 5dad5b9..a6c8d4e 100644 --- a/common/asm_i386.h +++ b/common/asm_i386.h @@ -10,7 +10,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. diff --git a/common/block16.h b/common/block16.h index 1282fbd..afb62dd 100644 --- a/common/block16.h +++ b/common/block16.h @@ -10,7 +10,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. diff --git a/common/block8.h b/common/block8.h index e8986ba..6d9cf3d 100644 --- a/common/block8.h +++ b/common/block8.h @@ -10,7 +10,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. diff --git a/common/bothdefs.h b/common/bothdefs.h index 47f4221..670ffb4 100644 --- a/common/bothdefs.h +++ b/common/bothdefs.h @@ -11,7 +11,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. diff --git a/common/bspfile.h b/common/bspfile.h index 16379cc..f685072 100644 --- a/common/bspfile.h +++ b/common/bspfile.h @@ -10,7 +10,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. @@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MAX_MAP_PLANES 8192 #define MAX_MAP_NODES 32767 // because negative shorts are contents #define MAX_MAP_CLIPNODES 32767 // -#define MAX_MAP_LEAFS 32767 // +#define MAX_MAP_LEAFS 32767 // #define MAX_MAP_VERTS 65535 #define MAX_MAP_FACES 65535 #define MAX_MAP_MARKSURFACES 65535 @@ -98,7 +98,7 @@ typedef struct typedef struct { - int version; + int version; lump_t lumps[HEADER_LUMPS]; } dheader_t; @@ -199,7 +199,7 @@ typedef struct short side; int firstedge; // we must support > 64k edges - short numedges; + short numedges; short texinfo; // lighting info diff --git a/common/buildnum.c b/common/buildnum.c index f664d8d..1feab72 100644 --- a/common/buildnum.c +++ b/common/buildnum.c @@ -11,7 +11,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. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software @@ -28,15 +28,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. char *ddate = __DATE__ ; char *dtime = __TIME__ ; -char *mon[12] = +char *mon[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -char mond[12] = +char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; // returns days since Oct 24 1996 int build_number( void ) { - int m = 0; + int m = 0; int d = 0; int y = 0; int hr, min; diff --git a/common/cd_audio.c b/common/cd_audio.c index f0c2fac..4ab2a0f 100644 --- a/common/cd_audio.c +++ b/common/cd_audio.c @@ -10,7 +10,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. @@ -500,7 +500,7 @@ void CDAudio_Play(byte track, qboolean looping) if (!initialized || !enabled) return; - + if (!cd.valid) return; @@ -573,7 +573,7 @@ void CDAudio_Stop(void) { if (!initialized || !enabled) return; - + cdRequest->headerLength = 13; cdRequest->unit = 0; cdRequest->command = COMMAND_STOP_AUDIO; @@ -600,13 +600,13 @@ void CDAudio_Resume(void) { if (!initialized || !enabled) return; - + if (!cd.valid) return; if (!wasPlaying) return; - + cdRequest->headerLength = 13; cdRequest->unit = 0; cdRequest->command = COMMAND_RESUME_AUDIO; @@ -825,7 +825,7 @@ int CDAudio_Init(void) "disabled. Use \"-nocdaudio\" if you\n" "wish to avoid this message in the\n" "future. See README.TXT for help.\n" - ); + ); return -1; } if (regs.x.bx > 1) @@ -841,7 +841,7 @@ int CDAudio_Init(void) "MSCDEX version 2.00 or later\n" "required for music. See README.TXT\n" "for help.\n" - ); + ); Con_DPrintf("CDAudio_Init: MSCDEX version 2.00 or later required.\n"); return -1; } diff --git a/common/cd_linux.c b/common/cd_linux.c index 397c271..643526e 100644 --- a/common/cd_linux.c +++ b/common/cd_linux.c @@ -10,7 +10,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. @@ -85,7 +85,7 @@ static void CDAudio_Eject(void) if (cdfile == -1 || !enabled) return; // no cd init'd - if ( ioctl(cdfile, CDROMEJECT) == -1 ) + if ( ioctl(cdfile, CDROMEJECT) == -1 ) Con_DPrintf("CD eject ioctl failed\n"); } @@ -95,7 +95,7 @@ static void CDAudio_CloseDoor(void) if (cdfile == -1 || !enabled) return; // no cd init'd - if ( ioctl(cdfile, CDROMCLOSETRAY) == -1 ) + if ( ioctl(cdfile, CDROMCLOSETRAY) == -1 ) Con_DPrintf("CD close ioctl failed\n"); } @@ -109,7 +109,7 @@ static int CDAudio_GetAudioDiskInfo(void) cdValid = false; - if ( ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1 ) + if ( ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1 ) { Con_DPrintf("CD readtochdr ioctl failed\n"); return -1; @@ -150,7 +150,7 @@ void CDAudio_Play(byte track, qboolean looping) if (cdfile == -1 || !enabled) return; - + if (!cdValid) { CDAudio_GetAudioDiskInfo(); @@ -222,7 +222,7 @@ void CDAudio_Play(byte track, qboolean looping) return; } - if ( ioctl(cdfile, CDROMRESUME) == -1 ) + if ( ioctl(cdfile, CDROMRESUME) == -1 ) Con_DPrintf("CD resume ioctl failed\n"); playLooping = looping; @@ -238,7 +238,7 @@ void CDAudio_Stop(void) { if (cdfile == -1 || !enabled) return; - + if (!playing) return; @@ -257,7 +257,7 @@ void CDAudio_Pause(void) if (!playing) return; - if ( ioctl(cdfile, CDROMPAUSE) == -1 ) + if ( ioctl(cdfile, CDROMPAUSE) == -1 ) Con_DPrintf("CD pause ioctl failed\n"); wasPlaying = playing; @@ -269,14 +269,14 @@ void CDAudio_Resume(void) { if (cdfile == -1 || !enabled) return; - + if (!cdValid) return; if (!wasPlaying) return; - - if ( ioctl(cdfile, CDROMRESUME) == -1 ) + + if ( ioctl(cdfile, CDROMRESUME) == -1 ) Con_DPrintf("CD resume ioctl failed\n"); playing = true; } diff --git a/common/cd_null.c b/common/cd_null.c index 987761f..605e7c6 100644 --- a/common/cd_null.c +++ b/common/cd_null.c @@ -10,7 +10,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. diff --git a/common/cd_sdl.c b/common/cd_sdl.c index b073c63..bbc04a4 100644 --- a/common/cd_sdl.c +++ b/common/cd_sdl.c @@ -11,7 +11,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. @@ -59,7 +59,7 @@ void CDAudio_Play(byte track, qboolean looping) /* XXX - Does this default value make sense? */ CDstatus cd_stat = CD_ERROR; if(!cd_id || !enabled) return; - + if(!cdValid) { if(!CD_INDRIVE(cd_stat=SDL_CDStatus(cd_id)) ||(!cd_id->numtracks)) return; @@ -158,11 +158,11 @@ int CDAudio_Init() SDL_GetError()); return -1; } - + initialized = true; enabled = true; cdValid = true; - + if(!CD_INDRIVE(SDL_CDStatus(cd_id))) { Con_Printf("CDAudio_Init: No CD in drive.\n"); diff --git a/common/cd_win.c b/common/cd_win.c index dfdbbfc..5fd8037 100644 --- a/common/cd_win.c +++ b/common/cd_win.c @@ -10,7 +10,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. @@ -248,7 +248,7 @@ void CDAudio_Play(byte track, qboolean looping) if (!enabled) return; - + if (!cdValid) { CDAudio_GetAudioDiskInfo(); @@ -369,13 +369,13 @@ void CDAudio_Resume(void) if (!enabled) return; - + if (!cdValid) return; if (!wasPlaying) return; - + mciPlayParms.dwFrom = MCI_MAKE_TMSF(playTrack, 0, 0, 0); mciPlayParms.dwTo = MCI_MAKE_TMSF(playTrack + 1, 0, 0, 0); mciPlayParms.dwCallback = (DWORD)mainwindow; diff --git a/common/cd_wrapper.c b/common/cd_wrapper.c index 5aecb3d..a98f3b2 100644 --- a/common/cd_wrapper.c +++ b/common/cd_wrapper.c @@ -10,7 +10,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. diff --git a/common/cdaudio.h b/common/cdaudio.h index 18a1588..37ccf43 100644 --- a/common/cdaudio.h +++ b/common/cdaudio.h @@ -10,7 +10,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. diff --git a/common/cl_cam.c b/common/cl_cam.c index 4baad85..d4d40a0 100644 --- a/common/cl_cam.c +++ b/common/cl_cam.c @@ -12,7 +12,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. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software @@ -128,7 +128,7 @@ static void vectoangles(vec3_t vec, vec3_t ang) { float forward; float yaw, pitch; - + if (vec[1] == 0 && vec[0] == 0) { yaw = 0; @@ -173,7 +173,7 @@ qboolean Cam_DrawViewModel(void) // returns true if we should draw this player, we don't if we are chase camming qboolean Cam_DrawPlayer(int playernum) { - if (cl.spectator && autocam && locked && cl_chasecam->value && + if (cl.spectator && autocam && locked && cl_chasecam->value && spec_track == playernum) return false; return true; @@ -216,7 +216,7 @@ pmtrace_t Cam_DoTrace(vec3_t vec1, vec3_t vec2) VectorCopy (vec1, pmove.origin); return PM_PlayerMove(pmove.origin, vec2); } - + // Returns distance or 9999 if invalid for some reason static float Cam_TryFlyby(player_state_t *self, player_state_t *player, vec3_t vec, qboolean checkvis) { @@ -268,7 +268,7 @@ static qboolean Cam_IsVisible(player_state_t *player, vec3_t vec) return true; } -static qboolean InitFlyby(player_state_t *self, player_state_t *player, int checkvis) +static qboolean InitFlyby(player_state_t *self, player_state_t *player, int checkvis) { float f, max; vec3_t vec, vec2; @@ -354,7 +354,7 @@ static qboolean InitFlyby(player_state_t *self, player_state_t *player, int chec return false; } locked = true; - VectorCopy(vec, desired_position); + VectorCopy(vec, desired_position); return true; } @@ -377,7 +377,7 @@ static void Cam_CheckHighTarget(void) } else Cam_Unlock(); } - + // ZOID // // Take over the user controls and track a player. @@ -391,7 +391,7 @@ void Cam_Track(usercmd_t *cmd) if (!cl.spectator) return; - + if (cl_hightrack->value && !locked) Cam_CheckHighTarget(); @@ -419,7 +419,7 @@ void Cam_Track(usercmd_t *cmd) } } else cam_lastviewtime = realtime; - + // couldn't track for some reason if (!locked || !autocam) return; @@ -454,7 +454,7 @@ void Cam_Track(usercmd_t *cmd) // move there locally immediately VectorCopy(desired_position, self->origin); - + VectorSubtract(player->origin, desired_position, vec); vectoangles(vec, cl.viewangles); cl.viewangles[0] = -cl.viewangles[0]; @@ -507,7 +507,7 @@ void Cam_SetView(void) frame_t *frame; vec3_t vec, vec2; - if (cls.state != ca_active || !cl.spectator || + if (cls.state != ca_active || !cl.spectator || !autocam || !locked) return; @@ -635,7 +635,7 @@ void Cam_Reset(void) void CL_InitCam(void) { - cl_hightrack = Cvar_Get ("cl_hightrack","0",0,"None"); + cl_hightrack = Cvar_Get ("cl_hightrack","0",0,"None"); } diff --git a/common/cl_ents.c b/common/cl_ents.c index 4a1f684..0734d5b 100644 --- a/common/cl_ents.c +++ b/common/cl_ents.c @@ -11,7 +11,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. @@ -148,7 +148,7 @@ void CL_DecayLights (void) { if (dl->die < cl.time || !dl->radius) continue; - + dl->radius -= host_frametime*dl->decay; if (dl->radius < 0) dl->radius = 0; @@ -194,10 +194,10 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits) bitcounts[i]++; to->flags = bits; - + if (bits & U_MODEL) to->modelindex = MSG_ReadByte (); - + if (bits & U_FRAME) to->frame = MSG_ReadByte (); @@ -212,19 +212,19 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits) if (bits & U_ORIGIN1) to->origin[0] = MSG_ReadCoord (); - + if (bits & U_ANGLE1) to->angles[0] = MSG_ReadAngle(); if (bits & U_ORIGIN2) to->origin[1] = MSG_ReadCoord (); - + if (bits & U_ANGLE2) to->angles[1] = MSG_ReadAngle(); if (bits & U_ORIGIN3) to->origin[2] = MSG_ReadCoord (); - + if (bits & U_ANGLE3) to->angles[2] = MSG_ReadAngle(); #ifdef QUAKEWORLD @@ -474,9 +474,9 @@ void CL_LinkPacketEntities (void) ent->keynum = s1->number; ent->model = model = cl.model_precache[s1->modelindex]; - + // set colormap - if (s1->colormap && (s1->colormap < MAX_CLIENTS) + if (s1->colormap && (s1->colormap < MAX_CLIENTS) && !strcmp(ent->model->name,"progs/player.mdl") ) { ent->colormap = cl.players[s1->colormap-1].translations; @@ -490,7 +490,7 @@ void CL_LinkPacketEntities (void) // set skin ent->skinnum = s1->skinnum; - + // set frame ent->frame = s1->frame; @@ -519,7 +519,7 @@ void CL_LinkPacketEntities (void) // calculate origin for (i=0 ; i<3 ; i++) - ent->origin[i] = s2->origin[i] + + ent->origin[i] = s2->origin[i] + f * (s1->origin[i] - s2->origin[i]); // add automatic particle trails @@ -765,14 +765,14 @@ void CL_AddFlagModels (entity_t *ent, int team) f = 14; if (ent->frame >= 29 && ent->frame <= 40) { if (ent->frame >= 29 && ent->frame <= 34) { //axpain - if (ent->frame == 29) f = f + 2; + if (ent->frame == 29) f = f + 2; else if (ent->frame == 30) f = f + 8; else if (ent->frame == 31) f = f + 12; else if (ent->frame == 32) f = f + 11; else if (ent->frame == 33) f = f + 10; else if (ent->frame == 34) f = f + 4; } else if (ent->frame >= 35 && ent->frame <= 40) { // pain - if (ent->frame == 35) f = f + 2; + if (ent->frame == 35) f = f + 2; else if (ent->frame == 36) f = f + 10; else if (ent->frame == 37) f = f + 10; else if (ent->frame == 38) f = f + 8; @@ -781,7 +781,7 @@ void CL_AddFlagModels (entity_t *ent, int team) } } else if (ent->frame >= 103 && ent->frame <= 118) { if (ent->frame >= 103 && ent->frame <= 104) f = f + 6; //nailattack - else if (ent->frame >= 105 && ent->frame <= 106) f = f + 6; //light + else if (ent->frame >= 105 && ent->frame <= 106) f = f + 6; //light else if (ent->frame >= 107 && ent->frame <= 112) f = f + 7; //rocketattack else if (ent->frame >= 112 && ent->frame <= 118) f = f + 7; //shotattack } @@ -826,7 +826,7 @@ void CL_LinkPlayers (void) frame = &cl.frames[cl.parsecount&UPDATE_MASK]; - for (j=0, info=cl.players, state=frame->playerstate ; j < MAX_CLIENTS + for (j=0, info=cl.players, state=frame->playerstate ; j < MAX_CLIENTS ; j++, info++, state++) { if (state->messagenum != cl.parsecount) @@ -942,7 +942,7 @@ void CL_SetSolidEntities (void) continue; if (!cl.model_precache[state->modelindex]) continue; - if ( cl.model_precache[state->modelindex]->hulls[1].firstclipnode + if ( cl.model_precache[state->modelindex]->hulls[1].firstclipnode || cl.model_precache[state->modelindex]->clipbox ) { pmove.physents[pmove.numphysent].model = cl.model_precache[state->modelindex]; @@ -979,7 +979,7 @@ void CL_SetUpPlayerPrediction(qboolean dopred) frame = &cl.frames[cl.parsecount&UPDATE_MASK]; - for (j=0, pplayer = predicted_players, state=frame->playerstate; + for (j=0, pplayer = predicted_players, state=frame->playerstate; j < MAX_CLIENTS; j++, pplayer++, state++) { diff --git a/common/cl_input.c b/common/cl_input.c index 89cb4d1..90dbe33 100644 --- a/common/cl_input.c +++ b/common/cl_input.c @@ -11,7 +11,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. @@ -81,7 +81,7 @@ void KeyDown (kbutton_t *b) if (k == b->down[0] || k == b->down[1]) return; // repeating key - + if (!b->down[0]) b->down[0] = k; else if (!b->down[1]) @@ -91,7 +91,7 @@ void KeyDown (kbutton_t *b) Con_Printf ("Three keys down for a button!\n"); return; } - + if (b->state & 1) return; // still down b->state |= 1 + 2; // down + impulse down @@ -101,7 +101,7 @@ void KeyUp (kbutton_t *b) { int k; char *c; - + c = Cmd_Argv(1); if (c[0]) k = atoi(c); @@ -185,12 +185,12 @@ float CL_KeyState (kbutton_t *key) { float val; qboolean impulsedown, impulseup, down; - + impulsedown = key->state & 2; impulseup = key->state & 4; down = key->state & 1; val = 0; - + if (impulsedown && !impulseup) { if (down) { val = 0.5; // pressed and held this frame @@ -221,7 +221,7 @@ float CL_KeyState (kbutton_t *key) } key->state &= 1; // clear impulses - + return val; } @@ -252,7 +252,7 @@ void CL_AdjustAngles (void) { float speed; float up, down; - + if (in_speed.state & 1) speed = host_frametime * cl_anglespeedkey->value; else @@ -270,16 +270,16 @@ void CL_AdjustAngles (void) cl.viewangles[PITCH] -= speed*cl_pitchspeed->value * CL_KeyState (&in_forward); cl.viewangles[PITCH] += speed*cl_pitchspeed->value * CL_KeyState (&in_back); } - + up = CL_KeyState (&in_lookup); down = CL_KeyState(&in_lookdown); - + cl.viewangles[PITCH] -= speed*cl_pitchspeed->value * up; cl.viewangles[PITCH] += speed*cl_pitchspeed->value * down; if (up || down) V_StopPitchDrift (); - + cl.viewangles[PITCH] = bound( -70, cl.viewangles[PITCH], 80); cl.viewangles[ROLL] = bound( -50, cl.viewangles[ROLL], 50); } @@ -298,9 +298,9 @@ void CL_BaseMove (usercmd_t *cmd) return; #endif CL_AdjustAngles (); - + memset (cmd, 0, sizeof(*cmd)); -#ifdef QUAKEWORLD +#ifdef QUAKEWORLD VectorCopy (cl.viewangles, cmd->angles); #endif if (in_strafe.state & 1) @@ -316,10 +316,10 @@ void CL_BaseMove (usercmd_t *cmd) cmd->upmove -= cl_upspeed->value * CL_KeyState (&in_down); if (! (in_klook.state & 1) ) - { + { cmd->forwardmove += cl_forwardspeed->value * CL_KeyState (&in_forward); cmd->forwardmove -= cl_backspeed->value * CL_KeyState (&in_back); - } + } // // adjust for speed key @@ -366,11 +366,11 @@ void CL_FinishMove (usercmd_t *cmd) return; // // figure button bits -// +// if ( in_attack.state & 3 ) cmd->buttons |= 1; in_attack.state &= ~2; - + if (in_jump.state & 3) cmd->buttons |= 2; in_jump.state &= ~2; @@ -494,7 +494,7 @@ void CL_SendCmd (void) // // deliver the message // - Netchan_Transmit (&cls.netchan, buf.cursize, buf.data); + Netchan_Transmit (&cls.netchan, buf.cursize, buf.data); } #else /* @@ -513,14 +513,14 @@ void CL_SendCmd (void) { // get basic movement from keyboard CL_BaseMove (&cmd); - + // allow mice or other external controllers to add to the move //(*IN_Move) (&cmd); IN_Move(&cmd); - + // send the unreliable message CL_SendMove (&cmd); - + } if (cls.demoplayback) @@ -528,11 +528,11 @@ void CL_SendCmd (void) SZ_Clear (&cls.netchan.message); return; } - + // send the reliable message if (!cls.netchan.message.cursize) return; // no message at all - + if (!NET_CanSendMessage (cls.netcon)) { Con_DPrintf ("CL_WriteToServer: can't send\n"); @@ -556,11 +556,11 @@ void CL_SendMove (usercmd_t *cmd) int bits; sizebuf_t buf; byte data[128]; - + buf.maxsize = 128; buf.cursize = 0; buf.data = data; - + cl.cmd = *cmd; // @@ -572,7 +572,7 @@ void CL_SendMove (usercmd_t *cmd) for (i=0 ; i<3 ; i++) MSG_WriteAngle (&buf, cl.viewangles[i]); - + MSG_WriteShort (&buf, cmd->forwardmove); MSG_WriteShort (&buf, cmd->sidemove); MSG_WriteShort (&buf, cmd->upmove); @@ -581,15 +581,15 @@ void CL_SendMove (usercmd_t *cmd) // send button bits // bits = 0; - + if ( in_attack.state & 3 ) bits |= 1; in_attack.state &= ~2; - + if (in_jump.state & 3) bits |= 2; in_jump.state &= ~2; - + MSG_WriteByte (&buf, bits); MSG_WriteByte (&buf, in_impulse); @@ -614,7 +614,7 @@ void CL_SendMove (usercmd_t *cmd) // if (++cl.movemessages <= 2) return; - + if (NET_SendUnreliableMessage (cls.netcon, &buf) == -1) { Con_Printf ("CL_SendMove: lost server connection\n"); diff --git a/common/cl_main.c b/common/cl_main.c index 7d6aa44..ecfdce8 100644 --- a/common/cl_main.c +++ b/common/cl_main.c @@ -12,7 +12,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. @@ -295,7 +295,7 @@ void CL_ClearState (void) SZ_Clear (&cls.netchan.message); -// clear other arrays +// clear other arrays memset (cl_efrags, 0, sizeof(cl_efrags)); #ifdef UQUAKE memset (cl_entities, 0, sizeof(cl_entities)); @@ -337,14 +337,14 @@ void CL_Color_f (void) top = atoi(Cmd_Argv(1)); bottom = atoi(Cmd_Argv(2)); } - + top &= 15; if (top > 13) top = 13; bottom &= 15; if (bottom > 13) bottom = 13; - + snprintf(num, sizeof(num), "%i", top); Cvar_Set ("topcolor", num); snprintf(num, sizeof(num), "%i", bottom); @@ -367,9 +367,9 @@ void CL_Connect_f (void) if (Cmd_Argc() != 2) { Con_Printf ("usage: connect \n"); - return; + return; } - + server = Cmd_Argv (1); CL_Disconnect (); @@ -408,7 +408,7 @@ void CL_ConnectionlessPacket (void) } Netchan_Setup (&cls.netchan, net_from, cls.qport); MSG_WriteChar (&cls.netchan.message, clc_stringcmd); - MSG_WriteString (&cls.netchan.message, "new"); + MSG_WriteString (&cls.netchan.message, "new"); cls.state = ca_connected; Con_Printf ("Connected.\n"); allowremotecmd = false; // localid required now for remote cmds @@ -489,7 +489,7 @@ void CL_ConnectionlessPacket (void) data[3] = 0xff; data[4] = A2A_ACK; data[5] = 0; - + NET_SendPacket (6, data, net_from); return; } @@ -539,7 +539,7 @@ void CL_Disconnect (void) // stop sounds (especially looping!) S_StopAllSounds (true); - + // bring the console down and fade the colors back to normal // SCR_BringDownConsole (); @@ -668,7 +668,7 @@ void CL_EstablishConnection (char *host) Host_Error ("CL_Connect: connect failed\n"); #endif Con_DPrintf ("CL_EstablishConnection: connected to %s\n", host); - + cls.demonum = -1; // not in the demo loop now cls.state = ca_connected; #ifdef UQUAKE @@ -777,7 +777,7 @@ float CL_LerpPoint (void) float f, frac; f = cl.mtime[0] - cl.mtime[1]; - + if (!f || cl_nolerp->value || cls.timedemo || sv.active) { cl.time = cl.mtime[0]; @@ -812,7 +812,7 @@ SetPal(2); } else SetPal(0); - + return frac; } #endif @@ -911,7 +911,7 @@ void CL_PrintEntities_f (void) { entity_t *ent; int i; - + for (i=0,ent=cl_entities ; istring, &to); } - + NET_SendPacket (strlen(message)+1, message , to); } @@ -1017,7 +1017,7 @@ int CL_ReadFromServer (void) cl.oldtime = cl.time; cl.time += host_frametime; - + do { ret = CL_GetMessage (); @@ -1025,11 +1025,11 @@ int CL_ReadFromServer (void) Host_Error ("CL_ReadFromServer: lost server connection"); if (!ret) break; - + cl.last_received_message = realtime; CL_ParseServerMessage (); } while (ret && cls.state >= ca_connected); - + if (cl_shownet->value) Con_Printf ("\n"); @@ -1072,7 +1072,7 @@ void CL_ReadPackets (void) // // packet from server // - if (!cls.demoplayback && + if (!cls.demoplayback && !NET_CompareAdr (net_from, cls.netchan.remote_address)) { Con_DPrintf ("%s:sequenced packet without connection\n" @@ -1097,7 +1097,7 @@ void CL_ReadPackets (void) CL_Disconnect (); return; } - + } #endif @@ -1153,7 +1153,7 @@ void CL_RelinkEntities (void) vec3_t oldorg; dlight_t *dl; -// determine partial update time +// determine partial update time frac = CL_LerpPoint (); cl_numvisedicts = 0; @@ -1162,12 +1162,12 @@ void CL_RelinkEntities (void) // interpolate player info // for (i=0 ; i<3 ; i++) - cl.velocity[i] = cl.mvelocity[1][i] + + cl.velocity[i] = cl.mvelocity[1][i] + frac * (cl.mvelocity[0][i] - cl.mvelocity[1][i]); if (cls.demoplayback) { - // interpolate the angles + // interpolate the angles for (j=0 ; j<3 ; j++) { d = cl.mviewangles[0][j] - cl.mviewangles[1][j]; @@ -1178,9 +1178,9 @@ void CL_RelinkEntities (void) cl.viewangles[j] = cl.mviewangles[1][j] + frac*d; } } - + bobjrotate = anglemod(100*cl.time); - + // start on the entity after the world for (i=1,ent=cl_entities+1 ; iangles[j] = ent->msg_angles[1][j] + f*d; } - + } // rotate binary objects locally @@ -1249,14 +1249,14 @@ void CL_RelinkEntities (void) VectorCopy (ent->origin, dl->origin); dl->origin[2] += 16; AngleVectors (ent->angles, fv, rv, uv); - + VectorMA (dl->origin, 18, fv, dl->origin); dl->radius = 200 + (rand()&31); dl->minlight = 32; dl->die = cl.time + 0.1; } if (ent->effects & EF_BRIGHTLIGHT) - { + { dl = CL_AllocDlight (i); VectorCopy (ent->origin, dl->origin); dl->origin[2] += 16; @@ -1264,7 +1264,7 @@ void CL_RelinkEntities (void) dl->die = cl.time + 0.001; } if (ent->effects & EF_DIMLIGHT) - { + { dl = CL_AllocDlight (i); VectorCopy (ent->origin, dl->origin); dl->radius = 200 + (rand()&31); @@ -1272,7 +1272,7 @@ void CL_RelinkEntities (void) } #ifdef QUAKE2 if (ent->effects & EF_DARKLIGHT) - { + { dl = CL_AllocDlight (i); VectorCopy (ent->origin, dl->origin); dl->radius = 200.0 + (rand()&31); @@ -1280,7 +1280,7 @@ void CL_RelinkEntities (void) dl->dark = true; } if (ent->effects & EF_LIGHT) - { + { dl = CL_AllocDlight (i); VectorCopy (ent->origin, dl->origin); dl->radius = 200; @@ -1432,25 +1432,25 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon); MSG_WriteString (&cls.netchan.message, "prespawn"); cls.state = ca_onserver; break; - - case 2: + + case 2: MSG_WriteByte (&cls.netchan.message, clc_stringcmd); MSG_WriteString (&cls.netchan.message, va("name \"%s\"\n", cl_name->string)); - + MSG_WriteByte (&cls.netchan.message, clc_stringcmd); MSG_WriteString (&cls.netchan.message, va("color %i %i\n", ((int)cl_color->value)>>4, ((int)cl_color->value)&15)); - + MSG_WriteByte (&cls.netchan.message, clc_stringcmd); snprintf(str, sizeof(str), "spawn %s", cls.spawnparms); MSG_WriteString (&cls.netchan.message, str); break; - - case 3: + + case 3: MSG_WriteByte (&cls.netchan.message, clc_stringcmd); MSG_WriteString (&cls.netchan.message, "begin"); Cache_Report (); // print remaining memory break; - + case 4: SCR_EndLoadingPlaque (); // allow normal screen updates cls.state = ca_active; @@ -1563,7 +1563,7 @@ void SetPal (int i) static int old; byte pal[768]; int c; - + if (i == old) return; old = i; @@ -1628,7 +1628,7 @@ void CL_Init (void) // register our commands // Cmd_AddCommand ("changing", CL_Changing_f); -#ifdef UQUAKE +#ifdef UQUAKE Cmd_AddCommand ("entities", CL_PrintEntities_f); #endif Cmd_AddCommand ("disconnect", CL_Disconnect_f); @@ -1760,7 +1760,7 @@ void CL_InitCvars() "None"); topcolor = Cvar_Get ("topcolor","0", CVAR_ARCHIVE|CVAR_USERINFO|CVAR_SERVERINFO, - "None"); + "None"); bottomcolor = Cvar_Get ("bottomcolor","0", CVAR_ARCHIVE|CVAR_USERINFO|CVAR_SERVERINFO, "None"); diff --git a/common/cl_tent.c b/common/cl_tent.c index d68232f..b903c5f 100644 --- a/common/cl_tent.c +++ b/common/cl_tent.c @@ -11,7 +11,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. @@ -106,7 +106,7 @@ explosion_t int i; float time; int index; - + for (i=0 ; istart = cl.time; ex->model = Mod_ForName ("progs/s_explod.spr", true); break; - - + + case TE_TAREXPLOSION: // tarbaby explosion pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); @@ -292,29 +292,29 @@ CL_ParseTEnt (void) case TE_LIGHTNING1: // lightning bolts CL_ParseBeam (Mod_ForName("progs/bolt.mdl", true)); break; - + case TE_LIGHTNING2: // lightning bolts CL_ParseBeam (Mod_ForName("progs/bolt2.mdl", true)); break; - + case TE_LIGHTNING3: // lightning bolts CL_ParseBeam (Mod_ForName("progs/bolt3.mdl", true)); break; - - case TE_LAVASPLASH: + + case TE_LAVASPLASH: pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); R_LavaSplash (pos); break; - + case TE_TELEPORT: pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); R_TeleportSplash (pos); break; - + #ifdef QUAKEWORLD case TE_GUNSHOT: // bullet hitting wall cnt = MSG_ReadByte (); @@ -323,7 +323,7 @@ CL_ParseTEnt (void) pos[2] = MSG_ReadCoord (); R_RunParticleEffect (pos, vec3_origin, 0, 20 * cnt); break; - + case TE_BLOOD: // bullets hitting body cnt = MSG_ReadByte (); pos[0] = MSG_ReadCoord (); @@ -347,8 +347,8 @@ CL_ParseTEnt (void) pos[2] = MSG_ReadCoord (); R_RunParticleEffect (pos, vec3_origin, 0, 20); break; - -// PGM 01/21/97 + +// PGM 01/21/97 case TE_BEAM: // grappling hook beam CL_ParseBeam (Mod_ForName("progs/beam.mdl", true)); break; @@ -417,7 +417,7 @@ entity_t ent = &cl_visedicts[cl_numvisedicts]; cl_numvisedicts++; ent->keynum = 0; - + memset (ent, 0, sizeof(*ent)); ent->colormap = vid.colormap; @@ -468,7 +468,7 @@ CL_UpdateBeams (void) yaw = (int) (atan2(dist[1], dist[0]) * 180 / M_PI); if (yaw < 0) yaw += 360; - + forward = sqrt (dist[0]*dist[0] + dist[1]*dist[1]); pitch = (int) (atan2(dist[2], forward) * 180 / M_PI); if (pitch < 0) diff --git a/common/client.h b/common/client.h index d039fe2..0d78218 100644 --- a/common/client.h +++ b/common/client.h @@ -11,7 +11,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. @@ -214,7 +214,7 @@ typedef struct int signon; struct qsocket_s *netcon; - + // demos - this stuff can't go into client_state_t int demonum; char demos[MAX_DEMOS][MAX_DEMONAME]; @@ -224,8 +224,8 @@ typedef struct int forcetrack; QFile *demofile; float td_lastframe; - int td_startframe; - float td_starttime; + int td_startframe; + float td_starttime; } client_static_t; @@ -239,7 +239,7 @@ typedef struct { int movemessages; // since connecting to this server // throw out the first couple, so the - // player doesn't accidentally do + // player doesn't accidentally do // something the first frame // information for local display @@ -270,7 +270,7 @@ typedef struct int completed_time; // latched at intermission start float punchangle; // temporary yview for weapon kick int intermission; // don't change view, full screen, etc - + // // information that is static for the entire time connected to a server // @@ -321,11 +321,11 @@ typedef struct // UQ specific. int num_entities; // held in cl_entities array float last_received_message; // (time) for net trouble icon - double mtime[2]; // the timestamp of last two messages + double mtime[2]; // the timestamp of last two messages double oldtime; // previous cl.time, time-oldtime is // used to decay light values and // smooth step ups - + qboolean onground; qboolean inwater; float viewheight; diff --git a/common/cmd.c b/common/cmd.c index 4210e12..ac5c7cd 100644 --- a/common/cmd.c +++ b/common/cmd.c @@ -11,7 +11,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. @@ -97,7 +97,7 @@ Adds command text at the end of the buffer void Cbuf_AddText (char *text) { int l; - + l = Q_strlen (text); if (cmd_text.cursize + l >= cmd_text.maxsize) @@ -133,7 +133,7 @@ void Cbuf_InsertText (char *text) } else temp = NULL; // shut up compiler - + // add the entire text of the file Cbuf_AddText (text); SZ_Write (&cmd_text, "\n", 1); @@ -156,7 +156,7 @@ void Cbuf_Execute (void) char *text; char line[1024] = {0}; int quotes; - + while (cmd_text.cursize) { // find a \n or ; line break @@ -172,10 +172,10 @@ void Cbuf_Execute (void) if (text[i] == '\n' || text[i] == '\r') break; } - + memcpy (line, text, i); line[i] = '\0'; - + // delete the text from the command buffer and move remaining commands down // this is necessary because commands (exec, alias) can insert data at the // beginning of the text buffer @@ -191,7 +191,7 @@ void Cbuf_Execute (void) // execute the command line Cmd_ExecuteString (line, src_command); - + if (cmd_wait) { // skip out while text still remains in buffer, leaving it // for next frame @@ -224,7 +224,7 @@ void Cmd_StuffCmds_f (void) int i, j; int s; char *text, *build, c; - + // build the combined string to parse from s = 0; for (i=1 ; ivalue || developer->value)) Con_Printf ("execing %s\n",Cmd_Argv(1)); - + Cbuf_InsertText (f); Hunk_FreeToLowMark (mark); } @@ -320,7 +320,7 @@ Just prints the rest of the line to the console void Cmd_Echo_f (void) { int i; - + for (i=1 ; inext = cmd_alias; cmd_alias = a; } - strcpy (a->name, s); + strcpy (a->name, s); // copy the rest of the command line cmd[0] = 0; // start out with a null string @@ -393,7 +393,7 @@ void Cmd_Alias_f (void) strcat (cmd, " "); } strcat (cmd, "\n"); - + a->value = CopyString (cmd); } @@ -424,7 +424,7 @@ void Cmd_UnAlias_f (void) prev->next = a->next; if (a == cmd_alias) cmd_alias = a->next; - Z_Free (a); + Z_Free (a); return; } prev = a; @@ -479,7 +479,7 @@ char *Cmd_Argv (int arg) { if ( arg >= cmd_argc ) return cmd_null_string; - return cmd_argv[arg]; + return cmd_argv[arg]; } /* @@ -507,14 +507,14 @@ Parses the given string into command line tokens. void Cmd_TokenizeString (char *text) { int i; - + // clear the args from the last string for (i=0 ; inext) { @@ -616,12 +616,12 @@ char *Cmd_CompleteCommand (char *partial) cmd_function_t *cmd; int len; cmdalias_t *a; - + len = Q_strlen(partial); - + if (!len) return NULL; - + // check for exact match for (cmd=cmd_functions ; cmd ; cmd=cmd->next) if (!strcmp (partial,cmd->name)) @@ -658,7 +658,7 @@ void Cmd_ForwardToServer (void) Con_Printf ("Can't \"%s\", not connected\n", Cmd_Argv(0)); return; } - + if (cls.demoplayback) return; // not really connected @@ -691,7 +691,7 @@ void Cmd_ForwardToServer_f (void) Cbuf_InsertText ("snap\n"); return; } - + if (cls.demoplayback) return; // not really connected @@ -719,13 +719,13 @@ FIXME: lookupnoadd the token to speed search? ============ */ void Cmd_ExecuteString (char *text, cmd_source_t src) -{ +{ cmd_function_t *cmd; cmdalias_t *a; cmd_source = src; Cmd_TokenizeString (text); - + // execute the command line if (!Cmd_Argc()) return; // no tokens @@ -756,10 +756,10 @@ void Cmd_ExecuteString (char *text, cmd_source_t src) return; } } - + if (cl_warncmd->value || developer->value) Con_Printf ("Unknown command \"%s\"\n", Cmd_Argv(0)); - + } @@ -775,14 +775,14 @@ where the given parameter apears, or 0 if not present int Cmd_CheckParm (char *parm) { int i; - + if (!parm) Sys_Error ("Cmd_CheckParm: NULL"); for (i = 1; i < Cmd_Argc (); i++) if (! Q_strcasecmp (parm, Cmd_Argv (i))) return i; - + return 0; } diff --git a/common/cmd.h b/common/cmd.h index 40573cd..566bca5 100644 --- a/common/cmd.h +++ b/common/cmd.h @@ -11,7 +11,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. diff --git a/common/common.c b/common/common.c index 415df12..a156a8d 100644 --- a/common/common.c +++ b/common/common.c @@ -12,7 +12,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. @@ -88,7 +88,7 @@ Handles byte ordering and avoids alignment errors void MSG_WriteChar (sizebuf_t *sb, int c) { byte *buf; - + #ifdef PARANOID if (c < -128 || c > 127) Sys_Error ("MSG_WriteChar: range error"); @@ -101,7 +101,7 @@ void MSG_WriteChar (sizebuf_t *sb, int c) void MSG_WriteByte (sizebuf_t *sb, int c) { byte *buf; - + #ifdef PARANOID if (c < 0 || c > 255) Sys_Error ("MSG_WriteByte: range error"); @@ -114,7 +114,7 @@ void MSG_WriteByte (sizebuf_t *sb, int c) void MSG_WriteShort (sizebuf_t *sb, int c) { byte *buf; - + #ifdef PARANOID if (c < ((short)0x8000) || c > (short)0x7fff) Sys_Error ("MSG_WriteShort: range error"); @@ -128,7 +128,7 @@ void MSG_WriteShort (sizebuf_t *sb, int c) void MSG_WriteLong (sizebuf_t *sb, int c) { byte *buf; - + buf = SZ_GetSpace (sb, 4); buf[0] = c&0xff; buf[1] = (c>>8)&0xff; @@ -143,11 +143,11 @@ void MSG_WriteFloat (sizebuf_t *sb, float f) float f; int l; } dat; - - + + dat.f = f; dat.l = LittleLong (dat.l); - + SZ_Write (sb, &dat.l, 4); } @@ -207,7 +207,7 @@ void MSG_WriteDeltaUsercmd (sizebuf_t *buf, usercmd_t *from, usercmd_t *cmd) MSG_WriteAngle16 (buf, cmd->angles[1]); if (bits & CM_ANGLE3) MSG_WriteAngle16 (buf, cmd->angles[2]); - + if (bits & CM_FORWARD) MSG_WriteShort (buf, cmd->forwardmove); if (bits & CM_SIDE) @@ -242,70 +242,70 @@ int MSG_GetReadCount(void) int MSG_ReadChar (void) { int c; - + if (msg_readcount+1 > net_message.cursize) { msg_badread = true; return -1; } - + c = (signed char)net_message.data[msg_readcount]; msg_readcount++; - + return c; } int MSG_ReadByte (void) { int c; - + if (msg_readcount+1 > net_message.cursize) { msg_badread = true; return -1; } - + c = (unsigned char)net_message.data[msg_readcount]; msg_readcount++; - + return c; } int MSG_ReadShort (void) { int c; - + if (msg_readcount+2 > net_message.cursize) { msg_badread = true; return -1; } - + c = (short)(net_message.data[msg_readcount] + (net_message.data[msg_readcount+1]<<8)); - + msg_readcount += 2; - + return c; } int MSG_ReadLong (void) { int c; - + if (msg_readcount+4 > net_message.cursize) { msg_badread = true; return -1; } - + c = net_message.data[msg_readcount] + (net_message.data[msg_readcount+1]<<8) + (net_message.data[msg_readcount+2]<<16) + (net_message.data[msg_readcount+3]<<24); - + msg_readcount += 4; - + return c; } @@ -317,23 +317,23 @@ float MSG_ReadFloat (void) float f; int l; } dat; - + dat.b[0] = net_message.data[msg_readcount]; dat.b[1] = net_message.data[msg_readcount+1]; dat.b[2] = net_message.data[msg_readcount+2]; dat.b[3] = net_message.data[msg_readcount+3]; msg_readcount += 4; - + dat.l = LittleLong (dat.l); - return dat.f; + return dat.f; } char *MSG_ReadString (void) { static char string[2048]; int l,c; - + l = 0; do { @@ -343,9 +343,9 @@ char *MSG_ReadString (void) string[l] = c; l++; } while (l < sizeof(string)-1); - + string[l] = 0; - + return string; } @@ -353,7 +353,7 @@ char *MSG_ReadStringLine (void) { static char string[2048]; int l,c; - + l = 0; do { @@ -363,9 +363,9 @@ char *MSG_ReadStringLine (void) string[l] = c; l++; } while (l < sizeof(string)-1); - + string[l] = 0; - + return string; } @@ -391,7 +391,7 @@ void MSG_ReadDeltaUsercmd (usercmd_t *from, usercmd_t *move) memcpy (move, from, sizeof(*move)); bits = MSG_ReadByte (); - + // read current angles if (bits & CM_ANGLE1) move->angles[0] = MSG_ReadAngle16 (); @@ -399,7 +399,7 @@ void MSG_ReadDeltaUsercmd (usercmd_t *from, usercmd_t *move) move->angles[1] = MSG_ReadAngle16 (); if (bits & CM_ANGLE3) move->angles[2] = MSG_ReadAngle16 (); - + // read movement if (bits & CM_FORWARD) move->forwardmove = MSG_ReadShort (); @@ -407,7 +407,7 @@ void MSG_ReadDeltaUsercmd (usercmd_t *from, usercmd_t *move) move->sidemove = MSG_ReadShort (); if (bits & CM_UP) move->upmove = MSG_ReadShort (); - + // read buttons if (bits & CM_BUTTONS) move->buttons = MSG_ReadByte (); @@ -448,35 +448,35 @@ void SZ_Clear (sizebuf_t *buf) void *SZ_GetSpace (sizebuf_t *buf, int length) { void *data; - + if (buf->cursize + length > buf->maxsize) { if (!buf->allowoverflow) Sys_Error ("SZ_GetSpace: overflow without allowoverflow set (%d)", buf->maxsize); - + if (length > buf->maxsize) Sys_Error ("SZ_GetSpace: %i is > full buffer size", length); - + Sys_Printf ("SZ_GetSpace: overflow\n"); // because Con_Printf may be redirected - SZ_Clear (buf); + SZ_Clear (buf); buf->overflowed = true; } data = buf->data + buf->cursize; buf->cursize += length; - + return data; } void SZ_Write (sizebuf_t *buf, void *data, int length) { - Q_memcpy (SZ_GetSpace(buf,length),data,length); + Q_memcpy (SZ_GetSpace(buf,length),data,length); } void SZ_Print (sizebuf_t *buf, char *data) { int len; - + len = Q_strlen(data)+1; if (!buf->cursize || buf->data[buf->cursize-1]) @@ -494,7 +494,7 @@ COM_SkipPath char *COM_SkipPath (char *pathname) { char *last; - + last = pathname; while (*pathname) { @@ -546,15 +546,15 @@ COM_FileBase void COM_FileBase (char *in, char *out) { char *s, *s2; - + s = in + strlen(in) - 1; - + while (s != in && *s != '.') s--; - + for (s2 = s ; *s2 && *s2 != '/' ; s2--) ; - + if (s-s2 < 2) strcpy (out,"?model?"); else @@ -600,13 +600,13 @@ char *COM_Parse (char *data) { int c; int len; - + len = 0; com_token[0] = 0; - + if (!data) return NULL; - + // skip whitespace skipwhite: while ( (c = *data) <= ' ') @@ -615,7 +615,7 @@ skipwhite: return NULL; // end of file; data++; } - + // skip // comments if (c=='/' && data[1] == '/') { @@ -623,7 +623,7 @@ skipwhite: data++; goto skipwhite; } - + // handle quoted strings specially if (c == '\"') @@ -689,7 +689,7 @@ skipwhite: if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'') break; } while (c>32); - + com_token[len] = 0; return data; } @@ -721,19 +721,19 @@ char *va(char *format, ...) { va_list argptr; static char string[1024]; - + va_start (argptr, format); vsnprintf (string, sizeof(string), format, argptr); va_end (argptr); - return string; + return string; } /// just for debugging int memsearch (byte *start, int count, int search) { int i; - + for (i=0 ; i #define svc_damage 19 - + #define svc_spawnstatic 20 // svc_spawnbinary 21 #define svc_spawnbaseline 22 - + #define svc_temp_entity 23 #define svc_setpause 24 // [byte] on / off @@ -104,7 +104,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define svc_download 41 // [short] size [size bytes] #define svc_playerinfo 42 // variable -#define svc_nails 43 // [byte] num [48 bits] xyzpy 12 12 12 4 8 +#define svc_nails 43 // [byte] num [48 bits] xyzpy 12 12 12 4 8 #define svc_chokecount 44 // [byte] packets choked #define svc_modellist 45 // [strings] #define svc_soundlist 46 // [strings] @@ -176,9 +176,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TE_TELEPORT 11 #define TE_EXPLOSION2 12 -// PGM 01/21/97 +// PGM 01/21/97 #define TE_BEAM 13 -// PGM 01/21/97 +// PGM 01/21/97 // QUAKEWORLD #define TE_BLOOD 12 diff --git a/common/common_quakedef.h b/common/common_quakedef.h index 4545de1..7047a5b 100644 --- a/common/common_quakedef.h +++ b/common/common_quakedef.h @@ -11,7 +11,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. @@ -115,7 +115,7 @@ void Host_Quit_f (void); void Host_ClientCommands (char *fmt, ...); void Host_ShutdownServer (qboolean crash); -extern qboolean msg_suppress_1; +extern qboolean msg_suppress_1; // suppresses resolution and cache size console output // an fullscreen DIB focus gain/loss #endif // _COMMON_QUAKEDEF_H diff --git a/common/console.c b/common/console.c index f24c79c..25fdaa8 100644 --- a/common/console.c +++ b/common/console.c @@ -12,7 +12,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. @@ -61,7 +61,7 @@ qboolean con_debuglog; extern char key_lines[32][MAXCMDLINE]; extern int edit_line; extern int key_linepos; - + qboolean con_initialized; @@ -88,7 +88,7 @@ void Con_ToggleConsole_f (void) } else key_dest = key_console; - + Con_ClearNotify (); } @@ -108,7 +108,7 @@ void Con_ToggleChat_f (void) } else key_dest = key_console; - + Con_ClearNotify (); } @@ -123,7 +123,7 @@ void Con_Clear_f (void) Q_memset (con_chat.text, ' ', CON_TEXTSIZE); } - + /* ================ Con_ClearNotify @@ -132,12 +132,12 @@ Con_ClearNotify void Con_ClearNotify (void) { int i; - + for (i=0 ; idisplay = con->current; } - + /* ================ Con_CheckResize @@ -246,7 +246,7 @@ void Con_Init (void) con = &con_main; con_linewidth = -1; Con_CheckResize (); - + Con_Printf ("Console initialized.\n"); // @@ -323,7 +323,7 @@ void Con_Print (char *txt) cr = false; } - + if (!con->x) { Con_Linefeed (); @@ -351,7 +351,7 @@ void Con_Print (char *txt) con->x = 0; break; } - + } } @@ -369,24 +369,24 @@ void Con_Printf (char *fmt, ...) va_list argptr; char msg[MAXPRINTMSG]; static qboolean inupdate; - + va_start (argptr,fmt); vsnprintf (msg, sizeof(msg), fmt, argptr); va_end (argptr); - + // also echo to debugging console Sys_Printf ("%s", msg); // also echo to debugging console // log all messages to file if (con_debuglog) Sys_DebugLog(va("%s/qconsole.log",com_gamedir), "%s", msg); - + if (!con_initialized) return; - + // write it to the scrollable buffer Con_Print (msg); - + // update the screen immediately if the console is displayed if (cls.state != ca_active) { @@ -412,14 +412,14 @@ void Con_DPrintf (char *fmt, ...) { va_list argptr; char msg[MAXPRINTMSG]; - + if (!developer->value) return; // don't confuse non-developers with techie stuff... va_start (argptr,fmt); vsnprintf (msg, sizeof(msg), fmt, argptr); va_end (argptr); - + Con_Printf ("%s", msg); } @@ -462,7 +462,7 @@ void Con_DrawInput (void) // prestep if horizontally scrolling if (key_linepos >= con_linewidth) text += 1 + key_linepos - con_linewidth; - + // draw it y = con_vislines-22; @@ -499,7 +499,7 @@ void Con_DrawNotify (void) if (time > con_notifytime->value) continue; text = con->text + (i % con_totallines)*con_linewidth; - + clearnotify = 0; scr_copytop = 1; @@ -514,7 +514,7 @@ void Con_DrawNotify (void) { clearnotify = 0; scr_copytop = 1; - + if (chat_team) { Draw_String (8, v, "say_team:"); @@ -538,7 +538,7 @@ void Con_DrawNotify (void) Draw_Character ( (x+skip)<<3, v, 10+((int)(realtime*con_cursorspeed)&1)); v += 8; } - + if (v > con_notifylines) con_notifylines = v; } @@ -560,7 +560,7 @@ void Con_DrawConsole (int lines) int j, n; char dlbar[1024]; #endif - + if (lines <= 0) return; @@ -569,7 +569,7 @@ void Con_DrawConsole (int lines) // draw the text con_vislines = lines; - + // changed to line things up better rows = (lines-22)>>3; // rows of text to draw @@ -581,11 +581,11 @@ void Con_DrawConsole (int lines) // draw arrows to show the buffer is backscrolled for (x=0 ; xdisplay; for (i=0 ; icurrent - row >= con_totallines) break; // past scrollback wrap point - + text = con->text + (row % con_totallines)*con_linewidth; for (x=0 ; xnext) if (!Q_strcmp (var_name, var->name)) return var; @@ -66,7 +66,7 @@ Cvar_VariableValue float Cvar_VariableValue (char *var_name) { cvar_t *var; - + var = Cvar_FindVar (var_name); if (!var) return 0; @@ -82,7 +82,7 @@ Cvar_VariableString char *Cvar_VariableString (char *var_name) { cvar_t *var; - + var = Cvar_FindVar (var_name); if (!var) return cvar_null_string; @@ -99,12 +99,12 @@ char *Cvar_CompleteVariable (char *partial) { cvar_t *cvar; int len; - + len = Q_strlen(partial); - + if (!len) return NULL; - + // check exact match for (cvar=cvar_vars ; cvar ; cvar=cvar->next) if (!strcmp (partial,cvar->name)) @@ -132,7 +132,7 @@ Cvar_Set void Cvar_Set (char *var_name, char *value) { cvar_t *var; - + var = Cvar_FindVar (var_name); if (!var) { // there is an error in C code if this happens @@ -158,9 +158,9 @@ void Cvar_Set (char *var_name, char *value) } } #endif - + Z_Free (var->string); // free the old value string - + var->string = Z_Malloc (Q_strlen(value)+1); Q_strcpy (var->string, value); var->value = Q_atof (var->string); @@ -170,7 +170,7 @@ void Cvar_Set (char *var_name, char *value) { cvar_t *var; qboolean changed; - + var = Cvar_FindVar (var_name); if (!var) { // there is an error in C code if this happens @@ -180,11 +180,11 @@ void Cvar_Set (char *var_name, char *value) // Don't change if this is a CVAR_ROM if(var->flags&CVAR_ROM) return; - + changed = Q_strcmp(var->string, value); - + Z_Free (var->string); // free the old value string - + var->string = Z_Malloc (Q_strlen(value)+1); Q_strcpy (var->string, value); var->value = Q_atof (var->string); @@ -212,7 +212,7 @@ qboolean Cvar_Command (void) v = Cvar_FindVar (Cmd_Argv(0)); if (!v) return false; - + // perform a variable print or set if (Cmd_Argc() == 1) { @@ -236,7 +236,7 @@ with the archive flag set to true. void Cvar_WriteVariables (QFile *f) { cvar_t *var; - + for (var = cvar_vars ; var ; var = var->next) if (var->flags&CVAR_ARCHIVE) Qprintf (f, "%s \"%s\"\n", var->name, var->string); @@ -256,15 +256,15 @@ void Cvar_Set_f(void) var_name = Cmd_Argv (1); value = Cmd_Argv (2); var = Cvar_FindVar (var_name); - if (var) + if (var) { Cvar_Set (var->name, value); - } - else + } + else { var = Cvar_Get (var_name, value, CVAR_USER_CREATED|CVAR_HEAP, "User created cvar"); - } + } } void Cvar_Toggle_f (void) @@ -294,7 +294,7 @@ void Cvar_Help_f (void) if (Cmd_Argc() != 2) { - Con_Printf ("usage: help \n"); + Con_Printf ("usage: help \n"); return; } @@ -329,7 +329,7 @@ void Cvar_Init() void Cvar_Shutdown (void) { cvar_t *var,*next; - + var = cvar_vars; while(var) { @@ -340,7 +340,7 @@ void Cvar_Shutdown (void) free(var); var = next; } -} +} cvar_t *Cvar_Get(char *name, char *string, int cvarflags, char *description) @@ -354,7 +354,7 @@ cvar_t *Cvar_Get(char *name, char *string, int cvarflags, char *description) return NULL; } v = Cvar_FindVar(name); - if (!v) + if (!v) { v = (cvar_t *) malloc(sizeof(cvar_t)); // Cvar doesn't exist, so we create it @@ -365,7 +365,7 @@ cvar_t *Cvar_Get(char *name, char *string, int cvarflags, char *description) Q_strcpy (v->string, string); v->flags = cvarflags; v->description = strdup(description); - v->value = Q_atof (v->string); + v->value = Q_atof (v->string); return v; } // Cvar does exist, so we update the flags and return. diff --git a/common/cvar.h b/common/cvar.h index 2cb2368..22ce895 100644 --- a/common/cvar.h +++ b/common/cvar.h @@ -11,7 +11,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. @@ -32,7 +32,7 @@ typedef struct cvar_s char *name; char *string; int flags; - char *description; // for "help" command + char *description; // for "help" command // qboolean archive; // set to true to cause it to be saved to vars.rc // qboolean info; // added to serverinfo or userinfo when changed // qboolean server; // notifies players when changed (UQUAKE) @@ -54,12 +54,12 @@ typedef struct cvar_s #define CVAR_ROM 64 // display only, cannot be set by user at all #define CVAR_USER_CREATED 128 // created by a set command -#define CVAR_HEAP 256 // allocated off the heap, safe to free +#define CVAR_HEAP 256 // allocated off the heap, safe to free #define CVAR_CHEAT 512 // can not be changed if cheats are disabled #define CVAR_NORESTART 1024 // do not clear when a cvar_restart is issued #define CVAR_LATCH 2048 // will only change when C code next does // a Cvar_Get(), so it can't be changed -#define CVAR_TEMP 4906 // can be set even when cheats are +#define CVAR_TEMP 4906 // can be set even when cheats are // disabled, but is not archived // Zoid| A good CVAR_ROM example is basepath. The code should read "cvar_t diff --git a/common/cvars.c b/common/cvars.c index fb216f7..8bad3a5 100644 --- a/common/cvars.c +++ b/common/cvars.c @@ -9,7 +9,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. diff --git a/common/cvars.h b/common/cvars.h index 6d1b5df..a4de8a0 100644 --- a/common/cvars.h +++ b/common/cvars.h @@ -10,7 +10,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. diff --git a/common/d_edge.c b/common/d_edge.c index bd244bf..b8e0577 100644 --- a/common/d_edge.c +++ b/common/d_edge.c @@ -11,7 +11,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. @@ -89,7 +89,7 @@ void D_DrawSolidSurface (surf_t *surf, int color) espan_t *span; byte *pdest; int u, u2, pix; - + pix = (color<<24) | (color<<16) | (color<<8) | color; for (span=surf->spans ; span ; span=span->pnext) { diff --git a/common/d_fill.c b/common/d_fill.c index fc0e898..8c09a41 100644 --- a/common/d_fill.c +++ b/common/d_fill.c @@ -11,7 +11,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. @@ -55,7 +55,7 @@ void D_FillRect (vrect_t *rect, int color) rwidth = vid.width - rx; if (ry+rheight > vid.height) rheight = vid.height - rx; - + if (rwidth < 1 || rheight < 1) return; diff --git a/common/d_iface.h b/common/d_iface.h index 83cf7b7..c66644b 100644 --- a/common/d_iface.h +++ b/common/d_iface.h @@ -10,7 +10,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. @@ -98,7 +98,7 @@ typedef struct { typedef struct { int nump; - emitpoint_t *pverts; // there's room for an extra element at [nump], + emitpoint_t *pverts; // there's room for an extra element at [nump], // if the driver wants to duplicate element [0] at // element [nump] to avoid dealing with wrapping mspriteframe_t *pspriteframe; @@ -128,7 +128,7 @@ extern qboolean r_recursiveaffinetriangles; // true if a driver wants to use // recursive triangular subdivison // and vertex drawing via // D_PolysetDrawFinalVerts() past - // a certain distance (normally + // a certain distance (normally // only used by the software // driver) extern float r_aliasuvscale; // scale-up factor for screen u and v diff --git a/common/d_ifacea.h b/common/d_ifacea.h index 3516e6f..95ea2f9 100644 --- a/common/d_ifacea.h +++ b/common/d_ifacea.h @@ -10,7 +10,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. diff --git a/common/d_init.c b/common/d_init.c index 2591f5a..77a3732 100644 --- a/common/d_init.c +++ b/common/d_init.c @@ -10,7 +10,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. diff --git a/common/d_local.h b/common/d_local.h index 6158457..77cbaf7 100644 --- a/common/d_local.h +++ b/common/d_local.h @@ -11,7 +11,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. diff --git a/common/d_modech.c b/common/d_modech.c index b33c8ed..40347c8 100644 --- a/common/d_modech.c +++ b/common/d_modech.c @@ -11,7 +11,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. @@ -30,7 +30,7 @@ int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle; int d_y_aspect_shift, d_pix_min, d_pix_max, d_pix_shift; int d_scantable[MAXHEIGHT]; -short *zspantable[MAXHEIGHT]; +short *zspantable[MAXHEIGHT]; /* ================ diff --git a/common/d_part.c b/common/d_part.c index 642a503..00c3172 100644 --- a/common/d_part.c +++ b/common/d_part.c @@ -11,7 +11,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. @@ -67,7 +67,7 @@ void D_DrawParticle (particle_t *pparticle) transformed[0] = DotProduct(local, r_pright); transformed[1] = DotProduct(local, r_pup); - transformed[2] = DotProduct(local, r_ppn); + transformed[2] = DotProduct(local, r_ppn); if (transformed[2] < PARTICLE_Z_CLIP) return; @@ -78,7 +78,7 @@ void D_DrawParticle (particle_t *pparticle) u = (int)(xcenter + zi * transformed[0] + 0.5); v = (int)(ycenter - zi * transformed[1] + 0.5); - if ((v > d_vrectbottom_particle) || + if ((v > d_vrectbottom_particle) || (u > d_vrectright_particle) || (v < d_vrecty) || (u < d_vrectx)) diff --git a/common/d_polyse.c b/common/d_polyse.c index 21bbfb8..3ac6fa1 100644 --- a/common/d_polyse.c +++ b/common/d_polyse.c @@ -12,7 +12,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. @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // TODO: put in span spilling to shrink list size // !!! if this is changed, it must be changed in d_polysa.s too !!! -#define DPS_MAXSPANS MAXHEIGHT+1 +#define DPS_MAXSPANS MAXHEIGHT+1 // 1 extra for spanpackage that marks end // !!! if this is changed, it must be changed in asm_draw.h too !!! @@ -167,7 +167,7 @@ void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts) if (z >= *zbuf) { int pix; - + *zbuf = z; pix = skintable[fv->v[3]>>16][fv->v[2]>>16]; pix = ((byte *)acolormap)[pix + (fv->v[4] & 0xFF00) ]; @@ -202,7 +202,7 @@ void D_DrawSubdiv (void) if (((index0->v[1]-index1->v[1]) * (index0->v[0]-index2->v[0]) - - (index0->v[0]-index1->v[0]) * + (index0->v[0]-index1->v[0]) * (index0->v[1]-index2->v[1])) >= 0) { continue; @@ -377,7 +377,7 @@ split: if (z >= *zbuf) { int pix; - + *zbuf = z; pix = d_pcolormap[skintable[new[3]>>16][new[2]>>16]]; d_viewbuffer[d_scantable[new[1]] + new[0]] = pix; @@ -401,7 +401,7 @@ void D_PolysetUpdateTables (void) { int i; byte *s; - + if (r_affinetridesc.skinwidth != skinwidth || r_affinetridesc.pskin != skinstart) { @@ -998,7 +998,7 @@ void D_PolysetRecursiveDrawLine (int *lp1, int *lp2) int d; int new[6]; int ofs; - + d = lp2[0] - lp1[0]; if (d < -1 || d > 1) goto split; @@ -1022,7 +1022,7 @@ split: if (new[5] > d_pzbuffer[ofs]) { int pix; - + d_pzbuffer[ofs] = new[5]; pix = skintable[new[3]>>16][new[2]>>16]; // pix = ((byte *)acolormap)[pix + (new[4] & 0xFF00)]; @@ -1038,7 +1038,7 @@ void D_PolysetRecursiveTriangle2 (int *lp1, int *lp2, int *lp3) { int d; int new[4]; - + d = lp2[0] - lp1[0]; if (d < -1 || d > 1) goto split; diff --git a/common/d_scan.c b/common/d_scan.c index 33748d2..1df3a7f 100644 --- a/common/d_scan.c +++ b/common/d_scan.c @@ -11,7 +11,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. @@ -125,7 +125,7 @@ void Turbulent8 (espan_t *pspan) fixed16_t snext, tnext; float sdivz, tdivz, zi, z, du, dv, spancountminus1; float sdivz16stepu, tdivz16stepu, zi16stepu; - + r_turb_turb = sintable + ((int)(cl.time*SPEED)&(CYCLE-1)); r_turb_sstep = 0; // keep compiler happy diff --git a/common/d_sky.c b/common/d_sky.c index 669318d..a0cc9bc 100644 --- a/common/d_sky.c +++ b/common/d_sky.c @@ -10,7 +10,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. diff --git a/common/d_sprite.c b/common/d_sprite.c index f64df49..921f14b 100644 --- a/common/d_sprite.c +++ b/common/d_sprite.c @@ -10,7 +10,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. @@ -334,7 +334,7 @@ void D_SpriteScanRightEdge (void) } while (i != maxindex); - pspan->count = DS_SPAN_LIST_END; // mark the end of the span list + pspan->count = DS_SPAN_LIST_END; // mark the end of the span list } diff --git a/common/d_surf.c b/common/d_surf.c index c7ad763..38c78ff 100644 --- a/common/d_surf.c +++ b/common/d_surf.c @@ -10,7 +10,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. @@ -46,13 +46,13 @@ int D_SurfaceCacheForRes (int width, int height) size = Q_atoi(com_argv[COM_CheckParm("-surfcachesize")+1]) * 1024; return size; } - + size = SURFCACHE_SIZE_AT_320X200; pix = width*height; if (pix > 64000) size += (pix-64000)*3; - + return size; } @@ -72,7 +72,7 @@ void D_ClearCacheGuard (void) { byte *s; int i; - + s = (byte *)sc_base + sc_size; for (i=0 ; inext = NULL; sc_base->owner = NULL; sc_base->size = sc_size; - + D_ClearCacheGuard (); } @@ -110,7 +110,7 @@ D_FlushCaches void D_FlushCaches (void) { surfcache_t *c; - + if (!sc_base) return; @@ -119,7 +119,7 @@ void D_FlushCaches (void) if (c->owner) *c->owner = NULL; } - + sc_rover = sc_base; sc_base->next = NULL; sc_base->owner = NULL; @@ -141,7 +141,7 @@ surfcache_t *D_SCAlloc (int width, int size) if ((size <= 0) || (size > 0x10000)) Sys_Error ("D_SCAlloc: bad cache size %d\n", size); - + /* This adds the offset of data[0] in the surfcache_t struct. */ size += (int)((surfcache_t *)0)->data; @@ -162,12 +162,12 @@ surfcache_t *D_SCAlloc (int width, int size) } sc_rover = sc_base; } - + // colect and free surfcache_t blocks until the rover block is large enough new = sc_rover; if (sc_rover->owner) *sc_rover->owner = NULL; - + while (new->size < size) { // free another @@ -176,7 +176,7 @@ surfcache_t *D_SCAlloc (int width, int size) Sys_Error ("D_SCAlloc: hit the end of memory"); if (sc_rover->owner) *sc_rover->owner = NULL; - + new->size += sc_rover->size; new->next = sc_rover->next; } @@ -194,7 +194,7 @@ surfcache_t *D_SCAlloc (int width, int size) } else sc_rover = new->next; - + new->width = width; // DEBUG if (width > 0) @@ -208,7 +208,7 @@ surfcache_t *D_SCAlloc (int width, int size) r_cache_thrash = true; } else if (wrapped_this_time) - { + { d_roverwrapped = true; } @@ -254,9 +254,9 @@ int MaskForNum (int num) int D_log2 (int num) { int c; - + c = 0; - + while (num>>=1) c++; return c; @@ -281,7 +281,7 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel) r_drawsurf.lightadj[1] = d_lightstylevalue[surface->styles[1]]; r_drawsurf.lightadj[2] = d_lightstylevalue[surface->styles[2]]; r_drawsurf.lightadj[3] = d_lightstylevalue[surface->styles[3]]; - + // // see if the cache holds apropriate data // @@ -303,7 +303,7 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel) r_drawsurf.surfwidth = surface->extents[0] >> miplevel; r_drawsurf.rowbytes = r_drawsurf.surfwidth; r_drawsurf.surfheight = surface->extents[1] >> miplevel; - + // // allocate memory if needed // @@ -315,14 +315,14 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel) cache->owner = &surface->cachespots[miplevel]; cache->mipscale = surfscale; } - + if (surface->dlightframe == r_framecount) cache->dlight = 1; else cache->dlight = 0; r_drawsurf.surfdat = (pixel_t *)cache->data; - + cache->texture = r_drawsurf.texture; cache->lightadj[0] = r_drawsurf.lightadj[0]; cache->lightadj[1] = r_drawsurf.lightadj[1]; diff --git a/common/d_vars.c b/common/d_vars.c index ad45d3e..863ad8a 100644 --- a/common/d_vars.c +++ b/common/d_vars.c @@ -10,7 +10,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. diff --git a/common/d_zpoint.c b/common/d_zpoint.c index 871d3eb..ede9a50 100644 --- a/common/d_zpoint.c +++ b/common/d_zpoint.c @@ -10,7 +10,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. @@ -35,7 +35,7 @@ void D_DrawZPoint (void) byte *pdest; short *pz; int izi; - + pz = d_pzbuffer + (d_zwidth * r_zpointdesc.v) + r_zpointdesc.u; pdest = d_viewbuffer + d_scantable[r_zpointdesc.v] + r_zpointdesc.u; izi = (int)(r_zpointdesc.zi * 0x8000); diff --git a/common/dga_check.c b/common/dga_check.c index 64cf7fd..9de0110 100644 --- a/common/dga_check.c +++ b/common/dga_check.c @@ -1,6 +1,6 @@ /* dga_check.c - + Routines to check for XFree86 DGA and VidMode extensions Copyright (C) 2000 Contributors of the QuakeForge Project @@ -14,7 +14,7 @@ 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 @@ VID_CheckVMode(Display *dpy, int *maj_ver, int *min_ver) #if defined(HAS_DGA) int event_base, error_base; int dummy; - + if (! XF86VidModeQueryExtension(dpy, &event_base, &error_base)) { return 0; } diff --git a/common/dga_check.h b/common/dga_check.h index 68950e0..b89125a 100644 --- a/common/dga_check.h +++ b/common/dga_check.h @@ -1,8 +1,8 @@ /* dga_check.h - + Definitions for XFree86 DGA and VidMode support - + Copyright (C) 2000 Contributors of the QuakeForge Project Copyright (C) 2000 Marcus Sundberg [mackan@stacken.kth.se] Please see the file "AUTHORS" for a list of contributors @@ -14,13 +14,13 @@ 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. You should have received a copy of the GNU General Public License along with this program; if not, write to: - + Free Software Foundation, Inc. 59 Temple Place - Suite 330 Boston, MA 02111-1307, USA. diff --git a/common/dirent.c b/common/dirent.c index 00041d7..fab64ec 100644 --- a/common/dirent.c +++ b/common/dirent.c @@ -1,7 +1,7 @@ /* * dirent.c * - * Derived from DIRLIB.C by Matt J. Weinstein + * Derived from DIRLIB.C by Matt J. Weinstein * This note appears in the DIRLIB.H * DIRLIB.H by M. J. Weinstein Released to public domain 1-Jan-89 * diff --git a/common/dosisms.h b/common/dosisms.h index 7f12268..a6f9e45 100644 --- a/common/dosisms.h +++ b/common/dosisms.h @@ -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. diff --git a/common/draw.c b/common/draw.c index 3fd5a87..e61bc03 100644 --- a/common/draw.c +++ b/common/draw.c @@ -11,7 +11,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. @@ -74,7 +74,7 @@ qpic_t *Draw_CachePic (char *path) cachepic_t *pic; int i; qpic_t *dat; - + for (pic=menu_cachepics, i=0 ; iname)) break; @@ -96,7 +96,7 @@ qpic_t *Draw_CachePic (char *path) // load the pic from disk // COM_LoadCacheFile (path, &pic->cache); - + dat = (qpic_t *)pic->cache.data; if (!dat) { @@ -143,11 +143,11 @@ void Draw_Character (int x, int y, int num) byte *dest; byte *source; unsigned short *pusdest; - int drawline; + int drawline; int row, col; num &= 255; - + if (y <= -8) return; // totally off screen @@ -173,7 +173,7 @@ void Draw_Character (int x, int y, int num) if (r_pixbytes == 1) { dest = vid.conbuffer + y*vid.conrowbytes + x; - + while (drawline--) { if (source[0]) @@ -284,7 +284,7 @@ void Draw_Crosshair(void) byte c = (byte)crosshaircolor->value; if (crosshair->value == 2) { - x = scr_vrect.x + scr_vrect.width/2 + cl_crossx->value; + x = scr_vrect.x + scr_vrect.width/2 + cl_crossx->value; y = scr_vrect.y + scr_vrect.height/2 + cl_crossy->value; // FIXME: Find a better way to do this... Draw_Pixel(x - 1, y, c); @@ -297,8 +297,8 @@ void Draw_Crosshair(void) Draw_Pixel(x, y + 3, c); } else if (crosshair->value) Draw_Character ( - scr_vrect.x + scr_vrect.width/2-4 + cl_crossx->value, - scr_vrect.y + scr_vrect.height/2-4 + cl_crossy->value, + scr_vrect.x + scr_vrect.width/2-4 + cl_crossx->value, + scr_vrect.y + scr_vrect.height/2-4 + cl_crossy->value, '+'); } @@ -315,7 +315,7 @@ void Draw_DebugChar (char num) { byte *dest; byte *source; - int drawline; + int drawline; extern byte *draw_chars; int row, col; @@ -463,7 +463,7 @@ void Draw_TransPic (int x, int y, qpic_t *pic) { Sys_Error ("Draw_TransPic: bad coordinates"); } - + source = pic->data; if (r_pixbytes == 1) @@ -477,7 +477,7 @@ void Draw_TransPic (int x, int y, qpic_t *pic) for (u=0 ; uwidth ; u++) if ( (tbyte=source[u]) != TRANSPARENT_COLOR) dest[u] = tbyte; - + dest += vid.rowbytes; source += pic->width; } @@ -550,7 +550,7 @@ void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation) { Sys_Error ("Draw_TransPic: bad coordinates"); } - + source = pic->data; if (r_pixbytes == 1) @@ -642,7 +642,7 @@ void Draw_ConsoleBackground (int lines) + 320*186; memcpy(saveback, conback->data + 320*186, 320*8); - + // draw the pic if (r_pixbytes == 1) { diff --git a/common/draw.h b/common/draw.h index 3c9387f..732bcef 100644 --- a/common/draw.h +++ b/common/draw.h @@ -11,7 +11,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. diff --git a/common/gl_cl_parse.c b/common/gl_cl_parse.c index da1b0c5..3084bd7 100644 --- a/common/gl_cl_parse.c +++ b/common/gl_cl_parse.c @@ -12,7 +12,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. @@ -61,7 +61,7 @@ void CL_ParseUpdate (int bits) bits |= (i<<8); } - if (bits & U_LONGENTITY) + if (bits & U_LONGENTITY) num = MSG_ReadShort (); else num = MSG_ReadByte (); @@ -78,7 +78,7 @@ if (bits&(1<msgtime = cl.mtime[0]; - + if (bits & U_MODEL) { modnum = MSG_ReadByte (); @@ -87,7 +87,7 @@ if (bits&(1<baseline.modelindex; - + model = cl.model_precache[modnum]; if (model != ent->model) { @@ -106,7 +106,7 @@ if (bits&(1< 0 && num <= cl.maxclients) R_TranslatePlayerSkin (num - 1); } - + if (bits & U_FRAME) ent->frame = MSG_ReadByte (); else @@ -204,7 +204,7 @@ void CL_NewTranslation (int slot) int i, j; int top, bottom; byte *dest, *source; - + if (slot > cl.maxclients) Sys_Error ("CL_NewTranslation: slot > cl.maxclients"); dest = cl.scores[slot].translations; @@ -221,12 +221,12 @@ void CL_NewTranslation (int slot) else for (j=0 ; j<16 ; j++) dest[TOP_RANGE+j] = source[top+15-j]; - + if (bottom < 128) memcpy (dest + BOTTOM_RANGE, source + bottom, 16); else for (j=0 ; j<16 ; j++) - dest[BOTTOM_RANGE+j] = source[bottom+15-j]; + dest[BOTTOM_RANGE+j] = source[bottom+15-j]; } #endif } diff --git a/common/gl_draw.c b/common/gl_draw.c index 857eeac..016eecb 100644 --- a/common/gl_draw.c +++ b/common/gl_draw.c @@ -11,7 +11,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. @@ -292,7 +292,7 @@ qpic_t *Draw_CachePic (char *path) // // load the pic from disk // - dat = (qpic_t *)COM_LoadTempFile (path); + dat = (qpic_t *)COM_LoadTempFile (path); if (!dat) Sys_Error ("Draw_CachePic: failed to load %s", path); SwapPic (dat); @@ -460,7 +460,7 @@ void Draw_Character (int x, int y, int num) return; // space num &= 255; - + if (y <= -8) return; // totally off screen @@ -522,7 +522,7 @@ void Draw_Crosshair(void) unsigned char *pColor; if (crosshair->value == 3) { - x = scr_vrect.x + scr_vrect.width/2 - 3 + cl_crossx->value; + x = scr_vrect.x + scr_vrect.width/2 - 3 + cl_crossx->value; y = scr_vrect.y + scr_vrect.height/2 - 3 + cl_crossy->value; glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); @@ -531,7 +531,7 @@ void Draw_Crosshair(void) GL_Bind (cs_texture3); glBegin (GL_QUADS); - + glTexCoord2f (0, 0); glVertex2f (x - 7, y - 1); glTexCoord2f (1, 0); @@ -540,12 +540,12 @@ void Draw_Crosshair(void) glVertex2f (x + 9, y + 17); glTexCoord2f (0, 1); glVertex2f (x - 7, y + 17); - + glEnd (); - + glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); } else if (crosshair->value == 2) { - x = scr_vrect.x + scr_vrect.width/2 - 3 + cl_crossx->value; + x = scr_vrect.x + scr_vrect.width/2 - 3 + cl_crossx->value; y = scr_vrect.y + scr_vrect.height/2 - 3 + cl_crossy->value; glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); @@ -554,7 +554,7 @@ void Draw_Crosshair(void) GL_Bind (cs_texture); glBegin (GL_QUADS); - + glTexCoord2f (0, 0); glVertex2f (x - 4, y - 4); glTexCoord2f (1, 0); @@ -563,13 +563,13 @@ void Draw_Crosshair(void) glVertex2f (x + 12, y + 12); glTexCoord2f (0, 1); glVertex2f (x - 4, y + 12); - + glEnd (); - + glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); } else if (crosshair->value) - Draw_Character (scr_vrect.x + scr_vrect.width/2-4 + cl_crossx->value, - scr_vrect.y + scr_vrect.height/2-4 + cl_crossy->value, + Draw_Character (scr_vrect.x + scr_vrect.width/2-4 + cl_crossx->value, + scr_vrect.y + scr_vrect.height/2-4 + cl_crossy->value, '+'); } @@ -655,7 +655,7 @@ void Draw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int h if (scrap_dirty) Scrap_Upload (); gl = (glpic_t *)pic->data; - + oldglwidth = gl->sh - gl->sl; oldglheight = gl->th - gl->tl; @@ -664,7 +664,7 @@ void Draw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int h newtl = gl->tl + (srcy*oldglheight)/pic->height; newth = newtl + (height*oldglheight)/pic->height; - + glColor4f (1,1,1,1); GL_Bind (gl->texnum); glBegin (GL_QUADS); @@ -692,7 +692,7 @@ void Draw_TransPic (int x, int y, qpic_t *pic) { Sys_Error ("Draw_TransPic: bad coordinates"); } - + Draw_Pic (x, y, pic); } @@ -769,7 +769,7 @@ void Draw_ConsoleBackground (int lines) conback = Draw_CachePic ("gfx/conback.lmp"); gl = (glpic_t *)conback->data; - + y = vid.height * 0.9; if (lines > y) alpha = 1; @@ -803,7 +803,7 @@ void Draw_ConsoleBackground (int lines) glCullFace(GL_FRONT); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); } - + ofs = (vid.height - lines)/(float)vid.height; glBegin (GL_QUADS); @@ -1225,7 +1225,7 @@ done: ; } } -void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha) +void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha) { int i, s; qboolean noalpha; @@ -1397,13 +1397,13 @@ int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolea { if (!strcmp (identifier, glt->identifier)) { - if (width != glt->width + if (width != glt->width || height != glt->height) { glt->width = width; glt->height = height; glt->mipmap = mipmap; - + GL_Bind (glt->texnum); GL_Upload8 (data, width, height, @@ -1446,12 +1446,12 @@ int GL_LoadPicTexture (qpic_t *pic) static GLenum oldtarget = TEXTURE0_SGIS; -void GL_SelectTexture (GLenum target) +void GL_SelectTexture (GLenum target) { if (!gl_mtexable) return; qglSelectTextureSGIS(target); - if (target == oldtarget) + if (target == oldtarget) return; cnttextures[oldtarget-TEXTURE0_SGIS] = currenttexture; currenttexture = cnttextures[target-TEXTURE0_SGIS]; diff --git a/common/gl_mesh.c b/common/gl_mesh.c index ec6f061..ed8cd02 100644 --- a/common/gl_mesh.c +++ b/common/gl_mesh.c @@ -12,7 +12,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. @@ -302,7 +302,7 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr) aliasmodel = m; paliashdr = hdr; // (aliashdr_t *)Mod_Extradata (m); - + modelcrc = m->numclipnodes + m->numedges + m->numframes + @@ -324,7 +324,7 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr) COM_StripExtension (m->name+strlen("progs/"), cache+strlen("glquake/")); strcat (cache, ".ms3"); - COM_FOpenFile (cache, &f); + COM_FOpenFile (cache, &f); if (f) { byte sig[2]; @@ -336,7 +336,7 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr) if ((memcmp(sig, "QF", sizeof(sig)) != 0) || cachecrc != modelcrc) { - Con_Printf ("Mismatched mesh on model %s\n",m->name); + Con_Printf ("Mismatched mesh on model %s\n",m->name); } else { @@ -348,7 +348,7 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr) fCacheSynced = 1; } } - + if (!fCacheSynced) { // @@ -378,7 +378,7 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr) byte sig[2]; memcpy(sig, "QF",2); Qwrite(f, sig, sizeof(sig)); - Qwrite(f, &modelcrc, sizeof(modelcrc)); + Qwrite(f, &modelcrc, sizeof(modelcrc)); Qwrite(f, &numcommands, 4); Qwrite(f, &numorder, 4); Qwrite(f, commands, numcommands * sizeof(commands[0])); @@ -396,7 +396,7 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr) paliashdr->commands = (byte *)cmds - (byte *)paliashdr; memcpy (cmds, commands, numcommands * 4); - verts = Hunk_Alloc (paliashdr->numposes * paliashdr->poseverts + verts = Hunk_Alloc (paliashdr->numposes * paliashdr->poseverts * sizeof(trivertx_t) ); paliashdr->posedata = (byte *)verts - (byte *)paliashdr; for (i=0 ; inumposes ; i++) diff --git a/common/gl_model.c b/common/gl_model.c index 9858fe2..b10e988 100644 --- a/common/gl_model.c +++ b/common/gl_model.c @@ -12,7 +12,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. @@ -76,13 +76,13 @@ Caches the data if needed void *Mod_Extradata (model_t *mod) { void *r; - + r = Cache_Check (&mod->cache); if (r) return r; Mod_LoadModel (mod, true); - + if (!mod->cache.data) Sys_Error ("Mod_Extradata: caching failed"); return mod->cache.data; @@ -98,7 +98,7 @@ mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model) mnode_t *node; float d; mplane_t *plane; - + if (!model || !model->nodes) Sys_Error ("Mod_PointInLeaf: bad model"); @@ -114,7 +114,7 @@ mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model) else node = node->children[1]; } - + return NULL; // never reached } @@ -131,7 +131,7 @@ byte *Mod_DecompressVis (byte *in, model_t *model) byte *out; int row; - row = (model->numleafs+7)>>3; + row = (model->numleafs+7)>>3; out = decompressed; #if 0 @@ -144,7 +144,7 @@ byte *Mod_DecompressVis (byte *in, model_t *model) *out++ = 0xff; row--; } - return decompressed; + return decompressed; } do @@ -154,7 +154,7 @@ byte *Mod_DecompressVis (byte *in, model_t *model) *out++ = *in++; continue; } - + c = in[1]; in += 2; while (c) @@ -164,7 +164,7 @@ byte *Mod_DecompressVis (byte *in, model_t *model) } } while (out - decompressed < row); #endif - + return decompressed; } @@ -184,7 +184,7 @@ void Mod_ClearAll (void) { int i; model_t *mod; - + for (i=0 , mod=mod_known ; itype != mod_alias) mod->needload = true; @@ -200,17 +200,17 @@ model_t *Mod_FindName (char *name) { int i; model_t *mod; - + if (!name[0]) Sys_Error ("Mod_ForName: NULL name"); - + // // search the currently loaded models // for (i=0 , mod=mod_known ; iname, name) ) break; - + if (i == mod_numknown) { if (mod_numknown == MAX_MOD_KNOWN) @@ -232,9 +232,9 @@ Mod_TouchModel void Mod_TouchModel (char *name) { model_t *mod; - + mod = Mod_FindName (name); - + if (!mod->needload) { if (mod->type == mod_alias) @@ -272,9 +272,9 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash) // if (!crash) { - + } - + // // load the file // @@ -285,12 +285,12 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash) Sys_Error ("Mod_NumForName: %s not found", mod->name); return NULL; } - + // // allocate a new model // COM_FileBase (mod->name, loadname); - + loadmodel = mod; // @@ -299,17 +299,17 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash) // call the apropriate loader mod->needload = false; - + switch (LittleLong(*(unsigned *)buf)) { case IDPOLYHEADER: Mod_LoadAliasModel (mod, buf); break; - + case IDSPRITEHEADER: Mod_LoadSpriteModel (mod, buf); break; - + default: Mod_LoadBrushModel (mod, buf); break; @@ -328,9 +328,9 @@ Loads in a model for the given name model_t *Mod_ForName (char *name, qboolean crash) { model_t *mod; - + mod = Mod_FindName (name); - + return Mod_LoadModel (mod, crash); } @@ -366,9 +366,9 @@ void Mod_LoadTextures (lump_t *l) return; } m = (dmiptexlump_t *)(mod_base + l->fileofs); - + m->nummiptex = LittleLong (m->nummiptex); - + loadmodel->numtextures = m->nummiptex; loadmodel->textures = Hunk_AllocName (m->nummiptex * sizeof(*loadmodel->textures) , loadname); @@ -382,7 +382,7 @@ void Mod_LoadTextures (lump_t *l) mt->height = LittleLong (mt->height); for (j=0 ; joffsets[j] = LittleLong (mt->offsets[j]); - + if ( (mt->width & 15) || (mt->height & 15) ) Sys_Error ("Texture %s is not 16 aligned", mt->name); pixels = mt->width*mt->height/64*85; @@ -396,9 +396,9 @@ void Mod_LoadTextures (lump_t *l) tx->offsets[j] = mt->offsets[j] + sizeof(texture_t) - sizeof(miptex_t); // the pixels immediately follow the structures memcpy ( tx+1, mt+1, pixels); - - if (!Q_strncmp(mt->name,"sky",3)) + + if (!Q_strncmp(mt->name,"sky",3)) R_InitSky (tx); else { @@ -472,7 +472,7 @@ void Mod_LoadTextures (lump_t *l) else Sys_Error ("Bad animating texture %s", tx->name); } - + #define ANIM_CYCLE 2 // link them all together for (j=0 ; jlightdata = NULL; return; } - loadmodel->lightdata = Hunk_AllocName ( l->filelen, loadname); + loadmodel->lightdata = Hunk_AllocName ( l->filelen, loadname); memcpy (loadmodel->lightdata, mod_base + l->fileofs, l->filelen); } @@ -531,7 +531,7 @@ void Mod_LoadVisibility (lump_t *l) loadmodel->visdata = NULL; return; } - loadmodel->visdata = Hunk_AllocName ( l->filelen, loadname); + loadmodel->visdata = Hunk_AllocName ( l->filelen, loadname); memcpy (loadmodel->visdata, mod_base + l->fileofs, l->filelen); } @@ -548,7 +548,7 @@ void Mod_LoadEntities (lump_t *l) loadmodel->entities = NULL; return; } - loadmodel->entities = Hunk_AllocName ( l->filelen, loadname); + loadmodel->entities = Hunk_AllocName ( l->filelen, loadname); memcpy (loadmodel->entities, mod_base + l->fileofs, l->filelen); } @@ -568,7 +568,7 @@ void Mod_LoadVertexes (lump_t *l) if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->vertexes = out; loadmodel->numvertexes = count; @@ -596,7 +596,7 @@ void Mod_LoadSubmodels (lump_t *l) if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->submodels = out; loadmodel->numsubmodels = count; @@ -632,7 +632,7 @@ void Mod_LoadEdges (lump_t *l) if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( (count + 1) * sizeof(*out), loadname); + out = Hunk_AllocName ( (count + 1) * sizeof(*out), loadname); loadmodel->edges = out; loadmodel->numedges = count; @@ -661,7 +661,7 @@ void Mod_LoadTexinfo (lump_t *l) if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->texinfo = out; loadmodel->numtexinfo = count; @@ -690,7 +690,7 @@ void Mod_LoadTexinfo (lump_t *l) miptex = LittleLong (in->miptex); out->flags = LittleLong (in->flags); - + if (!loadmodel->textures) { out->texture = r_notexture_mip; // checkerboard texture @@ -729,7 +729,7 @@ void CalcSurfaceExtents (msurface_t *s) maxs[0] = maxs[1] = -99999; tex = s->texinfo; - + for (i=0 ; inumedges ; i++) { e = loadmodel->surfedges[s->firstedge+i]; @@ -737,10 +737,10 @@ void CalcSurfaceExtents (msurface_t *s) v = &loadmodel->vertexes[loadmodel->edges[e].v[0]]; else v = &loadmodel->vertexes[loadmodel->edges[-e].v[1]]; - + for (j=0 ; j<2 ; j++) { - val = v->position[0] * tex->vecs[j][0] + + val = v->position[0] * tex->vecs[j][0] + v->position[1] * tex->vecs[j][1] + v->position[2] * tex->vecs[j][2] + tex->vecs[j][3]; @@ -752,7 +752,7 @@ void CalcSurfaceExtents (msurface_t *s) } for (i=0 ; i<2 ; i++) - { + { bmins[i] = floor(mins[i]/16); bmaxs[i] = ceil(maxs[i]/16); @@ -780,7 +780,7 @@ void Mod_LoadFaces (lump_t *l) if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->surfaces = out; loadmodel->numsurfaces = count; @@ -788,20 +788,20 @@ void Mod_LoadFaces (lump_t *l) for ( surfnum=0 ; surfnumfirstedge = LittleLong(in->firstedge); - out->numedges = LittleShort(in->numedges); + out->numedges = LittleShort(in->numedges); out->flags = 0; planenum = LittleShort(in->planenum); side = LittleShort(in->side); if (side) - out->flags |= SURF_PLANEBACK; + out->flags |= SURF_PLANEBACK; out->plane = loadmodel->planes + planenum; out->texinfo = loadmodel->texinfo + LittleShort (in->texinfo); CalcSurfaceExtents (out); - + // lighting info for (i=0 ; isamples = NULL; else out->samples = loadmodel->lightdata + i; - + // set the drawing flags flag - + if (!Q_strncmp(out->texinfo->texture->name,"sky",3)) // sky { out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED); @@ -822,7 +822,7 @@ void Mod_LoadFaces (lump_t *l) #endif continue; } - + if (!Q_strncmp(out->texinfo->texture->name,"*",1)) // turbulent { out->flags |= (SURF_DRAWTURB | SURF_DRAWTILED); @@ -868,7 +868,7 @@ void Mod_LoadNodes (lump_t *l) if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->nodes = out; loadmodel->numnodes = count; @@ -880,13 +880,13 @@ void Mod_LoadNodes (lump_t *l) out->minmaxs[j] = LittleShort (in->mins[j]); out->minmaxs[3+j] = LittleShort (in->maxs[j]); } - + p = LittleLong(in->planenum); out->plane = loadmodel->planes + p; out->firstsurface = LittleShort (in->firstface); out->numsurfaces = LittleShort (in->numfaces); - + for (j=0 ; j<2 ; j++) { p = LittleShort (in->children[j]); @@ -896,7 +896,7 @@ void Mod_LoadNodes (lump_t *l) out->children[j] = (mnode_t *)(loadmodel->leafs + (-1 - p)); } } - + Mod_SetParent (loadmodel->nodes, NULL); // sets nodes and leafs } @@ -917,7 +917,7 @@ void Mod_LoadLeafs (lump_t *l) if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->leafs = out; loadmodel->numleafs = count; @@ -938,14 +938,14 @@ void Mod_LoadLeafs (lump_t *l) out->firstmarksurface = loadmodel->marksurfaces + LittleShort(in->firstmarksurface); out->nummarksurfaces = LittleShort(in->nummarksurfaces); - + p = LittleLong(in->visofs); if (p == -1) out->compressed_vis = NULL; else out->compressed_vis = loadmodel->visdata + p; out->efrags = NULL; - + for (j=0 ; j<4 ; j++) out->ambient_sound_level[j] = in->ambient_level[j]; @@ -960,7 +960,7 @@ void Mod_LoadLeafs (lump_t *l) for (j=0 ; jnummarksurfaces ; j++) out->firstmarksurface[j]->flags |= SURF_DONTWARP; } - } + } } /* @@ -978,7 +978,7 @@ void Mod_LoadClipnodes (lump_t *l) if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->clipnodes = out; loadmodel->numclipnodes = count; @@ -1028,12 +1028,12 @@ void Mod_MakeHull0 (void) dclipnode_t *out; int i, j, count; hull_t *hull; - - hull = &loadmodel->hulls[0]; - + + hull = &loadmodel->hulls[0]; + in = loadmodel->nodes; count = loadmodel->numnodes; - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); hull->clipnodes = out; hull->firstclipnode = 0; @@ -1060,16 +1060,16 @@ Mod_LoadMarksurfaces ================= */ void Mod_LoadMarksurfaces (lump_t *l) -{ +{ int i, j, count; short *in; msurface_t **out; - + in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->marksurfaces = out; loadmodel->nummarksurfaces = count; @@ -1089,15 +1089,15 @@ Mod_LoadSurfedges ================= */ void Mod_LoadSurfedges (lump_t *l) -{ +{ int i, count; int *in, *out; - + in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->surfedges = out; loadmodel->numsurfedges = count; @@ -1119,13 +1119,13 @@ void Mod_LoadPlanes (lump_t *l) dplane_t *in; int count; int bits; - + in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*2*sizeof(*out), loadname); - + out = Hunk_AllocName ( count*2*sizeof(*out), loadname); + loadmodel->planes = out; loadmodel->numplanes = count; @@ -1173,9 +1173,9 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) int i, j; dheader_t *header; dmodel_t *bm; - + loadmodel->type = mod_brush; - + header = (dheader_t *)buffer; i = LittleLong (header->version); @@ -1198,17 +1198,17 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) for (i = 0; i < HEADER_LUMPS; i++) { if (i == LUMP_ENTITIES) continue; - mod->checksum ^= LittleLong(Com_BlockChecksum(mod_base + header->lumps[i].fileofs, + mod->checksum ^= LittleLong(Com_BlockChecksum(mod_base + header->lumps[i].fileofs, header->lumps[i].filelen)); if (i == LUMP_VISIBILITY || i == LUMP_LEAFS || i == LUMP_NODES) continue; - mod->checksum2 ^= LittleLong(Com_BlockChecksum(mod_base + header->lumps[i].fileofs, + mod->checksum2 ^= LittleLong(Com_BlockChecksum(mod_base + header->lumps[i].fileofs, header->lumps[i].filelen)); } // load into heap - + Mod_LoadVertexes (&header->lumps[LUMP_VERTEXES]); Mod_LoadEdges (&header->lumps[LUMP_EDGES]); Mod_LoadSurfedges (&header->lumps[LUMP_SURFEDGES]); @@ -1226,9 +1226,9 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) Mod_LoadSubmodels (&header->lumps[LUMP_MODELS]); Mod_MakeHull0 (); - + mod->numframes = 2; // regular and alternate animation - + // // set up the submodels (FIXME: this is confusing) // @@ -1242,10 +1242,10 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) mod->hulls[j].firstclipnode = bm->headnode[j]; mod->hulls[j].lastclipnode = mod->numclipnodes-1; } - + mod->firstmodelsurface = bm->firstface; mod->nummodelsurfaces = bm->numfaces; - + VectorCopy (bm->maxs, mod->maxs); VectorCopy (bm->mins, mod->mins); @@ -1297,7 +1297,7 @@ void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame) trivertx_t *pinframe; int i; daliasframe_t *pdaliasframe; - + //printf("pheader->numverts: %d\n", pheader->numverts); pdaliasframe = (daliasframe_t *)pin; @@ -1343,7 +1343,7 @@ void *Mod_LoadAliasGroup (void * pin, maliasframedesc_t *frame) int i, numframes; daliasinterval_t *pin_intervals; void *ptemp; - + pingroup = (daliasgroup_t *)pin; numframes = LittleLong (pingroup->numframes); @@ -1470,7 +1470,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) daliasskingroup_t *pinskingroup; int groupskins; daliasskininterval_t *pinskinintervals; - + skin = (byte *)(pskintype + 1); if (numskins < 1 || numskins > MAX_SKINS) @@ -1494,7 +1494,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) pheader->gl_texturenum[i][1] = pheader->gl_texturenum[i][2] = pheader->gl_texturenum[i][3] = - GL_LoadTexture (name, pheader->skinwidth, + GL_LoadTexture (name, pheader->skinwidth, pheader->skinheight, (byte *)(pskintype + 1), true, false); pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s); } else { @@ -1516,15 +1516,15 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) memcpy (texels, (byte *)(pskintype), s); } snprintf(name, sizeof(name), "%s_%i_%i", loadmodel->name, i,j); - pheader->gl_texturenum[i][j&3] = - GL_LoadTexture (name, pheader->skinwidth, + pheader->gl_texturenum[i][j&3] = + GL_LoadTexture (name, pheader->skinwidth, pheader->skinheight, (byte *)(pskintype), true, false); pskintype = (daliasskintype_t *)((byte *)(pskintype) + s); } k = j; for (/* */; j < 4; j++) - pheader->gl_texturenum[i][j&3] = - pheader->gl_texturenum[i][j - k]; + pheader->gl_texturenum[i][j&3] = + pheader->gl_texturenum[i][j - k]; } } @@ -1560,15 +1560,15 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer) CRC_Init(&crc); for (len = com_filesize, p = buffer; len; len--, p++) CRC_ProcessByte(&crc, *p); - + snprintf(st, sizeof(st), "%d", (int) crc); - Info_SetValueForKey (cls.userinfo, + Info_SetValueForKey (cls.userinfo, !strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name, st, MAX_INFO_STRING); if (cls.state >= ca_connected) { MSG_WriteByte (&cls.netchan.message, clc_stringcmd); - snprintf(st, sizeof(st), "setinfo %s %d", + snprintf(st, sizeof(st), "setinfo %s %d", !strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name, (int)crc); SZ_Print (&cls.netchan.message, st); @@ -1588,11 +1588,11 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer) // allocate space for a working header, plus all the data except the frames, // skin and group info // - size = sizeof (aliashdr_t) + size = sizeof (aliashdr_t) + (LittleLong (pinmodel->numframes) - 1) * sizeof (pheader->frames[0]); pheader = Hunk_AllocName (size, loadname); - + mod->flags = LittleLong (pinmodel->flags); // @@ -1716,10 +1716,10 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer) // // move the complete, relocatable alias model to the cache -// +// end = Hunk_LowMark (); total = end - start; - + Cache_Alloc (&mod->cache, total, loadname); if (!mod->cache.data) return; @@ -1837,7 +1837,7 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer) int numframes; int size; dspriteframetype_t *pframetype; - + pin = (dsprite_t *)buffer; version = LittleLong (pin->version); @@ -1864,7 +1864,7 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer) mod->maxs[0] = mod->maxs[1] = psprite->maxwidth/2; mod->mins[2] = -psprite->maxheight/2; mod->maxs[2] = psprite->maxheight/2; - + // // load the frames // diff --git a/common/gl_ngraph.c b/common/gl_ngraph.c index eea8eef..56f598c 100644 --- a/common/gl_ngraph.c +++ b/common/gl_ngraph.c @@ -11,7 +11,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. @@ -57,7 +57,7 @@ static void R_LineGraph (int x, int h) if (h>s) h = s; - + for (i=0 ; iefrag; - + while (ef) { prev = &ef->leaf->efrags; @@ -78,16 +78,16 @@ void R_RemoveEfrags (entity_t *ent) else prev = &walk->leafnext; } - + old = ef; ef = ef->entnext; - + // put it on the free list old->entnext = cl.free_efrags; cl.free_efrags = old; } - - ent->efrag = NULL; + + ent->efrag = NULL; } /* @@ -101,12 +101,12 @@ void R_SplitEntityOnNode (mnode_t *node) mplane_t *splitplane; mleaf_t *leaf; int sides; - + if (node->contents == CONTENTS_SOLID) { return; } - + // add an efrag if the node is a leaf if ( node->contents < 0) @@ -126,25 +126,25 @@ void R_SplitEntityOnNode (mnode_t *node) cl.free_efrags = cl.free_efrags->entnext; ef->entity = r_addent; - -// add the entity link + +// add the entity link *lastlink = ef; lastlink = &ef->entnext; ef->entnext = NULL; - + // set the leaf links ef->leaf = leaf; ef->leafnext = leaf->efrags; leaf->efrags = ef; - + return; } - + // NODE_MIXED splitplane = node->plane; sides = BOX_ON_PLANE_SIDE(r_emins, r_emaxs, splitplane); - + if (sides == 3) { // split on this plane @@ -152,11 +152,11 @@ void R_SplitEntityOnNode (mnode_t *node) if (!r_pefragtopnode) r_pefragtopnode = node; } - + // recurse down the contacted sides if (sides & 1) R_SplitEntityOnNode (node->children[0]); - + if (sides & 2) R_SplitEntityOnNode (node->children[1]); } @@ -172,15 +172,15 @@ void R_AddEfrags (entity_t *ent) { model_t *entmodel; int i; - + if (!ent->model) return; r_addent = ent; - + lastlink = &ent->efrag; r_pefragtopnode = NULL; - + entmodel = ent->model; for (i=0 ; i<3 ; i++) @@ -233,7 +233,7 @@ void R_StoreEfrags (efrag_t **ppefrag) ppefrag = &pefrag->leafnext; break; - default: + default: Sys_Error ("R_StoreEfrags: Bad entity type %d\n", clmodel->type); } } diff --git a/common/gl_rlight.c b/common/gl_rlight.c index 8a10e18..40bb1b9 100644 --- a/common/gl_rlight.c +++ b/common/gl_rlight.c @@ -11,7 +11,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. @@ -39,7 +39,7 @@ R_AnimateLight void R_AnimateLight (void) { int i,j,k; - + // // light animations // 'm' is normal light, 'a' is no light, 'z' is double bright @@ -55,7 +55,7 @@ void R_AnimateLight (void) k = cl_lightstyle[j].map[k] - 'a'; k = k*22; d_lightstylevalue[j] = k; - } + } } /* @@ -118,7 +118,7 @@ void R_RenderDlight (dlight_t *light) } glBegin (GL_TRIANGLE_FAN); - if (light->color[0] || light->color[1] || light->color[2] + if (light->color[0] || light->color[1] || light->color[2] || light->color[3]) // is there a color? glColor4f (light->color[0], light->color[1], light->color[2], light->color[3]); @@ -134,7 +134,7 @@ void R_RenderDlight (dlight_t *light) for (j=0 ; j<3 ; j++) v[j] = light->origin[j] + (vright[j]*(*bub_cos) + + vup[j]*(*bub_sin)) * rad; - bub_sin++; + bub_sin++; bub_cos++; glVertex3fv (v); } @@ -197,13 +197,13 @@ void R_MarkLights (dlight_t *light, int bit, mnode_t *node) float dist; msurface_t *surf; int i; - + if (node->contents < 0) return; splitplane = node->plane; dist = DotProduct (light->origin, splitplane->normal) - splitplane->dist; - + if (dist > light->radius) { R_MarkLights (light, bit, node->children[0]); @@ -214,7 +214,7 @@ void R_MarkLights (dlight_t *light, int bit, mnode_t *node) R_MarkLights (light, bit, node->children[1]); return; } - + // mark the polygons surf = cl.worldmodel->surfaces + node->firstsurface; for (i=0 ; inumsurfaces ; i++, surf++) @@ -289,13 +289,13 @@ RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end) int maps; r[0] = r[1] = r[2] = r[3] = 0; - + if (node->contents < 0) { r[3] = -1; return r; // didn't hit anything } - + // calculate mid point // FIXME: optimize for axial @@ -303,26 +303,26 @@ RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end) front = DotProduct (start, plane->normal) - plane->dist; back = DotProduct (end, plane->normal) - plane->dist; side = front < 0; - + if ( (back < 0) == side) return RecursiveLightPoint (node->children[side], start, end); - + frac = front / (front-back); mid[0] = start[0] + (end[0] - start[0])*frac; mid[1] = start[1] + (end[1] - start[1])*frac; mid[2] = start[2] + (end[2] - start[2])*frac; - -// go down front side + +// go down front side r = RecursiveLightPoint (node->children[side], start, mid); if (r[3] >= 0) return r; // hit something - + if ( (back < 0) == side ) { r[3] = -1; return r; // didn't hit anuthing } - + // check for impact on this node VectorCopy (mid, lightspot); lightplane = plane; @@ -334,17 +334,17 @@ RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end) continue; // no lightmaps tex = surf->texinfo; - + s = DotProduct (mid, tex->vecs[0]) + tex->vecs[0][3]; t = DotProduct (mid, tex->vecs[1]) + tex->vecs[1][3];; if (s < surf->texturemins[0] || t < surf->texturemins[1]) continue; - + ds = s - surf->texturemins[0]; dt = t - surf->texturemins[1]; - + if ( ds > surf->extents[0] || dt > surf->extents[1] ) continue; @@ -363,7 +363,7 @@ RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end) else lightmap += (dt * ((surf->extents[0]>>4)+1) + ds); - + for (maps = 0 ; (maps < MAXLIGHTMAPS) && (surf->styles[maps] != 255) ; @@ -411,19 +411,19 @@ R_LightPoint (vec3_t p) { vec3_t end; int *r = myr; - + if (!cl.worldmodel->lightdata) { r[0] = r[1] = r[2] = r[3] = 255; return r; } - + end[0] = p[0]; end[1] = p[1]; end[2] = p[2] - 2048; - + r = RecursiveLightPoint (cl.worldmodel->nodes, p, end); - + if (r[3] == -1) r[3] = 0; diff --git a/common/gl_rmain.c b/common/gl_rmain.c index 93288d9..da10f8e 100644 --- a/common/gl_rmain.c +++ b/common/gl_rmain.c @@ -1,10 +1,10 @@ /* gl_rmain.c - + Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1999,2000 contributors of the QuakeForge project Please see the file "AUTHORS" for a list of contributors - + Author: Date: 07 Jan 2000 @@ -15,13 +15,13 @@ 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. You should have received a copy of the GNU General Public License along with this program; if not, write to: - + Free Software Foundation, Inc. 59 Temple Place - Suite 330 Boston, MA 02111-1307, USA. @@ -54,7 +54,7 @@ mplane_t frustum[4]; int c_brush_polys, c_alias_polys; -qboolean envmap; // true during envmap command capture +qboolean envmap; // true during envmap command capture int currenttexture = -1; // to avoid unnecessary texture sets @@ -123,7 +123,7 @@ cvar_t *gl_nocolors; cvar_t *gl_keeptjunctions; cvar_t *gl_doubleeyes; -extern cvar_t *gl_ztrick; +extern cvar_t *gl_ztrick; #ifdef QUAKEWORLD extern cvar_t *scr_fov; #endif @@ -257,7 +257,7 @@ R_DrawSpriteModel (entity_t *e) { VectorMA (e->origin, frame->down, up, point); VectorMA (point, frame->right, right, point); glVertex3fv (point); - + glEnd (); glDisable (GL_ALPHA_TEST); @@ -327,7 +327,7 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum) // normals and vertexes come from the frame list - l = shadedots[verts->lightnormalindex] + l = shadedots[verts->lightnormalindex] * shadelight[3]; if (shadelight[0] || shadelight[1] || shadelight[2]) glColor3f (l*shadelight[0], l*shadelight[1], @@ -397,7 +397,7 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum) { verts++; } while (--count); glEnd (); - } + } } /* @@ -460,7 +460,7 @@ R_DrawAliasModel (entity_t *e) { shadelight[2] = (float)j[2]; shadelight[3] = (float)j[3]; ambientlight = shadelight[3]; - + // allways give the gun some light if (e == &cl.viewent && ambientlight < 24) ambientlight = shadelight[3] = 24; @@ -477,7 +477,7 @@ R_DrawAliasModel (entity_t *e) { if (add > 0) { ambientlight += add; - // ZOID: models should be affected by + // ZOID: models should be affected by // dlights as well shadelight[0] += cl_dlights[lnum].color[0]; shadelight[1] += cl_dlights[lnum].color[1]; @@ -497,7 +497,7 @@ R_DrawAliasModel (entity_t *e) { if (!strcmp(clmodel->name, "progs/player.mdl")) #else i = currententity - cl_entities; - if (i >= 1 && i <= cl.maxclients + if (i >= 1 && i <= cl.maxclients /*&& !strcmp (currententity->model->name, "progs/player.mdl")*/ ) #endif @@ -509,11 +509,11 @@ R_DrawAliasModel (entity_t *e) { // HACK HACK HACK -- no fullbright colors, so make torches full light ambientlight = shadelight[3] = 256; - shadedots = r_avertexnormal_dots[((int)(e->angles[1] + shadedots = r_avertexnormal_dots[((int)(e->angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)]; shadelight[3] /= 200.0; - + an = e->angles[1]/180*M_PI; shadevector[0] = cos(-an); shadevector[1] = sin(-an); @@ -570,7 +570,7 @@ R_DrawAliasModel (entity_t *e) { #else if (currententity->colormap != vid.colormap && !gl_nocolors->value) { i = currententity - cl_entities; - if (i >= 1 && i<=cl.maxclients + if (i >= 1 && i<=cl.maxclients /*&& !strcmp (currententity->model->name, "progs/player.mdl")*/ ) GL_Bind(playertextures - 1 + i); @@ -704,7 +704,7 @@ R_DrawViewModel ( void ) shadelight[2] = j[2]; shadelight[3] = j[3]; -// add dynamic lights +// add dynamic lights for (lnum=0 ; lnumradius) @@ -957,7 +957,7 @@ R_RenderScene ( void ) { R_SetupFrame (); R_SetFrustum (); - + R_SetupGL (); R_MarkLeaves (); // done here so we know if we're in water @@ -1065,12 +1065,12 @@ R_RenderView ( void ) { // render normal view /*** Render Volumetric Fog ***/ - - if(r_volfog->value) + + if(r_volfog->value) { R_RenderScene (); R_DrawViewModel (); - + glClear(GL_STENCIL_BUFFER_BIT); //glColorMask(GL_FALSE); glStencilFunc(GL_ALWAYS, 1, 1); @@ -1082,7 +1082,7 @@ R_RenderView ( void ) { glFogfv (GL_FOG_COLOR, colors); // fixme: GL_FOG_DENSITY should have r_volfog_density var glFogf (GL_FOG_DENSITY, r_volfog->value); - + glEnable(GL_FOG); R_DrawWaterSurfaces(); glDisable(GL_FOG); @@ -1094,11 +1094,11 @@ R_RenderView ( void ) { /*** Depth fog code ***/ - else if (r_fog->value) + else if (r_fog->value) { // FIXME: would be nice if the user could select what fogmode... (r_fog_mode) glFogi (GL_FOG_MODE, GL_EXP2); glFogfv (GL_FOG_COLOR, colors); - glFogf (GL_FOG_DENSITY, (GLfloat) r_fog->value); + glFogf (GL_FOG_DENSITY, (GLfloat) r_fog->value); // glFogi (GL_FOG_MODE, GL_LINEAR); // glFogfv (GL_FOG_COLOR, colors); // glFogf (GL_FOG_START, 300.0); @@ -1109,24 +1109,24 @@ R_RenderView ( void ) { R_RenderScene (); R_DrawViewModel (); R_DrawWaterSurfaces (); - + glDisable(GL_FOG); - } + } /*** Regular rendering code ***/ -else +else { R_RenderScene (); R_DrawViewModel (); R_DrawWaterSurfaces (); - } + } R_PolyBlend (); if (r_speeds->value) { //glFinish (); time2 = Sys_DoubleTime (); - Con_Printf ("%3i ms %4i wpoly %4i epoly\n", (int)((time2-time1)*1000), c_brush_polys, c_alias_polys); + Con_Printf ("%3i ms %4i wpoly %4i epoly\n", (int)((time2-time1)*1000), c_brush_polys, c_alias_polys); } } diff --git a/common/gl_rmisc.c b/common/gl_rmisc.c index ad84c94..623029c 100644 --- a/common/gl_rmisc.c +++ b/common/gl_rmisc.c @@ -11,7 +11,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. @@ -46,13 +46,13 @@ void R_InitTextures (void) // create a simple checkerboard texture for the default r_notexture_mip = Hunk_AllocName (sizeof(texture_t) + 16*16+8*8+4*4+2*2, "notexture"); - + r_notexture_mip->width = r_notexture_mip->height = 16; r_notexture_mip->offsets[0] = sizeof(texture_t); r_notexture_mip->offsets[1] = r_notexture_mip->offsets[0] + 16*16; r_notexture_mip->offsets[2] = r_notexture_mip->offsets[1] + 8*8; r_notexture_mip->offsets[3] = r_notexture_mip->offsets[2] + 4*4; - + for (m=0 ; m<4 ; m++) { dest = (byte *)r_notexture_mip + r_notexture_mip->offsets[m]; @@ -64,7 +64,7 @@ void R_InitTextures (void) else *dest++ = 0xff; } - } + } } byte dottexture[8][8] = @@ -133,39 +133,39 @@ void R_Envmap_f (void) GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - COM_WriteFile ("env0.rgb", buffer, sizeof(buffer)); + COM_WriteFile ("env0.rgb", buffer, sizeof(buffer)); r_refdef.viewangles[1] = 90; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - COM_WriteFile ("env1.rgb", buffer, sizeof(buffer)); + COM_WriteFile ("env1.rgb", buffer, sizeof(buffer)); r_refdef.viewangles[1] = 180; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - COM_WriteFile ("env2.rgb", buffer, sizeof(buffer)); + COM_WriteFile ("env2.rgb", buffer, sizeof(buffer)); r_refdef.viewangles[1] = 270; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - COM_WriteFile ("env3.rgb", buffer, sizeof(buffer)); + COM_WriteFile ("env3.rgb", buffer, sizeof(buffer)); r_refdef.viewangles[0] = -90; r_refdef.viewangles[1] = 0; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - COM_WriteFile ("env4.rgb", buffer, sizeof(buffer)); + COM_WriteFile ("env4.rgb", buffer, sizeof(buffer)); r_refdef.viewangles[0] = 90; r_refdef.viewangles[1] = 0; GL_BeginRendering (&glx, &gly, &glwidth, &glheight); R_RenderView (); glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - COM_WriteFile ("env5.rgb", buffer, sizeof(buffer)); + COM_WriteFile ("env5.rgb", buffer, sizeof(buffer)); envmap = false; glDrawBuffer (GL_BACK); @@ -179,14 +179,14 @@ R_Init =============== */ void R_Init (void) -{ +{ #ifndef QUAKEWORLD extern cvar_t *gl_finish; #endif /* QUAKEWORLD */ - Cmd_AddCommand ("timerefresh", R_TimeRefresh_f); - Cmd_AddCommand ("envmap", R_Envmap_f); - Cmd_AddCommand ("pointfile", R_ReadPointFile_f); + Cmd_AddCommand ("timerefresh", R_TimeRefresh_f); + Cmd_AddCommand ("envmap", R_Envmap_f); + Cmd_AddCommand ("pointfile", R_ReadPointFile_f); r_norefresh = Cvar_Get ("r_norefresh","0",0,"None"); r_lightmap = Cvar_Get ("r_lightmap","0",0,"None"); @@ -231,7 +231,7 @@ void R_Init (void) #endif R_InitBubble(); - + gl_doubleeyes = Cvar_Get ("gl_doubleeyes","1",CVAR_ARCHIVE,"None"); R_InitParticles (); @@ -311,7 +311,7 @@ void R_TranslatePlayerSkin (int playernum) translate[TOP_RANGE+i] = top+i; else translate[TOP_RANGE+i] = top+15-i; - + if (bottom < 128) translate[BOTTOM_RANGE+i] = bottom+i; else @@ -356,7 +356,7 @@ void R_TranslatePlayerSkin (int playernum) // don't mipmap these, because it takes too long - GL_Upload8 (translated, paliashdr->skinwidth, paliashdr->skinheight, + GL_Upload8 (translated, paliashdr->skinwidth, paliashdr->skinheight, false, false, true); #endif @@ -416,8 +416,8 @@ void R_TranslatePlayerSkin (int playernum) } } - glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, - scaled_width, scaled_height, 0, GL_RGBA, + glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, + scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); @@ -452,7 +452,7 @@ void R_TranslatePlayerSkin (int playernum) translate[TOP_RANGE+i] = top+i; else translate[TOP_RANGE+i] = top+15-i; - + if (bottom < 128) translate[BOTTOM_RANGE+i] = bottom+i; else @@ -574,7 +574,7 @@ R_NewMap void R_NewMap (void) { int i; - + for (i=0 ; i<256 ; i++) d_lightstylevalue[i] = 264; // normal light value @@ -585,7 +585,7 @@ void R_NewMap (void) // FIXME: is this one short? for (i=0 ; inumleafs ; i++) cl.worldmodel->leafs[i].efrags = NULL; - + r_viewleaf = NULL; R_ClearParticles (); diff --git a/common/gl_rpart.c b/common/gl_rpart.c index 7cd28c5..a368501 100644 --- a/common/gl_rpart.c +++ b/common/gl_rpart.c @@ -12,7 +12,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. @@ -52,10 +52,10 @@ void R_DrawParticles (void) vec3_t up, right; float scale; qboolean alphaTestEnabled; - + GL_Bind(particletexture); alphaTestEnabled = glIsEnabled(GL_ALPHA_TEST); - + if (alphaTestEnabled) glDisable(GL_ALPHA_TEST); glEnable (GL_BLEND); @@ -78,8 +78,8 @@ void R_DrawParticles (void) grav = frametime * 800 * 0.05; #endif dvel = 4*frametime; - - for ( ;; ) + + for ( ;; ) { kill = active_particles; if (kill && kill->die < cl.time) @@ -108,7 +108,7 @@ void R_DrawParticles (void) } // hack a scale up to keep particles from disapearing - scale = (p->org[0] - r_origin[0])*vpn[0] + scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1] + (p->org[2] - r_origin[2])*vpn[2]; if (scale < 20) @@ -140,7 +140,7 @@ void R_DrawParticles (void) p->org[0] += p->vel[0]*frametime; p->org[1] += p->vel[1]*frametime; p->org[2] += p->vel[2]*frametime; - + switch (p->type) { case pt_static: diff --git a/common/gl_rsurf.c b/common/gl_rsurf.c index 0ad9a50..261bcd3 100644 --- a/common/gl_rsurf.c +++ b/common/gl_rsurf.c @@ -11,7 +11,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. @@ -113,7 +113,7 @@ void R_AddDynamicLights (msurface_t *surf) local[0] -= surf->texturemins[0]; local[1] -= surf->texturemins[1]; - + for (t = 0 ; talternate_anims) base = base->alternate_anims; } - + if (!base->anim_total) return base; reletive = (int)(cl.time*10) % base->anim_total; - count = 0; + count = 0; while (base->anim_min > reletive || base->anim_max <= reletive) { base = base->anim_next; @@ -333,7 +333,7 @@ qboolean mtexenabled = false; void GL_SelectTexture (GLenum target); -void GL_DisableMultitexture(void) +void GL_DisableMultitexture(void) { if (mtexenabled) { glDisable(GL_TEXTURE_2D); @@ -342,7 +342,7 @@ void GL_DisableMultitexture(void) } } -void GL_EnableMultitexture(void) +void GL_EnableMultitexture(void) { if (gl_mtexable) { GL_SelectTexture(TEXTURE1_SGIS); @@ -435,7 +435,7 @@ void R_DrawSequentialPoly (msurface_t *s) glBlendFunc (GL_ZERO, GL_ONE_MINUS_SRC_COLOR); glDisable (GL_BLEND); - + } // @@ -493,7 +493,7 @@ void R_DrawSequentialPoly (msurface_t *s) { lightmap_modified[i] = false; theRect = &lightmap_rectchange[i]; - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t, + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t, BLOCK_WIDTH, theRect->h, gl_lightmap_format, GL_UNSIGNED_BYTE, lightmaps+(i* BLOCK_HEIGHT + theRect->t) *BLOCK_WIDTH*lightmap_bytes); theRect->l = BLOCK_WIDTH; @@ -595,7 +595,7 @@ void R_DrawSequentialPoly (msurface_t *s) { lightmap_modified[i] = false; theRect = &lightmap_rectchange[i]; - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t, + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t, BLOCK_WIDTH, theRect->h, gl_lightmap_format, GL_UNSIGNED_BYTE, lightmaps+(i* BLOCK_HEIGHT + theRect->t) *BLOCK_WIDTH*lightmap_bytes); theRect->l = BLOCK_WIDTH; @@ -761,12 +761,12 @@ void R_BlendLightmaps (void) // theRect->w = BLOCK_WIDTH; // theRect->h = BLOCK_HEIGHT; // glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes -// , BLOCK_WIDTH, BLOCK_HEIGHT, 0, +// , BLOCK_WIDTH, BLOCK_HEIGHT, 0, // gl_lightmap_format, GL_UNSIGNED_BYTE, lightmaps+i*BLOCK_WIDTH*BLOCK_HEIGHT*lightmap_bytes); // glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes -// , BLOCK_WIDTH, theRect->h, 0, +// , BLOCK_WIDTH, theRect->h, 0, // gl_lightmap_format, GL_UNSIGNED_BYTE, lightmaps+(i*BLOCK_HEIGHT+theRect->t)*BLOCK_WIDTH*lightmap_bytes); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t, + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t, BLOCK_WIDTH, theRect->h, gl_lightmap_format, GL_UNSIGNED_BYTE, lightmaps+(i* BLOCK_HEIGHT + theRect->t) *BLOCK_WIDTH*lightmap_bytes); theRect->l = BLOCK_WIDTH; @@ -776,7 +776,7 @@ void R_BlendLightmaps (void) } for ( ; p ; p=p->chain) { - + if (r_waterwarp->value && (p->flags & SURF_UNDERWATER)) { DrawGLWaterPolyLightmap (p); // if (r_waterwarp->value && ((r_viewleaf->contents==CONTENTS_EMPTY && (p->flags & SURF_UNDERWATER))) @@ -831,7 +831,7 @@ void R_RenderBrushPoly (msurface_t *fa) EmitBothSkyLayers (fa); return; } - + t = R_TextureAnimation (fa->texinfo->texture); GL_Bind (t->gl_texturenum); @@ -905,7 +905,7 @@ void R_RenderDynamicLightmaps (msurface_t *fa) if (fa->flags & ( SURF_DRAWSKY | SURF_DRAWTURB) ) return; - + fa->polys->chain = lightmap_polys[fa->lightmaptexturenum]; lightmap_polys[fa->lightmaptexturenum] = fa->polys; @@ -1030,7 +1030,7 @@ void R_DrawWaterSurfaces (void) GL_Bind (s->texinfo->texture->gl_texturenum); EmitWaterPolys (s); } - + waterchain = NULL; } else { @@ -1046,12 +1046,12 @@ void R_DrawWaterSurfaces (void) continue; // set modulate mode explicitly - + GL_Bind (t->gl_texturenum); for ( ; s ; s=s->texturechain) EmitWaterPolys (s); - + t->texturechain = NULL; } @@ -1088,7 +1088,7 @@ void DrawTextureChains (void) } return; - } + } for (i=0 ; inumtextures ; i++) { @@ -1245,7 +1245,7 @@ void R_RecursiveWorldNode (mnode_t *node) return; if (R_CullBox (node->minmaxs, node->minmaxs+3)) return; - + // if a leaf node, draw stuff if (node->contents < 0) { @@ -1396,7 +1396,7 @@ void R_MarkLeaves (void) if (r_oldviewleaf == r_viewleaf && !r_novis->value) return; - + r_visframecount++; r_oldviewleaf = r_viewleaf; @@ -1407,7 +1407,7 @@ void R_MarkLeaves (void) } else vis = Mod_LeafPVS (r_viewleaf, cl.worldmodel); - + for (i=0 ; inumleafs ; i++) { if (vis[i>>3] & (1<<(i&7))) @@ -1575,7 +1575,7 @@ void BuildSurfaceDisplayList (msurface_t *fa) // skip co-linear points #define COLINEAR_EPSILON 0.001 if ((fabs( v1[0] - v2[0] ) <= COLINEAR_EPSILON) && - (fabs( v1[1] - v2[1] ) <= COLINEAR_EPSILON) && + (fabs( v1[1] - v2[1] ) <= COLINEAR_EPSILON) && (fabs( v1[2] - v2[2] ) <= COLINEAR_EPSILON)) { int j; @@ -1708,7 +1708,7 @@ void GL_BuildLightmaps (void) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes - , BLOCK_WIDTH, BLOCK_HEIGHT, 0, + , BLOCK_WIDTH, BLOCK_HEIGHT, 0, gl_lightmap_format, GL_UNSIGNED_BYTE, lightmaps+i*BLOCK_WIDTH*BLOCK_HEIGHT*lightmap_bytes); } diff --git a/common/gl_screen.c b/common/gl_screen.c index 1ffad06..7c17aff 100644 --- a/common/gl_screen.c +++ b/common/gl_screen.c @@ -12,7 +12,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. @@ -74,7 +74,7 @@ SlowPrint () Screen_Update (); Con_Printf (); -net +net turn off messages option the refresh is allways rendered, unless the console is full screen @@ -84,14 +84,14 @@ console is: notify lines half full - + */ int glx, gly, glwidth, glheight; -// only the refresh window will be updated unless these variables are flagged +// only the refresh window will be updated unless these variables are flagged int scr_copytop; int scr_copyeverything; @@ -200,7 +200,7 @@ void SCR_DrawCenterString (void) else y = 48; - do + do { // scan the width of the line for (l=0 ; l<40 ; l++) @@ -209,11 +209,11 @@ void SCR_DrawCenterString (void) x = (vid.width - l*8)/2; for (j=0 ; jvalue < 30) Cvar_Set ("viewsize","30"); @@ -343,7 +343,7 @@ static void SCR_CalcRefdef (void) r_refdef.vrect.x = (vid.width - r_refdef.vrect.width)/2; if (full) r_refdef.vrect.y = 0; - else + else r_refdef.vrect.y = (h - r_refdef.vrect.height)/2; r_refdef.fov_x = scr_fov->value; @@ -447,7 +447,7 @@ SCR_DrawTurtle void SCR_DrawTurtle (void) { static int count; - + if (!scr_showturtle->value) return; @@ -535,7 +535,7 @@ void SCR_DrawPause (void) return; pic = Draw_CachePic ("gfx/pause.lmp"); - Draw_Pic ( (vid.width - pic->width)/2, + Draw_Pic ( (vid.width - pic->width)/2, (vid.height - 48 - pic->height)/2, pic); } @@ -552,9 +552,9 @@ void SCR_DrawLoading (void) if (!scr_drawloading) return; - + pic = Draw_CachePic ("gfx/loading.lmp"); - Draw_Pic ( (vid.width - pic->width)/2, + Draw_Pic ( (vid.width - pic->width)/2, (vid.height - 48 - pic->height)/2, pic); } @@ -571,10 +571,10 @@ SCR_SetUpToDrawConsole void SCR_SetUpToDrawConsole (void) { Con_CheckResize (); - + if (scr_drawloading) return; // never a console with loading plaque - + // decide on the height of the console if (cls.state != ca_active) { @@ -583,12 +583,12 @@ void SCR_SetUpToDrawConsole (void) } else if (key_dest == key_console) { - scr_conlines = vid.height * max(0.2, + scr_conlines = vid.height * max(0.2, min(scr_consize->value, 1)); } else scr_conlines = 0; // none visible - + if (scr_conlines < scr_con_current) { scr_con_current -= scr_conspeed->value * host_frametime * 4; @@ -613,7 +613,7 @@ void SCR_SetUpToDrawConsole (void) else con_notifylines = 0; } - + /* ================== SCR_DrawConsole @@ -635,13 +635,13 @@ void SCR_DrawConsole (void) } -/* -============================================================================== - - SCREEN SHOTS - -============================================================================== -*/ +/* +============================================================================== + + SCREEN SHOTS + +============================================================================== +*/ typedef struct _TargaHeader { unsigned char id_length, colormap_type, image_type; @@ -652,33 +652,33 @@ typedef struct _TargaHeader { } TargaHeader; -/* -================== +/* +================== SCR_ScreenShot_f -================== -*/ -void SCR_ScreenShot_f (void) +================== +*/ +void SCR_ScreenShot_f (void) { byte *buffer; - char pcxname[80]; + char pcxname[80]; char checkname[MAX_OSPATH]; int i, c, temp; -// -// find a file name to save it to -// +// +// find a file name to save it to +// strcpy(pcxname,"quake00.tga"); - - for (i=0 ; i<=99 ; i++) - { - pcxname[5] = i/10 + '0'; - pcxname[6] = i%10 + '0'; + + for (i=0 ; i<=99 ; i++) + { + pcxname[5] = i/10 + '0'; + pcxname[6] = i%10 + '0'; snprintf(checkname, sizeof(checkname), "%s/%s", com_gamedir, pcxname); if (Sys_FileTime(checkname) == -1) break; // file doesn't exist - } - if (i==100) + } + if (i==100) { - Con_Printf ("SCR_ScreenShot_f: Couldn't create a PCX file\n"); + Con_Printf ("SCR_ScreenShot_f: Couldn't create a PCX file\n"); return; } @@ -692,7 +692,7 @@ void SCR_ScreenShot_f (void) buffer[15] = glheight>>8; buffer[16] = 24; // pixel size - glReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, buffer+18 ); + glReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, buffer+18 ); // swap rgb to bgr c = 18+glwidth*glheight*3; @@ -706,27 +706,27 @@ void SCR_ScreenShot_f (void) free (buffer); Con_Printf ("Wrote %s\n", pcxname); -} +} -/* -============== -WritePCXfile -============== -*/ +/* +============== +WritePCXfile +============== +*/ void WritePCXfile (char *filename, byte *data, int width, int height, - int rowbytes, byte *palette, qboolean upload) + int rowbytes, byte *palette, qboolean upload) { int i, j, length; pcx_t *pcx; byte *pack; - + pcx = Hunk_TempAlloc (width*height*2+1000); if (pcx == NULL) { Con_Printf("SCR_ScreenShot_f: not enough memory\n"); return; - } - + } + pcx->manufacturer = 0x0a; // PCX id pcx->version = 5; // 256 color pcx->encoding = 1; // uncompressed @@ -764,13 +764,13 @@ void WritePCXfile (char *filename, byte *data, int width, int height, data += rowbytes - width; data -= rowbytes * 2; } - + // write the palette *pack++ = 0x0c; // palette ID byte for (i=0 ; i<768 ; i++) *pack++ = *palette++; - -// write output file + +// write output file length = pack - (byte *)pcx; #ifdef QUAKEWORLD if (upload) @@ -778,8 +778,8 @@ void WritePCXfile (char *filename, byte *data, int width, int height, else #endif COM_WriteFile (filename, pcx, length); -} - +} + /* @@ -859,17 +859,17 @@ void SCR_DrawStringToSnap (const char *s, byte *buf, int x, int y, int width) } -/* -================== +/* +================== SCR_RSShot_f -================== -*/ -void SCR_RSShot_f (void) -{ +================== +*/ +void SCR_RSShot_f (void) +{ // int i; int x, y; unsigned char *src, *dest; - char pcxname[80]; + char pcxname[80]; // char checkname[MAX_OSPATH]; unsigned char *newbuf; int w, h; @@ -889,32 +889,32 @@ void SCR_RSShot_f (void) Con_Printf("Remote screen shot requested.\n"); #if 0 -// -// find a file name to save it to -// +// +// find a file name to save it to +// strcpy(pcxname,"mquake00.pcx"); - - for (i=0 ; i<=99 ; i++) - { - pcxname[6] = i/10 + '0'; - pcxname[7] = i%10 + '0'; + + for (i=0 ; i<=99 ; i++) + { + pcxname[6] = i/10 + '0'; + pcxname[7] = i%10 + '0'; snprintf(checkname, sizeof(checkname), "%s/%s", com_gamedir, pcxname); if (Sys_FileTime(checkname) == -1) break; // file doesn't exist - } - if (i==100) + } + if (i==100) { - Con_Printf ("SCR_ScreenShot_f: Couldn't create a PCX"); + Con_Printf ("SCR_ScreenShot_f: Couldn't create a PCX"); return; } #endif - -// -// save the pcx file -// + +// +// save the pcx file +// newbuf = malloc(glheight * glwidth * 3); - glReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, newbuf ); + glReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, newbuf ); w = (vid.width < RSSHOT_WIDTH) ? glwidth : RSSHOT_WIDTH; h = (vid.height < RSSHOT_HEIGHT) ? glheight : RSSHOT_HEIGHT; @@ -986,7 +986,7 @@ void SCR_RSShot_f (void) free(newbuf); Con_Printf ("Wrote %s\n", pcxname); -} +} @@ -1007,7 +1007,7 @@ void SCR_BeginLoadingPlaque (void) return; if (cls.signon != SIGNONS) return; - + // redraw with no console and the loading plaque Con_ClearNotify (); scr_centertime_off = 0; @@ -1053,7 +1053,7 @@ void SCR_DrawNotifyString (void) y = vid.height*0.35; - do + do { // scan the width of the line for (l=0 ; l<40 ; l++) @@ -1061,8 +1061,8 @@ void SCR_DrawNotifyString (void) break; x = (vid.width - l*8)/2; for (j=0 ; j 0) { // top - Draw_TileClear (r_refdef.vrect.x, 0, - r_refdef.vrect.x + r_refdef.vrect.width, + Draw_TileClear (r_refdef.vrect.x, 0, + r_refdef.vrect.x + r_refdef.vrect.width, r_refdef.vrect.y); // bottom Draw_TileClear (r_refdef.vrect.x, - r_refdef.vrect.y + r_refdef.vrect.height, - r_refdef.vrect.width, - vid.height - sb_lines - + r_refdef.vrect.y + r_refdef.vrect.height, + r_refdef.vrect.width, + vid.height - sb_lines - (r_refdef.vrect.height + r_refdef.vrect.y)); } } @@ -1202,7 +1202,7 @@ void SCR_UpdateScreen (void) } GL_BeginRendering (&glx, &gly, &glwidth, &glheight); - + // // determine size of refresh window // @@ -1219,7 +1219,7 @@ void SCR_UpdateScreen (void) // do 3D refresh drawing, and then update the screen // SCR_SetUpToDrawConsole (); - + V_RenderView (); GL_Set2D (); @@ -1258,7 +1258,7 @@ void SCR_UpdateScreen (void) { if (crosshair->value) Draw_Crosshair(); - + SCR_DrawRam (); SCR_DrawNet (); SCR_DrawFPS (); @@ -1266,7 +1266,7 @@ void SCR_UpdateScreen (void) SCR_DrawPause (); SCR_CheckDrawCenterString (); Sbar_Draw (); - SCR_DrawConsole (); + SCR_DrawConsole (); M_Draw (); } diff --git a/common/gl_test.c b/common/gl_test.c index 8cf4863..25ec08c 100644 --- a/common/gl_test.c +++ b/common/gl_test.c @@ -10,7 +10,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. diff --git a/common/gl_vidglx.c b/common/gl_vidglx.c index 4fc00e2..e14789e 100644 --- a/common/gl_vidglx.c +++ b/common/gl_vidglx.c @@ -12,7 +12,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. @@ -223,7 +223,7 @@ void VID_SetPalette (unsigned char *palette) g = pal[1]; b = pal[2]; pal += 3; - + // v = (255<<24) + (r<<16) + (g<<8) + (b<<0); // v = (255<<0) + (r<<8) + (g<<16) + (b<<24); v = (255<<24) + (r<<0) + (g<<8) + (b<<16); @@ -352,7 +352,7 @@ qboolean VID_Is8bit(void) } #ifdef GL_EXT_SHARED -void VID_Init8bitPalette() +void VID_Init8bitPalette() { // Check for 8bit Extensions and initialize them. int i; @@ -378,7 +378,7 @@ void VID_Init8bitPalette() #else -void VID_Init8bitPalette(void) +void VID_Init8bitPalette(void) { } @@ -410,7 +410,7 @@ void VID_Init(unsigned char *palette) #ifdef HAS_DGA vid_dga_mouseaccel = Cvar_Get("vid_dga_mouseaccel","1",CVAR_ARCHIVE, "None"); -#endif +#endif vid.maxwarpwidth = WARP_WIDTH; vid.maxwarpheight = WARP_HEIGHT; vid.colormap = host_colormap; diff --git a/common/gl_vidlinux_3dfx.c b/common/gl_vidlinux_3dfx.c index a0aee7d..6a1dbb7 100644 --- a/common/gl_vidlinux_3dfx.c +++ b/common/gl_vidlinux_3dfx.c @@ -1,6 +1,6 @@ /* gl_vidlinux_3dfx.c - OpenGL device driver for 3Dfx chipsets running Linux - + Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1999,2000 contributors of the QuakeForge project Portions Copyright (C) 1999,2000 Nelson Rush. @@ -13,7 +13,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. @@ -51,7 +51,7 @@ static cvar_t *vid_redrawfull; static cvar_t *vid_waitforrefresh; cvar_t *gl_ztrick; extern cvar_t *gl_triplebuffer; - + static fxMesaContext fc = NULL; static int scr_width, scr_height; static qboolean is8bit = 0; @@ -148,7 +148,7 @@ void VID_SetPalette (unsigned char *palette) g = pal[1]; b = pal[2]; pal += 3; - + // v = (255<<24) + (r<<16) + (g<<8) + (b<<0); // v = (255<<0) + (r<<8) + (g<<16) + (b<<24); v = (255<<24) + (r<<0) + (g<<8) + (b<<16); @@ -272,7 +272,7 @@ void GL_EndRendering (void) fxMesaSwapBuffers(); } -static int resolutions[][3]={ +static int resolutions[][3]={ { 320, 200, GR_RESOLUTION_320x200 }, { 320, 240, GR_RESOLUTION_320x240 }, { 400, 256, GR_RESOLUTION_400x256 }, @@ -337,7 +337,7 @@ findres(int *width, int *height) return resolutions[i][2]; } } - + *width = 640; *height = 480; return GR_RESOLUTION_640x480; @@ -349,7 +349,7 @@ qboolean VID_Is8bit(void) } #ifdef GL_EXT_SHARED -void VID_Init8bitPalette() +void VID_Init8bitPalette() { // Check for 8bit Extensions and initialize them. int i; @@ -376,7 +376,7 @@ void VID_Init8bitPalette() #else extern void gl3DfxSetPaletteEXT(GLuint *pal); -void VID_Init8bitPalette(void) +void VID_Init8bitPalette(void) { // Check for 8bit Extensions and initialize them. int i; @@ -417,7 +417,7 @@ void VID_Init(unsigned char *palette) "None"); // Cvar_RegisterVariable (&gl_ztrick); gl_ztrick = Cvar_Get ("gl_ztrick","0",CVAR_ARCHIVE,"None"); - + vid.maxwarpwidth = WARP_WIDTH; vid.maxwarpheight = WARP_HEIGHT; vid.colormap = host_colormap; @@ -456,7 +456,7 @@ void VID_Init(unsigned char *palette) if (vid.conheight < 200) vid.conheight = 200; - fc = fxMesaCreateContext(0, findres(&width, &height), GR_REFRESH_75Hz, + fc = fxMesaCreateContext(0, findres(&width, &height), GR_REFRESH_75Hz, attribs); if (!fc) Sys_Error("Unable to create 3DFX context.\n"); @@ -497,7 +497,7 @@ void VID_ExtraOptionDraw(unsigned int options_draw_cursor) { /* Port specific Options menu entrys */ } - + void VID_ExtraOptionCmd(int option_cursor) { /* diff --git a/common/gl_vidnt.c b/common/gl_vidnt.c index 8513677..0d93738 100644 --- a/common/gl_vidnt.c +++ b/common/gl_vidnt.c @@ -1,6 +1,6 @@ /* gl_vidnt.c - OpenGL low-level video driver for Windows NT/9x - + Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1999,2000 contributors of the QuakeForge project Portions Copyright (C) 1999,2000 Nelson Rush. @@ -13,7 +13,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. @@ -522,7 +522,7 @@ void CheckTextureExtensions (void) if (!texture_ext || COM_CheckParm ("-gl11") ) { hInstGL = LoadLibrary("opengl32.dll"); - + if (hInstGL == NULL) Sys_Error ("Couldn't load opengl32.dll\n"); @@ -579,7 +579,7 @@ int texture_mode = GL_LINEAR; int texture_extension_number = 1; #ifdef _WIN32 -void CheckMultiTextureExtensions(void) +void CheckMultiTextureExtensions(void) { if (strstr(gl_extensions, "GL_SGIS_multitexture ") && !COM_CheckParm("-nomtex")) { Con_Printf("Multitexture extensions found.\n"); @@ -589,7 +589,7 @@ void CheckMultiTextureExtensions(void) } } #else -void CheckMultiTextureExtensions(void) +void CheckMultiTextureExtensions(void) { gl_mtexable = true; } @@ -729,7 +729,7 @@ void VID_SetPalette (unsigned char *palette) g = pal[1]; b = pal[2]; pal += 3; - + // v = (255<<24) + (r<<16) + (g<<8) + (b<<0); // v = (255<<0) + (r<<8) + (g<<16) + (b<<24); v = (255<<24) + (r<<0) + (g<<8) + (b<<16); @@ -769,7 +769,7 @@ BOOL gammaworks; void VID_ShiftPalette (unsigned char *palette) { extern byte ramps[3][256]; - + // VID_SetPalette (palette); // gammaworks = SetDeviceGammaRamp (maindc, ramps); @@ -830,7 +830,7 @@ BOOL bSetupPixelFormat(HDC hDC) 0, // shift bit ignored 0, // no accumulation buffer 0, 0, 0, 0, // accum bits ignored - 32, // 32-bit z-buffer + 32, // 32-bit z-buffer 0, // no stencil buffer 0, // no auxiliary buffer PFD_MAIN_PLANE, // main layer @@ -856,49 +856,49 @@ BOOL bSetupPixelFormat(HDC hDC) -byte scantokey[128] = - { -// 0 1 2 3 4 5 6 7 -// 8 9 A B C D E F - 0 , 27, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '[', ']', 13 , K_CTRL,'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', - '\'' , '`', K_SHIFT,'\\', 'z', 'x', 'c', 'v', // 2 - 'b', 'n', 'm', ',', '.', '/', K_SHIFT,'*', - K_ALT,' ', K_CAPSLOCK , K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE , 0 , K_HOME, - K_UPARROW,K_PGUP,'-',K_LEFTARROW,'5',K_RIGHTARROW,'+',K_END, //4 - K_DOWNARROW,K_PGDN,K_INS,K_DEL,0,0, 0, K_F11, - K_F12,0 , 0 , 0 , 0 , 0 , 0 , 0, // 5 - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, // 6 - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 // 7 - }; +byte scantokey[128] = + { +// 0 1 2 3 4 5 6 7 +// 8 9 A B C D E F + 0 , 27, '1', '2', '3', '4', '5', '6', + '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0 + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'o', 'p', '[', ']', 13 , K_CTRL,'a', 's', // 1 + 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', + '\'' , '`', K_SHIFT,'\\', 'z', 'x', 'c', 'v', // 2 + 'b', 'n', 'm', ',', '.', '/', K_SHIFT,'*', + K_ALT,' ', K_CAPSLOCK , K_F1, K_F2, K_F3, K_F4, K_F5, // 3 + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE , 0 , K_HOME, + K_UPARROW,K_PGUP,'-',K_LEFTARROW,'5',K_RIGHTARROW,'+',K_END, //4 + K_DOWNARROW,K_PGDN,K_INS,K_DEL,0,0, 0, K_F11, + K_F12,0 , 0 , 0 , 0 , 0 , 0 , 0, // 5 + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, // 6 + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 // 7 + }; -byte shiftscantokey[128] = - { -// 0 1 2 3 4 5 6 7 -// 8 9 A B C D E F - 0 , 27, '!', '@', '#', '$', '%', '^', - '&', '*', '(', ')', '_', '+', K_BACKSPACE, 9, // 0 - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', - 'O', 'P', '{', '}', 13 , K_CTRL,'A', 'S', // 1 - 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', - '"' , '~', K_SHIFT,'|', 'Z', 'X', 'C', 'V', // 2 - 'B', 'N', 'M', '<', '>', '?', K_SHIFT,'*', - K_ALT,' ', K_CAPSLOCK , K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE , 0 , K_HOME, - K_UPARROW,K_PGUP,'_',K_LEFTARROW,'%',K_RIGHTARROW,'+',K_END, //4 - K_DOWNARROW,K_PGDN,K_INS,K_DEL,0,0, 0, K_F11, - K_F12,0 , 0 , 0 , 0 , 0 , 0 , 0, // 5 - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, // 6 - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 // 7 - }; +byte shiftscantokey[128] = + { +// 0 1 2 3 4 5 6 7 +// 8 9 A B C D E F + 0 , 27, '!', '@', '#', '$', '%', '^', + '&', '*', '(', ')', '_', '+', K_BACKSPACE, 9, // 0 + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', + 'O', 'P', '{', '}', 13 , K_CTRL,'A', 'S', // 1 + 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', + '"' , '~', K_SHIFT,'|', 'Z', 'X', 'C', 'V', // 2 + 'B', 'N', 'M', '<', '>', '?', K_SHIFT,'*', + K_ALT,' ', K_CAPSLOCK , K_F1, K_F2, K_F3, K_F4, K_F5, // 3 + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE , 0 , K_HOME, + K_UPARROW,K_PGUP,'_',K_LEFTARROW,'%',K_RIGHTARROW,'+',K_END, //4 + K_DOWNARROW,K_PGDN,K_INS,K_DEL,0,0, 0, K_F11, + K_F12,0 , 0 , 0 , 0 , 0 , 0 , 0, // 5 + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, // 6 + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 // 7 + }; /* @@ -934,7 +934,7 @@ ClearAllStates void ClearAllStates (void) { int i; - + // send an up event for each key, to make sure the server clears them all for (i=0 ; i<256 ; i++) { @@ -1002,7 +1002,7 @@ void AppActivate(BOOL fActive, BOOL minimize) { IN_DeactivateMouse (); IN_ShowMouse (); - if (vid_canalttab) { + if (vid_canalttab) { ChangeDisplaySettings (NULL, 0); vid_wassuspended = true; } @@ -1050,7 +1050,7 @@ LONG WINAPI MainWndProc ( case WM_SYSKEYDOWN: Key_Event (MapKey(lParam), true); break; - + case WM_KEYUP: case WM_SYSKEYUP: Key_Event (MapKey(lParam), false); @@ -1087,7 +1087,7 @@ LONG WINAPI MainWndProc ( // 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 ((short) HIWORD(wParam) > 0) { Key_Event(K_MWHEELUP, true); Key_Event(K_MWHEELUP, false); @@ -1153,7 +1153,7 @@ int VID_NumModes (void) return nummodes; } - + /* ================= VID_GetModePtr @@ -1270,7 +1270,7 @@ VID_DescribeMode_f void VID_DescribeMode_f (void) { int t, modenum; - + modenum = Q_atoi (Cmd_Argv(1)); t = leavecurrentmode; @@ -1513,7 +1513,7 @@ qboolean VID_Is8bit() { #define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB -void VID_Init8bitPalette() +void VID_Init8bitPalette() { // Check for 8bit Extensions and initialize them. int i; @@ -1596,7 +1596,7 @@ void VID_Init (unsigned char *palette) vid_nopageflip = Cvar_Get ("_vid_nopageflip","0",CVAR_ARCHIVE,"None"); _vid_wait_override = Cvar_Get ("_vid_wait_override","0",CVAR_ARCHIVE, "None"); - + _vid_default_mode = Cvar_Get ("_vid_default_mode","0",CVAR_ARCHIVE, "None"); _vid_default_mode_win = Cvar_Get ("_vid_default_mode_win","0", @@ -1890,7 +1890,7 @@ void VID_MenuDraw (void) vid_wmodes = 0; lnummodes = VID_NumModes (); - + for (i=1 ; (i=0; row--) { pixbuf = *targa_rgba + row*columns*4; for(column=0; column Date: 09 Feb 2000 - + This file is part of the QuakeForge Core system. - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 @@ -18,13 +18,13 @@ 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. You should have received a copy of the GNU General Public License along with this program; if not, write to: - + Free Software Foundation, Inc. 59 Temple Place - Suite 330 Boston, MA 02111-1307, USA. @@ -129,7 +129,7 @@ Host_ClearMemory (void) #ifdef UQUAKE cls.signon = 0; - + memset (&sv, 0, sizeof(sv)); #endif memset (&cl, 0, sizeof(cl)); @@ -151,14 +151,14 @@ Host_EndGame ( char *message, ... ) va_start (argptr, message); vsnprintf (string, sizeof(string), message, argptr); va_end (argptr); - + Con_Printf ("\n===========================\n"); Con_Printf ("Host_EndGame: %s\n", string); Con_Printf ("===========================\n\n"); - + #if QUAKEWORLD CL_Disconnect (); - + longjmp (host_abort, 1); #elif UQUAKE cl.paused = false; @@ -168,7 +168,7 @@ Host_EndGame ( char *message, ... ) if ( cls.state == ca_dedicated ) Sys_Error ("Host_EndGame: %s\n",string); // dedicated servers exit - + if ( cls.demonum != -1 ) CL_NextDemo (); else @@ -236,7 +236,7 @@ Host_FilterTime ( float time ) #ifdef UQUAKE } #endif - + return true; } @@ -272,7 +272,7 @@ Host_FrameMain ( float time ) // decide the simulation time if ( !Host_FilterTime(time) ) return; - + // get new events IN_SendKeyEvents (); IN_Frame(); @@ -311,14 +311,14 @@ Host_FrameMain ( float time ) // if running the server locally, make intentions now if (sv.active) CL_SendCmd (); - + // check for commands typed to the host Host_GetConsoleCommands (); - + if (sv.active) SV_Frame (); // Send frame to clients - /* + /* if running the server remotely, send intentions now after incoming messages have been read */ @@ -341,7 +341,7 @@ Host_FrameMain ( float time ) if (host_speeds->value) time2 = Sys_DoubleTime (); - + // update audio #ifdef QUAKEWORLD if (cls.state == ca_active) { @@ -353,7 +353,7 @@ Host_FrameMain ( float time ) } else S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin); - + CDAudio_Update(); if (host_speeds->value) { @@ -393,14 +393,14 @@ Host_Frame ( float time ) Host_FrameMain (time); return; } - + time1 = Sys_DoubleTime (); Host_FrameMain (time); - time2 = Sys_DoubleTime (); - + time2 = Sys_DoubleTime (); + timetotal += time2 - time1; timecount++; - + if (timecount < 1000) return; @@ -429,25 +429,25 @@ Host_Error ( char *error, ... ) va_list argptr; char string[1024]; static qboolean inerror = false; - + if ( inerror ) { Sys_Error ("Host_Error: Called recursively from within an error"); } inerror = true; - + va_start (argptr, error); vsnprintf (string, sizeof(string), error, argptr); va_end (argptr); Con_Printf ("Host_Error: %s\n", string); -#ifdef UQUAKE +#ifdef UQUAKE if (sv.active) SV_Shutdown (false); if (cls.state == ca_dedicated) Sys_Error ("Host_Error: %s\n",string); // dedicated servers exit #endif - + CL_Disconnect (); cls.demonum = -1; @@ -464,7 +464,7 @@ Host_Error ( char *error, ... ) /* Host_InitVCR - + Set up playback and recording of demos. */ extern int vcrFile; @@ -475,7 +475,7 @@ Host_InitVCR ( quakeparms_t *parms ) { int i, len, n; char *p; - + if ( COM_CheckParm("-playback") ) { if ( com_argc != 2 ) Sys_Error("No other parameters allowed with -playback\n"); @@ -536,7 +536,7 @@ Host_InitDisplay () /* Host_Init - + System Startup */ void @@ -552,21 +552,21 @@ Host_Init (quakeparms_t *parms) if ( COM_CheckParm ("-minmemory") ) parms->memsize = MINIMUM_MEMORY; - + host_parms = *parms; if (parms->memsize < MINIMUM_MEMORY) Sys_Error ("Only %4.1fMB of memory reported, can't execute game", parms->memsize / (float) 0x100000); - + Memory_Init (parms->membase, parms->memsize); CL_InitCvars(); SCR_InitCvars(); VID_InitCvars (); - Cbuf_Init (); + Cbuf_Init (); Cmd_Init (); Cvar_Init (); V_Init (); - + #ifdef QUAKEWORLD COM_Init (); @@ -575,20 +575,20 @@ Host_Init (quakeparms_t *parms) #elif UQUAKE Chase_Init (); Host_InitVCR (parms); - + COM_Init (); Host_InitLocal (); #endif W_LoadWadFile ("gfx.wad"); Key_Init (); - Con_Init (); - M_Init (); + Con_Init (); + M_Init (); -#ifdef UQUAKE +#ifdef UQUAKE PR_Init (); #endif - + Mod_Init (); #ifdef UQUAKE @@ -598,7 +598,7 @@ Host_Init (quakeparms_t *parms) Con_Printf ("Exe: "__TIME__" "__DATE__"\n"); Con_Printf ("%4.1f megabytes RAM used.\n", (parms->memsize / (1024 * 1024.0)) ); - + R_InitTextures (); // needed even for UQ dedicated server #ifdef UQUAKE @@ -634,7 +634,7 @@ Host_Init (quakeparms_t *parms) Cbuf_InsertText ("exec quake.rc\n"); -#ifdef QUAKEWORLD +#ifdef QUAKEWORLD Cbuf_AddText ("echo Type connect or use GameSpy to connect to a game.\n"); #endif Cbuf_AddText ("cl_warncmd 1\n"); @@ -643,10 +643,10 @@ Host_Init (quakeparms_t *parms) host_hunklevel = Hunk_LowMark (); host_initialized = true; -#ifdef QUAKEWORLD +#ifdef QUAKEWORLD Con_Printf ("\nClient Version %s\n\n", QF_VERSION); #endif - Sys_Printf ("======= QuakeForge Initialized =======\n"); + Sys_Printf ("======= QuakeForge Initialized =======\n"); } @@ -660,7 +660,7 @@ void Host_Shutdown( void ) { static qboolean isdown = false; - + if ( isdown ) { printf ("recursive shutdown\n"); return; @@ -672,8 +672,8 @@ Host_Shutdown( void ) scr_disabled_for_loading = true; #endif - Host_WriteConfiguration (); - + Host_WriteConfiguration (); + CDAudio_Shutdown (); NET_Shutdown (); S_Shutdown(); @@ -683,7 +683,7 @@ Host_Shutdown( void ) //plugin_unload(IN->handle); } -#if QUAKEWORLD +#if QUAKEWORLD if (host_basepal) { #elif UQUAKE if (cls.state != ca_dedicated) { @@ -710,7 +710,7 @@ Host_WriteConfiguration ( void ) Con_Printf ("Couldn't write config.cfg.\n"); return; } - + Key_WriteBindings (f); Cvar_WriteVariables (f); @@ -722,14 +722,14 @@ Host_WriteConfiguration ( void ) #ifdef UQUAKE /* Host_InitLocal - + (desc) */ void Host_InitLocal ( void ) { Host_InitCommands (); - + // Cvar_RegisterVariable (&host_framerate); host_framerate = Cvar_Get ("host_framerate","0",0,"None"); @@ -767,14 +767,14 @@ Host_InitLocal ( void ) sv_filter = Cvar_Get ("sv_filter","1",0,"None"); Host_FindMaxClients (); - + host_time = 1.0; // so a think at time 0 won't get called } /* Host_FindMaxClients - + (desc) */ void Host_FindMaxClients (void) @@ -782,7 +782,7 @@ void Host_FindMaxClients (void) int i; svs.maxclients = 1; - + i = COM_CheckParm ("-dedicated"); if (i) { @@ -834,11 +834,11 @@ void Host_ClientCommands (char *fmt, ...) { va_list argptr; char string[1024]; - + va_start (argptr, fmt); vsnprintf (string, sizeof(string), fmt, argptr); va_end (argptr); - + MSG_WriteByte (&host_client->message, svc_stufftext); MSG_WriteString (&host_client->message, string); } diff --git a/common/image.h b/common/image.h index 8d1b5ab..f506cc6 100644 --- a/common/image.h +++ b/common/image.h @@ -11,7 +11,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. diff --git a/common/in_aa.c b/common/in_aa.c index 0cd9f89..2ca6dac 100644 --- a/common/in_aa.c +++ b/common/in_aa.c @@ -12,7 +12,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. @@ -95,7 +95,7 @@ static void IN_init_kb() fprintf(stderr, "Video mode not set?\n"); Sys_Error("keyboard_init() failed"); } - + for (i = 0; i < 128; i++) scantokey[i] = ' '; @@ -208,7 +208,7 @@ static void IN_init_kb() scantokey[119] = AA_UNKNOWN; /* pause */ // misc if (!aa_autoinitkbd(context, AA_SENDRELEASE)) - { + { fprintf(stderr, "Error in aa_autoinitkbd!\n"); Sys_Error("keyboard_init() failed"); } diff --git a/common/in_dos.c b/common/in_dos.c index 1f9e444..e289b06 100644 --- a/common/in_dos.c +++ b/common/in_dos.c @@ -10,7 +10,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. @@ -33,7 +33,7 @@ typedef struct long numAxes; long numButtons; long flags; - + vec3_t viewangles; // intended velocities @@ -94,7 +94,7 @@ qboolean joy_avail; int joy_oldbuttonstate; int joy_buttonstate; -int joyxl, joyxh, joyyl, joyyh; +int joyxl, joyxh, joyyl, joyyh; int joystickx, joysticky; qboolean need_center; @@ -134,9 +134,9 @@ IN_StartupMouse */ void IN_StartupMouse (void) { - if ( COM_CheckParm ("-nomouse") ) - return; - + if ( COM_CheckParm ("-nomouse") ) + return; + // check for mouse regs.x.ax = 0; dos_int86(0x33); @@ -146,7 +146,7 @@ void IN_StartupMouse (void) Con_Printf ("No mouse found\n"); return; } - + mouse_buttons = regs.x.bx; if (mouse_buttons > 3) mouse_buttons = 3; @@ -205,7 +205,7 @@ void IN_Frame(void) regs.x.ax = 3; // read buttons dos_int86(0x33); mouse_buttonstate = regs.x.bx; - + // perform button actions for (i=0 ; i> 4)&15)^15; @@ -241,14 +241,14 @@ void IN_Frame(void) Key_Event (K_JOY1 + i, false); } } - + joy_oldbuttonstate = joy_buttonstate; } if (extern_avail) { extern_buttonstate = extern_control->buttons; - + // perform button actions for (i=0 ; ivalue) { mouse_x = (mx + old_mouse_x) * 0.5; @@ -308,10 +308,10 @@ void IN_MouseMove (usercmd_t *cmd) cmd->sidemove += m_side->value * mouse_x; else cl.viewangles[YAW] -= m_yaw->value * mouse_x; - + if (in_mlook.state & 1) V_StopPitchDrift (); - + if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) { cl.viewangles[PITCH] += m_pitch->value * mouse_y; @@ -338,10 +338,10 @@ void IN_JoyMove (usercmd_t *cmd) { float speed, aspeed; - if (!joy_avail || !in_joystick->value) - return; - - IN_ReadJoystick (); + if (!joy_avail || !in_joystick->value) + return; + + IN_ReadJoystick (); if (joysticky > joyyh*2 || joystickx > joyxh*2) return; // assume something jumped in and messed up the joystick // reading time (win 95) @@ -355,15 +355,15 @@ void IN_JoyMove (usercmd_t *cmd) if (in_strafe.state & 1) { if (joystickx < joyxl) - cmd->sidemove -= speed*cl_sidespeed->value; - else if (joystickx > joyxh) - cmd->sidemove += speed*cl_sidespeed->value; + cmd->sidemove -= speed*cl_sidespeed->value; + else if (joystickx > joyxh) + cmd->sidemove += speed*cl_sidespeed->value; } else { if (joystickx < joyxl) cl.viewangles[YAW] += aspeed*cl_yawspeed->value; - else if (joystickx > joyxh) + else if (joystickx > joyxh) cl.viewangles[YAW] -= aspeed*cl_yawspeed->value; cl.viewangles[YAW] = anglemod(cl.viewangles[YAW]); } @@ -372,18 +372,18 @@ void IN_JoyMove (usercmd_t *cmd) { if (m_pitch->value < 0) speed *= -1; - - if (joysticky < joyyl) + + if (joysticky < joyyl) cl.viewangles[PITCH] += aspeed*cl_pitchspeed->value; - else if (joysticky > joyyh) + else if (joysticky > joyyh) cl.viewangles[PITCH] -= aspeed*cl_pitchspeed->value; } else { - if (joysticky < joyyl) - cmd->forwardmove += speed*cl_forwardspeed->value; - else if (joysticky > joyyh) - cmd->forwardmove -= speed*cl_backspeed->value; + if (joysticky < joyyl) + cmd->forwardmove += speed*cl_forwardspeed->value; + else if (joysticky > joyyh) + cmd->forwardmove -= speed*cl_backspeed->value; } } @@ -399,12 +399,12 @@ void IN_Move (usercmd_t *cmd) IN_ExternalMove (cmd); } -/* -============================================================================ - - JOYSTICK - -============================================================================ +/* +============================================================================ + + JOYSTICK + +============================================================================ */ @@ -432,7 +432,7 @@ qboolean IN_ReadJoystick (void) if ( !(b&3) ) return true; } - + Con_Printf ("IN_ReadJoystick: no response\n"); joy_avail = false; return false; @@ -443,12 +443,12 @@ qboolean IN_ReadJoystick (void) WaitJoyButton ============= */ -qboolean WaitJoyButton (void) -{ - int oldbuttons, buttons; - - oldbuttons = 0; - do +qboolean WaitJoyButton (void) +{ + int oldbuttons, buttons; + + oldbuttons = 0; + do { key_count = -1; Sys_SendKeyEvents (); @@ -460,16 +460,16 @@ qboolean WaitJoyButton (void) } key_lastpress = 0; SCR_UpdateScreen (); - buttons = ((dos_inportb(0x201) >> 4)&1)^1; - if (buttons != oldbuttons) - { - oldbuttons = buttons; - continue; + buttons = ((dos_inportb(0x201) >> 4)&1)^1; + if (buttons != oldbuttons) + { + oldbuttons = buttons; + continue; } - } while ( !buttons); - - do - { + } while ( !buttons); + + do + { key_count = -1; Sys_SendKeyEvents (); key_count = 0; @@ -480,87 +480,87 @@ qboolean WaitJoyButton (void) } key_lastpress = 0; SCR_UpdateScreen (); - buttons = ((dos_inportb(0x201) >> 4)&1)^1; - if (buttons != oldbuttons) - { - oldbuttons = buttons; - continue; - } - } while ( buttons); - - return true; -} - - - -/* -=============== -IN_StartupJoystick -=============== -*/ -void IN_StartupJoystick (void) -{ - int centerx, centery; - - Con_Printf ("\n"); + buttons = ((dos_inportb(0x201) >> 4)&1)^1; + if (buttons != oldbuttons) + { + oldbuttons = buttons; + continue; + } + } while ( buttons); - joy_avail = false; - if ( COM_CheckParm ("-nojoy") ) - return; - - if (!IN_ReadJoystick ()) - { - joy_avail = false; - Con_Printf ("joystick not found\n"); - return; - } + return true; +} - Con_Printf ("joystick found\n"); - - Con_Printf ("CENTER the joystick\nand press button 1 (ESC to skip):\n"); - if (!WaitJoyButton ()) - return; - IN_ReadJoystick (); - centerx = joystickx; - centery = joysticky; - - Con_Printf ("Push the joystick to the UPPER LEFT\nand press button 1 (ESC to skip):\n"); - if (!WaitJoyButton ()) - return; - IN_ReadJoystick (); - joyxl = (centerx + joystickx)/2; - joyyl = (centerx + joysticky)/2; - - Con_Printf ("Push the joystick to the LOWER RIGHT\nand press button 1 (ESC to skip):\n"); - if (!WaitJoyButton ()) - return; - IN_ReadJoystick (); - joyxh = (centerx + joystickx)/2; - joyyh = (centery + joysticky)/2; - joy_avail = true; - Con_Printf ("joystick configured.\n"); + +/* +=============== +IN_StartupJoystick +=============== +*/ +void IN_StartupJoystick (void) +{ + int centerx, centery; Con_Printf ("\n"); -} - - -/* -============================================================================ - - EXTERNAL - -============================================================================ + + joy_avail = false; + if ( COM_CheckParm ("-nojoy") ) + return; + + if (!IN_ReadJoystick ()) + { + joy_avail = false; + Con_Printf ("joystick not found\n"); + return; + } + + Con_Printf ("joystick found\n"); + + Con_Printf ("CENTER the joystick\nand press button 1 (ESC to skip):\n"); + if (!WaitJoyButton ()) + return; + IN_ReadJoystick (); + centerx = joystickx; + centery = joysticky; + + Con_Printf ("Push the joystick to the UPPER LEFT\nand press button 1 (ESC to skip):\n"); + if (!WaitJoyButton ()) + return; + IN_ReadJoystick (); + joyxl = (centerx + joystickx)/2; + joyyl = (centerx + joysticky)/2; + + Con_Printf ("Push the joystick to the LOWER RIGHT\nand press button 1 (ESC to skip):\n"); + if (!WaitJoyButton ()) + return; + IN_ReadJoystick (); + joyxh = (centerx + joystickx)/2; + joyyh = (centery + joysticky)/2; + + joy_avail = true; + Con_Printf ("joystick configured.\n"); + + Con_Printf ("\n"); +} + + +/* +============================================================================ + + EXTERNAL + +============================================================================ */ -/* -=============== -IN_StartupExternal -=============== -*/ -void IN_StartupExternal (void) -{ +/* +=============== +IN_StartupExternal +=============== +*/ +void IN_StartupExternal (void) +{ if (extern_control->numButtons > 32) extern_control->numButtons = 32; diff --git a/common/in_null.c b/common/in_null.c index f5a85ec..34dd6b3 100644 --- a/common/in_null.c +++ b/common/in_null.c @@ -10,7 +10,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. diff --git a/common/in_sun.c b/common/in_sun.c index b788862..a4be761 100644 --- a/common/in_sun.c +++ b/common/in_sun.c @@ -10,7 +10,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. @@ -108,8 +108,8 @@ static void CheckMouseState(void) // make input rawer XAutoRepeatOff(x_disp); XGrabKeyboard(x_disp, x_win, True, GrabModeAsync, GrabModeAsync, CurrentTime); - XGrabPointer(x_disp, x_win, True, - PointerMotionMask | ButtonPressMask | ButtonReleaseMask, + XGrabPointer(x_disp, x_win, True, + PointerMotionMask | ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime); // if (XChangePointerControl( x_disp, True, True, 1, MOUSE_SCALE, x_mouse_thresh )) @@ -193,7 +193,7 @@ IN_Move(usercmd_t *cmd) if (!x_grabbed) return; // no mouse movement - + now = gethrtime(); @@ -202,7 +202,7 @@ IN_Move(usercmd_t *cmd) dy = global_dy; global_dy = 0; - + // printf("GOT: dx %d dy %d\n", dx, dy); dx *= sensitivity->value; @@ -210,7 +210,7 @@ IN_Move(usercmd_t *cmd) // // implement low pass filter to smooth motion a bit -// +// if (now - last_movement > 100000000) { dx = .6 * dx; dy = .6 * dy; @@ -225,20 +225,20 @@ IN_Move(usercmd_t *cmd) last_dy = dy; if (!dx && !dy) { - if (in_mlook.state & 1) + if (in_mlook.state & 1) V_StopPitchDrift (); return; } - + // add mouse X/Y movement to cmd if ((in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1))) cmd->sidemove += m_side->value * dx; - else + else cl.viewangles[YAW] -= m_yaw->value * dx; - if (in_mlook.state & 1) + if (in_mlook.state & 1) V_StopPitchDrift (); - + if ((in_mlook.state & 1) && !(in_strafe.state & 1)) { cl.viewangles[PITCH] += m_pitch->value * dy; if (cl.viewangles[PITCH] > 80) cl.viewangles[PITCH] = 80; diff --git a/common/in_svgalib.c b/common/in_svgalib.c index 93a9bc0..2eb55f9 100644 --- a/common/in_svgalib.c +++ b/common/in_svgalib.c @@ -12,7 +12,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. @@ -140,41 +140,41 @@ static void IN_init_kb() scantokey[ 13] = '='; scantokey[ 14] = K_BACKSPACE; scantokey[ 15] = K_TAB; - scantokey[ 16] = 'q'; - scantokey[ 17] = 'w'; - scantokey[ 18] = 'e'; - scantokey[ 19] = 'r'; - scantokey[ 20] = 't'; - scantokey[ 21] = 'y'; - scantokey[ 22] = 'u'; - scantokey[ 23] = 'i'; - scantokey[ 24] = 'o'; - scantokey[ 25] = 'p'; + scantokey[ 16] = 'q'; + scantokey[ 17] = 'w'; + scantokey[ 18] = 'e'; + scantokey[ 19] = 'r'; + scantokey[ 20] = 't'; + scantokey[ 21] = 'y'; + scantokey[ 22] = 'u'; + scantokey[ 23] = 'i'; + scantokey[ 24] = 'o'; + scantokey[ 25] = 'p'; scantokey[ 26] = '['; scantokey[ 27] = ']'; scantokey[ 28] = K_ENTER; scantokey[ 29] = K_CTRL; /*left */ scantokey[ 30] = 'a'; - scantokey[ 31] = 's'; - scantokey[ 32] = 'd'; - scantokey[ 33] = 'f'; - scantokey[ 34] = 'g'; - scantokey[ 35] = 'h'; - scantokey[ 36] = 'j'; - scantokey[ 37] = 'k'; - scantokey[ 38] = 'l'; + scantokey[ 31] = 's'; + scantokey[ 32] = 'd'; + scantokey[ 33] = 'f'; + scantokey[ 34] = 'g'; + scantokey[ 35] = 'h'; + scantokey[ 36] = 'j'; + scantokey[ 37] = 'k'; + scantokey[ 38] = 'l'; scantokey[ 39] = ';'; scantokey[ 40] = '\''; scantokey[ 41] = '`'; scantokey[ 42] = K_SHIFT; /*left */ scantokey[ 43] = '\\'; - scantokey[ 44] = 'z'; - scantokey[ 45] = 'x'; + scantokey[ 44] = 'z'; + scantokey[ 45] = 'x'; scantokey[ 46] = 'c'; - scantokey[ 47] = 'v'; + scantokey[ 47] = 'v'; scantokey[ 48] = 'b'; - scantokey[ 49] = 'n'; - scantokey[ 50] = 'm'; + scantokey[ 49] = 'n'; + scantokey[ 50] = 'm'; scantokey[ 51] = ','; scantokey[ 52] = '.'; scantokey[ 53] = '/'; @@ -182,7 +182,7 @@ static void IN_init_kb() scantokey[ 55] = KP_MULTIPLY; scantokey[ 56] = K_ALT; /*left */ scantokey[ 57] = ' '; - scantokey[ 58] = K_CAPSLOCK; + scantokey[ 58] = K_CAPSLOCK; scantokey[ 59] = K_F1; scantokey[ 60] = K_F2; scantokey[ 61] = K_F3; @@ -230,7 +230,7 @@ static void IN_init_kb() scantokey[110] = K_INS; scantokey[111] = K_DEL; scantokey[119] = K_PAUSE; - + if (keyboard_init()) { Sys_Error("keyboard_init() failed"); } @@ -367,9 +367,9 @@ void IN_Move(usercmd_t *cmd) } else { cl.viewangles[YAW] -= m_yaw->value * mouse_x; } - + if ((in_mlook.state & 1)) V_StopPitchDrift(); - + if ((in_mlook.state & 1) && !(in_strafe.state & 1)) { cl.viewangles[PITCH] += m_pitch->value * mouse_y; if (cl.viewangles[PITCH] > 80) { diff --git a/common/in_win.c b/common/in_win.c index 00fd19e..5f24d01 100644 --- a/common/in_win.c +++ b/common/in_win.c @@ -10,7 +10,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. @@ -355,7 +355,7 @@ qboolean IN_InitDInput (void) if (!hInstDI) { hInstDI = LoadLibrary("dinput.dll"); - + if (hInstDI == NULL) { Con_SafePrintf ("Couldn't load dinput.dll\n"); @@ -432,8 +432,8 @@ IN_StartupMouse */ void IN_StartupMouse (void) { - if ( COM_CheckParm ("-nomouse") ) - return; + if ( COM_CheckParm ("-nomouse") ) + return; mouseinitialized = true; @@ -457,16 +457,16 @@ void IN_StartupMouse (void) if (mouseparmsvalid) { - if ( COM_CheckParm ("-noforcemspd") ) + if ( COM_CheckParm ("-noforcemspd") ) newmouseparms[2] = originalmouseparms[2]; - if ( COM_CheckParm ("-noforcemaccel") ) + if ( COM_CheckParm ("-noforcemaccel") ) { newmouseparms[0] = originalmouseparms[0]; newmouseparms[1] = originalmouseparms[1]; } - if ( COM_CheckParm ("-noforcemparms") ) + if ( COM_CheckParm ("-noforcemparms") ) { newmouseparms[0] = originalmouseparms[0]; newmouseparms[1] = originalmouseparms[1]; @@ -577,8 +577,8 @@ void IN_MouseEvent (int mstate) { Key_Event (K_MOUSE1 + i, false); } - } - + } + mouse_oldbuttonstate = mstate; } } @@ -650,7 +650,7 @@ void IN_MouseMove (usercmd_t *cmd) else mstate_di &= ~(1<<1); break; - + case DIMOFS_BUTTON2: if (od.dwData & 0x80) mstate_di |= (1<<2); @@ -674,8 +674,8 @@ void IN_MouseMove (usercmd_t *cmd) { Key_Event (K_MOUSE1 + i, false); } - } - + } + mouse_oldbuttonstate = mstate_di; } else @@ -712,7 +712,7 @@ void IN_MouseMove (usercmd_t *cmd) if (in_mlook.state & 1) V_StopPitchDrift (); - + if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) { cl.viewangles[PITCH] += m_pitch->value * mouse_y; @@ -790,24 +790,24 @@ void IN_ClearStates (void) } -/* -=============== -IN_StartupJoystick -=============== -*/ -void IN_StartupJoystick (void) -{ +/* +=============== +IN_StartupJoystick +=============== +*/ +void IN_StartupJoystick (void) +{ int numdevs; JOYCAPS jc; MMRESULT mmr = !JOYERR_NOERROR; - + // assume no joystick - joy_avail = false; + joy_avail = false; // abort startup if user requests no joystick - if ( COM_CheckParm ("-nojoy") ) - return; - + if ( COM_CheckParm ("-nojoy") ) + return; + // verify joystick driver is present if ((numdevs = joyGetNumDevs ()) == 0) { @@ -824,7 +824,7 @@ void IN_StartupJoystick (void) if ((mmr = joyGetPosEx (joy_id, &ji)) == JOYERR_NOERROR) break; - } + } // abort startup if we didn't find a valid joystick if (mmr != JOYERR_NOERROR) @@ -838,7 +838,7 @@ void IN_StartupJoystick (void) memset (&jc, 0, sizeof(jc)); if ((mmr = joyGetDevCaps (joy_id, &jc, sizeof(jc))) != JOYERR_NOERROR) { - Con_Printf ("\njoystick not found -- invalid joystick capabilities (%x)\n\n", mmr); + Con_Printf ("\njoystick not found -- invalid joystick capabilities (%x)\n\n", mmr); return; } @@ -852,10 +852,10 @@ void IN_StartupJoystick (void) // mark the joystick as available and advanced initialization not completed // this is needed as cvars are not available during initialization - joy_avail = true; + joy_avail = true; joy_advancedinit = false; - Con_Printf ("\njoystick detected\n\n"); + Con_Printf ("\njoystick detected\n\n"); } @@ -975,7 +975,7 @@ IN_Frame(void) return; } - + // loop through the joystick buttons // key a joystick event or auxillary event for higher number buttons for each state change buttonstate = ji.dwButtons; @@ -1030,11 +1030,11 @@ IN_Frame(void) } -/* -=============== +/* +=============== IN_ReadJoystick -=============== -*/ +=============== +*/ qboolean IN_ReadJoystick (void) { @@ -1087,9 +1087,9 @@ void IN_JoyMove (usercmd_t *cmd) // verify joystick is available and that the user wants to use it if (!joy_avail || !in_joystick->value) { - return; + return; } - + // collect the joystick data, if possible if (IN_ReadJoystick () != true) { @@ -1126,7 +1126,7 @@ void IN_JoyMove (usercmd_t *cmd) } } - // convert range from -32768..32767 to -1..1 + // convert range from -32768..32767 to -1..1 fAxisValue /= 32768.0; switch (dwAxisMap[i]) @@ -1136,7 +1136,7 @@ void IN_JoyMove (usercmd_t *cmd) { // user wants forward control to become look control if (fabs(fAxisValue) > joy_pitchthreshold->value) - { + { // if mouse invert is on, invert the joystick pitch value // only absolute control support here (joy_advanced is false) if (m_pitch->value < 0.0) diff --git a/common/in_x11.c b/common/in_x11.c index bf737a8..1dcd27a 100644 --- a/common/in_x11.c +++ b/common/in_x11.c @@ -12,7 +12,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. @@ -162,14 +162,14 @@ int XLateKey(XKeyEvent *ev) case XK_Shift_L: case XK_Shift_R: key = K_SHIFT; break; - case XK_Execute: - case XK_Control_L: + case XK_Execute: + case XK_Control_L: case XK_Control_R: key = K_CTRL; break; case XK_Mode_switch: - case XK_Alt_L: - case XK_Meta_L: - case XK_Alt_R: + case XK_Alt_L: + case XK_Meta_L: + case XK_Alt_R: case XK_Meta_R: key = K_ALT; break; case XK_Caps_Lock: key = K_CAPSLOCK; break; @@ -217,7 +217,7 @@ int XLateKey(XKeyEvent *ev) key = key + ('a' - 'A'); } break; - } + } return key; } @@ -272,7 +272,7 @@ static void event_motion(XEvent *event) XWarpPointer(x_disp, None, x_win, 0, 0, 0, 0, (vid.width / 2), (vid.height / 2)); XSelectInput(x_disp, x_win, INPUT_MASK); - XGrabPointer(x_disp, x_win, True, MOUSE_MASK, GrabModeAsync, + XGrabPointer(x_disp, x_win, True, MOUSE_MASK, GrabModeAsync, GrabModeAsync, x_win, None, CurrentTime); } else { mouse_x = (event->xmotion.x - p_mouse_x); @@ -294,7 +294,7 @@ IN_Frame(void) XUngrabPointer(x_disp,CurrentTime); } else { /* grab the pointer */ - XGrabPointer(x_disp, x_win, True, MOUSE_MASK, GrabModeAsync, + XGrabPointer(x_disp, x_win, True, MOUSE_MASK, GrabModeAsync, GrabModeAsync, x_win, None, CurrentTime); //XGrabPointer(x_disp,x_win,True,0,GrabModeAsync, // GrabModeAsync,x_win,None,CurrentTime); @@ -315,7 +315,7 @@ void IN_Move(usercmd_t *cmd) { if (!mouse_avail) return; - + if (m_filter->value) { mouse_x = (mouse_x + old_mouse_x) * 0.5; mouse_y = (mouse_y + old_mouse_y) * 0.5; @@ -323,17 +323,17 @@ void IN_Move(usercmd_t *cmd) old_mouse_x = mouse_x; old_mouse_y = mouse_y; - + mouse_x *= sensitivity->value; mouse_y *= sensitivity->value; - + if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) )) cmd->sidemove += m_side->value * mouse_x; else cl.viewangles[YAW] -= m_yaw->value * mouse_x; if (in_mlook.state & 1) V_StopPitchDrift (); - + if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) { cl.viewangles[PITCH] += m_pitch->value * mouse_y; if (cl.viewangles[PITCH] > 80) diff --git a/common/input.h b/common/input.h index b6b08d7..1578191 100644 --- a/common/input.h +++ b/common/input.h @@ -11,7 +11,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. diff --git a/common/keys.c b/common/keys.c index 7744a3a..0ea993d 100644 --- a/common/keys.c +++ b/common/keys.c @@ -11,7 +11,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. @@ -91,7 +91,7 @@ keyname_t keynames[] = {"ALT", K_ALT}, {"CTRL", K_CTRL}, {"SHIFT", K_SHIFT}, - + // Keypad stuff.. {"NUMLOCK", KP_NUMLCK}, {"KP_SLASH", KP_DIVIDE}, @@ -255,7 +255,7 @@ void Key_Console (int key) HANDLE th; char *clipText, *textCopied; #endif - + switch (key) { case KP_ENTER: case K_ENTER: @@ -279,7 +279,7 @@ void Key_Console (int key) Cbuf_AddText (key_lines[edit_line]+1); // skip the ] Cbuf_AddText ("\n"); -no_lf: +no_lf: Con_Printf ("%s\n",key_lines[edit_line]); edit_line = (edit_line + 1) & 31; history_line = edit_line; @@ -295,10 +295,10 @@ no_lf: // command completion CompleteCommand (); return; - + case K_BACKSPACE: if (key_linepos > 1) - { + { strcpy(key_lines[edit_line] + key_linepos - 1, key_lines[edit_line] + key_linepos); key_linepos--; } @@ -309,12 +309,12 @@ no_lf: if (key_linepos < strlen(key_lines[edit_line])) strcpy(key_lines[edit_line] + key_linepos, key_lines[edit_line] + key_linepos + 1); return; - + case KP_RIGHTARROW: case K_RIGHTARROW: if (key_linepos < strlen(key_lines[edit_line])) key_linepos++; - return; + return; case KP_LEFTARROW: case K_LEFTARROW: @@ -351,7 +351,7 @@ no_lf: key_linepos = Q_strlen(key_lines[edit_line]); } return; - + case K_MWHEELUP: case KP_PGUP: case K_PGUP: @@ -397,7 +397,7 @@ no_lf: i = MAXCMDLINE-1 - strlen(key_lines[edit_line]); if (i > 0) { // insert the string - memcpy (key_lines[edit_line] + key_linepos + i, + memcpy (key_lines[edit_line] + key_linepos + i, key_lines[edit_line] + key_linepos, strlen(key_lines[edit_line]) - key_linepos + 1); memcpy (key_lines[edit_line] + key_linepos, textCopied, i); key_linepos += i; @@ -414,10 +414,10 @@ no_lf: if (key < 32 || key > 127) return; // non printable - + if (key_linepos < MAXCMDLINE-1) { - i = strlen(key_lines[edit_line]) - 1; + i = strlen(key_lines[edit_line]) - 1; if (i == MAXCMDLINE-2) i--; for (; i >= key_linepos; i--) key_lines[edit_line][i + 1] = key_lines[edit_line][i]; @@ -497,7 +497,7 @@ the K_* names are matched up. int Key_StringToKeynum (char *str) { keyname_t *kn; - + if (!str || !str[0]) return -1; if (!str[1]) @@ -522,9 +522,9 @@ FIXME: handle quote special (general escape sequence?) */ char *Key_KeynumToString (int keynum) { - keyname_t *kn; + keyname_t *kn; static char tinystr[2]; - + if (keynum == -1) return ""; if (keynum > 32 && keynum < 127) @@ -533,7 +533,7 @@ char *Key_KeynumToString (int keynum) tinystr[1] = 0; return tinystr; } - + for (kn=keynames ; kn->name ; kn++) if (keynum == kn->keynum) return kn->name; @@ -551,7 +551,7 @@ void Key_SetBinding (int keynum, char *binding) { char *new; int l; - + if (keynum == -1) return; @@ -564,13 +564,13 @@ void Key_SetBinding (int keynum, char *binding) Z_Free (keybindings[keynum]); keybindings[keynum] = NULL; } - + // allocate memory for new binding - l = Q_strlen (binding); + l = Q_strlen (binding); new = Z_Malloc (l+1); Q_strcpy (new, binding); new[l] = 0; - keybindings[keynum] = new; + keybindings[keynum] = new; if (!Q_strncmp (new, "toggleconsole", 13)) { consolekeys[keynum] = false; @@ -591,7 +591,7 @@ void Key_Unbind_f (void) Con_Printf ("unbind : remove commands from a key\n"); return; } - + b = Key_StringToKeynum (Cmd_Argv(1)); if (b==-1) { @@ -605,7 +605,7 @@ void Key_Unbind_f (void) void Key_Unbindall_f (void) { int i; - + for (i=0 ; i<256 ; i++) if (keybindings[i]) Key_SetBinding (i, ""); @@ -621,7 +621,7 @@ void Key_Bind_f (void) { int i, c, b; char cmd[1024]; - + c = Cmd_Argc(); if (c != 2 && c != 3) @@ -644,7 +644,7 @@ void Key_Bind_f (void) Con_Printf ("\"%s\" is not bound\n", Cmd_Argv(1) ); return; } - + // copy the rest of the command line cmd[0] = 0; // start out with a null string for (i=2 ; i< c ; i++) @@ -689,7 +689,7 @@ void Key_Init (void) key_lines[i][1] = 0; } key_linepos = 1; - + // // init ascii characters in console mode // @@ -799,11 +799,11 @@ void Key_Event (int key, qboolean down) { key_repeats[key]++; if (key != K_BACKSPACE && key != K_DEL - && key != K_LEFTARROW && key != K_RIGHTARROW + && key != K_LEFTARROW && key != K_RIGHTARROW && key != K_PGUP && key != K_PGDN && key_repeats[key] > 1) return; // ignore most autorepeats - + if (key >= 200 && !keybindings[key]) Con_Printf ("%s is unbound, hit F4 to set.\n", Key_KeynumToString (key) ); } @@ -881,7 +881,7 @@ void Key_Event (int key, qboolean down) // if ( (key_dest == key_menu && menubound[key]) || (key_dest == key_console && !consolekeys[key]) - || (key_dest == key_game && ( + || (key_dest == key_game && ( (cls.state == ca_active) || !consolekeys[key] ) ) ) { diff --git a/common/keys.h b/common/keys.h index 0b12cad..7b06068 100644 --- a/common/keys.h +++ b/common/keys.h @@ -11,7 +11,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. @@ -49,7 +49,7 @@ typedef enum { K_DOWNARROW, K_LEFTARROW, K_RIGHTARROW, - + K_ALT, K_CTRL, K_SHIFT, @@ -79,21 +79,21 @@ typedef enum { KP_NUMLCK, KP_DIVIDE, KP_MULTIPLY, - + KP_HOME, KP_UPARROW, KP_PGUP, KP_MINUS, - + KP_LEFTARROW, KP_5, KP_RIGHTARROW, KP_PLUS, - + KP_END, KP_DOWNARROW, KP_PGDN, - + KP_INS, KP_DEL, KP_ENTER, @@ -104,7 +104,7 @@ typedef enum { K_MOUSE1 = 200, K_MOUSE2, K_MOUSE3, - + // // joystick buttons // @@ -112,7 +112,7 @@ typedef enum { K_JOY2, K_JOY3, K_JOY4, - + // // aux keys are for multi-buttoned joysticks to generate so they can use // the normal binding process @@ -149,9 +149,9 @@ typedef enum { K_AUX30, K_AUX31, K_AUX32, - + // JACK: Intellimouse(c) Mouse Wheel Support - + K_MWHEELUP, K_MWHEELDOWN } keynum_t; diff --git a/common/lib_replace.c b/common/lib_replace.c index 57ed964..7675a7b 100644 --- a/common/lib_replace.c +++ b/common/lib_replace.c @@ -11,7 +11,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. @@ -36,7 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void Q_memset (void *dest, int fill, int count) { int i; - + if ( (((long)dest | count) & 3) == 0) { count >>= 2; @@ -52,7 +52,7 @@ void Q_memset (void *dest, int fill, int count) void Q_memcpy (void *dest, void *src, int count) { int i; - + if (( ( (long)dest | (long)src | count) & 3) == 0 ) { count>>=2; @@ -97,7 +97,7 @@ void Q_strncpy (char *dest, char *src, int count) int Q_strlen (char *str) { int count; - + count = 0; while (str[count]) count++; @@ -125,13 +125,13 @@ int Q_strcmp (char *s1, char *s2) while (1) { if (*s1 != *s2) - return -1; // strings not equal + return -1; // strings not equal if (!*s1) return 0; // strings are equal s1++; s2++; } - + return -1; } @@ -142,20 +142,20 @@ int Q_strncmp (char *s1, char *s2, int count) if (!count--) return 0; if (*s1 != *s2) - return -1; // strings not equal + return -1; // strings not equal if (!*s1) return 0; // strings are equal s1++; s2++; } - + return -1; } int Q_strncasecmp (char *s1, char *s2, int n) { int c1, c2; - + while (1) { c1 = *s1++; @@ -163,7 +163,7 @@ int Q_strncasecmp (char *s1, char *s2, int n) if (!n--) return 0; // strings are equal until end point - + if (c1 != c2) { if (c1 >= 'a' && c1 <= 'z') @@ -178,7 +178,7 @@ int Q_strncasecmp (char *s1, char *s2, int n) // s1++; // s2++; } - + return -1; } @@ -194,7 +194,7 @@ int Q_atoi (char *str) int val; int sign; int c; - + if (*str == '-') { sign = -1; @@ -202,7 +202,7 @@ int Q_atoi (char *str) } else sign = 1; - + val = 0; // @@ -224,7 +224,7 @@ int Q_atoi (char *str) return val*sign; } } - + // // check for character // @@ -232,7 +232,7 @@ int Q_atoi (char *str) { return sign * str[1]; } - + // // assume decimal // @@ -243,7 +243,7 @@ int Q_atoi (char *str) return val*sign; val = val*10 + c - '0'; } - + return 0; } @@ -254,7 +254,7 @@ float Q_atof (char *str) int sign; int c; int decimal, total; - + if (*str == '-') { sign = -1; @@ -262,7 +262,7 @@ float Q_atof (char *str) } else sign = 1; - + val = 0; // @@ -284,7 +284,7 @@ float Q_atof (char *str) return val*sign; } } - + // // check for character // @@ -292,7 +292,7 @@ float Q_atof (char *str) { return sign * str[1]; } - + // // assume decimal // @@ -319,6 +319,6 @@ float Q_atof (char *str) val /= 10; total--; } - + return val*sign; } diff --git a/common/lib_replace.h b/common/lib_replace.h index 460a370..f733db6 100644 --- a/common/lib_replace.h +++ b/common/lib_replace.h @@ -10,7 +10,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. diff --git a/common/mathlib.c b/common/mathlib.c index 451eff3..09878f3 100644 --- a/common/mathlib.c +++ b/common/mathlib.c @@ -12,7 +12,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. @@ -207,7 +207,7 @@ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p) return 3; } #endif - + // general case switch (p->signbits) { @@ -297,7 +297,7 @@ void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up) { float angle; float sr, sp, sy, cr, cp, cy; - + angle = angles[YAW] * (M_PI*2 / 360); sy = sin(angle); cy = cos(angle); @@ -323,7 +323,7 @@ int VectorCompare (vec3_t v1, vec3_t v2) { if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) return 0; - + return 1; } @@ -386,7 +386,7 @@ float VectorNormalize (vec3_t v) v[1] *= ilength; v[2] *= ilength; } - + return length; } diff --git a/common/mathlib.h b/common/mathlib.h index f48e60c..a787258 100644 --- a/common/mathlib.h +++ b/common/mathlib.h @@ -10,7 +10,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. diff --git a/common/mdfour.c b/common/mdfour.c index 88370e8..de2daf4 100644 --- a/common/mdfour.c +++ b/common/mdfour.c @@ -1,19 +1,19 @@ -/* +/* Unix SMB/Netbios implementation. Version 1.9. a implementation of MD4 designed for use in the SMB authentication protocol Copyright (C) Andrew Tridgell 1997-1998. - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -29,7 +29,7 @@ #include "mdfour.h" #endif // _MDFOUR_H -/* NOTE: This code makes no attempt to be fast! +/* NOTE: This code makes no attempt to be fast! It assumes that a int is at least 32 bits long */ @@ -60,38 +60,38 @@ static void mdfour64(uint32 *M) for (j=0;j<16;j++) X[j] = M[j]; - A = m->A; B = m->B; C = m->C; D = m->D; + A = m->A; B = m->B; C = m->C; D = m->D; AA = A; BB = B; CC = C; DD = D; - ROUND1(A,B,C,D, 0, 3); ROUND1(D,A,B,C, 1, 7); + ROUND1(A,B,C,D, 0, 3); ROUND1(D,A,B,C, 1, 7); ROUND1(C,D,A,B, 2, 11); ROUND1(B,C,D,A, 3, 19); - ROUND1(A,B,C,D, 4, 3); ROUND1(D,A,B,C, 5, 7); + ROUND1(A,B,C,D, 4, 3); ROUND1(D,A,B,C, 5, 7); ROUND1(C,D,A,B, 6, 11); ROUND1(B,C,D,A, 7, 19); - ROUND1(A,B,C,D, 8, 3); ROUND1(D,A,B,C, 9, 7); + ROUND1(A,B,C,D, 8, 3); ROUND1(D,A,B,C, 9, 7); ROUND1(C,D,A,B, 10, 11); ROUND1(B,C,D,A, 11, 19); - ROUND1(A,B,C,D, 12, 3); ROUND1(D,A,B,C, 13, 7); - ROUND1(C,D,A,B, 14, 11); ROUND1(B,C,D,A, 15, 19); + ROUND1(A,B,C,D, 12, 3); ROUND1(D,A,B,C, 13, 7); + ROUND1(C,D,A,B, 14, 11); ROUND1(B,C,D,A, 15, 19); - ROUND2(A,B,C,D, 0, 3); ROUND2(D,A,B,C, 4, 5); + ROUND2(A,B,C,D, 0, 3); ROUND2(D,A,B,C, 4, 5); ROUND2(C,D,A,B, 8, 9); ROUND2(B,C,D,A, 12, 13); - ROUND2(A,B,C,D, 1, 3); ROUND2(D,A,B,C, 5, 5); + ROUND2(A,B,C,D, 1, 3); ROUND2(D,A,B,C, 5, 5); ROUND2(C,D,A,B, 9, 9); ROUND2(B,C,D,A, 13, 13); - ROUND2(A,B,C,D, 2, 3); ROUND2(D,A,B,C, 6, 5); + ROUND2(A,B,C,D, 2, 3); ROUND2(D,A,B,C, 6, 5); ROUND2(C,D,A,B, 10, 9); ROUND2(B,C,D,A, 14, 13); - ROUND2(A,B,C,D, 3, 3); ROUND2(D,A,B,C, 7, 5); + ROUND2(A,B,C,D, 3, 3); ROUND2(D,A,B,C, 7, 5); ROUND2(C,D,A,B, 11, 9); ROUND2(B,C,D,A, 15, 13); - ROUND3(A,B,C,D, 0, 3); ROUND3(D,A,B,C, 8, 9); + ROUND3(A,B,C,D, 0, 3); ROUND3(D,A,B,C, 8, 9); ROUND3(C,D,A,B, 4, 11); ROUND3(B,C,D,A, 12, 15); - ROUND3(A,B,C,D, 2, 3); ROUND3(D,A,B,C, 10, 9); + ROUND3(A,B,C,D, 2, 3); ROUND3(D,A,B,C, 10, 9); ROUND3(C,D,A,B, 6, 11); ROUND3(B,C,D,A, 14, 15); - ROUND3(A,B,C,D, 1, 3); ROUND3(D,A,B,C, 9, 9); + ROUND3(A,B,C,D, 1, 3); ROUND3(D,A,B,C, 9, 9); ROUND3(C,D,A,B, 5, 11); ROUND3(B,C,D,A, 13, 15); - ROUND3(A,B,C,D, 3, 3); ROUND3(D,A,B,C, 11, 9); + ROUND3(A,B,C,D, 3, 3); ROUND3(D,A,B,C, 11, 9); ROUND3(C,D,A,B, 7, 11); ROUND3(B,C,D,A, 15, 15); A += AA; B += BB; C += CC; D += DD; - + #ifdef LARGE_INT32 A &= 0xFFFFFFFF; B &= 0xFFFFFFFF; C &= 0xFFFFFFFF; D &= 0xFFFFFFFF; @@ -149,7 +149,7 @@ static void mdfour_tail(unsigned char *in, int n) copy64(M, buf); mdfour64(M); } else { - copy4(buf+120, b); + copy4(buf+120, b); copy64(M, buf); mdfour64(M); copy64(M, buf+64); @@ -202,13 +202,13 @@ static void file_checksum1(char *fname) int fd, i; struct mdfour md; unsigned char buf[64*1024], sum[16]; - + fd = open(fname,O_RDONLY); if (fd == -1) { perror("fname"); exit(1); } - + mdfour_begin(&md); while (1) { @@ -240,7 +240,7 @@ static void file_checksum2(char *fname) perror("fname"); exit(1); } - + MDbegin(&md); while (1) { diff --git a/common/mdfour.h b/common/mdfour.h index e84d6d3..023f3de 100644 --- a/common/mdfour.h +++ b/common/mdfour.h @@ -1,19 +1,19 @@ -/* +/* Unix SMB/Netbios implementation. Version 1.9. a implementation of MD4 designed for use in the SMB authentication protocol Copyright (C) Andrew Tridgell 1997-1998. - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/common/model.c b/common/model.c index 5720d5e..6a6237a 100644 --- a/common/model.c +++ b/common/model.c @@ -12,7 +12,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. @@ -86,13 +86,13 @@ Caches the data if needed void *Mod_Extradata (model_t *mod) { void *r; - + r = Cache_Check (&mod->cache); if (r) return r; Mod_LoadModel (mod, true); - + if (!mod->cache.data) Sys_Error ("Mod_Extradata: caching failed"); return mod->cache.data; @@ -108,7 +108,7 @@ mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model) mnode_t *node; float d; mplane_t *plane; - + if (!model || !model->nodes) SV_SYS_ERROR ("Mod_PointInLeaf: bad model"); @@ -124,7 +124,7 @@ mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model) else node = node->children[1]; } - + return NULL; // never reached } @@ -141,7 +141,7 @@ byte *Mod_DecompressVis (byte *in, model_t *model) byte *out; int row; - row = (model->numleafs+7)>>3; + row = (model->numleafs+7)>>3; out = decompressed; #if 0 @@ -154,7 +154,7 @@ byte *Mod_DecompressVis (byte *in, model_t *model) *out++ = 0xff; row--; } - return decompressed; + return decompressed; } do @@ -164,7 +164,7 @@ byte *Mod_DecompressVis (byte *in, model_t *model) *out++ = *in++; continue; } - + c = in[1]; in += 2; while (c) @@ -174,7 +174,7 @@ byte *Mod_DecompressVis (byte *in, model_t *model) } } while (out - decompressed < row); #endif - + return decompressed; } @@ -194,7 +194,7 @@ void Mod_ClearAll (void) { int i; model_t *mod; - + for (i=0 , mod=mod_known ; itype != mod_alias) mod->needload = true; @@ -210,17 +210,17 @@ model_t *Mod_FindName (char *name) { int i; model_t *mod; - + if (!name[0]) SV_SYS_ERROR ("Mod_ForName: NULL name"); - + // // search the currently loaded models // for (i=0 , mod=mod_known ; iname, name) ) break; - + if (i == mod_numknown) { if (mod_numknown == MAX_MOD_KNOWN) @@ -242,9 +242,9 @@ Mod_TouchModel void Mod_TouchModel (char *name) { model_t *mod; - + mod = Mod_FindName (name); - + if (!mod->needload) { if (mod->type == mod_alias) @@ -282,9 +282,9 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash) // if (!crash) { - + } - + // // load the file // @@ -295,12 +295,12 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash) SV_SYS_ERROR ("Mod_NumForName: %s not found", mod->name); return NULL; } - + // // allocate a new model // COM_FileBase (mod->name, loadname); - + loadmodel = mod; // @@ -309,7 +309,7 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash) // call the apropriate loader mod->needload = false; - + #ifdef SERVERONLY //XXX FIXME WTF (taniwha) Mod_LoadBrushModel (mod, buf); #else @@ -318,11 +318,11 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash) case IDPOLYHEADER: Mod_LoadAliasModel (mod, buf); break; - + case IDSPRITEHEADER: Mod_LoadSpriteModel (mod, buf); break; - + default: Mod_LoadBrushModel (mod, buf); break; @@ -369,7 +369,7 @@ int Mod_LoadExternalTexture(int number, char *texturename) return (0); sprintf(texturepathname, "/id1/gfx/%s", texturename); - + mt = (miptex_t *)COM_LoadHunkFile(texturepathname); if (!mt) @@ -380,7 +380,7 @@ int Mod_LoadExternalTexture(int number, char *texturename) mt->height = LittleLong (mt->height); for (j=0 ; joffsets[j] = LittleLong (mt->offsets[j]); - + if ( (mt->width & 15) || (mt->height & 15) ) Sys_Error ("Texture %s is not 16 aligned", mt->name); pixels = mt->width*mt->height/64*85; @@ -395,10 +395,10 @@ int Mod_LoadExternalTexture(int number, char *texturename) tx->offsets[j] = mt->offsets[j] + sizeof(texture_t) - sizeof(miptex_t); // the pixels immediately follow the structures memcpy ( tx+1, mt+1, pixels); - - if (!Q_strncmp(mt->name,"sky",3)) + + if (!Q_strncmp(mt->name,"sky",3)) R_InitSky (tx); - return (1); + return (1); } #endif @@ -422,9 +422,9 @@ void Mod_LoadTextures (lump_t *l) return; } m = (dmiptexlump_t *)(mod_base + l->fileofs); - + m->nummiptex = LittleLong (m->nummiptex); - + loadmodel->numtextures = m->nummiptex; loadmodel->textures = Hunk_AllocName (m->nummiptex * sizeof(*loadmodel->textures) , loadname); @@ -445,7 +445,7 @@ void Mod_LoadTextures (lump_t *l) #endif for (j=0 ; joffsets[j] = LittleLong (mt->offsets[j]); - + if ( (mt->width & 15) || (mt->height & 15) ) SV_SYS_ERROR ("Texture %s is not 16 aligned", mt->name); pixels = mt->width*mt->height/64*85; @@ -459,8 +459,8 @@ void Mod_LoadTextures (lump_t *l) tx->offsets[j] = mt->offsets[j] + sizeof(texture_t) - sizeof(miptex_t); // the pixels immediately follow the structures memcpy ( tx+1, mt+1, pixels); -#ifndef SERVERONLY - if (!Q_strncmp(mt->name,"sky",3)) +#ifndef SERVERONLY + if (!Q_strncmp(mt->name,"sky",3)) R_InitSky (tx); #endif } @@ -529,7 +529,7 @@ void Mod_LoadTextures (lump_t *l) else SV_SYS_ERROR ("Bad animating texture %s", tx->name); } - + #define ANIM_CYCLE 2 // link them all together for (j=0 ; jlightdata = NULL; return; } - loadmodel->lightdata = Hunk_AllocName ( l->filelen, loadname); + loadmodel->lightdata = Hunk_AllocName ( l->filelen, loadname); memcpy (loadmodel->lightdata, mod_base + l->fileofs, l->filelen); } @@ -588,7 +588,7 @@ void Mod_LoadVisibility (lump_t *l) loadmodel->visdata = NULL; return; } - loadmodel->visdata = Hunk_AllocName ( l->filelen, loadname); + loadmodel->visdata = Hunk_AllocName ( l->filelen, loadname); memcpy (loadmodel->visdata, mod_base + l->fileofs, l->filelen); } @@ -605,7 +605,7 @@ void Mod_LoadEntities (lump_t *l) loadmodel->entities = NULL; return; } - loadmodel->entities = Hunk_AllocName ( l->filelen, loadname); + loadmodel->entities = Hunk_AllocName ( l->filelen, loadname); memcpy (loadmodel->entities, mod_base + l->fileofs, l->filelen); } @@ -625,7 +625,7 @@ void Mod_LoadVertexes (lump_t *l) if (l->filelen % sizeof(*in)) SV_SYS_ERROR ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->vertexes = out; loadmodel->numvertexes = count; @@ -653,7 +653,7 @@ void Mod_LoadSubmodels (lump_t *l) if (l->filelen % sizeof(*in)) SV_SYS_ERROR ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->submodels = out; loadmodel->numsubmodels = count; @@ -689,7 +689,7 @@ void Mod_LoadEdges (lump_t *l) if (l->filelen % sizeof(*in)) SV_SYS_ERROR ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( (count + 1) * sizeof(*out), loadname); + out = Hunk_AllocName ( (count + 1) * sizeof(*out), loadname); loadmodel->edges = out; loadmodel->numedges = count; @@ -718,7 +718,7 @@ void Mod_LoadTexinfo (lump_t *l) if (l->filelen % sizeof(*in)) SV_SYS_ERROR ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->texinfo = out; loadmodel->numtexinfo = count; @@ -761,7 +761,7 @@ void Mod_LoadTexinfo (lump_t *l) #endif miptex = LittleLong (in->miptex); out->flags = LittleLong (in->flags); - + if (!loadmodel->textures) { #ifdef SERVERONLY @@ -808,7 +808,7 @@ void CalcSurfaceExtents (msurface_t *s) maxs[0] = maxs[1] = -99999; tex = s->texinfo; - + for (i=0 ; inumedges ; i++) { e = loadmodel->surfedges[s->firstedge+i]; @@ -816,10 +816,10 @@ void CalcSurfaceExtents (msurface_t *s) v = &loadmodel->vertexes[loadmodel->edges[e].v[0]]; else v = &loadmodel->vertexes[loadmodel->edges[-e].v[1]]; - + for (j=0 ; j<2 ; j++) { - val = v->position[0] * tex->vecs[j][0] + + val = v->position[0] * tex->vecs[j][0] + v->position[1] * tex->vecs[j][1] + v->position[2] * tex->vecs[j][2] + tex->vecs[j][3]; @@ -831,7 +831,7 @@ void CalcSurfaceExtents (msurface_t *s) } for (i=0 ; i<2 ; i++) - { + { bmins[i] = floor(mins[i]/16); bmaxs[i] = ceil(maxs[i]/16); @@ -859,7 +859,7 @@ void Mod_LoadFaces (lump_t *l) if (l->filelen % sizeof(*in)) SV_SYS_ERROR ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->surfaces = out; loadmodel->numsurfaces = count; @@ -867,20 +867,20 @@ void Mod_LoadFaces (lump_t *l) for ( surfnum=0 ; surfnumfirstedge = LittleLong(in->firstedge); - out->numedges = LittleShort(in->numedges); + out->numedges = LittleShort(in->numedges); out->flags = 0; planenum = LittleShort(in->planenum); side = LittleShort(in->side); if (side) - out->flags |= SURF_PLANEBACK; + out->flags |= SURF_PLANEBACK; out->plane = loadmodel->planes + planenum; out->texinfo = loadmodel->texinfo + LittleShort (in->texinfo); CalcSurfaceExtents (out); - + // lighting info for (i=0 ; isamples = NULL; else out->samples = loadmodel->lightdata + i; - + // set the drawing flags flag - + if (!Q_strncmp(out->texinfo->texture->name,"sky",3)) // sky { out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED); continue; } - + if (!Q_strncmp(out->texinfo->texture->name,"*",1)) // turbulent { out->flags |= (SURF_DRAWTURB | SURF_DRAWTILED); @@ -942,7 +942,7 @@ void Mod_LoadNodes (lump_t *l) if (l->filelen % sizeof(*in)) SV_SYS_ERROR ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->nodes = out; loadmodel->numnodes = count; @@ -954,13 +954,13 @@ void Mod_LoadNodes (lump_t *l) out->minmaxs[j] = LittleShort (in->mins[j]); out->minmaxs[3+j] = LittleShort (in->maxs[j]); } - + p = LittleLong(in->planenum); out->plane = loadmodel->planes + p; out->firstsurface = LittleShort (in->firstface); out->numsurfaces = LittleShort (in->numfaces); - + for (j=0 ; j<2 ; j++) { p = LittleShort (in->children[j]); @@ -970,7 +970,7 @@ void Mod_LoadNodes (lump_t *l) out->children[j] = (mnode_t *)(loadmodel->leafs + (-1 - p)); } } - + Mod_SetParent (loadmodel->nodes, NULL); // sets nodes and leafs } @@ -989,7 +989,7 @@ void Mod_LoadLeafs (lump_t *l) if (l->filelen % sizeof(*in)) SV_SYS_ERROR ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->leafs = out; loadmodel->numleafs = count; @@ -1008,17 +1008,17 @@ void Mod_LoadLeafs (lump_t *l) out->firstmarksurface = loadmodel->marksurfaces + LittleShort(in->firstmarksurface); out->nummarksurfaces = LittleShort(in->nummarksurfaces); - + p = LittleLong(in->visofs); if (p == -1) out->compressed_vis = NULL; else out->compressed_vis = loadmodel->visdata + p; out->efrags = NULL; - + for (j=0 ; j<4 ; j++) out->ambient_sound_level[j] = in->ambient_level[j]; - } + } } /* @@ -1036,7 +1036,7 @@ void Mod_LoadClipnodes (lump_t *l) if (l->filelen % sizeof(*in)) SV_SYS_ERROR ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->clipnodes = out; loadmodel->numclipnodes = count; @@ -1086,12 +1086,12 @@ void Mod_MakeHull0 (void) dclipnode_t *out; int i, j, count; hull_t *hull; - - hull = &loadmodel->hulls[0]; - + + hull = &loadmodel->hulls[0]; + in = loadmodel->nodes; count = loadmodel->numnodes; - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); hull->clipnodes = out; hull->firstclipnode = 0; @@ -1118,16 +1118,16 @@ Mod_LoadMarksurfaces ================= */ void Mod_LoadMarksurfaces (lump_t *l) -{ +{ int i, j, count; short *in; msurface_t **out; - + in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) SV_SYS_ERROR ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->marksurfaces = out; loadmodel->nummarksurfaces = count; @@ -1147,15 +1147,15 @@ Mod_LoadSurfedges ================= */ void Mod_LoadSurfedges (lump_t *l) -{ +{ int i, count; int *in, *out; - + in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) SV_SYS_ERROR ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*sizeof(*out), loadname); + out = Hunk_AllocName ( count*sizeof(*out), loadname); loadmodel->surfedges = out; loadmodel->numsurfedges = count; @@ -1176,13 +1176,13 @@ void Mod_LoadPlanes (lump_t *l) dplane_t *in; int count; int bits; - + in = (void *)(mod_base + l->fileofs); if (l->filelen % sizeof(*in)) SV_SYS_ERROR ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - out = Hunk_AllocName ( count*2*sizeof(*out), loadname); - + out = Hunk_AllocName ( count*2*sizeof(*out), loadname); + loadmodel->planes = out; loadmodel->numplanes = count; @@ -1230,9 +1230,9 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) int i, j; dheader_t *header; dmodel_t *bm; - + loadmodel->type = mod_brush; - + header = (dheader_t *)buffer; i = LittleLong (header->version); @@ -1241,7 +1241,7 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) mod->name, i); bspver = i; // save BSP version for later use - + // swap all the lumps mod_base = (byte *)header; @@ -1255,15 +1255,15 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) for (i = 0; i < HEADER_LUMPS; i++) { if (i == LUMP_ENTITIES) continue; - mod->checksum ^= LittleLong(Com_BlockChecksum(mod_base + header->lumps[i].fileofs, + mod->checksum ^= LittleLong(Com_BlockChecksum(mod_base + header->lumps[i].fileofs, header->lumps[i].filelen)); if (i == LUMP_VISIBILITY || i == LUMP_LEAFS || i == LUMP_NODES) continue; - mod->checksum2 ^= LittleLong(Com_BlockChecksum(mod_base + header->lumps[i].fileofs, + mod->checksum2 ^= LittleLong(Com_BlockChecksum(mod_base + header->lumps[i].fileofs, header->lumps[i].filelen)); } - + // load into heap Mod_LoadVertexes (&header->lumps[LUMP_VERTEXES]); @@ -1283,10 +1283,10 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) Mod_LoadSubmodels (&header->lumps[LUMP_MODELS]); Mod_MakeHull0 (); - + mod->numframes = 2; // regular and alternate animation mod->flags = 0; - + // // set up the submodels (FIXME: this is confusing) // @@ -1300,14 +1300,14 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) mod->hulls[j].firstclipnode = bm->headnode[j]; mod->hulls[j].lastclipnode = mod->numclipnodes-1; } - + mod->firstmodelsurface = bm->firstface; mod->nummodelsurfaces = bm->numfaces; mod->radius = RadiusFromBounds (mod->mins, mod->maxs); - + VectorCopy (bm->maxs, mod->maxs); VectorCopy (bm->mins, mod->mins); - + mod->numleafs = bm->visleafs; if (i < mod->numsubmodels-1) @@ -1393,7 +1393,7 @@ void * Mod_LoadAliasGroup (void * pin, int *pframeindex, int numv, daliasinterval_t *pin_intervals; float *poutintervals; void *ptemp; - + pingroup = (daliasgroup_t *)pin; numframes = LittleLong (pingroup->numframes); @@ -1557,7 +1557,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer) maliasskindesc_t *pskindesc; int skinsize; int start, end, total; - + if (!strcmp(loadmodel->name, "progs/player.mdl") || !strcmp(loadmodel->name, "progs/eyes.mdl")) { unsigned short crc; @@ -1568,15 +1568,15 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer) CRC_Init(&crc); for (len = com_filesize, p = buffer; len; len--, p++) CRC_ProcessByte(&crc, *p); - + snprintf(st, sizeof(st), "%d", (int) crc); - Info_SetValueForKey (cls.userinfo, + Info_SetValueForKey (cls.userinfo, !strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name, st, MAX_INFO_STRING); if (cls.state >= ca_connected) { MSG_WriteByte (&cls.netchan.message, clc_stringcmd); - snprintf(st, sizeof(st), "setinfo %s %d", + snprintf(st, sizeof(st), "setinfo %s %d", !strcmp(loadmodel->name, "progs/player.mdl") ? pmodel_name : emodel_name, (int)crc); SZ_Print (&cls.netchan.message, st); @@ -1606,7 +1606,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer) pmodel = (mdl_t *) ((byte *)&pheader[1] + (LittleLong (pinmodel->numframes) - 1) * sizeof (pheader->frames[0])); - + // mod->cache.data = pheader; mod->flags = LittleLong (pinmodel->flags); @@ -1775,10 +1775,10 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer) // // move the complete, relocatable alias model to the cache -// +// end = Hunk_LowMark (); total = end - start; - + Cache_Alloc (&mod->cache, total, loadname); if (!mod->cache.data) return; @@ -1912,7 +1912,7 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer) int numframes; int size; dspriteframetype_t *pframetype; - + pin = (dsprite_t *)buffer; version = LittleLong (pin->version); @@ -1939,7 +1939,7 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer) mod->maxs[0] = mod->maxs[1] = psprite->maxwidth/2; mod->mins[2] = -psprite->maxheight/2; mod->maxs[2] = psprite->maxheight/2; - + // // load the frames // diff --git a/common/model.h b/common/model.h index b50f058..7ed8032 100644 --- a/common/model.h +++ b/common/model.h @@ -10,7 +10,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. @@ -141,7 +141,7 @@ typedef struct msurface_s int firstedge; // look up in model->surfedges[], negative numbers int numedges; // are backwards edges - + struct surfcache_s *cachespots[MIPLEVELS]; short texturemins[2]; @@ -153,7 +153,7 @@ typedef struct msurface_s struct msurface_s *texturechain; mtexinfo_t *texinfo; - + // lighting info int dlightframe; int dlightbits; @@ -170,14 +170,14 @@ typedef struct mnode_s // common with leaf int contents; // 0, to differentiate from leafs int visframe; // node needs to be traversed if current - + float minmaxs[6]; // for bounding box culling struct mnode_s *parent; // node specific mplane_t *plane; - struct mnode_s *children[2]; + struct mnode_s *children[2]; unsigned short firstsurface; unsigned short numsurfaces; @@ -379,17 +379,17 @@ typedef struct model_s modtype_t type; int numframes; synctype_t synctype; - + int flags; // // volume occupied by the model graphics -// +// vec3_t mins, maxs; float radius; // -// solid volume for clipping +// solid volume for clipping // qboolean clipbox; vec3_t clipmins, clipmaxs; diff --git a/common/modelgen.h b/common/modelgen.h index c475356..e234c83 100644 --- a/common/modelgen.h +++ b/common/modelgen.h @@ -10,7 +10,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. diff --git a/common/net.h b/common/net.h index 46a1b29..36d32a3 100644 --- a/common/net.h +++ b/common/net.h @@ -11,7 +11,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. @@ -101,7 +101,7 @@ typedef struct qsocket_s qboolean disconnected; qboolean canSend; qboolean sendNext; - + int driver; int landriver; int socket; diff --git a/common/net_chan.c b/common/net_chan.c index 44b034c..126c338 100644 --- a/common/net_chan.c +++ b/common/net_chan.c @@ -11,7 +11,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. @@ -131,7 +131,7 @@ void Netchan_OutOfBand (netadr_t adr, int length, byte *data) send.data = send_buf; send.maxsize = sizeof(send_buf); send.cursize = 0; - + MSG_WriteLong (&send, -1); // -1 sequence means out of band SZ_Write (&send, data, length); @@ -154,7 +154,7 @@ void Netchan_OutOfBandPrint (netadr_t adr, char *format, ...) { va_list argptr; static char string[8192]; // ??? why static? - + va_start (argptr, format); vsnprintf (string, sizeof(string), format, argptr); va_end (argptr); @@ -174,16 +174,16 @@ called to open a channel to a remote system void Netchan_Setup (netchan_t *chan, netadr_t adr, int qport) { memset (chan, 0, sizeof(*chan)); - + chan->remote_address = adr; chan->last_received = realtime; - + chan->message.data = chan->message_buf; chan->message.allowoverflow = true; chan->message.maxsize = sizeof(chan->message_buf); chan->qport = qport; - + chan->rate = 1.0/2500; } @@ -208,7 +208,7 @@ qboolean Netchan_CanPacket (netchan_t *chan) =============== Netchan_CanReliable -Returns true if the bandwidth choke isn't +Returns true if the bandwidth choke isn't ================ */ qboolean Netchan_CanReliable (netchan_t *chan) @@ -290,7 +290,7 @@ void Netchan_Transmit (netchan_t *chan, int length, byte *data) SZ_Write (&send, chan->reliable_buf, chan->reliable_length); chan->last_reliable_sequence = chan->outgoing_sequence; } - + // add the unreliable part if space is available if (send.maxsize - send.cursize >= length) SZ_Write (&send, data, length); @@ -344,12 +344,12 @@ qboolean Netchan_Process (netchan_t *chan) if ( #ifndef SERVERONLY - !cls.demoplayback && + !cls.demoplayback && #endif !NET_CompareAdr (net_from, chan->remote_address)) return false; - -// get sequence numbers + +// get sequence numbers MSG_BeginReading (); sequence = MSG_ReadLong (); sequence_ack = MSG_ReadLong (); @@ -362,8 +362,8 @@ qboolean Netchan_Process (netchan_t *chan) reliable_message = sequence >> 31; reliable_ack = sequence_ack >> 31; - sequence &= ~(1<<31); - sequence_ack &= ~(1<<31); + sequence &= ~(1<<31); + sequence_ack &= ~(1<<31); if (showpackets->value) Con_Printf ("<-- s=%i(%i) a=%i(%i) %i\n" @@ -379,7 +379,7 @@ qboolean Netchan_Process (netchan_t *chan) { int i; double time, rate; - + i = sequence_ack & (MAX_LATENT - 1); time = realtime - chan->outgoing_time[i]; time -= 0.1; // subtract 100 ms @@ -437,9 +437,9 @@ qboolean Netchan_Process (netchan_t *chan) // if (reliable_ack == (unsigned)chan->reliable_sequence) chan->reliable_length = 0; // it has been received - + // -// if this message contains a reliable message, bump incoming_reliable_sequence +// if this message contains a reliable message, bump incoming_reliable_sequence // chan->incoming_sequence = sequence; chan->incoming_acknowledged = sequence_ack; @@ -454,7 +454,7 @@ qboolean Netchan_Process (netchan_t *chan) chan->frame_latency = chan->frame_latency*OLD_AVG + (chan->outgoing_sequence-sequence_ack)*(1.0-OLD_AVG); chan->frame_rate = chan->frame_rate*OLD_AVG - + (realtime-chan->last_received)*(1.0-OLD_AVG); + + (realtime-chan->last_received)*(1.0-OLD_AVG); chan->good_count += 1; chan->last_received = realtime; diff --git a/common/net_com.c b/common/net_com.c index 9b347c7..a0512de 100644 --- a/common/net_com.c +++ b/common/net_com.c @@ -1,12 +1,12 @@ /* net_com.c - MD4-based checksum utility functions - + Copyright (C) 1999,2000 contributors of the QuakeForge project Please see the file "AUTHORS" for a list of contributors Author: Jeff Teunissen Date: 01 Jan 2000 - + This file is part of the QuakeForge utility library. This program is free software; you can redistribute it and/or @@ -16,7 +16,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. @@ -37,7 +37,7 @@ unsigned Com_BlockChecksum (void *buffer, int length) // mdfour_update (&md, (unsigned char *) buffer, length); // mdfour_result (&md, (unsigned char *) digest); mdfour ( (unsigned char *) digest, (unsigned char *) buffer, length ); - + val = digest[0] ^ digest[1] ^ digest[2] ^ digest[3]; return val; @@ -46,7 +46,7 @@ unsigned Com_BlockChecksum (void *buffer, int length) void Com_BlockFullChecksum (void *buffer, int len, unsigned char *outbuf) { // struct mdfour md; - + // mdfour_begin (&md); // mdfour_update (&md, (unsigned char *) buffer, len); // mdfour_result (&md, outbuf); diff --git a/common/net_ser.h b/common/net_ser.h index d2ea0f3..f309ddd 100644 --- a/common/net_ser.h +++ b/common/net_ser.h @@ -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. diff --git a/common/net_udp.c b/common/net_udp.c index ac016d8..377f0e8 100644 --- a/common/net_udp.c +++ b/common/net_udp.c @@ -12,7 +12,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. @@ -124,7 +124,7 @@ qboolean NET_CompareAdr (netadr_t a, netadr_t b) char *NET_AdrToString (netadr_t a) { static char s[64]; - + snprintf(s, sizeof(s), "%i.%i.%i.%i:%i", a.ip[0], a.ip[1], a.ip[2], a.ip[3], ntohs(a.port)); return s; @@ -133,7 +133,7 @@ char *NET_AdrToString (netadr_t a) char *NET_BaseAdrToString (netadr_t a) { static char s[64]; - + snprintf(s, sizeof(s), "%i.%i.%i.%i", a.ip[0], a.ip[1], a.ip[2], a.ip[3]); return s; @@ -155,11 +155,11 @@ qboolean NET_StringToAdr (char *s, netadr_t *a) struct sockaddr_in sadr; char *colon; char copy[128]; - - + + memset (&sadr, 0, sizeof(sadr)); sadr.sin_family = AF_INET; - + sadr.sin_port = 0; strcpy (copy, s); @@ -170,7 +170,7 @@ qboolean NET_StringToAdr (char *s, netadr_t *a) *colon = 0; sadr.sin_port = htons((unsigned short)atoi(colon+1)); } - + if (copy[0] >= '0' && copy[0] <= '9') { *(int *)&sadr.sin_addr = inet_addr(copy); @@ -181,13 +181,13 @@ qboolean NET_StringToAdr (char *s, netadr_t *a) return 0; *(int *)&sadr.sin_addr = *(int *)h->h_addr_list[0]; } - + SockadrToNetadr (&sadr, a); return true; } -// Returns true if we can't bind the address locally--in other words, +// Returns true if we can't bind the address locally--in other words, // the IP is NOT one of our interfaces. qboolean NET_IsClientLegal(netadr_t *adr) { @@ -205,7 +205,7 @@ qboolean NET_IsClientLegal(netadr_t *adr) sadr.sin_port = 0; - if( bind (newsocket, (void *)&sadr, sizeof(sadr)) == -1) + if( bind (newsocket, (void *)&sadr, sizeof(sadr)) == -1) { // It is not a local address close(newsocket); @@ -357,10 +357,10 @@ NET_Init void NET_Init (int port) { #ifdef _WIN32 - WORD wVersionRequested; + WORD wVersionRequested; int r; - wVersionRequested = MAKEWORD(1, 1); + wVersionRequested = MAKEWORD(1, 1); r = WSAStartup(MAKEWORD(1, 1), &winsockdata); if (r) diff --git a/common/net_udp.h b/common/net_udp.h index 7530301..780bdbf 100644 --- a/common/net_udp.h +++ b/common/net_udp.h @@ -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. diff --git a/common/net_udp6.c b/common/net_udp6.c index dbd8969..992ad97 100644 --- a/common/net_udp6.c +++ b/common/net_udp6.c @@ -10,7 +10,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. @@ -136,7 +136,7 @@ char *NET_BaseAdrToString (netadr_t a) int err; NetadrToSockadr(&a,&sa); - + if ((err=getnameinfo((struct sockaddr *) &sa,sizeof(sa),s,sizeof(s),NULL,0,NI_NUMERICHOST))) { strcpy(s,""); } @@ -182,9 +182,9 @@ qboolean NET_StringToAdr (char *s, netadr_t *a) } *space++='\0'; } - + for (; *space; space++) { - if (*space==':') + if (*space==':') { *space='\0'; ports=space+1; @@ -218,14 +218,14 @@ qboolean NET_StringToAdr (char *s, netadr_t *a) break; default: Con_Printf ("NET_StringToAdr: string %s:\nprotocol family %d not supported\n",s, resultp->ai_family); - return 0; + return 0; } SockadrToNetadr ((struct sockaddr_in6 *) &ss, a); return true; } -// Returns true if we can't bind the address locally--in other words, +// Returns true if we can't bind the address locally--in other words, // the IP is NOT one of our interfaces. qboolean NET_IsClientLegal(netadr_t *adr) { @@ -243,7 +243,7 @@ qboolean NET_IsClientLegal(netadr_t *adr) sadr.sin_port = 0; - if( bind (newsocket, (void *)&sadr, sizeof(sadr)) == -1) + if( bind (newsocket, (void *)&sadr, sizeof(sadr)) == -1) { // It is not a local address close(newsocket); @@ -362,7 +362,7 @@ int UDP_OpenSocket (int port) memset(&hints,0,sizeof(hints)); hints.ai_socktype=SOCK_DGRAM; hints.ai_family=PF_UNSPEC; - + if ((err=getaddrinfo(com_argv[i+1],NULL,&hints,&resultp))) { Sys_Error ("UDP_OpenSocket: addr %s: %s",com_argv[i+1], gai_strerror(err)); @@ -428,10 +428,10 @@ NET_Init void NET_Init (int port) { #ifdef _WIN32 - WORD wVersionRequested; + WORD wVersionRequested; int r; - wVersionRequested = MAKEWORD(1, 1); + wVersionRequested = MAKEWORD(1, 1); r = WSAStartup(MAKEWORD(1, 1), &winsockdata); if (r) diff --git a/common/net_wins.h b/common/net_wins.h index 756ce64..5b5c62c 100644 --- a/common/net_wins.h +++ b/common/net_wins.h @@ -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. diff --git a/common/net_wipx.h b/common/net_wipx.h index ed82dc1..03832cd 100644 --- a/common/net_wipx.h +++ b/common/net_wipx.h @@ -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. diff --git a/common/nonintel.c b/common/nonintel.c index 075da70..aa12c2c 100644 --- a/common/nonintel.c +++ b/common/nonintel.c @@ -10,7 +10,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. diff --git a/common/nozip.h b/common/nozip.h index ef70888..25356b7 100644 --- a/common/nozip.h +++ b/common/nozip.h @@ -9,7 +9,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. diff --git a/common/pcx.c b/common/pcx.c index 92e6e2a..7b8176e 100644 --- a/common/pcx.c +++ b/common/pcx.c @@ -1,8 +1,8 @@ /* pcx.c - + PCX loading/saving functions - + Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1999,2000 contributors of the QuakeForge project Please see the file "AUTHORS" for a list of contributors @@ -15,7 +15,7 @@ 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. @@ -57,7 +57,7 @@ byte *LoadPCX (char *file, cache_user_t *cache, int buf_x, int buf_y) { Con_Printf("Using cached version of %s\n", file); return out; } - + raw = COM_LoadTempFile (file); if (!raw) { Con_Printf("Can not open %s\n", file); @@ -67,7 +67,7 @@ byte *LoadPCX (char *file, cache_user_t *cache, int buf_x, int buf_y) { pcx = (pcx_t *)raw; raw = &pcx->data; - if (pcx->manufacturer != 0x0a + if (pcx->manufacturer != 0x0a || pcx->version != 5 || pcx->encoding != 1 || pcx->bits_per_pixel != 8 diff --git a/common/plugin.c b/common/plugin.c index 333be39..e1ad661 100644 --- a/common/plugin.c +++ b/common/plugin.c @@ -1,16 +1,16 @@ /* plugin.c - + Dynamic shared object loader - + Copyright (C) 1999, 2000 contributors of the QuakeForge project Please see the file "AUTHORS" for a list of contributors Author: Zephaniah E. Hull Date: 11 Feb 2000 - + This file is part of the QuakeForge Core system. - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 @@ -18,13 +18,13 @@ 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. You should have received a copy of the GNU General Public License along with this program; if not, write to: - + Free Software Foundation, Inc. 59 Temple Place - Suite 330 Boston, MA 02111-1307, USA. @@ -94,11 +94,11 @@ int plugin_load(char *filename) if ((gpi = dlsym(h, "get_input_plugin_info"))) { /* input_pi *p; - + p = (input_pi *) gpi(); p->handle = h; p->filename = filename; - + IN = p; } else if (gpi = dlsym(h, "get_sound_plugin_info")) { sound_pi *p; @@ -147,6 +147,6 @@ int plugin_load(char *filename) void plugin_unload(void *handle) { - + } #endif diff --git a/common/plugin.h b/common/plugin.h index a3bbc49..a11b7be 100644 --- a/common/plugin.h +++ b/common/plugin.h @@ -11,7 +11,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. diff --git a/common/pmove.c b/common/pmove.c index ff4d36b..065da09 100644 --- a/common/pmove.c +++ b/common/pmove.c @@ -10,7 +10,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. @@ -78,13 +78,13 @@ int PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) float backoff; float change; int i, blocked; - + blocked = 0; if (normal[2] > 0) blocked |= 1; // floor if (!normal[2]) blocked |= 2; // step - + backoff = DotProduct (in, normal) * overbounce; for (i=0 ; i<3 ; i++) @@ -94,7 +94,7 @@ int PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) if (out[i] > -STOP_EPSILON && out[i] < STOP_EPSILON) out[i] = 0; } - + return blocked; } @@ -121,14 +121,14 @@ int PM_FlyMove (void) vec3_t end; float time_left; int blocked; - + numbumps = 4; - + blocked = 0; VectorCopy (pmove.velocity, original_velocity); VectorCopy (pmove.velocity, primal_velocity); numplanes = 0; - + time_left = frametime; for (bumpcount=0 ; bumpcount= MAX_CLIP_PLANES) { // this shouldn't really happen @@ -193,7 +193,7 @@ int PM_FlyMove (void) if (j == numplanes) break; } - + if (i != numplanes) { // go along this plane } @@ -246,9 +246,9 @@ void PM_GroundMove (void) if (!pmove.velocity[0] && !pmove.velocity[1] && !pmove.velocity[2]) return; - // first try just moving to the destination + // first try just moving to the destination dest[0] = pmove.origin[0] + pmove.velocity[0]*frametime; - dest[1] = pmove.origin[1] + pmove.velocity[1]*frametime; + dest[1] = pmove.origin[1] + pmove.velocity[1]*frametime; dest[2] = pmove.origin[2]; // first try moving directly to the next spot @@ -333,12 +333,12 @@ void PM_Friction (void) float drop; vec3_t start, stop; pmtrace_t trace; - + if (pmove.waterjumptime) return; vel = pmove.velocity; - + speed = sqrt(vel[0]*vel[0] +vel[1]*vel[1] + vel[2]*vel[2]); if (speed < 1) { @@ -408,16 +408,16 @@ void PM_Accelerate (vec3_t wishdir, float wishspeed, float accel) accelspeed = accel*frametime*wishspeed; if (accelspeed > addspeed) accelspeed = addspeed; - + for (i=0 ; i<3 ; i++) - pmove.velocity[i] += accelspeed*wishdir[i]; + pmove.velocity[i] += accelspeed*wishdir[i]; } void PM_AirAccelerate (vec3_t wishdir, float wishspeed, float accel) { int i; float addspeed, accelspeed, currentspeed, wishspd = wishspeed; - + if (pmove.dead) return; if (pmove.waterjumptime) @@ -432,9 +432,9 @@ void PM_AirAccelerate (vec3_t wishdir, float wishspeed, float accel) accelspeed = accel * wishspeed * frametime; if (accelspeed > addspeed) accelspeed = addspeed; - + for (i=0 ; i<3 ; i++) - pmove.velocity[i] += accelspeed*wishdir[i]; + pmove.velocity[i] += accelspeed*wishdir[i]; } @@ -492,7 +492,7 @@ void PM_WaterMove (void) VectorCopy (trace.endpos, pmove.origin); return; } - + PM_FlyMove (); // if (pmove.waterjumptime) // Con_Printf ("<-wm%f, %f, %f\n", pmove.velocity[0], pmove.velocity[1], pmove.velocity[2]); @@ -515,7 +515,7 @@ void PM_AirMove (void) fmove = pmove.cmd.forwardmove; smove = pmove.cmd.sidemove; - + forward[2] = 0; right[2] = 0; VectorNormalize (forward); @@ -536,7 +536,7 @@ void PM_AirMove (void) VectorScale (wishvel, movevars.maxspeed/wishspeed, wishvel); wishspeed = movevars.maxspeed; } - + // if (pmove.waterjumptime) // Con_Printf ("am->%f, %f, %f\n", pmove.velocity[0], pmove.velocity[1], pmove.velocity[2]); @@ -584,7 +584,7 @@ void PM_CatagorizePosition (void) // if the player hull point one unit down is solid, the player // is on ground -// see if standing on something solid +// see if standing on something solid point[0] = pmove.origin[0]; point[1] = pmove.origin[1]; point[2] = pmove.origin[2] - 1; @@ -620,7 +620,7 @@ void PM_CatagorizePosition (void) waterlevel = 0; watertype = CONTENTS_EMPTY; - point[2] = pmove.origin[2] + player_mins[2] + 1; + point[2] = pmove.origin[2] + player_mins[2] + 1; cont = PM_PointContents (point); if (cont <= CONTENTS_WATER) @@ -814,7 +814,7 @@ void SpectatorMove (void) // accelerate fmove = pmove.cmd.forwardmove; smove = pmove.cmd.sidemove; - + VectorNormalize (forward); VectorNormalize (right); @@ -841,9 +841,9 @@ void SpectatorMove (void) accelspeed = movevars.accelerate*frametime*wishspeed; if (accelspeed > addspeed) accelspeed = addspeed; - + for (i=0 ; i<3 ; i++) - pmove.velocity[i] += accelspeed*wishdir[i]; + pmove.velocity[i] += accelspeed*wishdir[i]; // move diff --git a/common/pmove.h b/common/pmove.h index 917a317..5f5a9f7 100644 --- a/common/pmove.h +++ b/common/pmove.h @@ -11,7 +11,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. diff --git a/common/pmove_simple.h b/common/pmove_simple.h index 5d84d72..cfdaf1c 100644 --- a/common/pmove_simple.h +++ b/common/pmove_simple.h @@ -10,7 +10,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. diff --git a/common/pmovetst.c b/common/pmovetst.c index b1d105b..eaea98f 100644 --- a/common/pmovetst.c +++ b/common/pmovetst.c @@ -10,7 +10,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. @@ -53,19 +53,19 @@ void PM_InitBoxHull (void) for (i=0 ; i<6 ; i++) { box_clipnodes[i].planenum = i; - + side = i&1; - + box_clipnodes[i].children[side] = CONTENTS_EMPTY; if (i != 5) box_clipnodes[i].children[side^1] = i + 1; else box_clipnodes[i].children[side^1] = CONTENTS_SOLID; - + box_planes[i].type = i>>1; box_planes[i].normal[i>>1] = 1; } - + } @@ -106,10 +106,10 @@ int PM_HullPointContents (hull_t *hull, int num, vec3_t p) { if (num < hull->firstclipnode || num > hull->lastclipnode) Sys_Error ("PM_HullPointContents: bad node number"); - + node = hull->clipnodes + num; plane = hull->planes + node->planenum; - + if (plane->type < 3) d = p[plane->type] - plane->dist; else @@ -119,7 +119,7 @@ int PM_HullPointContents (hull_t *hull, int num, vec3_t p) else num = node->children[0]; } - + return num; } @@ -145,10 +145,10 @@ int PM_PointContents (vec3_t p) { if (num < hull->firstclipnode || num > hull->lastclipnode) Sys_Error ("PM_HullPointContents: bad node number"); - + node = hull->clipnodes + num; plane = hull->planes + node->planenum; - + if (plane->type < 3) d = p[plane->type] - plane->dist; else @@ -158,7 +158,7 @@ int PM_PointContents (vec3_t p) else num = node->children[0]; } - + return num; } @@ -225,7 +225,7 @@ qboolean PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec t1 = DotProduct (plane->normal, p1) - plane->dist; t2 = DotProduct (plane->normal, p2) - plane->dist; } - + #if 1 if (t1 >= 0 && t2 >= 0) return PM_RecursiveHullCheck (hull, node->children[0], p1f, p2f, p1, p2, trace); @@ -247,7 +247,7 @@ qboolean PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec frac = 0; if (frac > 1) frac = 1; - + midf = p1f + (p2f - p1f)*frac; for (i=0 ; i<3 ; i++) mid[i] = p1[i] + frac*(p2[i] - p1[i]); @@ -265,15 +265,15 @@ qboolean PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec // return false; // } //#endif - + if (PM_HullPointContents (hull, node->children[side^1], mid) != CONTENTS_SOLID) // go past the node return PM_RecursiveHullCheck (hull, node->children[side^1], midf, p2f, mid, p2, trace); - + if (trace->allsolid) return false; // never got out of the solid area - + //================== // the other side of the node is solid, this is the impact point //================== diff --git a/common/pr_cmds.c b/common/pr_cmds.c index 82ebb2f..8eb2efa 100644 --- a/common/pr_cmds.c +++ b/common/pr_cmds.c @@ -11,7 +11,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. @@ -50,7 +50,7 @@ char *PF_VarString (int first) { int i; static char out[256]; - + out[0] = 0; for (i=first ; is_name) ,s); ed = PROG_TO_EDICT(pr_global_struct->self); @@ -101,13 +101,13 @@ void PF_objerror (void) { char *s; edict_t *ed; - + s = PF_VarString(0); Con_Printf ("======OBJECT ERROR in %s:\n%s\n", PR_GetString(pr_xfunction->s_name),s); ed = PROG_TO_EDICT(pr_global_struct->self); ED_Print (ed); ED_Free (ed); - + #ifdef QUAKEWORLD SV_Error ("Program error"); #else @@ -143,7 +143,7 @@ void PF_setorigin (void) { edict_t *e; float *org; - + e = G_EDICT(OFS_PARM0); org = G_VECTOR(OFS_PARM1); VectorCopy (org, e->v.origin); @@ -165,7 +165,7 @@ void SetMinMaxSize (edict_t *e, float *min, float *max, qboolean rotate) float a; vec3_t base, transformed; int i, j, k, l; - + for (i=0 ; i<3 ; i++) if (min[i] > max[i]) PR_RunError ("backwards mins/maxs"); @@ -181,20 +181,20 @@ void SetMinMaxSize (edict_t *e, float *min, float *max, qboolean rotate) { // find min / max for rotations angles = e->v.angles; - + a = angles[1]/180 * M_PI; - + xvector[0] = cos(a); xvector[1] = sin(a); yvector[0] = -sin(a); yvector[1] = cos(a); - + VectorCopy (min, bounds[0]); VectorCopy (max, bounds[1]); - + rmin[0] = rmin[1] = rmin[2] = 9999; rmax[0] = rmax[1] = rmax[2] = -9999; - + for (i=0 ; i<= 1 ; i++) { base[0] = bounds[i][0]; @@ -204,12 +204,12 @@ void SetMinMaxSize (edict_t *e, float *min, float *max, qboolean rotate) for (k=0 ; k<= 1 ; k++) { base[2] = bounds[k][2]; - + // transform the point transformed[0] = xvector[0]*base[0] + yvector[0]*base[1]; transformed[1] = xvector[1]*base[0] + yvector[1]*base[1]; transformed[2] = base[2]; - + for (l=0 ; l<3 ; l++) { if (transformed[l] < rmin[l]) @@ -221,12 +221,12 @@ void SetMinMaxSize (edict_t *e, float *min, float *max, qboolean rotate) } } } - + // set derived values VectorCopy (rmin, e->v.mins); VectorCopy (rmax, e->v.maxs); VectorSubtract (max, min, e->v.size); - + SV_LinkEdict (e, false); } @@ -244,7 +244,7 @@ void PF_setsize (void) { edict_t *e; float *min, *max; - + e = G_EDICT(OFS_PARM0); min = G_VECTOR(OFS_PARM1); max = G_VECTOR(OFS_PARM2); @@ -284,7 +284,7 @@ void PF_setmodel (void) if (!*check) PR_RunError ("no precache: %s\n", m); - + e->v.model = PR_SetString(m); e->v.modelindex = i; @@ -300,7 +300,7 @@ void PF_setmodel (void) } #else mod = sv.models[ (int)e->v.modelindex]; // Mod_ForName (m, true); - + if (mod) SetMinMaxSize (e, mod->mins, mod->maxs, true); else @@ -352,7 +352,7 @@ void PF_sprint (void) #ifdef QUAKEWORLD int level; #endif - + entnum = G_EDICTNUM(OFS_PARM0); #ifdef QUAKEWORLD @@ -362,7 +362,7 @@ void PF_sprint (void) #else s = PF_VarString(1); #endif - + #ifdef QUAKEWORLD if (entnum < 1 || entnum > MAX_CLIENTS) #else @@ -372,9 +372,9 @@ void PF_sprint (void) Con_Printf ("tried to sprint to a non-client\n"); return; } - + client = &svs.clients[entnum-1]; - + #ifdef QUAKEWORLD SV_ClientPrintf (client, level, "%s", s); #else @@ -398,10 +398,10 @@ void PF_centerprint (void) char *s; int entnum; client_t *cl; - + entnum = G_EDICTNUM(OFS_PARM0); s = PF_VarString(1); - + #ifdef QUAKEWORLD if (entnum < 1 || entnum > MAX_CLIENTS) #else @@ -411,7 +411,7 @@ void PF_centerprint (void) Con_Printf ("tried to sprint to a non-client\n"); return; } - + cl = &svs.clients[entnum-1]; #ifdef QUAKEWORLD @@ -436,12 +436,12 @@ void PF_normalize (void) float *value1; vec3_t newvalue; float new; - + value1 = G_VECTOR(OFS_PARM0); new = value1[0] * value1[0] + value1[1] * value1[1] + value1[2]*value1[2]; new = sqrt(new); - + if (new == 0) newvalue[0] = newvalue[1] = newvalue[2] = 0; else @@ -451,8 +451,8 @@ void PF_normalize (void) newvalue[1] = value1[1] * new; newvalue[2] = value1[2] * new; } - - VectorCopy (newvalue, G_VECTOR(OFS_RETURN)); + + VectorCopy (newvalue, G_VECTOR(OFS_RETURN)); } /* @@ -466,12 +466,12 @@ void PF_vlen (void) { float *value1; float new; - + value1 = G_VECTOR(OFS_PARM0); new = value1[0] * value1[0] + value1[1] * value1[1] + value1[2]*value1[2]; new = sqrt(new); - + G_FLOAT(OFS_RETURN) = new; } @@ -486,7 +486,7 @@ void PF_vectoyaw (void) { float *value1; float yaw; - + value1 = G_VECTOR(OFS_PARM0); if (value1[1] == 0 && value1[0] == 0) @@ -514,7 +514,7 @@ void PF_vectoangles (void) float *value1; float forward; float yaw, pitch; - + value1 = G_VECTOR(OFS_PARM0); if (value1[1] == 0 && value1[0] == 0) @@ -554,9 +554,9 @@ random() void PF_random (void) { float num; - + num = (rand ()&0x7fff) / ((float)0x7fff); - + G_FLOAT(OFS_RETURN) = num; } @@ -573,7 +573,7 @@ void PF_particle (void) float *org, *dir; float color; float count; - + org = G_VECTOR(OFS_PARM0); dir = G_VECTOR(OFS_PARM1); color = G_FLOAT(OFS_PARM2); @@ -596,16 +596,16 @@ void PF_ambientsound (void) float vol, attenuation; int i, soundnum; - pos = G_VECTOR (OFS_PARM0); + pos = G_VECTOR (OFS_PARM0); samp = G_STRING(OFS_PARM1); vol = G_FLOAT(OFS_PARM2); attenuation = G_FLOAT(OFS_PARM3); - + // check to see if samp was properly precached for (soundnum=0, check = sv.sound_precache ; *check ; check++, soundnum++) if (!strcmp(*check,samp)) break; - + if (!*check) { Con_Printf ("no precache: %s\n", samp); @@ -647,7 +647,7 @@ void PF_sound (void) edict_t *entity; int volume; float attenuation; - + entity = G_EDICT(OFS_PARM0); channel = G_FLOAT(OFS_PARM1); sample = G_STRING(OFS_PARM2); @@ -664,7 +664,7 @@ void PF_sound (void) if (channel < 0 || channel > 7) Sys_Error ("SV_StartSound: channel = %i", channel); #endif - + SV_StartSound (entity, channel, sample, volume, attenuation); } @@ -714,7 +714,7 @@ void PF_traceline (void) pr_global_struct->trace_inopen = trace.inopen; VectorCopy (trace.endpos, pr_global_struct->trace_endpos); VectorCopy (trace.plane.normal, pr_global_struct->trace_plane_normal); - pr_global_struct->trace_plane_dist = trace.plane.dist; + pr_global_struct->trace_plane_dist = trace.plane.dist; if (trace.ent) pr_global_struct->trace_ent = EDICT_TO_PROG(trace.ent); else @@ -827,7 +827,7 @@ void PF_checkclient (void) mleaf_t *leaf; int l; vec3_t view; - + // find a new check if on a new frame if (sv.time - sv.lastchecktime >= 0.1) { @@ -835,7 +835,7 @@ void PF_checkclient (void) sv.lastchecktime = sv.time; } -// return check if it might be visible +// return check if it might be visible ent = EDICT_NUM(sv.lastcheck); if (ent->free || ent->v.health <= 0) { @@ -877,7 +877,7 @@ void PF_stuffcmd (void) int entnum; char *str; client_t *cl; - + entnum = G_EDICTNUM(OFS_PARM0); #ifdef QUAKEWORLD if (entnum < 1 || entnum > MAX_CLIENTS) @@ -885,8 +885,8 @@ void PF_stuffcmd (void) if (entnum < 1 || entnum > svs.maxclients) #endif PR_RunError ("Parm 0 not a client"); - str = G_STRING(OFS_PARM1); - + str = G_STRING(OFS_PARM1); + cl = &svs.clients[entnum-1]; #if QUAKEWORLD @@ -918,8 +918,8 @@ localcmd (string) void PF_localcmd (void) { char *str; - - str = G_STRING(OFS_PARM0); + + str = G_STRING(OFS_PARM0); Cbuf_AddText (str); } @@ -933,9 +933,9 @@ float cvar (string) void PF_cvar (void) { char *str; - + str = G_STRING(OFS_PARM0); - + G_FLOAT(OFS_RETURN) = Cvar_VariableValue (str); } @@ -949,10 +949,10 @@ float cvar (string) void PF_cvar_set (void) { char *var, *val; - + var = G_STRING(OFS_PARM0); val = G_STRING(OFS_PARM1); - + Cvar_Set (var, val); } @@ -974,7 +974,7 @@ void PF_findradius (void) int i, j; chain = (edict_t *)sv.edicts; - + org = G_VECTOR(OFS_PARM0); rad = G_FLOAT(OFS_PARM1); @@ -986,10 +986,10 @@ void PF_findradius (void) if (ent->v.solid == SOLID_NOT) continue; for (j=0 ; j<3 ; j++) - eorg[j] = org[j] - (ent->v.origin[j] + (ent->v.mins[j] + ent->v.maxs[j])*0.5); + eorg[j] = org[j] - (ent->v.origin[j] + (ent->v.mins[j] + ent->v.maxs[j])*0.5); if (Length(eorg) > rad) continue; - + ent->v.chain = EDICT_TO_PROG(chain); chain = ent; } @@ -1018,7 +1018,7 @@ void PF_ftos (void) { float v; v = G_FLOAT(OFS_PARM0); - + if (v == (int)v) snprintf(pr_string_temp, sizeof(pr_string_temp), "%d",(int)v); else @@ -1049,7 +1049,7 @@ void PF_Spawn (void) void PF_Remove (void) { edict_t *ed; - + ed = G_EDICT(OFS_PARM0); ED_Free (ed); } @@ -1058,17 +1058,17 @@ void PF_Remove (void) // entity (entity start, .string field, string match) find = #5; void PF_Find (void) { - int e; + int e; int f; char *s, *t; edict_t *ed; - + e = G_EDICTNUM(OFS_PARM0); f = G_INT(OFS_PARM1); s = G_STRING(OFS_PARM2); if (!s) PR_RunError ("PF_Find: bad search string"); - + for (e++ ; e < sv.num_edicts ; e++) { ed = EDICT_NUM(e); @@ -1083,7 +1083,7 @@ void PF_Find (void) return; } } - + RETURN_EDICT(sv.edicts); } @@ -1102,14 +1102,14 @@ void PF_precache_sound (void) { char *s; int i; - + if (sv.state != ss_loading) PR_RunError ("PF_Precache_*: Precache can only be done in spawn functions"); - + s = G_STRING(OFS_PARM0); G_INT(OFS_RETURN) = G_INT(OFS_PARM0); PR_CheckEmptyString (s); - + for (i=0 ; iself); yaw = G_FLOAT(OFS_PARM0); dist = G_FLOAT(OFS_PARM1); - + if ( !( (int)ent->v.flags & (FL_ONGROUND|FL_FLY|FL_SWIM) ) ) { G_FLOAT(OFS_RETURN) = 0; @@ -1198,7 +1198,7 @@ void PF_walkmove (void) } yaw = yaw*M_PI*2 / 360; - + move[0] = cos(yaw)*dist; move[1] = sin(yaw)*dist; move[2] = 0; @@ -1206,10 +1206,10 @@ void PF_walkmove (void) // save program state, because SV_movestep may call other progs oldf = pr_xfunction; oldself = pr_global_struct->self; - + G_FLOAT(OFS_RETURN) = SV_movestep(ent, move, true); - - + + // restore program state pr_xfunction = oldf; pr_global_struct->self = oldself; @@ -1227,12 +1227,12 @@ void PF_droptofloor (void) edict_t *ent; vec3_t end; trace_t trace; - + ent = PROG_TO_EDICT(pr_global_struct->self); VectorCopy (ent->v.origin, end); end[2] -= 256; - + trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, false, ent); if (trace.fraction == 1 || trace.allsolid) @@ -1260,17 +1260,17 @@ void PF_lightstyle (void) char *val; client_t *client; int j; - + style = G_FLOAT(OFS_PARM0); val = G_STRING(OFS_PARM1); // change the string in sv sv.lightstyles[style] = val; - + // send message to all clients on this server if (sv.state != ss_active) return; - + #ifdef QUAKEWORLD for (j=0, client = svs.clients ; jstate == cs_spawned ) @@ -1317,7 +1317,7 @@ PF_checkbottom void PF_checkbottom (void) { edict_t *ent; - + ent = G_EDICT(OFS_PARM0); G_FLOAT(OFS_RETURN) = SV_CheckBottom (ent); @@ -1331,10 +1331,10 @@ PF_pointcontents void PF_pointcontents (void) { float *v; - + v = G_VECTOR(OFS_PARM0); - G_FLOAT(OFS_RETURN) = SV_PointContents (v); + G_FLOAT(OFS_RETURN) = SV_PointContents (v); } /* @@ -1348,7 +1348,7 @@ void PF_nextent (void) { int i; edict_t *ent; - + i = G_EDICTNUM(OFS_PARM0); while (1) { @@ -1427,7 +1427,7 @@ void PF_aim (void) VectorCopy (dir, bestdir); bestdist = sv_aim->value; bestent = NULL; - + check = NEXT_EDICT(sv.edicts); for (i=1 ; iv.origin, ent->v.origin, dir); @@ -1460,7 +1460,7 @@ void PF_aim (void) VectorScale (pr_global_struct->v_forward, dist, end); end[2] = dir[2]; VectorNormalize (end); - VectorCopy (end, G_VECTOR(OFS_RETURN)); + VectorCopy (end, G_VECTOR(OFS_RETURN)); } else { @@ -1479,12 +1479,12 @@ void PF_changeyaw (void) { edict_t *ent; float ideal, current, move, speed; - + ent = PROG_TO_EDICT(pr_global_struct->self); current = anglemod( ent->v.angles[1] ); ideal = ent->v.ideal_yaw; speed = ent->v.yaw_speed; - + if (current == ideal) return; move = ideal - current; @@ -1508,7 +1508,7 @@ void PF_changeyaw (void) if (move < -speed) move = -speed; } - + ent->v.angles[1] = anglemod (current + move); } @@ -1535,7 +1535,7 @@ sizebuf_t *WriteDest (void) { case MSG_BROADCAST: return &sv.datagram; - + case MSG_ONE: { #ifdef QUAKEWORLD SV_Error("Shouldn't be at MSG_ONE"); @@ -1551,10 +1551,10 @@ sizebuf_t *WriteDest (void) return &svs.clients[entnum-1].message; #endif } - + case MSG_ALL: return &sv.reliable_datagram; - + case MSG_INIT: #ifdef QUAKEWORLD if (sv.state != ss_loading) @@ -1569,7 +1569,7 @@ sizebuf_t *WriteDest (void) PR_RunError ("WriteDest: bad destination"); break; } - + return NULL; } @@ -1693,7 +1693,7 @@ void PF_makestatic (void) { edict_t *ent; int i; - + ent = G_EDICT(OFS_PARM0); MSG_WriteByte (&sv.signon,svc_spawnstatic); @@ -1762,7 +1762,7 @@ void PF_changelevel (void) return; svs.changelevel_issued = true; #endif - + s = G_STRING(OFS_PARM0); #ifdef QUAKEWORLD Cbuf_AddText (va("map %s\n",s)); @@ -1792,11 +1792,11 @@ void PF_logfrag (void) e1 = NUM_FOR_EDICT(ent1); e2 = NUM_FOR_EDICT(ent2); - + if (e1 < 1 || e1 > MAX_CLIENTS || e2 < 1 || e2 > MAX_CLIENTS) return; - + s = va("\\%s\\%s\\\n",svs.clients[e1-1].name, svs.clients[e2-1].name); SZ_Print (&svs.log[svs.logsequence&1], s); diff --git a/common/pr_comp.h b/common/pr_comp.h index 210c068..8d7f695 100644 --- a/common/pr_comp.h +++ b/common/pr_comp.h @@ -10,7 +10,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. @@ -52,19 +52,19 @@ enum { OP_ADD_V, OP_SUB_F, OP_SUB_V, - + OP_EQ_F, OP_EQ_V, OP_EQ_S, OP_EQ_E, OP_EQ_FNC, - + OP_NE_F, OP_NE_V, OP_NE_S, OP_NE_E, OP_NE_FNC, - + OP_LE, OP_GE, OP_LT, @@ -114,7 +114,7 @@ enum { OP_GOTO, OP_AND, OP_OR, - + OP_BITAND, OP_BITOR }; @@ -142,12 +142,12 @@ typedef struct int first_statement; // negative numbers are builtins int parm_start; int locals; // total ints of parms + locals - + int profile; // runtime - + int s_name; int s_file; // source file defined in - + int numparms; byte parm_size[MAX_PARMS]; } dfunction_t; @@ -158,25 +158,25 @@ typedef struct { int version; int crc; // check of header file - + int ofs_statements; int numstatements; // statement 0 is an error int ofs_globaldefs; int numglobaldefs; - + int ofs_fielddefs; int numfielddefs; - + int ofs_functions; int numfunctions; // function 0 is an empty - + int ofs_strings; int numstrings; // first string is a null string int ofs_globals; int numglobals; - + int entityfields; } dprograms_t; diff --git a/common/pr_edict.c b/common/pr_edict.c index 0442a3b..1f04fd4 100644 --- a/common/pr_edict.c +++ b/common/pr_edict.c @@ -12,7 +12,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. @@ -142,7 +142,7 @@ edict_t *ED_Alloc (void) return e; } } - + if (i == MAX_EDICTS) #ifdef QUAKEWORLD { @@ -188,7 +188,7 @@ void ED_Free (edict_t *ed) VectorCopy (vec3_origin, ed->v.angles); ed->v.nextthink = -1; ed->v.solid = 0; - + ed->freetime = sv.time; } @@ -203,7 +203,7 @@ ddef_t *ED_GlobalAtOfs (int ofs) { ddef_t *def; int i; - + for (i=0 ; inumglobaldefs ; i++) { def = &pr_globaldefs[i]; @@ -222,7 +222,7 @@ ddef_t *ED_FieldAtOfs (int ofs) { ddef_t *def; int i; - + for (i=0 ; inumfielddefs ; i++) { def = &pr_fielddefs[i]; @@ -241,7 +241,7 @@ ddef_t *ED_FindField (char *name) { ddef_t *def; int i; - + for (i=0 ; inumfielddefs ; i++) { def = &pr_fielddefs[i]; @@ -261,7 +261,7 @@ ddef_t *ED_FindGlobal (char *name) { ddef_t *def; int i; - + for (i=0 ; inumglobaldefs ; i++) { def = &pr_globaldefs[i]; @@ -281,7 +281,7 @@ dfunction_t *ED_FindFunction (char *name) { dfunction_t *func; int i; - + for (i=0 ; inumfunctions ; i++) { func = &pr_functions[i]; @@ -334,7 +334,7 @@ char *PR_ValueString (etype_t type, eval_t *val) static char line[256]; ddef_t *def; dfunction_t *f; - + type &= ~DEF_SAVEGLOBAL; switch (type) @@ -342,7 +342,7 @@ char *PR_ValueString (etype_t type, eval_t *val) case ev_string: snprintf(line, sizeof(line), "%s", PR_GetString(val->string)); break; - case ev_entity: + case ev_entity: snprintf(line, sizeof(line), "entity %i", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)) ); break; case ev_function: @@ -369,7 +369,7 @@ char *PR_ValueString (etype_t type, eval_t *val) snprintf(line, sizeof(line), "bad type %i", type); break; } - + return line; } @@ -386,7 +386,7 @@ char *PR_UglyValueString (etype_t type, eval_t *val) static char line[256]; ddef_t *def; dfunction_t *f; - + type &= ~DEF_SAVEGLOBAL; switch (type) @@ -394,7 +394,7 @@ char *PR_UglyValueString (etype_t type, eval_t *val) case ev_string: snprintf(line, sizeof(line), "%s", PR_GetString(val->string)); break; - case ev_entity: + case ev_entity: snprintf(line, sizeof(line), "%i", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict))); break; case ev_function: @@ -418,7 +418,7 @@ char *PR_UglyValueString (etype_t type, eval_t *val) snprintf(line, sizeof(line), "bad type %i", type); break; } - + return line; } @@ -437,7 +437,7 @@ char *PR_GlobalString (int ofs) ddef_t *def; void *val; static char line[128]; - + val = (void *)&pr_globals[ofs]; def = ED_GlobalAtOfs(ofs); if (!def) @@ -447,12 +447,12 @@ char *PR_GlobalString (int ofs) s = PR_ValueString (def->type, val); snprintf(line, sizeof(line),"%i(%s)%s", ofs, PR_GetString(def->s_name), s); } - + i = strlen(line); for ( ; i<20 ; i++) strcat (line," "); strcat (line," "); - + return line; } @@ -461,18 +461,18 @@ char *PR_GlobalStringNoContents (int ofs) int i; ddef_t *def; static char line[128]; - + def = ED_GlobalAtOfs(ofs); if (!def) snprintf(line, sizeof(line),"%i(???)", ofs); else snprintf(line, sizeof(line),"%i(%s)", ofs, PR_GetString(def->s_name)); - + i = strlen(line); for ( ; i<20 ; i++) strcat (line," "); strcat (line," "); - + return line; } @@ -498,31 +498,31 @@ void ED_Print (edict_t *ed) Con_Printf ("FREE\n"); return; } - + for (i=1 ; inumfielddefs ; i++) { d = &pr_fielddefs[i]; name = PR_GetString(d->s_name); if (name[strlen(name)-2] == '_') continue; // skip _x, _y, _z vars - + v = (int *)((char *)&ed->v + d->ofs*4); // if the value is still all 0, skip the field type = d->type & ~DEF_SAVEGLOBAL; - + for (j=0 ; jtype, (eval_t *)v)); + Con_Printf ("%s\n", PR_ValueString(d->type, (eval_t *)v)); } } @@ -548,14 +548,14 @@ void ED_Write (QFile *f, edict_t *ed) Qprintf (f, "}\n"); return; } - + for (i=1 ; inumfielddefs ; i++) { d = &pr_fielddefs[i]; name = PR_GetString(d->s_name); if (name[strlen(name)-2] == '_') continue; // skip _x, _y, _z vars - + v = (int *)((char *)&ed->v + d->ofs*4); // if the value is still all 0, skip the field @@ -565,9 +565,9 @@ void ED_Write (QFile *f, edict_t *ed) break; if (j == type_size[type]) continue; - + Qprintf (f,"\"%s\" ",name); - Qprintf (f,"\"%s\"\n", PR_UglyValueString(d->type, (eval_t *)v)); + Qprintf (f,"\"%s\"\n", PR_UglyValueString(d->type, (eval_t *)v)); } Qprintf (f, "}\n"); @@ -588,7 +588,7 @@ For debugging, prints all the entities in the current server void ED_PrintEdicts (void) { int i; - + Con_Printf ("%i entities\n", sv.num_edicts); for (i=0 ; is_name); Qprintf (f,"\"%s\" ", name); - Qprintf (f,"\"%s\"\n", PR_UglyValueString(type, (eval_t *)&pr_globals[def->ofs])); + Qprintf (f,"\"%s\"\n", PR_UglyValueString(type, (eval_t *)&pr_globals[def->ofs])); } Qprintf (f,"}\n"); } @@ -710,7 +710,7 @@ void ED_ParseGlobals (char *data) ddef_t *key; while (1) - { + { // parse key data = COM_Parse (data); if (com_token[0] == '}') @@ -724,7 +724,7 @@ void ED_ParseGlobals (char *data) strcpy (keyname, com_token); - // parse value + // parse value data = COM_Parse (data); if (!data) #ifdef QUAKEWORLD @@ -768,7 +768,7 @@ char *ED_NewString (char *string) { char *new, *new_p; int i,l; - + l = strlen(string) + 1; new = Hunk_Alloc (l); new_p = new; @@ -786,7 +786,7 @@ char *ED_NewString (char *string) else *new_p++ = string[i]; } - + return new; } @@ -807,19 +807,19 @@ qboolean ED_ParseEpair (void *base, ddef_t *key, char *s) char *v, *w; void *d; dfunction_t *func; - + d = (void *)((int *)base + key->ofs); - + switch (key->type & ~DEF_SAVEGLOBAL) { case ev_string: *(string_t *)d = PR_SetString(ED_NewString (s)); break; - + case ev_float: *(float *)d = atof (s); break; - + case ev_vector: strcpy (string, s); v = string; @@ -833,11 +833,11 @@ qboolean ED_ParseEpair (void *base, ddef_t *key, char *s) w = v = v+1; } break; - + case ev_entity: *(int *)d = EDICT_TO_PROG(EDICT_NUM(atoi (s))); break; - + case ev_field: def = ED_FindField (s); if (!def) @@ -847,7 +847,7 @@ qboolean ED_ParseEpair (void *base, ddef_t *key, char *s) } *(int *)d = G_INT(def->ofs); break; - + case ev_function: func = ED_FindFunction (s); if (!func) @@ -857,7 +857,7 @@ qboolean ED_ParseEpair (void *base, ddef_t *key, char *s) } *(func_t *)d = func - pr_functions; break; - + default: break; } @@ -891,7 +891,7 @@ char *ED_ParseEdict (char *data, edict_t *ent) // go through all the dictionary pairs while (1) - { + { // parse key data = COM_Parse (data); if (com_token[0] == '}') @@ -902,7 +902,7 @@ char *ED_ParseEdict (char *data, edict_t *ent) #else Sys_Error ("ED_ParseEntity: EOF without closing brace"); #endif - + // anglehack is to allow QuakeEd to write single scalar angles // and allow them to be turned into vectors. (FIXME...) if (!strcmp(com_token, "angle")) @@ -928,8 +928,8 @@ if (!strcmp(com_token, "light")) n--; } #endif - - // parse value + + // parse value data = COM_Parse (data); if (!data) #ifdef QUAKEWORLD @@ -945,13 +945,13 @@ if (!strcmp(com_token, "light")) Sys_Error ("ED_ParseEntity: closing brace without data"); #endif - init = true; + init = true; // keynames with a leading underscore are used for utility comments, // and are immediately discarded by quake if (keyname[0] == '_') continue; - + key = ED_FindField (keyname); if (!key) { @@ -997,19 +997,19 @@ to call ED_CallSpawnFunctions () to let the objects initialize themselves. ================ */ void ED_LoadFromFile (char *data) -{ +{ edict_t *ent; int inhibit; dfunction_t *func; - + ent = NULL; inhibit = 0; pr_global_struct->time = sv.time; - + // parse ents while (1) { -// parse the opening brace +// parse the opening brace data = COM_Parse (data); if (!data) break; @@ -1025,7 +1025,7 @@ void ED_LoadFromFile (char *data) else ent = ED_Alloc (); data = ED_ParseEdict (data, ent); - + // remove things from different skill levels or deathmatch #ifndef QUAKEWORLD if (deathmatch->value) @@ -1033,7 +1033,7 @@ void ED_LoadFromFile (char *data) #endif if (((int)ent->v.spawnflags & SPAWNFLAG_NOT_DEATHMATCH)) { - ED_Free (ent); + ED_Free (ent); inhibit++; continue; } @@ -1043,7 +1043,7 @@ void ED_LoadFromFile (char *data) || (current_skill == 1 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_MEDIUM)) || (current_skill >= 2 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_HARD)) ) { - ED_Free (ent); + ED_Free (ent); inhibit++; continue; } @@ -1059,7 +1059,7 @@ void ED_LoadFromFile (char *data) ED_Free (ent); continue; } - + // look for the spawn function func = ED_FindFunction ( PR_GetString(ent->v.classname) ); @@ -1076,7 +1076,7 @@ void ED_LoadFromFile (char *data) #ifdef QUAKEWORLD SV_FlushSignon(); #endif - } + } Con_DPrintf ("%i entities inhibited\n", inhibit); } @@ -1129,7 +1129,7 @@ void PR_LoadProgs (void) // byte swap the header for (i=0 ; iversion != PROG_VERSION) #ifdef QUAKEWORLD @@ -1156,9 +1156,9 @@ void PR_LoadProgs (void) pr_global_struct = (globalvars_t *)((byte *)progs + progs->ofs_globals); pr_globals = (float *)pr_global_struct; - + pr_edict_size = progs->entityfields * 4 + sizeof (edict_t) - sizeof(entvars_t); - + // byte swap the lumps for (i=0 ; inumstatements ; i++) { @@ -1176,7 +1176,7 @@ void PR_LoadProgs (void) pr_functions[i].s_file = LittleLong (pr_functions[i].s_file); pr_functions[i].numparms = LittleLong (pr_functions[i].numparms); pr_functions[i].locals = LittleLong (pr_functions[i].locals); - } + } for (i=0 ; inumglobaldefs ; i++) { @@ -1272,10 +1272,10 @@ edict_t *EDICT_NUM(int n) int NUM_FOR_EDICT(edict_t *e) { int b; - + b = (byte *)e - (byte *)sv.edicts; b = b / pr_edict_size; - + if (b < 0 || b >= sv.num_edicts) #ifdef QUAKEWORLD SV_Error ("NUM_FOR_EDICT: bad pointer"); diff --git a/common/pr_exec.c b/common/pr_exec.c index 95ff543..00b5686 100644 --- a/common/pr_exec.c +++ b/common/pr_exec.c @@ -10,7 +10,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. @@ -61,43 +61,43 @@ char *pr_opnames[] = "DONE", "MUL_F", -"MUL_V", +"MUL_V", "MUL_FV", "MUL_VF", - + "DIV", "ADD_F", -"ADD_V", - +"ADD_V", + "SUB_F", "SUB_V", "EQ_F", "EQ_V", -"EQ_S", +"EQ_S", "EQ_E", "EQ_FNC", - + "NE_F", -"NE_V", +"NE_V", "NE_S", -"NE_E", +"NE_E", "NE_FNC", - + "LE", "GE", "LT", -"GT", +"GT", "INDIRECT", "INDIRECT", -"INDIRECT", -"INDIRECT", "INDIRECT", -"INDIRECT", +"INDIRECT", +"INDIRECT", +"INDIRECT", -"ADDRESS", +"ADDRESS", "STORE_F", "STORE_V", @@ -114,16 +114,16 @@ char *pr_opnames[] = "STOREP_FNC", "RETURN", - + "NOT_F", "NOT_V", -"NOT_S", -"NOT_ENT", -"NOT_FNC", - +"NOT_S", +"NOT_ENT", +"NOT_FNC", + "IF", "IFNOT", - + "CALL0", "CALL1", "CALL2", @@ -133,13 +133,13 @@ char *pr_opnames[] = "CALL6", "CALL7", "CALL8", - + "STATE", - -"GOTO", - + +"GOTO", + "AND", -"OR", +"OR", "BITAND", "BITOR" @@ -159,7 +159,7 @@ PR_PrintStatement void PR_PrintStatement (dstatement_t *s) { int i; - + if ( (unsigned)s->op < sizeof(pr_opnames)/sizeof(pr_opnames[0])) { Con_Printf ("%s ", pr_opnames[s->op]); @@ -167,7 +167,7 @@ void PR_PrintStatement (dstatement_t *s) for ( ; i<10 ; i++) Con_Printf (" "); } - + if (s->op == OP_IF || s->op == OP_IFNOT) Con_Printf ("%sbranch %i",PR_GlobalString(s->a),s->b); else if (s->op == OP_GOTO) @@ -200,24 +200,24 @@ void PR_StackTrace (void) { dfunction_t *f; int i; - + if (pr_depth == 0) { Con_Printf ("\n"); return; } - + pr_stack[pr_depth].f = pr_xfunction; for (i=pr_depth ; i>=0 ; i--) { f = pr_stack[i].f; - + if (!f) { Con_Printf ("\n"); } else - Con_Printf ("%12s : %s\n", PR_GetString(f->s_file), PR_GetString(f->s_name)); + Con_Printf ("%12s : %s\n", PR_GetString(f->s_file), PR_GetString(f->s_name)); } } @@ -234,8 +234,8 @@ void PR_Profile_f (void) int max; int num; int i; - - num = 0; + + num = 0; do { max = 0; @@ -279,7 +279,7 @@ void PR_RunError (char *error, ...) PR_PrintStatement (pr_statements + pr_xstatement); PR_StackTrace (); Con_Printf ("%s\n", string); - + pr_depth = 0; // dump the stack so {SV|Host}_Error can shutdown functions #ifdef QUAKEWORLD @@ -309,7 +309,7 @@ int PR_EnterFunction (dfunction_t *f) int i, j, c, o; pr_stack[pr_depth].s = pr_xstatement; - pr_stack[pr_depth].f = pr_xfunction; + pr_stack[pr_depth].f = pr_xfunction; pr_depth++; if (pr_depth >= MAX_STACK_DEPTH) PR_RunError ("stack overflow"); @@ -397,7 +397,7 @@ void PR_ExecuteProgram (func_t fnum) Host_Error ("PR_ExecuteProgram: NULL function"); #endif } - + f = &pr_functions[fnum]; runaway = 100000; @@ -407,7 +407,7 @@ void PR_ExecuteProgram (func_t fnum) exitdepth = pr_depth; s = PR_EnterFunction (f); - + while (1) { s++; // next statement @@ -416,16 +416,16 @@ while (1) a = (eval_t *)&pr_globals[st->a]; b = (eval_t *)&pr_globals[st->b]; c = (eval_t *)&pr_globals[st->c]; - + if (--runaway == 0) PR_RunError ("runaway loop error"); - + pr_xfunction->profile++; pr_xstatement = s; - + if (pr_trace) PR_PrintStatement (st); - + switch (st->op) { case OP_ADD_F: @@ -436,7 +436,7 @@ while (1) c->vector[1] = a->vector[1] + b->vector[1]; c->vector[2] = a->vector[2] + b->vector[2]; break; - + case OP_SUB_F: c->_float = a->_float - b->_float; break; @@ -468,16 +468,16 @@ while (1) case OP_DIV_F: c->_float = a->_float / b->_float; break; - + case OP_BITAND: c->_float = (int)a->_float & (int)b->_float; break; - + case OP_BITOR: c->_float = (int)a->_float | (int)b->_float; break; - - + + case OP_GE: c->_float = a->_float >= b->_float; break; @@ -496,7 +496,7 @@ while (1) case OP_OR: c->_float = a->_float || b->_float; break; - + case OP_NOT_F: c->_float = !a->_float; break; @@ -563,7 +563,7 @@ while (1) b->vector[1] = a->vector[1]; b->vector[2] = a->vector[2]; break; - + case OP_STOREP_F: case OP_STOREP_ENT: case OP_STOREP_FLD: // integers @@ -578,7 +578,7 @@ while (1) ptr->vector[1] = a->vector[1]; ptr->vector[2] = a->vector[2]; break; - + case OP_ADDRESS: ed = PROG_TO_EDICT(a->edict); #ifdef PARANOID @@ -588,7 +588,7 @@ while (1) PR_RunError ("assignment to world entity"); c->_int = (byte *)((int *)&ed->v + b->_int) - (byte *)sv.edicts; break; - + case OP_LOAD_F: case OP_LOAD_FLD: case OP_LOAD_ENT: @@ -612,23 +612,23 @@ while (1) c->vector[1] = a->vector[1]; c->vector[2] = a->vector[2]; break; - + //================== case OP_IFNOT: if (!a->_int) s += st->b - 1; // offset the s++ break; - + case OP_IF: if (a->_int) s += st->b - 1; // offset the s++ break; - + case OP_GOTO: s += st->a - 1; // offset the s++ break; - + case OP_CALL0: case OP_CALL1: case OP_CALL2: @@ -661,12 +661,12 @@ while (1) pr_globals[OFS_RETURN] = pr_globals[st->a]; pr_globals[OFS_RETURN+1] = pr_globals[st->a+1]; pr_globals[OFS_RETURN+2] = pr_globals[st->a+2]; - + s = PR_LeaveFunction (); if (pr_depth == exitdepth) return; // all done break; - + case OP_STATE: ed = PROG_TO_EDICT(pr_global_struct->self); #ifdef QUAKEWORLD @@ -685,7 +685,7 @@ while (1) } ed->v.think = b->function; break; - + default: PR_RunError ("Bad opcode %i", st->op); } @@ -704,7 +704,7 @@ int num_prstr; char *PR_GetString(int num) { - + #ifdef QUAKEWORLD if (num < 0) { //Con_DPrintf("GET:%d == %s\n", num, pr_strtbl[-num]); diff --git a/common/progs.h b/common/progs.h index 4aacb01..7886fe0 100644 --- a/common/progs.h +++ b/common/progs.h @@ -10,7 +10,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. @@ -38,19 +38,19 @@ typedef union eval_s func_t function; int _int; int edict; -} eval_t; +} eval_t; #define MAX_ENT_LEAFS 16 typedef struct edict_s { qboolean free; link_t area; // linked to a division node or leaf - + int num_leafs; short leafnums[MAX_ENT_LEAFS]; entity_state_t baseline; - + float freetime; // sv.time when the object was freed entvars_t v; // C exported fields from progs // other fields from progs come immediately after diff --git a/common/protocol.h b/common/protocol.h index 21e6673..bd2fda8 100644 --- a/common/protocol.h +++ b/common/protocol.h @@ -9,7 +9,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. diff --git a/common/qargs.c b/common/qargs.c index 1f80b59..cc954c7 100644 --- a/common/qargs.c +++ b/common/qargs.c @@ -12,7 +12,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. @@ -66,7 +66,7 @@ where the given parameter apears, or 0 if not present int COM_CheckParm (char *parm) { int i; - + for (i=1 ; inext) { @@ -196,9 +196,9 @@ void COM_WriteFile (char *filename, void *data, int len) { QFile *f; char name[MAX_OSPATH]; - + snprintf(name, sizeof(name), "%s/%s", com_gamedir, filename); - + f = Qopen (name, "wb"); if (!f) { Sys_mkdir(com_gamedir); @@ -206,7 +206,7 @@ void COM_WriteFile (char *filename, void *data, int len) if (!f) Sys_Error ("Error opening %s", filename); } - + Sys_Printf ("COM_WriteFile: %s\n", name); Qwrite (f, data, len); Qclose (f); @@ -223,7 +223,7 @@ Only used for CopyFile and download void COM_CreatePath (char *path) { char *ofs; - + for (ofs = path+1 ; *ofs ; ofs++) { if (*ofs == '/') @@ -249,13 +249,13 @@ void COM_CopyFile (char *netpath, char *cachepath) QFile *in, *out; int remaining, count; char buf[4096]; - - remaining = COM_FileOpenRead (netpath, &in); + + remaining = COM_FileOpenRead (netpath, &in); COM_CreatePath (cachepath); // create directories up to the cache file out = Qopen(cachepath, "wb"); if (!out) Sys_Error ("Error opening %s", cachepath); - + while (remaining) { if (remaining < sizeof(buf)) @@ -327,7 +327,7 @@ int COM_FOpenFile (char *filename, QFile **gzfile) #endif file_from_pak = 0; - + // // search through the path, one element at a time // @@ -359,11 +359,11 @@ int COM_FOpenFile (char *filename, QFile **gzfile) } } else - { + { // check a file in the directory tree snprintf(netpath, sizeof(netpath), "%s/%s",search->filename, filename); - + findtime = Sys_FileTime (netpath); if (findtime == -1) { #ifdef HAS_ZLIB @@ -374,7 +374,7 @@ int COM_FOpenFile (char *filename, QFile **gzfile) #endif continue; } - + if(developer->value) Sys_Printf ("FindFile: %s\n",netpath); @@ -383,11 +383,11 @@ int COM_FOpenFile (char *filename, QFile **gzfile) *gzfile=COM_OpenRead(netpath,-1,-1); return com_filesize; } - + } - + Sys_Printf ("FindFile: can't find %s\n", filename); - + *gzfile = NULL; com_filesize = -1; return -1; @@ -417,10 +417,10 @@ byte *COM_LoadFile (char *path, int usehunk) len = com_filesize = COM_FOpenFile (path, &h); if (!h) return NULL; - + // extract the filename base name for hunk tag COM_FileBase (path, base); - + if (usehunk == 1) buf = Hunk_AllocName (len+1, base); else if (usehunk == 2) @@ -441,7 +441,7 @@ byte *COM_LoadFile (char *path, int usehunk) if (!buf) Sys_Error ("COM_LoadFile: not enough space for %s", path); - + ((byte *)buf)[len] = 0; #ifndef SERVERONLY Draw_BeginDisc (); @@ -475,11 +475,11 @@ void COM_LoadCacheFile (char *path, struct cache_user_s *cu) byte *COM_LoadStackFile (char *path, void *buffer, int bufsize) { byte *buf; - + loadbuf = (byte *)buffer; loadsize = bufsize; buf = COM_LoadFile (path, 4); - + return buf; } @@ -537,7 +537,7 @@ pack_t *COM_LoadPackFile (char *packfile) pack->handle = packhandle; pack->numfiles = numpackfiles; pack->files = newfiles; - + Con_Printf ("Added packfile %s (%i files)\n", packfile, numpackfiles); return pack; } @@ -547,7 +547,7 @@ int COM_pakzip_checkfile(unzFile *pak, const char *path) { int status; - + status = unzLocateFile(pak, path, 2); return (status == UNZ_OK); } @@ -587,7 +587,7 @@ uint_t COM_pakzip_getlen(unzFile *pak) { unz_file_info info; - + if (unzGetCurrentFileInfo(pak, &info, NULL, 0, NULL, 0, NULL, 0) != UNZ_OK) return 0; @@ -598,10 +598,10 @@ uint_t COM_pakzip_readfile(unzFile *pak, const char *path, uint_t bufsize, byte_t *buf) { uint_t len; - + if (!COM_pakzip_open(pak,path)) return 0; - + if ((len = COM_pakzip_getlen(pak)) != 0) { if (COM_pakzip_read(pak, (void*)buf, 1, len) != len) @@ -662,7 +662,7 @@ pack_t *COM_LoadPackZipFile (char *packfile) //pack_old->handle = unzGetLocalExtrafield(packfile, NULL, NULL); pack_old->numfiles = numpackfiles; pack_old->files = newfiles; - + Con_Printf ("Added packfile %s (%.0f files)\n", packfile, numpackfiles); COM_pakzip_close(pak); @@ -688,12 +688,12 @@ COM_LoadGameDirectory(char *dir) pack_t *pak; char pakfile[MAX_OSPATH]; qboolean done = false; - + for ( i=0 ; !done ; i++ ) { // Load all Pak1 files snprintf(pakfile, sizeof(pakfile), "%s/pak%i.pak", dir, i); - pak = COM_LoadPackFile(pakfile); - + pak = COM_LoadPackFile(pakfile); + if( !pak ) { done = true; } else { @@ -707,9 +707,9 @@ COM_LoadGameDirectory(char *dir) #ifdef GENERATIONS for (done=false, i=0 ; !done ; i++ ) { // Load all Pak3 files. snprintf(pakfile, sizeof(pakfile), "%s/pak%i.qz", dir, i); - + pak = COM_LoadPackZipFile(pakfile); - + if(!pak) { done = true; } else { @@ -732,7 +732,7 @@ COM_LoadGameDirectory(char *dir) char pakfile[MAX_OSPATH]; DIR *dir_ptr; struct dirent *dirent; - + dir_ptr = opendir(dir); if (!dir_ptr) return; @@ -741,7 +741,7 @@ COM_LoadGameDirectory(char *dir) if (!fnmatch("*.pak", dirent->d_name, 0)) { snprintf(pakfile, sizeof(pakfile), "%s/%s", dir, dirent->d_name); - pak = COM_LoadPackFile(pakfile); + pak = COM_LoadPackFile(pakfile); if (!pak) { Sys_Error(va("Bad pakfile %s!!", pakfile)); @@ -756,11 +756,11 @@ COM_LoadGameDirectory(char *dir) closedir(dir_ptr); #ifdef GENERATIONS - for (done=false, i=0 ; !done ; i++ ) { + for (done=false, i=0 ; !done ; i++ ) { snprintf(pakfile, sizeof(pakfile), "%s/pak%i.qz", dir, i); - + pak = COM_LoadPackZipFile(pakfile); - + if(!pak) { done = true; } else { @@ -780,7 +780,7 @@ COM_LoadGameDirectory(char *dir) COM_AddGameDirectory Sets com_gamedir, adds the directory to the head of the path, -then loads and adds pak1.pak pak2.pak ... +then loads and adds pak1.pak pak2.pak ... ================ */ void COM_AddGameDirectory (char *dir) diff --git a/common/quakefs.h b/common/quakefs.h index c3bf457..ac8f738 100644 --- a/common/quakefs.h +++ b/common/quakefs.h @@ -11,7 +11,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. diff --git a/common/r_aclip.c b/common/r_aclip.c index 4a858fa..46856fd 100644 --- a/common/r_aclip.c +++ b/common/r_aclip.c @@ -10,7 +10,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. @@ -58,11 +58,11 @@ void R_Alias_clip_z (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out) { scale = (ALIAS_Z_CLIP_PLANE - pav0->fv[2]) / (pav1->fv[2] - pav0->fv[2]); - + avout.fv[0] = pav0->fv[0] + (pav1->fv[0] - pav0->fv[0]) * scale; avout.fv[1] = pav0->fv[1] + (pav1->fv[1] - pav0->fv[1]) * scale; avout.fv[2] = ALIAS_Z_CLIP_PLANE; - + out->v[2] = pfv0->v[2] + (pfv1->v[2] - pfv0->v[2]) * scale; out->v[3] = pfv0->v[3] + (pfv1->v[3] - pfv0->v[3]) * scale; out->v[4] = pfv0->v[4] + (pfv1->v[4] - pfv0->v[4]) * scale; @@ -71,11 +71,11 @@ void R_Alias_clip_z (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out) { scale = (ALIAS_Z_CLIP_PLANE - pav1->fv[2]) / (pav0->fv[2] - pav1->fv[2]); - + avout.fv[0] = pav1->fv[0] + (pav0->fv[0] - pav1->fv[0]) * scale; avout.fv[1] = pav1->fv[1] + (pav0->fv[1] - pav1->fv[1]) * scale; avout.fv[2] = ALIAS_Z_CLIP_PLANE; - + out->v[2] = pfv1->v[2] + (pfv0->v[2] - pfv1->v[2]) * scale; out->v[3] = pfv1->v[3] + (pfv0->v[3] - pfv1->v[3]) * scale; out->v[4] = pfv1->v[4] + (pfv0->v[4] - pfv1->v[4]) * scale; @@ -90,7 +90,7 @@ void R_Alias_clip_z (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out) if (out->v[0] > r_refdef.aliasvrectright) out->flags |= ALIAS_RIGHT_CLIP; if (out->v[1] > r_refdef.aliasvrectbottom) - out->flags |= ALIAS_BOTTOM_CLIP; + out->flags |= ALIAS_BOTTOM_CLIP; } @@ -195,7 +195,7 @@ int R_AliasClip (finalvert_t *in, finalvert_t *out, int flag, int count, { int i,j,k; int flags, oldflags; - + j = count-1; k = 0; for (i=0 ; i r_refdef.aliasvrectright) out[k].flags |= ALIAS_RIGHT_CLIP; if (out[k].v[1] > r_refdef.aliasvrectbottom) - out[k].flags |= ALIAS_BOTTOM_CLIP; + out[k].flags |= ALIAS_BOTTOM_CLIP; k++; } if (!flags) @@ -225,7 +225,7 @@ int R_AliasClip (finalvert_t *in, finalvert_t *out, int flag, int count, k++; } } - + return k; } @@ -253,7 +253,7 @@ void R_AliasClipTriangle (mtriangle_t *ptri) for (i=0 ; i<3 ; i++) { fv[0][i] = pfinalverts[ptri->vertindex[i]]; - + if (!ptri->facesfront && (fv[0][i].flags & ALIAS_ONSEAM) ) fv[0][i].v[2] += r_affinetridesc.seamfixupX16; } diff --git a/common/r_alias.c b/common/r_alias.c index ff9db33..336e9c3 100644 --- a/common/r_alias.c +++ b/common/r_alias.c @@ -11,7 +11,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. @@ -101,7 +101,7 @@ qboolean R_AliasCheckBBox (void) qboolean zclipped, zfullyclipped; unsigned anyclip, allclip; int minz; - + // expand, rotate, and translate points into worldspace currententity->trivial_accept = 0; @@ -164,7 +164,7 @@ qboolean R_AliasCheckBBox (void) } } - + if (zfullyclipped) { return false; // everything was near-z-clipped @@ -299,7 +299,7 @@ void R_AliasPreparePoints (void) if (fv->v[0] > r_refdef.aliasvrectright) fv->flags |= ALIAS_RIGHT_CLIP; if (fv->v[1] > r_refdef.aliasvrectbottom) - fv->flags |= ALIAS_BOTTOM_CLIP; + fv->flags |= ALIAS_BOTTOM_CLIP; } } @@ -317,7 +317,7 @@ void R_AliasPreparePoints (void) if ( pfv[0]->flags & pfv[1]->flags & pfv[2]->flags & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP) ) continue; // completely clipped - + if ( ! ( (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP) ) ) { // totally unclipped @@ -325,7 +325,7 @@ void R_AliasPreparePoints (void) r_affinetridesc.ptriangles = ptri; D_PolysetDraw (); } - else + else { // partially clipped R_AliasClipTriangle (ptri); } @@ -589,20 +589,20 @@ void R_AliasSetupSkin (void) ((byte *)paliashdr + paliasskingroup->intervals); numskins = paliasskingroup->numskins; fullskininterval = pskinintervals[numskins-1]; - + skintime = cl.time + currententity->syncbase; - + // when loading in Mod_LoadAliasSkinGroup, we guaranteed all interval // values are positive, so we don't have to worry about division by 0 skintargettime = skintime - ((int)(skintime / fullskininterval)) * fullskininterval; - + for (i=0 ; i<(numskins-1) ; i++) { if (pskinintervals[i] > skintargettime) break; } - + pskindesc = &paliasskingroup->skindescs[i]; } @@ -611,7 +611,7 @@ void R_AliasSetupSkin (void) r_affinetridesc.skinwidth = a_skinwidth; r_affinetridesc.seamfixupX16 = (a_skinwidth >> 1) << 16; r_affinetridesc.skinheight = pmdl->skinheight; - + #ifdef QUAKEWORLD if (currententity->scoreboard) { @@ -690,7 +690,7 @@ void R_AliasSetupFrame (void) ((byte *)paliashdr + paliashdr->frames[frame].frame); return; } - + paliasgroup = (maliasgroup_t *) ((byte *)paliashdr + paliashdr->frames[frame].frame); pintervals = (float *)((byte *)paliashdr + paliasgroup->intervals); diff --git a/common/r_bsp.c b/common/r_bsp.c index d231b5c..428bdbf 100644 --- a/common/r_bsp.c +++ b/common/r_bsp.c @@ -10,7 +10,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. @@ -91,7 +91,7 @@ void R_RotateBmodel (void) // TODO: share work with R_SetUpAliasTransform // yaw - angle = currententity->angles[YAW]; + angle = currententity->angles[YAW]; angle = angle * M_PI*2 / 360; s = sin(angle); c = cos(angle); @@ -108,7 +108,7 @@ void R_RotateBmodel (void) // pitch - angle = currententity->angles[PITCH]; + angle = currententity->angles[PITCH]; angle = angle * M_PI*2 / 360; s = sin(angle); c = cos(angle); @@ -126,7 +126,7 @@ void R_RotateBmodel (void) R_ConcatRotations (temp2, temp1, temp3); // roll - angle = currententity->angles[ROLL]; + angle = currententity->angles[ROLL]; angle = angle * M_PI*2 / 360; s = sin(angle); c = cos(angle); @@ -484,7 +484,7 @@ void R_RecursiveWorldNode (mnode_t *node, int clipflags) rejectpt[0] = (float)node->minmaxs[pindex[0]]; rejectpt[1] = (float)node->minmaxs[pindex[1]]; rejectpt[2] = (float)node->minmaxs[pindex[2]]; - + d = DotProduct (rejectpt, view_clipplanes[i].normal); d -= view_clipplanes[i].dist; @@ -502,7 +502,7 @@ void R_RecursiveWorldNode (mnode_t *node, int clipflags) clipflags &= ~(1<contents < 0) { @@ -551,7 +551,7 @@ void R_RecursiveWorldNode (mnode_t *node, int clipflags) dot = DotProduct (modelorg, plane->normal) - plane->dist; break; } - + if (dot >= 0) side = 0; else diff --git a/common/r_draw.c b/common/r_draw.c index a63b50a..5d0360a 100644 --- a/common/r_draw.c +++ b/common/r_draw.c @@ -10,7 +10,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. @@ -100,16 +100,16 @@ void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1) else { world = &pv0->position[0]; - + // transform and project VectorSubtract (world, modelorg, local); TransformVector (local, transformed); - + if (transformed[2] < NEAR_CLIP) transformed[2] = NEAR_CLIP; - + lzi0 = 1.0 / transformed[2]; - + // FIXME: build x/yscale into transform? scale = xscale * lzi0; u0 = (xcenter + scale*transformed[0]); @@ -117,14 +117,14 @@ void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1) u0 = r_refdef.fvrectx_adj; if (u0 > r_refdef.fvrectright_adj) u0 = r_refdef.fvrectright_adj; - + scale = yscale * lzi0; v0 = (ycenter - scale*transformed[1]); if (v0 < r_refdef.fvrecty_adj) v0 = r_refdef.fvrecty_adj; if (v0 > r_refdef.fvrectbottom_adj) v0 = r_refdef.fvrectbottom_adj; - + ceilv0 = (int) ceil(v0); } diff --git a/common/r_edge.c b/common/r_edge.c index a717bef..71c3015 100644 --- a/common/r_edge.c +++ b/common/r_edge.c @@ -10,7 +10,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. @@ -210,7 +210,7 @@ addedge: } #endif // !id386 - + #if !id386 @@ -250,29 +250,29 @@ nextedge: if (pedge->u < pedge->prev->u) goto pushback; pedge = pedge->next; - + pedge->u += pedge->u_step; if (pedge->u < pedge->prev->u) goto pushback; pedge = pedge->next; - + pedge->u += pedge->u_step; if (pedge->u < pedge->prev->u) goto pushback; pedge = pedge->next; - + pedge->u += pedge->u_step; if (pedge->u < pedge->prev->u) goto pushback; pedge = pedge->next; - - goto nextedge; - + + goto nextedge; + pushback: if (pedge == &edge_aftertail) return; - - // push it back to keep it sorted + + // push it back to keep it sorted pnext_edge = pedge->next; // pull the edge out of the edge list @@ -405,7 +405,7 @@ newtop: // set last_u on the new span surf->last_u = iu; - + gotposition: // insert before surf2 surf->next = surf2; @@ -576,7 +576,7 @@ newtop: // set last_u on the new span surf->last_u = iu; - + gotposition: // insert before surf2 surf->next = surf2; @@ -606,7 +606,7 @@ void R_GenerateSpans (void) // generate spans for (edge=edge_head.next ; edge != &edge_tail; edge=edge->next) - { + { if (edge->surfs[0]) { // it has a left surface, so a surface is going away for this span @@ -644,7 +644,7 @@ void R_GenerateSpansBackward (void) // generate spans for (edge=edge_head.next ; edge != &edge_tail; edge=edge->next) - { + { if (edge->surfs[0]) R_TrailingEdge (&surfaces[edge->surfs[0]], edge); @@ -660,7 +660,7 @@ void R_GenerateSpansBackward (void) ============== R_ScanEdges -Input: +Input: newedges[] array this has links to edges, which have links to surfaces @@ -690,7 +690,7 @@ void R_ScanEdges (void) edge_head.next = &edge_tail; edge_head.surfs[0] = 0; edge_head.surfs[1] = 1; - + edge_tail.u = (r_refdef.vrectright << 20) + 0xFFFFF; edge_tail_u_shift20 = edge_tail.u >> 20; edge_tail.u_step = 0; @@ -698,7 +698,7 @@ void R_ScanEdges (void) edge_tail.next = &edge_aftertail; edge_tail.surfs[0] = 1; edge_tail.surfs[1] = 0; - + edge_aftertail.u = -1; // force a move edge_aftertail.u_step = 0; edge_aftertail.next = &edge_sentinel; @@ -708,7 +708,7 @@ void R_ScanEdges (void) edge_sentinel.u = 2000 << 24; // make sure nothing sorts past this edge_sentinel.prev = &edge_aftertail; -// +// // process all scan lines // bottom = r_refdef.vrectbottom - 1; @@ -735,7 +735,7 @@ void R_ScanEdges (void) VID_UnlockBuffer (); S_ExtraUpdate (); // don't let sound get messed up if going slow VID_LockBuffer (); - + if (r_drawculledpolys) R_DrawCulledPolys (); else diff --git a/common/r_efrag.c b/common/r_efrag.c index e5e4288..80c1ef2 100644 --- a/common/r_efrag.c +++ b/common/r_efrag.c @@ -10,7 +10,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. @@ -57,9 +57,9 @@ Call when removing an object from the world or moving it to another position void R_RemoveEfrags (entity_t *ent) { efrag_t *ef, *old, *walk, **prev; - + ef = ent->efrag; - + while (ef) { prev = &ef->leaf->efrags; @@ -76,16 +76,16 @@ void R_RemoveEfrags (entity_t *ent) else prev = &walk->leafnext; } - + old = ef; ef = ef->entnext; - + // put it on the free list old->entnext = cl.free_efrags; cl.free_efrags = old; } - - ent->efrag = NULL; + + ent->efrag = NULL; } /* @@ -99,12 +99,12 @@ void R_SplitEntityOnNode (mnode_t *node) mplane_t *splitplane; mleaf_t *leaf; int sides; - + if (node->contents == CONTENTS_SOLID) { return; } - + // add an efrag if the node is a leaf if ( node->contents < 0) @@ -124,25 +124,25 @@ void R_SplitEntityOnNode (mnode_t *node) cl.free_efrags = cl.free_efrags->entnext; ef->entity = r_addent; - -// add the entity link + +// add the entity link *lastlink = ef; lastlink = &ef->entnext; ef->entnext = NULL; - + // set the leaf links ef->leaf = leaf; ef->leafnext = leaf->efrags; leaf->efrags = ef; - + return; } - + // NODE_MIXED splitplane = node->plane; sides = BOX_ON_PLANE_SIDE(r_emins, r_emaxs, splitplane); - + if (sides == 3) { // split on this plane @@ -150,11 +150,11 @@ void R_SplitEntityOnNode (mnode_t *node) if (!r_pefragtopnode) r_pefragtopnode = node; } - + // recurse down the contacted sides if (sides & 1) R_SplitEntityOnNode (node->children[0]); - + if (sides & 2) R_SplitEntityOnNode (node->children[1]); } @@ -172,7 +172,7 @@ void R_SplitEntityOnNode2 (mnode_t *node) if (node->visframe != r_visframecount) return; - + if (node->contents < 0) { if (node->contents != CONTENTS_SOLID) @@ -180,17 +180,17 @@ void R_SplitEntityOnNode2 (mnode_t *node) // visible and not BSP clipped return; } - + splitplane = node->plane; sides = BOX_ON_PLANE_SIDE(r_emins, r_emaxs, splitplane); - + if (sides == 3) { // remember first splitter r_pefragtopnode = node; return; } - + // not split yet; recurse down the contacted side if (sides & 1) R_SplitEntityOnNode2 (node->children[0]); @@ -208,7 +208,7 @@ void R_AddEfrags (entity_t *ent) { model_t *entmodel; int i; - + if (!ent->model) return; @@ -220,10 +220,10 @@ void R_AddEfrags (entity_t *ent) return; // never add the world r_addent = ent; - + lastlink = &ent->efrag; r_pefragtopnode = NULL; - + entmodel = ent->model; for (i=0 ; i<3 ; i++) @@ -276,7 +276,7 @@ void R_StoreEfrags (efrag_t **ppefrag) ppefrag = &pefrag->leafnext; break; - default: + default: Sys_Error ("R_StoreEfrags: Bad entity type %d\n", clmodel->type); } } diff --git a/common/r_light.c b/common/r_light.c index 554d924..1f13237 100644 --- a/common/r_light.c +++ b/common/r_light.c @@ -10,7 +10,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. @@ -36,7 +36,7 @@ R_AnimateLight void R_AnimateLight (void) { int i,j,k; - + // // light animations // 'm' is normal light, 'a' is no light, 'z' is double bright @@ -52,7 +52,7 @@ void R_AnimateLight (void) k = cl_lightstyle[j].map[k] - 'a'; k = k*22; d_lightstylevalue[j] = k; - } + } } @@ -75,13 +75,13 @@ void R_MarkLights (dlight_t *light, int bit, mnode_t *node) float dist; msurface_t *surf; int i; - + if (node->contents < 0) return; splitplane = node->plane; dist = DotProduct (light->origin, splitplane->normal) - splitplane->dist; - + if (dist > light->radius) { R_MarkLights (light, bit, node->children[0]); @@ -92,7 +92,7 @@ void R_MarkLights (dlight_t *light, int bit, mnode_t *node) R_MarkLights (light, bit, node->children[1]); return; } - + // mark the polygons surf = cl.worldmodel->surfaces + node->firstsurface; for (i=0 ; inumsurfaces ; i++, surf++) @@ -158,7 +158,7 @@ int RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end) if (node->contents < 0) return -1; // didn't hit anything - + // calculate mid point // FIXME: optimize for axial @@ -166,23 +166,23 @@ int RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end) front = DotProduct (start, plane->normal) - plane->dist; back = DotProduct (end, plane->normal) - plane->dist; side = front < 0; - + if ( (back < 0) == side) return RecursiveLightPoint (node->children[side], start, end); - + frac = front / (front-back); mid[0] = start[0] + (end[0] - start[0])*frac; mid[1] = start[1] + (end[1] - start[1])*frac; mid[2] = start[2] + (end[2] - start[2])*frac; - -// go down front side + +// go down front side r = RecursiveLightPoint (node->children[side], start, mid); if (r >= 0) return r; // hit something - + if ( (back < 0) == side ) return -1; // didn't hit anuthing - + // check for impact on this node surf = cl.worldmodel->surfaces + node->firstsurface; @@ -192,17 +192,17 @@ int RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end) continue; // no lightmaps tex = surf->texinfo; - + s = DotProduct (mid, tex->vecs[0]) + tex->vecs[0][3]; t = DotProduct (mid, tex->vecs[1]) + tex->vecs[1][3];; if (s < surf->texturemins[0] || t < surf->texturemins[1]) continue; - + ds = s - surf->texturemins[0]; dt = t - surf->texturemins[1]; - + if ( ds > surf->extents[0] || dt > surf->extents[1] ) continue; @@ -227,10 +227,10 @@ int RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end) lightmap += ((surf->extents[0]>>4)+1) * ((surf->extents[1]>>4)+1); } - + r >>= 8; } - + return r; } @@ -242,16 +242,16 @@ int R_LightPoint (vec3_t p) { vec3_t end; int r; - + if (!cl.worldmodel->lightdata) return 255; - + end[0] = p[0]; end[1] = p[1]; end[2] = p[2] - 2048; - + r = RecursiveLightPoint (cl.worldmodel->nodes, p, end); - + if (r == -1) r = 0; diff --git a/common/r_local.h b/common/r_local.h index 09772fa..efad342 100644 --- a/common/r_local.h +++ b/common/r_local.h @@ -11,7 +11,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. diff --git a/common/r_main.c b/common/r_main.c index 0a13927..38e63df 100644 --- a/common/r_main.c +++ b/common/r_main.c @@ -11,7 +11,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. @@ -149,7 +149,7 @@ cvar_t *r_netgraph; cvar_t *r_zgraph; //cvar_t r_graphheight = {"r_graphheight","15"}; cvar_t *r_graphheight; -//#else +//#else //cvar_t r_graphheight = {"r_graphheight","10"}; //#endif // QUAKEWORLD @@ -207,16 +207,16 @@ void R_InitTextures (void) { int x,y, m; byte *dest; - + // create a simple checkerboard texture for the default r_notexture_mip = Hunk_AllocName (sizeof(texture_t) + 16*16+8*8+4*4+2*2, "notexture"); - + r_notexture_mip->width = r_notexture_mip->height = 16; r_notexture_mip->offsets[0] = sizeof(texture_t); r_notexture_mip->offsets[1] = r_notexture_mip->offsets[0] + 16*16; r_notexture_mip->offsets[2] = r_notexture_mip->offsets[1] + 8*8; r_notexture_mip->offsets[3] = r_notexture_mip->offsets[2] + 4*4; - + for (m=0 ; m<4 ; m++) { dest = (byte *)r_notexture_mip + r_notexture_mip->offsets[m]; @@ -228,7 +228,7 @@ void R_InitTextures (void) else *dest++ = 0xff; } - } + } } /* @@ -239,14 +239,14 @@ R_Init void R_Init (void) { int dummy; - + // get stack position so we can guess if we are going to overflow r_stack_start = (byte *)&dummy; - + R_InitTurb (); - - Cmd_AddCommand ("timerefresh", R_TimeRefresh_f); - Cmd_AddCommand ("pointfile", R_ReadPointFile_f); + + Cmd_AddCommand ("timerefresh", R_TimeRefresh_f); + Cmd_AddCommand ("pointfile", R_ReadPointFile_f); // Cvar_RegisterVariable (&r_draworder); r_draworder = Cvar_Get ("r_draworder","0",0,"None"); @@ -333,7 +333,7 @@ void R_NewMap (void) { int i; -#ifdef QUAKEWORLD +#ifdef QUAKEWORLD memset (&r_worldentity, 0, sizeof(r_worldentity)); r_worldentity.model = cl.worldmodel; #endif @@ -341,7 +341,7 @@ void R_NewMap (void) // FIXME: is this one short? for (i=0 ; inumleafs ; i++) cl.worldmodel->leafs[i].efrags = NULL; - + r_viewleaf = NULL; R_ClearParticles (); @@ -500,7 +500,7 @@ void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect) pixelAspect = aspect; xOrigin = r_refdef.xOrigin; yOrigin = r_refdef.yOrigin; - + screenAspect = r_refdef.vrect.width*pixelAspect / r_refdef.vrect.height; // 320*200 1.0 pixelAspect = 1.6 screenAspect @@ -536,26 +536,26 @@ void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect) screenedge[0].normal[1] = 0; screenedge[0].normal[2] = 1; screenedge[0].type = PLANE_ANYZ; - + // right side clip screenedge[1].normal[0] = 1.0 / ((1.0-xOrigin)*r_refdef.horizontalFieldOfView); screenedge[1].normal[1] = 0; screenedge[1].normal[2] = 1; screenedge[1].type = PLANE_ANYZ; - + // top side clip screenedge[2].normal[0] = 0; screenedge[2].normal[1] = -1.0 / (yOrigin*verticalFieldOfView); screenedge[2].normal[2] = 1; screenedge[2].type = PLANE_ANYZ; - + // bottom side clip screenedge[3].normal[0] = 0; screenedge[3].normal[1] = 1.0 / ((1.0-yOrigin)*verticalFieldOfView); - screenedge[3].normal[2] = 1; + screenedge[3].normal[2] = 1; screenedge[3].type = PLANE_ANYZ; - + for (i=0 ; i<4 ; i++) VectorNormalize (screenedge[i].normal); @@ -605,12 +605,12 @@ void R_MarkLeaves (void) if (r_oldviewleaf == r_viewleaf) return; - + r_visframecount++; r_oldviewleaf = r_viewleaf; vis = Mod_LeafPVS (r_viewleaf, cl.worldmodel); - + for (i=0 ; inumleafs ; i++) { if (vis[i>>3] & (1<<(i&7))) @@ -671,7 +671,7 @@ void R_DrawEntitiesOnList (void) if (R_AliasCheckBBox ()) { j = R_LightPoint (currententity->origin); - + lighting.ambientlight = j; lighting.shadelight = j; @@ -685,12 +685,12 @@ void R_DrawEntitiesOnList (void) cl_dlights[lnum].origin, dist); add = cl_dlights[lnum].radius - Length(dist); - + if (add > 0) lighting.ambientlight += add; } } - + // clamp lighting so it doesn't overbright as much if (lighting.ambientlight > 128) lighting.ambientlight = 128; @@ -723,7 +723,7 @@ void R_DrawViewModel (void) float add; dlight_t *dl; -#ifdef QUAKEWORLD +#ifdef QUAKEWORLD if (!r_drawviewmodel->value || r_fov_greater_than_90 || !Cam_DrawViewModel()) #else if (!r_drawviewmodel->value || r_fov_greater_than_90) @@ -753,7 +753,7 @@ void R_DrawViewModel (void) r_viewlighting.ambientlight = j; r_viewlighting.shadelight = j; -// add dynamic lights +// add dynamic lights for (lnum=0 ; lnumvertexes; - + // FIXME: stop transforming twice R_RotateBmodel (); @@ -942,7 +942,7 @@ void R_DrawBEntitiesOnList (void) if (r_pefragtopnode) { currententity->topnode = r_pefragtopnode; - + if (r_pefragtopnode->contents >= 0) { // not a leaf; has to be clipped to the world BSP @@ -956,12 +956,12 @@ void R_DrawBEntitiesOnList (void) // drawing order R_DrawSubmodelPolygons (clmodel, clipflags); } - + currententity->topnode = NULL; } } - // put back world rotation and frustum clipping + // put back world rotation and frustum clipping // FIXME: R_RotateBmodel should just work off base_vxx VectorCopy (base_vpn, vpn); VectorCopy (base_vup, vup); @@ -1051,7 +1051,7 @@ void R_EdgeDrawing (void) S_ExtraUpdate (); // don't let sound get messed up if going slow VID_LockBuffer (); } - + if (!(r_drawpolys | r_drawculledpolys)) R_ScanEdges (); } @@ -1093,14 +1093,14 @@ SetVisibilityByPassages (); if (!cl_entities[0].model || !cl.worldmodel) #endif // QUAKEWORLD Sys_Error ("R_RenderView: NULL worldmodel"); - + if (!r_dspeeds->value) { VID_UnlockBuffer (); S_ExtraUpdate (); // don't let sound get messed up if going slow VID_LockBuffer (); } - + R_EdgeDrawing (); if (!r_dspeeds->value) @@ -1109,7 +1109,7 @@ SetVisibilityByPassages (); S_ExtraUpdate (); // don't let sound get messed up if going slow VID_LockBuffer (); } - + if (r_dspeeds->value) { se_time2 = Sys_DoubleTime (); @@ -1155,7 +1155,7 @@ SetVisibilityByPassages (); if (r_aliasstats->value) R_PrintAliasStats (); - + if (r_speeds->value) R_PrintTimes (); @@ -1176,7 +1176,7 @@ void R_RenderView (void) { int dummy; int delta; - + delta = (byte *)&dummy - r_stack_start; if (delta < -10000 || delta > 10000) Sys_Error ("R_RenderView: called without enough stack"); @@ -1201,7 +1201,7 @@ R_InitTurb void R_InitTurb (void) { int i; - + for (i=0 ; i < SIN_BUFFER_SIZE ; i++) { sintable[i] = AMP + sin(i*3.14159*2/CYCLE)*AMP; diff --git a/common/r_misc.c b/common/r_misc.c index 68274ec..69f218f 100644 --- a/common/r_misc.c +++ b/common/r_misc.c @@ -12,7 +12,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. @@ -88,7 +88,7 @@ void R_TimeRefresh_f (void) vrect_t vr; startangle = r_refdef.viewangles[1]; - + start = Sys_DoubleTime (); for (i=0 ; i<128 ; i++) { @@ -110,7 +110,7 @@ void R_TimeRefresh_f (void) stop = Sys_DoubleTime (); time = stop-start; Con_Printf ("%f seconds (%f fps)\n", time, 128/time); - + r_refdef.viewangles[1] = startangle; } @@ -129,12 +129,12 @@ void R_LineGraph (int x, int y, int h) int color; // FIXME: should be disabled on no-buffer adapters, or should be in the driver -#ifdef UQUAKE +#ifdef UQUAKE x += r_refdef.vrect.x; y += r_refdef.vrect.y; #endif dest = vid.buffer + vid.rowbytes*y + x; - + s = r_graphheight->value; if (h == 10000) @@ -182,7 +182,7 @@ void R_TimeGraph (void) float r_time2; static byte r_timings[MAX_TIMINGS]; int x; - + r_time2 = Sys_DoubleTime (); a = (r_time2-r_time1)/0.01; @@ -291,7 +291,7 @@ void R_PrintTimes (void) r_time2 = Sys_DoubleTime (); ms = 1000* (r_time2 - r_time1); - + Con_Printf ("%5.1f ms %3i/%3i/%3i poly %3i surf\n", ms, c_faceclip, r_polycount, r_drawnpolycount, c_surf); c_surf = 0; @@ -339,7 +339,7 @@ void WarpPalette (void) int i,j; byte newpalette[768]; int basecolor[3]; - + basecolor[0] = 130; basecolor[1] = 80; basecolor[2] = 50; @@ -352,7 +352,7 @@ void WarpPalette (void) newpalette[i*3+j] = (host_basepal[i*3+j] + basecolor[j])/2; } } - + VID_ShiftPalette (newpalette); } @@ -366,7 +366,7 @@ void R_TransformFrustum (void) { int i; vec3_t v, v2; - + for (i=0 ; i<4 ; i++) { v[0] = screenedge[i].normal[2]; @@ -395,7 +395,7 @@ void TransformVector (vec3_t in, vec3_t out) { out[0] = DotProduct(in,vright); out[1] = DotProduct(in,vup); - out[2] = DotProduct(in,vpn); + out[2] = DotProduct(in,vpn); } #endif @@ -409,7 +409,7 @@ R_TransformPlane void R_TransformPlane (mplane_t *p, float *normal, float *dist) { float d; - + d = DotProduct (r_origin, p->normal); *dist = p->dist - d; // TODO: when we have rotating entities, this will need to use the view matrix @@ -499,9 +499,9 @@ void R_SetupFrame (void) if (!sv.active) #endif r_draworder->value = 0; // don't let cheaters look behind walls - + R_CheckVariables (); - + R_AnimateLight (); r_framecount++; diff --git a/common/r_part.c b/common/r_part.c index 1805a60..a25b6c2 100644 --- a/common/r_part.c +++ b/common/r_part.c @@ -11,7 +11,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. @@ -93,20 +93,20 @@ void R_DarkFieldParticles (entity_t *ent) free_particles = p->next; p->next = active_particles; active_particles = p; - + p->die = cl.time + 0.2 + (rand()&7) * 0.02; p->color = 150 + rand()%6; p->type = pt_slowgrav; - + dir[0] = j*8; dir[1] = i*8; dir[2] = k*8; - + p->org[0] = org[0] + i + (rand()&3); p->org[1] = org[1] + j + (rand()&3); p->org[2] = org[2] + k + (rand()&3); - - VectorNormalize (dir); + + VectorNormalize (dir); vel = 50 + (rand()&63); VectorScale (dir, vel, p->vel); } @@ -137,7 +137,7 @@ void R_EntityParticles (entity_t *ent) float sr, sp, sy, cr, cp, cy; vec3_t forward; float dist; - + dist = 64; count = 50; @@ -159,7 +159,7 @@ avelocities[0][i] = (rand()&255) * 0.01; angle = cl.time * avelocities[i][2]; sr = sin(angle); cr = cos(angle); - + forward[0] = cp*cy; forward[1] = cp*sy; forward[2] = -sp; @@ -174,10 +174,10 @@ avelocities[0][i] = (rand()&255) * 0.01; p->die = cl.time + 0.01; p->color = 0x6f; p->type = pt_explode; - - p->org[0] = ent->origin[0] + r_avertexnormals[i][0]*dist + forward[0]*beamlength; - p->org[1] = ent->origin[1] + r_avertexnormals[i][1]*dist + forward[1]*beamlength; - p->org[2] = ent->origin[2] + r_avertexnormals[i][2]*dist + forward[2]*beamlength; + + p->org[0] = ent->origin[0] + r_avertexnormals[i][0]*dist + forward[0]*beamlength; + p->org[1] = ent->origin[1] + r_avertexnormals[i][1]*dist + forward[1]*beamlength; + p->org[2] = ent->origin[2] + r_avertexnormals[i][2]*dist + forward[2]*beamlength; } } @@ -190,7 +190,7 @@ R_ClearParticles void R_ClearParticles (void) { int i; - + free_particles = &particles[0]; active_particles = NULL; @@ -209,7 +209,7 @@ void R_ReadPointFile_f (void) particle_t *p; char name[MAX_OSPATH]; char buf[256]; - + // FIXME snprintf(name, sizeof(name),"maps/%s.pts", sv.name); COM_FOpenFile (name, &f); @@ -218,7 +218,7 @@ void R_ReadPointFile_f (void) Con_Printf ("couldn't open %s\n", name); return; } - + Con_Printf ("Reading %s...\n", name); c = 0; for ( ;; ) @@ -229,7 +229,7 @@ void R_ReadPointFile_f (void) if (r != 3) break; c++; - + if (!free_particles) { Con_Printf ("Not enough free particles\n"); @@ -239,7 +239,7 @@ void R_ReadPointFile_f (void) free_particles = p->next; p->next = active_particles; active_particles = p; - + p->die = 99999; p->color = (-c)&15; p->type = pt_static; @@ -262,7 +262,7 @@ void R_ParseParticleEffect (void) { vec3_t org, dir; int i, count, msgcount, color; - + for (i=0 ; i<3 ; i++) org[i] = MSG_ReadCoord (); for (i=0 ; i<3 ; i++) @@ -274,10 +274,10 @@ if (msgcount == 255) count = 1024; else count = msgcount; - + R_RunParticleEffect (org, dir, color, count); } - + /* =============== R_ParticleExplosion @@ -288,7 +288,7 @@ void R_ParticleExplosion (vec3_t org) { int i, j; particle_t *p; - + for (i=0 ; i<1024 ; i++) { if (!free_particles) @@ -366,7 +366,7 @@ void R_BlobExplosion (vec3_t org) { int i, j; particle_t *p; - + for (i=0 ; i<1024 ; i++) { if (!free_particles) @@ -421,7 +421,7 @@ void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count) else scale = 1; #endif - + for (i=0 ; inext; p->next = active_particles; active_particles = p; - + p->die = cl.time + 2 + (rand()&31) * 0.02; p->color = 224 + (rand()&7); #ifdef QUAKEWORLD @@ -513,16 +513,16 @@ void R_LavaSplash (vec3_t org) #else p->type = pt_slowgrav; #endif - + dir[0] = j*8 + (rand()&7); dir[1] = i*8 + (rand()&7); dir[2] = 256; - + p->org[0] = org[0] + dir[0]; p->org[1] = org[1] + dir[1]; p->org[2] = org[2] + (rand()&63); - - VectorNormalize (dir); + + VectorNormalize (dir); vel = 50 + (rand()&63); VectorScale (dir, vel, p->vel); } @@ -551,7 +551,7 @@ void R_TeleportSplash (vec3_t org) free_particles = p->next; p->next = active_particles; active_particles = p; - + p->die = cl.time + 0.2 + (rand()&7) * 0.02; p->color = 7 + (rand()&7); #ifdef QUAKEWORLD @@ -559,16 +559,16 @@ void R_TeleportSplash (vec3_t org) #else p->type = pt_slowgrav; #endif - + dir[0] = j*8; dir[1] = i*8; dir[2] = k*8; - + p->org[0] = org[0] + i + (rand()&3); p->org[1] = org[1] + j + (rand()&3); p->org[2] = org[2] + k + (rand()&3); - - VectorNormalize (dir); + + VectorNormalize (dir); vel = 50 + (rand()&63); VectorScale (dir, vel, p->vel); } @@ -606,7 +606,7 @@ R_RocketTrail (vec3_t start, vec3_t end, int type) free_particles = p->next; p->next = active_particles; active_particles = p; - + VectorCopy (vec3_origin, p->vel); p->die = cl.time + 2; diff --git a/common/r_shared.h b/common/r_shared.h index e7926c9..34bb2ee 100644 --- a/common/r_shared.h +++ b/common/r_shared.h @@ -10,7 +10,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. diff --git a/common/r_sky.c b/common/r_sky.c index e5b2cb7..b1c5f37 100644 --- a/common/r_sky.c +++ b/common/r_sky.c @@ -10,7 +10,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. @@ -87,7 +87,7 @@ void R_InitSky (texture_t *mt) } } } - + r_skysource = newsky; } @@ -113,7 +113,7 @@ void R_MakeSky (void) xlast = xshift; ylast = yshift; - + pnewsky = (unsigned *)&newsky[0]; for (y=0 ; ydist; pclipnormal = pclipplane->normal; - + // calc dists if (clip_current) { @@ -84,13 +84,13 @@ int R_ClipSpriteFace (int nump, clipplane_t *pclipplane) outstep = clip_verts[1][0]; clip_current = 1; } - + instep = in; for (i=0 ; i 0) == (dists[i+1] > 0) ) continue; - + // split it into a new vertex frac = dists[i] / (dists[i] - dists[i+1]); - + vert2 = instep + sizeof (vec5_t) / sizeof (float); - + outstep[0] = instep[0] + frac*(vert2[0] - instep[0]); outstep[1] = instep[1] + frac*(vert2[1] - instep[1]); outstep[2] = instep[2] + frac*(vert2[2] - instep[2]); @@ -128,8 +128,8 @@ int R_ClipSpriteFace (int nump, clipplane_t *pclipplane) outstep += sizeof (vec5_t) / sizeof (float); outcount++; - } - + } + return outcount; } @@ -217,7 +217,7 @@ void R_SetupAndDrawSprite () pout->s = pv[3]; pout->t = pv[4]; - + scale = xscale * pout->zi; pout->u = (xcenter + scale * transformed[0]); diff --git a/common/r_surf.c b/common/r_surf.c index 31d2e6f..407d381 100644 --- a/common/r_surf.c +++ b/common/r_surf.c @@ -11,7 +11,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. @@ -105,7 +105,7 @@ void R_AddDynamicLights (void) local[0] -= surf->texturemins[0]; local[1] -= surf->texturemins[1]; - + for (t = 0 ; tstyles[maps] != 255); maps++) { - scale = r_drawsurf.lightadj[maps]; // 8.8 fraction + scale = r_drawsurf.lightadj[maps]; // 8.8 fraction for (i=0 ; ialternate_anims) base = base->alternate_anims; } - + if (!base->anim_total) return base; reletive = (int)(cl.time*10) % base->anim_total; - count = 0; + count = 0; while (base->anim_min > reletive || base->anim_max <= reletive) { base = base->anim_next; @@ -273,22 +273,22 @@ void R_DrawSurface (void) // calculate the lightings R_BuildLightMap (); - + surfrowbytes = r_drawsurf.rowbytes; mt = r_drawsurf.texture; - + r_source = (byte *)mt + mt->offsets[r_drawsurf.surfmip]; - + // the fractional light values should range from 0 to (VID_GRADES - 1) << 16 // from a source range of 0 - 255 - + texwidth = mt->width >> r_drawsurf.surfmip; blocksize = 16 >> r_drawsurf.surfmip; blockdivshift = 4 - r_drawsurf.surfmip; blockdivmask = (1 << blockdivshift) - 1; - + r_lightwidth = (r_drawsurf.surf->extents[0]>>4)+1; r_numhblocks = r_drawsurf.surfwidth >> blockdivshift; @@ -322,7 +322,7 @@ void R_DrawSurface (void) // << 16 components are to guarantee positive values for % soffset = ((soffset >> r_drawsurf.surfmip) + (smax << 16)) % smax; - basetptr = &r_source[((((basetoffset >> r_drawsurf.surfmip) + basetptr = &r_source[((((basetoffset >> r_drawsurf.surfmip) + (tmax << 16)) % tmax) * twidth)]; pcolumndest = r_drawsurf.surfdat; @@ -387,7 +387,7 @@ void R_DrawSurfaceBlock8_mip0 (void) [(light & 0xFF00) + pix]; light += lightstep; } - + psource += sourcetstep; lightright += lightrightstep; lightleft += lightleftstep; @@ -437,7 +437,7 @@ void R_DrawSurfaceBlock8_mip1 (void) [(light & 0xFF00) + pix]; light += lightstep; } - + psource += sourcetstep; lightright += lightrightstep; lightleft += lightleftstep; @@ -487,7 +487,7 @@ void R_DrawSurfaceBlock8_mip2 (void) [(light & 0xFF00) + pix]; light += lightstep; } - + psource += sourcetstep; lightright += lightrightstep; lightleft += lightleftstep; @@ -537,7 +537,7 @@ void R_DrawSurfaceBlock8_mip3 (void) [(light & 0xFF00) + pix]; light += lightstep; } - + psource += sourcetstep; lightright += lightrightstep; lightleft += lightleftstep; diff --git a/common/r_vars.c b/common/r_vars.c index b5a02d0..7c0cafa 100644 --- a/common/r_vars.c +++ b/common/r_vars.c @@ -10,7 +10,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. diff --git a/common/register_check.c b/common/register_check.c index bbb3a0b..cd7f392 100644 --- a/common/register_check.c +++ b/common/register_check.c @@ -17,13 +17,13 @@ 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. You should have received a copy of the GNU General Public License along with this program; if not, write to: - + Free Software Foundation, Inc. 59 Temple Place - Suite 330 Boston, MA 02111-1307, USA @@ -38,7 +38,7 @@ cvar_t *registered; /* register_check - + Look for gfx/pop.lmp (only found in ID's registered quake pak files), and set the "registered" cvar to 1 if found. */ diff --git a/common/register_check.h b/common/register_check.h index fb6e0de..97cabbe 100644 --- a/common/register_check.h +++ b/common/register_check.h @@ -10,7 +10,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. diff --git a/common/render.h b/common/render.h index 8b348fb..e88f18f 100644 --- a/common/render.h +++ b/common/render.h @@ -11,7 +11,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. @@ -69,12 +69,12 @@ typedef struct entity_s entity_state_t baseline; // to fill in defaults in updates double msgtime; // time of last update - vec3_t msg_origins[2]; // last two updates (0 is newest) + vec3_t msg_origins[2]; // last two updates (0 is newest) vec3_t msg_angles[2]; // last two updates (0 is newest) int effects; // light, particals, etc //#endif vec3_t origin; - vec3_t angles; + vec3_t angles; struct model_s *model; // NULL = no model struct efrag_s *efrag; // linked list of efrags int frame; @@ -87,10 +87,10 @@ typedef struct entity_s //#endif int visframe; // last frame this entity was // found in an active leaf - + int dlightframe; // dynamic lighting int dlightbits; - + // FIXME: could turn these into a union int trivial_accept; struct mnode_s *topnode; // for bmodels, first world node @@ -116,14 +116,14 @@ typedef struct // right and bottom edges, for clamping float fvrectright; // rightmost edge, for Alias clamping float fvrectbottom; // bottommost edge, for Alias clamping - float horizontalFieldOfView; // at Z = 1.0, this many X is visible + float horizontalFieldOfView; // at Z = 1.0, this many X is visible // 2.0 = 90 degrees float xOrigin; // should probably allways be 0.5 float yOrigin; // between be around 0.3 to 0.5 vec3_t vieworg; vec3_t viewangles; - + float fov_x, fov_y; int ambientlight; diff --git a/common/resource.h b/common/resource.h index 1eb8077..f1a933d 100644 --- a/common/resource.h +++ b/common/resource.h @@ -10,7 +10,7 @@ #define IDC_PROGRESS 1000 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 115 diff --git a/common/sbar.c b/common/sbar.c index 9177496..070791d 100644 --- a/common/sbar.c +++ b/common/sbar.c @@ -12,7 +12,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. @@ -95,7 +95,7 @@ static qboolean largegame = false; /* Sbar_Items - + Return a target-independant items list int Sbar_Items ( void ) @@ -207,7 +207,7 @@ void Sbar_Init (void) sb_weapons[0][4] = Draw_PicFromWad ("inv_rlaunch"); sb_weapons[0][5] = Draw_PicFromWad ("inv_srlaunch"); sb_weapons[0][6] = Draw_PicFromWad ("inv_lightng"); - + sb_weapons[1][0] = Draw_PicFromWad ("inv2_shotgun"); sb_weapons[1][1] = Draw_PicFromWad ("inv2_sshotgun"); sb_weapons[1][2] = Draw_PicFromWad ("inv2_nailgun"); @@ -215,7 +215,7 @@ void Sbar_Init (void) sb_weapons[1][4] = Draw_PicFromWad ("inv2_rlaunch"); sb_weapons[1][5] = Draw_PicFromWad ("inv2_srlaunch"); sb_weapons[1][6] = Draw_PicFromWad ("inv2_lightng"); - + for (i=0 ; i<5 ; i++) { sb_weapons[2+i][0] = Draw_PicFromWad (va("inva%i_shotgun",i+1)); @@ -267,15 +267,15 @@ void Sbar_Init (void) Cmd_AddCommand ("+showscores", Sbar_ShowScores); Cmd_AddCommand ("-showscores", Sbar_DontShowScores); -#ifdef QUAKEWORLD +#ifdef QUAKEWORLD Cmd_AddCommand ("+showteamscores", Sbar_ShowTeamScores); Cmd_AddCommand ("-showteamscores", Sbar_DontShowTeamScores); #endif - + sb_sbar = Draw_PicFromWad ("sbar"); sb_ibar = Draw_PicFromWad ("ibar"); sb_scorebar = Draw_PicFromWad ("scorebar"); - + #ifdef UQUAKE if (hipnotic) //MED 01/04/97 added new hipnotic weapons { @@ -344,7 +344,7 @@ void Sbar_DrawPic (int x, int y, qpic_t *pic) #ifdef UQUAKE if ((cl_sbar->value && !cl.gametype == GAME_DEATHMATCH) && (hipnotic || rogue)) - Draw_Pic (x + ((vid.width - 320)>>1), + Draw_Pic (x + ((vid.width - 320)>>1), y + (vid.height-SBAR_HEIGHT), pic); else #endif @@ -357,18 +357,18 @@ Sbar_DrawSubPic ============= JACK: Draws a portion of the picture in the status bar. */ -void Sbar_DrawSubPic(int x, int y, qpic_t *pic, - int srcx, int srcy, int width, int height) +void Sbar_DrawSubPic(int x, int y, qpic_t *pic, + int srcx, int srcy, int width, int height) { #ifdef UQUAKE if ((cl_sbar->value && !cl.gametype == GAME_DEATHMATCH) && (hipnotic || rogue)) - Draw_SubPic (x + ((vid.width - 320)>>1), - y + (vid.height-SBAR_HEIGHT), + Draw_SubPic (x + ((vid.width - 320)>>1), + y + (vid.height-SBAR_HEIGHT), pic, srcx, srcy, width, height); else #endif - Draw_SubPic (x, y + (vid.height-SBAR_HEIGHT), + Draw_SubPic (x, y + (vid.height-SBAR_HEIGHT), pic, srcx, srcy, width, height); } @@ -383,7 +383,7 @@ void Sbar_DrawTransPic (int x, int y, qpic_t *pic) #ifdef UQUAKE if ((cl_sbar->value && !cl.gametype == GAME_DEATHMATCH) && (hipnotic || rogue)) - Draw_TransPic (x + ((vid.width - 320)>>1), + Draw_TransPic (x + ((vid.width - 320)>>1), y + (vid.height-SBAR_HEIGHT), pic); else #endif @@ -402,7 +402,7 @@ void Sbar_DrawCharacter (int x, int y, int num) #ifdef UQUAKE if ((cl_sbar->value && !cl.gametype == GAME_DEATHMATCH) && (hipnotic || rogue)) - Draw_Character (x + ((vid.width - 320)>>1) + 4, + Draw_Character (x + ((vid.width - 320)>>1) + 4, y + (vid.height-SBAR_HEIGHT), num); else #endif @@ -419,7 +419,7 @@ void Sbar_DrawString (int x, int y, char *str) #ifdef UQUAKE if ((cl_sbar->value && !cl.gametype == GAME_DEATHMATCH) && (hipnotic || rogue)) - Draw_String (x + ((vid.width - 320)>>1), + Draw_String (x + ((vid.width - 320)>>1), y + (vid.height-SBAR_HEIGHT), str); else #endif @@ -453,9 +453,9 @@ int Sbar_itoa (int num, char *buf) *str++ = '0'+dig; num -= dig*pow10; } while (pow10 != 1); - + *str = 0; - + return (str - buf); } @@ -524,7 +524,7 @@ Sbar_SortFrags void Sbar_SortFrags (qboolean includespec) { int i, j, k; - + // sort by frags scoreboardlines = 0; for (i=0 ; ivalue || (scr_viewsize->value < 100)); + headsup = !(cl_sbar->value || (scr_viewsize->value < 100)); hudswap = cl_hudswap->value; // Get that nasty float out :) #ifdef UQUAKE if (hipnotic) headsup = false; - + if (rogue) { headsup = false; if ( cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN ) @@ -760,8 +760,8 @@ void Sbar_DrawInventory (void) if (headsup) { if (i || vid.height>200) Sbar_DrawSubPic ((hudswap) ? 0 : (vid.width-24),-68-(7-i)*16 , sb_weapons[flashon][i],0,0,24,16); - - } else + + } else Sbar_DrawPic (i*24, -16, sb_weapons[flashon][i]); if (flashon > 1) @@ -772,7 +772,7 @@ void Sbar_DrawInventory (void) #ifdef UQUAKE // hipnotic weapons if (hipnotic) { - + int grenadeflashing=0; for (i=0 ; i<4 ; i++) { @@ -846,9 +846,9 @@ void Sbar_DrawInventory (void) Sbar_DrawCharacter ( (6*i+3)*8 - 2, -24, 18 + num[2] - '0'); } } - + flashon = 0; - + // items for (i=0 ; i<6 ; i++) if (cl.stats[STAT_ITEMS] & (1<<(17+i))) { @@ -880,13 +880,13 @@ void Sbar_DrawInventory (void) } else { Sbar_DrawPic (288 + i*16, -16, hsb_items[i]); } - + if (time && time > cl.time - 2) sb_updates = 0; } } } - + if (rogue) { // new rogue items for (i=0 ; i<2 ; i++) { @@ -912,7 +912,7 @@ void Sbar_DrawInventory (void) if (time && time > cl.time - 2 && flashon ) { // flash frame sb_updates = 0; } else - Sbar_DrawPic (320-32 + i*8, -16, sb_sigil[i]); + Sbar_DrawPic (320-32 + i*8, -16, sb_sigil[i]); if (time && time > cl.time - 2) sb_updates = 0; } @@ -930,7 +930,7 @@ Sbar_DrawFrags =============== */ void Sbar_DrawFrags (void) -{ +{ int i, k, l; int top, bottom; int x, y, f; @@ -981,14 +981,14 @@ void Sbar_DrawFrags (void) #endif top = Sbar_ColorForMap (top); bottom = Sbar_ColorForMap (bottom); - + Draw_Fill (xofs + x * 8 + 10, y, 28, 4, top); Draw_Fill (xofs + x * 8 + 10, y + 4, 28, 3, bottom); // draw number f = s->frags; snprintf(num, sizeof(num), "%3i", f); - + Sbar_DrawCharacter ( (x + 1) * 8 , -24, num[0]); Sbar_DrawCharacter ( (x + 2) * 8 , -24, num[1]); Sbar_DrawCharacter ( (x + 3) * 8 , -24, num[2]); @@ -1012,7 +1012,7 @@ Sbar_DrawFace void Sbar_DrawFace (void) { int f, anim; - + #ifdef UQUAKE // PGM 01/19/97 - team color drawing // PGM 03/02/97 - fixed so color swatch only appears in CTF modes @@ -1024,7 +1024,7 @@ void Sbar_DrawFace (void) int xofs; char num[12]; scoreboard_t *s; - + s = &cl.scores[cl.playernum]; // draw background top = s->colors & 0xf0; @@ -1060,7 +1060,7 @@ void Sbar_DrawFace (void) Sbar_DrawCharacter ( 116, 3, num[1]); Sbar_DrawCharacter ( 123, 3, num[2]); } - + return; } // PGM 01/19/97 - team color drawing @@ -1090,7 +1090,7 @@ void Sbar_DrawFace (void) f = cl.stats[STAT_HEALTH] / 20; if (f < 0) f = 0; } - + if (cl.time <= cl.faceanimtime) { anim = 1; @@ -1152,7 +1152,7 @@ void Sbar_DrawNormal (void) // face Sbar_DrawFace (); - + // health Sbar_DrawNum (136, 0, cl.stats[STAT_HEALTH], 3 , cl.stats[STAT_HEALTH] <= 25); @@ -1175,7 +1175,7 @@ void Sbar_DrawNormal (void) else if (cl.stats[STAT_ITEMS] & RIT_MULTI_ROCKETS) Sbar_DrawPic (224, 0, rsb_ammo[2]); } else { -#endif // !QUAKEWORLD +#endif // !QUAKEWORLD if (cl.stats[STAT_ITEMS] & IT_SHELLS) Sbar_DrawPic (224, 0, sb_ammo[0]); else if (cl.stats[STAT_ITEMS] & IT_NAILS) @@ -1225,7 +1225,7 @@ void Sbar_Draw (void) scr_copyeverything = 1; sb_updates++; - + // top line if (sb_lines > 24) { #ifdef QUAKEWORLD @@ -1281,7 +1281,7 @@ void Sbar_Draw (void) else if (sb_showteamscores) Sbar_TeamOverlay(); - if (sb_showscores || sb_showteamscores || + if (sb_showscores || sb_showteamscores || cl.stats[STAT_HEALTH] <= 0) sb_updates = 0; #if 0 @@ -1421,17 +1421,17 @@ void Sbar_TeamOverlay (void) // draw total snprintf(num, sizeof(num), "%5i", tm->frags); Draw_String (x + 104 + 40, y, num); - + // draw players snprintf(num, sizeof(num), "%5i", tm->players); Draw_String (x + 104 + 88, y, num); - + if (!strncmp(Info_ValueForKey(cl.players[cl.playernum].userinfo, "team"), tm->team, 16)) { Draw_Character ( x + 104 - 8, y, 16); Draw_Character ( x + 104 + 32, y, 17); } - + y += 8; } y += 8; @@ -1483,7 +1483,7 @@ void Sbar_DeathmatchOverlay (int start) Draw_Pic (160-pic->width/2, 0, pic); } -// scores +// scores Sbar_SortFrags (true); // draw the text @@ -1496,7 +1496,7 @@ void Sbar_DeathmatchOverlay (int start) if (teamplay) { x = 4; -// 0 40 64 104 152 192 +// 0 40 64 104 152 192 Draw_String ( x , y, "ping pl time frags team name"); y += 8; // Draw_String ( x , y, "---- -- ---- ----- ---- ----------------"); @@ -1563,7 +1563,7 @@ void Sbar_DeathmatchOverlay (int start) bottom = s->bottomcolor; top = Sbar_ColorForMap (top); bottom = Sbar_ColorForMap (bottom); - + if (largegame) Draw_Fill ( x+104, y+1, 40, 3, top); else @@ -1573,7 +1573,7 @@ void Sbar_DeathmatchOverlay (int start) // draw number f = s->frags; snprintf(num, sizeof(num), "%3i",f); - + Draw_Character ( x+112 , y, num[0]); Draw_Character ( x+120 , y, num[1]); Draw_Character ( x+128 , y, num[2]); @@ -1583,7 +1583,7 @@ void Sbar_DeathmatchOverlay (int start) Draw_Character ( x + 104, y, 16); Draw_Character ( x + 136, y, 17); } - + // team if (teamplay) { @@ -1597,7 +1597,7 @@ void Sbar_DeathmatchOverlay (int start) Draw_String (x+152+40, y, s->name); else Draw_String (x+152, y, s->name); - + y += skip; } @@ -1635,7 +1635,7 @@ void Sbar_MiniDeathmatchOverlay (void) scr_copyeverything = 1; scr_fullupdate = 0; -// scores +// scores Sbar_SortFrags (false); if (vid.width >= 640) Sbar_SortTeams(); @@ -1678,14 +1678,14 @@ void Sbar_MiniDeathmatchOverlay (void) bottom = s->bottomcolor; top = Sbar_ColorForMap (top); bottom = Sbar_ColorForMap (bottom); - + Draw_Fill ( x, y+1, 40, 3, top); Draw_Fill ( x, y+4, 40, 4, bottom); // draw number f = s->frags; snprintf(num, sizeof(num), "%3i",f); - + Draw_Character ( x+8 , y, num[0]); Draw_Character ( x+16, y, num[1]); Draw_Character ( x+24, y, num[2]); @@ -1695,7 +1695,7 @@ void Sbar_MiniDeathmatchOverlay (void) Draw_Character ( x, y, 16); Draw_Character ( x + 32, y, 17); } - + // team if (teamplay) { @@ -1739,13 +1739,13 @@ void Sbar_MiniDeathmatchOverlay (void) // draw total snprintf(num, sizeof(num), "%5i", tm->frags); Draw_String (x + 40, y, num); - + if (!strncmp(Info_ValueForKey(cl.players[cl.playernum].userinfo, "team"), tm->team, 16)) { Draw_Character ( x - 8, y, 16); Draw_Character ( x + 32, y, 17); } - + y += 8; } diff --git a/common/sbar.h b/common/sbar.h index 3dc9787..28b55e5 100644 --- a/common/sbar.h +++ b/common/sbar.h @@ -10,7 +10,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. diff --git a/common/screen.c b/common/screen.c index 9bc509a..4cfda09 100644 --- a/common/screen.c +++ b/common/screen.c @@ -12,7 +12,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. @@ -79,7 +79,7 @@ SlowPrint () Screen_Update (); Con_Printf (); -net +net turn off messages option the refresh is allways rendered, unless the console is full screen @@ -89,12 +89,12 @@ console is: notify lines half full - + */ -// only the refresh window will be updated unless these variables are flagged +// only the refresh window will be updated unless these variables are flagged int scr_copytop; int scr_copyeverything; @@ -223,7 +223,7 @@ void SCR_DrawCenterString (void) else y = 48; - do + do { // scan the width of the line for (l=0 ; l<40 ; l++) @@ -232,11 +232,11 @@ void SCR_DrawCenterString (void) x = (vid.width - l*8)/2; for (j=0 ; jvalue < 30) Cvar_Set ("viewsize","30"); @@ -324,7 +324,7 @@ static void SCR_CalcRefdef (void) r_refdef.fov_x = scr_fov->value; r_refdef.fov_y = CalcFov (r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height); -// intermission is always full screen +// intermission is always full screen if (cl.intermission) size = 120; else @@ -453,7 +453,7 @@ SCR_DrawTurtle void SCR_DrawTurtle (void) { static int count; - + if (!scr_showturtle->value) return; @@ -540,7 +540,7 @@ void SCR_DrawPause (void) return; pic = Draw_CachePic ("gfx/pause.lmp"); - Draw_Pic ( (vid.width - pic->width)/2, + Draw_Pic ( (vid.width - pic->width)/2, (vid.height - 48 - pic->height)/2, pic); } @@ -556,9 +556,9 @@ void SCR_DrawLoading (void) if (!scr_drawloading) return; - + pic = Draw_CachePic ("gfx/loading.lmp"); - Draw_Pic ( (vid.width - pic->width)/2, + Draw_Pic ( (vid.width - pic->width)/2, (vid.height - 48 - pic->height)/2, pic); } @@ -573,7 +573,7 @@ SCR_SetUpToDrawConsole void SCR_SetUpToDrawConsole (void) { Con_CheckResize (); - + if (scr_drawloading) return; // never a console with loading plaque @@ -586,10 +586,10 @@ void SCR_SetUpToDrawConsole (void) else if (key_dest == key_console) scr_conlines = vid.height * max(0.2, min(scr_consize->value, 1)); - + else scr_conlines = 0; // none visible - + if (scr_conlines < scr_con_current) { scr_con_current -= scr_conspeed->value * host_frametime * 4; @@ -618,7 +618,7 @@ void SCR_SetUpToDrawConsole (void) else con_notifylines = 0; } - + /* ================== SCR_DrawConsole @@ -640,34 +640,34 @@ void SCR_DrawConsole (void) } -/* -============================================================================== - - SCREEN SHOTS - -============================================================================== -*/ +/* +============================================================================== + + SCREEN SHOTS + +============================================================================== +*/ -/* -============== -WritePCXfile -============== -*/ +/* +============== +WritePCXfile +============== +*/ void WritePCXfile (char *filename, byte *data, int width, int height, - int rowbytes, byte *palette, qboolean upload) + int rowbytes, byte *palette, qboolean upload) { int i, j, length; pcx_t *pcx; byte *pack; - + pcx = Hunk_TempAlloc (width*height*2+1000); if (pcx == NULL) { Con_Printf("SCR_ScreenShot_f: not enough memory\n"); return; - } - + } + pcx->manufacturer = 0x0a; // PCX id pcx->version = 5; // 256 color pcx->encoding = 1; // uncompressed @@ -686,7 +686,7 @@ void WritePCXfile (char *filename, byte *data, int width, int height, // pack the image pack = &pcx->data; - + for (i=0 ; ivalue; vid.recalc_refdef = 1; } - + // // check for vid changes // @@ -1177,13 +1177,13 @@ void SCR_UpdateScreen (void) oldfov = scr_fov->value; vid.recalc_refdef = true; } - + if (oldlcd_x != lcd_x->value) { oldlcd_x = lcd_x->value; vid.recalc_refdef = true; } - + if (oldscreensize != scr_viewsize->value) { oldscreensize = scr_viewsize->value; @@ -1195,7 +1195,7 @@ void SCR_UpdateScreen (void) oldsbar = cl_sbar->value; vid.recalc_refdef = true; } - + if (vid.recalc_refdef) { // something changed, so reorder the screen @@ -1219,7 +1219,7 @@ void SCR_UpdateScreen (void) SCR_SetUpToDrawConsole (); SCR_EraseCenterString (); - + D_DisableBackBufferAccess (); // for adapters that can't stay mapped in // for linear writes all the time @@ -1263,7 +1263,7 @@ void SCR_UpdateScreen (void) SCR_DrawFPS (); SCR_CheckDrawCenterString (); Sbar_Draw (); - SCR_DrawConsole (); + SCR_DrawConsole (); M_Draw (); } @@ -1287,7 +1287,7 @@ void SCR_UpdateScreen (void) vrect.width = vid.width; vrect.height = vid.height; vrect.pnext = 0; - + VID_Update (&vrect); } else if (scr_copytop) @@ -1297,9 +1297,9 @@ void SCR_UpdateScreen (void) vrect.width = vid.width; vrect.height = vid.height - sb_lines; vrect.pnext = 0; - + VID_Update (&vrect); - } + } else { vrect.x = scr_vrect.x; @@ -1307,9 +1307,9 @@ void SCR_UpdateScreen (void) vrect.width = scr_vrect.width; vrect.height = scr_vrect.height; vrect.pnext = 0; - + VID_Update (&vrect); - } + } } /* diff --git a/common/screen.h b/common/screen.h index f77905b..eda8613 100644 --- a/common/screen.h +++ b/common/screen.h @@ -10,7 +10,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. @@ -53,7 +53,7 @@ extern qboolean scr_skipupdate; extern cvar_t *scr_viewsize; -// only the refresh window will be updated unless these variables are flagged +// only the refresh window will be updated unless these variables are flagged extern int scr_copytop; extern int scr_copyeverything; diff --git a/common/server.h b/common/server.h index afb1948..e3e06a3 100644 --- a/common/server.h +++ b/common/server.h @@ -11,7 +11,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. @@ -68,16 +68,16 @@ typedef struct server_state_t state; // precache commands are only valid during load double time; - + int lastcheck; // used by PF_checkclient - double lastchecktime; // for monster ai + double lastchecktime; // for monster ai qboolean paused; // are we paused? //check player/eyes models for hacks unsigned model_player_checksum; unsigned eyes_player_checksum; - + char name[64]; // map name char modelname[MAX_QPATH]; // maps/.bsp, for model_precache[0] struct model_s *worldmodel; @@ -111,7 +111,7 @@ typedef struct // the signon buffer will be sent to each client as they connect // includes the entity baselines, the static entities, etc - // large levels will have >MAX_DATAGRAM sized signons, so + // large levels will have >MAX_DATAGRAM sized signons, so // multiple signon messages are kept sizebuf_t signon; int num_signon_buffers; @@ -127,10 +127,10 @@ typedef struct qboolean loadgame; // handle connections specially double time; - + int lastcheck; // used by PF_checkclient double lastchecktime; - + char name[64]; // map name #ifdef QUAKE2 char startspot[64]; @@ -229,9 +229,9 @@ typedef struct client_s // spawn parms are carried from level to level float spawn_parms[NUM_SPAWN_PARMS]; -// client known data for deltas +// client known data for deltas int old_frags; - + int stats[MAX_CL_STATS]; @@ -253,7 +253,7 @@ typedef struct client_s char uploadfn[MAX_QPATH]; netadr_t snap_from; qboolean remote_snap; - + //===== NETWORK ============ int chokecount; int delta_sequence; // -1 = no compression @@ -285,14 +285,14 @@ typedef struct client_s edict_t *edict; // EDICT_NUM(clientnum+1) char name[32]; // for printing to other people int colors; - + float ping_times[NUM_PING_TIMES]; int num_pings; // ping_times[num_pings%NUM_PING_TIMES] // spawn parms are carried from level to level float spawn_parms[NUM_SPAWN_PARMS]; -// client known data for deltas +// client known data for deltas int old_frags; } client_t; #endif @@ -337,7 +337,7 @@ typedef struct // used to check late spawns client_t clients[MAX_CLIENTS]; int serverflags; // episode completion information - + double last_heartbeat; int beatcount; int mheartbeat_sequence; diff --git a/common/skin.c b/common/skin.c index cce4a08..8876be5 100644 --- a/common/skin.c +++ b/common/skin.c @@ -12,7 +12,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. @@ -159,7 +159,7 @@ void Skin_NextDownload (void) Con_Printf ("Checking skins...\n"); cls.downloadtype = dl_skin; - for ( + for ( ; cls.downloadnumber != MAX_CLIENTS ; cls.downloadnumber++) { diff --git a/common/snd_alsa.c b/common/snd_alsa.c index 652cf4c..f5cfbca 100644 --- a/common/snd_alsa.c +++ b/common/snd_alsa.c @@ -9,7 +9,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. @@ -66,13 +66,13 @@ int check_card(int card) snd_ctl_t *handle; snd_ctl_hw_info_t info; int rc; - + if ((rc = snd_ctl_open(&handle, card)) < 0) { Con_Printf("Error: control open (%i): %s\n", card, snd_strerror(rc)); return rc; } if ((rc = snd_ctl_hw_info(handle, &info)) < 0) { - Con_Printf("Error: control hardware info (%i): %s\n", card, + Con_Printf("Error: control hardware info (%i): %s\n", card, snd_strerror(rc)); snd_ctl_close(handle); return rc; @@ -289,7 +289,7 @@ void SNDDMA_Submit(void) switch (mmap_control->status.status) { case SND_PCM_STATUS_PREPARED: if ((rc=snd_pcm_channel_go(pcm_handle, SND_PCM_CHANNEL_PLAYBACK))<0) { - fprintf(stderr, "unable to start playback. %s\n", + fprintf(stderr, "unable to start playback. %s\n", snd_strerror(rc)); exit(1); } @@ -298,7 +298,7 @@ void SNDDMA_Submit(void) break; case SND_PCM_STATUS_UNDERRUN: if ((rc=snd_pcm_plugin_prepare(pcm_handle, SND_PCM_CHANNEL_PLAYBACK))<0) { - fprintf(stderr, "underrun: playback channel prepare error. %s\n", + fprintf(stderr, "underrun: playback channel prepare error. %s\n", snd_strerror(rc)); exit(1); } diff --git a/common/snd_dma.c b/common/snd_dma.c index eb1d5f6..046a050 100644 --- a/common/snd_dma.c +++ b/common/snd_dma.c @@ -11,7 +11,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. @@ -130,7 +130,7 @@ void S_SoundInfo_f(void) Con_Printf ("sound system not started\n"); return; } - + Con_Printf("%5d stereo\n", shm->channels - 1); Con_Printf("%5d samples\n", shm->samples); Con_Printf("%5d samplepos\n", shm->samplepos); @@ -312,12 +312,12 @@ sfx_t *S_FindName (char *name) if (num_sfx == MAX_SFX) Sys_Error ("S_FindName: out of sfx_t"); - + sfx = &known_sfx[i]; strcpy (sfx->name, name); num_sfx++; - + return sfx; } @@ -331,7 +331,7 @@ S_TouchSound void S_TouchSound (char *name) { sfx_t *sfx; - + if (!sound_started) return; @@ -353,11 +353,11 @@ sfx_t *S_PrecacheSound (char *name) return NULL; sfx = S_FindName (name); - + // cache it in if (precache->value) S_LoadSound (sfx); - + return sfx; } @@ -405,8 +405,8 @@ channel_t *SND_PickChannel(int entnum, int entchannel) if (channels[first_to_die].sfx) channels[first_to_die].sfx = NULL; - return &channels[first_to_die]; -} + return &channels[first_to_die]; +} /* ================= @@ -434,9 +434,9 @@ void SND_Spatialize(channel_t *ch) sndfx = ch->sfx; VectorSubtract(ch->origin, listener_origin, source_vec); - + dist = VectorNormalize(source_vec) * ch->dist_mult; - + dot = DotProduct(listener_right, source_vec); if (shm->channels == 1) @@ -460,7 +460,7 @@ void SND_Spatialize(channel_t *ch) ch->leftvol = (int) (ch->master_vol * scale); if (ch->leftvol < 0) ch->leftvol = 0; -} +} // ======================================================================= @@ -490,7 +490,7 @@ void S_StartSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float f target_chan = SND_PickChannel(entnum, entchannel); if (!target_chan) return; - + // spatialize memset (target_chan, 0, sizeof(*target_chan)); VectorCopy(origin, target_chan->origin); @@ -513,7 +513,7 @@ void S_StartSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float f target_chan->sfx = sfx; target_chan->pos = 0.0; - target_chan->end = paintedtime + sc->length; + target_chan->end = paintedtime + sc->length; // if an identical sound has also been started this frame, offset the pos // a bit to keep it from just making the first one louder @@ -531,7 +531,7 @@ void S_StartSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float f target_chan->end -= skip; break; } - + } } @@ -578,7 +578,7 @@ void S_StopAllSoundsC (void) void S_ClearBuffer (void) { int clear; - + #ifdef _WIN32 if (!sound_started || !shm || (!shm->buffer && !pDSBuf)) #else @@ -621,7 +621,7 @@ void S_ClearBuffer (void) Q_memset(pData, clear, shm->samples * shm->samplebits/8); pDSBuf->lpVtbl->Unlock(pDSBuf, pData, dwSize, NULL, 0); - + } else #endif @@ -662,13 +662,13 @@ void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation) Con_Printf ("Sound %s not looped\n", sfx->name); return; } - + ss->sfx = sfx; VectorCopy (origin, ss->origin); ss->master_vol = vol; ss->dist_mult = (attenuation/64) / sound_nominal_clip_dist; - ss->end = paintedtime + sc->length; - + ss->end = paintedtime + sc->length; + SND_Spatialize (ss); } @@ -704,9 +704,9 @@ void S_UpdateAmbientSounds (void) for (ambient_channel = 0 ; ambient_channel< NUM_AMBIENTS ; ambient_channel++) { - chan = &channels[ambient_channel]; + chan = &channels[ambient_channel]; chan->sfx = ambient_sfx[ambient_channel]; - + vol = ambient_level->value * l->ambient_sound_level[ambient_channel]; if (vol < 8) vol = 0; @@ -724,7 +724,7 @@ void S_UpdateAmbientSounds (void) if (chan->master_vol < vol) chan->master_vol = vol; } - + chan->leftvol = chan->rightvol = chan->master_vol; } } @@ -751,13 +751,13 @@ void S_Update(vec3_t origin, vec3_t forward, vec3_t right, vec3_t up) VectorCopy(forward, listener_forward); VectorCopy(right, listener_right); VectorCopy(up, listener_up); - + // update general area ambient sound sources S_UpdateAmbientSounds (); combine = NULL; -// update spatialization for static and dynamic sounds +// update spatialization for static and dynamic sounds ch = channels+NUM_AMBIENTS; for (i=NUM_AMBIENTS ; i= MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS) { // see if it can just use the last one @@ -785,7 +785,7 @@ void S_Update(vec3_t origin, vec3_t forward, vec3_t right, vec3_t up) for (j=MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS ; jsfx == ch->sfx) break; - + if (j == total_channels) { combine = NULL; @@ -801,8 +801,8 @@ void S_Update(vec3_t origin, vec3_t forward, vec3_t right, vec3_t up) continue; } } - - + + } // @@ -818,7 +818,7 @@ void S_Update(vec3_t origin, vec3_t forward, vec3_t right, vec3_t up) //Con_Printf ("%3i %3i %s\n", ch->leftvol, ch->rightvol, ch->sfx->name); total++; } - + Con_Printf ("----(%i)----\n", total); } @@ -832,7 +832,7 @@ void GetSoundtime(void) static int buffers; static int oldsamplepos; int fullsamples; - + fullsamples = shm->samples / shm->channels; // it is possible to miscount buffers if it has wrapped twice between @@ -847,7 +847,7 @@ void GetSoundtime(void) if (samplepos < oldsamplepos) { buffers++; // buffer wrapped - + if (paintedtime > 0x40000000) { // time to chop things off to avoid 32 bit limits buffers = 0; @@ -877,7 +877,7 @@ void S_Update_(void) { unsigned endtime; int samps; - + if (!sound_started || (snd_blocked > 0)) return; @@ -906,10 +906,10 @@ void S_Update_(void) { if (pDSBuf->lpVtbl->GetStatus (pDSBuf, &dwStatus) != DD_OK) Con_Printf ("Couldn't get sound buffer status\n"); - + if (dwStatus & DSBSTATUS_BUFFERLOST) pDSBuf->lpVtbl->Restore (pDSBuf); - + if (!(dwStatus & DSBSTATUS_PLAYING)) pDSBuf->lpVtbl->Play(pDSBuf, 0, 0, DSBPLAY_LOOPING); } @@ -935,7 +935,7 @@ void S_Play(void) int i; char name[256]; sfx_t *sfx; - + i = 1; while (ivalue) return; - + sfx = S_PrecacheSound (sound); if (!sfx) { diff --git a/common/snd_dos.c b/common/snd_dos.c index 83ed7ac..548679e 100644 --- a/common/snd_dos.c +++ b/common/snd_dos.c @@ -10,7 +10,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. @@ -66,10 +66,10 @@ void PrintBits (byte b) { int i; char str[9]; - + for (i=0 ; i<8 ; i++) str[i] = '0' + ((b & (1<<(7-i))) > 0); - + str[8] = 0; Con_Printf ("%s (%i)", str, b); } @@ -230,7 +230,7 @@ void StartSB(void) for (i=0 ; i<0x10000 ; i++) dos_inportb(dsp_port+0xe); // ack the dsp - + timeconstant = 65536-(256000000/(shm->channels*shm->speed)); WriteDSP(0x40); WriteDSP(timeconstant>>8); @@ -314,7 +314,7 @@ void StartDMA(void) +(2<<2) // read +(dma&3); // channel # dos_outportb(mode_reg, mode); - + // set address // set page dos_outportb(page_reg[dma], realaddr >> 16); @@ -358,7 +358,7 @@ qboolean BLASTER_Init(void) int realaddr; int rc; int p; - + shm = 0; rc = 0; @@ -371,7 +371,7 @@ qboolean BLASTER_Init(void) "The BLASTER environment variable\n" "is not set, sound effects are\n" "disabled. See README.TXT for help.\n" - ); + ); return 0; } @@ -406,7 +406,7 @@ qboolean BLASTER_Init(void) Con_Printf ("Can't -dsp %i on v%i hardware\n", p, dsp_version); else dsp_version = p; - } + } // everyone does 11khz sampling rate unless told otherwise @@ -426,16 +426,16 @@ qboolean BLASTER_Init(void) else if (dsp_version == 3) { shm->channels = 2; - shm->samplebits = 8; + shm->samplebits = 8; } // v2 cards do 8 bit mono else { shm->channels = 1; - shm->samplebits = 8; + shm->samplebits = 8; } - + Cmd_AddCommand("sbinfo", SB_Info_f); size = 4096; @@ -537,9 +537,9 @@ void BLASTER_Shutdown(void) } else { - + } - + WriteDSP(0xd3); // turn off speaker ResetDSP (); @@ -586,9 +586,9 @@ qboolean SNDDMA_Init(void) dmacard = dma_blaster; return true; } - + dmacard = dma_none; - + return false; } @@ -613,7 +613,7 @@ int SNDDMA_GetDMAPos(void) case dma_none: break; } - + return 0; } diff --git a/common/snd_gus.c b/common/snd_gus.c index 2cf2309..9e166f3 100644 --- a/common/snd_gus.c +++ b/common/snd_gus.c @@ -10,7 +10,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. @@ -648,7 +648,7 @@ void ClearGf1Ints(void) SetGf18(DMA_CONTROL,0x00); SetGf18(ADLIB_CONTROL,0x00); SetGf18(RECORD_CONTROL,0x00); - + GetGf18(DMA_CONTROL); GetGf18(RECORD_CONTROL); for (i=0;i<32;i++); @@ -1097,11 +1097,11 @@ qboolean GUS_Init(void) if (rc) { shm->speed = Q_atoi(com_argv[rc+1]); - + // Make sure rate not too high if (shm->speed>48000) shm->speed=48000; - + // Adjust speed to match one of the possible CODEC rates for (CodecRate=CodecRates;CodecRate->Rate!=0;CodecRate++) { @@ -1114,11 +1114,11 @@ qboolean GUS_Init(void) } } - + // Always do 16 bit stereo shm->channels = 2; shm->samplebits = 16; - + // allocate buffer twice the size we need so we can get aligned buffer dma_buffer = dos_getmemory(BUFFER_SIZE*2); if (dma_buffer==NULL) diff --git a/common/snd_mem.c b/common/snd_mem.c index 0807374..dbe9536 100644 --- a/common/snd_mem.c +++ b/common/snd_mem.c @@ -10,7 +10,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. @@ -47,7 +47,7 @@ void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, byte *data) int i; int sample, samplefrac, fracstep; sfxcache_t *sc; - + sc = Cache_Check (&sfx->cache); if (!sc) return; @@ -140,7 +140,7 @@ sfxcache_t *S_LoadSound (sfx_t *s) return NULL; } - stepscale = (float)info.rate / shm->speed; + stepscale = (float)info.rate / shm->speed; len = info.samples / stepscale; len = len * info.width * info.channels; @@ -148,7 +148,7 @@ sfxcache_t *S_LoadSound (sfx_t *s) sc = Cache_Alloc ( &s->cache, len + sizeof(sfxcache_t), s->name); if (!sc) return NULL; - + sc->length = info.samples; sc->loopstart = info.loopstart; sc->speed = info.rate; @@ -209,7 +209,7 @@ void FindNextChunk(char *name) data_p = NULL; return; } - + data_p += 4; iff_chunk_len = GetLittleLong(); if (iff_chunk_len < 0) @@ -237,7 +237,7 @@ void FindChunk(char *name) void DumpChunks(void) { char str[5]; - + str[4] = 0; data_p=iff_data; do @@ -266,7 +266,7 @@ wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength) if (!wav) return info; - + iff_data = wav; iff_end = wav + wavlength; @@ -345,7 +345,7 @@ wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength) info.samples = samples; info.dataofs = data_p - wav; - + return info; } diff --git a/common/snd_mix.c b/common/snd_mix.c index d4d0959..0ac3369 100644 --- a/common/snd_mix.c +++ b/common/snd_mix.c @@ -10,7 +10,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. @@ -85,7 +85,7 @@ void S_TransferStereo16 (int endtime) DWORD *pbuf2; HRESULT hresult; #endif - + snd_vol = volume->value*256; snd_p = (int *) paintbuffer; @@ -96,7 +96,7 @@ void S_TransferStereo16 (int endtime) { reps = 0; - while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, &pbuf, &dwSize, + while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, &pbuf, &dwSize, &pbuf2, &dwSize2, 0)) != DS_OK) { if (hresult != DSERR_BUFFERLOST) @@ -170,10 +170,10 @@ void S_TransferPaintBuffer(int endtime) S_TransferStereo16 (endtime); return; } - + p = (int *) paintbuffer; count = (endtime - paintedtime) * shm->channels; - out_mask = shm->samples - 1; + out_mask = shm->samples - 1; out_idx = paintedtime * shm->channels & out_mask; step = 3 - shm->channels; snd_vol = volume->value*256; @@ -183,7 +183,7 @@ void S_TransferPaintBuffer(int endtime) { reps = 0; - while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, &pbuf, &dwSize, + while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, &pbuf, &dwSize, &pbuf2,&dwSize2, 0)) != DS_OK) { if (hresult != DSERR_BUFFERLOST) @@ -245,7 +245,7 @@ void S_TransferPaintBuffer(int endtime) DWORD dwNewpos, dwWrite; int il = paintedtime; int ir = endtime - paintedtime; - + ir += il; pDSBuf->lpVtbl->Unlock(pDSBuf, pbuf, dwSize, NULL, 0); @@ -310,12 +310,12 @@ void S_PaintChannels(int endtime) count = end - ltime; if (count > 0) - { + { if (sc->width == 1) SND_PaintChannelFrom8(ch, sc, count); else SND_PaintChannelFrom16(ch, sc, count); - + ltime += count; } @@ -327,14 +327,14 @@ void S_PaintChannels(int endtime) ch->pos = sc->loopstart; ch->end = ltime + sc->length - ch->pos; } - else + else { // channel just stopped ch->sfx = NULL; break; } } } - + } // transfer out according to DMA format @@ -346,7 +346,7 @@ void S_PaintChannels(int endtime) void SND_InitScaletable (void) { int i, j; - + for (i=0 ; i<32 ; i++) for (j=0 ; j<256 ; j++) snd_scaletable[i][j] = ((signed char)j) * i * 8; @@ -366,7 +366,7 @@ void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count) ch->leftvol = 255; if (ch->rightvol > 255) ch->rightvol = 255; - + lscale = snd_scaletable[ch->leftvol >> 3]; rscale = snd_scaletable[ch->rightvol >> 3]; sfx = (signed char *)sc->data + ch->pos; @@ -377,7 +377,7 @@ void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count) paintbuffer[i].left += lscale[data]; paintbuffer[i].right += rscale[data]; } - + ch->pos += count; } diff --git a/common/snd_mme.c b/common/snd_mme.c index a97ade3..1acf4c3 100644 --- a/common/snd_mme.c +++ b/common/snd_mme.c @@ -9,7 +9,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. @@ -40,7 +40,7 @@ static int snd_sent, snd_completed; static HPSTR lpData; static LPWAVEHDR lpWaveHdr; -static HWAVEOUT hWaveOut; +static HWAVEOUT hWaveOut; static DWORD gSndBufSize; @@ -147,10 +147,10 @@ qboolean SNDDMA_InitWav (void) format->wf.nBlockAlign = format->wf.nChannels *format->wBitsPerSample / 8; format->wf.nAvgBytesPerSec = format->wf.nSamplesPerSec - *format->wf.nBlockAlign; - + *format->wf.nBlockAlign; + /* Open a waveform device for output using our callback function. */ - while ((hr = waveOutOpen((LPHWAVEOUT)&hWaveOut, WAVE_MAPPER, + while ((hr = waveOutOpen((LPHWAVEOUT)&hWaveOut, WAVE_MAPPER, (LPWAVEFORMAT)format, (void (*)())mme_callback, 0, CALLBACK_FUNCTION | WAVE_OPEN_SHAREABLE)) @@ -166,40 +166,40 @@ qboolean SNDDMA_InitWav (void) } mmeFreeMem(format); - /* - * Allocate and lock memory for the waveform data. The memory - * for waveform data must be globally allocated with - * GMEM_MOVEABLE and GMEM_SHARE flags. + /* + * Allocate and lock memory for the waveform data. The memory + * for waveform data must be globally allocated with + * GMEM_MOVEABLE and GMEM_SHARE flags. - */ + */ gSndBufSize = WAV_BUFFERS*WAV_BUFFER_SIZE; - lpData = mmeAllocBuffer(gSndBufSize); - if (!lpData) { + lpData = mmeAllocBuffer(gSndBufSize); + if (!lpData) { Con_SafePrintf ("Sound: Out of memory.\n"); FreeSound (); - return false; + return false; } memset (lpData, 0, gSndBufSize); - /* - * Allocate and lock memory for the header. This memory must - * also be globally allocated with GMEM_MOVEABLE and - * GMEM_SHARE flags. - */ + /* + * Allocate and lock memory for the header. This memory must + * also be globally allocated with GMEM_MOVEABLE and + * GMEM_SHARE flags. + */ lpWaveHdr = mmeAllocMem(sizeof(WAVEHDR) * WAV_BUFFERS); if (lpWaveHdr == NULL) - { + { Con_SafePrintf ("Sound: Failed to Alloc header.\n"); FreeSound (); - return false; - } + return false; + } memset (lpWaveHdr, 0, sizeof(WAVEHDR) * WAV_BUFFERS); - /* After allocation, set up and prepare headers. */ + /* After allocation, set up and prepare headers. */ for (i=0 ; idwBufferLength = WAV_BUFFER_SIZE; + h->dwBufferLength = WAV_BUFFER_SIZE; h->lpData = lpData + i*WAV_BUFFER_SIZE; snd_sent++; - /* - * Now the data block can be sent to the output device. The - * waveOutWrite function returns immediately and waveform - * data is sent to the output device in the background. - */ - wResult = waveOutWrite(hWaveOut, h, sizeof(WAVEHDR)); + /* + * Now the data block can be sent to the output device. The + * waveOutWrite function returns immediately and waveform + * data is sent to the output device in the background. + */ + wResult = waveOutWrite(hWaveOut, h, sizeof(WAVEHDR)); if (wResult != MMSYSERR_NOERROR) - { + { Con_SafePrintf ("Failed to write block to device\n"); FreeSound (); - return; + return; } } } diff --git a/common/snd_next.c b/common/snd_next.c index c7cea86..9754818 100644 --- a/common/snd_next.c +++ b/common/snd_next.c @@ -10,7 +10,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. @@ -48,7 +48,7 @@ qboolean SNDDMA_Init(void) int SNDDMA_GetDMAPos(void) { shm->samplepos = (int)(realtime*shm->speed*shm->channels) & (shm->samples-1); - + return shm->samplepos; } diff --git a/common/snd_null.c b/common/snd_null.c index acdb65f..f5754eb 100644 --- a/common/snd_null.c +++ b/common/snd_null.c @@ -10,7 +10,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. @@ -44,7 +44,7 @@ cvar_t *bgmvolume; //cvar_t volume = {"volume", "0.7", true}; cvar_t *volume; - + void S_Init (void) { } @@ -91,7 +91,7 @@ void S_ClearPrecache (void) } void S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up) -{ +{ } void S_StopAllSounds (qboolean clear) diff --git a/common/snd_oss.c b/common/snd_oss.c index 2658361..54116ff 100644 --- a/common/snd_oss.c +++ b/common/snd_oss.c @@ -10,7 +10,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. @@ -103,13 +103,13 @@ qboolean SNDDMA_Init(void) } if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info)==-1) - { + { perror("GETOSPACE"); Con_Printf("Um, can't do GETOSPACE?\n"); close(audio_fd); return 0; } - + shm = &sn; shm->splitbuffer = 0; @@ -152,7 +152,7 @@ qboolean SNDDMA_Init(void) shm->buffer = (unsigned char *) mmap(NULL, info.fragstotal * info.fragsize, PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0); - + if (shm->buffer == MAP_FAILED) { perror("/dev/dsp"); diff --git a/common/snd_sun.c b/common/snd_sun.c index c4bfc66..4b5f5ea 100644 --- a/common/snd_sun.c +++ b/common/snd_sun.c @@ -10,7 +10,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. diff --git a/common/snd_win.c b/common/snd_win.c index 9d6de84..86f6f8c 100644 --- a/common/snd_win.c +++ b/common/snd_win.c @@ -10,7 +10,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. @@ -59,10 +59,10 @@ static int sample16; static int snd_sent, snd_completed; -/* - * Global variables. Must be visible to window-procedure function - * so it can unlock and free the data block after it has been played. - */ +/* + * Global variables. Must be visible to window-procedure function + * so it can unlock and free the data block after it has been played. + */ HANDLE hData; HPSTR lpData, lpData2; @@ -70,7 +70,7 @@ HPSTR lpData, lpData2; HGLOBAL hWaveHdr; LPWAVEHDR lpWaveHdr; -HWAVEOUT hWaveOut; +HWAVEOUT hWaveOut; WAVEOUTCAPS wavecaps; @@ -167,7 +167,7 @@ void FreeSound (void) if (hWaveHdr) { - GlobalUnlock(hWaveHdr); + GlobalUnlock(hWaveHdr); GlobalFree(hWaveHdr); } @@ -208,7 +208,7 @@ sndinitstat SNDDMA_InitDirect (void) DSBCAPS dsbcaps; DWORD dwSize, dwWrite; DSCAPS dscaps; - WAVEFORMATEX format, pformat; + WAVEFORMATEX format, pformat; HRESULT hresult; int reps; @@ -229,12 +229,12 @@ sndinitstat SNDDMA_InitDirect (void) *format.wBitsPerSample / 8; format.cbSize = 0; format.nAvgBytesPerSec = format.nSamplesPerSec - *format.nBlockAlign; + *format.nBlockAlign; if (!hInstDS) { hInstDS = LoadLibrary("dsound.dll"); - + if (hInstDS == NULL) { Con_SafePrintf ("Couldn't load dsound.dll\n"); @@ -363,7 +363,7 @@ sndinitstat SNDDMA_InitDirect (void) { // Removed the option for -primarysound // -- Robert S. Elsner -#if 0 +#if 0 if (DS_OK != pDS->lpVtbl->SetCooperativeLevel (pDS, mainwindow, DSSCL_WRITEPRIMARY)) { Con_SafePrintf ("Set coop level failed\n"); @@ -390,7 +390,7 @@ sndinitstat SNDDMA_InitDirect (void) " %d bits/sample\n" " %d bytes/sec\n", shm->channels, shm->samplebits, shm->speed);*/ - + gSndBufSize = dsbcaps.dwBufferBytes; // initialize the buffer @@ -420,7 +420,7 @@ sndinitstat SNDDMA_InitDirect (void) pDSBuf->lpVtbl->Unlock(pDSBuf, lpData, dwSize, NULL, 0); /* we don't want anyone to access the buffer directly w/o locking it first. */ - lpData = NULL; + lpData = NULL; pDSBuf->lpVtbl->Stop(pDSBuf); pDSBuf->lpVtbl->GetCurrentPosition(pDSBuf, &mmstarttime.u.sample, &dwWrite); @@ -450,10 +450,10 @@ Crappy windows multimedia base */ qboolean SNDDMA_InitWav (void) { - WAVEFORMATEX format; + WAVEFORMATEX format; int i; HRESULT hr; - + snd_sent = 0; snd_completed = 0; @@ -472,11 +472,11 @@ qboolean SNDDMA_InitWav (void) *format.wBitsPerSample / 8; format.cbSize = 0; format.nAvgBytesPerSec = format.nSamplesPerSec - *format.nBlockAlign; - - /* Open a waveform device for output using window callback. */ - while ((hr = waveOutOpen((LPHWAVEOUT)&hWaveOut, WAVE_MAPPER, - &format, + *format.nBlockAlign; + + /* Open a waveform device for output using window callback. */ + while ((hr = waveOutOpen((LPHWAVEOUT)&hWaveOut, WAVE_MAPPER, + &format, 0, 0L, CALLBACK_NULL)) != MMSYSERR_NOERROR) { if (hr != MMSYSERR_ALLOCATED) @@ -495,61 +495,61 @@ qboolean SNDDMA_InitWav (void) " hardware already in use\n"); return false; } - } + } - /* - * Allocate and lock memory for the waveform data. The memory - * for waveform data must be globally allocated with - * GMEM_MOVEABLE and GMEM_SHARE flags. + /* + * Allocate and lock memory for the waveform data. The memory + * for waveform data must be globally allocated with + * GMEM_MOVEABLE and GMEM_SHARE flags. - */ + */ gSndBufSize = WAV_BUFFERS*WAV_BUFFER_SIZE; - hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, gSndBufSize); - if (!hData) - { + hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, gSndBufSize); + if (!hData) + { Con_SafePrintf ("Sound: Out of memory.\n"); FreeSound (); - return false; + return false; } lpData = GlobalLock(hData); if (!lpData) - { + { Con_SafePrintf ("Sound: Failed to lock.\n"); FreeSound (); - return false; - } + return false; + } memset (lpData, 0, gSndBufSize); - /* - * Allocate and lock memory for the header. This memory must - * also be globally allocated with GMEM_MOVEABLE and - * GMEM_SHARE flags. - */ - hWaveHdr = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, - (DWORD) sizeof(WAVEHDR) * WAV_BUFFERS); + /* + * Allocate and lock memory for the header. This memory must + * also be globally allocated with GMEM_MOVEABLE and + * GMEM_SHARE flags. + */ + hWaveHdr = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, + (DWORD) sizeof(WAVEHDR) * WAV_BUFFERS); if (hWaveHdr == NULL) - { + { Con_SafePrintf ("Sound: Failed to Alloc header.\n"); FreeSound (); - return false; - } + return false; + } - lpWaveHdr = (LPWAVEHDR) GlobalLock(hWaveHdr); + lpWaveHdr = (LPWAVEHDR) GlobalLock(hWaveHdr); if (lpWaveHdr == NULL) - { + { Con_SafePrintf ("Sound: Failed to lock header.\n"); FreeSound (); - return false; + return false; } memset (lpWaveHdr, 0, sizeof(WAVEHDR) * WAV_BUFFERS); - /* After allocation, set up and prepare headers. */ + /* After allocation, set up and prepare headers. */ for (i=0 ; ilpVtbl->GetCurrentPosition(pDSBuf, &mmtime.u.sample, &dwWrite); @@ -731,19 +731,19 @@ void SNDDMA_Submit(void) h = lpWaveHdr + ( snd_sent&WAV_MASK ); snd_sent++; - /* - * Now the data block can be sent to the output device. The - * waveOutWrite function returns immediately and waveform - * data is sent to the output device in the background. - */ - wResult = waveOutWrite(hWaveOut, h, sizeof(WAVEHDR)); + /* + * Now the data block can be sent to the output device. The + * waveOutWrite function returns immediately and waveform + * data is sent to the output device in the background. + */ + wResult = waveOutWrite(hWaveOut, h, sizeof(WAVEHDR)); if (wResult != MMSYSERR_NOERROR) - { + { Con_SafePrintf ("Failed to write block to device\n"); FreeSound (); - return; - } + return; + } } } diff --git a/common/sound.h b/common/sound.h index 118cdc5..d6ee797 100644 --- a/common/sound.h +++ b/common/sound.h @@ -11,7 +11,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. diff --git a/common/spritegn.h b/common/spritegn.h index d880db2..5f0ae7d 100644 --- a/common/spritegn.h +++ b/common/spritegn.h @@ -10,7 +10,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. diff --git a/common/sw_rpart.c b/common/sw_rpart.c index b026367..4932345 100644 --- a/common/sw_rpart.c +++ b/common/sw_rpart.c @@ -11,7 +11,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. @@ -56,7 +56,7 @@ void R_DrawParticles (void) #else frametime = cl.time - cl.oldtime; #endif - + time3 = frametime * 15; time2 = frametime * 10; // 15; time1 = frametime * 5; @@ -66,8 +66,8 @@ void R_DrawParticles (void) grav = frametime * sv_gravity->value * 0.05; #endif dvel = 4*frametime; - - for ( ;; ) + + for ( ;; ) { kill = active_particles; if (kill && kill->die < cl.time) @@ -100,7 +100,7 @@ void R_DrawParticles (void) p->org[0] += p->vel[0]*frametime; p->org[1] += p->vel[1]*frametime; p->org[2] += p->vel[2]*frametime; - + switch (p->type) { case pt_static: diff --git a/common/sw_view.c b/common/sw_view.c index 391931a..8da3f8f 100644 --- a/common/sw_view.c +++ b/common/sw_view.c @@ -10,7 +10,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. @@ -43,9 +43,9 @@ void V_UpdatePalette (void) qboolean force; V_CalcPowerupCshift (); - + new = false; - + for (i=0 ; i>8; g += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[1]-g))>>8; b += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[2]-b))>>8; } - + newpal[0] = gammatable[r]; newpal[1] = gammatable[g]; newpal[2] = gammatable[b]; newpal += 3; } - VID_ShiftPalette (pal); + VID_ShiftPalette (pal); } diff --git a/common/sys.h b/common/sys.h index c67a926..1cb04e2 100644 --- a/common/sys.h +++ b/common/sys.h @@ -10,7 +10,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. diff --git a/common/sys_common.c b/common/sys_common.c index fae4d36..648ea68 100644 --- a/common/sys_common.c +++ b/common/sys_common.c @@ -14,7 +14,7 @@ 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. @@ -53,10 +53,10 @@ cvar_t *sys_nostdout; char trans_table[256] = { '\0', '#', '#', '#', '#', '.', '#', '#', '#', 9, 10, '#', ' ', 13, '.', -'.', '[', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '<', +'.', '[', ']', '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', +'-', '.', '/', '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', @@ -133,14 +133,14 @@ int Sys_FileTime (char *path) int ret = -1; #ifdef HAVE_STAT struct stat buf; - + if (stat(path, &buf) == 0) ret = buf.st_mtime; #else /* HAVE_STAT */ QFile *f; #if defined(_WIN32) && !defined(SERVERONLY) int t = VID_ForceUnlockedAndReturnState(); #endif - + f = fopen(path, "rb"); if (f) { fclose(f); @@ -213,7 +213,7 @@ double Sys_DoubleTime(void) #endif if (!starttime) starttime = secs; - + return (secs - starttime) + usecs/1000000.0; } diff --git a/common/sys_linux.c b/common/sys_linux.c index 6a08024..769e2d0 100644 --- a/common/sys_linux.c +++ b/common/sys_linux.c @@ -1,8 +1,8 @@ /* sys_linux.c - + Linux-style Unix system driver. - + Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1999,2000 contributors of the QuakeForge project Portions Copyright (C) 1999,2000 Nelson Rush. @@ -12,13 +12,13 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, @@ -100,7 +100,7 @@ Sys_Error(char *error, ...) Host_Shutdown (); exit (1); -} +} void @@ -167,12 +167,12 @@ int Sys_FileRead (int handle, void *dest, int count) { void Sys_DebugLog(char *file, char *fmt, ...) { - va_list argptr; + va_list argptr; static char data[1024]; QFile *stream; unsigned char *p; //int fd; - + va_start(argptr, fmt); vsnprintf(data, sizeof(data), fmt, argptr); va_end(argptr); @@ -188,7 +188,7 @@ void Sys_DebugLog(char *file, char *fmt, ...) { close(fd); */ } -/* +/* This function isn't used. void Sys_EditFile(char *filename) { @@ -241,7 +241,7 @@ char *Sys_ConsoleInput(void) { timeout.tv_usec = 0; if (select (1, &fdset, NULL, NULL, &timeout) == -1 || !FD_ISSET(0, &fdset)) return NULL; - + len = read (0, text, sizeof(text)); if (len < 1) return NULL; diff --git a/common/sys_null.c b/common/sys_null.c index d772896..9e8c59d 100644 --- a/common/sys_null.c +++ b/common/sys_null.c @@ -10,7 +10,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. @@ -34,7 +34,7 @@ QFile *sys_handles[MAX_HANDLES]; int findhandle (void) { int i; - + for (i=1 ; i Date: 01 Jan 2000 - + This file is part of the QuakeForge utility library. - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/common/unzip.c b/common/unzip.c index ef98ddc..7752a31 100644 --- a/common/unzip.c +++ b/common/unzip.c @@ -1,4 +1,4 @@ -/* unzip.c -- IO on .zip files using zlib +/* unzip.c -- IO on .zip files using zlib Version 0.15 beta, Mar 19th, 1998, Read unzip.h for more info @@ -43,7 +43,7 @@ #ifndef UNZ_MAXFILENAMEINZIP #define UNZ_MAXFILENAMEINZIP (256) #endif -#endif +#endif #ifndef ALLOC # define ALLOC(size) (malloc(size)) @@ -147,7 +147,7 @@ local int unzlocal_getByte(fin,pi) } else { - if (ferror(fin)) + if (ferror(fin)) return UNZ_ERRNO; else return UNZ_EOF; @@ -156,7 +156,7 @@ local int unzlocal_getByte(fin,pi) /* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets + Reads a long in LSB order from the given gz_stream. Sets */ local int unzlocal_getShort (fin,pX) FILE* fin; @@ -168,11 +168,11 @@ local int unzlocal_getShort (fin,pX) err = unzlocal_getByte(fin,&i); x = (uLong)i; - + if (err==UNZ_OK) err = unzlocal_getByte(fin,&i); x += ((uLong)i)<<8; - + if (err==UNZ_OK) *pX = x; else @@ -190,7 +190,7 @@ local int unzlocal_getLong (fin,pX) err = unzlocal_getByte(fin,&i); x = (uLong)i; - + if (err==UNZ_OK) err = unzlocal_getByte(fin,&i); x += ((uLong)i)<<8; @@ -202,7 +202,7 @@ local int unzlocal_getLong (fin,pX) if (err==UNZ_OK) err = unzlocal_getByte(fin,&i); x += ((uLong)i)<<24; - + if (err==UNZ_OK) *pX = x; else @@ -246,7 +246,7 @@ local int strcmpcasenosensitive_internal (fileName1,fileName2) #define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal #endif -/* +/* Compare two filename (fileName1,fileName2). If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi @@ -267,7 +267,7 @@ extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivit return strcmp(fileName1,fileName2); return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); -} +} #define BUFREADCOMMENT (0x400) @@ -283,13 +283,13 @@ local uLong unzlocal_SearchCentralDir(fin) uLong uBackRead; uLong uMaxBack=0xffff; /* maximum size of global comment */ uLong uPosFound=0; - + if (fseek(fin,0,SEEK_END) != 0) return 0; uSizeFile = ftell( fin ); - + if (uMaxBack>uSizeFile) uMaxBack = uSizeFile; @@ -302,13 +302,13 @@ local uLong unzlocal_SearchCentralDir(fin) { uLong uReadSize,uReadPos ; int i; - if (uBackRead+BUFREADCOMMENT>uMaxBack) + if (uBackRead+BUFREADCOMMENT>uMaxBack) uBackRead = uMaxBack; else uBackRead+=BUFREADCOMMENT; uReadPos = uSizeFile-uBackRead ; - - uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? + + uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? (BUFREADCOMMENT+4) : (uSizeFile-uReadPos); if (fseek(fin,uReadPos,SEEK_SET)!=0) break; @@ -317,7 +317,7 @@ local uLong unzlocal_SearchCentralDir(fin) break; for (i=(int)uReadSize-3; (i--)>0;) - if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && + if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) { uPosFound = uReadPos+i; @@ -348,12 +348,12 @@ extern unzFile ZEXPORT unzOpen (path) uLong central_pos,uL; FILE * fin ; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current dist, used for spaning ZIP, unsupported, always 0*/ uLong number_disk_with_CD; /* number the the disk with central dir, used for spaning ZIP, unsupported, always 0*/ uLong number_entry_CD; /* total number of entries in - the central dir + the central dir (same than number_entry on nospan) */ int err=UNZ_OK; @@ -401,7 +401,7 @@ extern unzFile ZEXPORT unzOpen (path) if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK) err=UNZ_ERRNO; - /* offset of start of central directory with respect to the + /* offset of start of central directory with respect to the starting disk number */ if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK) err=UNZ_ERRNO; @@ -410,7 +410,7 @@ extern unzFile ZEXPORT unzOpen (path) if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK) err=UNZ_ERRNO; - if ((central_posfile,lSeek,SEEK_CUR)==0) lSeek=0; @@ -726,7 +726,7 @@ extern int ZEXPORT unzGoToFirstFile (file) extern int ZEXPORT unzGoToNextFile (file) unzFile file; { - unz_s* s; + unz_s* s; int err; if (file==NULL) @@ -761,10 +761,10 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) const char *szFileName; int iCaseSensitivity; { - unz_s* s; + unz_s* s; int err; - + uLong num_fileSaved; uLong pos_in_central_dirSaved; @@ -875,7 +875,7 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */ err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && + else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && ((uFlags & 8)==0)) err=UNZ_BADZIPFILE; @@ -897,7 +897,7 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, return err; } - + /* Open for reading data the current file in the zipfile. If there is no error and the file is opened, the return value is UNZ_OK. @@ -943,7 +943,7 @@ extern int ZEXPORT unzOpenCurrentFile (file) } pfile_in_zip_read_info->stream_initialised=0; - + if ((s->cur_file_info.compression_method!=0) && (s->cur_file_info.compression_method!=Z_DEFLATED)) err=UNZ_BADZIPFILE; @@ -962,29 +962,29 @@ extern int ZEXPORT unzOpenCurrentFile (file) { pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; pfile_in_zip_read_info->stream.zfree = (free_func)0; - pfile_in_zip_read_info->stream.opaque = (voidpf)0; - + pfile_in_zip_read_info->stream.opaque = (voidpf)0; + err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); if (err == Z_OK) pfile_in_zip_read_info->stream_initialised=1; /* windowBits is passed < 0 to tell that there is no zlib header. * Note that in this case inflate *requires* an extra "dummy" byte * after the compressed stream in order to complete decompression and - * return Z_STREAM_END. - * In unzip, i don't wait absolutely Z_STREAM_END because I known the + * return Z_STREAM_END. + * In unzip, i don't wait absolutely Z_STREAM_END because I known the * size of both compressed and uncompressed data */ } - pfile_in_zip_read_info->rest_read_compressed = + pfile_in_zip_read_info->rest_read_compressed = s->cur_file_info.compressed_size ; - pfile_in_zip_read_info->rest_read_uncompressed = + pfile_in_zip_read_info->rest_read_uncompressed = s->cur_file_info.uncompressed_size ; - - pfile_in_zip_read_info->pos_in_zipfile = - s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + + + pfile_in_zip_read_info->pos_in_zipfile = + s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + iSizeVar; - + pfile_in_zip_read_info->stream.avail_in = (uInt)0; @@ -1029,9 +1029,9 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) pfile_in_zip_read_info->stream.next_out = (Bytef*)buf; pfile_in_zip_read_info->stream.avail_out = (uInt)len; - + if (len>pfile_in_zip_read_info->rest_read_uncompressed) - pfile_in_zip_read_info->stream.avail_out = + pfile_in_zip_read_info->stream.avail_out = (uInt)pfile_in_zip_read_info->rest_read_uncompressed; while (pfile_in_zip_read_info->stream.avail_out>0) @@ -1045,7 +1045,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) if (uReadThis == 0) return UNZ_EOF; if (fseek(pfile_in_zip_read_info->file, - pfile_in_zip_read_info->pos_in_zipfile + + pfile_in_zip_read_info->pos_in_zipfile + pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0) return UNZ_ERRNO; if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1, @@ -1054,8 +1054,8 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) pfile_in_zip_read_info->pos_in_zipfile += uReadThis; pfile_in_zip_read_info->rest_read_compressed-=uReadThis; - - pfile_in_zip_read_info->stream.next_in = + + pfile_in_zip_read_info->stream.next_in = (Bytef*)pfile_in_zip_read_info->read_buffer; pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; } @@ -1063,16 +1063,16 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) if (pfile_in_zip_read_info->compression_method==0) { uInt uDoCopy,i ; - if (pfile_in_zip_read_info->stream.avail_out < + if (pfile_in_zip_read_info->stream.avail_out < pfile_in_zip_read_info->stream.avail_in) uDoCopy = pfile_in_zip_read_info->stream.avail_out ; else uDoCopy = pfile_in_zip_read_info->stream.avail_in ; - + for (i=0;istream.next_out+i) = *(pfile_in_zip_read_info->stream.next_in+i); - + pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, pfile_in_zip_read_info->stream.next_out, uDoCopy); @@ -1104,8 +1104,8 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; uOutThis = uTotalOutAfter-uTotalOutBefore; - - pfile_in_zip_read_info->crc32 = + + pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,bufBefore, (uInt)(uOutThis)); @@ -1113,10 +1113,10 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) uOutThis; iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); - + if (err==Z_STREAM_END) return (iRead==0) ? UNZ_EOF : iRead; - if (err!=Z_OK) + if (err!=Z_OK) break; } } @@ -1148,7 +1148,7 @@ extern z_off_t ZEXPORT unztell (file) /* - return 1 if the end of file was reached, 0 elsewhere + return 1 if the end of file was reached, 0 elsewhere */ extern int ZEXPORT unzeof (file) unzFile file; @@ -1162,7 +1162,7 @@ extern int ZEXPORT unzeof (file) if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; - + if (pfile_in_zip_read_info->rest_read_uncompressed == 0) return 1; else @@ -1180,7 +1180,7 @@ extern int ZEXPORT unzeof (file) if buf!=NULL, len is the size of the buffer, the extra header is copied in buf. - the return value is the number of bytes copied in buf, or (if <0) + the return value is the number of bytes copied in buf, or (if <0) the error code */ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len) @@ -1201,12 +1201,12 @@ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len) if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; - size_to_read = (pfile_in_zip_read_info->size_local_extrafield - + size_to_read = (pfile_in_zip_read_info->size_local_extrafield - pfile_in_zip_read_info->pos_local_extrafield); if (buf==NULL) return (int)size_to_read; - + if (len>size_to_read) read_now = (uInt)size_to_read; else @@ -1214,9 +1214,9 @@ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len) if (read_now==0) return 0; - + if (fseek(pfile_in_zip_read_info->file, - pfile_in_zip_read_info->offset_local_extrafield + + pfile_in_zip_read_info->offset_local_extrafield + pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0) return UNZ_ERRNO; diff --git a/common/unzip.h b/common/unzip.h index b790b74..3c8f896 100644 --- a/common/unzip.h +++ b/common/unzip.h @@ -1,4 +1,4 @@ -/* unzip.h -- IO for uncompress .zip files using zlib +/* unzip.h -- IO for uncompress .zip files using zlib Version 0.15 beta, Mar 19th, 1998, Copyright (C) 1998 Gilles Vollant @@ -33,7 +33,7 @@ */ -/* for more info about .ZIP format, see +/* for more info about .ZIP format, see ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip PkWare has also a specification at : ftp://ftp.pkware.com/probdesc.zip */ @@ -49,7 +49,7 @@ extern "C" { #include #endif -#ifndef UNZ_BUFSIZE +#ifndef UNZ_BUFSIZE #define UNZ_BUFSIZE (16384) #endif @@ -60,7 +60,7 @@ extern "C" { #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) /* like the STRICT of WIN32, we define a pointer that cannot be converted from (void*) without cast */ -typedef struct TagunzFile__ { int unused; } unzFile__; +typedef struct TagunzFile__ { int unused; } unzFile__; typedef unzFile__ *unzFile; #else typedef voidp unzFile; @@ -77,7 +77,7 @@ typedef voidp unzFile; #define UNZ_CRCERROR (-105) /* tm_unz contain date/time info */ -typedef struct tm_unz_s +typedef struct tm_unz_s { uInt tm_sec; /* seconds after the minute - [0,59] */ uInt tm_min; /* minutes after the hour - [0,59] */ @@ -106,8 +106,8 @@ typedef struct unz_file_info_s uLong compression_method; /* compression method 2 bytes */ uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ uLong crc; /* crc-32 4 bytes */ - uLong compressed_size; /* compressed size 4 bytes */ - uLong uncompressed_size; /* uncompressed size 4 bytes */ + uLong compressed_size; /* compressed size 4 bytes */ + uLong uncompressed_size; /* uncompressed size 4 bytes */ uLong size_filename; /* filename length 2 bytes */ uLong size_file_extra; /* extra field length 2 bytes */ uLong size_file_comment; /* file comment length 2 bytes */ @@ -184,7 +184,7 @@ extern int ZEXPORT unzGoToNextFile OF((unzFile file)); return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. */ -extern int ZEXPORT unzLocateFile OF((unzFile file, +extern int ZEXPORT unzLocateFile OF((unzFile file, const char *szFileName, int iCaseSensitivity)); /* @@ -235,8 +235,8 @@ extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); Return UNZ_CRCERROR if all the file was read but the CRC is not good */ - -extern int ZEXPORT unzReadCurrentFile OF((unzFile file, + +extern int ZEXPORT unzReadCurrentFile OF((unzFile file, voidp buf, unsigned len)); /* @@ -257,7 +257,7 @@ extern z_off_t ZEXPORT unztell OF((unzFile file)); extern int ZEXPORT unzeof OF((unzFile file)); /* - return 1 if the end of file was reached, 0 elsewhere + return 1 if the end of file was reached, 0 elsewhere */ extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, @@ -272,7 +272,7 @@ extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, if buf!=NULL, len is the size of the buffer, the extra header is copied in buf. - the return value is the number of bytes copied in buf, or (if <0) + the return value is the number of bytes copied in buf, or (if <0) the error code */ diff --git a/common/vgamodes.h b/common/vgamodes.h index b8106cd..e7aa8d4 100644 --- a/common/vgamodes.h +++ b/common/vgamodes.h @@ -10,7 +10,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. @@ -538,14 +538,14 @@ vmode_t vgavidmodes[] = { NULL, "360x200", NULL, 360, 200, (200.0/360.0)*(320.0/240.0), 384, 1, 1, &extra360x200x256planar, VGA_InitMode, - VGA_SwapBuffers, + VGA_SwapBuffers, VGA_SetPalette, VGA_BeginDirectRect, VGA_EndDirectRect }, { NULL, "320x240", NULL, 320, 240, (240.0/320.0)*(320.0/240.0), 320, 1, 1, &extra320x240x256planar, VGA_InitMode, - VGA_SwapBuffers, + VGA_SwapBuffers, VGA_SetPalette, VGA_BeginDirectRect, VGA_EndDirectRect }, { @@ -559,42 +559,42 @@ vmode_t vgavidmodes[] = { NULL, "320x350", NULL, 320, 350, (350.0/320.0)*(320.0/240.0), 320, 1, 1, &extra320x350x256planar, VGA_InitMode, - VGA_SwapBuffers, + VGA_SwapBuffers, VGA_SetPalette, VGA_BeginDirectRect, VGA_EndDirectRect }, { NULL, "360x350", NULL, 360, 350, (350.0/360.0)*(320.0/240.0), 384, 1, 1, &extra360x350x256planar, VGA_InitMode, - VGA_SwapBuffers, + VGA_SwapBuffers, VGA_SetPalette, VGA_BeginDirectRect, VGA_EndDirectRect }, { NULL, "320x400", NULL, 320, 400, (400.0/320.0)*(320.0/240.0), 320, 1, 1, &extra320x400x256planar, VGA_InitMode, - VGA_SwapBuffers, + VGA_SwapBuffers, VGA_SetPalette, VGA_BeginDirectRect, VGA_EndDirectRect }, { NULL, "360x400", NULL, 360, 400, (400.0/360.0)*(320.0/240.0), 384, 1, 1, &extra360x400x256planar, VGA_InitMode, - VGA_SwapBuffers, + VGA_SwapBuffers, VGA_SetPalette, VGA_BeginDirectRect, VGA_EndDirectRect }, { NULL, "320x480", NULL, 320, 480, (480.0/320.0)*(320.0/240.0), 320, 1, 1, &extra320x480x256planar, VGA_InitMode, - VGA_SwapBuffers, + VGA_SwapBuffers, VGA_SetPalette, VGA_BeginDirectRect, VGA_EndDirectRect }, { NULL, "360x480", NULL, 360, 480, (480.0/360.0)*(320.0/240.0), 384, 1, 1, &extra360x480x256planar, VGA_InitMode, - VGA_SwapBuffers, + VGA_SwapBuffers, VGA_SetPalette, VGA_BeginDirectRect, VGA_EndDirectRect }, }; diff --git a/common/vid.h b/common/vid.h index 9902bab..2f5fb30 100644 --- a/common/vid.h +++ b/common/vid.h @@ -10,7 +10,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. @@ -41,7 +41,7 @@ typedef struct unsigned short *colormap16; // 256 * VID_GRADES size int fullbright; // index of first fullbright color unsigned rowbytes; // may be > width if displayed in a window - unsigned width; + unsigned width; unsigned height; float aspect; // width / height -- < 0 is taller than wide int numpages; diff --git a/common/vid_aa.c b/common/vid_aa.c index 6c94154..32bddc2 100644 --- a/common/vid_aa.c +++ b/common/vid_aa.c @@ -12,7 +12,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. @@ -50,7 +50,7 @@ static int UseDisplay = 1; static cvar_t *vid_mode; static cvar_t *vid_redrawfull; static cvar_t *vid_waitforrefresh; - + static char *framebuffer_ptr; static byte backingbuf[48*24]; @@ -179,7 +179,7 @@ D_EndDirectRect (int x, int y, int width, int height) vidpage=offset / 0x10000; aa_setpage(); } - memcpy (vid.direct + off, + memcpy (vid.direct + off, &backingbuf[(i +j)*24], width); } } @@ -305,7 +305,7 @@ VID_SetMode(int modenum, unsigned char *palette) vid.conwidth = vid.width; vid.conheight = vid.height; vid.numpages = 1; - + vid.maxwarpwidth = WARP_WIDTH; vid.maxwarpheight = WARP_HEIGHT; @@ -388,7 +388,7 @@ VID_Init(unsigned char *palette) vid_redrawfull = Cvar_Get ("vid_redrawfull","0",0,"None"); vid_waitforrefresh = Cvar_Get ("vid_waitforrefresh","0", CVAR_ARCHIVE,"None"); - + Cmd_AddCommand("vid_nummodes", VID_NumModes_f); Cmd_AddCommand("vid_describemode", VID_DescribeMode_f); Cmd_AddCommand("vid_describemodes", VID_DescribeModes_f); @@ -424,7 +424,7 @@ VID_Init(unsigned char *palette) } -void +void VID_Update(vrect_t *rects) { int ycount; @@ -438,22 +438,22 @@ VID_Update(vrect_t *rects) offset = rects->y * vid.rowbytes + rects->x; while (ycount--) { register int i = offset % 0x10000; - + if ((offset / 0x10000) != vidpage) { vidpage=offset / 0x10000; aa_setpage(); } if (rects->width + i > 0x10000) { - memcpy(framebuffer_ptr + i, - vid.buffer + offset, + memcpy(framebuffer_ptr + i, + vid.buffer + offset, 0x10000 - i); aa_setpage(); memcpy(framebuffer_ptr, - vid.buffer + offset + 0x10000 - i, + vid.buffer + offset + 0x10000 - i, rects->width - 0x10000 + i); } else { - memcpy(framebuffer_ptr + i, - vid.buffer + offset, + memcpy(framebuffer_ptr + i, + vid.buffer + offset, rects->width); } offset += vid.rowbytes; @@ -461,7 +461,7 @@ VID_Update(vrect_t *rects) rects = rects->pnext; } } - + if (vid_mode->value != current_mode) { VID_SetMode ((int)vid_mode->value, vid_current_palette); } diff --git a/common/vid_dos.c b/common/vid_dos.c index cac24e4..9023682 100644 --- a/common/vid_dos.c +++ b/common/vid_dos.c @@ -11,7 +11,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. @@ -115,7 +115,7 @@ void VID_Init (unsigned char *palette) vid_windowed_mode = Cvar_Get ("vid_windowed_mode","0",CVAR_ARCHIVE, "None"); block_switch = Cvar_Get ("block_switch","0",CVAR_ARCHIVE,"None"); - + Cmd_AddCommand ("vid_testmode", VID_TestMode_f); Cmd_AddCommand ("vid_nummodes", VID_NumModes_f); Cmd_AddCommand ("vid_describecurrentmode", VID_DescribeCurrentMode_f); @@ -136,7 +136,7 @@ void VID_Init (unsigned char *palette) VID_SetMode (vid_modenum, palette); vid_realmode = vid_modenum; - + vid_menudrawfn = VID_MenuDraw; vid_menukeyfn = VID_MenuKey; } @@ -205,7 +205,7 @@ char *VID_ModeInfo (int modenum, char **ppheader) /* ================ -VID_SetMode +VID_SetMode ================ */ int VID_SetMode (int modenum, unsigned char *palette) @@ -410,7 +410,7 @@ VID_DescribeMode_f void VID_DescribeMode_f (void) { int modenum; - + modenum = Q_atoi (Cmd_Argv(1)); Con_Printf ("%s\n", VID_ModeInfo (modenum, NULL)); @@ -593,7 +593,7 @@ void VID_MenuDraw (void) vid_wmodes = 0; nummodes = VID_NumModes (); - + for (i=0 ; ivalue != VID_WAIT_VSYNC) { if ((vid_wait->value == VID_WAIT_DISPLAY_ENABLE) && de_exists) VID_ExtraWaitDisplayEnable (); - + regs.x.bx = VESA_DONT_WAIT_VSYNC; } else @@ -746,11 +746,11 @@ void VID_ExtraSwapBuffers (viddef_t *lvid, vmode_t *pcurrentmode, regs.x.cx = pageoffset % VGA_rowbytes; regs.x.dx = pageoffset / VGA_rowbytes; dos_int86(0x10); - + VID_displayedpage = VID_currentpage; if (++VID_currentpage >= lvid->numpages) VID_currentpage = 0; - + // // set the new write window if this is a banked mode; otherwise, set the // new address to which to write @@ -769,7 +769,7 @@ void VID_ExtraSwapBuffers (viddef_t *lvid, vmode_t *pcurrentmode, lvid->buffer = VID_membase + VID_pagelist[VID_currentpage]; lvid->conbuffer = lvid->buffer; } - + VGA_pagebase = lvid->buffer; } else diff --git a/common/vid_ggi.c b/common/vid_ggi.c index 7188137..4fbd06b 100644 --- a/common/vid_ggi.c +++ b/common/vid_ggi.c @@ -10,7 +10,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. @@ -150,7 +150,7 @@ do_copy8(int xsize, int ysize, uint8 *dest, uint8 *src) { int i, j; uint8 *palptr = palette; - + for (j = 0; j < ysize; j++) { for (i = 0; i < xsize; i++) { dest[i] = palptr[src[i]]; @@ -166,7 +166,7 @@ do_copy16(int xsize, int ysize, void *destptr, uint8 *src) int i, j, destinc = (stride/2 - xsize)/2; uint16 *palptr = palette; uint32 *dest = destptr; - + for (j = 0; j < ysize; j++) { for (i = 0; i < xsize; /* i is incremented below */) { register uint32 pixel = palptr[src[i++]]; @@ -186,7 +186,7 @@ do_copy32(int xsize, int ysize, uint32 *dest, uint8 *src) { int i, j, destinc = stride/4; uint32 *palptr = palette; - + for (j = 0; j < ysize; j++) { for (i = 0; i < xsize; i++) { dest[i] = palptr[src[i]]; @@ -394,7 +394,7 @@ void VID_Init(unsigned char *pal) if (!usedbuf) { if ((drawptr = malloc(vid.width * vid.height)) == NULL) { - Sys_Error("VID: Unable to allocate draw buffer\n"); + Sys_Error("VID: Unable to allocate draw buffer\n"); } if (!havedbuf && (scale || palette)) { int linesize = pixelsize*realwidth; @@ -803,7 +803,7 @@ static void GetEvent(void) { ggi_event ev; uint32 b; - + ggiEventRead(ggivis, &ev, emAll); switch(ev.any.type) { case evKeyPress: @@ -850,7 +850,7 @@ static void GetEvent(void) } break; -#if 0 +#if 0 case ConfigureNotify: //printf("config notify\n"); config_notify_width = ev.xconfigure.width; @@ -905,7 +905,7 @@ void IN_Move(usercmd_t *cmd) { if (!mouse_avail) return; - + if (m_filter->value) { mouse_x = (mouse_x + old_mouse_x) * 0.5; mouse_y = (mouse_y + old_mouse_y) * 0.5; @@ -913,17 +913,17 @@ IN_Move(usercmd_t *cmd) old_mouse_x = mouse_x; old_mouse_y = mouse_y; - + mouse_x *= sensitivity->value; mouse_y *= sensitivity->value; - + if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) )) cmd->sidemove += m_side->value * mouse_x; else cl.viewangles[YAW] -= m_yaw->value * mouse_x; if (in_mlook.state & 1) V_StopPitchDrift (); - + if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) { cl.viewangles[PITCH] += m_pitch->value * mouse_y; if (cl.viewangles[PITCH] > 80) diff --git a/common/vid_null.c b/common/vid_null.c index 96db413..815a787 100644 --- a/common/vid_null.c +++ b/common/vid_null.c @@ -11,7 +11,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. @@ -57,7 +57,7 @@ void VID_Init (unsigned char *palette) vid.fullbright = 256 - LittleLong (*((int *)vid.colormap + 2048)); vid.buffer = vid.conbuffer = vid_buffer; vid.rowbytes = vid.conrowbytes = BASEWIDTH; - + d_pzbuffer = zbuffer; D_InitCaches (surfcache, sizeof(surfcache)); } diff --git a/common/vid_sdl.c b/common/vid_sdl.c index 9958f4f..2f3d50a 100644 --- a/common/vid_sdl.c +++ b/common/vid_sdl.c @@ -1,5 +1,5 @@ /* -vid_sdl.h - sdl video driver +vid_sdl.h - sdl video driver Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1999,2000 contributors of the QuakeForge project Please see the file "AUTHORS" for a list of contributors @@ -11,7 +11,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. @@ -117,7 +117,7 @@ void VID_Init (unsigned char *palette) if ( COM_CheckParm ("-fullscreen") ) flags |= SDL_FULLSCREEN; - // Initialize display + // Initialize display if (!(screen = SDL_SetVideoMode(vid.width, vid.height, 8, flags))) Sys_Error("VID: Couldn't set video mode: %s\n", SDL_GetError()); VID_SetPalette(palette); @@ -134,7 +134,7 @@ void VID_Init (unsigned char *palette) vid.conbuffer = vid.buffer; vid.conrowbytes = vid.rowbytes; vid.direct = 0; - + // allocate z buffer and surface cache chunk = vid.width * vid.height * sizeof (*d_pzbuffer); cachesize = D_SurfaceCacheForRes (vid.width, vid.height); @@ -143,7 +143,7 @@ void VID_Init (unsigned char *palette) if (d_pzbuffer == NULL) Sys_Error ("Not enough memory for video mode\n"); - // initialize the cache memory + // initialize the cache memory cache = (byte *) d_pzbuffer + vid.width * vid.height * sizeof (*d_pzbuffer); D_InitCaches (cache, cachesize); @@ -275,8 +275,8 @@ void Sys_SendKeyEvents(void) case SDLK_RALT: case SDLK_LALT: sym = K_ALT; break; case SDLK_CAPSLOCK: sym = K_CAPSLOCK; break; - case SDLK_KP0: - if(modstate & KMOD_NUM) sym = K_INS; + case SDLK_KP0: + if(modstate & KMOD_NUM) sym = K_INS; else sym = SDLK_0; break; case SDLK_KP1: @@ -369,7 +369,7 @@ void IN_Init (void) { _windowed_mouse = Cvar_Get ("_windowed_mouse","0",CVAR_ARCHIVE,"None"); - if ( COM_CheckParm("-nomouse") && !_windowed_mouse->value) + if ( COM_CheckParm("-nomouse") && !_windowed_mouse->value) return; mouse_x = mouse_y = 0.0; @@ -389,9 +389,9 @@ void IN_Frame(void) { int i; int mouse_buttonstate; - + if (!mouse_avail) return; - + i = SDL_GetMouseState(NULL, NULL); /* Quake swaps the second and third buttons */ mouse_buttonstate = (i & ~0x06) | ((i & 0x02)<<1) | ((i & 0x04)>>1); @@ -409,17 +409,17 @@ void IN_Move (usercmd_t *cmd) { if (!mouse_avail) return; - + mouse_x *= sensitivity->value; mouse_y *= sensitivity->value; - + if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) )) cmd->sidemove += m_side->value * mouse_x; else cl.viewangles[YAW] -= m_yaw->value * mouse_x; if (in_mlook.state & 1) V_StopPitchDrift (); - + if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) { cl.viewangles[PITCH] += m_pitch->value * mouse_y; if (cl.viewangles[PITCH] > 80) diff --git a/common/vid_sunx.c b/common/vid_sunx.c index eeba978..cf3a000 100644 --- a/common/vid_sunx.c +++ b/common/vid_sunx.c @@ -12,7 +12,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. @@ -348,7 +348,7 @@ void TragicDeath(int signal_num) static Cursor CreateNullCursor(Display *display, Window root) { - Pixmap cursormask; + Pixmap cursormask; XGCValues xgc; GC gc; XColor dummycolour; @@ -751,7 +751,7 @@ void VID_Init (unsigned char *palette) vid.aspect = ((float)vid.height / (float)vid.width) * (320.0 / 240.0); D_InitCaches (surfcache, sizeof(surfcache)); - + // XSynchronize(x_disp, False); IN_Init(); @@ -876,16 +876,16 @@ XLateKey(XKeyEvent *ev) case XK_Shift_L: case XK_Shift_R: key = K_SHIFT; break; - case XK_Execute: - case XK_Control_L: + case XK_Execute: + case XK_Control_L: case XK_Control_R: key = K_CTRL; break; case XK_Mode_switch: - case XK_Alt_L: - case XK_Meta_L: - case XK_Alt_R: + case XK_Alt_L: + case XK_Meta_L: + case XK_Alt_R: case XK_Meta_R: key = K_ALT; break; - + case XK_Caps_Lock: key = K_CAPSLOCK; break; case XK_KP_Begin: key = K_AUX30; break; @@ -931,7 +931,7 @@ XLateKey(XKeyEvent *ev) key = key + ('a' - 'A'); } break; - } + } return key; } @@ -985,7 +985,7 @@ GetEvent(void) if (mouse_avail && mouse_grabbed) { mouse_x = (float) ((int)x_event.xmotion.x - (int)(vid.width/2)); mouse_y = (float) ((int)x_event.xmotion.y - (int)(vid.height/2)); - //printf("m: x=%d,y=%d, mx=%3.2f,my=%3.2f\n", + //printf("m: x=%d,y=%d, mx=%3.2f,my=%3.2f\n", // x_event.xmotion.x, x_event.xmotion.y, mouse_x, mouse_y); /* move the mouse to the window center again */ @@ -1025,7 +1025,7 @@ GetEvent(void) if (doShm && x_event.type == x_shmeventtype) oktodraw = true; } - + if (mouse_avail) { if (key_dest == key_game && !mouse_grabbed && mouse_in_window) { mouse_grabbed = true; @@ -1075,11 +1075,11 @@ VID_Update(vrect_t *rects) if (doShm) { while (rects) { if (x_visinfo->depth == 16) { - st2_fixup(x_framebuffer[current_framebuffer], + st2_fixup(x_framebuffer[current_framebuffer], rects->x, rects->y, rects->width, rects->height); } else if (x_visinfo->depth == 24) { - st3_fixup(x_framebuffer[current_framebuffer], + st3_fixup(x_framebuffer[current_framebuffer], rects->x, rects->y, rects->width, rects->height); } @@ -1101,11 +1101,11 @@ VID_Update(vrect_t *rects) } else { while (rects) { if (x_visinfo->depth == 16) { - st2_fixup(x_framebuffer[current_framebuffer], + st2_fixup(x_framebuffer[current_framebuffer], rects->x, rects->y, rects->width, rects->height); } else if (x_visinfo->depth == 24) { - st3_fixup(x_framebuffer[current_framebuffer], + st3_fixup(x_framebuffer[current_framebuffer], rects->x, rects->y, rects->width, rects->height); } diff --git a/common/vid_sunxil.c b/common/vid_sunxil.c index f6a66ac..b5f5bfc 100644 --- a/common/vid_sunxil.c +++ b/common/vid_sunxil.c @@ -10,7 +10,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. @@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// vid_sunxil.c -- uses X to setup windows and XIL to copy images (scaled as needed) +// vid_sunxil.c -- uses X to setup windows and XIL to copy images (scaled as needed) // to screen #define _BSD @@ -229,7 +229,7 @@ qboolean CheckPixelMultiply (void) { int m; int w, h; - XWindowAttributes wattr; + XWindowAttributes wattr; XWindowChanges chg; unsigned int value_mask; int old_pixel; @@ -243,7 +243,7 @@ qboolean CheckPixelMultiply (void) old_pixel = current_pixel_multiply; current_pixel_multiply = m; pixel_multiply->value = m; - + if(XGetWindowAttributes(x_disp, x_win, & wattr) == 0) return true; // ??? @@ -261,7 +261,7 @@ qboolean CheckPixelMultiply (void) vid.width = MP(wattr.width) & ~3; vid.height = MP(wattr.height); - if (vid.width < 320) + if (vid.width < 320) vid.width = 320; if (vid.height < 200) vid.height = 200; @@ -289,7 +289,7 @@ void TragicDeath(int signal_num) static Cursor CreateNullCursor(Display *display, Window root) { - Pixmap cursormask; + Pixmap cursormask; XGCValues xgc; GC gc; XColor dummycolour; @@ -380,14 +380,14 @@ void VID_Init (unsigned char *palette) int w, h; int desired_width=320, desired_height=200; - + Cmd_AddCommand ("gamma", VID_Gamma_f); pixel_multiply = Cvar_Get ("pixel_multiply","2",CVAR_ARCHIVE,"None"); - if (pipe(render_pipeline) < 0) + if (pipe(render_pipeline) < 0) Sys_Error("VID_Init: pipe"); - + for (i=0 ; i<256 ; i++) vid_gamma[i] = i; @@ -445,10 +445,10 @@ void VID_Init (unsigned char *palette) desired_width = Q_atoi(com_argv[pnum+1]); desired_height = Q_atoi(com_argv[pnum+2]); if (desired_width < 1 || desired_height < 1) - Sys_Error("VID: Bad window width/height\n"); + Sys_Error("VID: Bad window width/height\n"); } - template_mask = VisualScreenMask; // make sure we get the right one + template_mask = VisualScreenMask; // make sure we get the right one template.screen = x_screen; // // specify a visual id @@ -516,7 +516,7 @@ void VID_Init (unsigned char *palette) // patch things up so game doesn't fail if window is too small // - if (vid.width < 320) + if (vid.width < 320) vid.width = 320; if (vid.height < 200) vid.height = 200; @@ -524,7 +524,7 @@ void VID_Init (unsigned char *palette) // // see if we're going to use threads // - if(((sysconf(_SC_NPROCESSORS_ONLN) > 1) || COM_CheckParm("-mt")) && + if(((sysconf(_SC_NPROCESSORS_ONLN) > 1) || COM_CheckParm("-mt")) && (COM_CheckParm("-no_mt") == 0)) { use_mt = 1; printf("VID: Using multiple threads!\n"); @@ -601,16 +601,16 @@ void VID_Init (unsigned char *palette) // // initialize XIL // - + state = xil_open(); - + if(state == NULL) { // // XIL's default error handler will print an error msg on stderr // Sys_Error("xil_open failed\n"); } - + X11_active = true; VID_ResetFramebuffer(); @@ -637,10 +637,10 @@ VID_ResetFramebuffer() quake_image = xil_create(state, vid.width, vid.height, 1, XIL_BYTE); xil_export(quake_image); - + if (xil_get_memory_storage(quake_image, &storage) == FALSE) Sys_Error("xil_get_memory_storage"); - + xil_import(quake_image, TRUE); xil_export(quake_image); @@ -653,7 +653,7 @@ VID_ResetFramebuffer() vid.conrowbytes = vid.rowbytes; vid.conwidth = vid.width; vid.conheight = vid.height; - + vid.maxwarpwidth = WARP_WIDTH; vid.maxwarpheight = WARP_HEIGHT; vid.recalc_refdef = 1; // force a surface cache flush @@ -677,11 +677,11 @@ VID_ResetFramebuffer_MT() old_display_image = display_image; display_image = xil_create_from_window(state, x_disp, x_win); - - if (quake_image == NULL) + + if (quake_image == NULL) if (thr_create(NULL, NULL, update_thread, NULL, THR_NEW_LWP, NULL) != 0) - Sys_Error("VID: thr_create"); - + Sys_Error("VID: thr_create"); + quake_image = drain_renderpipeline(quake_image); xil_destroy(old_display_image); @@ -771,11 +771,11 @@ int XLateKey(XKeyEvent *ev) case XK_Pause: key = K_PAUSE; break; case XK_Shift_L: case XK_Shift_R: key = K_SHIFT; break; - case XK_Control_L: + case XK_Control_L: case XK_Control_R: key = K_CTRL; break; - case XK_Alt_L: - case XK_Meta_L: - case XK_Alt_R: + case XK_Alt_L: + case XK_Meta_L: + case XK_Alt_R: case XK_Meta_R: key = K_ALT; break; case XK_Caps_Lock: key = K_CAPSLOCK; break; // various other keys on the keyboard @@ -794,7 +794,7 @@ int XLateKey(XKeyEvent *ev) default: key = (unsigned char)*buf; break; - } + } return key; @@ -831,12 +831,12 @@ void GetEvent(void) if (_windowed_mouse->value) { mouse_x = (float) ((int)x_event.xmotion.x - (int)(vid.width/2)); mouse_y = (float) ((int)x_event.xmotion.y - (int)(vid.height/2)); - //printf("m: x=%d,y=%d, mx=%3.2f,my=%3.2f\n", + //printf("m: x=%d,y=%d, mx=%3.2f,my=%3.2f\n", // x_event.xmotion.x, x_event.xmotion.y, mouse_x, mouse_y); /* move the mouse to the window center again */ XSelectInput( x_disp, x_win, x_std_event_mask & ~PointerMotionMask ); - XWarpPointer(x_disp,None,x_win,0,0,0,0, + XWarpPointer(x_disp,None,x_win,0,0,0,0, (vid.width/2),(vid.height/2)); XSelectInput( x_disp, x_win, x_std_event_mask ); } else { @@ -870,7 +870,7 @@ void GetEvent(void) if (b>=0) mouse_buttonstate &= ~(1<value) { mouse_x = (mouse_x + old_mouse_x) * 0.5; mouse_y = (mouse_y + old_mouse_y) * 0.5; @@ -1236,17 +1236,17 @@ void IN_Move (usercmd_t *cmd) old_mouse_x = mouse_x; old_mouse_y = mouse_y; - + mouse_x *= sensitivity->value; mouse_y *= sensitivity->value; - + if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) )) cmd->sidemove += m_side->value * mouse_x; else cl.viewangles[YAW] -= m_yaw->value * mouse_x; if (in_mlook.state & 1) V_StopPitchDrift (); - + if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) { cl.viewangles[PITCH] += m_pitch->value * mouse_y; if (cl.viewangles[PITCH] > 80) diff --git a/common/vid_svgalib.c b/common/vid_svgalib.c index 9e9b1c1..e034761 100644 --- a/common/vid_svgalib.c +++ b/common/vid_svgalib.c @@ -14,7 +14,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. @@ -67,7 +67,7 @@ static cvar_t *vid_mode; static cvar_t *vid_redrawfull; //static cvar_t vid_waitforrefresh = {"vid_waitforrefresh","0",true}; static cvar_t *vid_waitforrefresh; - + static char *framebuffer_ptr; @@ -184,7 +184,7 @@ D_EndDirectRect (int x, int y, int width, int height) vidpage=offset / 0x10000; vga_setpage(vidpage); } - memcpy (vid.direct + off, + memcpy (vid.direct + off, &backingbuf[(i +j)*24], width); } } @@ -224,7 +224,7 @@ static void VID_DescribeMode_f(void) { int modenum; - + modenum = Q_atoi (Cmd_Argv(1)); if ((modenum >= num_modes) || (modenum < 0 ) || !modes[modenum].width) { @@ -244,7 +244,7 @@ static void VID_DescribeModes_f(void) { int i; - + for (i=0;iy * vid.rowbytes + rects->x; while (ycount--) { register int i = offset % 0x10000; - + if ((offset / 0x10000) != vidpage) { vidpage=offset / 0x10000; vga_setpage(vidpage); } if (rects->width + i > 0x10000) { - memcpy(framebuffer_ptr + i, - vid.buffer + offset, + memcpy(framebuffer_ptr + i, + vid.buffer + offset, 0x10000 - i); vga_setpage(++vidpage); memcpy(framebuffer_ptr, - vid.buffer + offset + 0x10000 - i, + vid.buffer + offset + 0x10000 - i, rects->width - 0x10000 + i); } else { - memcpy(framebuffer_ptr + i, - vid.buffer + offset, + memcpy(framebuffer_ptr + i, + vid.buffer + offset, rects->width); } offset += vid.rowbytes; @@ -619,7 +619,7 @@ VID_Update(vrect_t *rects) rects = rects->pnext; } } - + if (vid_mode->value != current_mode) { VID_SetMode ((int)vid_mode->value, vid_current_palette); } diff --git a/common/vid_vga.c b/common/vid_vga.c index 6cc0fd6..358923f 100644 --- a/common/vid_vga.c +++ b/common/vid_vga.c @@ -10,7 +10,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. @@ -293,7 +293,7 @@ qboolean VGA_FreeAndAllocVidbuffer (viddef_t *lvid, int allocnewbuffer) vid_surfcache = (byte *)d_pzbuffer + lvid->width * lvid->height * sizeof (*d_pzbuffer); - + if (allocnewbuffer) { lvid->buffer = (void *)( (byte *)vid_surfcache + vid_surfcachesize); diff --git a/common/vid_win.c b/common/vid_win.c index 5c0a63a..0c38ca6 100644 --- a/common/vid_win.c +++ b/common/vid_win.c @@ -12,7 +12,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. @@ -257,7 +257,7 @@ ClearAllStates void ClearAllStates (void) { int i; - + // send an up event for each key, to make sure the server clears them all for (i=0 ; i<256 ; i++) { @@ -333,7 +333,7 @@ qboolean VID_AllocBuffers (int width, int height) vid_surfcache = (byte *)d_pzbuffer + width * height * sizeof (*d_pzbuffer); - + return true; } @@ -1084,7 +1084,7 @@ int VID_NumModes (void) return nummodes; } - + /* ================= VID_GetModePtr @@ -1831,8 +1831,8 @@ void VID_LockBuffer (void) if (lcd_x->value) screenwidth <<= 1; } - - + + void VID_UnlockBuffer (void) { if (dibdc) @@ -2000,7 +2000,7 @@ VID_DescribeMode_f void VID_DescribeMode_f (void) { int modenum; - + modenum = Q_atoi (Cmd_Argv(1)); Con_Printf ("%s\n", VID_GetExtModeDescription (modenum)); @@ -2681,49 +2681,49 @@ void D_EndDirectRect (int x, int y, int width, int height) //========================================================================== -byte scantokey[128] = -{ -// 0 1 2 3 4 5 6 7 -// 8 9 A B C D E F - 0 , 27, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '[', ']', 13, K_CTRL, 'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', - '\'', '`', K_SHIFT,'\\', 'z', 'x', 'c', 'v', // 2 +byte scantokey[128] = +{ +// 0 1 2 3 4 5 6 7 +// 8 9 A B C D E F + 0 , 27, '1', '2', '3', '4', '5', '6', + '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0 + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'o', 'p', '[', ']', 13, K_CTRL, 'a', 's', // 1 + 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', + '\'', '`', K_SHIFT,'\\', 'z', 'x', 'c', 'v', // 2 'b', 'n', 'm', ',', '.', '/', K_SHIFT,KP_MULTIPLY, - K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE,K_SCRLCK,KP_HOME, + K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3 + K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE,K_SCRLCK,KP_HOME, KP_UPARROW,KP_PGUP,KP_MINUS,KP_LEFTARROW,KP_5,KP_RIGHTARROW,KP_PLUS,KP_END, // 4 - KP_DOWNARROW,KP_PGDN,KP_INS,KP_DEL,0, 0, 0, K_F11, + KP_DOWNARROW,KP_PGDN,KP_INS,KP_DEL,0, 0, 0, K_F11, K_F12, 0, 0, 0, 0, 0, 0, 0, // 5 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; +}; -byte extscantokey[128] = -{ -// 0 1 2 3 4 5 6 7 -// 8 9 A B C D E F - 0 , 27, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '[', ']', KP_ENTER,K_CTRL,'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', - '\'', '`', K_SHIFT,'\\', 'z', 'x', 'c', 'v', // 2 +byte extscantokey[128] = +{ +// 0 1 2 3 4 5 6 7 +// 8 9 A B C D E F + 0 , 27, '1', '2', '3', '4', '5', '6', + '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0 + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'o', 'p', '[', ']', KP_ENTER,K_CTRL,'a', 's', // 1 + 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', + '\'', '`', K_SHIFT,'\\', 'z', 'x', 'c', 'v', // 2 'b', 'n', 'm', ',', '.', KP_DIVIDE,K_SHIFT,'*', - K_ALT, ' ', K_CAPSLOCK,K_F1,K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10, KP_NUMLCK,0, K_HOME, + K_ALT, ' ', K_CAPSLOCK,K_F1,K_F2, K_F3, K_F4, K_F5, // 3 + K_F6, K_F7, K_F8, K_F9, K_F10, KP_NUMLCK,0, K_HOME, K_UPARROW,K_PGUP,'-',K_LEFTARROW,'5',K_RIGHTARROW,'+', K_END, // 4 - K_DOWNARROW,K_PGDN,K_INS,K_DEL, 0, 0, 0, K_F11, + K_DOWNARROW,K_PGDN,K_INS,K_DEL, 0, 0, 0, K_F11, K_F12, 0, 0, 0, 0, 0, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; +}; @@ -2950,7 +2950,7 @@ LONG WINAPI MainWndProc ( uMsg = WM_MOUSEWHEEL; wParam <<= 16; } - + switch (uMsg) { case WM_CREATE: @@ -3013,7 +3013,7 @@ LONG WINAPI MainWndProc ( case WM_SIZE: Minimized = false; - + if (!(wParam & SIZE_RESTORED)) { if (wParam & SIZE_MINIMIZED) @@ -3092,7 +3092,7 @@ LONG WINAPI MainWndProc ( // 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 ((short) HIWORD(wParam) > 0) { Key_Event(K_MWHEELUP, true); Key_Event(K_MWHEELUP, false); @@ -3221,7 +3221,7 @@ void VID_MenuDraw (void) vid_wmodes = 3; lnummodes = VID_NumModes (); - + for (i=3 ; idepth == 16) { - st2_fixup(x_framebuffer[current_framebuffer], + st2_fixup(x_framebuffer[current_framebuffer], rects->x, rects->y, rects->width, rects->height); } else if (x_visinfo->depth == 24) { - st3_fixup(x_framebuffer[current_framebuffer], + st3_fixup(x_framebuffer[current_framebuffer], rects->x, rects->y, rects->width, rects->height); } @@ -781,11 +781,11 @@ VID_Update(vrect_t *rects) } else { while (rects) { if (x_visinfo->depth == 16) { - st2_fixup(x_framebuffer[current_framebuffer], + st2_fixup(x_framebuffer[current_framebuffer], rects->x, rects->y, rects->width, rects->height); } else if (x_visinfo->depth == 24) { - st3_fixup(x_framebuffer[current_framebuffer], + st3_fixup(x_framebuffer[current_framebuffer], rects->x, rects->y, rects->width, rects->height); } diff --git a/common/view.c b/common/view.c index 6c9b567..0a1d63e 100644 --- a/common/view.c +++ b/common/view.c @@ -12,7 +12,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. @@ -100,21 +100,21 @@ 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; - + } @@ -133,7 +133,7 @@ V_CalcBob ( void ) float bob; #endif float cycle; - + #ifdef QUAKEWORLD if (cl.spectator) return 0; @@ -163,7 +163,7 @@ V_CalcBob ( void ) bob = bob*0.3 + bob*0.7*sin(cycle); bob = bound( -7, bob, 4); return bob; - + } @@ -205,7 +205,7 @@ V_StopPitchDrift (void) stopped. Drifting is enabled when the center view key is hit, mlook is released - and lookspring is nonzero, or when + and lookspring is nonzero, or when */ void V_DriftPitch ( void ) @@ -232,7 +232,7 @@ V_DriftPitch ( void ) cl.driftmove = 0; else cl.driftmove += host_frametime; - + if ( cl.driftmove > v_centermove->value) { V_StartPitchDrift (); } @@ -248,7 +248,7 @@ V_DriftPitch ( void ) move = host_frametime * cl.pitchvel; cl.pitchvel += host_frametime * v_centerspeed->value; - + //Con_Printf ("move: %f (%f)\n", move, host_frametime); if (delta > 0) { @@ -269,14 +269,14 @@ V_DriftPitch ( void ) /* -============================================================================== - - 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 }; @@ -293,13 +293,13 @@ 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; inf = bound(0, inf, 255); @@ -316,14 +316,14 @@ qboolean V_CheckGamma ( void ) { static float oldgammavalue; - + if (v_gamma->value == oldgammavalue) return false; oldgammavalue = v_gamma->value; - + BuildGammaTable (v_gamma->value); vid.recalc_refdef = 1; // force a surface cache flush - + return true; } @@ -345,7 +345,7 @@ V_ParseDamage ( void ) #endif float side; float count; - + armor = MSG_ReadByte (); blood = MSG_ReadByte (); for (i=0 ; i<3 ; i++) @@ -378,11 +378,11 @@ V_ParseDamage ( void ) VectorSubtract (from, cl.simorg, from); #else ent = &cl_entities[cl.playernum + 1]; - + VectorSubtract (from, ent->origin, from); #endif VectorNormalize (from); - + #ifdef QUAKEWORLD AngleVectors (cl.simangles, forward, right, up); #else @@ -391,7 +391,7 @@ V_ParseDamage ( void ) side = DotProduct (from, right); v_dmg_roll = count*side*v_kickroll->value; - + side = DotProduct (from, forward); v_dmg_pitch = count*side*v_kickpitch->value; @@ -536,13 +536,13 @@ V_CalcBlend ( void ) v_blend[3] = bound(0.0, a, 1.0); } -/* -============================================================================== - - VIEW RENDERING - -============================================================================== -*/ +/* +============================================================================== + + VIEW RENDERING + +============================================================================== +*/ float angledelta ( float a ) @@ -560,17 +560,17 @@ angledelta ( float a ) */ void CalcGunAngle ( void ) -{ +{ float yaw, pitch, move; static float oldyaw = 0; static float oldpitch = 0; - + yaw = r_refdef.viewangles[YAW]; pitch = -r_refdef.viewangles[PITCH]; yaw = angledelta(yaw - r_refdef.viewangles[YAW]) * 0.4; yaw = bound(-10, yaw, 10); - + pitch = angledelta(-pitch - r_refdef.viewangles[PITCH]) * 0.4; pitch = bound(-10, pitch, 10); @@ -582,7 +582,7 @@ CalcGunAngle ( void ) if (oldyaw - move > yaw) yaw = oldyaw - move; } - + if ( pitch > oldpitch ) { if (oldpitch + move < pitch) pitch = oldpitch + move; @@ -590,7 +590,7 @@ CalcGunAngle ( void ) if (oldpitch - move > pitch) pitch = oldpitch - move; } - + oldyaw = yaw; oldpitch = pitch; @@ -614,7 +614,7 @@ V_BoundOffsets ( void ) { #ifdef UQUAKE entity_t *ent; - + ent = &cl_entities[cl.playernum + 1]; #endif // absolutely bound refresh reletive to entity clipping hull @@ -677,7 +677,7 @@ void V_CalcViewRoll (void) { float side; - + #ifdef QUAKEWORLD side = V_CalcRoll (cl.simangles, cl.simvel); #else @@ -778,11 +778,11 @@ V_CalcRefdef ( void ) // the view dir ent->angles[PITCH] = -cl.viewangles[PITCH]; // the model should face // the view dir - - + + #endif bob = V_CalcBob (); - + #ifdef QUAKEWORLD // refresh position from simulated origin VectorCopy (cl.simorg, r_refdef.vieworg); @@ -847,9 +847,9 @@ V_CalcRefdef ( void ) r_refdef.vieworg[i] += scr_ofsx->value*forward[i] + scr_ofsy->value*right[i] + scr_ofsz->value*up[i]; - + #endif - + #ifdef UQUAKE V_BoundOffsets (); #endif @@ -859,7 +859,7 @@ V_CalcRefdef ( void ) #else VectorCopy (cl.viewangles, view->angles); #endif - + CalcGunAngle (); #ifdef QUAKEWORLD @@ -908,7 +908,7 @@ V_CalcRefdef ( void ) #ifdef QUAKEWORLD if ( (view_message->onground != -1) && (cl.simorg[2] - oldz > 0) ) { float steptime; - + steptime = host_frametime; oldz += steptime * 80; @@ -994,7 +994,7 @@ cl.simangles[ROLL] = 0; // FIXME DropPunchAngle (); #endif if (cl.intermission) { // intermission / finale rendering - V_CalcIntermissionRefdef (); + V_CalcIntermissionRefdef (); } else { if (!cl.paused /* && (sv.maxclients > 1 || key_dest == key_game) */ ) V_CalcRefdef (); @@ -1037,7 +1037,7 @@ cl.simangles[ROLL] = 0; // FIXME #else R_RenderView (); #endif - + if (crosshair->value) Draw_Crosshair(); } @@ -1046,13 +1046,13 @@ cl.simangles[ROLL] = 0; // FIXME /* V_Init - + Create and initialize view cvars and console commands */ void V_Init ( void ) { - 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); @@ -1074,7 +1074,7 @@ V_Init ( void ) v_idlescale = Cvar_Get ("v_idlescale", "0", CVAR_NONE, "None"); crosshaircolor = Cvar_Get ("crosshaircolor", "79", CVAR_ARCHIVE, "Crosshair Color"); crosshair = Cvar_Get ("crosshair", "0", CVAR_ARCHIVE, "Crosshair selection"); - cl_crossx = Cvar_Get ("cl_crossx", "0", CVAR_ARCHIVE, "Crosshair X location"); + cl_crossx = Cvar_Get ("cl_crossx", "0", CVAR_ARCHIVE, "Crosshair X location"); cl_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, "Crosshair Y location"); gl_cshiftpercent = Cvar_Get ("gl_cshiftpercent", "100", CVAR_NONE, "Percentage of color shifting"); diff --git a/common/view.h b/common/view.h index 6494124..65cd80b 100644 --- a/common/view.h +++ b/common/view.h @@ -10,7 +10,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. diff --git a/common/wad.c b/common/wad.c index dfecac0..ded8ffe 100644 --- a/common/wad.c +++ b/common/wad.c @@ -10,7 +10,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. @@ -216,5 +216,5 @@ automatic byte swapping void SwapPic (qpic_t *pic) { pic->width = LittleLong(pic->width); - pic->height = LittleLong(pic->height); + pic->height = LittleLong(pic->height); } diff --git a/common/wad.h b/common/wad.h index fde7257..58b2f2b 100644 --- a/common/wad.h +++ b/common/wad.h @@ -10,7 +10,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. @@ -67,7 +67,7 @@ typedef struct char name[16]; // must be null terminated } lumpinfo_t; -typedef struct +typedef struct { int wad_numlumps; lumpinfo_t *wad_lumps; diff --git a/common/winquake.h b/common/winquake.h index 15c7c8c..1f2a993 100644 --- a/common/winquake.h +++ b/common/winquake.h @@ -10,7 +10,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. @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // winquake.h: Win32-specific Quake header file -#ifdef _WIN32 +#ifdef _WIN32 #pragma warning( disable : 4229 ) // mgraph gets this #include diff --git a/common/wins/net_ser.h b/common/wins/net_ser.h index 5885ab9..7e133d8 100644 --- a/common/wins/net_ser.h +++ b/common/wins/net_ser.h @@ -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. diff --git a/common/wins/net_wins.h b/common/wins/net_wins.h index 756ce64..5b5c62c 100644 --- a/common/wins/net_wins.h +++ b/common/wins/net_wins.h @@ -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. diff --git a/common/wins/net_wipx.h b/common/wins/net_wipx.h index ed82dc1..03832cd 100644 --- a/common/wins/net_wipx.h +++ b/common/wins/net_wipx.h @@ -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. diff --git a/common/world.c b/common/world.c index 39a6e2e..43b787c 100644 --- a/common/world.c +++ b/common/world.c @@ -11,7 +11,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. @@ -91,19 +91,19 @@ void SV_InitBoxHull (void) for (i=0 ; i<6 ; i++) { box_clipnodes[i].planenum = i; - + side = i&1; - + box_clipnodes[i].children[side] = CONTENTS_EMPTY; if (i != 5) box_clipnodes[i].children[side^1] = i + 1; else box_clipnodes[i].children[side^1] = CONTENTS_SOLID; - + box_planes[i].type = i>>1; box_planes[i].normal[i>>1] = 1; } - + } @@ -176,7 +176,7 @@ hull_t *SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset) VectorSubtract (ent->v.mins, maxs, hullmins); VectorSubtract (ent->v.maxs, mins, hullmaxs); hull = SV_HullForBox (hullmins, hullmaxs); - + VectorCopy (ent->v.origin, offset); } @@ -214,28 +214,28 @@ areanode_t *SV_CreateAreaNode (int depth, vec3_t mins, vec3_t maxs) ClearLink (&anode->trigger_edicts); ClearLink (&anode->solid_edicts); - + if (depth == AREA_DEPTH) { anode->axis = -1; anode->children[0] = anode->children[1] = NULL; return anode; } - + VectorSubtract (maxs, mins, size); if (size[0] > size[1]) anode->axis = 0; else anode->axis = 1; - + anode->dist = 0.5 * (maxs[anode->axis] + mins[anode->axis]); - VectorCopy (mins, mins1); - VectorCopy (mins, mins2); - VectorCopy (maxs, maxs1); - VectorCopy (maxs, maxs2); - + VectorCopy (mins, mins1); + VectorCopy (mins, mins2); + VectorCopy (maxs, maxs1); + VectorCopy (maxs, maxs2); + maxs1[anode->axis] = mins2[anode->axis] = anode->dist; - + anode->children[0] = SV_CreateAreaNode (depth+1, mins2, maxs2); anode->children[1] = SV_CreateAreaNode (depth+1, mins1, maxs1); @@ -252,7 +252,7 @@ SV_ClearWorld void SV_ClearWorld (void) { SV_InitBoxHull (); - + memset (sv_areanodes, 0, sizeof(sv_areanodes)); sv_numareanodes = 0; SV_CreateAreaNode (0, sv.worldmodel->mins, sv.worldmodel->maxs); @@ -313,11 +313,11 @@ void SV_TouchLinks ( edict_t *ent, areanode_t *node ) pr_global_struct->self = old_self; pr_global_struct->other = old_other; } - + // recurse down both sides if (node->axis == -1) return; - + if ( ent->v.absmax[node->axis] > node->dist ) SV_TouchLinks ( ent, node->children[0] ); if ( ent->v.absmin[node->axis] < node->dist ) @@ -339,7 +339,7 @@ void SV_FindTouchedLeafs (edict_t *ent, mnode_t *node) if (node->contents == CONTENTS_SOLID) return; - + // add an efrag if the node is a leaf if ( node->contents < 0) @@ -351,19 +351,19 @@ void SV_FindTouchedLeafs (edict_t *ent, mnode_t *node) leafnum = leaf - sv.worldmodel->leafs - 1; ent->leafnums[ent->num_leafs] = leafnum; - ent->num_leafs++; + ent->num_leafs++; return; } - + // NODE_MIXED splitplane = node->plane; sides = BOX_ON_PLANE_SIDE(ent->v.absmin, ent->v.absmax, splitplane); - + // recurse down the contacted sides if (sides & 1) SV_FindTouchedLeafs (ent, node->children[0]); - + if (sides & 2) SV_FindTouchedLeafs (ent, node->children[1]); } @@ -380,7 +380,7 @@ void SV_LinkEdict (edict_t *ent, qboolean touch_triggers) if (ent->area.prev) SV_UnlinkEdict (ent); // unlink from old position - + if (ent == sv.edicts) return; // don't add the world @@ -389,12 +389,12 @@ void SV_LinkEdict (edict_t *ent, qboolean touch_triggers) // set the abs box #ifdef QUAKEWORLD - VectorAdd (ent->v.origin, ent->v.mins, ent->v.absmin); + VectorAdd (ent->v.origin, ent->v.mins, ent->v.absmin); VectorAdd (ent->v.origin, ent->v.maxs, ent->v.absmax); #else #ifdef QUAKE2 - if (ent->v.solid == SOLID_BSP && + if (ent->v.solid == SOLID_BSP && (ent->v.angles[0] || ent->v.angles[1] || ent->v.angles[2]) ) { // expand for rotation float max, v; @@ -419,7 +419,7 @@ void SV_LinkEdict (edict_t *ent, qboolean touch_triggers) else #endif { - VectorAdd (ent->v.origin, ent->v.mins, ent->v.absmin); + VectorAdd (ent->v.origin, ent->v.mins, ent->v.absmin); VectorAdd (ent->v.origin, ent->v.maxs, ent->v.absmax); } #endif @@ -445,7 +445,7 @@ void SV_LinkEdict (edict_t *ent, qboolean touch_triggers) ent->v.absmax[1] += 1; ent->v.absmax[2] += 1; } - + // link to PVS leafs ent->num_leafs = 0; if (ent->v.modelindex) @@ -467,14 +467,14 @@ void SV_LinkEdict (edict_t *ent, qboolean touch_triggers) else break; // crosses the node } - -// link it in + +// link it in if (ent->v.solid == SOLID_TRIGGER) InsertLinkBefore (&ent->area, &node->trigger_edicts); else InsertLinkBefore (&ent->area, &node->solid_edicts); - + // if touch_triggers, touch all entities at this node and decend for more if (touch_triggers) SV_TouchLinks ( ent, sv_areanodes ); @@ -508,10 +508,10 @@ int SV_HullPointContents (hull_t *hull, int num, vec3_t p) { if (num < hull->firstclipnode || num > hull->lastclipnode) SV_Error ("SV_HullPointContents: bad node number"); - + node = hull->clipnodes + num; plane = hull->planes + node->planenum; - + if (plane->type < 3) d = p[plane->type] - plane->dist; else @@ -521,7 +521,7 @@ int SV_HullPointContents (hull_t *hull, int num, vec3_t p) else num = node->children[0]; } - + return num; } @@ -568,10 +568,10 @@ edict_t *SV_TestEntityPosition (edict_t *ent) trace_t trace; trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, ent->v.origin, 0, ent); - + if (trace.startsolid) return sv.edicts; - + return NULL; } #endif @@ -640,7 +640,7 @@ qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec t1 = DotProduct (plane->normal, p1) - plane->dist; t2 = DotProduct (plane->normal, p2) - plane->dist; } - + #if 1 if (t1 >= 0 && t2 >= 0) return SV_RecursiveHullCheck (hull, node->children[0], p1f, p2f, p1, p2, trace); @@ -662,7 +662,7 @@ qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec frac = 0; if (frac > 1) frac = 1; - + midf = p1f + (p2f - p1f)*frac; for (i=0 ; i<3 ; i++) mid[i] = p1[i] + frac*(p2[i] - p1[i]); @@ -681,15 +681,15 @@ qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec return false; } #endif - + if (SV_HullPointContents (hull, node->children[side^1], mid) != CONTENTS_SOLID) // go past the node return SV_RecursiveHullCheck (hull, node->children[side^1], midf, p2f, mid, p2, trace); - + if (trace->allsolid) return false; // never got out of the solid area - + //================== // the other side of the node is solid, this is the impact point //================== @@ -757,7 +757,7 @@ trace_t SV_ClipMoveToEntity (edict_t *ent, vec3_t start, vec3_t mins, vec3_t max #ifdef QUAKE2 // rotate start and end into the models frame of reference - if (ent->v.solid == SOLID_BSP && + if (ent->v.solid == SOLID_BSP && (ent->v.angles[0] || ent->v.angles[1] || ent->v.angles[2]) ) { vec3_t a; @@ -783,7 +783,7 @@ trace_t SV_ClipMoveToEntity (edict_t *ent, vec3_t start, vec3_t mins, vec3_t max #ifdef QUAKE2 // rotate endpos back to world frame of reference - if (ent->v.solid == SOLID_BSP && + if (ent->v.solid == SOLID_BSP && (ent->v.angles[0] || ent->v.angles[1] || ent->v.angles[2]) ) { vec3_t a; @@ -892,7 +892,7 @@ void SV_ClipToLinks ( areanode_t *node, moveclip_t *clip ) else if (trace.startsolid) clip->trace.startsolid = true; } - + // recurse down both sides if (node->axis == -1) return; @@ -917,7 +917,7 @@ boxmins[0] = boxmins[1] = boxmins[2] = -9999; boxmaxs[0] = boxmaxs[1] = boxmaxs[2] = 9999; #else int i; - + for (i=0 ; i<3 ; i++) { if (end[i] > start[i]) @@ -970,7 +970,7 @@ trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, e VectorCopy (mins, clip.mins2); VectorCopy (maxs, clip.maxs2); } - + // create the bounding box of the entire move SV_MoveBounds ( start, clip.mins2, clip.maxs2, end, clip.boxmins, clip.boxmaxs ); @@ -995,7 +995,7 @@ edict_t *SV_TestPlayerPosition (edict_t *ent, vec3_t origin) vec3_t boxmins, boxmaxs; vec3_t offset; int e; - + // check world first hull = &sv.worldmodel->hulls[1]; if ( SV_HullPointContents (hull, hull->firstclipnode, origin) != CONTENTS_EMPTY ) @@ -1004,7 +1004,7 @@ edict_t *SV_TestPlayerPosition (edict_t *ent, vec3_t origin) // check all entities VectorAdd (origin, ent->v.mins, boxmins); VectorAdd (origin, ent->v.maxs, boxmaxs); - + check = NEXT_EDICT(sv.edicts); for (e=1 ; ev.mins, ent->v.maxs, offset); - + VectorSubtract (origin, offset, offset); - + // test the point if ( SV_HullPointContents (hull, hull->firstclipnode, offset) != CONTENTS_EMPTY ) return check; diff --git a/common/world.h b/common/world.h index d5e7e6b..ab56a05 100644 --- a/common/world.h +++ b/common/world.h @@ -11,7 +11,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. diff --git a/common/zone.c b/common/zone.c index aca5aee..20cd98a 100644 --- a/common/zone.c +++ b/common/zone.c @@ -11,7 +11,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 @@ Z_ClearZone void Z_ClearZone (memzone_t *zone, int size) { memblock_t *block; - + // set the entire zone to one free block zone->blocklist.next = zone->blocklist.prev = block = @@ -93,7 +93,7 @@ void Z_ClearZone (memzone_t *zone, int size) zone->blocklist.id = 0; zone->blocklist.size = 0; zone->rover = block; - + block->prev = block->next = &zone->blocklist; block->tag = 0; // free block block->id = ZONEID; @@ -109,7 +109,7 @@ Z_Free void Z_Free (void *ptr) { memblock_t *block, *other; - + if (!ptr) Sys_Error ("Z_Free: NULL pointer"); @@ -120,7 +120,7 @@ void Z_Free (void *ptr) Sys_Error ("Z_Free: freed a freed pointer"); block->tag = 0; // mark as free - + other = block->prev; if (!other->tag) { // merge with previous free block @@ -131,7 +131,7 @@ void Z_Free (void *ptr) mainzone->rover = other; block = other; } - + other = block->next; if (!other->tag) { // merge the next free block onto the end @@ -152,7 +152,7 @@ Z_Malloc void *Z_Malloc (int size) { void *buf; - + Z_CheckHeap (); // DEBUG buf = Z_TagMalloc (size, 1); if (!buf) @@ -177,10 +177,10 @@ void *Z_TagMalloc (int size, int tag) size += sizeof(memblock_t); // account for size of block header size += 4; // space for memory trash tester size = (size + 7) & ~7; // align to 8-byte boundary - + base = rover = mainzone->rover; start = base->prev; - + do { if (rover == start) // scaned all the way around the list @@ -190,7 +190,7 @@ void *Z_TagMalloc (int size, int tag) else rover = rover->next; } while (base->tag || base->size < size); - + // // found a block big enough // @@ -207,11 +207,11 @@ void *Z_TagMalloc (int size, int tag) base->next = new; base->size = size; } - + base->tag = tag; // no longer a free block - + mainzone->rover = base->next; // next allocation will start looking here - + base->id = ZONEID; // marker for memory trash testing @@ -229,16 +229,16 @@ Z_Print void Z_Print (memzone_t *zone) { memblock_t *block; - + Con_Printf ("zone size: %i location: %p\n",mainzone->size,mainzone); - + for (block = zone->blocklist.next ; ; block = block->next) { Con_Printf ("block:%p size:%7i tag:%3i\n", block, block->size, block->tag); - + if (block->next == &zone->blocklist) - break; // all blocks have been hit + break; // all blocks have been hit if ( (byte *)block + block->size != (byte *)block->next) Con_Printf ("ERROR: block size does not touch the next block\n"); if ( block->next->prev != block) @@ -257,11 +257,11 @@ Z_CheckHeap void Z_CheckHeap (void) { memblock_t *block; - + for (block = mainzone->blocklist.next ; ; block = block->next) { if (block->next == &mainzone->blocklist) - break; // all blocks have been hit + break; // all blocks have been hit if ( (byte *)block + block->size != (byte *)block->next) Sys_Error ("Z_CheckHeap: block size does not touch the next block\n"); if ( block->next->prev != block) @@ -303,7 +303,7 @@ Run consistancy and sentinal trahing checks void Hunk_Check (void) { hunk_t *h; - + for (h = (hunk_t *)hunk_base ; (byte *)h != hunk_base + hunk_low_used ; ) { if (h->sentinal != HUNK_SENTINAL) @@ -333,7 +333,7 @@ void Hunk_Print (qboolean all) count = 0; sum = 0; totalblocks = 0; - + h = (hunk_t *)hunk_base; endlow = (hunk_t *)(hunk_base + hunk_low_used); starthigh = (hunk_t *)(hunk_base + hunk_size - hunk_high_used); @@ -354,7 +354,7 @@ void Hunk_Print (qboolean all) Con_Printf ("-------------------------\n"); h = starthigh; } - + // // if totally done, break // @@ -368,7 +368,7 @@ void Hunk_Print (qboolean all) Sys_Error ("Hunk_Check: trahsed sentinal"); if (h->size < 16 || h->size + (byte *)h - hunk_base > hunk_size) Sys_Error ("Hunk_Check: bad size"); - + next = (hunk_t *)((byte *)h+h->size); count++; totalblocks++; @@ -380,11 +380,11 @@ void Hunk_Print (qboolean all) memcpy (name, h->name, 8); if (all) Con_Printf ("%8p :%8i %8s\n",h, h->size, name); - + // // print the total // - if (next == endlow || next == endhigh || + if (next == endlow || next == endhigh || strncmp (h->name, next->name, 8) ) { if (!all) @@ -398,7 +398,7 @@ void Hunk_Print (qboolean all) Con_Printf ("-------------------------\n"); Con_Printf ("%8i total blocks\n", totalblocks); - + } /* @@ -409,34 +409,34 @@ Hunk_AllocName void *Hunk_AllocName (int size, char *name) { hunk_t *h; - + #ifdef PARANOID Hunk_Check (); #endif if (size < 0) Sys_Error ("Hunk_Alloc: bad size: %i", size); - + size = sizeof(hunk_t) + ((size+15)&~15); - + if (hunk_size - hunk_low_used - hunk_high_used < size) #ifdef _WIN32 Sys_Error ("Not enough RAM allocated. Try starting using \"-heapsize 16000\" or higher."); -#else +#else Sys_Error ("Not enough RAM allocated. Try starting using \"-mem 16\" or higher."); #endif - + h = (hunk_t *)(hunk_base + hunk_low_used); hunk_low_used += size; Cache_FreeLow (hunk_low_used); memset (h, 0, size); - + h->size = size; h->sentinal = HUNK_SENTINAL; Q_strncpy (h->name, name, 8); - + return (void *)(h+1); } @@ -544,13 +544,13 @@ void *Hunk_TempAlloc (int size) void *buf; size = (size+15)&~15; - + if (hunk_tempactive) { Hunk_FreeToHighMark (hunk_tempmark); hunk_tempactive = false; } - + hunk_tempmark = Hunk_HighMark (); buf = Hunk_HighAllocName (size, "temp"); @@ -574,7 +574,7 @@ typedef struct cache_system_s cache_user_t *user; char name[16]; struct cache_system_s *prev, *next; - struct cache_system_s *lru_prev, *lru_next; // for LRU flushing + struct cache_system_s *lru_prev, *lru_next; // for LRU flushing } cache_system_t; cache_system_t *Cache_TryAlloc (int size, qboolean nobottom); @@ -620,7 +620,7 @@ Throw things out until the hunk can be expanded to the given point void Cache_FreeLow (int new_low_hunk) { cache_system_t *c; - + while (1) { c = cache_head.next; @@ -642,7 +642,7 @@ Throw things out until the hunk can be expanded to the given point void Cache_FreeHigh (int new_high_hunk) { cache_system_t *c, *prev; - + prev = NULL; while (1) { @@ -668,7 +668,7 @@ void Cache_UnlinkLRU (cache_system_t *cs) cs->lru_next->lru_prev = cs->lru_prev; cs->lru_prev->lru_next = cs->lru_next; - + cs->lru_prev = cs->lru_next = NULL; } @@ -694,7 +694,7 @@ Size should already include the header and padding cache_system_t *Cache_TryAlloc (int size, qboolean nobottom) { cache_system_t *cs, *new; - + // is the cache completely empty? if (!nobottom && cache_head.prev == &cache_head) @@ -708,16 +708,16 @@ cache_system_t *Cache_TryAlloc (int size, qboolean nobottom) cache_head.prev = cache_head.next = new; new->prev = new->next = &cache_head; - + Cache_MakeLRU (new); return new; } - + // search from the bottom up for space new = (cache_system_t *) (hunk_base + hunk_low_used); cs = cache_head.next; - + do { if (!nobottom || cs != cache_head.next) @@ -726,40 +726,40 @@ cache_system_t *Cache_TryAlloc (int size, qboolean nobottom) { // found space memset (new, 0, sizeof(*new)); new->size = size; - + new->next = cs; new->prev = cs->prev; cs->prev->next = new; cs->prev = new; - + Cache_MakeLRU (new); - + return new; } } - // continue looking + // continue looking new = (cache_system_t *)((byte *)cs + cs->size); cs = cs->next; } while (cs != &cache_head); - + // try to allocate one at the very end if ( hunk_base + hunk_size - hunk_high_used - (byte *)new >= size) { memset (new, 0, sizeof(*new)); new->size = size; - + new->next = &cache_head; new->prev = cache_head.prev; cache_head.prev->next = new; cache_head.prev = new; - + Cache_MakeLRU (new); return new; } - + return NULL; // couldn't allocate } @@ -872,7 +872,7 @@ void *Cache_Check (cache_user_t *c) // move to head of LRU Cache_UnlinkLRU (cs); Cache_MakeLRU (cs); - + return c->data; } @@ -888,13 +888,13 @@ void *Cache_Alloc (cache_user_t *c, int size, char *name) if (c->data) Sys_Error ("Cache_Alloc: allready allocated"); - + if (size <= 0) Sys_Error ("Cache_Alloc: size %i", size); size = (size + sizeof(cache_system_t) + 15) & ~15; -// find memory for it +// find memory for it while (1) { cs = Cache_TryAlloc (size, false); @@ -905,14 +905,14 @@ void *Cache_Alloc (cache_user_t *c, int size, char *name) cs->user = c; break; } - + // free the least recently used cahedat if (cache_head.lru_prev == &cache_head) Sys_Error ("Cache_Alloc: out of memory"); // not enough memory at all Cache_Free ( cache_head.lru_prev->user ); - } - + } + return Cache_Check (c); } @@ -933,7 +933,7 @@ void Memory_Init (void *buf, int size) hunk_size = size; hunk_low_used = 0; hunk_high_used = 0; - + Cache_Init (); p = COM_CheckParm ("-zone"); if (p) diff --git a/common/zone.h b/common/zone.h index 74ce686..e76f532 100644 --- a/common/zone.h +++ b/common/zone.h @@ -10,7 +10,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. diff --git a/gamedata/uquake/progdefs.h b/gamedata/uquake/progdefs.h index db86de1..ac17d38 100644 --- a/gamedata/uquake/progdefs.h +++ b/gamedata/uquake/progdefs.h @@ -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. diff --git a/qw_client/Makefile.in b/qw_client/Makefile.in index b42edd1..ba99f41 100644 --- a/qw_client/Makefile.in +++ b/qw_client/Makefile.in @@ -322,7 +322,7 @@ GL_REND_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\ GLX_GL_OBJS = $(patsubst %,$(BUILD_DIR)/%,$(addsuffix .@OBJEXT@,\ $(basename $(GLX_GL_SRC) .c .s))) - + ALL_GL_OBJS = $(GLX_GL_OBJS) $(GL_REND_OBJS) \ $(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a diff --git a/qw_client/cl_demo.c b/qw_client/cl_demo.c index 5447042..6bae4c9 100644 --- a/qw_client/cl_demo.c +++ b/qw_client/cl_demo.c @@ -12,7 +12,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. @@ -160,7 +160,7 @@ qboolean CL_GetDemoMessage (void) Qread(cls.demofile, &demotime, sizeof(demotime)); demotime = LittleFloat(demotime); -// decide if it is time to grab the next message +// decide if it is time to grab the next message if (cls.timedemo) { if (cls.td_lastframe < 0) cls.td_lastframe = demotime; @@ -195,10 +195,10 @@ qboolean CL_GetDemoMessage (void) if (cls.state < ca_demostart) Host_Error ("CL_GetDemoMessage: cls.state != ca_active"); - + // get the msg type Qread (cls.demofile, &c, sizeof(c)); - + switch (c) { case dem_cmd : // user sent input @@ -273,7 +273,7 @@ int CL_GetMessage(void) return false; CL_WriteDemoMessage (&net_message); - + return true; } @@ -409,7 +409,7 @@ void CL_Record_f (void) if (cls.demorecording) CL_Stop_f(); - + snprintf(name, sizeof(name), "%s/%s", com_gamedir, Cmd_Argv(1)); // @@ -471,7 +471,7 @@ void CL_Record_f (void) // flush packet CL_WriteRecordDemoMessage (&buf, seq++); - SZ_Clear (&buf); + SZ_Clear (&buf); // soundlist MSG_WriteByte (&buf, svc_soundlist); @@ -485,7 +485,7 @@ void CL_Record_f (void) MSG_WriteByte (&buf, 0); MSG_WriteByte (&buf, n); CL_WriteRecordDemoMessage (&buf, seq++); - SZ_Clear (&buf); + SZ_Clear (&buf); MSG_WriteByte (&buf, svc_soundlist); MSG_WriteByte (&buf, n + 1); } @@ -496,7 +496,7 @@ void CL_Record_f (void) MSG_WriteByte (&buf, 0); MSG_WriteByte (&buf, 0); CL_WriteRecordDemoMessage (&buf, seq++); - SZ_Clear (&buf); + SZ_Clear (&buf); } // modellist @@ -511,7 +511,7 @@ void CL_Record_f (void) MSG_WriteByte (&buf, 0); MSG_WriteByte (&buf, n); CL_WriteRecordDemoMessage (&buf, seq++); - SZ_Clear (&buf); + SZ_Clear (&buf); MSG_WriteByte (&buf, svc_modellist); MSG_WriteByte (&buf, n + 1); } @@ -522,7 +522,7 @@ void CL_Record_f (void) MSG_WriteByte (&buf, 0); MSG_WriteByte (&buf, 0); CL_WriteRecordDemoMessage (&buf, seq++); - SZ_Clear (&buf); + SZ_Clear (&buf); } // spawnstatic @@ -551,7 +551,7 @@ void CL_Record_f (void) if (buf.cursize > MAX_MSGLEN/2) { CL_WriteRecordDemoMessage (&buf, seq++); - SZ_Clear (&buf); + SZ_Clear (&buf); } } @@ -565,7 +565,7 @@ void CL_Record_f (void) es = cl_baselines + i; if (memcmp(es, &blankes, sizeof(blankes))) { - MSG_WriteByte (&buf,svc_spawnbaseline); + MSG_WriteByte (&buf,svc_spawnbaseline); MSG_WriteShort (&buf, i); MSG_WriteByte (&buf, es->modelindex); @@ -580,7 +580,7 @@ void CL_Record_f (void) if (buf.cursize > MAX_MSGLEN/2) { CL_WriteRecordDemoMessage (&buf, seq++); - SZ_Clear (&buf); + SZ_Clear (&buf); } } } @@ -590,7 +590,7 @@ void CL_Record_f (void) if (buf.cursize) { CL_WriteRecordDemoMessage (&buf, seq++); - SZ_Clear (&buf); + SZ_Clear (&buf); } // send current status of all other players @@ -601,15 +601,15 @@ void CL_Record_f (void) MSG_WriteByte (&buf, svc_updatefrags); MSG_WriteByte (&buf, i); MSG_WriteShort (&buf, player->frags); - + MSG_WriteByte (&buf, svc_updateping); MSG_WriteByte (&buf, i); MSG_WriteShort (&buf, player->ping); - + MSG_WriteByte (&buf, svc_updatepl); MSG_WriteByte (&buf, i); MSG_WriteByte (&buf, player->pl); - + MSG_WriteByte (&buf, svc_updateentertime); MSG_WriteByte (&buf, i); MSG_WriteFloat (&buf, player->entertime); @@ -621,10 +621,10 @@ void CL_Record_f (void) if (buf.cursize > MAX_MSGLEN/2) { CL_WriteRecordDemoMessage (&buf, seq++); - SZ_Clear (&buf); + SZ_Clear (&buf); } } - + // send all current light styles for (i=0 ; i MAX_MSGLEN/2) { CL_WriteRecordDemoMessage (&buf, seq++); - SZ_Clear (&buf); + SZ_Clear (&buf); } } @@ -695,7 +695,7 @@ void CL_ReRecord_f (void) if (cls.demorecording) CL_Stop_f(); - + snprintf(name, sizeof(name), "%s/%s", com_gamedir, Cmd_Argv(1)); // @@ -739,7 +739,7 @@ void CL_PlayDemo_f (void) // disconnect from server // CL_Disconnect (); - + // // open the demo file // @@ -771,9 +771,9 @@ void CL_FinishTimeDemo (void) { int frames; float time; - + cls.timedemo = false; - + // the first frame didn't count frames = (host_framecount - cls.td_startframe) - 1; time = Sys_DoubleTime() - cls.td_starttime; @@ -798,13 +798,13 @@ void CL_TimeDemo_f (void) } CL_PlayDemo_f (); - + if (cls.state != ca_demostart) return; // cls.td_starttime will be grabbed at the second frame of the demo, so // all the loading time doesn't get counted - + cls.timedemo = true; cls.td_starttime = 0; cls.td_startframe = host_framecount; diff --git a/qw_client/cl_parse.c b/qw_client/cl_parse.c index 163721d..f5ca2cb 100644 --- a/qw_client/cl_parse.c +++ b/qw_client/cl_parse.c @@ -12,7 +12,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. @@ -49,7 +49,7 @@ char *svc_strings[] = "svc_stufftext", // [string] stuffed into client's console buffer // the string should be \n terminated "svc_setangle", // [vec3] set the view angle to this absolute value - + "svc_serverdata", // [long] version ... "svc_lightstyle", // [byte] [string] "svc_updatename", // [byte] [string] @@ -59,11 +59,11 @@ char *svc_strings[] = "svc_updatecolors", // [byte] [byte] "svc_particle", // [vec3] "svc_damage", // [byte] impact [byte] blood [vec3] from - + "svc_spawnstatic", "OBSOLETE svc_spawnbinary", "svc_spawnbaseline", - + "svc_temp_entity", // "svc_setpause", "svc_signonnum", @@ -225,7 +225,7 @@ void Model_NextDownload (void) } cls.downloadtype = dl_model; - for ( + for ( ; cl.model_name[cls.downloadnumber][0] ; cls.downloadnumber++) { @@ -282,7 +282,7 @@ void Sound_NextDownload (void) } cls.downloadtype = dl_sound; - for ( + for ( ; cl.sound_name[cls.downloadnumber][0] ; cls.downloadnumber++) { @@ -504,7 +504,7 @@ Con_DPrintf("Upload starting of %d...\n", size); upload_pos = 0; CL_NextUpload(); -} +} qboolean CL_IsUploading(void) { @@ -541,7 +541,7 @@ void CL_ParseServerData (void) qboolean cflag = false; extern char gamedirfile[MAX_OSPATH]; int protover; - + Con_DPrintf ("Serverdata packet received.\n"); // // wipe the client_state_t struct @@ -551,7 +551,7 @@ void CL_ParseServerData (void) // parse protocol version number // allow 2.2 and 2.29 demos to play protover = MSG_ReadLong (); - if (protover != PROTOCOL_VERSION && + if (protover != PROTOCOL_VERSION && !(cls.demoplayback && (protover == 26 || protover == 27 || protover == 28))) Host_EndGame ("Server returned version %i, not %i\nYou probably need to upgrade.\nCheck http://www.quakeworld.net/", protover, PROTOCOL_VERSION); @@ -559,16 +559,16 @@ void CL_ParseServerData (void) // gametype is always GAME_DEATHMATCH in QW cl.gametype = GAME_DEATHMATCH; - + // maxclients is irrelivant in QW cl.maxclients = 0; - + // game directory str = MSG_ReadString (); if (stricmp(gamedirfile, str)) { // save current config - Host_WriteConfiguration (); + Host_WriteConfiguration (); cflag = true; } @@ -719,7 +719,7 @@ CL_ParseBaseline void CL_ParseBaseline (entity_state_t *es) { int i; - + es->modelindex = MSG_ReadByte (); es->frame = MSG_ReadByte (); es->colormap = MSG_ReadByte(); @@ -748,7 +748,7 @@ void CL_ParseStatic (void) entity_state_t es; CL_ParseBaseline (&es); - + i = cl.num_statics; if (i >= MAX_STATIC_ENTITIES) Host_EndGame ("Too many static entities"); @@ -763,7 +763,7 @@ void CL_ParseStatic (void) VectorCopy (es.origin, ent->origin); VectorCopy (es.angles, ent->angles); - + R_AddEfrags (ent); } @@ -777,13 +777,13 @@ void CL_ParseStaticSound (void) vec3_t org; int sound_num, vol, atten; int i; - + for (i=0 ; i<3 ; i++) org[i] = MSG_ReadCoord (); sound_num = MSG_ReadByte (); vol = MSG_ReadByte (); atten = MSG_ReadByte (); - + S_StaticSound (cl.sound_precache[sound_num], org, vol, atten); } @@ -808,34 +808,34 @@ void CL_ParseStartSoundPacket(void) int channel, ent; int sound_num; int volume; - float attenuation; + float attenuation; int i; - - channel = MSG_ReadShort(); + + channel = MSG_ReadShort(); if (channel & SND_VOLUME) volume = MSG_ReadByte (); else volume = DEFAULT_SOUND_PACKET_VOLUME; - + if (channel & SND_ATTENUATION) attenuation = MSG_ReadByte () / 64.0; else attenuation = DEFAULT_SOUND_PACKET_ATTENUATION; - + sound_num = MSG_ReadByte (); for (i=0 ; i<3 ; i++) pos[i] = MSG_ReadCoord (); - + ent = (channel>>3)&1023; channel &= 7; if (ent > MAX_EDICTS) Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", ent); - + S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation); -} +} /* @@ -877,7 +877,7 @@ void CL_ParseClientdata (void) cls.latency = latency; else cls.latency += 0.001; // drift up, so correction are needed - } + } } /* @@ -985,7 +985,7 @@ void CL_SetStat (int stat, int value) Sys_Error ("CL_SetStat: %i is invalid", stat); Sbar_Changed (); - + if (stat == STAT_ITEMS) { // set flash times Sbar_Changed (); @@ -1023,7 +1023,7 @@ void CL_MuzzleFlash (void) dl = CL_AllocDlight (i); VectorCopy (pl->origin, dl->origin); AngleVectors (pl->viewangles, fv, rv, uv); - + VectorMA (dl->origin, 18, fv, dl->origin); dl->radius = 200 + (rand()&31); dl->minlight = 32; @@ -1083,7 +1083,7 @@ void CL_ParseServerMessage (void) } SHOWNET(svc_strings[cmd]); - + // other commands switch (cmd) { @@ -1092,11 +1092,11 @@ void CL_ParseServerMessage (void) Host_EndGame ("CL_ParseServerMessage: Illegible server message"); break; - + case svc_nop: // Con_Printf ("svc_nop\n"); break; - + case svc_disconnect: if (cls.state == ca_connected) Host_EndGame ("Server disconnected\n" @@ -1115,34 +1115,34 @@ void CL_ParseServerMessage (void) Con_Printf ("%s", MSG_ReadString ()); con_ormask = 0; break; - + case svc_centerprint: SCR_CenterPrint (MSG_ReadString ()); break; - + case svc_stufftext: s = MSG_ReadString (); //s = COM_EscapeEscapes(s); Con_DPrintf ("stufftext: %s\n", s); Cbuf_AddText (s); break; - + case svc_damage: V_ParseDamage (); break; - + case svc_serverdata: Cbuf_Execute (); // make sure any stuffed commands are done CL_ParseServerData (); vid.recalc_refdef = true; // leave full screen intermission break; - + case svc_setangle: for (i=0 ; i<3 ; i++) cl.viewangles[i] = MSG_ReadAngle (); // cl.viewangles[PITCH] = cl.viewangles[ROLL] = 0; break; - + case svc_lightstyle: i = MSG_ReadByte (); if (i >= MAX_LIGHTSTYLES) @@ -1150,23 +1150,23 @@ void CL_ParseServerMessage (void) Q_strcpy (cl_lightstyle[i].map, MSG_ReadString()); cl_lightstyle[i].length = Q_strlen(cl_lightstyle[i].map); break; - + case svc_sound: CL_ParseStartSoundPacket(); break; - + case svc_stopsound: i = MSG_ReadShort(); S_StopSound(i>>3, i&7); break; - + case svc_updatefrags: Sbar_Changed (); i = MSG_ReadByte (); if (i >= MAX_CLIENTS) Host_EndGame ("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD"); cl.players[i].frags = MSG_ReadShort (); - break; + break; case svc_updateping: i = MSG_ReadByte (); @@ -1174,14 +1174,14 @@ void CL_ParseServerMessage (void) Host_EndGame ("CL_ParseServerMessage: svc_updateping > MAX_SCOREBOARD"); cl.players[i].ping = MSG_ReadShort (); break; - + case svc_updatepl: i = MSG_ReadByte (); if (i >= MAX_CLIENTS) Host_EndGame ("CL_ParseServerMessage: svc_updatepl > MAX_SCOREBOARD"); cl.players[i].pl = MSG_ReadByte (); break; - + case svc_updateentertime: // time is sent over as seconds ago i = MSG_ReadByte (); @@ -1189,14 +1189,14 @@ void CL_ParseServerMessage (void) Host_EndGame ("CL_ParseServerMessage: svc_updateentertime > MAX_SCOREBOARD"); cl.players[i].entertime = realtime - MSG_ReadFloat (); break; - + case svc_spawnbaseline: i = MSG_ReadShort (); CL_ParseBaseline (&cl_baselines[i]); break; case svc_spawnstatic: CL_ParseStatic (); - break; + break; case svc_temp_entity: CL_ParseTEnt (); break; @@ -1219,7 +1219,7 @@ void CL_ParseServerMessage (void) j = MSG_ReadLong (); CL_SetStat (i, j); break; - + case svc_spawnstaticsound: CL_ParseStaticSound (); break; @@ -1234,7 +1234,7 @@ void CL_ParseServerMessage (void) cl.completed_time = realtime; vid.recalc_refdef = true; // go to full screen for (i=0 ; i<3 ; i++) - cl.simorg[i] = MSG_ReadCoord (); + cl.simorg[i] = MSG_ReadCoord (); for (i=0 ; i<3 ; i++) cl.simangles[i] = MSG_ReadAngle (); VectorCopy (vec3_origin, cl.simvel); @@ -1244,9 +1244,9 @@ void CL_ParseServerMessage (void) cl.intermission = 2; cl.completed_time = realtime; vid.recalc_refdef = true; // go to full screen - SCR_CenterPrint (MSG_ReadString ()); + SCR_CenterPrint (MSG_ReadString ()); break; - + case svc_sellscreen: Cmd_ExecuteString ("help", src_command); break; diff --git a/qw_client/cl_pred.c b/qw_client/cl_pred.c index 5b06acb..c174a84 100644 --- a/qw_client/cl_pred.c +++ b/qw_client/cl_pred.c @@ -12,7 +12,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. @@ -178,7 +178,7 @@ CL_PredictMove (void) for (i=1 ; iplayerstate[cl.playernum], &to->playerstate[cl.playernum], &to->cmd, @@ -198,7 +198,7 @@ CL_PredictMove (void) f = 0; else { - f = (cl.time - from->senttime) / (to->senttime + f = (cl.time - from->senttime) / (to->senttime - from->senttime); f = max(0, min(f, 1)); @@ -215,16 +215,16 @@ CL_PredictMove (void) cl.simorg); return; } - + for (i=0 ; i<3 ; i++) { - cl.simorg[i] = from->playerstate[cl.playernum].origin[i] + cl.simorg[i] = from->playerstate[cl.playernum].origin[i] + f*(to->playerstate[cl.playernum].origin[i] - from->playerstate[cl.playernum].origin[i]); - cl.simvel[i] = from->playerstate[cl.playernum].velocity[i] - + f*(to->playerstate[cl.playernum].velocity[i] + cl.simvel[i] = from->playerstate[cl.playernum].velocity[i] + + f*(to->playerstate[cl.playernum].velocity[i] - from->playerstate[cl.playernum].velocity[i]); - } + } } diff --git a/qw_client/menu.c b/qw_client/menu.c index 95d3834..4cf9033 100644 --- a/qw_client/menu.c +++ b/qw_client/menu.c @@ -13,7 +13,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. @@ -38,9 +38,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. enum { - m_none, m_main, m_singleplayer, m_load, m_save, m_multiplayer, + m_none, m_main, m_singleplayer, m_load, m_save, m_multiplayer, m_setup, m_net, m_options, m_video, m_keys, m_help, m_quit, - m_serialconfig, m_modemconfig, m_lanconfig, m_gameoptions, + m_serialconfig, m_modemconfig, m_lanconfig, m_gameoptions, m_search, m_slist } m_state; @@ -187,7 +187,7 @@ void M_BuildTranslationTable(int top, int bottom) memcpy (dest + BOTTOM_RANGE, source + bottom, 16); else for (j=0 ; j<16 ; j++) - dest[BOTTOM_RANGE+j] = source[bottom+15-j]; + dest[BOTTOM_RANGE+j] = source[bottom+15-j]; } @@ -256,7 +256,7 @@ void M_DrawTextBox (int x, int y, int width, int lines) //============================================================================= int m_save_demonum; - + /* ================ M_ToggleMenu_f @@ -287,7 +287,7 @@ void M_ToggleMenu_f (void) } } - + //============================================================================= /* MAIN MENU */ @@ -306,7 +306,7 @@ void M_Menu_Main_f (void) m_state = m_main; m_entersound = true; } - + void M_Main_Draw (void) { @@ -319,7 +319,7 @@ void M_Main_Draw (void) M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mainmenu.lmp") ); f = (int)(realtime * 10)%6; - + M_DrawTransPic (54, 32 + m_main_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) ); } @@ -335,7 +335,7 @@ void M_Main_Key (int key) if (cls.demonum != -1 && !cls.demoplayback && cls.state == ca_disconnected) CL_NextDemo (); break; - + case KP_DOWNARROW: case K_DOWNARROW: S_LocalSound ("misc/menu1.wav"); @@ -450,11 +450,11 @@ void M_AdjustSliders (int dir) volume->value = 1; break; - + case 8: // allways run if (cl_forwardspeed->value > 200) { - cl_forwardspeed->value = 200; + cl_forwardspeed->value = 200; cl_backspeed->value = 200; } else @@ -463,15 +463,15 @@ void M_AdjustSliders (int dir) cl_backspeed->value = 400; } break; - + case 9: // invert mouse m_pitch->value = -m_pitch->value; break; - + case 10: // lookspring lookspring->value = !lookspring->value; break; - + case 11: // lookstrafe lookstrafe->value = !lookstrafe->value; break; @@ -524,7 +524,7 @@ void M_Options_Draw (void) M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") ); p = Draw_CachePic ("gfx/p_option.lmp"); M_DrawPic ( (320-p->width)/2, 4, p); - + M_Print (16, options_draw_cursor, " Customize controls"); M_Print (16, options_draw_cursor+=8, " Go to console"); M_Print (16, options_draw_cursor+=8, " Reset to defaults"); @@ -587,7 +587,7 @@ void M_Options_Key (int k) case K_ESCAPE: M_Menu_Main_f (); break; - + case KP_ENTER: case K_ENTER: m_entersound = true; @@ -612,7 +612,7 @@ void M_Options_Key (int k) break; } return; - + case KP_UPARROW: case K_UPARROW: S_LocalSound ("misc/menu1.wav"); @@ -627,7 +627,7 @@ void M_Options_Key (int k) options_cursor++; if (options_cursor >= options_items) options_cursor = 0; - break; + break; case KP_LEFTARROW: case K_LEFTARROW: @@ -740,7 +740,7 @@ void M_Keys_Draw (void) M_Print (12, 32, "Press a key or button for this action"); else M_Print (18, 32, "Enter to change, backspace to clear"); - + // search for known bindings for (i=0 ; iwidth)/2, 4, p); // M_DrawTransPic (72, 32, Draw_CachePic ("gfx/sp_menu.lmp") ); - M_DrawTextBox (60, 10*8, 23, 4); + M_DrawTextBox (60, 10*8, 23, 4); M_PrintWhite (92, 12*8, "QuakeWorld is for"); M_PrintWhite (88, 13*8, "Internet play only"); @@ -1088,7 +1088,7 @@ void M_MultiPlayer_Draw (void) { M_DrawPic ( (320-p->width)/2, 4, p); // M_DrawTransPic (72, 32, Draw_CachePic ("gfx/sp_menu.lmp") ); - M_DrawTextBox (46, 8*8, 27, 9); + M_DrawTextBox (46, 8*8, 27, 9); M_PrintWhite (72, 10*8, "If you want to find QW "); M_PrintWhite (72, 11*8, "games, head on over to: "); M_Print (72, 12*8, " www.quakeworld.net "); diff --git a/qw_client/menu.h b/qw_client/menu.h index 8af40c7..d71a29a 100644 --- a/qw_client/menu.h +++ b/qw_client/menu.h @@ -11,7 +11,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. diff --git a/qw_client/sw_cl_parse.c b/qw_client/sw_cl_parse.c index 00ea070..265c8a6 100644 --- a/qw_client/sw_cl_parse.c +++ b/qw_client/sw_cl_parse.c @@ -12,7 +12,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. @@ -74,12 +74,12 @@ void CL_NewTranslation (int slot) else for (j=0 ; j<16 ; j++) dest[TOP_RANGE+j] = source[top+15-j]; - + if (bottom < 128) memcpy (dest + BOTTOM_RANGE, source + bottom, 16); else for (j=0 ; j<16 ; j++) - dest[BOTTOM_RANGE+j] = source[bottom+15-j]; + dest[BOTTOM_RANGE+j] = source[bottom+15-j]; } } } diff --git a/qw_client/sys_win.c b/qw_client/sys_win.c index 7c4f69d..b50a06a 100644 --- a/qw_client/sys_win.c +++ b/qw_client/sys_win.c @@ -11,7 +11,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. @@ -63,7 +63,7 @@ void Sys_PushFPCW_SetHigh (void); void Sys_DebugLog (char *file, char *fmt, ...) { - va_list argptr; + va_list argptr; static char data[1024]; int fd; @@ -93,7 +93,7 @@ int findhandle (void) { int i; - + for (i=1 ; i= ' ') { - WriteFile(houtput, &ch, 1, &dummy, NULL); + WriteFile(houtput, &ch, 1, &dummy, NULL); text[len] = ch; len = (len + 1) & 0xff; } @@ -630,7 +630,7 @@ HWND hwnd_dialog; int WINAPI -WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, +WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; @@ -682,7 +682,7 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, *lpCmdLine = 0; lpCmdLine++; } - + } } @@ -703,7 +703,7 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, if (rect.left > (rect.top * 2)) { SetWindowPos (hwnd_dialog, 0, - (rect.left / 2) - ((rect.right + (rect.left / 2) - ((rect.right - rect.left) / 2), rect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); @@ -806,7 +806,7 @@ SV_Error (char *error, ...) Con_Printf ("SV_Error: %s\n",string); //SV_FinalMessage (va("server crashed: %s\n", string)); - + Sys_Error ("SV_Error: %s\n",string); } diff --git a/qw_server/progdefs.h b/qw_server/progdefs.h index 038fd5e..591473c 100644 --- a/qw_server/progdefs.h +++ b/qw_server/progdefs.h @@ -10,7 +10,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. diff --git a/qw_server/sv_ccmds.c b/qw_server/sv_ccmds.c index caeec52..f7c4697 100644 --- a/qw_server/sv_ccmds.c +++ b/qw_server/sv_ccmds.c @@ -12,7 +12,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. @@ -260,19 +260,19 @@ void SV_Give_f (void) { char *t; int v; - + if (!sv_allow_cheats) { Con_Printf ("You must run the server with -cheats to enable this command.\n"); return; } - + if (!SV_SetPlayer ()) return; t = Cmd_Argv(2); v = atoi (Cmd_Argv(3)); - + switch (t[0]) { case '2': @@ -285,22 +285,22 @@ void SV_Give_f (void) case '9': sv_player->v.items = (int)sv_player->v.items | IT_SHOTGUN<< (t[0] - '2'); break; - + case 's': sv_player->v.ammo_shells = v; - break; + break; case 'n': sv_player->v.ammo_nails = v; - break; + break; case 'r': sv_player->v.ammo_rockets = v; - break; + break; case 'h': sv_player->v.health = v; - break; + break; case 'c': sv_player->v.ammo_cells = v; - break; + break; } } @@ -309,7 +309,7 @@ void SV_Give_f (void) ====================== SV_Map_f -handle a +handle a map command from the console or progs. ====================== @@ -368,7 +368,7 @@ void SV_Kick_f (void) int uid; uid = atoi(Cmd_Argv(1)); - + for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) { if (!cl->state) @@ -379,7 +379,7 @@ void SV_Kick_f (void) // print directly, because the dropped client won't get the // SV_BroadcastPrintf message SV_ClientPrintf (cl, PRINT_HIGH, "You were kicked from the game\n"); - SV_DropClient (cl); + SV_DropClient (cl); return; } } @@ -411,7 +411,7 @@ void SV_Status_f (void) Con_Printf ("cpu utilization : %3i%%\n",(int)cpu); Con_Printf ("avg response time: %i ms\n",(int)avg); Con_Printf ("packets/frame : %5.2f (%d)\n", pak, num_prstr); - + // min fps lat drp if (sv_redirected != RD_NONE) { // most remote clients are 40 columns @@ -429,7 +429,7 @@ void SV_Status_f (void) Con_Printf ("%6i %5i", cl->userid, (int)cl->edict->v.frags); if (cl->spectator) Con_Printf(" (s)\n"); - else + else Con_Printf("\n"); s = NET_BaseAdrToString ( cl->netchan.remote_address); @@ -463,7 +463,7 @@ void SV_Status_f (void) l = 16 - strlen(s); for (j=0 ; jname); l = 16 - strlen(cl->name); for (j=0 ; jnetchan.qport); if (cl->spectator) Con_Printf(" (s)\n"); - else + else Con_Printf("\n"); - + } } Con_Printf ("\n"); @@ -581,11 +581,11 @@ void SV_Serverinfo_f (void) } Info_SetValueForKey (svs.info, Cmd_Argv(1), Cmd_Argv(2), MAX_SERVERINFO_STRING); - // if this is a cvar, change it too + // if this is a cvar, change it too var = Cvar_FindVar (Cmd_Argv(1)); if (var) { - Z_Free (var->string); // free the old value string + Z_Free (var->string); // free the old value string var->string = CopyString (Cmd_Argv(2)); var->value = Q_atof (var->string); } @@ -636,11 +636,11 @@ SV_Floodport_f void SV_Floodprot_f (void) { int arg1, arg2, arg3; - + if (Cmd_Argc() == 1) { if (fp_messages) { - Con_Printf ("Current floodprot settings: \nAfter %d msgs per %d seconds, silence for %d seconds\n", + Con_Printf ("Current floodprot settings: \nAfter %d msgs per %d seconds, silence for %d seconds\n", fp_messages, fp_persecond, fp_secondsdead); return; } else @@ -662,7 +662,7 @@ void SV_Floodprot_f (void) Con_Printf ("All values must be positive numbers\n"); return; } - + if (arg1 > 10) { Con_Printf ("Can only track up to 10 messages.\n"); return; @@ -793,7 +793,7 @@ SV_Snap void SV_Snap (int uid) { client_t *cl; - char pcxname[80]; + char pcxname[80]; char checkname[MAX_OSPATH]; int i; @@ -814,18 +814,18 @@ void SV_Snap (int uid) snprintf(checkname, sizeof(checkname), "%s/snap", gamedirfile); Sys_mkdir(gamedirfile); Sys_mkdir(checkname); - - for (i=0 ; i<=99 ; i++) - { - pcxname[strlen(pcxname) - 6] = i/10 + '0'; - pcxname[strlen(pcxname) - 5] = i%10 + '0'; + + for (i=0 ; i<=99 ; i++) + { + pcxname[strlen(pcxname) - 6] = i/10 + '0'; + pcxname[strlen(pcxname) - 5] = i%10 + '0'; snprintf(checkname, sizeof(checkname), "%s/snap/%s", gamedirfile, pcxname); if (Sys_FileTime(checkname) == -1) break; // file doesn't exist - } - if (i==100) + } + if (i==100) { - Con_Printf ("Snap: Couldn't create a file, clean some out.\n"); + Con_Printf ("Snap: Couldn't create a file, clean some out.\n"); return; } strcpy(cl->uploadfn, checkname); diff --git a/qw_server/sv_ents.c b/qw_server/sv_ents.c index 3e12dd6..710993e 100644 --- a/qw_server/sv_ents.c +++ b/qw_server/sv_ents.c @@ -10,7 +10,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. @@ -67,7 +67,7 @@ void SV_AddToFatPVS (vec3_t org, mnode_t *node) } return; } - + plane = node->plane; d = DotProduct (org, plane->normal) - plane->dist; if (d > 8) @@ -122,7 +122,7 @@ qboolean SV_AddNailUpdate (edict_t *ent) void SV_EmitNailUpdate (sizebuf_t *msg) { - byte bits[6]; // [48 bits] xyzpy 12 12 12 4 8 + byte bits[6]; // [48 bits] xyzpy 12 12 12 4 8 int n, i; edict_t *ent; int x, y, z, p, yaw; @@ -173,7 +173,7 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb // send an update bits = 0; - + for (i=0 ; i<3 ; i++) { miss = to->origin[i] - from->origin[i]; @@ -183,25 +183,25 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb if ( to->angles[0] != from->angles[0] ) bits |= U_ANGLE1; - + if ( to->angles[1] != from->angles[1] ) bits |= U_ANGLE2; - + if ( to->angles[2] != from->angles[2] ) bits |= U_ANGLE3; - + if ( to->colormap != from->colormap ) bits |= U_COLORMAP; - + if ( to->skinnum != from->skinnum ) bits |= U_SKIN; - + if ( to->frame != from->frame ) bits |= U_FRAME; - + if ( to->effects != from->effects ) bits |= U_EFFECTS; - + if ( to->modelindex != from->modelindex ) bits |= U_MODEL; @@ -225,7 +225,7 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb if (i & U_REMOVE) Sys_Error ("U_REMOVE"); MSG_WriteShort (msg, i); - + if (bits & U_MOREBITS) MSG_WriteByte (msg, bits&255); if (bits & U_MODEL) @@ -239,7 +239,7 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb if (bits & U_EFFECTS) MSG_WriteByte (msg, to->effects); if (bits & U_ORIGIN1) - MSG_WriteCoord (msg, to->origin[0]); + MSG_WriteCoord (msg, to->origin[0]); if (bits & U_ANGLE1) MSG_WriteAngle(msg, to->angles[0]); if (bits & U_ORIGIN2) @@ -350,7 +350,7 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, byte *pvs, sizeb // ZOID visibility tracking if (ent != clent && - !(client->spec_track && client->spec_track - 1 == j)) + !(client->spec_track && client->spec_track - 1 == j)) { if (cl->spectator) continue; @@ -362,9 +362,9 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, byte *pvs, sizeb if (i == ent->num_leafs) continue; // not visible } - + pflags = PF_MSEC | PF_COMMAND; - + if (ent->v.modelindex != sv_playermodel) pflags |= PF_MODEL; for (i=0 ; i<3 ; i++) @@ -391,7 +391,7 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, byte *pvs, sizeb } if (client->spec_track && client->spec_track - 1 == j && - ent->v.weaponframe) + ent->v.weaponframe) pflags |= PF_WEAPONFRAME; MSG_WriteByte (msg, svc_playerinfo); @@ -400,7 +400,7 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, byte *pvs, sizeb for (i=0 ; i<3 ; i++) MSG_WriteCoord (msg, ent->v.origin[i]); - + MSG_WriteByte (msg, ent->v.frame); if (pflags & PF_MSEC) @@ -410,7 +410,7 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, byte *pvs, sizeb msec = 255; MSG_WriteByte (msg, msec); } - + if (pflags & PF_COMMAND) { cmd = cl->lastcmd; @@ -478,7 +478,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg) // send over the players in the PVS SV_WritePlayersToClient (client, clent, pvs, msg); - + // put other visible entities into either a packet_entities or a nails message pack = &frame->entities; pack->num_entities = 0; @@ -495,7 +495,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg) for (i=0 ; i < ent->num_leafs ; i++) if (pvs[ent->leafnums[i] >> 3] & (1 << (ent->leafnums[i]&7) )) break; - + if (i == ent->num_leafs) continue; // not visible diff --git a/qw_server/sv_init.c b/qw_server/sv_init.c index 63ba358..5aa04be 100644 --- a/qw_server/sv_init.c +++ b/qw_server/sv_init.c @@ -11,7 +11,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. @@ -51,7 +51,7 @@ SV_ModelIndex int SV_ModelIndex (char *name) { int i; - + if (!name || !name[0]) return 0; @@ -97,8 +97,8 @@ void SV_CreateBaseline (void) { int i; edict_t *svent; - int entnum; - + int entnum; + for (entnum = 0; entnum < sv.num_edicts ; entnum++) { svent = EDICT_NUM(entnum); @@ -137,7 +137,7 @@ void SV_CreateBaseline (void) // // add to the message // - MSG_WriteByte (&sv.signon,svc_spawnbaseline); + MSG_WriteByte (&sv.signon,svc_spawnbaseline); MSG_WriteShort (&sv.signon,entnum); MSG_WriteByte (&sv.signon, svent->baseline.modelindex); @@ -157,7 +157,7 @@ void SV_CreateBaseline (void) ================ SV_SaveSpawnparms -Grabs the current state of the progs serverinfo flags +Grabs the current state of the progs serverinfo flags and each client for saving across the transition to another level ================ @@ -301,7 +301,7 @@ void SV_SpawnServer (char *server) int i; Con_DPrintf ("SpawnServer: %s\n",server); - + SV_SaveSpawnparms (); svs.spawncount++; // any partially connected client will be @@ -321,13 +321,13 @@ void SV_SpawnServer (char *server) sv.reliable_datagram.maxsize = sizeof(sv.reliable_datagram_buf); sv.reliable_datagram.data = sv.reliable_datagram_buf; - + sv.multicast.maxsize = sizeof(sv.multicast_buf); sv.multicast.data = sv.multicast_buf; - + sv.master.maxsize = sizeof(sv.master_buf); sv.master.data = sv.master_buf; - + sv.signon.maxsize = sizeof(sv.signon_buffers[0]); sv.signon.data = sv.signon_buffers[0]; sv.num_signon_buffers = 1; @@ -340,7 +340,7 @@ void SV_SpawnServer (char *server) // allocate edicts sv.edicts = Hunk_AllocName (MAX_EDICTS*pr_edict_size, "edicts"); - + // leave slots at start for clients only sv.num_edicts = MAX_CLIENTS+1; for (i=0 ; imapname = PR_SetString(sv.name); // serverflags are for cross level information (sigils) pr_global_struct->serverflags = svs.serverflags; - + // run the frame start qc function to let progs check cvars SV_ProgStartFrame (); @@ -409,7 +409,7 @@ void SV_SpawnServer (char *server) // all spawning is completed, any further precache statements // or prog writes to the signon message are errors sv.state = ss_active; - + // run two frames to allow everything to settle host_frametime = 0.1; SV_Physics (); diff --git a/qw_server/sv_main.c b/qw_server/sv_main.c index 05eee48..d640b78 100644 --- a/qw_server/sv_main.c +++ b/qw_server/sv_main.c @@ -12,7 +12,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. @@ -54,7 +54,7 @@ client_t *host_client; // current client cvar_t *sv_maxrate; //cvar_t sv_mintic = {"sv_mintic","0.03"}; // bound the size of the cvar_t *sv_mintic; -//cvar_t sv_maxtic = {"sv_maxtic","0.1"}; // physics time tic +//cvar_t sv_maxtic = {"sv_maxtic","0.1"}; // physics time tic cvar_t *sv_maxtic; //cvar_t developer = {"developer","0"}; // show extra messages @@ -183,7 +183,7 @@ void SV_Error (char *error, ...) Con_Printf ("SV_Error: %s\n",string); SV_FinalMessage (va("server crashed: %s\n", string)); - + SV_Shutdown (); Sys_Error ("SV_Error: %s\n",string); @@ -203,7 +203,7 @@ void SV_FinalMessage (char *message) { int i; client_t *cl; - + SZ_Clear (&net_message); MSG_WriteByte (&net_message, svc_print); MSG_WriteByte (&net_message, PRINT_HIGH); @@ -330,15 +330,15 @@ void SV_FullClientUpdate (client_t *client, sizebuf_t *buf) MSG_WriteByte (buf, svc_updatefrags); MSG_WriteByte (buf, i); MSG_WriteShort (buf, client->old_frags); - + MSG_WriteByte (buf, svc_updateping); MSG_WriteByte (buf, i); MSG_WriteShort (buf, client->ping); - + MSG_WriteByte (buf, svc_updatepl); MSG_WriteByte (buf, i); MSG_WriteByte (buf, client->lossage); - + MSG_WriteByte (buf, svc_updateentertime); MSG_WriteByte (buf, i); MSG_WriteFloat (buf, realtime - client->connection_started); @@ -413,7 +413,7 @@ void SVC_Status (void) top = (top < 0) ? 0 : ((top > 13) ? 13 : top); bottom = (bottom < 0) ? 0 : ((bottom > 13) ? 13 : bottom); ping = cl->ping; - Con_Printf ("%i %i %i %i \"%s\" \"%s\" %i %i\n", cl->userid, + Con_Printf ("%i %i %i %i \"%s\" \"%s\" %i %i\n", cl->userid, cl->old_frags, (int)(realtime - cl->connection_started)/60, ping, cl->name, Info_ValueForKey (cl->userinfo, "skin"), top, bottom); } @@ -543,7 +543,7 @@ void SVC_GetChallenge (void) } // send it back - Netchan_OutOfBandPrint (net_from, "%c%i", S2C_CHALLENGE, + Netchan_OutOfBandPrint (net_from, "%c%i", S2C_CHALLENGE, svs.challenges[i].challenge); } @@ -608,7 +608,7 @@ void SVC_DirectConnect (void) s = Info_ValueForKey (userinfo, "spectator"); if (s[0] && strcmp(s, "0")) { - if (spectator_password->string[0] && + if (spectator_password->string[0] && stricmp(spectator_password->string, "none") && strcmp(spectator_password->string, s) ) { // failed @@ -623,7 +623,7 @@ void SVC_DirectConnect (void) else { s = Info_ValueForKey (userinfo, "password"); - if (password->string[0] && + if (password->string[0] && stricmp(password->string, "none") && strcmp(password->string, s) ) { @@ -647,7 +647,7 @@ void SVC_DirectConnect (void) if (!sv_highchars->value) { byte *p, *q; - for (p = (byte *)newcl->userinfo, q = (byte *)userinfo; + for (p = (byte *)newcl->userinfo, q = (byte *)userinfo; *q && p < (byte *)newcl->userinfo + sizeof(newcl->userinfo)-1; q++) if (*q > 31 && *q <= 127) *p++ = *q; @@ -660,7 +660,7 @@ void SVC_DirectConnect (void) if (cl->state == cs_free) continue; if (NET_CompareBaseAdr (adr, cl->netchan.remote_address) - && ( cl->netchan.qport == qport + && ( cl->netchan.qport == qport || adr.port == cl->netchan.remote_address.port )) { if (cl->state == cs_connected) { @@ -719,7 +719,7 @@ void SVC_DirectConnect (void) return; } - + // build a new connection // accept the new client // this is the only place a client_t is ever initialized @@ -728,7 +728,7 @@ void SVC_DirectConnect (void) Netchan_OutOfBandPrint (adr, "%c", S2C_CONNECTION ); edictnum = (newcl-svs.clients)+1; - + Netchan_Setup (&newcl->netchan , adr, qport); newcl->state = cs_connected; @@ -740,9 +740,9 @@ void SVC_DirectConnect (void) // spectator mode can ONLY be set at join time newcl->spectator = spectator; - ent = EDICT_NUM(edictnum); + ent = EDICT_NUM(edictnum); newcl->edict = ent; - + // parse some info from the info strings SV_ExtractFromUserinfo (newcl); @@ -893,7 +893,7 @@ void SV_ConnectionlessPacket (void) ============================================================================== PACKET FILTERING - + You can add or remove addresses from the filter list with: @@ -946,13 +946,13 @@ qboolean StringToFilter (char *s, ipfilter_t *f) int i, j; byte b[4]; byte m[4]; - + for (i=0 ; i<4 ; i++) { b[i] = 0; m[i] = 0; } - + for (i=0 ; i<4 ; i++) { if (*s < '0' || *s > '9') @@ -960,7 +960,7 @@ qboolean StringToFilter (char *s, ipfilter_t *f) Con_Printf ("Bad filter address: %s\n", s); return false; } - + j = 0; while (*s >= '0' && *s <= '9') { @@ -975,10 +975,10 @@ qboolean StringToFilter (char *s, ipfilter_t *f) break; s++; } - + f->mask = *(unsigned *)m; f->compare = *(unsigned *)b; - + return true; } @@ -990,7 +990,7 @@ SV_AddIP_f void SV_AddIP_f (void) { int i; - + for (i=0 ; ivalue; nclients = 0; @@ -1219,11 +1219,11 @@ void SV_CheckTimeouts (void) nclients++; if (cl->netchan.last_received < droptime) { SV_BroadcastPrintf (PRINT_HIGH, "%s timed out\n", cl->name); - SV_DropClient (cl); + SV_DropClient (cl); cl->state = cs_free; // don't bother with zombie state } } - if (cl->state == cs_zombie && + if (cl->state == cs_zombie && realtime - cl->connection_started > zombietime->value) { cl->state = cs_free; // can now be reused @@ -1293,10 +1293,10 @@ SV_Frame void SV_Frame (double time) { static double start, end; - + start = Sys_DoubleTime (); svs.stats.idle += start - end; - + // keep the random time dependent rand (); @@ -1321,7 +1321,7 @@ void SV_Frame (double time) // check for commands typed to the host SV_GetConsoleCommands (); - + // process console commands Cbuf_Execute (); @@ -1369,7 +1369,7 @@ void SV_InitLocal (void) SV_InitOperatorCommands (); SV_UserInit (); - + rcon_password = Cvar_Get ("rcon_password","",CVAR_NONE, "Password for remote server commands"); password = Cvar_Get ("password","",CVAR_NONE, @@ -1420,7 +1420,7 @@ void SV_InitLocal (void) sv_aim = Cvar_Get ("sv_aim","2",0,"None"); filterban = Cvar_Get ("filterban","1",0,"None"); - + allow_download = Cvar_Get ("allow_download","1",0,"None"); allow_download_skins = Cvar_Get ("allow_download_skins","1",0,"None"); allow_download_models = Cvar_Get ("allow_download_models","1",0,"None"); @@ -1647,7 +1647,7 @@ void SV_ExtractFromUserinfo (client_t *cl) } else break; } - + if (strncmp(val, cl->name, strlen(cl->name))) { if (!sv.paused) { if (!cl->lastnametime || realtime - cl->lastnametime > 5) { @@ -1656,17 +1656,17 @@ void SV_ExtractFromUserinfo (client_t *cl) } else if (cl->lastnamecount++ > 4) { SV_BroadcastPrintf (PRINT_HIGH, "%s was kicked for name spam\n", cl->name); SV_ClientPrintf (cl, PRINT_HIGH, "You were kicked from the game for name spamming\n"); - SV_DropClient (cl); + SV_DropClient (cl); return; } } - + if (cl->state >= cs_spawned && !cl->spectator) SV_BroadcastPrintf (PRINT_HIGH, "%s changed name to %s\n", cl->name, val); } - strncpy (cl->name, val, sizeof(cl->name)-1); + strncpy (cl->name, val, sizeof(cl->name)-1); // rate command val = Info_ValueForKey (cl->userinfo, "rate"); @@ -1741,11 +1741,11 @@ void SV_Init (quakeparms_t *parms) Memory_Init (parms->membase, parms->memsize); SV_InitCvars (); Cbuf_Init (); - Cmd_Init (); + Cmd_Init (); Cvar_Init (); COM_Init (); - + PR_Init (); Mod_Init (); @@ -1761,14 +1761,14 @@ void SV_Init (quakeparms_t *parms) Cbuf_InsertText ("exec server.cfg\n"); host_initialized = true; - + Con_Printf ("Exe: "__TIME__" "__DATE__"\n"); - Con_Printf ("%4.1f megabyte heap\n",parms->memsize/ (1024*1024.0)); + Con_Printf ("%4.1f megabyte heap\n",parms->memsize/ (1024*1024.0)); Con_Printf ("\nServer Version %s\n\n", QF_VERSION); Con_Printf ("======== QuakeWorld Initialized ========\n"); - + // process command line arguments Cmd_StuffCmds_f (); Cbuf_Execute (); diff --git a/qw_server/sv_move.c b/qw_server/sv_move.c index 7d7e02c..c003271 100644 --- a/qw_server/sv_move.c +++ b/qw_server/sv_move.c @@ -10,7 +10,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. @@ -53,7 +53,7 @@ qboolean SV_CheckBottom (edict_t *ent) trace_t trace; int x, y; float mid, bottom; - + VectorAdd (ent->v.origin, ent->v.mins, mins); VectorAdd (ent->v.origin, ent->v.maxs, maxs); @@ -79,7 +79,7 @@ realcheck: // check it for real... // start[2] = mins[2]; - + // the midpoint must be within 16 of the bottom start[0] = stop[0] = (mins[0] + maxs[0])*0.5; start[1] = stop[1] = (mins[1] + maxs[1])*0.5; @@ -89,16 +89,16 @@ realcheck: if (trace.fraction == 1.0) return false; mid = bottom = trace.endpos[2]; - -// the corners must be within 16 of the midpoint + +// the corners must be within 16 of the midpoint for (x=0 ; x<=1 ; x++) for (y=0 ; y<=1 ; y++) { start[0] = stop[0] = x ? maxs[0] : mins[0]; start[1] = stop[1] = y ? maxs[1] : mins[1]; - + trace = SV_Move (start, vec3_origin, vec3_origin, stop, true, ent); - + if (trace.fraction != 1.0 && trace.endpos[2] > bottom) bottom = trace.endpos[2]; if (trace.fraction == 1.0 || mid - trace.endpos[2] > STEPSIZE) @@ -128,7 +128,7 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink) int i; edict_t *enemy; -// try the move +// try the move VectorCopy (ent->v.origin, oldorg); VectorAdd (ent->v.origin, move, neworg); @@ -149,22 +149,22 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink) neworg[2] += 8; } trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, neworg, false, ent); - + if (trace.fraction == 1) { if ( ((int)ent->v.flags & FL_SWIM) && SV_PointContents(trace.endpos) == CONTENTS_EMPTY ) return false; // swim monster left water - + VectorCopy (trace.endpos, ent->v.origin); if (relink) SV_LinkEdict (ent, true); return true; } - + if (enemy == sv.edicts) break; } - + return false; } @@ -194,16 +194,16 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink) if (relink) SV_LinkEdict (ent, true); ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND; -// Con_Printf ("fall down\n"); +// Con_Printf ("fall down\n"); return true; } - + return false; // walked off an edge } // check point traces down for dangling corners VectorCopy (trace.endpos, ent->v.origin); - + if (!SV_CheckBottom (ent)) { if ( (int)ent->v.flags & FL_PARTIALGROUND ) @@ -219,7 +219,7 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink) if ( (int)ent->v.flags & FL_PARTIALGROUND ) { -// Con_Printf ("back on ground\n"); +// Con_Printf ("back on ground\n"); ent->v.flags = (int)ent->v.flags & ~FL_PARTIALGROUND; } ent->v.groundentity = EDICT_TO_PROG(trace.ent); @@ -247,10 +247,10 @@ qboolean SV_StepDirection (edict_t *ent, float yaw, float dist) { vec3_t move, oldorigin; float delta; - + ent->v.ideal_yaw = yaw; PF_changeyaw(); - + yaw = yaw*M_PI*2 / 360; move[0] = cos(yaw)*dist; move[1] = sin(yaw)*dist; @@ -268,7 +268,7 @@ qboolean SV_StepDirection (edict_t *ent, float yaw, float dist) return true; } SV_LinkEdict (ent, true); - + return false; } @@ -281,7 +281,7 @@ SV_FixCheckBottom void SV_FixCheckBottom (edict_t *ent) { // Con_Printf ("SV_FixCheckBottom\n"); - + ent->v.flags = (int)ent->v.flags | FL_PARTIALGROUND; } @@ -325,7 +325,7 @@ void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist) tdir = d[2] == 90 ? 45 : 315; else tdir = d[2] == 90 ? 135 : 215; - + if (tdir != turnaround && SV_StepDirection(actor, tdir, dist)) return; } @@ -338,7 +338,7 @@ void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist) d[2]=tdir; } - if (d[1]!=DI_NODIR && d[1]!=turnaround + if (d[1]!=DI_NODIR && d[1]!=turnaround && SV_StepDirection(actor, d[1], dist)) return; @@ -386,7 +386,7 @@ SV_CloseEnough qboolean SV_CloseEnough (edict_t *ent, edict_t *goal, float dist) { int i; - + for (i=0 ; i<3 ; i++) { if (goal->v.absmin[i] > ent->v.absmax[i] + dist) @@ -407,7 +407,7 @@ void SV_MoveToGoal (void) { edict_t *ent, *goal; float dist; - + ent = PROG_TO_EDICT(pr_global_struct->self); goal = PROG_TO_EDICT(ent->v.goalentity); dist = G_FLOAT(OFS_PARM0); diff --git a/qw_server/sv_nchan.c b/qw_server/sv_nchan.c index 4b72c69..04dbec9 100644 --- a/qw_server/sv_nchan.c +++ b/qw_server/sv_nchan.c @@ -10,7 +10,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. @@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void ClientReliableCheckBlock(client_t *cl, int maxsize) { if (cl->num_backbuf || - cl->netchan.message.cursize > + cl->netchan.message.cursize > cl->netchan.message.maxsize - maxsize - 1) { // we would probably overflow the buffer, save it for next if (!cl->num_backbuf) { diff --git a/qw_server/sv_phys.c b/qw_server/sv_phys.c index 1cd8f49..981992f 100644 --- a/qw_server/sv_phys.c +++ b/qw_server/sv_phys.c @@ -11,7 +11,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. @@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. pushmove objects do not obey gravity, and do not interact with each other or trigger fields, but block normal movement and push normal objects when they move. -onground is set for toss objects when they come to a complete rest. it is set for steping or walking objects +onground is set for toss objects when they come to a complete rest. it is set for steping or walking objects doors, plats, etc are SOLID_BSP, and MOVETYPE_PUSH bonus items are SOLID_TRIGGER touch, and MOVETYPE_TOSS @@ -52,26 +52,26 @@ solid_edge items only clip against bsp models. */ -//cvar_t sv_maxvelocity = {"sv_maxvelocity","2000"}; +//cvar_t sv_maxvelocity = {"sv_maxvelocity","2000"}; cvar_t *sv_maxvelocity; -//cvar_t sv_gravity = { "sv_gravity", "800"}; +//cvar_t sv_gravity = { "sv_gravity", "800"}; cvar_t *sv_gravity; -//cvar_t sv_stopspeed = { "sv_stopspeed", "100"}; +//cvar_t sv_stopspeed = { "sv_stopspeed", "100"}; cvar_t *sv_stopspeed; -//cvar_t sv_maxspeed = { "sv_maxspeed", "320"}; +//cvar_t sv_maxspeed = { "sv_maxspeed", "320"}; cvar_t *sv_maxspeed; //cvar_t sv_spectatormaxspeed = { "sv_spectatormaxspeed", "500"}; cvar_t *sv_spectatormaxspeed; -//cvar_t sv_accelerate = { "sv_accelerate", "10"}; +//cvar_t sv_accelerate = { "sv_accelerate", "10"}; cvar_t *sv_accelerate; -//cvar_t sv_airaccelerate = { "sv_airaccelerate", "0.7"}; +//cvar_t sv_airaccelerate = { "sv_airaccelerate", "0.7"}; cvar_t *sv_airaccelerate; -//cvar_t sv_wateraccelerate = { "sv_wateraccelerate", "10"}; +//cvar_t sv_wateraccelerate = { "sv_wateraccelerate", "10"}; cvar_t *sv_wateraccelerate; -//cvar_t sv_friction = { "sv_friction", "4"}; +//cvar_t sv_friction = { "sv_friction", "4"}; cvar_t *sv_friction; -//cvar_t sv_waterfriction = { "sv_waterfriction", "4"}; +//cvar_t sv_waterfriction = { "sv_waterfriction", "4"}; cvar_t *sv_waterfriction; @@ -158,7 +158,7 @@ qboolean SV_RunThink (edict_t *ent) return true; if (thinktime > sv.time + host_frametime) return true; - + if (thinktime < sv.time) thinktime = sv.time; // don't let things stay in the past. // it is possible to start that way @@ -186,10 +186,10 @@ Two entities have touched, so run their touch functions void SV_Impact (edict_t *e1, edict_t *e2) { int old_self, old_other; - + old_self = pr_global_struct->self; old_other = pr_global_struct->other; - + pr_global_struct->time = sv.time; if (e1->v.touch && e1->v.solid != SOLID_NOT) { @@ -197,7 +197,7 @@ void SV_Impact (edict_t *e1, edict_t *e2) pr_global_struct->other = EDICT_TO_PROG(e2); PR_ExecuteProgram (e1->v.touch); } - + if (e2->v.touch && e2->v.solid != SOLID_NOT) { pr_global_struct->self = EDICT_TO_PROG(e2); @@ -225,13 +225,13 @@ int ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) float backoff; float change; int i, blocked; - + blocked = 0; if (normal[2] > 0) blocked |= 1; // floor if (!normal[2]) blocked |= 2; // step - + backoff = DotProduct (in, normal) * overbounce; for (i=0 ; i<3 ; i++) @@ -241,7 +241,7 @@ int ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) if (out[i] > -STOP_EPSILON && out[i] < STOP_EPSILON) out[i] = 0; } - + return blocked; } @@ -272,14 +272,14 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace) vec3_t end; float time_left; int blocked; - + numbumps = 4; - + blocked = 0; VectorCopy (ent->v.velocity, original_velocity); VectorCopy (ent->v.velocity, primal_velocity); numplanes = 0; - + time_left = time; for (bumpcount=0 ; bumpcountfree) break; // removed by the impact function - + time_left -= time_left * trace.fraction; - + // cliped to another plane if (numplanes >= MAX_CLIP_PLANES) { // this shouldn't really happen @@ -359,7 +359,7 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace) if (j == numplanes) break; } - + if (i != numplanes) { // go along this plane VectorCopy (new_velocity, ent->v.velocity); @@ -422,7 +422,7 @@ trace_t SV_PushEntity (edict_t *ent, vec3_t push) { trace_t trace; vec3_t end; - + VectorAdd (ent->v.origin, push, end); if (ent->v.movetype == MOVETYPE_FLYMISSILE) @@ -432,15 +432,15 @@ trace_t SV_PushEntity (edict_t *ent, vec3_t push) trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NOMONSTERS, ent); else trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL, ent); - + VectorCopy (trace.endpos, ent->v.origin); SV_LinkEdict (ent, true); if (trace.ent) - SV_Impact (ent, trace.ent); + SV_Impact (ent, trace.ent); return trace; -} +} /* @@ -466,7 +466,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move) } VectorCopy (pusher->v.origin, pushorig); - + // move the pusher to it's final position VectorAdd (pusher->v.origin, move, pusher->v.origin); @@ -511,7 +511,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move) moved_edict[num_moved] = check; num_moved++; - // try moving the contacted entity + // try moving the contacted entity VectorAdd (check->v.origin, move, check->v.origin); block = SV_TestEntityPosition (check); if (!block) @@ -542,7 +542,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move) SV_LinkEdict (check, false); continue; } - + VectorCopy (pushorig, pusher->v.origin); SV_LinkEdict (pusher, false); @@ -554,7 +554,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move) pr_global_struct->other = EDICT_TO_PROG(check); PR_ExecuteProgram (pusher->v.blocked); } - + // move back any entities we already moved for (i=0 ; iv.ltime; - + thinktime = ent->v.nextthink; if (thinktime < ent->v.ltime + host_frametime) { @@ -622,7 +622,7 @@ float l; { SV_PushMove (ent, movetime); // advances ent->v.ltime if not blocked } - + if (thinktime > oldltime && thinktime <= ent->v.ltime) { VectorCopy (ent->v.origin, oldorg); @@ -673,7 +673,7 @@ void SV_Physics_Noclip (edict_t *ent) // regular thinking if (!SV_RunThink (ent)) return; - + VectorMA (ent->v.angles, host_frametime, ent->v.avelocity, ent->v.angles); VectorMA (ent->v.origin, host_frametime, ent->v.velocity, ent->v.origin); @@ -705,13 +705,13 @@ void SV_CheckWaterTransition (edict_t *ent) ent->v.waterlevel = 1; return; } - + if (cont <= CONTENTS_WATER) { if (ent->v.watertype == CONTENTS_EMPTY) { // just crossed into water SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1); - } + } ent->v.watertype = cont; ent->v.waterlevel = 1; } @@ -720,7 +720,7 @@ void SV_CheckWaterTransition (edict_t *ent) if (ent->v.watertype != CONTENTS_EMPTY) { // just crossed into water SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1); - } + } ent->v.watertype = CONTENTS_EMPTY; ent->v.waterlevel = cont; } @@ -767,7 +767,7 @@ void SV_Physics_Toss (edict_t *ent) return; if (ent->free) return; - + if (ent->v.movetype == MOVETYPE_BOUNCE) backoff = 1.5; else @@ -777,7 +777,7 @@ void SV_Physics_Toss (edict_t *ent) // stop if on ground if (trace.plane.normal[2] > 0.7) - { + { if (ent->v.velocity[2] < 60 || ent->v.movetype != MOVETYPE_BOUNCE ) { ent->v.flags = (int)ent->v.flags | FL_ONGROUND; @@ -786,7 +786,7 @@ void SV_Physics_Toss (edict_t *ent) VectorCopy (vec3_origin, ent->v.avelocity); } } - + // check for in water SV_CheckWaterTransition (ent); } @@ -837,7 +837,7 @@ void SV_Physics_Step (edict_t *ent) // regular thinking SV_RunThink (ent); - + SV_CheckWaterTransition (ent); } @@ -889,7 +889,7 @@ void SV_RunEntity (edict_t *ent) SV_Physics_Toss (ent); break; default: - SV_Error ("SV_Physics: bad movetype %i", (int)ent->v.movetype); + SV_Error ("SV_Physics: bad movetype %i", (int)ent->v.movetype); } } @@ -908,8 +908,8 @@ void SV_RunNewmis (void) ent = PROG_TO_EDICT(pr_global_struct->newmis); host_frametime = 0.05; pr_global_struct->newmis = 0; - - SV_RunEntity (ent); + + SV_RunEntity (ent); } /* @@ -955,21 +955,21 @@ void SV_Physics (void) SV_RunEntity (ent); SV_RunNewmis (); } - + if (pr_global_struct->force_retouch) - pr_global_struct->force_retouch--; + pr_global_struct->force_retouch--; } void SV_SetMoveVars(void) { - movevars.gravity = sv_gravity->value; - movevars.stopspeed = sv_stopspeed->value; - movevars.maxspeed = sv_maxspeed->value; - movevars.spectatormaxspeed = sv_spectatormaxspeed->value; - movevars.accelerate = sv_accelerate->value; - movevars.airaccelerate = sv_airaccelerate->value; - movevars.wateraccelerate = sv_wateraccelerate->value; - movevars.friction = sv_friction->value; - movevars.waterfriction = sv_waterfriction->value; + movevars.gravity = sv_gravity->value; + movevars.stopspeed = sv_stopspeed->value; + movevars.maxspeed = sv_maxspeed->value; + movevars.spectatormaxspeed = sv_spectatormaxspeed->value; + movevars.accelerate = sv_accelerate->value; + movevars.airaccelerate = sv_airaccelerate->value; + movevars.wateraccelerate = sv_wateraccelerate->value; + movevars.friction = sv_friction->value; + movevars.waterfriction = sv_waterfriction->value; movevars.entgravity = 1.0; } diff --git a/qw_server/sv_send.c b/qw_server/sv_send.c index 1715cd3..4e8702d 100644 --- a/qw_server/sv_send.c +++ b/qw_server/sv_send.c @@ -11,7 +11,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. @@ -120,7 +120,7 @@ void Con_Printf (char *fmt, ...) { va_list argptr; char msg[MAXPRINTMSG]; - + va_start (argptr, fmt); vsnprintf (msg, sizeof(msg), fmt, argptr); va_end (argptr); @@ -157,7 +157,7 @@ void Con_DPrintf (char *fmt, ...) va_start (argptr, fmt); vsnprintf (msg, sizeof(msg), fmt, argptr); va_end (argptr); - + Con_Printf ("%s", msg); } @@ -188,10 +188,10 @@ void SV_ClientPrintf (client_t *cl, int level, char *fmt, ...) { va_list argptr; char string[1024]; - + if (level < cl->messagelevel) return; - + va_start (argptr, fmt); vsnprintf (string, sizeof(string), fmt, argptr); va_end (argptr); @@ -216,7 +216,7 @@ void SV_BroadcastPrintf (int level, char *fmt, ...) va_start (argptr, fmt); vsnprintf (string, sizeof(string), fmt, argptr); va_end (argptr); - + Sys_Printf ("%s", string); // print to the console for (i=0, cl = svs.clients ; ivalue) // no PHS flag @@ -439,7 +439,7 @@ void SV_StartSound (edict_t *entity, int channel, char *sample, int volume, SV_Multicast (origin, reliable ? MULTICAST_PHS_R : MULTICAST_PHS); else SV_Multicast (origin, reliable ? MULTICAST_ALL_R : MULTICAST_ALL); -} +} /* @@ -505,7 +505,7 @@ void SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg) MSG_WriteByte (msg, ent->v.dmg_take); for (i=0 ; i<3 ; i++) MSG_WriteCoord (msg, other->v.origin[i] + 0.5*(other->v.mins[i] + other->v.maxs[i])); - + ent->v.dmg_take = 0; ent->v.dmg_save = 0; } @@ -533,10 +533,10 @@ void SV_UpdateClientStats (client_t *client) edict_t *ent; int stats[MAX_CL_STATS]; int i; - + ent = client->edict; memset (stats, 0, sizeof(stats)); - + // if we are a spectator and we are tracking a player, we get his stats // so our status bar reflects his if (client->spectator && client->spec_track > 0) @@ -746,7 +746,7 @@ void SV_SendClientMessages (void) // it'll fit SZ_Write(&c->netchan.message, c->backbuf_data[0], c->backbuf_size[0]); - + //move along, move along for (j = 1; j < c->num_backbuf; j++) { memcpy(c->backbuf_data[j - 1], c->backbuf_data[j], @@ -792,7 +792,7 @@ void SV_SendClientMessages (void) SV_SendClientDatagram (c); else Netchan_Transmit (&c->netchan, 0, NULL); // just update reliable - + } } @@ -817,7 +817,7 @@ void SV_SendMessagesToAll (void) for (i=0, c = svs.clients ; istate) // FIXME: should this only send to active? c->send_message = true; - + SV_SendClientMessages (); } diff --git a/qw_server/sv_user.c b/qw_server/sv_user.c index 8ee5f18..e3bb233 100644 --- a/qw_server/sv_user.c +++ b/qw_server/sv_user.c @@ -12,7 +12,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. @@ -90,7 +90,7 @@ void SV_New_f (void) //NOTE: This doesn't go through ClientReliableWrite since it's before the user //spawns. These functions are written to not overflow if (host_client->num_backbuf) { - Con_Printf("WARNING %s: [SV_New] Back buffered (%d0, clearing", host_client->name, host_client->netchan.message.cursize); + Con_Printf("WARNING %s: [SV_New] Back buffered (%d0, clearing", host_client->name, host_client->netchan.message.cursize); host_client->num_backbuf = 0; SZ_Clear(&host_client->netchan.message); } @@ -155,19 +155,19 @@ void SV_Soundlist_f (void) } n = atoi(Cmd_Argv(2)); - + //NOTE: This doesn't go through ClientReliableWrite since it's before the user //spawns. These functions are written to not overflow if (host_client->num_backbuf) { - Con_Printf("WARNING %s: [SV_Soundlist] Back buffered (%d0, clearing", host_client->name, host_client->netchan.message.cursize); + Con_Printf("WARNING %s: [SV_Soundlist] Back buffered (%d0, clearing", host_client->name, host_client->netchan.message.cursize); host_client->num_backbuf = 0; SZ_Clear(&host_client->netchan.message); } MSG_WriteByte (&host_client->netchan.message, svc_soundlist); MSG_WriteByte (&host_client->netchan.message, n); - for (s = sv.sound_precache+1 + n ; - *s && host_client->netchan.message.cursize < (MAX_MSGLEN/2); + for (s = sv.sound_precache+1 + n ; + *s && host_client->netchan.message.cursize < (MAX_MSGLEN/2); s++, n++) MSG_WriteString (&host_client->netchan.message, *s); @@ -195,7 +195,7 @@ void SV_Modellist_f (void) Con_Printf ("modellist not valid -- allready spawned\n"); return; } - + // handle the case of a level changing while a client was connecting if ( atoi(Cmd_Argv(1)) != svs.spawncount ) { @@ -209,15 +209,15 @@ void SV_Modellist_f (void) //NOTE: This doesn't go through ClientReliableWrite since it's before the user //spawns. These functions are written to not overflow if (host_client->num_backbuf) { - Con_Printf("WARNING %s: [SV_Modellist] Back buffered (%d0, clearing", host_client->name, host_client->netchan.message.cursize); + Con_Printf("WARNING %s: [SV_Modellist] Back buffered (%d0, clearing", host_client->name, host_client->netchan.message.cursize); host_client->num_backbuf = 0; SZ_Clear(&host_client->netchan.message); } MSG_WriteByte (&host_client->netchan.message, svc_modellist); MSG_WriteByte (&host_client->netchan.message, n); - for (s = sv.model_precache+1+n ; - *s && host_client->netchan.message.cursize < (MAX_MSGLEN/2); + for (s = sv.model_precache+1+n ; + *s && host_client->netchan.message.cursize < (MAX_MSGLEN/2); s++, n++) MSG_WriteString (&host_client->netchan.message, *s); MSG_WriteByte (&host_client->netchan.message, 0); @@ -244,7 +244,7 @@ void SV_PreSpawn_f (void) Con_Printf ("prespawn not valid -- allready spawned\n"); return; } - + // handle the case of a level changing while a client was connecting if ( atoi(Cmd_Argv(1)) != svs.spawncount ) { @@ -252,7 +252,7 @@ void SV_PreSpawn_f (void) SV_New_f (); return; } - + buf = atoi(Cmd_Argv(2)); if (buf >= sv.num_signon_buffers) buf = 0; @@ -265,11 +265,11 @@ void SV_PreSpawn_f (void) if (sv_mapcheck->value && check != sv.worldmodel->checksum && check != sv.worldmodel->checksum2) { - SV_ClientPrintf (host_client, PRINT_HIGH, + SV_ClientPrintf (host_client, PRINT_HIGH, "Map model file does not match (%s), %i != %i/%i.\n" "You may need a new version of the map, or the proper install files.\n", sv.modelname, check, sv.worldmodel->checksum, sv.worldmodel->checksum2); - SV_DropClient (host_client); + SV_DropClient (host_client); return; } host_client->checksum = check; @@ -278,12 +278,12 @@ void SV_PreSpawn_f (void) //NOTE: This doesn't go through ClientReliableWrite since it's before the user //spawns. These functions are written to not overflow if (host_client->num_backbuf) { - Con_Printf("WARNING %s: [SV_PreSpawn] Back buffered (%d0, clearing", host_client->name, host_client->netchan.message.cursize); + Con_Printf("WARNING %s: [SV_PreSpawn] Back buffered (%d0, clearing", host_client->name, host_client->netchan.message.cursize); host_client->num_backbuf = 0; SZ_Clear(&host_client->netchan.message); } - SZ_Write (&host_client->netchan.message, + SZ_Write (&host_client->netchan.message, sv.signon_buffers[buf], sv.signon_buffer_size[buf]); @@ -296,7 +296,7 @@ void SV_PreSpawn_f (void) else { // need to prespawn more MSG_WriteByte (&host_client->netchan.message, svc_stufftext); - MSG_WriteString (&host_client->netchan.message, + MSG_WriteString (&host_client->netchan.message, va("cmd prespawn %i %i\n", svs.spawncount, buf) ); } } @@ -339,7 +339,7 @@ void SV_Spawn_f (void) } - + // send all current names, colors, and frag counts // FIXME: is this a good thing? SZ_Clear (&host_client->netchan.message); @@ -349,11 +349,11 @@ void SV_Spawn_f (void) // normally this could overflow, but no need to check due to backbuf for (i=n, client = svs.clients + n ; istate = cs_spawned; - + // handle the case of a level changing while a client was connecting if ( atoi(Cmd_Argv(1)) != svs.spawncount ) { @@ -462,7 +462,7 @@ void SV_Begin_f (void) // copy spawn parms out of the client_t for (i=0 ; i< NUM_SPAWN_PARMS ; i++) (&pr_global_struct->parm1)[i] = host_client->spawn_parms[i]; - + // call the spawn function pr_global_struct->time = sv.time; pr_global_struct->self = EDICT_TO_PROG(sv_player); @@ -483,7 +483,7 @@ void SV_Begin_f (void) // actually spawn the player pr_global_struct->time = sv.time; pr_global_struct->self = EDICT_TO_PROG(sv_player); - PR_ExecuteProgram (pr_global_struct->PutClientInServer); + PR_ExecuteProgram (pr_global_struct->PutClientInServer); } // clear the net statistics, because connecting gives a bogus picture @@ -567,7 +567,7 @@ void OutofBandPrintf(netadr_t where, char *fmt, ...) { va_list argptr; char send[1024]; - + send[0] = 0xff; send[1] = 0xff; send[2] = 0xff; @@ -640,7 +640,7 @@ Con_DPrintf ("UPLOAD: %d received\n", size); p++; else p = host_client->uploadfn; - OutofBandPrintf(host_client->snap_from, "%s upload completed.\nTo download, enter:\ndownload %s\n", + OutofBandPrintf(host_client->snap_from, "%s upload completed.\nTo download, enter:\ndownload %s\n", host_client->uploadfn, p); } } @@ -667,7 +667,7 @@ void SV_BeginDownload_f(void) // first off, no .. or global allow check if (strstr (name, "..") || !allow_download->value // leading dot is no good - || *name == '.' + || *name == '.' // leading slash bad as well, must be in subdir || *name == '/' // next up, skin check @@ -678,8 +678,8 @@ void SV_BeginDownload_f(void) || (strncmp(name, "sound/", 6) == 0 && !allow_download_sounds->value) // now maps (note special case for maps, must not be in pak) || (strncmp(name, "maps/", 6) == 0 && !allow_download_maps->value) - // MUST be in a subdirectory - || !strstr (name, "/") ) + // MUST be in a subdirectory + || !strstr (name, "/") ) { // don't allow anything with .. path ClientReliableWrite_Begin (host_client, svc_download, 4); ClientReliableWrite_Short (host_client, -1); @@ -760,7 +760,7 @@ void SV_Say (qboolean team) if (fp_messages) { if (!sv.paused && realtimelockedtill) { SV_ClientPrintf(host_client, PRINT_CHAT, - "You can't talk for %d more seconds\n", + "You can't talk for %d more seconds\n", (int) (host_client->lockedtill - realtime)); return; } @@ -886,7 +886,7 @@ void SV_Kill_f (void) SV_ClientPrintf (host_client, PRINT_HIGH, "Can't suicide -- allready dead!\n"); return; } - + pr_global_struct->time = sv.time; pr_global_struct->self = EDICT_TO_PROG(sv_player); PR_ExecuteProgram (pr_global_struct->ClientKill); @@ -958,7 +958,7 @@ void SV_Drop_f (void) SV_EndRedirect (); if (!host_client->spectator) SV_BroadcastPrintf (PRINT_HIGH, "%s dropped\n", host_client->name); - SV_DropClient (host_client); + SV_DropClient (host_client); } /* @@ -972,7 +972,7 @@ void SV_PTrack_f (void) { int i; edict_t *ent, *tent; - + if (!host_client->spectator) return; @@ -985,7 +985,7 @@ void SV_PTrack_f (void) ent->v.goalentity = EDICT_TO_PROG(tent); return; } - + i = atoi(Cmd_Argv(1)); if (i < 0 || i >= MAX_CLIENTS || svs.clients[i].state != cs_spawned || svs.clients[i].spectator) { @@ -1014,14 +1014,14 @@ Change the bandwidth estimate for a client void SV_Rate_f (void) { int rate; - + if (Cmd_Argc() != 2) { SV_ClientPrintf (host_client, PRINT_HIGH, "Current rate is %i\n", (int)(1.0/host_client->netchan.rate + 0.5)); return; } - + rate = atoi(Cmd_Argv(1)); if (rate < 500) rate = 500; @@ -1041,14 +1041,14 @@ Change the message level for a client ================= */ void SV_Msg_f (void) -{ +{ if (Cmd_Argc() != 2) { SV_ClientPrintf (host_client, PRINT_HIGH, "Current msg level is %i\n", host_client->messagelevel); return; } - + host_client->messagelevel = atoi(Cmd_Argv(1)); SV_ClientPrintf (host_client, PRINT_HIGH, "Msg level set to %i\n", host_client->messagelevel); @@ -1088,7 +1088,7 @@ void SV_SetInfo_f (void) Info_SetValueForKey (host_client->userinfo, Cmd_Argv(1), Cmd_Argv(2), MAX_INFO_STRING); // name is extracted below in ExtractFromUserInfo // strncpy (host_client->name, Info_ValueForKey (host_client->userinfo, "name") -// , sizeof(host_client->name)-1); +// , sizeof(host_client->name)-1); // SV_FullClientUpdate (host_client, &sv.reliable_datagram); // host_client->sendinfo = true; @@ -1143,7 +1143,7 @@ ucmd_t ucmds[] = {"drop", SV_Drop_f}, {"pings", SV_Pings_f}, -// issued by hand at client consoles +// issued by hand at client consoles {"rate", SV_Rate_f}, {"kill", SV_Kill_f}, {"pause", SV_Pause_f}, @@ -1162,7 +1162,7 @@ ucmd_t ucmds[] = {"ptrack", SV_PTrack_f}, //ZOID - used with autocam {"snap", SV_NoSnap_f}, - + {NULL, NULL} }; @@ -1174,7 +1174,7 @@ SV_ExecuteUserCommand void SV_ExecuteUserCommand (char *s) { ucmd_t *u; - + Cmd_TokenizeString (s); sv_player = host_client->edict; @@ -1214,21 +1214,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; - + } @@ -1262,8 +1262,8 @@ void AddLinksToPmove ( areanode_t *node ) if (check->v.owner == pl) continue; // player's own missile - if (check->v.solid == SOLID_BSP - || check->v.solid == SOLID_BBOX + if (check->v.solid == SOLID_BSP + || check->v.solid == SOLID_BBOX || check->v.solid == SOLID_SLIDEBOX) { if (check == sv_player) @@ -1292,7 +1292,7 @@ void AddLinksToPmove ( areanode_t *node ) } } } - + // recurse down both sides if (node->axis == -1) return; @@ -1327,8 +1327,8 @@ void AddAllEntsToPmove (void) continue; if (check->v.owner == pl) continue; - if (check->v.solid == SOLID_BSP - || check->v.solid == SOLID_BBOX + if (check->v.solid == SOLID_BSP + || check->v.solid == SOLID_BBOX || check->v.solid == SOLID_SLIDEBOX) { if (check == sv_player) @@ -1371,7 +1371,7 @@ void SV_PreRunCmd(void) { memset(playertouch, 0, sizeof(playertouch)); } - + // Over how long do we make the checks? #define CHECK_TIME 30 @@ -1397,14 +1397,14 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean inside) tmp_time *= 1010; if (host_client->msecs > (int) (tmp_time + 0.5)) { host_client->msec_cheating++; - SV_BroadcastPrintf(PRINT_HIGH, + SV_BroadcastPrintf(PRINT_HIGH, va("%s thinks %d msecs pass in %f msecs. (Strike %d/%d)\n", host_client->name, host_client->msecs, tmp_time, host_client->msec_cheating, CHECK_LIMIT)); if (host_client->msec_cheating >= CHECK_LIMIT) { - SV_BroadcastPrintf(PRINT_HIGH, - va("Strike %d for %s!!\n", + SV_BroadcastPrintf(PRINT_HIGH, + va("Strike %d for %s!!\n", host_client->msec_cheating, host_client->name)); SV_BroadcastPrintf(PRINT_HIGH, "Please see http://www.quakeforge.net/speed_cheat.html for infomation on the cheat detection, and to explain how some may be cheating without knowing it.\n"); SV_DropClient(host_client); @@ -1439,7 +1439,7 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean inside) // // angles -// show 1/3 the pitch angle and all the roll angle +// show 1/3 the pitch angle and all the roll angle if (sv_player->v.health > 0) { if (!sv_player->v.fixangle) @@ -1447,7 +1447,7 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean inside) sv_player->v.angles[PITCH] = -sv_player->v.v_angle[PITCH]/3; sv_player->v.angles[YAW] = sv_player->v.v_angle[YAW]; } - sv_player->v.angles[ROLL] = + sv_player->v.angles[ROLL] = V_CalcRoll (sv_player->v.angles, sv_player->v.velocity)*4; } @@ -1599,11 +1599,11 @@ void SV_ExecuteClientMessage (client_t *cl) frame->ping_time = realtime - frame->senttime; // make sure the reply sequence number matches the incoming - // sequence number + // sequence number if (cl->netchan.incoming_sequence >= cl->netchan.outgoing_sequence) cl->netchan.outgoing_sequence = cl->netchan.incoming_sequence; else - cl->send_message = false; // don't reply, sequences have slipped + cl->send_message = false; // don't reply, sequences have slipped // save time for ping calculations cl->frames[cl->netchan.outgoing_sequence & UPDATE_MASK].senttime = realtime; @@ -1614,7 +1614,7 @@ void SV_ExecuteClientMessage (client_t *cl) // seq_hash = (cl->netchan.incoming_sequence & 0xffff) ; // ^ QW_CHECK_HASH; seq_hash = cl->netchan.incoming_sequence; - + // mark time so clients will know how much to predict // other players cl->localtime = sv.time; @@ -1626,19 +1626,19 @@ void SV_ExecuteClientMessage (client_t *cl) Con_Printf ("SV_ReadClientMessage: badread\n"); SV_DropClient (cl); return; - } + } c = MSG_ReadByte (); if (c == -1) break; - + switch (c) { default: Con_Printf ("SV_ReadClientMessage: unknown command char\n"); SV_DropClient (cl); return; - + case clc_nop: break; @@ -1673,7 +1673,7 @@ void SV_ExecuteClientMessage (client_t *cl) if (calculatedChecksum != checksum) { - Con_DPrintf ("Failed command checksum for %s(%d) (%d != %d)\n", + Con_DPrintf ("Failed command checksum for %s(%d) (%d != %d)\n", cl->name, cl->netchan.incoming_sequence, checksum, calculatedChecksum); return; } @@ -1704,7 +1704,7 @@ void SV_ExecuteClientMessage (client_t *cl) break; - case clc_stringcmd: + case clc_stringcmd: s = MSG_ReadString (); SV_ExecuteUserCommand (s); break; diff --git a/qw_server/sys_unix.c b/qw_server/sys_unix.c index faa4b9b..ec3372d 100644 --- a/qw_server/sys_unix.c +++ b/qw_server/sys_unix.c @@ -10,7 +10,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. @@ -88,12 +88,12 @@ void Sys_Error (char *error, ...) { va_list argptr; char string[1024]; - + va_start (argptr, error); vsnprintf (string, sizeof(string), error, argptr); va_end (argptr); printf ("Fatal error: %s\n",string); - + exit (1); } @@ -136,7 +136,7 @@ char *Sys_ConsoleInput (void) if (len < 1) return NULL; text[len-1] = 0; // rip off the /n and terminate - + return text; } @@ -175,7 +175,7 @@ int main(int argc, char *argv[]) memset (&parms, 0, sizeof(parms)); - COM_InitArgv (argc, argv); + COM_InitArgv (argc, argv); parms.argc = com_argc; parms.argv = com_argv; @@ -192,7 +192,7 @@ int main(int argc, char *argv[]) SV_Init (&parms); // run one frame immediately for first heartbeat - SV_Frame (0.1); + SV_Frame (0.1); // // main loop @@ -218,13 +218,13 @@ int main(int argc, char *argv[]) newtime = Sys_DoubleTime (); time = newtime - oldtime; oldtime = newtime; - - SV_Frame (time); - + + SV_Frame (time); + // extrasleep is just a way to generate a fucked up connection on purpose if (sys_extrasleep->value) usleep (sys_extrasleep->value); - } + } exit(0); } diff --git a/qw_server/sys_win.c b/qw_server/sys_win.c index c27b6c1..235f1ce 100644 --- a/qw_server/sys_win.c +++ b/qw_server/sys_win.c @@ -10,7 +10,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. @@ -170,7 +170,7 @@ int main (int argc, char **argv) int sleep_msec; COM_InitArgv (argc, argv); - + parms.argc = com_argc; parms.argv = com_argv; @@ -211,7 +211,7 @@ int main (int argc, char **argv) Cvar_Set ("sys_sleep", "0"); // run one frame immediately for first heartbeat - SV_Frame (0.1); + SV_Frame (0.1); // // main loop @@ -244,9 +244,9 @@ int main (int argc, char **argv) newtime = Sys_DoubleTime (); time = newtime - oldtime; oldtime = newtime; - - SV_Frame (time); - } + + SV_Frame (time); + } return true; } diff --git a/tools/gas2masm/gas2masm.c b/tools/gas2masm/gas2masm.c index 26d7f18..2cb27bf 100644 --- a/tools/gas2masm/gas2masm.c +++ b/tools/gas2masm/gas2masm.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. @@ -400,7 +400,7 @@ void emitonejumpdata (void) isaddr = 0; len = strlen(tokens[1]); - + if (tokens[1][0] == '*') { for (i=0 ; i32); - + com_token[len] = 0; return data; } @@ -215,7 +215,7 @@ char *Cmd_Argv (int arg) { if ( (unsigned)arg >= cmd_argc ) return ""; - return cmd_argv[arg]; + return cmd_argv[arg]; } /* @@ -226,9 +226,9 @@ Parses the given string into command line tokens. ============ */ void Cmd_TokenizeString (char *text) -{ +{ cmd_argc = 0; - + while (1) { // skip whitespace up to a /n @@ -236,10 +236,10 @@ void Cmd_TokenizeString (char *text) { text++; } - + if (!*text) return; - + text = COM_Parse (text); if (!text) return; @@ -250,7 +250,7 @@ void Cmd_TokenizeString (char *text) cmd_argc++; } } - + } @@ -275,7 +275,7 @@ char *Info_ValueForKey (char *s, char *key) char pkey[512]; static char value[512]; char *o; - + if (*s == '\\') s++; while (1) diff --git a/tools/qwfwd/qwfwd.c b/tools/qwfwd/qwfwd.c index 014d170..e1d75e2 100644 --- a/tools/qwfwd/qwfwd.c +++ b/tools/qwfwd/qwfwd.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. @@ -214,7 +214,7 @@ int main(int argc, char *argv[]) if(i1 > 0) { for (p = peers; p; p = p->next) if (memcmp(&p->sin.sin_addr, &fsin.sin_addr, sizeof(p->sin.sin_addr)) == 0 && - memcmp(&p->sin.sin_port, &fsin.sin_port, sizeof(p->sin.sin_port)) == 0) + memcmp(&p->sin.sin_port, &fsin.sin_port, sizeof(p->sin.sin_port)) == 0) { send(p->s, buffer, i1, 0); time(&p->last); @@ -238,15 +238,15 @@ int main(int argc, char *argv[]) i1 = recv(p->s, buffer, 4096, 0); if(i1 > 0) { time(&p->last); - sendto(s, buffer, i1, 0, (struct sockaddr *) &p->sin, - sizeof(p->sin)); + sendto(s, buffer, i1, 0, (struct sockaddr *) &p->sin, + sizeof(p->sin)); } } } else { peer_t *pp; pp = NULL; - p = peers; + p = peers; while (p) { if (time(NULL) - p->last > 300) { if (!pp && !p->next) { diff --git a/uquake/cl_demo.c b/uquake/cl_demo.c index eaf87ed..6708fa4 100644 --- a/uquake/cl_demo.c +++ b/uquake/cl_demo.c @@ -12,7 +12,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. @@ -101,12 +101,12 @@ int CL_GetMessage(void) { int r, i; float f; - + if (cls.demoplayback) { if (cl.paused) return 0; - // decide if it is time to grab the next message + // decide if it is time to grab the next message if (cls.signon == SIGNONS) // allways grab until fully connected { if (cls.timedemo) @@ -124,7 +124,7 @@ int CL_GetMessage(void) return 0; // don't need another message yet } } - + // get the next message Qread (cls.demofile, &net_message.cursize, 4); VectorCopy (cl.mviewangles[0], cl.mviewangles[1]); @@ -133,7 +133,7 @@ int CL_GetMessage(void) r = Qread (cls.demofile, &f, 4); cl.mviewangles[0][i] = LittleFloat (f); } - + net_message.cursize = LittleLong (net_message.cursize); if (net_message.cursize > MAX_MSGLEN) Sys_Error ("Demo message > MAX_MSGLEN"); @@ -143,17 +143,17 @@ int CL_GetMessage(void) CL_StopPlayback (); return 0; } - + return 1; } while (1) { r = NET_GetMessage (cls.netcon); - + if (r != 1 && r != 2) return r; - + // discard nop keepalive message if (net_message.cursize == 1 && net_message.data[0] == svc_nop) Con_Printf ("<-- server to client keepalive\n"); @@ -163,7 +163,7 @@ int CL_GetMessage(void) if (cls.demorecording) CL_WriteDemoMessage (); - + return r; } @@ -240,16 +240,16 @@ void CL_Record_f (void) Con_Printf ("Forcing CD track to %i\n", cls.forcetrack); } else - track = -1; + track = -1; snprintf(name, sizeof(name), "%s/%s", com_gamedir, Cmd_Argv(1)); - + // // start the map up // if (c > 2) Cmd_ExecuteString ( va("map %s", Cmd_Argv(2)), src_command); - + // // open the demo file // @@ -265,7 +265,7 @@ void CL_Record_f (void) cls.forcetrack = track; Qprintf (cls.demofile, "%i\n", cls.forcetrack); - + cls.demorecording = true; } @@ -296,7 +296,7 @@ void CL_PlayDemo_f (void) // disconnect from server // CL_Disconnect (); - + // // open the demo file // @@ -338,9 +338,9 @@ void CL_FinishTimeDemo (void) { int frames; float time; - + cls.timedemo = false; - + // the first frame didn't count frames = (host_framecount - cls.td_startframe) - 1; time = realtime - cls.td_starttime; @@ -368,10 +368,10 @@ void CL_TimeDemo_f (void) } CL_PlayDemo_f (); - + // cls.td_starttime will be grabbed at the second frame of the demo, so // all the loading time doesn't get counted - + cls.timedemo = true; cls.td_startframe = host_framecount; cls.td_lastframe = -1; // get a new message this frame diff --git a/uquake/cl_parse.c b/uquake/cl_parse.c index ceda65b..4a73839 100644 --- a/uquake/cl_parse.c +++ b/uquake/cl_parse.c @@ -11,7 +11,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. @@ -51,7 +51,7 @@ char *svc_strings[] = "svc_stufftext", // [string] stuffed into client's console buffer // the string should be \n terminated "svc_setangle", // [vec3] set the view angle to this absolute value - + "svc_serverinfo", // [long] version // [string] signon string // [string]..[0]model cache [string]...[0]sounds cache @@ -64,11 +64,11 @@ char *svc_strings[] = "svc_updatecolors", // [byte] [byte] "svc_particle", // [vec3] "svc_damage", // [byte] impact [byte] blood [vec3] from - + "svc_spawnstatic", "OBSOLETE svc_spawnbinary", "svc_spawnbaseline", - + "svc_temp_entity", // "svc_setpause", "svc_signonnum", @@ -108,7 +108,7 @@ entity_t *CL_EntityNum (int num) cl.num_entities++; } } - + return &cl_entities[num]; } @@ -125,21 +125,21 @@ void CL_ParseStartSoundPacket(void) int sound_num; int volume; int field_mask; - float attenuation; + float attenuation; int i; - - field_mask = MSG_ReadByte(); + + field_mask = MSG_ReadByte(); if (field_mask & SND_VOLUME) volume = MSG_ReadByte (); else volume = DEFAULT_SOUND_PACKET_VOLUME; - + if (field_mask & SND_ATTENUATION) attenuation = MSG_ReadByte () / 64.0; else attenuation = DEFAULT_SOUND_PACKET_ATTENUATION; - + channel = MSG_ReadShort (); sound_num = MSG_ReadByte (); @@ -148,12 +148,12 @@ void CL_ParseStartSoundPacket(void) if (ent > MAX_EDICTS) Host_Error ("CL_ParseStartSoundPacket: ent = %i", ent); - + for (i=0 ; i<3 ; i++) pos[i] = MSG_ReadCoord (); - + S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation); -} +} /* ================== @@ -170,7 +170,7 @@ void CL_KeepaliveMessage (void) int ret; sizebuf_t old; byte olddata[8192]; - + if (sv.active) return; // no need if server is local if (cls.demoplayback) @@ -179,14 +179,14 @@ void CL_KeepaliveMessage (void) // read messages from server, should just be nops old = net_message; memcpy (olddata, net_message.data, net_message.cursize); - + do { ret = CL_GetMessage (); switch (ret) { default: - Host_Error ("CL_KeepaliveMessage: CL_GetMessage failed"); + Host_Error ("CL_KeepaliveMessage: CL_GetMessage failed"); case 0: break; // nothing waiting case 1: @@ -228,7 +228,7 @@ void CL_ParseServerInfo (void) int nummodels, numsounds; char model_precache[MAX_MODELS][MAX_QPATH]; char sound_precache[MAX_SOUNDS][MAX_QPATH]; - + Con_DPrintf ("Serverinfo packet received.\n"); // // wipe the client_state_t struct @@ -327,12 +327,12 @@ void CL_ParseServerInfo (void) // local state cl_entities[0].model = cl.worldmodel = cl.model_precache[1]; - + R_NewMap (); Hunk_Check (); // make sure nothing is hurt - - noclip_anglehack = false; // noclip is turned off at start + + noclip_anglehack = false; // noclip is turned off at start } @@ -344,7 +344,7 @@ CL_ParseBaseline void CL_ParseBaseline (entity_t *ent) { int i; - + ent->baseline.modelindex = MSG_ReadByte (); ent->baseline.frame = MSG_ReadByte (); ent->baseline.colormap = MSG_ReadByte(); @@ -367,7 +367,7 @@ Server information pertaining to this client only void CL_ParseClientdata (int bits) { int i, j; - + if (bits & SU_VIEWHEIGHT) cl.viewheight = MSG_ReadChar (); else @@ -377,7 +377,7 @@ void CL_ParseClientdata (int bits) cl.idealpitch = MSG_ReadChar (); else cl.idealpitch = 0; - + VectorCopy (cl.mvelocity[0], cl.mvelocity[1]); for (i=0 ; i<3 ; i++) { @@ -404,7 +404,7 @@ void CL_ParseClientdata (int bits) cl.item_gettime[j] = cl.time; cl.stats[STAT_ITEMS] = i; } - + cl.onground = (bits & SU_ONGROUND) != 0; cl.inwater = (bits & SU_INWATER) != 0; @@ -432,7 +432,7 @@ void CL_ParseClientdata (int bits) cl.stats[STAT_WEAPON] = i; Sbar_Changed (); } - + i = MSG_ReadShort (); if (cl.stats[STAT_HEALTH] != i) { @@ -487,7 +487,7 @@ void CL_ParseStatic (void) { entity_t *ent; int i; - + i = cl.num_statics; if (i >= MAX_STATIC_ENTITIES) Host_Error ("Too many static entities"); @@ -503,7 +503,7 @@ void CL_ParseStatic (void) ent->effects = ent->baseline.effects; VectorCopy (ent->baseline.origin, ent->origin); - VectorCopy (ent->baseline.angles, ent->angles); + VectorCopy (ent->baseline.angles, ent->angles); R_AddEfrags (ent); } @@ -517,13 +517,13 @@ void CL_ParseStaticSound (void) vec3_t org; int sound_num, vol, atten; int i; - + for (i=0 ; i<3 ; i++) org[i] = MSG_ReadCoord (); sound_num = MSG_ReadByte (); vol = MSG_ReadByte (); atten = MSG_ReadByte (); - + S_StaticSound (cl.sound_precache[sound_num], org, vol, atten); } @@ -540,7 +540,7 @@ void CL_ParseServerMessage (void) int cmd; int i; char ch; - + // // if recording demos, copy the message out // @@ -548,13 +548,13 @@ void CL_ParseServerMessage (void) Con_Printf ("%i ",net_message.cursize); else if (cl_shownet->value == 2) Con_Printf ("------------------\n"); - - cl.onground = false; // unless the server says otherwise + + cl.onground = false; // unless the server says otherwise // // parse the message // MSG_BeginReading (); - + while (1) { if (msg_badread) @@ -577,34 +577,34 @@ void CL_ParseServerMessage (void) } SHOWNET(svc_strings[cmd]); - + // other commands switch (cmd) { default: Host_Error ("CL_ParseServerMessage: Illegible server message\n"); break; - + case svc_nop: // Con_Printf ("svc_nop\n"); break; - + case svc_time: cl.mtime[1] = cl.mtime[0]; - cl.mtime[0] = MSG_ReadFloat (); + cl.mtime[0] = MSG_ReadFloat (); break; - + case svc_clientdata: i = MSG_ReadShort (); CL_ParseClientdata (i); break; - + case svc_version: i = MSG_ReadLong (); if (i != PROTOCOL_VERSION) Host_Error ("CL_ParseServerMessage: Server is protocol %i instead of %i\n", i, PROTOCOL_VERSION); break; - + case svc_disconnect: Host_EndGame ("Server disconnected\n"); @@ -617,34 +617,34 @@ void CL_ParseServerMessage (void) Con_Printf ("%c%s", ch, MSG_ReadString ()); con_ormask = 0; break; - + case svc_centerprint: SCR_CenterPrint (MSG_ReadString ()); break; - + case svc_stufftext: Cbuf_AddText (MSG_ReadString ()); break; - + case svc_damage: V_ParseDamage (); break; - + case svc_serverinfo: CL_ParseServerInfo (); vid.recalc_refdef = true; // leave intermission full screen break; - + case svc_setangle: for (i=0 ; i<3 ; i++) cl.viewangles[i] = MSG_ReadAngle (); break; - + case svc_setview: cl.playernum = MSG_ReadShort (); cl.playernum--; break; - + case svc_lightstyle: i = MSG_ReadByte (); if (i >= MAX_LIGHTSTYLES) @@ -652,16 +652,16 @@ void CL_ParseServerMessage (void) Q_strcpy (cl_lightstyle[i].map, MSG_ReadString()); cl_lightstyle[i].length = Q_strlen(cl_lightstyle[i].map); break; - + case svc_sound: CL_ParseStartSoundPacket(); break; - + case svc_stopsound: i = MSG_ReadShort(); S_StopSound(i>>3, i&7); break; - + case svc_updatename: Sbar_Changed (); i = MSG_ReadByte (); @@ -669,14 +669,14 @@ void CL_ParseServerMessage (void) Host_Error ("CL_ParseServerMessage: svc_updatename > MAX_SCOREBOARD"); strcpy (cl.scores[i].name, MSG_ReadString ()); break; - + case svc_updatefrags: Sbar_Changed (); i = MSG_ReadByte (); if (i >= cl.maxclients) Host_Error ("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD"); cl.scores[i].frags = MSG_ReadShort (); - break; + break; case svc_updatecolors: Sbar_Changed (); @@ -686,7 +686,7 @@ void CL_ParseServerMessage (void) cl.scores[i].colors = MSG_ReadByte (); CL_NewTranslation (i); break; - + case svc_particle: R_ParseParticleEffect (); break; @@ -698,7 +698,7 @@ void CL_ParseServerMessage (void) break; case svc_spawnstatic: CL_ParseStatic (); - break; + break; case svc_temp_entity: CL_ParseTEnt (); break; @@ -723,7 +723,7 @@ void CL_ParseServerMessage (void) } } break; - + case svc_signonnum: i = MSG_ReadByte (); if (i <= cls.signon) @@ -746,7 +746,7 @@ void CL_ParseServerMessage (void) Sys_Error ("svc_updatestat: %i is invalid", i); cl.stats[i] = MSG_ReadLong ();; break; - + case svc_spawnstaticsound: CL_ParseStaticSound (); break; @@ -771,14 +771,14 @@ void CL_ParseServerMessage (void) cl.intermission = 2; cl.completed_time = cl.time; vid.recalc_refdef = true; // go to full screen - SCR_CenterPrint (MSG_ReadString ()); + SCR_CenterPrint (MSG_ReadString ()); break; case svc_cutscene: cl.intermission = 3; cl.completed_time = cl.time; vid.recalc_refdef = true; // go to full screen - SCR_CenterPrint (MSG_ReadString ()); + SCR_CenterPrint (MSG_ReadString ()); break; case svc_sellscreen: diff --git a/uquake/cl_pred.c b/uquake/cl_pred.c index a77a0f8..b064f4b 100644 --- a/uquake/cl_pred.c +++ b/uquake/cl_pred.c @@ -11,7 +11,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. diff --git a/uquake/conproc.c b/uquake/conproc.c index 19ebe12..42ca65a 100644 --- a/uquake/conproc.c +++ b/uquake/conproc.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. @@ -97,7 +97,7 @@ DWORD RequestProc (DWORD dwNichts) DWORD dwRet; HANDLE heventWait[2]; int iBeginLine, iEndLine; - + heventWait[0] = heventParentSend; heventWait[1] = heventDone; @@ -106,11 +106,11 @@ DWORD RequestProc (DWORD dwNichts) dwRet = WaitForMultipleObjects (2, heventWait, FALSE, INFINITE); // heventDone fired, so we're exiting. - if (dwRet == WAIT_OBJECT_0 + 1) + if (dwRet == WAIT_OBJECT_0 + 1) break; pBuffer = (int *) GetMappedBuffer (hfileBuffer); - + // hfileBuffer is invalid. Just leave. if (!pBuffer) { @@ -130,7 +130,7 @@ DWORD RequestProc (DWORD dwNichts) // Param2 : End line iBeginLine = pBuffer[1]; iEndLine = pBuffer[2]; - pBuffer[0] = ReadText ((LPTSTR) (pBuffer + 1), iBeginLine, + pBuffer[0] = ReadText ((LPTSTR) (pBuffer + 1), iBeginLine, iEndLine); break; @@ -172,11 +172,11 @@ void ReleaseMappedBuffer (LPVOID pBuffer) BOOL GetScreenBufferLines (int *piLines) { - CONSOLE_SCREEN_BUFFER_INFO info; + CONSOLE_SCREEN_BUFFER_INFO info; BOOL bRet; bRet = GetConsoleScreenBufferInfo (hStdout, &info); - + if (bRet) *piLines = info.dwSize.Y; @@ -238,7 +238,7 @@ BOOL WriteText (LPCTSTR szText) rec.Event.KeyEvent.wVirtualScanCode = CharToCode (*sz); rec.Event.KeyEvent.uChar.AsciiChar = *sz; rec.Event.KeyEvent.uChar.UnicodeChar = *sz; - rec.Event.KeyEvent.dwControlKeyState = isupper(*sz) ? 0x80 : 0x0; + rec.Event.KeyEvent.dwControlKeyState = isupper(*sz) ? 0x80 : 0x0; WriteConsoleInput( hStdin, @@ -264,7 +264,7 @@ BOOL WriteText (LPCTSTR szText) int CharToCode (char c) { char upper; - + upper = toupper(c); switch (c) @@ -277,7 +277,7 @@ int CharToCode (char c) } if (isalpha(c)) - return (30 + upper - 65); + return (30 + upper - 65); if (isdigit(c)) return (1 + upper - 47); @@ -290,7 +290,7 @@ BOOL SetConsoleCXCY(HANDLE hStdout, int cx, int cy) { CONSOLE_SCREEN_BUFFER_INFO info; COORD coordMax; - + coordMax = GetLargestConsoleWindowSize(hStdout); if (cy > coordMax.Y) @@ -298,67 +298,67 @@ BOOL SetConsoleCXCY(HANDLE hStdout, int cx, int cy) if (cx > coordMax.X) cx = coordMax.X; - + if (!GetConsoleScreenBufferInfo(hStdout, &info)) return FALSE; - + // height - info.srWindow.Left = 0; - info.srWindow.Right = info.dwSize.X - 1; + info.srWindow.Left = 0; + info.srWindow.Right = info.dwSize.X - 1; info.srWindow.Top = 0; - info.srWindow.Bottom = cy - 1; - + info.srWindow.Bottom = cy - 1; + if (cy < info.dwSize.Y) { if (!SetConsoleWindowInfo(hStdout, TRUE, &info.srWindow)) return FALSE; - + info.dwSize.Y = cy; - + if (!SetConsoleScreenBufferSize(hStdout, info.dwSize)) return FALSE; } else if (cy > info.dwSize.Y) { info.dwSize.Y = cy; - + if (!SetConsoleScreenBufferSize(hStdout, info.dwSize)) return FALSE; - + if (!SetConsoleWindowInfo(hStdout, TRUE, &info.srWindow)) return FALSE; } - + if (!GetConsoleScreenBufferInfo(hStdout, &info)) return FALSE; - + // width - info.srWindow.Left = 0; + info.srWindow.Left = 0; info.srWindow.Right = cx - 1; info.srWindow.Top = 0; - info.srWindow.Bottom = info.dwSize.Y - 1; - + info.srWindow.Bottom = info.dwSize.Y - 1; + if (cx < info.dwSize.X) { if (!SetConsoleWindowInfo(hStdout, TRUE, &info.srWindow)) return FALSE; - + info.dwSize.X = cx; - + if (!SetConsoleScreenBufferSize(hStdout, info.dwSize)) return FALSE; } else if (cx > info.dwSize.X) { info.dwSize.X = cx; - + if (!SetConsoleScreenBufferSize(hStdout, info.dwSize)) return FALSE; - + if (!SetConsoleWindowInfo(hStdout, TRUE, &info.srWindow)) return FALSE; } - + return TRUE; } - + diff --git a/uquake/conproc.h b/uquake/conproc.h index 743526f..82c23be 100644 --- a/uquake/conproc.h +++ b/uquake/conproc.h @@ -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. diff --git a/uquake/dos_v2.c b/uquake/dos_v2.c index 4a5f7f6..17a5da4 100644 --- a/uquake/dos_v2.c +++ b/uquake/dos_v2.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. diff --git a/uquake/host_cmd.c b/uquake/host_cmd.c index 919ae38..cc34d9a 100644 --- a/uquake/host_cmd.c +++ b/uquake/host_cmd.c @@ -10,7 +10,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. @@ -61,7 +61,7 @@ void Host_Quit_f (void) return; } CL_Disconnect (); - SV_Shutdown(false); + SV_Shutdown(false); Sys_Quit (); } @@ -80,7 +80,7 @@ void Host_Status_f (void) int hours = 0; int j; void (*print) (char *fmt, ...); - + if (cmd_source == src_command) { if (!sv.active) @@ -271,7 +271,7 @@ void Host_Ping_f (void) int i, j; float total; client_t *client; - + if (cmd_source == src_command) { Cmd_ForwardToServer (); @@ -304,7 +304,7 @@ SERVER TRANSITIONS ====================== Host_Map_f -handle a +handle a map command from the console. Active clients are kicked off. ====================== @@ -320,7 +320,7 @@ void Host_Map_f (void) cls.demonum = -1; // stop demo loop in case this fails CL_Disconnect (); - SV_Shutdown(false); + SV_Shutdown(false); key_dest = key_game; // remove console or menu SCR_BeginLoadingPlaque (); @@ -342,7 +342,7 @@ void Host_Map_f (void) #endif if (!sv.active) return; - + if (cls.state != ca_dedicated) { strcpy (cls.spawnparms, ""); @@ -352,9 +352,9 @@ void Host_Map_f (void) strcat (cls.spawnparms, Cmd_Argv(i)); strcat (cls.spawnparms, " "); } - + Cmd_ExecuteString ("connect local", src_command); - } + } } /* @@ -465,7 +465,7 @@ User command to connect to server void Host_Connect_f (void) { char name[MAX_QPATH]; - + cls.demonum = -1; // stop demo loop in case this fails if (cls.demoplayback) { @@ -492,7 +492,7 @@ LOAD / SAVE GAME =============== Host_SavegameComment -Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current +Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current =============== */ void Host_SavegameComment (char *text) @@ -557,7 +557,7 @@ void Host_Savegame_f (void) Con_Printf ("Relative pathnames are not allowed.\n"); return; } - + for (i=0 ; iv.health <= 0) ) @@ -569,7 +569,7 @@ void Host_Savegame_f (void) snprintf(name, sizeof(name), "%s/%s", com_gamedir, Cmd_Argv(1)); COM_DefaultExtension (name, ".sav"); - + Con_Printf ("Saving game to %s...\n", name); f = Qopen (name, "w"); if (!f) @@ -577,7 +577,7 @@ void Host_Savegame_f (void) Con_Printf ("ERROR: couldn't open.\n"); return; } - + Qprintf (f, "%i\n", SAVEGAME_VERSION); Host_SavegameComment (comment); Qprintf (f, "%s\n", comment); @@ -641,7 +641,7 @@ void Host_Loadgame_f (void) snprintf(name, sizeof(name), "%s/%s", com_gamedir, Cmd_Argv(1)); COM_DefaultExtension (name, ".sav"); - + // we can't call SCR_BeginLoadingPlaque, because too much stack space has // been used. The menu calls it before stuffing loadgame command // SCR_BeginLoadingPlaque (); @@ -686,7 +686,7 @@ void Host_Loadgame_f (void) sscanf (buf, "%f\n",&time); CL_Disconnect_f (); - + #ifdef QUAKE2 SV_SpawnServer (mapname, NULL); #else @@ -735,7 +735,7 @@ void Host_Loadgame_f (void) break; // end of file if (strcmp(com_token,"{")) Sys_Error ("First token isn't a brace"); - + if (entnum == -1) { // parse the global vars ED_ParseGlobals (start); @@ -747,7 +747,7 @@ void Host_Loadgame_f (void) memset (&ent->v, 0, progs->entityfields * 4); ent->free = false; ED_ParseEdict (start, ent); - + // link it into the bsp tree if (!ent->free) SV_LinkEdict (ent, false); @@ -755,7 +755,7 @@ void Host_Loadgame_f (void) entnum++; } - + sv.num_edicts = entnum; sv.time = time; @@ -781,7 +781,7 @@ void SaveGamestate() edict_t *ent; snprintf(name, sizeof(name), "%s/%s.gip", com_gamedir, sv.name); - + Con_Printf ("Saving game to %s...\n", name); f = fopen (name, "w"); if (!f) @@ -789,7 +789,7 @@ void SaveGamestate() Con_Printf ("ERROR: couldn't open.\n"); return; } - + fprintf (f, "%i\n", SAVEGAME_VERSION); Host_SavegameComment (comment); fprintf (f, "%s\n", comment); @@ -837,7 +837,7 @@ int LoadGamestate(char *level, char *startspot) // float spawn_parms[NUM_SPAWN_PARMS]; snprintf(name, sizeof(name), "%s/%s.gip", com_gamedir, level); - + Con_Printf ("Loading game from %s...\n", name); f = fopen (name, "r"); if (!f) @@ -912,19 +912,19 @@ int LoadGamestate(char *level, char *startspot) break; // end of file if (strcmp(com_token,"{")) Sys_Error ("First token isn't a brace"); - + // parse an edict ent = EDICT_NUM(entnum); memset (&ent->v, 0, progs->entityfields * 4); ent->free = false; ED_ParseEdict (start, ent); - + // link it into the bsp tree if (!ent->free) SV_LinkEdict (ent, false); } - + // sv.num_edicts = entnum; sv.time = time; Qclose (f); @@ -992,7 +992,7 @@ void Host_Name_f (void) return; } if (Cmd_Argc () == 2) - newName = Cmd_Argv(1); + newName = Cmd_Argv(1); else newName = Cmd_Args(); newName[15] = 0; @@ -1021,15 +1021,15 @@ void Host_Name_f (void) Con_Printf ("%s renamed to %s\n", host_client->name, newName); Q_strcpy (host_client->name, newName); host_client->edict->v.netname = host_client->name - pr_strings; - + // send notification to all clients - + MSG_WriteByte (&sv.reliable_datagram, svc_updatename); MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients); MSG_WriteString (&sv.reliable_datagram, host_client->name); } - + void Host_Version_f (void) { Con_Printf ("Version %s\n", QF_VERSION); @@ -1174,7 +1174,7 @@ void Host_Color_f(void) { int top, bottom; int playercolor; - + if (Cmd_Argc() == 1) { Con_Printf ("\"color\" is \"%i %i\"\n", ((int)cl_color->value) >> 4, ((int)cl_color->value) & 0x0f); @@ -1189,14 +1189,14 @@ void Host_Color_f(void) top = atoi(Cmd_Argv(1)); bottom = atoi(Cmd_Argv(2)); } - + top &= 15; if (top > 13) top = 13; bottom &= 15; if (bottom > 13) bottom = 13; - + playercolor = top*16 + bottom; if (cmd_source == src_command) @@ -1234,7 +1234,7 @@ void Host_Kill_f (void) SV_ClientPrintf ("Can't suicide -- allready dead!\n"); return; } - + pr_global_struct->time = sv.time; pr_global_struct->self = EDICT_TO_PROG(sv_player); PR_ExecuteProgram (pr_global_struct->ClientKill); @@ -1253,7 +1253,7 @@ void Host_Pause_f (void) cl.paused = !cl.paused; return; } - + if (cmd_source == src_command) { Cmd_ForwardToServer (); @@ -1301,7 +1301,7 @@ void Host_PreSpawn_f (void) Con_Printf ("prespawn not valid -- allready spawned\n"); return; } - + SZ_Write (&host_client->message, sv.signon.data, sv.signon.cursize); MSG_WriteByte (&host_client->message, svc_signonnum); MSG_WriteByte (&host_client->message, 2); @@ -1361,7 +1361,7 @@ void Host_Spawn_f (void) if ((Sys_DoubleTime() - host_client->netconnection->connecttime) <= sv.time) Sys_Printf ("%s entered the game\n", host_client->name); - PR_ExecuteProgram (pr_global_struct->PutClientInServer); + PR_ExecuteProgram (pr_global_struct->PutClientInServer); } @@ -1384,7 +1384,7 @@ void Host_Spawn_f (void) MSG_WriteByte (&host_client->message, i); MSG_WriteByte (&host_client->message, client->colors); } - + // send all current light styles for (i=0 ; imessage, STAT_MONSTERS); MSG_WriteLong (&host_client->message, pr_global_struct->killed_monsters); - + // // send a fixangle // Never send a roll angle, because savegames can catch the server @@ -1567,7 +1567,7 @@ void Host_Give_f (void) t = Cmd_Argv(1); v = atoi (Cmd_Argv(2)); - + switch (t[0]) { case '0': @@ -1603,7 +1603,7 @@ void Host_Give_f (void) sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2')); } break; - + case 's': if (rogue) { @@ -1613,7 +1613,7 @@ void Host_Give_f (void) } sv_player->v.ammo_shells = v; - break; + break; case 'n': if (rogue) { @@ -1629,7 +1629,7 @@ void Host_Give_f (void) { sv_player->v.ammo_nails = v; } - break; + break; case 'l': if (rogue) { @@ -1657,7 +1657,7 @@ void Host_Give_f (void) { sv_player->v.ammo_rockets = v; } - break; + break; case 'm': if (rogue) { @@ -1669,10 +1669,10 @@ void Host_Give_f (void) sv_player->v.ammo_rockets = v; } } - break; + break; case 'h': sv_player->v.health = v; - break; + break; case 'c': if (rogue) { @@ -1688,7 +1688,7 @@ void Host_Give_f (void) { sv_player->v.ammo_cells = v; } - break; + break; case 'p': if (rogue) { @@ -1700,7 +1700,7 @@ void Host_Give_f (void) sv_player->v.ammo_cells = v; } } - break; + break; } } @@ -1708,7 +1708,7 @@ edict_t *FindViewthing (void) { int i; edict_t *e; - + for (i=0 ; iv.frame = 0; cl.model_precache[(int)e->v.modelindex] = m; } @@ -1764,7 +1764,7 @@ void Host_Viewframe_f (void) if (f >= m->numframes) f = m->numframes-1; - e->v.frame = f; + e->v.frame = f; } @@ -1777,7 +1777,7 @@ void PrintFrameName (model_t *m, int frame) if (!hdr) return; pframedesc = &hdr->frames[frame]; - + Con_Printf ("frame %i: %s\n", frame, pframedesc->name); } @@ -1790,7 +1790,7 @@ void Host_Viewnext_f (void) { edict_t *e; model_t *m; - + e = FindViewthing (); if (!e) return; @@ -1800,7 +1800,7 @@ void Host_Viewnext_f (void) if (e->v.frame >= m->numframes) e->v.frame = m->numframes - 1; - PrintFrameName (m, e->v.frame); + PrintFrameName (m, e->v.frame); } /* @@ -1823,7 +1823,7 @@ void Host_Viewprev_f (void) if (e->v.frame < 0) e->v.frame = 0; - PrintFrameName (m, e->v.frame); + PrintFrameName (m, e->v.frame); } /* @@ -1846,7 +1846,7 @@ void Host_Startdemos_f (void) if (COM_CheckParm ("-nodemos")) // No demos, please.. return; - + if (cls.state == ca_dedicated) { if (!sv.active) diff --git a/uquake/menu.c b/uquake/menu.c index cc11b85..afaa3a7 100644 --- a/uquake/menu.c +++ b/uquake/menu.c @@ -11,7 +11,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. @@ -1122,14 +1122,14 @@ void M_AdjustSliders (int dir) if (scr_viewsize->value < 30) scr_viewsize->value = 30; if (scr_viewsize->value > 120) - scr_viewsize->value = 120; + scr_viewsize->value = 120; break; case 4: // gamma v_gamma->value -= dir * 0.05; if (v_gamma->value < 0.5) v_gamma->value = 0.5; if (v_gamma->value > 1) - v_gamma->value = 1; + v_gamma->value = 1; break; case 5: // mouse speed sensitivity->value += dir * 0.5; @@ -1654,14 +1654,14 @@ int m_quit_prevstate; qboolean wasInMenus; #ifndef _WIN32 -char *quitMessage [] = +char *quitMessage [] = { /* .........1.........2.... */ " Are you gonna quit ", " this game just like ", " everything else? ", " ", - + " Milord, methinks that ", " thou art a lowly ", " quitter. Is this true? ", @@ -1676,22 +1676,22 @@ char *quitMessage [] = " for trying to quit! ", " Press Y to get ", " smacked out. ", - + " Press Y to quit like a ", " big loser in life. ", " Press N to stay proud ", " and successful! ", - + " If you press Y to ", " quit, I will summon ", " Satan all over your ", " hard drive! ", - + " Um, Asmodeus dislikes ", " his children trying to ", " quit. Press Y to return", " to your Tinkertoys. ", - + " If you quit now, I'll ", " throw a blanket-party ", " for you next time! ", diff --git a/uquake/menu.h b/uquake/menu.h index 945173a..a49ae89 100644 --- a/uquake/menu.h +++ b/uquake/menu.h @@ -11,7 +11,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. diff --git a/uquake/mplib.c b/uquake/mplib.c index 8ad33ff..8e5fe97 100644 --- a/uquake/mplib.c +++ b/uquake/mplib.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. diff --git a/uquake/mplpc.c b/uquake/mplpc.c index 44873b4..1b3065e 100644 --- a/uquake/mplpc.c +++ b/uquake/mplpc.c @@ -9,7 +9,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. diff --git a/uquake/net_bsd.c b/uquake/net_bsd.c index 79d62f8..39bfeb4 100644 --- a/uquake/net_bsd.c +++ b/uquake/net_bsd.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. diff --git a/uquake/net_bw.c b/uquake/net_bw.c index acc6103..86423ac 100644 --- a/uquake/net_bw.c +++ b/uquake/net_bw.c @@ -9,7 +9,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. @@ -183,7 +183,7 @@ typedef struct char reserved1 [2]; unsigned short dataLenPlus8; char reserved2 [2]; - char data[1]; // actual size is - 8 + char data[1]; // actual size is - 8 } BW_UDPreadInfo2_t; typedef struct @@ -724,7 +724,7 @@ int BW_GetAddrFromName (char *name, struct qsockaddr *hostaddr) port = net_hostport; hostaddr->sa_family = AF_INET; - ((struct sockaddr_in *)hostaddr)->sin_port = htons((short)port); + ((struct sockaddr_in *)hostaddr)->sin_port = htons((short)port); ((struct sockaddr_in *)hostaddr)->sin_addr.s_addr = ((ethdevinfo.inetAddr & mask) | addr); diff --git a/uquake/net_bw.h b/uquake/net_bw.h index 341c49a..ce15ec2 100644 --- a/uquake/net_bw.h +++ b/uquake/net_bw.h @@ -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. diff --git a/uquake/net_comx.c b/uquake/net_comx.c index 0e6254d..b259fbf 100644 --- a/uquake/net_comx.c +++ b/uquake/net_comx.c @@ -9,7 +9,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. @@ -708,7 +708,7 @@ int TTY_ReadByte(int handle) if ((ret = CheckStatus (p)) != 0) return ret; - + if (EMPTY (p->inputQueue)) return ERR_TTY_NODATA; @@ -973,7 +973,7 @@ void Com_f (void) Con_Printf("16550\n"); Con_Printf("port: %x\n", p->uart); Con_Printf("irq: %i\n", p->irq); - Con_Printf("baud: %i\n", 115200 / p->baudBits); + Con_Printf("baud: %i\n", 115200 / p->baudBits); Con_Printf("CTS: %s\n", (p->modemStatusIgnore & MSR_CTS) ? "ignored" : "honored"); Con_Printf("DSR: %s\n", (p->modemStatusIgnore & MSR_DSR) ? "ignored" : "honored"); Con_Printf("CD: %s\n", (p->modemStatusIgnore & MSR_CD) ? "ignored" : "honored"); diff --git a/uquake/net_dgrm.c b/uquake/net_dgrm.c index 7fa0d9a..4df1fef 100644 --- a/uquake/net_dgrm.c +++ b/uquake/net_dgrm.c @@ -10,7 +10,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. @@ -342,7 +342,7 @@ int Datagram_GetMessage (qsocket_t *sock) ReSendMessage (sock); while(1) - { + { length = sfunc.Read (sock->socket, (byte *)&packetBuffer, NET_DATAGRAMSIZE, &readaddr); // if ((rand() & 255) > 220) @@ -906,7 +906,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void) int activeNumber; int clientNumber; client_t *client; - + playerNumber = MSG_ReadByte(); activeNumber = -1; for (clientNumber = 0, client = svs.clients; clientNumber < svs.maxclients; clientNumber++, client++) @@ -1083,7 +1083,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void) return NULL; } - // everything is allocated, just fill in the details + // everything is allocated, just fill in the details sock->socket = newsock; sock->landriver = net_landriverlevel; sock->addr = clientaddr; diff --git a/uquake/net_dgrm.h b/uquake/net_dgrm.h index 0789756..78237c0 100644 --- a/uquake/net_dgrm.h +++ b/uquake/net_dgrm.h @@ -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. diff --git a/uquake/net_dos.c b/uquake/net_dos.c index 5dbbdce..eb0a9d0 100644 --- a/uquake/net_dos.c +++ b/uquake/net_dos.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. diff --git a/uquake/net_ipx.c b/uquake/net_ipx.c index fcb4d0e..b37017a 100644 --- a/uquake/net_ipx.c +++ b/uquake/net_ipx.c @@ -9,7 +9,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. @@ -460,7 +460,7 @@ tryagain: if (ecb->completionCode != 0) { - Con_Printf("Warning: IPX_Read error %02x\n", ecb->completionCode); + Con_Printf("Warning: IPX_Read error %02x\n", ecb->completionCode); ecb->fragSize = sizeof(IPXheader) + sizeof(int) + NET_DATAGRAMSIZE; IPX_ListenForPacket(ecb); goto tryagain; diff --git a/uquake/net_ipx.h b/uquake/net_ipx.h index 464fec4..9ff72a4 100644 --- a/uquake/net_ipx.h +++ b/uquake/net_ipx.h @@ -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. diff --git a/uquake/net_loop.c b/uquake/net_loop.c index 2f45db3..4611112 100644 --- a/uquake/net_loop.c +++ b/uquake/net_loop.c @@ -9,7 +9,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. @@ -71,7 +71,7 @@ qsocket_t *Loop_Connect (char *host) { if (Q_strcmp(host,"local") != 0) return NULL; - + localconnectpending = true; if (!loop_client) @@ -102,8 +102,8 @@ qsocket_t *Loop_Connect (char *host) loop_client->driverdata = (void *)loop_server; loop_server->driverdata = (void *)loop_client; - - return loop_client; + + return loop_client; } diff --git a/uquake/net_loop.h b/uquake/net_loop.h index cd174b5..ac12c6a 100644 --- a/uquake/net_loop.h +++ b/uquake/net_loop.h @@ -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. diff --git a/uquake/net_main.c b/uquake/net_main.c index 996a510..8bae846 100644 --- a/uquake/net_main.c +++ b/uquake/net_main.c @@ -9,7 +9,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. @@ -451,7 +451,7 @@ JustDoIt: PrintSlist(); PrintSlistTrailer(); } - + return NULL; } @@ -495,7 +495,7 @@ qsocket_t *NET_CheckNewConnections (void) return ret; } } - + if (recording) { vcrConnect.time = host_time; @@ -640,7 +640,7 @@ struct int NET_SendMessage (qsocket_t *sock, sizebuf_t *data) { int r; - + if (!sock) return -1; @@ -663,7 +663,7 @@ int NET_SendMessage (qsocket_t *sock, sizebuf_t *data) vcrSendMessage.r = r; Sys_FileWrite (vcrFile, &vcrSendMessage, 20); } - + return r; } @@ -671,7 +671,7 @@ int NET_SendMessage (qsocket_t *sock, sizebuf_t *data) int NET_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data) { int r; - + if (!sock) return -1; @@ -694,7 +694,7 @@ int NET_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data) vcrSendMessage.r = r; Sys_FileWrite (vcrFile, &vcrSendMessage, 20); } - + return r; } @@ -710,7 +710,7 @@ message to be transmitted. qboolean NET_CanSendMessage (qsocket_t *sock) { int r; - + if (!sock) return false; @@ -720,7 +720,7 @@ qboolean NET_CanSendMessage (qsocket_t *sock) SetNetTime(); r = sfunc.CanSendMessage(sock); - + if (recording) { vcrSendMessage.time = host_time; @@ -729,7 +729,7 @@ qboolean NET_CanSendMessage (qsocket_t *sock) vcrSendMessage.r = r; Sys_FileWrite (vcrFile, &vcrSendMessage, 20); } - + return r; } diff --git a/uquake/net_mp.c b/uquake/net_mp.c index 2e819dd..7662a6f 100644 --- a/uquake/net_mp.c +++ b/uquake/net_mp.c @@ -9,7 +9,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. @@ -200,7 +200,7 @@ static int PartialIPAddress (char *in, struct qsockaddr *hostaddr) int mask; int run; int port; - + buff[0] = '.'; b = buff; strcpy(buff+1, in); @@ -227,16 +227,16 @@ static int PartialIPAddress (char *in, struct qsockaddr *hostaddr) mask<<=8; addr = (addr<<8) + num; } - + if (*b++ == ':') port = Q_atoi(b); else port = net_hostport; hostaddr->sa_family = AF_INET; - ((struct sockaddr_in *)hostaddr)->sin_port = htons((short)port); + ((struct sockaddr_in *)hostaddr)->sin_port = htons((short)port); ((struct sockaddr_in *)hostaddr)->sin_addr.s_addr = (myAddr & htonl(mask)) | htonl(addr); - + return 0; } //============================================================================= @@ -399,13 +399,13 @@ int MPATH_GetAddrFromName(char *name, struct qsockaddr *addr) if (name[0] >= '0' && name[0] <= '9') return PartialIPAddress (name, addr); - + hostentry = gethostbyname (name); if (!hostentry) return -1; addr->sa_family = AF_INET; - ((struct sockaddr_in *)addr)->sin_port = htons(net_hostport); + ((struct sockaddr_in *)addr)->sin_port = htons(net_hostport); ((struct sockaddr_in *)addr)->sin_addr.s_addr = *(int *)hostentry->h_addr_list[0]; return 0; diff --git a/uquake/net_mp.h b/uquake/net_mp.h index 13e1675..e4cbb11 100644 --- a/uquake/net_mp.h +++ b/uquake/net_mp.h @@ -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. diff --git a/uquake/net_none.c b/uquake/net_none.c index c00c975..d34d75c 100644 --- a/uquake/net_none.c +++ b/uquake/net_none.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. diff --git a/uquake/net_ser.c b/uquake/net_ser.c index 0da574f..5bcaff6 100644 --- a/uquake/net_ser.c +++ b/uquake/net_ser.c @@ -9,7 +9,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. diff --git a/uquake/net_ser.h b/uquake/net_ser.h index 5885ab9..7e133d8 100644 --- a/uquake/net_ser.h +++ b/uquake/net_ser.h @@ -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. diff --git a/uquake/net_udp.c b/uquake/net_udp.c index 3dfbcca..2a2eaba 100644 --- a/uquake/net_udp.c +++ b/uquake/net_udp.c @@ -10,7 +10,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. @@ -93,7 +93,7 @@ int UDP_Init (void) char buff[MAXHOSTNAMELEN]; struct qsockaddr addr; char *colon; - + if (COM_CheckParm ("-noudp")) return -1; @@ -214,7 +214,7 @@ static int PartialIPAddress (char *in, struct qsockaddr *hostaddr) int mask; int run; int port; - + buff[0] = '.'; b = buff; strcpy(buff+1, in); @@ -241,16 +241,16 @@ static int PartialIPAddress (char *in, struct qsockaddr *hostaddr) mask<<=8; addr = (addr<<8) + num; } - + if (*b++ == ':') port = Q_atoi(b); else port = net_hostport; hostaddr->sa_family = AF_INET; - ((struct sockaddr_in *)hostaddr)->sin_port = htons((short)port); + ((struct sockaddr_in *)hostaddr)->sin_port = htons((short)port); ((struct sockaddr_in *)hostaddr)->sin_addr.s_addr = (myAddr & htonl(mask)) | htonl(addr); - + return 0; } //============================================================================= @@ -405,13 +405,13 @@ int UDP_GetAddrFromName(char *name, struct qsockaddr *addr) if (name[0] >= '0' && name[0] <= '9') return PartialIPAddress (name, addr); - + hostentry = gethostbyname (name); if (!hostentry) return -1; addr->sa_family = AF_INET; - ((struct sockaddr_in *)addr)->sin_port = htons(net_hostport); + ((struct sockaddr_in *)addr)->sin_port = htons(net_hostport); ((struct sockaddr_in *)addr)->sin_addr.s_addr = *(int *)hostentry->h_addr_list[0]; return 0; diff --git a/uquake/net_vcr.c b/uquake/net_vcr.c index d5d59b6..4cb19d3 100644 --- a/uquake/net_vcr.c +++ b/uquake/net_vcr.c @@ -9,7 +9,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. @@ -81,7 +81,7 @@ void VCR_Shutdown (void) int VCR_GetMessage (qsocket_t *sock) { int ret; - + if (host_time != next.time || next.op != VCR_OP_GETMESSAGE || next.session != *(long *)(&sock->driverdata)) Sys_Error ("VCR missmatch"); diff --git a/uquake/net_vcr.h b/uquake/net_vcr.h index 864bdd6..95b0f72 100644 --- a/uquake/net_vcr.h +++ b/uquake/net_vcr.h @@ -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. diff --git a/uquake/net_win.c b/uquake/net_win.c index 9c9e6cb..e29d331 100644 --- a/uquake/net_win.c +++ b/uquake/net_win.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. diff --git a/uquake/net_wins.c b/uquake/net_wins.c index f6f14ec..cae16ad 100644 --- a/uquake/net_wins.c +++ b/uquake/net_wins.c @@ -9,7 +9,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. @@ -71,29 +71,29 @@ WSADATA winsockdata; static double blocktime; -BOOL PASCAL FAR BlockingHook(void) -{ +BOOL PASCAL FAR BlockingHook(void) +{ MSG msg; BOOL ret; - + if ((Sys_DoubleTime() - blocktime) > 2.0) { WSACancelBlockingCall(); return FALSE; } - /* get the next message, if any */ - ret = (BOOL) PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); - - /* if we got one, process it */ - if (ret) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - /* TRUE if we got a message */ - return ret; -} + /* get the next message, if any */ + ret = (BOOL) PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); + + /* if we got one, process it */ + if (ret) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + /* TRUE if we got a message */ + return ret; +} void WINS_GetLocalAddress() @@ -134,7 +134,7 @@ int WINS_Init (void) // initialize the Winsock function vectors (we do this instead of statically linking // so we can run on Win 3.1, where there isn't necessarily Winsock) hInst = LoadLibrary("wsock32.dll"); - + if (hInst == NULL) { Con_SafePrintf ("Failed to load winsock.dll\n"); @@ -173,7 +173,7 @@ int WINS_Init (void) if (winsock_initialized == 0) { - wVersionRequested = MAKEWORD(1, 1); + wVersionRequested = MAKEWORD(1, 1); r = pWSAStartup (MAKEWORD(1, 1), &winsockdata); @@ -338,7 +338,7 @@ static int PartialIPAddress (char *in, struct qsockaddr *hostaddr) int mask; int run; int port; - + buff[0] = '.'; b = buff; strcpy(buff+1, in); @@ -365,16 +365,16 @@ static int PartialIPAddress (char *in, struct qsockaddr *hostaddr) mask<<=8; addr = (addr<<8) + num; } - + if (*b++ == ':') port = Q_atoi(b); else port = net_hostport; hostaddr->sa_family = AF_INET; - ((struct sockaddr_in *)hostaddr)->sin_port = htons((short)port); + ((struct sockaddr_in *)hostaddr)->sin_port = htons((short)port); ((struct sockaddr_in *)hostaddr)->sin_addr.s_addr = (myAddr & htonl(mask)) | htonl(addr); - + return 0; } //============================================================================= @@ -538,13 +538,13 @@ int WINS_GetAddrFromName(char *name, struct qsockaddr *addr) if (name[0] >= '0' && name[0] <= '9') return PartialIPAddress (name, addr); - + hostentry = pgethostbyname (name); if (!hostentry) return -1; addr->sa_family = AF_INET; - ((struct sockaddr_in *)addr)->sin_port = htons((unsigned short)net_hostport); + ((struct sockaddr_in *)addr)->sin_port = htons((unsigned short)net_hostport); ((struct sockaddr_in *)addr)->sin_addr.s_addr = *(int *)hostentry->h_addr_list[0]; return 0; diff --git a/uquake/net_wipx.c b/uquake/net_wipx.c index 5b0b788..91aedf0 100644 --- a/uquake/net_wipx.c +++ b/uquake/net_wipx.c @@ -9,7 +9,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. @@ -53,7 +53,7 @@ int WIPX_Init (void) struct qsockaddr addr; char *p; int r; - WORD wVersionRequested; + WORD wVersionRequested; if (COM_CheckParm ("-noipx")) return -1; @@ -64,7 +64,7 @@ int WIPX_Init (void) if (winsock_initialized == 0) { - wVersionRequested = MAKEWORD(1, 1); + wVersionRequested = MAKEWORD(1, 1); r = pWSAStartup (MAKEWORD(1, 1), &winsockdata); @@ -257,7 +257,7 @@ int WIPX_Read (int handle, byte *buf, int len, struct qsockaddr *addr) if (ret < 4) return 0; - + // remove sequence number, it's only needed for DOS IPX ret -= 4; memcpy(buf, packetBuffer+4, ret); diff --git a/uquake/sv_main.c b/uquake/sv_main.c index 6e2c981..0d85432 100644 --- a/uquake/sv_main.c +++ b/uquake/sv_main.c @@ -10,7 +10,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. @@ -139,7 +139,7 @@ void SV_Error (char *error, ...) Con_Printf ("SV_Error: %s\n",string); //SV_FinalMessage (va("server crashed: %s\n", string)); - + SV_Shutdown (false);//XXX Sys_Error ("SV_Error: %s\n",string); @@ -200,7 +200,7 @@ EVENT MESSAGES ============================================================================= */ -/* +/* ================== SV_StartParticle @@ -212,7 +212,7 @@ void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count) int i, v; if (sv.datagram.cursize > MAX_DATAGRAM-16) - return; + return; MSG_WriteByte (&sv.datagram, svc_particle); MSG_WriteCoord (&sv.datagram, org[0]); MSG_WriteCoord (&sv.datagram, org[1]); @@ -228,9 +228,9 @@ void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count) } MSG_WriteByte (&sv.datagram, count); MSG_WriteByte (&sv.datagram, color); -} +} -/* +/* ================== SV_StartSound @@ -244,15 +244,15 @@ An attenuation of 0 will play full volume everywhere in the level. Larger attenuations will drop off. (max 4 attenuation) ================== -*/ +*/ void SV_StartSound (edict_t *entity, int channel, char *sample, int volume, float attenuation) -{ +{ int sound_num; int field_mask; int i; int ent; - + if (volume < 0 || volume > 255) Sys_Error ("SV_StartSound: volume = %i", volume); @@ -263,20 +263,20 @@ void SV_StartSound (edict_t *entity, int channel, char *sample, int volume, Sys_Error ("SV_StartSound: channel = %i", channel); if (sv.datagram.cursize > MAX_DATAGRAM-16) - return; + return; // find precache number for sound for (sound_num=1 ; sound_numv.origin[i]+0.5*(entity->v.mins[i]+entity->v.maxs[i])); -} +} /* ============================================================================== @@ -351,7 +351,7 @@ void SV_SendServerinfo (client_t *client) MSG_WriteByte (&client->message, sv.edicts->v.sounds); MSG_WriteByte (&client->message, sv.edicts->v.sounds); -// set view +// set view MSG_WriteByte (&client->message, svc_setview); MSG_WriteShort (&client->message, NUM_FOR_EDICT(client->edict)); @@ -386,10 +386,10 @@ void SV_ConnectClient (int clientnum) edictnum = clientnum+1; ent = EDICT_NUM(edictnum); - + // set up the client_t netconnection = client->netconnection; - + if (sv.loadgame) memcpy (spawn_parms, client->spawn_parms, sizeof(spawn_parms)); memset (client, 0, sizeof(*client)); @@ -403,7 +403,7 @@ void SV_ConnectClient (int clientnum) client->message.maxsize = sizeof(client->msgbuf); client->message.allowoverflow = true; // we can catch it - client->privileged = false; + client->privileged = false; if (sv.loadgame) memcpy (client->spawn_parms, spawn_parms, sizeof(spawn_parms)); @@ -429,7 +429,7 @@ void SV_CheckForNewClients (void) { struct qsocket_s *ret; int i; - + // // check for new connections // @@ -439,18 +439,18 @@ void SV_CheckForNewClients (void) if (!ret) break; - // + // // init a new client structure - // + // for (i=0 ; iplane; d = DotProduct (org, plane->normal) - plane->dist; if (d > 8) @@ -583,7 +583,7 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) for (i=0 ; i < ent->num_leafs ; i++) if (pvs[ent->leafnums[i] >> 3] & (1 << (ent->leafnums[i]&7) )) break; - + if (i == ent->num_leafs) continue; // not visible } @@ -596,7 +596,7 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) // send an update bits = 0; - + for (i=0 ; i<3 ; i++) { miss = ent->v.origin[i] - ent->baseline.origin[i]; @@ -606,34 +606,34 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) if ( ent->v.angles[0] != ent->baseline.angles[0] ) bits |= U_ANGLE1; - + if ( ent->v.angles[1] != ent->baseline.angles[1] ) bits |= U_ANGLE2; - + if ( ent->v.angles[2] != ent->baseline.angles[2] ) bits |= U_ANGLE3; - + if (ent->v.movetype == MOVETYPE_STEP) bits |= U_NOLERP; // don't mess up the step animation - + if (ent->baseline.colormap != ent->v.colormap) bits |= U_COLORMAP; - + if (ent->baseline.skinnum != ent->v.skin) bits |= U_SKIN; - + if (ent->baseline.frame != ent->v.frame) bits |= U_FRAME; - + if (ent->baseline.effects != ent->v.effects) bits |= U_EFFECTS; - + if (ent->baseline.modelindex != ent->v.modelindex) bits |= U_MODEL; if (e >= 256) bits |= U_LONGENTITY; - + if (bits >= 256) bits |= U_MOREBITS; @@ -641,7 +641,7 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) // write the message // MSG_WriteByte (msg,bits | U_SIGNAL); - + if (bits & U_MOREBITS) MSG_WriteByte (msg, bits>>8); if (bits & U_LONGENTITY) @@ -660,7 +660,7 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) if (bits & U_EFFECTS) MSG_WriteByte (msg, ent->v.effects); if (bits & U_ORIGIN1) - MSG_WriteCoord (msg, ent->v.origin[0]); + MSG_WriteCoord (msg, ent->v.origin[0]); if (bits & U_ANGLE1) MSG_WriteAngle(msg, ent->v.angles[0]); if (bits & U_ORIGIN2) @@ -684,7 +684,7 @@ void SV_CleanupEnts (void) { int e; edict_t *ent; - + ent = NEXT_EDICT(sv.edicts); for (e=1 ; ev.dmg_take); for (i=0 ; i<3 ; i++) MSG_WriteCoord (msg, other->v.origin[i] + 0.5*(other->v.mins[i] + other->v.maxs[i])); - + ent->v.dmg_take = 0; ent->v.dmg_save = 0; } @@ -740,10 +740,10 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) } bits = 0; - + if (ent->v.view_ofs[2] != DEFAULT_VIEWHEIGHT) bits |= SU_VIEWHEIGHT; - + if (ent->v.idealpitch) bits |= SU_IDEALPITCH; @@ -761,13 +761,13 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) #endif bits |= SU_ITEMS; - + if ( (int)ent->v.flags & FL_ONGROUND) bits |= SU_ONGROUND; - + if ( ent->v.waterlevel >= 2) bits |= SU_INWATER; - + for (i=0 ; i<3 ; i++) { if (ent->v.punchangle[i]) @@ -775,7 +775,7 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) if (ent->v.velocity[i]) bits |= (SU_VELOCITY1<v.weaponframe) bits |= SU_WEAPONFRAME; @@ -813,7 +813,7 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) MSG_WriteByte (msg, ent->v.armorvalue); if (bits & SU_WEAPON) MSG_WriteByte (msg, SV_ModelIndex(pr_strings+ent->v.weaponmodel)); - + MSG_WriteShort (msg, ent->v.health); MSG_WriteByte (msg, ent->v.currentammo); MSG_WriteByte (msg, ent->v.ammo_shells); @@ -847,7 +847,7 @@ qboolean SV_SendClientDatagram (client_t *client) { byte buf[MAX_DATAGRAM]; sizebuf_t msg; - + msg.data = buf; msg.maxsize = sizeof(buf); msg.cursize = 0; @@ -870,7 +870,7 @@ qboolean SV_SendClientDatagram (client_t *client) SV_DropClient (true);// if the message couldn't send, kick off return false; } - + return true; } @@ -901,7 +901,7 @@ void SV_UpdateToReliableMessages (void) host_client->old_frags = host_client->edict->v.frags; } } - + for (j=0, client = svs.clients ; jactive) @@ -925,7 +925,7 @@ void SV_SendNop (client_t *client) { sizebuf_t msg; byte buf[4]; - + msg.data = buf; msg.maxsize = sizeof(buf); msg.cursize = 0; @@ -945,7 +945,7 @@ SV_SendClientMessages void SV_SendClientMessages (void) { int i; - + // update frags, names, etc SV_UpdateToReliableMessages (); @@ -965,7 +965,7 @@ void SV_SendClientMessages (void) // the player isn't totally in the game yet // send small keepalive messages if too much time has passed // send a full message when the next signon stage has been requested - // some other message data (name changes, etc) may accumulate + // some other message data (name changes, etc) may accumulate // between signon stages if (!host_client->sendsignon) { @@ -984,7 +984,7 @@ void SV_SendClientMessages (void) host_client->message.overflowed = false; continue; } - + if (host_client->message.cursize || host_client->dropasap) { if (!NET_CanSendMessage (host_client->netconnection)) @@ -1006,8 +1006,8 @@ void SV_SendClientMessages (void) } } } - - + + // clear muzzle flashes SV_CleanupEnts (); } @@ -1030,7 +1030,7 @@ SV_ModelIndex int SV_ModelIndex (char *name) { int i; - + if (!name || !name[0]) return 0; @@ -1052,8 +1052,8 @@ void SV_CreateBaseline (void) { int i; edict_t *svent; - int entnum; - + int entnum; + for (entnum = 0; entnum < sv.num_edicts ; entnum++) { // get the current server version @@ -1081,11 +1081,11 @@ void SV_CreateBaseline (void) svent->baseline.modelindex = SV_ModelIndex(pr_strings + svent->v.model); } - + // // add to the message // - MSG_WriteByte (&sv.signon,svc_spawnbaseline); + MSG_WriteByte (&sv.signon,svc_spawnbaseline); MSG_WriteShort (&sv.signon,entnum); MSG_WriteByte (&sv.signon, svent->baseline.modelindex); @@ -1120,7 +1120,7 @@ void SV_SendReconnect (void) MSG_WriteChar (&msg, svc_stufftext); MSG_WriteString (&msg, "reconnect\n"); NET_SendToAll (&msg, 5); - + if (cls.state != ca_dedicated) #ifdef QUAKE2 Cbuf_InsertText ("reconnect\n"); @@ -1204,7 +1204,7 @@ void SV_SpawnServer (char *server) current_skill = 3; skill->value = (float)current_skill; - + // // set up the new server // @@ -1223,21 +1223,21 @@ void SV_SpawnServer (char *server) // allocate server memory sv.max_edicts = MAX_EDICTS; - + sv.edicts = Hunk_AllocName (sv.max_edicts*pr_edict_size, "edicts"); sv.datagram.maxsize = sizeof(sv.datagram_buf); sv.datagram.cursize = 0; sv.datagram.data = sv.datagram_buf; - + sv.reliable_datagram.maxsize = sizeof(sv.reliable_datagram_buf); sv.reliable_datagram.cursize = 0; sv.reliable_datagram.data = sv.reliable_datagram_buf; - + sv.signon.maxsize = sizeof(sv.signon_buf); sv.signon.cursize = 0; sv.signon.data = sv.signon_buf; - + // leave slots at start for clients only sv.num_edicts = svs.maxclients+1; for (i=0 ; iv, 0, progs->entityfields * 4); ent->free = false; @@ -1300,14 +1300,14 @@ void SV_SpawnServer (char *server) // serverflags are for cross level information (sigils) pr_global_struct->serverflags = svs.serverflags; - + ED_LoadFromFile (sv.worldmodel->entities); sv.active = true; // all setup is completed, any further precache statements are errors sv.state = ss_active; - + // run two frames to allow everything to settle host_frametime = 0.1; SV_Physics (); @@ -1320,7 +1320,7 @@ void SV_SpawnServer (char *server) for (i=0,host_client = svs.clients ; iactive) SV_SendServerinfo (host_client); - + Con_DPrintf ("Server spawned.\n"); } @@ -1328,7 +1328,7 @@ void SV_SpawnServer (char *server) ================= SV_ClientPrintf -Sends text across to be displayed +Sends text across to be displayed FIXME: make this just a stuffed echo? ================= */ @@ -1336,11 +1336,11 @@ void SV_ClientPrintf (char *fmt, ...) { va_list argptr; char string[1024]; - + va_start (argptr, fmt); vsnprintf (string, sizeof(string), fmt, argptr); va_end (argptr); - + MSG_WriteByte (&host_client->message, svc_print); MSG_WriteString (&host_client->message, string); } @@ -1357,11 +1357,11 @@ void SV_BroadcastPrintf (char *fmt, ...) va_list argptr; char string[1024]; int i; - + va_start (argptr, fmt); vsnprintf (string, sizeof(string), fmt, argptr); va_end (argptr); - + for (i=0 ; imessage, svc_disconnect); NET_SendMessage (host_client->netconnection, &host_client->message); } - + if (host_client->edict && host_client->spawned) { // call the prog function for removing a client @@ -1443,12 +1443,12 @@ Host_ServerFrame void SV_FrameMain (void) { -// run the world state +// run the world state pr_global_struct->frametime = host_frametime; // read client messages SV_RunClients (); - + // move things around and think // always pause in single player if in console or menus if (!sv.paused && (svs.maxclients > 1 || key_dest == key_game) ) @@ -1460,12 +1460,12 @@ void SV_Frame (void) float save_host_frametime; float temp_host_frametime; -// run the world state +// run the world state pr_global_struct->frametime = host_frametime; // set the time and clear the general datagram SV_ClearDatagram (); - + // check for new clients SV_CheckForNewClients (); @@ -1489,18 +1489,18 @@ void SV_Frame (void) void SV_Frame (void) { -// run the world state +// run the world state pr_global_struct->frametime = host_frametime; // set the time and clear the general datagram SV_ClearDatagram (); - + // check for new clients SV_CheckForNewClients (); // read client messages SV_RunClients (); - + // move things around and think // always pause in single player if in console or menus if (!sv.paused && (svs.maxclients > 1 || key_dest == key_game) ) diff --git a/uquake/sv_move.c b/uquake/sv_move.c index 67e51ac..8d985bb 100644 --- a/uquake/sv_move.c +++ b/uquake/sv_move.c @@ -9,7 +9,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. @@ -45,7 +45,7 @@ qboolean SV_CheckBottom (edict_t *ent) trace_t trace; int x, y; float mid, bottom; - + VectorAdd (ent->v.origin, ent->v.mins, mins); VectorAdd (ent->v.origin, ent->v.maxs, maxs); @@ -71,7 +71,7 @@ realcheck: // check it for real... // start[2] = mins[2]; - + // the midpoint must be within 16 of the bottom start[0] = stop[0] = (mins[0] + maxs[0])*0.5; start[1] = stop[1] = (mins[1] + maxs[1])*0.5; @@ -81,16 +81,16 @@ realcheck: if (trace.fraction == 1.0) return false; mid = bottom = trace.endpos[2]; - -// the corners must be within 16 of the midpoint + +// the corners must be within 16 of the midpoint for (x=0 ; x<=1 ; x++) for (y=0 ; y<=1 ; y++) { start[0] = stop[0] = x ? maxs[0] : mins[0]; start[1] = stop[1] = y ? maxs[1] : mins[1]; - + trace = SV_Move (start, vec3_origin, vec3_origin, stop, true, ent); - + if (trace.fraction != 1.0 && trace.endpos[2] > bottom) bottom = trace.endpos[2]; if (trace.fraction == 1.0 || mid - trace.endpos[2] > STEPSIZE) @@ -120,7 +120,7 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink) int i; edict_t *enemy; -// try the move +// try the move VectorCopy (ent->v.origin, oldorg); VectorAdd (ent->v.origin, move, neworg); @@ -141,22 +141,22 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink) neworg[2] += 8; } trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, neworg, false, ent); - + if (trace.fraction == 1) { if ( ((int)ent->v.flags & FL_SWIM) && SV_PointContents(trace.endpos) == CONTENTS_EMPTY ) return false; // swim monster left water - + VectorCopy (trace.endpos, ent->v.origin); if (relink) SV_LinkEdict (ent, true); return true; } - + if (enemy == sv.edicts) break; } - + return false; } @@ -186,16 +186,16 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink) if (relink) SV_LinkEdict (ent, true); ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND; -// Con_Printf ("fall down\n"); +// Con_Printf ("fall down\n"); return true; } - + return false; // walked off an edge } // check point traces down for dangling corners VectorCopy (trace.endpos, ent->v.origin); - + if (!SV_CheckBottom (ent)) { if ( (int)ent->v.flags & FL_PARTIALGROUND ) @@ -211,7 +211,7 @@ qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink) if ( (int)ent->v.flags & FL_PARTIALGROUND ) { -// Con_Printf ("back on ground\n"); +// Con_Printf ("back on ground\n"); ent->v.flags = (int)ent->v.flags & ~FL_PARTIALGROUND; } ent->v.groundentity = EDICT_TO_PROG(trace.ent); @@ -239,10 +239,10 @@ qboolean SV_StepDirection (edict_t *ent, float yaw, float dist) { vec3_t move, oldorigin; float delta; - + ent->v.ideal_yaw = yaw; PF_changeyaw(); - + yaw = yaw*M_PI*2 / 360; move[0] = cos(yaw)*dist; move[1] = sin(yaw)*dist; @@ -260,7 +260,7 @@ qboolean SV_StepDirection (edict_t *ent, float yaw, float dist) return true; } SV_LinkEdict (ent, true); - + return false; } @@ -273,7 +273,7 @@ SV_FixCheckBottom void SV_FixCheckBottom (edict_t *ent) { // Con_Printf ("SV_FixCheckBottom\n"); - + ent->v.flags = (int)ent->v.flags | FL_PARTIALGROUND; } @@ -317,7 +317,7 @@ void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist) tdir = d[2] == 90 ? 45 : 315; else tdir = d[2] == 90 ? 135 : 215; - + if (tdir != turnaround && SV_StepDirection(actor, tdir, dist)) return; } @@ -330,7 +330,7 @@ void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist) d[2]=tdir; } - if (d[1]!=DI_NODIR && d[1]!=turnaround + if (d[1]!=DI_NODIR && d[1]!=turnaround && SV_StepDirection(actor, d[1], dist)) return; @@ -378,7 +378,7 @@ SV_CloseEnough qboolean SV_CloseEnough (edict_t *ent, edict_t *goal, float dist) { int i; - + for (i=0 ; i<3 ; i++) { if (goal->v.absmin[i] > ent->v.absmax[i] + dist) diff --git a/uquake/sv_phys.c b/uquake/sv_phys.c index 1482758..e1530b6 100644 --- a/uquake/sv_phys.c +++ b/uquake/sv_phys.c @@ -9,7 +9,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. @@ -34,7 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. pushmove objects do not obey gravity, and do not interact with each other or trigger fields, but block normal movement and push normal objects when they move. -onground is set for toss objects when they come to a complete rest. it is set for steping or walking objects +onground is set for toss objects when they come to a complete rest. it is set for steping or walking objects doors, plats, etc are SOLID_BSP, and MOVETYPE_PUSH bonus items are SOLID_TRIGGER touch, and MOVETYPE_TOSS @@ -143,7 +143,7 @@ qboolean SV_RunThink (edict_t *ent) thinktime = ent->v.nextthink; if (thinktime <= 0 || thinktime > sv.time + host_frametime) return true; - + if (thinktime < sv.time) thinktime = sv.time; // don't let things stay in the past. // it is possible to start that way @@ -166,10 +166,10 @@ Two entities have touched, so run their touch functions void SV_Impact (edict_t *e1, edict_t *e2) { int old_self, old_other; - + old_self = pr_global_struct->self; old_other = pr_global_struct->other; - + pr_global_struct->time = sv.time; if (e1->v.touch && e1->v.solid != SOLID_NOT) { @@ -177,7 +177,7 @@ void SV_Impact (edict_t *e1, edict_t *e2) pr_global_struct->other = EDICT_TO_PROG(e2); PR_ExecuteProgram (e1->v.touch); } - + if (e2->v.touch && e2->v.solid != SOLID_NOT) { pr_global_struct->self = EDICT_TO_PROG(e2); @@ -205,13 +205,13 @@ int ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) float backoff; float change; int i, blocked; - + blocked = 0; if (normal[2] > 0) blocked |= 1; // floor if (!normal[2]) blocked |= 2; // step - + backoff = DotProduct (in, normal) * overbounce; for (i=0 ; i<3 ; i++) @@ -221,7 +221,7 @@ int ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) if (out[i] > -STOP_EPSILON && out[i] < STOP_EPSILON) out[i] = 0; } - + return blocked; } @@ -252,14 +252,14 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace) vec3_t end; float time_left; int blocked; - + numbumps = 4; - + blocked = 0; VectorCopy (ent->v.velocity, original_velocity); VectorCopy (ent->v.velocity, primal_velocity); numplanes = 0; - + time_left = time; for (bumpcount=0 ; bumpcountfree) break; // removed by the impact function - + time_left -= time_left * trace.fraction; - + // cliped to another plane if (numplanes >= MAX_CLIP_PLANES) { // this shouldn't really happen @@ -342,7 +342,7 @@ int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace) if (j == numplanes) break; } - + if (i != numplanes) { // go along this plane VectorCopy (new_velocity, ent->v.velocity); @@ -422,7 +422,7 @@ trace_t SV_PushEntity (edict_t *ent, vec3_t push) { trace_t trace; vec3_t end; - + VectorAdd (ent->v.origin, push, end); if (ent->v.movetype == MOVETYPE_FLYMISSILE) @@ -431,16 +431,16 @@ trace_t SV_PushEntity (edict_t *ent, vec3_t push) // only clip against bmodels trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NOMONSTERS, ent); else - trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL, ent); - + trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL, ent); + VectorCopy (trace.endpos, ent->v.origin); SV_LinkEdict (ent, true); if (trace.ent) - SV_Impact (ent, trace.ent); + SV_Impact (ent, trace.ent); return trace; -} +} /* @@ -473,7 +473,7 @@ void SV_PushMove (edict_t *pusher, float movetime) } VectorCopy (pusher->v.origin, pushorig); - + // move the pusher to it's final position VectorAdd (pusher->v.origin, move, pusher->v.origin); @@ -516,13 +516,13 @@ void SV_PushMove (edict_t *pusher, float movetime) // remove the onground flag for non-players if (check->v.movetype != MOVETYPE_WALK) check->v.flags = (int)check->v.flags & ~FL_ONGROUND; - + VectorCopy (check->v.origin, entorig); VectorCopy (check->v.origin, moved_from[num_moved]); moved_edict[num_moved] = check; num_moved++; - // try moving the contacted entity + // try moving the contacted entity pusher->v.solid = SOLID_NOT; SV_PushEntity (check, move); pusher->v.solid = SOLID_BSP; @@ -539,7 +539,7 @@ void SV_PushMove (edict_t *pusher, float movetime) VectorCopy (check->v.mins, check->v.maxs); continue; } - + VectorCopy (entorig, check->v.origin); SV_LinkEdict (check, true); @@ -555,7 +555,7 @@ void SV_PushMove (edict_t *pusher, float movetime) pr_global_struct->other = EDICT_TO_PROG(check); PR_ExecuteProgram (pusher->v.blocked); } - + // move back any entities we already moved for (i=0 ; iv.angles, pushorig); - + // move the pusher to it's final position VectorAdd (pusher->v.angles, amove, pusher->v.angles); @@ -642,7 +642,7 @@ void SV_PushRotate (edict_t *pusher, float movetime) // remove the onground flag for non-players if (check->v.movetype != MOVETYPE_WALK) check->v.flags = (int)check->v.flags & ~FL_ONGROUND; - + VectorCopy (check->v.origin, entorig); VectorCopy (check->v.origin, moved_from[num_moved]); moved_edict[num_moved] = check; @@ -655,7 +655,7 @@ void SV_PushRotate (edict_t *pusher, float movetime) org2[2] = DotProduct (org, up); VectorSubtract (org2, org, move); - // try moving the contacted entity + // try moving the contacted entity pusher->v.solid = SOLID_NOT; SV_PushEntity (check, move); pusher->v.solid = SOLID_BSP; @@ -672,7 +672,7 @@ void SV_PushRotate (edict_t *pusher, float movetime) VectorCopy (check->v.mins, check->v.maxs); continue; } - + VectorCopy (entorig, check->v.origin); SV_LinkEdict (check, true); @@ -688,7 +688,7 @@ void SV_PushRotate (edict_t *pusher, float movetime) pr_global_struct->other = EDICT_TO_PROG(check); PR_ExecuteProgram (pusher->v.blocked); } - + // move back any entities we already moved for (i=0 ; iv.ltime; - + thinktime = ent->v.nextthink; if (thinktime < ent->v.ltime + host_frametime) { @@ -741,7 +741,7 @@ void SV_Physics_Pusher (edict_t *ent) #endif SV_PushMove (ent, movetime); // advances ent->v.ltime if not blocked } - + if (thinktime > oldltime && thinktime <= ent->v.ltime) { ent->v.nextthink = 0; @@ -792,7 +792,7 @@ void SV_CheckStuck (edict_t *ent) SV_LinkEdict (ent, true); return; } - + for (z=0 ; z< 18 ; z++) for (i=-1 ; i <= 1 ; i++) for (j=-1 ; j <= 1 ; j++) @@ -807,7 +807,7 @@ void SV_CheckStuck (edict_t *ent) return; } } - + VectorCopy (org, ent->v.origin); Con_DPrintf ("player is stuck.\n"); } @@ -828,8 +828,8 @@ qboolean SV_CheckWater (edict_t *ent) point[0] = ent->v.origin[0]; point[1] = ent->v.origin[1]; - point[2] = ent->v.origin[2] + ent->v.mins[2] + 1; - + point[2] = ent->v.origin[2] + ent->v.mins[2] + 1; + ent->v.waterlevel = 0; ent->v.watertype = CONTENTS_EMPTY; cont = SV_PointContents (point); @@ -867,7 +867,7 @@ qboolean SV_CheckWater (edict_t *ent) } #endif } - + return ent->v.waterlevel > 1; } @@ -882,19 +882,19 @@ void SV_WallFriction (edict_t *ent, trace_t *trace) vec3_t forward, right, up; float d, i; vec3_t into, side; - + AngleVectors (ent->v.v_angle, forward, right, up); d = DotProduct (trace->plane.normal, forward); - + d += 0.5; if (d >= 0) return; - + // cut the tangential velocity i = DotProduct (trace->plane.normal, ent->v.velocity); VectorScale (trace->plane.normal, i, into); VectorSubtract (ent->v.velocity, into, side); - + ent->v.velocity[0] = side[0] * (1 + d); ent->v.velocity[1] = side[1] * (1 + d); } @@ -918,7 +918,7 @@ int SV_TryUnstick (edict_t *ent, vec3_t oldvel) vec3_t dir; int clip; trace_t steptrace; - + VectorCopy (ent->v.origin, oldorg); VectorCopy (vec3_origin, dir); @@ -936,7 +936,7 @@ int SV_TryUnstick (edict_t *ent, vec3_t oldvel) case 6: dir[0] = 2; dir[1] = -2; break; case 7: dir[0] = -2; dir[1] = -2; break; } - + SV_PushEntity (ent, dir); // retry the original move @@ -951,11 +951,11 @@ int SV_TryUnstick (edict_t *ent, vec3_t oldvel) //Con_DPrintf ("unstuck!\n"); return clip; } - + // go back to the original pos and try again VectorCopy (oldorg, ent->v.origin); } - + VectorCopy (vec3_origin, ent->v.velocity); return 7; // still not moving } @@ -976,16 +976,16 @@ void SV_WalkMove (edict_t *ent) int clip; int oldonground; trace_t steptrace, downtrace; - + // // do a regular slide move unless it looks like you ran into a step // oldonground = (int)ent->v.flags & FL_ONGROUND; ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND; - + VectorCopy (ent->v.origin, oldorg); VectorCopy (ent->v.velocity, oldvel); - + clip = SV_FlyMove (ent, host_frametime, &steptrace); if ( !(clip & 2) ) @@ -993,13 +993,13 @@ void SV_WalkMove (edict_t *ent) if (!oldonground && ent->v.waterlevel == 0) return; // don't stair up while jumping - + if (ent->v.movetype != MOVETYPE_WALK) return; // gibbed by a trigger - + if (sv_nostep->value) return; - + if ( (int)sv_player->v.flags & FL_WATERJUMP ) return; @@ -1035,7 +1035,7 @@ void SV_WalkMove (edict_t *ent) clip = SV_TryUnstick (ent, oldvel); } } - + // extra friction based on view angle if ( clip & 2 ) SV_WallFriction (ent, &steptrace); @@ -1055,7 +1055,7 @@ void SV_WalkMove (edict_t *ent) { // if the push down didn't end up on good ground, use the move without // the step up. This happens near wall / slope combinations, and can -// cause the player to hop up higher on a slope too steep to climb +// cause the player to hop up higher on a slope too steep to climb VectorCopy (nosteporg, ent->v.origin); VectorCopy (nostepvel, ent->v.velocity); } @@ -1076,11 +1076,11 @@ void SV_Physics_Client (edict_t *ent, int num) // // call standard client pre-think -// +// pr_global_struct->time = sv.time; pr_global_struct->self = EDICT_TO_PROG(ent); PR_ExecuteProgram (pr_global_struct->PlayerPreThink); - + // // do a move // @@ -1111,7 +1111,7 @@ void SV_Physics_Client (edict_t *ent, int num) VectorSubtract (ent->v.velocity, ent->v.basevelocity, ent->v.velocity); #endif break; - + case MOVETYPE_TOSS: case MOVETYPE_BOUNCE: SV_Physics_Toss (ent); @@ -1122,20 +1122,20 @@ void SV_Physics_Client (edict_t *ent, int num) return; SV_FlyMove (ent, host_frametime, NULL); break; - + case MOVETYPE_NOCLIP: if (!SV_RunThink (ent)) return; VectorMA (ent->v.origin, host_frametime, ent->v.velocity, ent->v.origin); break; - + default: Sys_Error ("SV_Physics_client: bad movetype %i", (int)ent->v.movetype); } // // call standard player post-think -// +// SV_LinkEdict (ent, true); pr_global_struct->time = sv.time; @@ -1187,7 +1187,7 @@ void SV_Physics_Noclip (edict_t *ent) // regular thinking if (!SV_RunThink (ent)) return; - + VectorMA (ent->v.angles, host_frametime, ent->v.avelocity, ent->v.angles); VectorMA (ent->v.origin, host_frametime, ent->v.velocity, ent->v.origin); @@ -1213,10 +1213,10 @@ void SV_CheckWaterTransition (edict_t *ent) int cont; #ifdef QUAKE2 vec3_t point; - + point[0] = ent->v.origin[0]; point[1] = ent->v.origin[1]; - point[2] = ent->v.origin[2] + ent->v.mins[2] + 1; + point[2] = ent->v.origin[2] + ent->v.mins[2] + 1; cont = SV_PointContents (point); #else cont = SV_PointContents (ent->v.origin); @@ -1227,13 +1227,13 @@ void SV_CheckWaterTransition (edict_t *ent) ent->v.waterlevel = 1; return; } - + if (cont <= CONTENTS_WATER) { if (ent->v.watertype == CONTENTS_EMPTY) { // just crossed into water SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1); - } + } ent->v.watertype = cont; ent->v.waterlevel = 1; } @@ -1242,7 +1242,7 @@ void SV_CheckWaterTransition (edict_t *ent) if (ent->v.watertype != CONTENTS_EMPTY) { // just crossed into water SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1); - } + } ent->v.watertype = CONTENTS_EMPTY; ent->v.waterlevel = cont; } @@ -1321,7 +1321,7 @@ void SV_Physics_Toss (edict_t *ent) return; if (ent->free) return; - + if (ent->v.movetype == MOVETYPE_BOUNCE) backoff = 1.5; #ifdef QUAKE2 @@ -1335,7 +1335,7 @@ void SV_Physics_Toss (edict_t *ent) // stop if on ground if (trace.plane.normal[2] > 0.7) - { + { #ifdef QUAKE2 if (ent->v.velocity[2] < 60 || (ent->v.movetype != MOVETYPE_BOUNCE && ent->v.movetype != MOVETYPE_BOUNCEMISSILE)) #else @@ -1348,7 +1348,7 @@ void SV_Physics_Toss (edict_t *ent) VectorCopy (vec3_origin, ent->v.avelocity); } } - + // check for in water SV_CheckWaterTransition (ent); } @@ -1446,7 +1446,7 @@ void SV_Physics_Step (edict_t *ent) { vec3_t mins, maxs, point; int x, y; - + VectorAdd (ent->v.origin, ent->v.mins, mins); VectorAdd (ent->v.origin, ent->v.maxs, maxs); @@ -1504,7 +1504,7 @@ void SV_Physics_Step (edict_t *ent) // regular thinking SV_RunThink (ent); - + SV_CheckWaterTransition (ent); } #endif @@ -1558,7 +1558,7 @@ void SV_Physics (void) SV_Physics_Noclip (ent); else if (ent->v.movetype == MOVETYPE_STEP) SV_Physics_Step (ent); - else if (ent->v.movetype == MOVETYPE_TOSS + else if (ent->v.movetype == MOVETYPE_TOSS || ent->v.movetype == MOVETYPE_BOUNCE #ifdef QUAKE2 || ent->v.movetype == MOVETYPE_BOUNCEMISSILE @@ -1567,11 +1567,11 @@ void SV_Physics (void) || ent->v.movetype == MOVETYPE_FLYMISSILE) SV_Physics_Toss (ent); else - Sys_Error ("SV_Physics: bad movetype %i", (int)ent->v.movetype); + Sys_Error ("SV_Physics: bad movetype %i", (int)ent->v.movetype); } - + if (pr_global_struct->force_retouch) - pr_global_struct->force_retouch--; + pr_global_struct->force_retouch--; sv.time += host_frametime; } @@ -1602,7 +1602,7 @@ trace_t SV_Trace_Toss (edict_t *ent, edict_t *ignore) VectorMA (tent->v.angles, host_frametime, tent->v.avelocity, tent->v.angles); VectorScale (tent->v.velocity, host_frametime, move); VectorAdd (tent->v.origin, move, end); - trace = SV_Move (tent->v.origin, tent->v.mins, tent->v.maxs, end, MOVE_NORMAL, tent); + trace = SV_Move (tent->v.origin, tent->v.mins, tent->v.maxs, end, MOVE_NORMAL, tent); VectorCopy (trace.endpos, tent->v.origin); // p = free_particles; @@ -1611,7 +1611,7 @@ trace_t SV_Trace_Toss (edict_t *ent, edict_t *ignore) // free_particles = p->next; // p->next = active_particles; // active_particles = p; -// +// // p->die = 256; // p->color = 15; // p->type = pt_static; diff --git a/uquake/sv_user.c b/uquake/sv_user.c index b2602ee..81a2e95 100644 --- a/uquake/sv_user.c +++ b/uquake/sv_user.c @@ -9,7 +9,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. @@ -77,7 +77,7 @@ void SV_SetIdealPitch (void) if (!((int)sv_player->v.flags & FL_ONGROUND)) return; - + angleval = sv_player->v.angles[YAW] * M_PI*2 / 360; sinval = sin(angleval); cosval = cos(angleval); @@ -87,21 +87,21 @@ void SV_SetIdealPitch (void) top[0] = sv_player->v.origin[0] + cosval*(i+3)*12; top[1] = sv_player->v.origin[1] + sinval*(i+3)*12; top[2] = sv_player->v.origin[2] + sv_player->v.view_ofs[2]; - + bottom[0] = top[0]; bottom[1] = top[1]; bottom[2] = top[2] - 160; - + tr = SV_Move (top, vec3_origin, vec3_origin, bottom, 1, sv_player); if (tr.allsolid) return; // looking at a wall, leave ideal the way is was if (tr.fraction == 1) return; // near a dropoff - + z[i] = top[2] + tr.fraction*(bottom[2]-top[2]); } - + dir = 0; steps = 0; for (j=1 ; j ON_EPSILON || step-dir < -ON_EPSILON ) ) return; // mixed changes - steps++; + steps++; dir = step; } - + if (!dir) { sv_player->v.idealpitch = 0; return; } - + if (steps < 2) return; sv_player->v.idealpitch = -dir * sv_idealpitchscale->value; @@ -142,9 +142,9 @@ void SV_UserFriction (void) vec3_t start, stop; float friction; trace_t trace; - + vel = velocity; - + speed = sqrt(vel[0]*vel[0] +vel[1]*vel[1]); if (!speed) return; @@ -162,10 +162,10 @@ void SV_UserFriction (void) else friction = sv_friction->value; -// apply friction +// apply friction control = speed < sv_stopspeed->value ? sv_stopspeed->value : speed; newspeed = speed - host_frametime*control*friction; - + if (newspeed < 0) newspeed = 0; newspeed /= speed; @@ -200,9 +200,9 @@ void SV_Accelerate (vec3_t wishvel) accelspeed = sv_accelerate->value*host_frametime*addspeed; if (accelspeed > addspeed) accelspeed = addspeed; - + for (i=0 ; i<3 ; i++) - velocity[i] += accelspeed*pushvec[i]; + velocity[i] += accelspeed*pushvec[i]; } #endif void SV_Accelerate (void) @@ -217,16 +217,16 @@ void SV_Accelerate (void) accelspeed = sv_accelerate->value*host_frametime*wishspeed; if (accelspeed > addspeed) accelspeed = addspeed; - + for (i=0 ; i<3 ; i++) - velocity[i] += accelspeed*wishdir[i]; + velocity[i] += accelspeed*wishdir[i]; } void SV_AirAccelerate (vec3_t wishveloc) { int i; float addspeed, wishspd, accelspeed, currentspeed; - + wishspd = VectorNormalize (wishveloc); if (wishspd > 30) wishspd = 30; @@ -238,18 +238,18 @@ void SV_AirAccelerate (vec3_t wishveloc) accelspeed = sv_accelerate->value*wishspeed * host_frametime; if (accelspeed > addspeed) accelspeed = addspeed; - + for (i=0 ; i<3 ; i++) - velocity[i] += accelspeed*wishveloc[i]; + velocity[i] += accelspeed*wishveloc[i]; } void DropPunchAngle (void) { float len; - + len = VectorNormalize (sv_player->v.punchangle); - + len -= 10*host_frametime; if (len < 0) len = 0; @@ -297,12 +297,12 @@ void SV_WaterMove (void) { newspeed = speed - host_frametime * speed * sv_friction->value; if (newspeed < 0) - newspeed = 0; + newspeed = 0; VectorScale (velocity, newspeed/speed, velocity); } else newspeed = 0; - + // // water acceleration // @@ -351,11 +351,11 @@ void SV_AirMove (void) fmove = cmd.forwardmove; smove = cmd.sidemove; - + // hack to not let you back into teleporter if (sv.time < sv_player->v.teleport_time && fmove < 0) fmove = 0; - + for (i=0 ; i<3 ; i++) wishvel[i] = forward[i]*fmove + right[i]*smove; @@ -371,7 +371,7 @@ void SV_AirMove (void) VectorScale (wishvel, sv_maxspeed->value/wishspeed, wishvel); wishspeed = sv_maxspeed->value; } - + if ( sv_player->v.movetype == MOVETYPE_NOCLIP) { // noclip VectorCopy (wishvel, velocity); @@ -384,7 +384,7 @@ void SV_AirMove (void) else { // not on ground, so little effect on velocity SV_AirAccelerate (wishvel); - } + } } /* @@ -401,14 +401,14 @@ void SV_ClientThink (void) if (sv_player->v.movetype == MOVETYPE_NONE) return; - + onground = (int)sv_player->v.flags & FL_ONGROUND; origin = sv_player->v.origin; velocity = sv_player->v.velocity; DropPunchAngle (); - + // // if dead, behave differently // @@ -420,7 +420,7 @@ void SV_ClientThink (void) // show 1/3 the pitch angle and all the roll angle cmd = host_client->cmd; angles = sv_player->v.angles; - + VectorAdd (sv_player->v.v_angle, sv_player->v.punchangle, v_angle); angles[ROLL] = V_CalcRoll (sv_player->v.angles, sv_player->v.velocity)*4; if (!sv_player->v.fixangle) @@ -444,7 +444,7 @@ void SV_ClientThink (void) return; } - SV_AirMove (); + SV_AirMove (); } @@ -458,23 +458,23 @@ void SV_ReadClientMove (usercmd_t *move) int i; vec3_t angle; int bits; - + // read ping time host_client->ping_times[host_client->num_pings%NUM_PING_TIMES] = sv.time - MSG_ReadFloat (); host_client->num_pings++; -// read current angles +// read current angles for (i=0 ; i<3 ; i++) angle[i] = MSG_ReadAngle (); VectorCopy (angle, host_client->edict->v.v_angle); - + // read movement move->forwardmove = MSG_ReadShort (); move->sidemove = MSG_ReadShort (); move->upmove = MSG_ReadShort (); - + // read buttons bits = MSG_ReadByte (); host_client->edict->v.button0 = bits & 1; @@ -502,7 +502,7 @@ qboolean SV_ReadClientMessage (void) int ret; int cmd; char *s; - + do { nextmsg: @@ -514,9 +514,9 @@ nextmsg: } if (!ret) return true; - + MSG_BeginReading (); - + while (1) { if (!host_client->active) @@ -526,24 +526,24 @@ nextmsg: { Sys_Printf ("SV_ReadClientMessage: badread\n"); return false; - } - + } + cmd = MSG_ReadChar (); - + switch (cmd) { case -1: goto nextmsg; // end of message - + default: Sys_Printf ("SV_ReadClientMessage: unknown command char\n"); return false; - + case clc_nop: // Sys_Printf ("clc_nop\n"); break; - - case clc_stringcmd: + + case clc_stringcmd: s = MSG_ReadString (); if (host_client->privileged) ret = 2; @@ -594,18 +594,18 @@ nextmsg: else Con_DPrintf("%s tried to %s\n", host_client->name, s); break; - + case clc_disconnect: // Sys_Printf ("SV_ReadClientMessage: client disconnected\n"); return false; - + case clc_move: SV_ReadClientMove (&host_client->cmd); break; } } } while (ret == 1); - + return true; } @@ -618,12 +618,12 @@ SV_RunClients void SV_RunClients (void) { int i; - + for (i=0, host_client = svs.clients ; iactive) continue; - + sv_player = host_client->edict; if (!SV_ReadClientMessage ()) diff --git a/uquake/sw_cl_parse.c b/uquake/sw_cl_parse.c index cc352d0..00eda3a 100644 --- a/uquake/sw_cl_parse.c +++ b/uquake/sw_cl_parse.c @@ -9,7 +9,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. @@ -59,7 +59,7 @@ void CL_ParseUpdate (int bits) bits |= (i<<8); } - if (bits & U_LONGENTITY) + if (bits & U_LONGENTITY) num = MSG_ReadShort (); else num = MSG_ReadByte (); @@ -76,7 +76,7 @@ if (bits&(1<msgtime = cl.mtime[0]; - + if (bits & U_MODEL) { modnum = MSG_ReadByte (); @@ -85,7 +85,7 @@ if (bits&(1<baseline.modelindex; - + model = cl.model_precache[modnum]; if (model != ent->model) { @@ -102,7 +102,7 @@ if (bits&(1<frame = MSG_ReadByte (); else @@ -186,7 +186,7 @@ void CL_NewTranslation (int slot) int i, j; int top, bottom; byte *dest, *source; - + if (slot > cl.maxclients) Sys_Error ("CL_NewTranslation: slot > cl.maxclients"); dest = cl.scores[slot].translations; @@ -202,11 +202,11 @@ void CL_NewTranslation (int slot) else for (j=0 ; j<16 ; j++) dest[TOP_RANGE+j] = source[top+15-j]; - + if (bottom < 128) memcpy (dest + BOTTOM_RANGE, source + bottom, 16); else for (j=0 ; j<16 ; j++) - dest[BOTTOM_RANGE+j] = source[bottom+15-j]; + dest[BOTTOM_RANGE+j] = source[bottom+15-j]; } } diff --git a/uquake/sys_dos.c b/uquake/sys_dos.c index dd0d433..a15c69f 100644 --- a/uquake/sys_dos.c +++ b/uquake/sys_dos.c @@ -9,7 +9,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. @@ -80,7 +80,7 @@ extern byte end; void Sys_InitStackCheck (void) { int i; - + for (i=0 ; i<128*1024 ; i++) (&end)[i] = CHECKBYTE; } @@ -88,11 +88,11 @@ void Sys_InitStackCheck (void) void Sys_StackCheck (void) { int i; - + for (i=0 ; i<128*1024 ; i++) if ( (&end)[i] != CHECKBYTE ) break; - + Con_Printf ("%i undisturbed stack bytes\n", i); if (end != CHECKBYTE) Sys_Error ("System stack overflow!"); @@ -101,49 +101,49 @@ void Sys_StackCheck (void) //============================================================================= -byte scantokey[128] = - { -// 0 1 2 3 4 5 6 7 -// 8 9 A B C D E F - 0 , 27, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '[', ']', 13 , K_CTRL,'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', - '\'' , '`', K_SHIFT,'\\', 'z', 'x', 'c', 'v', // 2 - 'b', 'n', 'm', ',', '.', '/', K_SHIFT,'*', - K_ALT,' ', 0 , K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10,0 , 0 , K_HOME, - K_UPARROW,K_PGUP,'-',K_LEFTARROW,'5',K_RIGHTARROW,'+',K_END, //4 - K_DOWNARROW,K_PGDN,K_INS,K_DEL,0,0, 0, K_F11, - K_F12,0 , 0 , 0 , 0 , 0 , 0 , 0, // 5 - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, // 6 - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 // 7 - }; +byte scantokey[128] = + { +// 0 1 2 3 4 5 6 7 +// 8 9 A B C D E F + 0 , 27, '1', '2', '3', '4', '5', '6', + '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0 + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'o', 'p', '[', ']', 13 , K_CTRL,'a', 's', // 1 + 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', + '\'' , '`', K_SHIFT,'\\', 'z', 'x', 'c', 'v', // 2 + 'b', 'n', 'm', ',', '.', '/', K_SHIFT,'*', + K_ALT,' ', 0 , K_F1, K_F2, K_F3, K_F4, K_F5, // 3 + K_F6, K_F7, K_F8, K_F9, K_F10,0 , 0 , K_HOME, + K_UPARROW,K_PGUP,'-',K_LEFTARROW,'5',K_RIGHTARROW,'+',K_END, //4 + K_DOWNARROW,K_PGDN,K_INS,K_DEL,0,0, 0, K_F11, + K_F12,0 , 0 , 0 , 0 , 0 , 0 , 0, // 5 + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, // 6 + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 // 7 + }; -byte shiftscantokey[128] = - { -// 0 1 2 3 4 5 6 7 -// 8 9 A B C D E F - 0 , 27, '!', '@', '#', '$', '%', '^', - '&', '*', '(', ')', '_', '+', K_BACKSPACE, 9, // 0 - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', - 'O', 'P', '{', '}', 13 , K_CTRL,'A', 'S', // 1 - 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', - '"' , '~', K_SHIFT,'|', 'Z', 'X', 'C', 'V', // 2 - 'B', 'N', 'M', '<', '>', '?', K_SHIFT,'*', - K_ALT,' ', 0 , K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10,0 , 0 , K_HOME, - K_UPARROW,K_PGUP,'_',K_LEFTARROW,'%',K_RIGHTARROW,'+',K_END, //4 - K_DOWNARROW,K_PGDN,K_INS,K_DEL,0,0, 0, K_F11, - K_F12,0 , 0 , 0 , 0 , 0 , 0 , 0, // 5 - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, // 6 - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 // 7 - }; +byte shiftscantokey[128] = + { +// 0 1 2 3 4 5 6 7 +// 8 9 A B C D E F + 0 , 27, '!', '@', '#', '$', '%', '^', + '&', '*', '(', ')', '_', '+', K_BACKSPACE, 9, // 0 + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', + 'O', 'P', '{', '}', 13 , K_CTRL,'A', 'S', // 1 + 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', + '"' , '~', K_SHIFT,'|', 'Z', 'X', 'C', 'V', // 2 + 'B', 'N', 'M', '<', '>', '?', K_SHIFT,'*', + K_ALT,' ', 0 , K_F1, K_F2, K_F3, K_F4, K_F5, // 3 + K_F6, K_F7, K_F8, K_F9, K_F10,0 , 0 , K_HOME, + K_UPARROW,K_PGUP,'_',K_LEFTARROW,'%',K_RIGHTARROW,'+',K_END, //4 + K_DOWNARROW,K_PGDN,K_INS,K_DEL,0,0, 0, K_F11, + K_F12,0 , 0 , 0 , 0 , 0 , 0 , 0, // 5 + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, // 6 + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 // 7 + }; void TrapKey(void) { @@ -216,7 +216,7 @@ void *dos_getmaxlockedmem(int *size) static char *msg = "Locking data..."; int m, n; byte *x; - + // first lock all the current executing image so the locked count will // be accurate. It doesn't hurt to lock the memory multiple times last_locked = __djgpp_selector_limit + 1; @@ -311,10 +311,10 @@ void *dos_getmaxlockedmem(int *size) j -= 0x100000) { info.size = j; - + if (!__dpmi_lock_linear_region(&info)) goto Locked; - + write (STDOUT, ".", 1); } @@ -458,8 +458,8 @@ void Sys_Shutdown(void) } -#define SC_RSHIFT 0x36 -#define SC_LSHIFT 0x2a +#define SC_RSHIFT 0x36 +#define SC_LSHIFT 0x2a void Sys_SendKeyEvents (void) { int k, next; @@ -478,20 +478,20 @@ void Sys_SendKeyEvents (void) next = keybuf[(keybuf_tail-2)&(KEYBUF_SIZE-1)]; if (next == 0xe1) continue; // pause key bullshit - if (k==0xc5 && next == 0x9d) - { + if (k==0xc5 && next == 0x9d) + { Key_Event (K_PAUSE, true); - continue; - } + continue; + } - // extended keyboard shift key bullshit - if ( (k&0x7f)==SC_LSHIFT || (k&0x7f)==SC_RSHIFT ) - { - if ( keybuf[(keybuf_tail-2)&(KEYBUF_SIZE-1)]==0xe0 ) - continue; - k &= 0x80; - k |= SC_RSHIFT; - } + // extended keyboard shift key bullshit + if ( (k&0x7f)==SC_LSHIFT || (k&0x7f)==SC_RSHIFT ) + { + if ( keybuf[(keybuf_tail-2)&(KEYBUF_SIZE-1)]==0xe0 ) + continue; + k &= 0x80; + k |= SC_RSHIFT; + } if (k==0xc5 && keybuf[(keybuf_tail-2)&(KEYBUF_SIZE-1)] == 0x9d) continue; // more pause bullshit @@ -522,7 +522,7 @@ void Sys_Printf (char *fmt, ...) { va_list argptr; char text[1024]; - + va_start (argptr, fmt); vsnprintf (text, sizeof(text), fmt, argptr); va_end (argptr); @@ -547,10 +547,10 @@ void Sys_Quit (void) byte *d; char ver[6]; int i; - + // load the sell screen before shuting everything down - d = COM_LoadHunkFile ("end2.bin"); + d = COM_LoadHunkFile ("end2.bin"); if (d) memcpy (screen, d, sizeof(screen)); @@ -564,14 +564,14 @@ void Sys_Quit (void) // do the text mode sell screen if (d) { - memcpy ((void *)real2ptr(0xb8000), screen,80*25*2); - + memcpy ((void *)real2ptr(0xb8000), screen,80*25*2); + // set text pos - regs.x.ax = 0x0200; - regs.h.bh = 0; - regs.h.dl = 0; + regs.x.ax = 0x0200; + regs.h.bh = 0; + regs.h.dl = 0; regs.h.dh = 22; - dos_int86 (0x10); + dos_int86 (0x10); } else printf ("couldn't load endscreen.\n"); @@ -580,10 +580,10 @@ void Sys_Quit (void) } void Sys_Error (char *error, ...) -{ +{ va_list argptr; char string[1024]; - + va_start (argptr, error); vsnprintf (string, sizeof(string), error, argptr); va_end (argptr); @@ -592,19 +592,19 @@ void Sys_Error (char *error, ...) fprintf(stderr, "Error: %s\n", string); // Sys_AtExit is called by exit to shutdown the system exit(0); -} +} int Sys_FileOpenRead (char *path, int *handle) { int h; struct stat fileinfo; - + h = open (path, O_RDONLY|O_BINARY, 0666); *handle = h; if (h == -1) return -1; - + if (fstat (h,&fileinfo) == -1) Sys_Error ("Error fstating %s", path); @@ -616,7 +616,7 @@ int Sys_FileOpenWrite (char *path) int handle; umask (0); - + handle = open(path,O_RDWR | O_BINARY | O_CREAT | O_TRUNC , 0666); @@ -866,7 +866,7 @@ int main (int c, char **v) static char cwd[1024]; printf ("Quake v%s\n", VERSION); - + // make sure there's an FPU signal(SIGNOFP, Sys_NoFPUExceptionHandler); signal(SIGABRT, Sys_DefaultExceptionHandler); @@ -903,7 +903,7 @@ int main (int c, char **v) dos_registerintr(9, TrapKey); //Sys_InitStackCheck (); - + Host_Init(&quakeparms); //Sys_StackCheck (); diff --git a/uquake/sys_unix.c b/uquake/sys_unix.c index da7a781..b7783c5 100644 --- a/uquake/sys_unix.c +++ b/uquake/sys_unix.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. @@ -58,7 +58,7 @@ FILE IO #define MAX_HANDLES 10 -typedef struct +typedef struct { QFile *hFile; char *pMap; @@ -71,7 +71,7 @@ MEMFILE sys_handles[MAX_HANDLES]; int findhandle (void) { int i; - + for (i=1 ; i0) { len = read (0, text, sizeof(text)); @@ -268,7 +268,7 @@ char *Sys_ConsoleInput (void) return text; } } - + return 0; } @@ -299,7 +299,7 @@ int main (int argc, char **argv) { static quakeparms_t parms; float oldtime, newtime; - + parms.memsize = 16*1024*1024; parms.membase = malloc (parms.memsize); parms.basedir = "."; diff --git a/uquake/sys_win.c b/uquake/sys_win.c index f45d219..089e3f5 100644 --- a/uquake/sys_win.c +++ b/uquake/sys_win.c @@ -9,7 +9,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. @@ -71,10 +71,10 @@ volatile int sys_checksum; void Sys_DebugLog(char *file, char *fmt, ...) { - va_list argptr; + va_list argptr; static char data[1024]; int fd; - + va_start(argptr, fmt); vsnprintf(data, sizeof(data), fmt, argptr); va_end(argptr); @@ -123,7 +123,7 @@ QFile *sys_handles[MAX_HANDLES]; int findhandle (void) { int i; - + for (i=1 ; i= ' ') { - WriteFile(houtput, &ch, 1, &dummy, NULL); + WriteFile(houtput, &ch, 1, &dummy, NULL); text[len] = ch; len = (len + 1) & 0xff; } @@ -716,7 +716,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin *lpCmdLine = 0; lpCmdLine++; } - + } } @@ -802,13 +802,13 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin if (t < com_argc) hFile = (HANDLE)Q_atoi (com_argv[t+1]); } - + if ((t = COM_CheckParm ("-HPARENT")) > 0) { if (t < com_argc) heventParent = (HANDLE)Q_atoi (com_argv[t+1]); } - + if ((t = COM_CheckParm ("-HCHILD")) > 0) { if (t < com_argc) diff --git a/uquake/sys_wind.c b/uquake/sys_wind.c index 56e680d..fb353ab 100644 --- a/uquake/sys_wind.c +++ b/uquake/sys_wind.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. @@ -40,7 +40,7 @@ QFile *sys_handles[MAX_HANDLES]; int findhandle (void) { int i; - + for (i=1 ; i