diff --git a/Source/client/cstrike.src b/Source/client/cstrike.src index 1138199e..304baf92 100755 --- a/Source/client/cstrike.src +++ b/Source/client/cstrike.src @@ -55,6 +55,7 @@ text.c ../shared/pmove.c ../gs-entbase/client.src +../shared/decals.c ../shared/effects.c ../shared/spraylogo.cpp diff --git a/Source/client/cstrike/vguiscoreboard.c b/Source/client/cstrike/vguiscoreboard.c index 1f16ba5d..d2be3165 100755 --- a/Source/client/cstrike/vguiscoreboard.c +++ b/Source/client/cstrike/vguiscoreboard.c @@ -129,3 +129,14 @@ void VGUI_Scores_Show( void ) { vOffset = VGUI_Scores_DrawTeam( vOffset, TEAM_T ); vOffset = VGUI_Scores_DrawTeam( vOffset, 0 ); } + +void Scores_Init(void) +{ + +} + +void Scores_Draw(void) +{ + VGUI_Scores_Show(); +} + diff --git a/Source/client/entry.c b/Source/client/entry.c index b6793243..8becc466 100644 --- a/Source/client/entry.c +++ b/Source/client/entry.c @@ -49,13 +49,13 @@ void CSQC_Init(float apilevel, string enginename, float engineversion) SHADER_CULLED = shaderforname("mirror_cull"); /* Particles */ - PARTICLE_SPARK = particleeffectnum("part_spark"); + PARTICLE_SPARK = particleeffectnum("part_spark"); PARTICLE_PIECES_BLACK = particleeffectnum("part_pieces_black"); PARTICLE_SMOKE_GREY = particleeffectnum("part_smoke_grey"); PARTICLE_SMOKE_BROWN = particleeffectnum("part_smoke_brown"); - PARTICLE_BLOOD = particleeffectnum("part_blood"); - DECAL_SHOT = particleeffectnum("decal_shot"); - DECAL_GLASS = particleeffectnum("decal_glass"); + PARTICLE_BLOOD = particleeffectnum("part_blood"); + DECAL_SHOT = particleeffectnum("decal_shot"); + DECAL_GLASS = particleeffectnum("decal_glass"); /* 2D Pics */ precache_pic("gfx/vgui/icntlk_sv"); @@ -87,6 +87,7 @@ void CSQC_Init(float apilevel, string enginename, float engineversion) /* Game specific inits */ HUD_Init(); + Scores_Init(); Client_Init(apilevel, enginename, engineversion); } @@ -159,7 +160,7 @@ void CSQC_UpdateView(float w, float h, float focus) if (autocvar_cl_thirdperson == TRUE ) { makevectors(view_angles); vector vStart = [pSeat->vPlayerOrigin[0], pSeat->vPlayerOrigin[1], pSeat->vPlayerOrigin[2] + 16] + (v_right * 4); - vector vEnd = vStart + (v_forward * -48) + '0 0 16' + (v_right * 4); + vector vEnd = vStart + (v_forward * -48) + [0,0,16] + (v_right * 4); traceline(vStart, vEnd, FALSE, self); setproperty(VF_ORIGIN, trace_endpos + (v_forward * 5)); } else { @@ -188,7 +189,6 @@ void CSQC_UpdateView(float w, float h, float focus) if(focus == TRUE) { GameText_Draw(); - // The spectator sees things... differently if (getplayerkeyvalue(player_localnum, "*spec") != "0") { VGUI_DrawSpectatorHUD(); @@ -201,15 +201,15 @@ void CSQC_UpdateView(float w, float h, float focus) Chat_Draw(); Print_Draw(); -#ifdef CSTRIKE // Don't even try to draw centerprints and VGUI menus when scores are shown - if (pSeat->iShowScores == TRUE || getstatf(STAT_GAMESTATE) == GAME_OVER) { - VGUI_Scores_Show(); + if (pSeat->iShowScores == TRUE) { + Scores_Draw(); } else { CSQC_DrawCenterprint(); +#ifdef CSTRIKE needcursor |= CSQC_VGUI_Draw(); - } #endif + } } Predict_PostFrame((player)self); @@ -218,9 +218,9 @@ void CSQC_UpdateView(float w, float h, float focus) pSeat = (void*)0x70000000i; if (needcursor) { - setcursormode(TRUE, "gfx/cursor", '0 0 0', 1.0f); + setcursormode(TRUE, "gfx/cursor", [0,0,0], 1.0f); } else { - setcursormode(FALSE, "gfx/cursor", '0 0 0', 1.0f); + setcursormode(FALSE, "gfx/cursor", [0,0,0], 1.0f); } Sound_ProcessWordQue(); @@ -233,13 +233,12 @@ CSQC_InputEvent Updates all our input related globals for use in other functions ================= */ -float CSQC_InputEvent(float fEventType, float fKey, float fCharacter, - float fDeviceID) +float CSQC_InputEvent(float fEventType, float fKey, float fCharacter, float fDeviceID) { int s = (float)getproperty(VF_ACTIVESEAT); pSeat = &seats[s]; - switch(fEventType) { + switch (fEventType) { case IE_KEYDOWN: if (fKey == K_MOUSE1) { fMouseClick = 1; @@ -351,7 +350,8 @@ CSQC_Parse_Event Whenever we call a SVC_CGAMEPACKET on the SSQC, this is being run ================= */ -void CSQC_Parse_Event(void) { +void CSQC_Parse_Event(void) +{ /* always 0, unless it was sent with a MULTICAST_ONE or MULTICAST_ONE_R to p2+ */ int s = (float)getproperty(VF_ACTIVESEAT); pSeat = &seats[s]; @@ -402,7 +402,7 @@ void CSQC_Parse_Event(void) { vSize_z = readcoord(); float fStyle = readbyte(); - Effect_BreakModel(vPos, vSize, '0 0 0', fStyle); + Effect_BreakModel(vPos, vSize, [0,0,0], fStyle); break; case EV_CAMERATRIGGER: pSeat->vCameraPos.x = readcoord(); @@ -560,7 +560,7 @@ float CSQC_Parse_CenterPrint(string sMessage) { fCenterPrintLines = tokenizebyseparator(sMessage, "\n"); - for(int i = 0; i < (fCenterPrintLines); i++) { + for (int i = 0; i < (fCenterPrintLines); i++) { sCenterPrintBuffer[i] = sprintf("^xF80%s", argv(i)); } @@ -579,7 +579,7 @@ Whenever the world is fully initialized... */ void CSQC_WorldLoaded(void) { - /*precache_pic("{shot1", TRUE); + precache_pic("{shot1", TRUE); precache_pic("{shot2", TRUE); precache_pic("{shot3", TRUE); precache_pic("{shot4", TRUE); @@ -588,7 +588,7 @@ void CSQC_WorldLoaded(void) precache_pic("{bigshot2", TRUE); precache_pic("{bigshot3", TRUE); precache_pic("{bigshot4", TRUE); - precache_pic("{bigshot5", TRUE);*/ + precache_pic("{bigshot5", TRUE); } /* diff --git a/Source/client/sound.c b/Source/client/sound.c old mode 100755 new mode 100644 index e67a822b..57a83adf --- a/Source/client/sound.c +++ b/Source/client/sound.c @@ -16,7 +16,8 @@ var int iVOXCount; var int iVOXPos; var float fSampleTime = 0.0f; -void Sound_PlayVOX(string msg) { +void Sound_PlayVOX(string msg) +{ if (iVOXCount) { return; } @@ -31,7 +32,8 @@ void Sound_PlayVOX(string msg) { fSampleTime = time; } -void Sound_ProcessWordQue(void) { +void Sound_ProcessWordQue(void) +{ if (cltime < 2) { return; } diff --git a/Source/client/valve.src b/Source/client/valve.src index a4f02bf7..12589bc7 100755 --- a/Source/client/valve.src +++ b/Source/client/valve.src @@ -29,6 +29,7 @@ voice.c player.c ../shared/pmove.c predict.c +../shared/decals.c ../shared/effects.c ../shared/spraylogo.cpp @@ -63,6 +64,7 @@ damage.c chat.c valve/hud.c valve/hud_weaponselect.c +valve/scoreboard.c valve/input.c entry.c diff --git a/Source/client/valve/scoreboard.c b/Source/client/valve/scoreboard.c new file mode 100644 index 00000000..65343a3a --- /dev/null +++ b/Source/client/valve/scoreboard.c @@ -0,0 +1,9 @@ +void Scores_Init(void) +{ + +} + +void Scores_Draw(void) +{ + +} diff --git a/Source/client/view.c b/Source/client/view.c old mode 100755 new mode 100644 index 8991f496..7449ee60 --- a/Source/client/view.c +++ b/Source/client/view.c @@ -10,7 +10,7 @@ void View_Init(void) { #ifdef CSTRIKE string wm; - for ( int i = 0; i < ( CS_WEAPON_COUNT - 1 ); i++ ) { + for (int i = 0; i < (CS_WEAPON_COUNT - 1); i++) { wm = sprintf("models/%s", sViewModels[i]); precache_model(wm); } @@ -18,7 +18,7 @@ void View_Init(void) for (int s = seats.length; s-- > numclientseats;) { pSeat = &seats[s]; - if( !pSeat->eViewModel ) { + if(!pSeat->eViewModel) { pSeat->eViewModel = spawn(); pSeat->eViewModel.classname = "vm"; pSeat->eViewModel.renderflags = RF_DEPTHHACK; @@ -30,7 +30,8 @@ void View_Init(void) } } -void View_CalcViewport(int s, float fWinWidth, float fWinHeight) { +void View_CalcViewport(int s, float fWinWidth, float fWinHeight) +{ //FIXME: this is awkward. renderscene internally rounds to pixels. //on the other hand, drawpic uses linear filtering and multisample and stuff. //this means that there can be a pixel or so difference between scene and 2d. @@ -60,32 +61,32 @@ void View_CalcViewport(int s, float fWinWidth, float fWinHeight) { View_CalcBob ==================== */ -void View_CalcBob( void ) +void View_CalcBob(void) { float cycle; vector vel; - if ( self.flags & FL_ONGROUND == -1 ) { + if (self.flags & FL_ONGROUND == -1) { return; } pSeat->fBobTime += clframetime; - cycle = pSeat->fBobTime - (int)( pSeat->fBobTime / autocvar_v_bobcycle ) * autocvar_v_bobcycle; + cycle = pSeat->fBobTime - (int)(pSeat->fBobTime / autocvar_v_bobcycle) * autocvar_v_bobcycle; cycle /= autocvar_v_bobcycle; - if ( cycle < autocvar_v_bobup ) { + if (cycle < autocvar_v_bobup) { cycle = MATH_PI * cycle / autocvar_v_bobup; } else { - cycle = MATH_PI + MATH_PI * ( cycle - autocvar_v_bobup )/( 1.0 - autocvar_v_bobup ); + cycle = MATH_PI + MATH_PI * (cycle - autocvar_v_bobup)/(1.0 - autocvar_v_bobup); } vel = pSeat->vPlayerVelocity; vel_z = 0; - float fBob = sqrt( vel_x * vel_x + vel_y * vel_y ) * autocvar_v_bob; - fBob = fBob * 0.3 + fBob * 0.7 * sin( cycle ); - pSeat->fBob = bound( -7, fBob, 4 ); + float fBob = sqrt(vel_x * vel_x + vel_y * vel_y) * autocvar_v_bob; + fBob = fBob * 0.3 + fBob * 0.7 * sin(cycle); + pSeat->fBob = bound(-7, fBob, 4); } /* @@ -95,9 +96,10 @@ View_DropPunchAngle Quickly lerp to the original viewposition ==================== */ -void View_DropPunchAngle( void ) { +void View_DropPunchAngle(void) +{ float lerp; - lerp = 1.0f - ( clframetime * 4 ); + lerp = 1.0f - (clframetime * 4); pSeat->vPunchAngle *= lerp; } @@ -108,7 +110,7 @@ View_AddPunchAngle Gives the angle a bit of an offset/punch/kick ==================== */ -void View_AddPunchAngle( vector add ) +void View_AddPunchAngle(vector add) { pSeat->vPunchAngle /*+*/= add; } @@ -121,62 +123,62 @@ Really convoluted function that makes the gun, muzzleflash, dynamic lights and so on appear ==================== */ -void View_DrawViewModel( void ) +void View_DrawViewModel(void) { entity eViewModel = pSeat->eViewModel; entity eMuzzleflash = pSeat->eMuzzleflash; player pl = (player) self; - if ( pl.health <= 0 ) { + if (pl.health <= 0) { return; } // Don't update when paused - if ( serverkey( "pausestate" ) == "0" ) { + if (serverkeyfloat("pausestate") == 0) { View_CalcBob(); View_UpdateWeapon(eViewModel, eMuzzleflash); float fBaseTime = eViewModel.frame1time; eViewModel.frame1time += clframetime; eViewModel.frame2time += clframetime; - processmodelevents( eViewModel.modelindex, eViewModel.frame, fBaseTime, eViewModel.frame1time, Event_ProcessModel ); + processmodelevents(eViewModel.modelindex, eViewModel.frame, fBaseTime, eViewModel.frame1time, Event_ProcessModel); } makevectors(view_angles); eViewModel.angles = view_angles; eViewModel.origin = pSeat->vPlayerOrigin + pl.view_ofs; - eViewModel.origin += '0 0 -1' + ( v_forward * ( pSeat->fBob * 0.4 ) ) - + ( v_forward * autocvar_v_gunofs[0] ) - + ( v_right * autocvar_v_gunofs[1] ) - + ( v_up * autocvar_v_gunofs[2] ); + eViewModel.origin += [0,0,-1] + (v_forward * (pSeat->fBob * 0.4)) + + (v_forward * autocvar_v_gunofs[0]) + + (v_right * autocvar_v_gunofs[1]) + + (v_up * autocvar_v_gunofs[2]); // Left-handed weapons - if ( autocvar_v_lefthanded ) { + if (autocvar_v_lefthanded) { v_right *= -1; eViewModel.renderflags |= RF_USEAXIS; eViewModel.forceshader = SHADER_CULLED; } else { - if ( eViewModel.forceshader ) { + if (eViewModel.forceshader) { eViewModel.forceshader = 0; eViewModel.renderflags -= RF_USEAXIS; } } // Give the gun a tilt effect like in old HL/CS versions - if ( autocvar_v_bobclassic == 1 ) { + if (autocvar_v_bobclassic == 1) { eViewModel.angles_z = -pSeat->fBob; } // Only bother when zoomed out - if ( pl.viewzoom == 1.0f ) { + if (pl.viewzoom == 1.0f) { // Update muzzleflash position and draw it - if ( eMuzzleflash.alpha > 0.0f ) { + if (eMuzzleflash.alpha > 0.0f) { makevectors(getproperty(VF_ANGLES)); - eMuzzleflash.origin = gettaginfo( eViewModel, eMuzzleflash.skin ); - dynamiclight_add( pSeat->vPlayerOrigin + (v_forward * 32), 400 * eMuzzleflash.alpha, '1 0.45 0'); - addentity( eMuzzleflash ); + eMuzzleflash.origin = gettaginfo(eViewModel, eMuzzleflash.skin); + dynamiclight_add(pSeat->vPlayerOrigin + (v_forward * 32), 400 * eMuzzleflash.alpha, [1,0.45,0]); + addentity(eMuzzleflash); } - addentity( eViewModel ); + addentity(eViewModel); } } @@ -185,8 +187,8 @@ void View_PostDraw(void) entity eMuzzleflash = pSeat->eMuzzleflash; // Take away alpha once it has drawn fully at least once - if ( eMuzzleflash.alpha > 0.0f ) { - eMuzzleflash.alpha -= ( clframetime * 16 ); + if (eMuzzleflash.alpha > 0.0f) { + eMuzzleflash.alpha -= (clframetime * 16); } } @@ -197,19 +199,19 @@ void View_Stairsmooth(void) static vector oldpos; /* Have we gone up since last frame? */ - if ( ( pSeat->fPlayerFlags & FL_ONGROUND ) && ( endpos[2] - oldpos[2] > 0 ) ) { + if ((pSeat->fPlayerFlags & FL_ONGROUND) && (endpos[2] - oldpos[2] > 0)) { endpos[2] = oldpos[2] += (frametime * 150); - if ( endpos[2] > currentpos[2] ) { + if (endpos[2] > currentpos[2]) { endpos[2] = currentpos[2]; } - if ( currentpos[2] - endpos[2] > 18 ) { + if (currentpos[2] - endpos[2] > 18) { endpos[2] = currentpos[2] - 18; } } // Teleport hack - if ( fabs( currentpos[2] - oldpos[2] ) > 64 ) { + if (fabs(currentpos[2] - oldpos[2]) > 64) { endpos[2] = currentpos[2]; } @@ -226,7 +228,7 @@ Resets the timeline and plays a new sequence onto the view model ==================== */ -void View_PlayAnimation( int iSequence ) +void View_PlayAnimation(int iSequence) { pSeat->eViewModel.frame = (float)iSequence; pSeat->eViewModel.frame1time = 0.0f; diff --git a/Source/defs.h b/Source/defs.h index 7d76298a..60f4cc67 100644 --- a/Source/defs.h +++ b/Source/defs.h @@ -6,35 +6,37 @@ * ****/ -const vector VEC_HULL_MIN = '-16 -16 -36'; -const vector VEC_HULL_MAX = '16 16 36'; - -const vector VEC_CHULL_MIN = '-16 -16 -18'; -const vector VEC_CHULL_MAX = '16 16 18'; +/* Those are constant for HL BSP and CANNOT be changed. + * Blame Valve for purchasing a Quake II license but not + * scrapping hull sizes for their .bsp format... */ +const vector VEC_HULL_MIN = [-16,-16,-36]; +const vector VEC_HULL_MAX = [16,16,36]; +const vector VEC_CHULL_MIN = [-16,-16,-18]; +const vector VEC_CHULL_MAX = [16,16,18]; #ifdef CSTRIKE -const vector VEC_PLAYER_VIEWPOS = '0 0 20'; -const vector VEC_PLAYER_CVIEWPOS = '0 0 12'; +const vector VEC_PLAYER_VIEWPOS = [0,0,20]; +const vector VEC_PLAYER_CVIEWPOS = [0,0,12]; #endif #ifdef VALVE -const vector VEC_PLAYER_VIEWPOS = '0 0 24'; -const vector VEC_PLAYER_CVIEWPOS = '0 0 12'; +const vector VEC_PLAYER_VIEWPOS = [0,0,24]; +const vector VEC_PLAYER_CVIEWPOS = [0,0,12]; #endif // Actually used by input_button etc. -#define INPUT_BUTTON0 1 -#define INPUT_BUTTON2 2 -#define INPUT_BUTTON3 4 -#define INPUT_BUTTON4 8 -#define INPUT_BUTTON5 16 -#define INPUT_BUTTON6 32 -#define INPUT_BUTTON7 64 -#define INPUT_BUTTON8 128 +#define INPUT_BUTTON0 0x00000001 +#define INPUT_BUTTON2 0x00000002 +#define INPUT_BUTTON3 0x00000004 +#define INPUT_BUTTON4 0x00000008 +#define INPUT_BUTTON5 0x00000010 +#define INPUT_BUTTON6 0x00000020 +#define INPUT_BUTTON7 0x00000040 +#define INPUT_BUTTON8 0x00000080 #define FL_USERELEASED (1<<13) #define FL_CROUCHING (1<<19) -#define FL_SEMI_TOGGLED (1<<15) +#define FL_SEMI_TOGGLED (1<<15) #define FL_FROZEN (1<<17) #define FL_REMOVEME (1<<18) diff --git a/Source/gs-entbase/client/sprite.cpp b/Source/gs-entbase/client/sprite.cpp index 995910e0..e559877d 100644 --- a/Source/gs-entbase/client/sprite.cpp +++ b/Source/gs-entbase/client/sprite.cpp @@ -18,7 +18,7 @@ class sprite void sprite::think(void) { if (frame >= maxframe) { - if (loops == 1) { + if (loops == 0) { remove(this); } else { frame = 0; @@ -48,7 +48,7 @@ void Sprite_Animated(void) me.drawmask = MASK_ENGINE; me.nextthink = time + ( 1 / me.framerate ); me.maxframe = modelframecount( me.modelindex ); - me.loops = 0; /* repeats */ + me.loops = 1; /* repeats */ setorigin(me, me.origin); } @@ -69,6 +69,6 @@ void Sprite_ParseEvent(void) spr.drawmask = MASK_ENGINE; spr.nextthink = time + ( 1 / spr.framerate ); spr.maxframe = modelframecount( spr.modelindex ); - spr.loops = 1; /* does not repeat */ + spr.loops = 0; /* does not repeat */ setorigin(spr, spr.origin); } diff --git a/Source/gs-entbase/server/defs.h b/Source/gs-entbase/server/defs.h index 003f5805..9b2bc0b3 100644 --- a/Source/gs-entbase/server/defs.h +++ b/Source/gs-entbase/server/defs.h @@ -6,7 +6,7 @@ * ****/ -#define GS_DEVELOPER +//#define GS_DEVELOPER .float gflags; diff --git a/Source/gs-entbase/server/infodecal.cpp b/Source/gs-entbase/server/infodecal.cpp index 067e4340..ece59b4b 100644 --- a/Source/gs-entbase/server/infodecal.cpp +++ b/Source/gs-entbase/server/infodecal.cpp @@ -47,6 +47,7 @@ void infodecal(void) } if (!self.texture) { + print("^1ERROR:^7 infodecal with no .texture\n"); remove(self); return; } diff --git a/Source/server/cstrike.src b/Source/server/cstrike.src index 9c85389e..6e4c9a61 100755 --- a/Source/server/cstrike.src +++ b/Source/server/cstrike.src @@ -52,6 +52,7 @@ cstrike/money.c ../shared/cstrike/basemelee.c ../shared/cstrike/weapons.c ../shared/cstrike/equipment.c +../shared/decals.c ../shared/effects.c ../shared/spraylogo.cpp ../shared/pmove.c diff --git a/Source/server/cstrike/ammo.c b/Source/server/cstrike/ammo.c old mode 100755 new mode 100644 index f0903319..9a48c3fe --- a/Source/server/cstrike/ammo.c +++ b/Source/server/cstrike/ammo.c @@ -27,7 +27,8 @@ Ammo_BuyPrimary Buy ammo for the primary weapon you're equipped with ================= */ -void Ammo_BuyPrimary(void) { +void Ammo_BuyPrimary(void) +{ if ( !self.fSlotPrimary ) { return; } @@ -55,7 +56,8 @@ Ammo_BuySecondary Buy ammo for the secondary weapon you're equipped with ================= */ -void Ammo_BuySecondary(void) { +void Ammo_BuySecondary(void) +{ if ( !self.fSlotSecondary ) { return; } @@ -112,7 +114,8 @@ CSEv_GamePlayerBuyAmmo_f Called from the client, checks if he can buy ammo and does if yes ================= */ -void CSEv_GamePlayerBuyAmmo_f( float fType ) { +void CSEv_GamePlayerBuyAmmo_f( float fType ) +{ if ( Rules_BuyingPossible() == FALSE ) { return; } diff --git a/Source/server/cstrike/client.c b/Source/server/cstrike/client.c old mode 100755 new mode 100644 index 9e94d93c..09769b42 --- a/Source/server/cstrike/client.c +++ b/Source/server/cstrike/client.c @@ -13,7 +13,8 @@ SpectatorThink Run every frame on every spectator ================= */ -void Game_SpectatorThink( void ) { +void Game_SpectatorThink(void) +{ self.SendFlags = 1; } @@ -24,8 +25,9 @@ ClientKill Suicide command 'kill' executes this function. ================= */ -void Game_ClientKill( void ) { - Damage_Apply( self, self, self.health, self.origin, TRUE ); +void Game_ClientKill(void) +{ + Damage_Apply(self, self, self.health, self.origin, TRUE); } /* @@ -35,7 +37,7 @@ ClientConnect Run whenever a new client joins ================= */ -void Game_ClientConnect( void ) {} +void Game_ClientConnect(void) {} /* ================= @@ -44,7 +46,8 @@ SpectatorConnect Called when a spectator joins the game ================= */ -void Game_SpectatorConnect( void ) { +void Game_SpectatorConnect(void) +{ //Spawn_MakeSpectator(); //Spawn_ObserverCam(); ClientConnect(); @@ -58,8 +61,9 @@ SpectatorDisconnect Called when a spectator leaves the game ================= */ -void Game_SpectatorDisconnect( void ) { - Spray_RemoveAll( self ); +void Game_SpectatorDisconnect(void) +{ + Spray_RemoveAll(self); } /* @@ -69,12 +73,13 @@ ClientDisconnect Run whenever a client quits ================= */ -void Game_ClientDisconnect( void ) { +void Game_ClientDisconnect(void) +{ // We were part of the session self.health = 0; Rules_CountPlayers(); Rules_DeathCheck(); - Spray_RemoveAll( self ); + Spray_RemoveAll(self); } void Game_DecodeChangeParms(void) @@ -105,7 +110,7 @@ Puts a client into the world. */ void Game_PutClientInServer(void) { - if ( cvar( "sv_playerslots" ) == 1 ) { + if (cvar("sv_playerslots") == 1) { entity spot; self.SendEntity = Player_SendEntity; @@ -115,7 +120,7 @@ void Game_PutClientInServer(void) self.origin = Landmark_GetSpot(); self.fixangle = TRUE; } else { - spot = find( world, classname, "info_player_start" ); + spot = find(world, classname, "info_player_start"); self.origin = spot.origin; self.angles = spot.angles; self.fixangle = TRUE; @@ -123,7 +128,7 @@ void Game_PutClientInServer(void) self.classname = "player"; self.health = self.max_health = 100; - forceinfokey( self, "*dead", "0" ); + forceinfokey(self, "*dead", "0"); self.takedamage = DAMAGE_YES; self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_WALK; @@ -133,14 +138,14 @@ void Game_PutClientInServer(void) self.iBleeds = TRUE; self.fSlotGrenade = 0; self.viewzoom = 1.0; - setmodel( self, "models/player/vip/vip.mdl" ); - setsize( self, VEC_HULL_MIN, VEC_HULL_MAX ); + setmodel(self, "models/player/vip/vip.mdl"); + setsize(self, VEC_HULL_MIN, VEC_HULL_MAX); self.view_ofs = VEC_PLAYER_VIEWPOS; self.velocity = '0 0 0'; self.frame = 1; // Idle frame self.fBombProgress = 0; self.team = TEAM_CT; - forceinfokey( self, "*spec", "0" ); + forceinfokey(self, "*spec", "0"); return; } @@ -151,17 +156,17 @@ void Game_PutClientInServer(void) self.SendEntity = Player_SendEntity; // Because we don't want to reset these when we die - Money_AddMoney( self, autocvar_mp_startmoney ); + Money_AddMoney(self, autocvar_mp_startmoney); - if ( cvar( "mp_timelimit" ) > 0 ) { - if ( autocvar_fcs_voxannounce == TRUE ) { - float fTimeLeft = cvar( "mp_timelimit" ) - ( time / 60 ); - Vox_Singlecast( self, sprintf( "we have %s minutes remaining", Vox_TimeToString( fTimeLeft ) ) ); + if (cvar("mp_timelimit") > 0) { + if (autocvar_fcs_voxannounce == TRUE) { + float fTimeLeft = cvar("mp_timelimit") - (time / 60); + Vox_Singlecast(self, sprintf("we have %s minutes remaining", Vox_TimeToString(fTimeLeft))); } } self.team = 0; - forceinfokey( self, "*team", "0" ); + forceinfokey(self, "*team", "0"); } /* @@ -171,12 +176,13 @@ SV_RunClientCommand Funtion that can interrupt client commands before physics are run ================= */ -void Game_RunClientCommand( void ) { +void Game_RunClientCommand(void) +{ /*if (clienttype(self) == CLIENTTYPE_BOT) { ((CBot)self).RunAI(); }*/ - if ( fGameState == GAME_FREEZE && self.health > 0 ) { + if (fGameState == GAME_FREEZE && self.health > 0) { input_movevalues = '0 0 0'; //input_buttons = 0; input_impulse = 0; @@ -189,7 +195,7 @@ void Game_RunClientCommand( void ) { self.fInEscapeZone = FALSE; self.fInVIPZone = FALSE; - QPhysics_Run( self ); + QPhysics_Run(self); } void Game_SetNewParms(void) @@ -204,13 +210,13 @@ Client_SendEvent Send a game event ================= */ -void Client_SendEvent( entity eClient, float fEVType ) +void Client_SendEvent(entity eClient, float fEVType) { Weapon_UpdateCurrents(); - WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET ); - WriteByte( MSG_MULTICAST, fEVType ); - WriteByte( MSG_MULTICAST, num_for_edict( eClient ) ); + WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); + WriteByte(MSG_MULTICAST, fEVType); + WriteByte(MSG_MULTICAST, num_for_edict(eClient)); msg_entity = eClient; - multicast( self.origin, MULTICAST_PVS ); + multicast(self.origin, MULTICAST_PVS); } diff --git a/Source/server/cstrike/damage.c b/Source/server/cstrike/damage.c old mode 100755 new mode 100644 index d53d8855..47207d2b --- a/Source/server/cstrike/damage.c +++ b/Source/server/cstrike/damage.c @@ -13,17 +13,18 @@ Damage_CastOrbituary Sends a message to the clients to display a death message ================= */ -void Damage_CastOrbituary( entity eAttacker, entity eTarget, float fWeapon, float fHeadShot ) { - WriteByte( MSG_BROADCAST, SVC_CGAMEPACKET ); - WriteByte( MSG_BROADCAST, EV_ORBITUARY ); - WriteByte( MSG_BROADCAST, num_for_edict( eAttacker ) - 1 ); - WriteByte( MSG_BROADCAST, eAttacker.team ); - WriteByte( MSG_BROADCAST, num_for_edict( eTarget ) - 1 ); - WriteByte( MSG_BROADCAST, eTarget.team ); - WriteByte( MSG_BROADCAST, fWeapon ); - WriteByte( MSG_BROADCAST, fHeadShot ); +void Damage_CastOrbituary(entity eAttacker, entity eTarget, float fWeapon, float fHeadShot) +{ + WriteByte(MSG_BROADCAST, SVC_CGAMEPACKET); + WriteByte(MSG_BROADCAST, EV_ORBITUARY); + WriteByte(MSG_BROADCAST, num_for_edict(eAttacker) - 1); + WriteByte(MSG_BROADCAST, eAttacker.team); + WriteByte(MSG_BROADCAST, num_for_edict(eTarget) - 1); + WriteByte(MSG_BROADCAST, eTarget.team); + WriteByte(MSG_BROADCAST, fWeapon); + WriteByte(MSG_BROADCAST, fHeadShot); msg_entity = self; - multicast( [0,0,0], MULTICAST_ALL ); + multicast([0,0,0], MULTICAST_ALL); } /* @@ -33,9 +34,10 @@ Damage_GetHitLocation Debug function ================= */ -string Damage_GetHitLocation( int iSurface ) { +string Damage_GetHitLocation(int iSurface) +{ #ifdef CSTRIKE - switch ( iSurface ) { + switch (iSurface) { case BODY_HEAD: return "Head"; break; @@ -63,15 +65,16 @@ string Damage_GetHitLocation( int iSurface ) { #endif } -int Damage_ShouldDamage( float fTargetTeam, float fAttackerTeam ) { +int Damage_ShouldDamage(float fTargetTeam, float fAttackerTeam) +{ #ifdef CSTRIKE - if ( fTargetTeam == TEAM_VIP ) { + if (fTargetTeam == TEAM_VIP) { fTargetTeam = TEAM_CT; - } else if ( fAttackerTeam == TEAM_VIP ) { + } else if (fAttackerTeam == TEAM_VIP) { fAttackerTeam = TEAM_CT; } - if ( fTargetTeam == fAttackerTeam ) { + if (fTargetTeam == fAttackerTeam) { return FALSE; } @@ -86,28 +89,29 @@ Damage_Apply Generic function that applies damage, pain and suffering ================= */ -void Damage_Apply( entity eTarget, entity eAttacker, float iDamage, vector vHitPos, int iSkipArmor ) { +void Damage_Apply(entity eTarget, entity eAttacker, float iDamage, vector vHitPos, int iSkipArmor) +{ #ifdef CSTRIKE // Modify the damage based on the location - if ( trace_surface_id == BODY_HEAD ) { - if ( eTarget.iEquipment & EQUIPMENT_HELMET ) { - sound( self, CHAN_ITEM, "weapons/ric_metal-2.wav", 1, ATTN_IDLE ); + if (trace_surface_id == BODY_HEAD) { + if (eTarget.iEquipment & EQUIPMENT_HELMET) { + sound(self, CHAN_ITEM, "weapons/ric_metal-2.wav", 1, ATTN_IDLE); iDamage = 0; eTarget.iEquipment -= EQUIPMENT_HELMET; } else { iDamage *= 4; } - } else if ( trace_surface_id == BODY_STOMACH ) { + } else if (trace_surface_id == BODY_STOMACH) { iDamage *= 0.9; - } else if ( trace_surface_id == BODY_LEGLEFT ) { + } else if (trace_surface_id == BODY_LEGLEFT) { iDamage *= 0.4; - } else if ( trace_surface_id == BODY_LEGRIGHT ) { + } else if (trace_surface_id == BODY_LEGRIGHT) { iDamage *= 0.4; } - dprint( sprintf( "[DEBUG] Hit Bodypart: %s\n", Damage_GetHitLocation( trace_surface_id ) ) ); + dprint(sprintf("[DEBUG] Hit Bodypart: %s\n", Damage_GetHitLocation(trace_surface_id))); if (eTarget != eAttacker) { - if ( !Damage_ShouldDamage(eTarget.team, eAttacker.team)) { + if (!Damage_ShouldDamage(eTarget.team, eAttacker.team)) { if (!autocvar_mp_friendlyfire) { return; } @@ -117,35 +121,35 @@ void Damage_Apply( entity eTarget, entity eAttacker, float iDamage, vector vHitP eTarget.velocity = [0,0,0]; // Apply the damage finally - if ( eTarget.armor ) { + if (eTarget.armor) { float fRatio = 0.5; - if ( eAttacker.weapon ) { - fRatio *= wptTable[ eAttacker.weapon ].fWeaponArmorRatio; + if (eAttacker.weapon) { + fRatio *= wptTable[eAttacker.weapon].fWeaponArmorRatio; } // Simple implementation of how kevlar damage is calculated float fNewDmg = iDamage * fRatio; - float fNewArmor = ( iDamage - fNewDmg ) / 2; + float fNewArmor = (iDamage - fNewDmg) / 2; - if ( fNewArmor > eTarget.armor ) { + if (fNewArmor > eTarget.armor) { fNewArmor = eTarget.armor; fNewArmor *= (1/0.5); - fNewDmg = rint( iDamage - fNewArmor ); + fNewDmg = rint(iDamage - fNewArmor); eTarget.armor = 0; eTarget.iEquipment -= EQUIPMENT_KEVLAR; } else { - if ( fNewArmor < 0 ) { + if (fNewArmor < 0) { fNewArmor = 1; } - eTarget.armor = rint( eTarget.armor - fNewArmor ); + eTarget.armor = rint(eTarget.armor - fNewArmor); } - if ( iSkipArmor == TRUE ) { - eTarget.health = rint( eTarget.health -= iDamage ); + if (iSkipArmor == TRUE) { + eTarget.health = rint(eTarget.health -= iDamage); eTarget.dmg_take = (float)iDamage; } else { - eTarget.health = rint( eTarget.health -= fNewDmg ); + eTarget.health = rint(eTarget.health -= fNewDmg); eTarget.dmg_take = (float)fNewDmg; } } else { @@ -156,42 +160,42 @@ void Damage_Apply( entity eTarget, entity eAttacker, float iDamage, vector vHitP eTarget.dmg_inflictor = eAttacker; // Special monetary punishment for hostage murderers - if ( eTarget.classname == "hostage_entity" ) { - if ( eTarget.health > 0 ) { - Money_AddMoney( eAttacker, autocvar_fcs_penalty_pain ); // Pain + if (eTarget.classname == "hostage_entity") { + if (eTarget.health > 0) { + Money_AddMoney(eAttacker, autocvar_fcs_penalty_pain); // Pain } else { - Money_AddMoney( eAttacker, autocvar_fcs_penalty_kill ); // Death + Money_AddMoney(eAttacker, autocvar_fcs_penalty_kill); // Death } } // Target is dead and a client.... - if ( eTarget.health <= 0 ) { - if ( eTarget.flags & FL_CLIENT ) { + if (eTarget.health <= 0) { + if (eTarget.flags & FL_CLIENT) { eTarget.fDeaths++; - forceinfokey( eTarget, "*deaths", ftos( eTarget.fDeaths ) ); + forceinfokey(eTarget, "*deaths", ftos(eTarget.fDeaths)); } - if ( ( eTarget.flags & FL_CLIENT ) && ( eAttacker.flags & FL_CLIENT ) ) { + if ((eTarget.flags & FL_CLIENT) && (eAttacker.flags & FL_CLIENT)) { // Don't encourage them to kill their own team members for $$$ - if ( Damage_ShouldDamage( eTarget.team, eAttacker.team ) == TRUE ) { + if (Damage_ShouldDamage(eTarget.team, eAttacker.team) == TRUE) { eAttacker.frags++; - Money_AddMoney( eAttacker, autocvar_fcs_reward_kill ); + Money_AddMoney(eAttacker, autocvar_fcs_reward_kill); } else { eAttacker.frags--; } - Damage_CastOrbituary( eAttacker, eTarget, eAttacker.weapon, trace_surface_id == BODY_HEAD ? TRUE:FALSE ); + Damage_CastOrbituary(eAttacker, eTarget, eAttacker.weapon, trace_surface_id == BODY_HEAD ? TRUE:FALSE); } } entity eOld = self; self = eTarget; - if ( self.health <= 0 ) { + if (self.health <= 0) { self.health = 0; - self.vDeath( trace_surface_id ); + self.vDeath(trace_surface_id); } else { - self.vPain( trace_surface_id ); + self.vPain(trace_surface_id); } self = eOld; @@ -206,37 +210,38 @@ This verifies that the entity is actually able to receive some damage, from a plain geographical standpoint ================= */ -float Damage_CheckAttack( entity eTarget, vector vAttackPos ) { - if ( eTarget.movetype == MOVETYPE_PUSH ) { - traceline( vAttackPos, 0.5 * ( eTarget.absmin + eTarget.absmax ), TRUE, self ); +float Damage_CheckAttack(entity eTarget, vector vAttackPos) +{ + if (eTarget.movetype == MOVETYPE_PUSH) { + traceline(vAttackPos, 0.5 * (eTarget.absmin + eTarget.absmax), TRUE, self); - if ( trace_fraction == 1 ) { + if (trace_fraction == 1) { return TRUE; } - if ( trace_ent == eTarget ) { + if (trace_ent == eTarget) { return TRUE; } return FALSE; } - traceline( vAttackPos, eTarget.origin, TRUE, self ); - if ( trace_fraction == 1 ) { + traceline(vAttackPos, eTarget.origin, TRUE, self); + if (trace_fraction == 1) { return TRUE; } - traceline( vAttackPos, eTarget.origin + '15 15 0', TRUE, self ); - if ( trace_fraction == 1 ) { + traceline(vAttackPos, eTarget.origin + '15 15 0', TRUE, self); + if (trace_fraction == 1) { return TRUE; } - traceline( vAttackPos, eTarget.origin + '-15 -15 0', TRUE, self ); - if ( trace_fraction == 1 ) { + traceline(vAttackPos, eTarget.origin + '-15 -15 0', TRUE, self); + if (trace_fraction == 1) { return TRUE; } - traceline( vAttackPos, eTarget.origin + '-15 15 0', TRUE, self ); - if ( trace_fraction == 1 ) { + traceline(vAttackPos, eTarget.origin + '-15 15 0', TRUE, self); + if (trace_fraction == 1) { return TRUE; } - traceline( vAttackPos, eTarget.origin + '15 -15 0', TRUE, self ); - if ( trace_fraction == 1 ) { + traceline(vAttackPos, eTarget.origin + '15 -15 0', TRUE, self); + if (trace_fraction == 1) { return TRUE; } @@ -250,32 +255,33 @@ Damage_Radius Even more pain and suffering, mostly used for explosives ================= */ -void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadius, int iCheckClip ) { - for ( entity eDChain = world; ( eDChain = findfloat( eDChain, takedamage, DAMAGE_YES ) ); ) { +void Damage_Radius(vector vOrigin, entity eAttacker, float fDamage, float fRadius, int iCheckClip) +{ + for (entity eDChain = world; (eDChain = findfloat(eDChain, takedamage, DAMAGE_YES));) { vector vecRealPos; - vecRealPos[0] = eDChain.absmin[0] + ( 0.5 * ( eDChain.absmax[0] - eDChain.absmin[0] ) ); - vecRealPos[1] = eDChain.absmin[1] + ( 0.5 * ( eDChain.absmax[1] - eDChain.absmin[1] ) ); - vecRealPos[2] = eDChain.absmin[2] + ( 0.5 * ( eDChain.absmax[2] - eDChain.absmin[2] ) ); + vecRealPos[0] = eDChain.absmin[0] + (0.5 * (eDChain.absmax[0] - eDChain.absmin[0])); + vecRealPos[1] = eDChain.absmin[1] + (0.5 * (eDChain.absmax[1] - eDChain.absmin[1])); + vecRealPos[2] = eDChain.absmin[2] + (0.5 * (eDChain.absmax[2] - eDChain.absmin[2])); - float fDist = vlen( vOrigin - vecRealPos ); + float fDist = vlen(vOrigin - vecRealPos); //vector vPush; - if ( fDist > fRadius ) { + if (fDist > fRadius) { continue; } - if ( Damage_CheckAttack( eDChain, vOrigin ) || iCheckClip == FALSE ) { - float fDiff = vlen( vOrigin - vecRealPos ); + if (Damage_CheckAttack(eDChain, vOrigin) || iCheckClip == FALSE) { + float fDiff = vlen(vOrigin - vecRealPos); - fDiff = ( fRadius - fDiff ) / fRadius; + fDiff = (fRadius - fDiff) / fRadius; fDamage = rint(fDamage * fDiff); - if ( fDiff > 0 ) { - Damage_Apply( eDChain, eAttacker, fDamage, eDChain.origin, TRUE ); - /*if ( eDChain.movetype != MOVETYPE_NONE ) { - vPush = vectoangles( vecRealPos - vOrigin ); - makevectors( vPush ); - eDChain.velocity += ( v_forward * fDamage * 5 ) + ( v_up * fDamage * 2.5 ); + if (fDiff > 0) { + Damage_Apply(eDChain, eAttacker, fDamage, eDChain.origin, TRUE); + /*if (eDChain.movetype != MOVETYPE_NONE) { + vPush = vectoangles(vecRealPos - vOrigin); + makevectors(vPush); + eDChain.velocity += (v_forward * fDamage * 5) + (v_up * fDamage * 2.5); }*/ } diff --git a/Source/server/cstrike/input.c b/Source/server/cstrike/input.c old mode 100755 new mode 100644 index 4e514196..0aa1b4ca --- a/Source/server/cstrike/input.c +++ b/Source/server/cstrike/input.c @@ -13,44 +13,45 @@ Input_Handle Handles impulse and whatnot ================= */ -void Input_Handle( void ) { +void Input_Handle(void) +{ // Dead, specatator - if ( self.health <= 0 ) { - /*if ( self.button2 ) { - if ( infokey( self, "*spectator" ) == "0" ) { - forceinfokey( self, "*spectator", "1" ); + if (self.health <= 0) { + /*if (self.button2) { + if (infokey(self, "*spectator") == "0") { + forceinfokey(self, "*spectator", "1"); } else { - forceinfokey( self, "*spectator", "1" ); + forceinfokey(self, "*spectator", "1"); } }*/ return; } // TODO: Make this fast switch only - if ( self.impulse == 3 ) { - Weapon_Switch( SLOT_MELEE ); - } else if ( self.impulse == 2 ) { - Weapon_Switch( SLOT_SECONDARY ); - } else if ( self.impulse == 1 ) { - Weapon_Switch( SLOT_PRIMARY ); - } else if ( self.impulse == 4 ) { - Weapon_Switch( SLOT_GRENADE ); + if (self.impulse == 3) { + Weapon_Switch(SLOT_MELEE); + } else if (self.impulse == 2) { + Weapon_Switch(SLOT_SECONDARY); + } else if (self.impulse == 1) { + Weapon_Switch(SLOT_PRIMARY); + } else if (self.impulse == 4) { + Weapon_Switch(SLOT_GRENADE); } - if ( self.button5 ) { + if (self.button5) { Player_UseDown(); } else { Player_UseUp(); } - if ( self.button0 ) { - if ( fGameState != GAME_FREEZE ) { - Weapon_PrimaryAttack( self.weapon ); + if (self.button0) { + if (fGameState != GAME_FREEZE) { + Weapon_PrimaryAttack(self.weapon); } - } else if ( self.button4 ) { - Weapon_Reload( self.weapon ); - } else if ( self.button3 ) { - Weapon_SecondaryAttack( self.weapon ); + } else if (self.button4) { + Weapon_Reload(self.weapon); + } else if (self.button3) { + Weapon_SecondaryAttack(self.weapon); } else { Weapon_Release(); } diff --git a/Source/server/cstrike/main.c b/Source/server/cstrike/main.c old mode 100755 new mode 100644 index b84f1979..e9643628 --- a/Source/server/cstrike/main.c +++ b/Source/server/cstrike/main.c @@ -6,17 +6,19 @@ * ****/ -void SV_SendChat( entity eSender, string sMessage, entity eEnt, float fType ) { - WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET ); - WriteByte( MSG_MULTICAST, fType == 0 ? EV_CHAT:EV_CHAT_TEAM ); - WriteByte( MSG_MULTICAST, num_for_edict( eSender ) - 1 ); - WriteByte( MSG_MULTICAST, eSender.team ); - WriteString( MSG_MULTICAST, sMessage ); +void SV_SendChat(entity eSender, string sMessage, entity eEnt, float fType) +{ + WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); + WriteByte(MSG_MULTICAST, fType == 0 ? EV_CHAT:EV_CHAT_TEAM); + WriteByte(MSG_MULTICAST, num_for_edict(eSender) - 1); + WriteByte(MSG_MULTICAST, eSender.team); + WriteString(MSG_MULTICAST, sMessage); + if (eEnt) { msg_entity = eEnt; - multicast( '0 0 0', MULTICAST_ONE ); + multicast('0 0 0', MULTICAST_ONE); } else { - multicast( '0 0 0', MULTICAST_ALL ); + multicast('0 0 0', MULTICAST_ALL); } } @@ -28,153 +30,155 @@ Intercepts 'cmd' calls. We use it to intercept chat messages and handle distribution ourselves. ================= */ -void Game_ParseClientCommand( string sCommand ) { - tokenize( sCommand ); +void Game_ParseClientCommand(string sCommand) +{ + tokenize(sCommand); - if ( argv( 1 ) == "timeleft" ) { - float fTimeLeft = cvar( "mp_timelimit" ) - ( time / 60 ); - Vox_Singlecast( self, sprintf( "we have %s minutes remaining", Vox_TimeToString( fTimeLeft ) ) ); + if (argv(1) == "timeleft") { + float fTimeLeft = cvar("mp_timelimit") - (time / 60); + Vox_Singlecast(self, sprintf("we have %s minutes remaining", Vox_TimeToString(fTimeLeft))); return; } - string chat = substring( sCommand, 4, strlen( sCommand ) - 4 ); + string chat = substring(sCommand, 4, strlen(sCommand) - 4); // Players talk to players, spectators to spectators. - if ( self.health ) { - if ( argv( 0 ) == "say" ) { - localcmd( sprintf( "echo %s: %s\n", self.netname, chat ) ); - SV_SendChat( self, chat, world, 0 ); + if (self.health ) { + if (argv(0) == "say") { + localcmd(sprintf("echo %s: %s\n", self.netname, chat)); + SV_SendChat(self, chat, world, 0); return; - } else if ( argv( 0 ) == "say_team" ) { - localcmd( sprintf( "echo [TEAM %d] %s: %s\n", self.team, self.netname, chat ) ); - for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) { - if ( eFind.team == self.team ) { - SV_SendChat( self, chat, eFind, 1 ); + } else if (argv(0) == "say_team") { + localcmd(sprintf("echo [TEAM %d] %s: %s\n", self.team, self.netname, chat)); + for (entity eFind = world; (eFind = find(eFind, classname, "player"));) { + if (eFind.team == self.team) { + SV_SendChat(self, chat, eFind, 1); } } return; } } else { - if ( argv( 0 ) == "say" ) { - localcmd( sprintf( "echo [DEAD] %s: %s\n", self.netname, chat ) ); - for ( entity eFind = world; ( eFind = find( eFind, classname, "spectator" ) ); ) { - SV_SendChat( self, chat, eFind, 1 ); + if (argv(0) == "say") { + localcmd(sprintf("echo [DEAD] %s: %s\n", self.netname, chat)); + for (entity eFind = world; (eFind = find(eFind, classname, "spectator"));) { + SV_SendChat(self, chat, eFind, 1); } return; - } else if ( argv( 0 ) == "say_team" ) { - localcmd( sprintf( "echo [DEAD] %s: %s\n", self.netname, chat ) ); + } else if (argv(0) == "say_team") { + localcmd(sprintf("echo [DEAD] %s: %s\n", self.netname, chat)); return; } } - clientcommand( self, sCommand ); + clientcommand(self, sCommand); } -float Game_ConsoleCmd( string sCommand ) { +float Game_ConsoleCmd(string sCommand) +{ /*CBot bot; - if ( !self ) { - for ( other = world; ( other = find( other, classname, "player" ) ); ) { - if ( clienttype( other ) == CLIENTTYPE_REAL ) { + if (!self) { + for (other = world; (other = find(other, classname, "player"));) { + if (clienttype(other) == CLIENTTYPE_REAL) { self = other; break; } } }*/ - tokenize( sCommand ); - switch ( argv( 0 ) ) { + tokenize(sCommand); + switch (argv(0)) { /*case "bot_add": bot = (CBot)spawnclient(); - if ( !bot ) { - print( "Server is full\n" ); + if (!bot) { + print("Server is full\n"); return TRUE; } bot.CreateRandom(); break; case "bot_follow": - if ( !self ) { + if (!self) { return TRUE; } - for ( other = world; ( other = find( other, classname, "Player" ) ); ) { - if ( clienttype( other ) != CLIENTTYPE_BOT ) { + for (other = world; (other = find(other, classname, "Player"));) { + if (clienttype(other) != CLIENTTYPE_BOT) { continue; } bot = (CBot)other; - if ( bot.route ) { -// RT_RouteChange( bot.route, bot.origin, self.origin ); + if (bot.route) { +// RT_RouteChange(bot.route, bot.origin, self.origin); } else { -// RT_Destroy( bot.route ); - // bot.route = RT_RouteCreate( bot.origin, self.origin ); +// RT_Destroy(bot.route); + // bot.route = RT_RouteCreate(bot.origin, self.origin); } } break; case "bot_kill": - if ( !self ) { + if (!self) { return TRUE; } - for ( other = world; ( other = find( other, classname, "Player" ) ); ) { - if ( clienttype( other ) != CLIENTTYPE_BOT ) { + for (other = world; (other = find(other, classname, "Player"));) { + if (clienttype(other) != CLIENTTYPE_BOT) { continue; } - if ( argv( 1 ) ) { - if ( other.netname == argv( 1 ) ) { - //Damage_Apply( other, other, 500, DAMAGE_SUICIDE, 0 ); + if (argv(1)) { + if (other.netname == argv(1)) { + //Damage_Apply(other, other, 500, DAMAGE_SUICIDE, 0); break; } } else { - //Damage_Apply( other, other, 500, DAMAGE_SUICIDE, 0 ); + //Damage_Apply(other, other, 500, DAMAGE_SUICIDE, 0); } } break; case "bot_kick": - if ( !self ) { + if (!self) { return TRUE; } - for ( other = world; ( other = find( other, classname, "Player" ) ); ) { - if ( clienttype( other ) != CLIENTTYPE_BOT ) { + for (other = world; (other = find(other, classname, "Player"));) { + if (clienttype(other) != CLIENTTYPE_BOT) { continue; } - if ( argv( 1 ) ) { - if ( other.netname == argv( 1 ) ) { - dropclient( other ); + if (argv(1)) { + if (other.netname == argv(1)) { + dropclient(other); break; } } else { - dropclient( other ); + dropclient(other); } } break; case "way_add": - if ( !self ) { + if (!self) { return TRUE; } - Way_Waypoint_Create( self, TRUE ); + Way_Waypoint_Create(self, TRUE); break; case "way_delete": - if ( !self ) { + if (!self) { return TRUE; } - Way_Waypoint_Delete( Way_FindClosestWaypoint( self.origin ) ); + Way_Waypoint_Delete(Way_FindClosestWaypoint(self.origin)); break; case "way_radius": - if ( !self ) { + if (!self) { return TRUE; } - Way_Waypoint_SetRadius( Way_FindClosestWaypoint( self.origin ), stof( argv( 1 ) ) ); + Way_Waypoint_SetRadius(Way_FindClosestWaypoint(self.origin), stof(argv(1))); break; case "way_makejump": - if ( !self ) { + if (!self) { return TRUE; } - Way_Waypoint_MakeJump( Way_FindClosestWaypoint( self.origin ) ); + Way_Waypoint_MakeJump(Way_FindClosestWaypoint(self.origin)); break; case "way_save": - Way_DumpWaypoints( argv( 1 ) ); + Way_DumpWaypoints(argv(1)); break; case "way_load": - Way_ReadWaypoints( argv( 1 ) ); + Way_ReadWaypoints(argv(1)); break;*/ case "vox": - Vox_Broadcast( argv( 1 ) ); + Vox_Broadcast(argv(1)); break; default: return FALSE; @@ -183,7 +187,8 @@ float Game_ConsoleCmd( string sCommand ) { return TRUE; } -void SV_PausedTic( float fDuration ) { +void SV_PausedTic(float fDuration) +{ } @@ -194,26 +199,27 @@ StartFrame Runs every frame... by worldspawn? ================= */ -void Game_StartFrame( void ) { +void Game_StartFrame(void) +{ // We've got hostages, but no rescue zones, create some - if ( !iRescueZones && iHostagesMax > 0 ) { + if (!iRescueZones && iHostagesMax > 0) { Game_CreateRescueZones(); } - if ( iBuyZones == 0 ) { + if (iBuyZones == 0) { Game_CreateBuyZones(); } // TODO: Optimise this - if ( ( iAlivePlayers_T + iAlivePlayers_CT ) == 0 ) { + if ((iAlivePlayers_T + iAlivePlayers_CT) == 0) { int iInGamePlayers = 0; - for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) { + for (entity eFind = world; (eFind = find(eFind, classname, "player"));) { iInGamePlayers++; } - if ( ( iInGamePlayers > 0 ) && ( fGameState != GAME_COMMENCING && fGameState != GAME_END ) ) { - Timer_Begin( 2, GAME_COMMENCING ); - } else if ( iInGamePlayers == 0 ) { + if ((iInGamePlayers > 0) && (fGameState != GAME_COMMENCING && fGameState != GAME_END)) { + Timer_Begin(2, GAME_COMMENCING); + } else if (iInGamePlayers == 0) { fGameState = GAME_INACTIVE; fGameTime = 0; iWon_T = 0; @@ -241,57 +247,57 @@ void Game_Worldspawn(void) int iMOTDLines = 0; // The message of the day. - localcmd( sprintf( "echo [MOTD] Loading %s.\n", autocvar_motdfile ) ); - filestream fmMOTD = fopen( autocvar_motdfile, FILE_READ ); + localcmd(sprintf("echo [MOTD] Loading %s.\n", autocvar_motdfile)); + filestream fmMOTD = fopen(autocvar_motdfile, FILE_READ); - if ( fmMOTD >= 0 ) { - for ( int i = 0; i < 25; i++ ) { - sTemp = fgets( fmMOTD ); - if not ( sTemp ) { + if (fmMOTD >= 0) { + for (int i = 0; i < 25; i++) { + sTemp = fgets(fmMOTD); + if not (sTemp) { break; } - if ( sTemp == __NULL__ ) { - localcmd( sprintf( "serverinfo motdline%i /\n", iMOTDLines ) ); + if (sTemp == __NULL__) { + localcmd(sprintf("serverinfo motdline%i /\n", iMOTDLines)); } else { - localcmd( sprintf( "serverinfo motdline%i %s\n", iMOTDLines, sTemp ) ); + localcmd(sprintf("serverinfo motdline%i %s\n", iMOTDLines, sTemp)); } iMOTDLines++; } - localcmd( sprintf( "serverinfo motdlength %i\n", iMOTDLines ) ); - fclose( fmMOTD ); + localcmd(sprintf("serverinfo motdlength %i\n", iMOTDLines)); + fclose(fmMOTD); } else { - error( "[MOTD] Loading failed.\n" ); + error("[MOTD] Loading failed.\n"); } // The mapcycle information. - localcmd( sprintf( "echo [MAPCYCLE] Loading %s.\n", autocvar_mapcyclefile ) ); - filestream fmMapcycle = fopen( autocvar_mapcyclefile, FILE_READ ); + localcmd(sprintf("echo [MAPCYCLE] Loading %s.\n", autocvar_mapcyclefile)); + filestream fmMapcycle = fopen(autocvar_mapcyclefile, FILE_READ); - if ( fmMapcycle >= 0 ) { - for ( int i = 0;; i++ ) { - sTemp = fgets( fmMapcycle ); - if not ( sTemp ) { + if (fmMapcycle >= 0) { + for (int i = 0;; i++) { + sTemp = fgets(fmMapcycle); + if not (sTemp) { break; } - if ( sTemp != __NULL__ ) { + if (sTemp != __NULL__) { iMapCycleCount++; } } - fseek( fmMapcycle, 0 ); - localcmd( sprintf( "echo [MAPCYCLE] List has %i maps.\n", iMapCycleCount ) ); - sMapCycle = memalloc( sizeof( string ) * iMapCycleCount ); - for ( int i = 0; i < iMapCycleCount; i++ ) { - sMapCycle[ i ] = fgets( fmMapcycle ); + fseek(fmMapcycle, 0); + localcmd(sprintf("echo [MAPCYCLE] List has %i maps.\n", iMapCycleCount)); + sMapCycle = memalloc(sizeof(string) * iMapCycleCount); + for (int i = 0; i < iMapCycleCount; i++) { + sMapCycle[i] = fgets(fmMapcycle); } - fclose( fmMapcycle ); + fclose(fmMapcycle); - for ( int i = 0; i < iMapCycleCount; i++ ) { - if ( sMapCycle[ i ] == mapname ) { - if ( ( i + 1 ) < iMapCycleCount ) { - localcmd( sprintf( "echo [MAPCYCLE] Next map: %s\n", sMapCycle[ i + 1 ] ) ); + for (int i = 0; i < iMapCycleCount; i++) { + if (sMapCycle[i] == mapname) { + if ((i + 1) < iMapCycleCount) { + localcmd(sprintf("echo [MAPCYCLE] Next map: %s\n", sMapCycle[i + 1])); } else { break; } @@ -299,246 +305,246 @@ void Game_Worldspawn(void) } } else { iMapCycleCount = 0; - error( "[MAPCYCLE] Loading failed.\n" ); + error("[MAPCYCLE] Loading failed.\n"); } // Let's make our version information clear - localcmd( sprintf( "serverinfo fcs_ver %s\n", __DATE__ ) ); + localcmd(sprintf("serverinfo fcs_ver %s\n", __DATE__)); // All the important precaches - for ( int i = 1; i < CS_WEAPON_COUNT; i++ ) { - precache_model( sWeaponModels[ i ] ); + for (int i = 1; i < CS_WEAPON_COUNT; i++) { + precache_model(sWeaponModels[i]); } /*Bot_Init();*/ - precache_model( "models/w_flashbang.mdl" ); - precache_model( "models/w_hegrenade.mdl" ); - precache_model( "models/w_smokegrenade.mdl" ); + precache_model("models/w_flashbang.mdl"); + precache_model("models/w_hegrenade.mdl"); + precache_model("models/w_smokegrenade.mdl"); - precache_model( sCSPlayers[1] ); - precache_model( sCSPlayers[2] ); - precache_model( sCSPlayers[3] ); - precache_model( sCSPlayers[4] ); - precache_model( sCSPlayers[5] ); - precache_model( sCSPlayers[6] ); - precache_model( sCSPlayers[7] ); - precache_model( sCSPlayers[8] ); - precache_model( "models/player/vip/vip.mdl" ); - precache_model( "models/w_c4.mdl" ); + precache_model(sCSPlayers[1]); + precache_model(sCSPlayers[2]); + precache_model(sCSPlayers[3]); + precache_model(sCSPlayers[4]); + precache_model(sCSPlayers[5]); + precache_model(sCSPlayers[6]); + precache_model(sCSPlayers[7]); + precache_model(sCSPlayers[8]); + precache_model("models/player/vip/vip.mdl"); + precache_model("models/w_c4.mdl"); - precache_sound( "hostage/hos1.wav" ); - precache_sound( "hostage/hos2.wav" ); - precache_sound( "hostage/hos3.wav" ); - precache_sound( "hostage/hos4.wav" ); - precache_sound( "hostage/hos5.wav" ); + precache_sound("hostage/hos1.wav"); + precache_sound("hostage/hos2.wav"); + precache_sound("hostage/hos3.wav"); + precache_sound("hostage/hos4.wav"); + precache_sound("hostage/hos5.wav"); - precache_sound( "player/pl_pain2.wav" ); - precache_sound( "player/pl_pain4.wav" ); - precache_sound( "player/pl_pain5.wav" ); - precache_sound( "player/pl_pain6.wav" ); - precache_sound( "player/pl_pain7.wav" ); + precache_sound("player/pl_pain2.wav"); + precache_sound("player/pl_pain4.wav"); + precache_sound("player/pl_pain5.wav"); + precache_sound("player/pl_pain6.wav"); + precache_sound("player/pl_pain7.wav"); - precache_sound( "player/die1.wav" ); - precache_sound( "player/die2.wav" ); - precache_sound( "player/die3.wav" ); + precache_sound("player/die1.wav"); + precache_sound("player/die2.wav"); + precache_sound("player/die3.wav"); - precache_sound( "player/headshot1.wav" ); - precache_sound( "player/headshot2.wav" ); - precache_sound( "player/headshot3.wav" ); + precache_sound("player/headshot1.wav"); + precache_sound("player/headshot2.wav"); + precache_sound("player/headshot3.wav"); - precache_sound( "items/tr_kevlar.wav" ); + precache_sound("items/tr_kevlar.wav"); - precache_sound( "weapons/ak47-1.wav" ); - precache_sound( "weapons/ak47-2.wav" ); - precache_sound( "weapons/ak47_boltpull.wav" ); - precache_sound( "weapons/ak47_clipin.wav" ); - precache_sound( "weapons/ak47_clipout.wav" ); - precache_sound( "weapons/aug-1.wav" ); - precache_sound( "weapons/aug_boltpull.wav" ); - precache_sound( "weapons/aug_boltslap.wav" ); - precache_sound( "weapons/aug_clipin.wav" ); - precache_sound( "weapons/aug_clipout.wav" ); - precache_sound( "weapons/aug_forearm.wav" ); - precache_sound( "weapons/awp1.wav" ); - precache_sound( "weapons/awp_clipin.wav" ); - precache_sound( "weapons/awp_clipout.wav" ); - precache_sound( "weapons/awp_deploy.wav" ); - precache_sound( "weapons/boltdown.wav" ); - precache_sound( "weapons/boltpull1.wav" ); - precache_sound( "weapons/boltup.wav" ); - precache_sound( "weapons/c4_beep1.wav" ); - precache_sound( "weapons/c4_beep2.wav" ); - precache_sound( "weapons/c4_beep3.wav" ); - precache_sound( "weapons/c4_beep4.wav" ); - precache_sound( "weapons/c4_beep5.wav" ); - precache_sound( "weapons/c4_click.wav" ); - precache_sound( "weapons/c4_disarm.wav" ); - precache_sound( "weapons/c4_disarmed.wav" ); - precache_sound( "weapons/c4_explode1.wav" ); - precache_sound( "weapons/c4_plant.wav" ); - precache_sound( "weapons/clipin1.wav" ); - precache_sound( "weapons/clipout1.wav" ); - precache_sound( "weapons/de_clipin.wav" ); - precache_sound( "weapons/de_clipout.wav" ); - precache_sound( "weapons/de_deploy.wav" ); - precache_sound( "weapons/deagle-1.wav" ); - precache_sound( "weapons/deagle-2.wav" ); - precache_sound( "weapons/dryfire_pistol.wav" ); - precache_sound( "weapons/dryfire_rifle.wav" ); - precache_sound( "weapons/elite_clipout.wav" ); - precache_sound( "weapons/elite_deploy.wav" ); - precache_sound( "weapons/elite_fire.wav" ); - precache_sound( "weapons/elite_leftclipin.wav" ); - precache_sound( "weapons/elite_reloadstart.wav" ); - precache_sound( "weapons/elite_rightclipin.wav" ); - precache_sound( "weapons/elite_sliderelease.wav" ); - precache_sound( "weapons/elite_twirl.wav" ); - precache_sound( "weapons/fiveseven-1.wav" ); - precache_sound( "weapons/fiveseven_clipin.wav" ); - precache_sound( "weapons/fiveseven_clipout.wav" ); - precache_sound( "weapons/fiveseven_slidepull.wav" ); - precache_sound( "weapons/fiveseven_sliderelease.wav" ); - precache_sound( "weapons/flashbang-1.wav" ); - precache_sound( "weapons/flashbang-2.wav" ); - precache_sound( "weapons/g3sg1-1.wav" ); - precache_sound( "weapons/g3sg1_clipin.wav" ); - precache_sound( "weapons/g3sg1_clipout.wav" ); - precache_sound( "weapons/g3sg1_slide.wav" ); - precache_sound( "weapons/generic_reload.wav" ); - precache_sound( "weapons/generic_shot_reload.wav" ); - precache_sound( "weapons/glock18-1.wav" ); - precache_sound( "weapons/glock18-2.wav" ); - precache_sound( "weapons/grenade_hit1.wav" ); - precache_sound( "weapons/grenade_hit2.wav" ); - precache_sound( "weapons/grenade_hit3.wav" ); - precache_sound( "weapons/he_bounce-1.wav" ); - precache_sound( "weapons/headshot2.wav" ); - precache_sound( "weapons/hegrenade-1.wav" ); - precache_sound( "weapons/hegrenade-2.wav" ); - precache_sound( "weapons/knife_deploy1.wav" ); - precache_sound( "weapons/knife_hit1.wav" ); - precache_sound( "weapons/knife_hit2.wav" ); - precache_sound( "weapons/knife_hit3.wav" ); - precache_sound( "weapons/knife_hit4.wav" ); - precache_sound( "weapons/knife_hitwall1.wav" ); - precache_sound( "weapons/knife_slash1.wav" ); - precache_sound( "weapons/knife_slash2.wav" ); - precache_sound( "weapons/knife_stab.wav" ); - precache_sound( "weapons/m249-1.wav" ); - precache_sound( "weapons/m249-2.wav" ); - precache_sound( "weapons/m249_boxin.wav" ); - precache_sound( "weapons/m249_boxout.wav" ); - precache_sound( "weapons/m249_chain.wav" ); - precache_sound( "weapons/m249_coverdown.wav" ); - precache_sound( "weapons/m249_coverup.wav" ); - precache_sound( "weapons/m3-1.wav" ); - precache_sound( "weapons/m3_insertshell.wav" ); - precache_sound( "weapons/m3_pump.wav" ); - precache_sound( "weapons/m4a1-1.wav" ); - precache_sound( "weapons/m4a1_boltpull.wav" ); - precache_sound( "weapons/m4a1_clipin.wav" ); - precache_sound( "weapons/m4a1_clipout.wav" ); - precache_sound( "weapons/m4a1_deploy.wav" ); - precache_sound( "weapons/m4a1_silencer_off.wav" ); - precache_sound( "weapons/m4a1_silencer_on.wav" ); - precache_sound( "weapons/m4a1_unsil-1.wav" ); - precache_sound( "weapons/m4a1_unsil-2.wav" ); - precache_sound( "weapons/mac10-1.wav" ); - precache_sound( "weapons/mac10_boltpull.wav" ); - precache_sound( "weapons/mac10_clipin.wav" ); - precache_sound( "weapons/mac10_clipout.wav" ); - precache_sound( "weapons/mp5-1.wav" ); - precache_sound( "weapons/mp5-2.wav" ); - precache_sound( "weapons/mp5_clipin.wav" ); - precache_sound( "weapons/mp5_clipout.wav" ); - precache_sound( "weapons/mp5_slideback.wav" ); - precache_sound( "weapons/p228-1.wav" ); - precache_sound( "weapons/p228_clipin.wav" ); - precache_sound( "weapons/p228_clipout.wav" ); - precache_sound( "weapons/p228_slidepull.wav" ); - precache_sound( "weapons/p228_sliderelease.wav" ); - precache_sound( "weapons/p90-1.wav" ); - precache_sound( "weapons/p90_boltpull.wav" ); - precache_sound( "weapons/p90_clipin.wav" ); - precache_sound( "weapons/p90_clipout.wav" ); - precache_sound( "weapons/p90_cliprelease.wav" ); - precache_sound( "weapons/pinpull.wav" ); - precache_sound( "weapons/ric1.wav" ); - precache_sound( "weapons/ric2.wav" ); - precache_sound( "weapons/ric3.wav" ); - precache_sound( "weapons/ric4.wav" ); - precache_sound( "weapons/ric5.wav" ); - precache_sound( "weapons/ric_conc-1.wav" ); - precache_sound( "weapons/ric_conc-2.wav" ); - precache_sound( "weapons/ric_metal-1.wav" ); - precache_sound( "weapons/ric_metal-2.wav" ); - precache_sound( "weapons/scout_bolt.wav" ); - precache_sound( "weapons/scout_clipin.wav" ); - precache_sound( "weapons/scout_clipout.wav" ); - precache_sound( "weapons/scout_fire-1.wav" ); - precache_sound( "weapons/sg550-1.wav" ); - precache_sound( "weapons/sg550_boltpull.wav" ); - precache_sound( "weapons/sg550_clipin.wav" ); - precache_sound( "weapons/sg550_clipout.wav" ); - precache_sound( "weapons/sg552-1.wav" ); - precache_sound( "weapons/sg552-2.wav" ); - precache_sound( "weapons/sg552_boltpull.wav" ); - precache_sound( "weapons/sg552_clipin.wav" ); - precache_sound( "weapons/sg552_clipout.wav" ); - precache_sound( "weapons/sg_explode.wav" ); - precache_sound( "weapons/slideback1.wav" ); - precache_sound( "weapons/sliderelease1.wav" ); - precache_sound( "weapons/tmp-1.wav" ); - precache_sound( "weapons/tmp-2.wav" ); - precache_sound( "weapons/ump45-1.wav" ); - precache_sound( "weapons/ump45_boltslap.wav" ); - precache_sound( "weapons/ump45_clipin.wav" ); - precache_sound( "weapons/ump45_clipout.wav" ); - precache_sound( "weapons/usp1.wav" ); - precache_sound( "weapons/usp2.wav" ); - precache_sound( "weapons/usp_clipin.wav" ); - precache_sound( "weapons/usp_clipout.wav" ); - precache_sound( "weapons/usp_silencer_off.wav" ); - precache_sound( "weapons/usp_silencer_on.wav" ); - precache_sound( "weapons/usp_slideback.wav" ); - precache_sound( "weapons/usp_sliderelease.wav" ); - precache_sound( "weapons/usp_unsil-1.wav" ); - precache_sound( "weapons/xm1014-1.wav" ); - precache_sound( "weapons/zoom.wav" ); + precache_sound("weapons/ak47-1.wav"); + precache_sound("weapons/ak47-2.wav"); + precache_sound("weapons/ak47_boltpull.wav"); + precache_sound("weapons/ak47_clipin.wav"); + precache_sound("weapons/ak47_clipout.wav"); + precache_sound("weapons/aug-1.wav"); + precache_sound("weapons/aug_boltpull.wav"); + precache_sound("weapons/aug_boltslap.wav"); + precache_sound("weapons/aug_clipin.wav"); + precache_sound("weapons/aug_clipout.wav"); + precache_sound("weapons/aug_forearm.wav"); + precache_sound("weapons/awp1.wav"); + precache_sound("weapons/awp_clipin.wav"); + precache_sound("weapons/awp_clipout.wav"); + precache_sound("weapons/awp_deploy.wav"); + precache_sound("weapons/boltdown.wav"); + precache_sound("weapons/boltpull1.wav"); + precache_sound("weapons/boltup.wav"); + precache_sound("weapons/c4_beep1.wav"); + precache_sound("weapons/c4_beep2.wav"); + precache_sound("weapons/c4_beep3.wav"); + precache_sound("weapons/c4_beep4.wav"); + precache_sound("weapons/c4_beep5.wav"); + precache_sound("weapons/c4_click.wav"); + precache_sound("weapons/c4_disarm.wav"); + precache_sound("weapons/c4_disarmed.wav"); + precache_sound("weapons/c4_explode1.wav"); + precache_sound("weapons/c4_plant.wav"); + precache_sound("weapons/clipin1.wav"); + precache_sound("weapons/clipout1.wav"); + precache_sound("weapons/de_clipin.wav"); + precache_sound("weapons/de_clipout.wav"); + precache_sound("weapons/de_deploy.wav"); + precache_sound("weapons/deagle-1.wav"); + precache_sound("weapons/deagle-2.wav"); + precache_sound("weapons/dryfire_pistol.wav"); + precache_sound("weapons/dryfire_rifle.wav"); + precache_sound("weapons/elite_clipout.wav"); + precache_sound("weapons/elite_deploy.wav"); + precache_sound("weapons/elite_fire.wav"); + precache_sound("weapons/elite_leftclipin.wav"); + precache_sound("weapons/elite_reloadstart.wav"); + precache_sound("weapons/elite_rightclipin.wav"); + precache_sound("weapons/elite_sliderelease.wav"); + precache_sound("weapons/elite_twirl.wav"); + precache_sound("weapons/fiveseven-1.wav"); + precache_sound("weapons/fiveseven_clipin.wav"); + precache_sound("weapons/fiveseven_clipout.wav"); + precache_sound("weapons/fiveseven_slidepull.wav"); + precache_sound("weapons/fiveseven_sliderelease.wav"); + precache_sound("weapons/flashbang-1.wav"); + precache_sound("weapons/flashbang-2.wav"); + precache_sound("weapons/g3sg1-1.wav"); + precache_sound("weapons/g3sg1_clipin.wav"); + precache_sound("weapons/g3sg1_clipout.wav"); + precache_sound("weapons/g3sg1_slide.wav"); + precache_sound("weapons/generic_reload.wav"); + precache_sound("weapons/generic_shot_reload.wav"); + precache_sound("weapons/glock18-1.wav"); + precache_sound("weapons/glock18-2.wav"); + precache_sound("weapons/grenade_hit1.wav"); + precache_sound("weapons/grenade_hit2.wav"); + precache_sound("weapons/grenade_hit3.wav"); + precache_sound("weapons/he_bounce-1.wav"); + precache_sound("weapons/headshot2.wav"); + precache_sound("weapons/hegrenade-1.wav"); + precache_sound("weapons/hegrenade-2.wav"); + precache_sound("weapons/knife_deploy1.wav"); + precache_sound("weapons/knife_hit1.wav"); + precache_sound("weapons/knife_hit2.wav"); + precache_sound("weapons/knife_hit3.wav"); + precache_sound("weapons/knife_hit4.wav"); + precache_sound("weapons/knife_hitwall1.wav"); + precache_sound("weapons/knife_slash1.wav"); + precache_sound("weapons/knife_slash2.wav"); + precache_sound("weapons/knife_stab.wav"); + precache_sound("weapons/m249-1.wav"); + precache_sound("weapons/m249-2.wav"); + precache_sound("weapons/m249_boxin.wav"); + precache_sound("weapons/m249_boxout.wav"); + precache_sound("weapons/m249_chain.wav"); + precache_sound("weapons/m249_coverdown.wav"); + precache_sound("weapons/m249_coverup.wav"); + precache_sound("weapons/m3-1.wav"); + precache_sound("weapons/m3_insertshell.wav"); + precache_sound("weapons/m3_pump.wav"); + precache_sound("weapons/m4a1-1.wav"); + precache_sound("weapons/m4a1_boltpull.wav"); + precache_sound("weapons/m4a1_clipin.wav"); + precache_sound("weapons/m4a1_clipout.wav"); + precache_sound("weapons/m4a1_deploy.wav"); + precache_sound("weapons/m4a1_silencer_off.wav"); + precache_sound("weapons/m4a1_silencer_on.wav"); + precache_sound("weapons/m4a1_unsil-1.wav"); + precache_sound("weapons/m4a1_unsil-2.wav"); + precache_sound("weapons/mac10-1.wav"); + precache_sound("weapons/mac10_boltpull.wav"); + precache_sound("weapons/mac10_clipin.wav"); + precache_sound("weapons/mac10_clipout.wav"); + precache_sound("weapons/mp5-1.wav"); + precache_sound("weapons/mp5-2.wav"); + precache_sound("weapons/mp5_clipin.wav"); + precache_sound("weapons/mp5_clipout.wav"); + precache_sound("weapons/mp5_slideback.wav"); + precache_sound("weapons/p228-1.wav"); + precache_sound("weapons/p228_clipin.wav"); + precache_sound("weapons/p228_clipout.wav"); + precache_sound("weapons/p228_slidepull.wav"); + precache_sound("weapons/p228_sliderelease.wav"); + precache_sound("weapons/p90-1.wav"); + precache_sound("weapons/p90_boltpull.wav"); + precache_sound("weapons/p90_clipin.wav"); + precache_sound("weapons/p90_clipout.wav"); + precache_sound("weapons/p90_cliprelease.wav"); + precache_sound("weapons/pinpull.wav"); + precache_sound("weapons/ric1.wav"); + precache_sound("weapons/ric2.wav"); + precache_sound("weapons/ric3.wav"); + precache_sound("weapons/ric4.wav"); + precache_sound("weapons/ric5.wav"); + precache_sound("weapons/ric_conc-1.wav"); + precache_sound("weapons/ric_conc-2.wav"); + precache_sound("weapons/ric_metal-1.wav"); + precache_sound("weapons/ric_metal-2.wav"); + precache_sound("weapons/scout_bolt.wav"); + precache_sound("weapons/scout_clipin.wav"); + precache_sound("weapons/scout_clipout.wav"); + precache_sound("weapons/scout_fire-1.wav"); + precache_sound("weapons/sg550-1.wav"); + precache_sound("weapons/sg550_boltpull.wav"); + precache_sound("weapons/sg550_clipin.wav"); + precache_sound("weapons/sg550_clipout.wav"); + precache_sound("weapons/sg552-1.wav"); + precache_sound("weapons/sg552-2.wav"); + precache_sound("weapons/sg552_boltpull.wav"); + precache_sound("weapons/sg552_clipin.wav"); + precache_sound("weapons/sg552_clipout.wav"); + precache_sound("weapons/sg_explode.wav"); + precache_sound("weapons/slideback1.wav"); + precache_sound("weapons/sliderelease1.wav"); + precache_sound("weapons/tmp-1.wav"); + precache_sound("weapons/tmp-2.wav"); + precache_sound("weapons/ump45-1.wav"); + precache_sound("weapons/ump45_boltslap.wav"); + precache_sound("weapons/ump45_clipin.wav"); + precache_sound("weapons/ump45_clipout.wav"); + precache_sound("weapons/usp1.wav"); + precache_sound("weapons/usp2.wav"); + precache_sound("weapons/usp_clipin.wav"); + precache_sound("weapons/usp_clipout.wav"); + precache_sound("weapons/usp_silencer_off.wav"); + precache_sound("weapons/usp_silencer_on.wav"); + precache_sound("weapons/usp_slideback.wav"); + precache_sound("weapons/usp_sliderelease.wav"); + precache_sound("weapons/usp_unsil-1.wav"); + precache_sound("weapons/xm1014-1.wav"); + precache_sound("weapons/zoom.wav"); - clientstat( 0, EV_FLOAT, health ); - clientstat( 10, EV_FLOAT, weapon ); - clientstat( 16, EV_FLOAT, view_ofs_z ); - clientstat( 21, EV_FLOAT, viewzoom ); + clientstat(0, EV_FLOAT, health); + clientstat(10, EV_FLOAT, weapon); + clientstat(16, EV_FLOAT, view_ofs_z); + clientstat(21, EV_FLOAT, viewzoom); /* FIXME: Turn those into bitflags */ - clientstat( STAT_BUYZONE, EV_FLOAT, fInBuyZone ); - clientstat( STAT_HOSTAGEZONE, EV_FLOAT, fInHostageZone ); - clientstat( STAT_BOMBZONE, EV_FLOAT, fInBombZone ); - clientstat( STAT_ESCAPEZONE, EV_FLOAT, fInEscapeZone ); - clientstat( STAT_VIPZONE, EV_FLOAT, fInVIPZone ); + clientstat(STAT_BUYZONE, EV_FLOAT, fInBuyZone); + clientstat(STAT_HOSTAGEZONE, EV_FLOAT, fInHostageZone); + clientstat(STAT_BOMBZONE, EV_FLOAT, fInBombZone); + clientstat(STAT_ESCAPEZONE, EV_FLOAT, fInEscapeZone); + clientstat(STAT_VIPZONE, EV_FLOAT, fInVIPZone); - clientstat( 4, EV_FLOAT, armor ); - clientstat( STAT_MONEY, EV_FLOAT, fMoney ); - clientstat( STAT_SLOT_MELEE, EV_FLOAT, fSlotMelee ); - clientstat( STAT_SLOT_PRIMARY, EV_FLOAT, fSlotPrimary ); - clientstat( STAT_SLOT_SECONDARY, EV_FLOAT, fSlotSecondary ); - clientstat( STAT_SLOT_GRENADE, EV_FLOAT, fSlotGrenade ); - clientstat( STAT_SLOT_C4BOMB, EV_FLOAT, fSlotC4Bomb ); - clientstat( STAT_ITEM_FLASHBANG, EV_INTEGER, iAmmo_FLASHBANG ); - clientstat( STAT_ITEM_HEGRENADE, EV_INTEGER, iAmmo_HEGRENADE ); - clientstat( STAT_ITEM_SMOKEGRENADE, EV_INTEGER, iAmmo_SMOKEGRENADE ); - clientstat( STAT_EQUIPMENT, EV_INTEGER, iEquipment ); - clientstat( STAT_CURRENT_MAG, EV_INTEGER, iCurrentMag ); - clientstat( STAT_CURRENT_CALIBER, EV_INTEGER, iCurrentCaliber ); - clientstat( STAT_TEAM, EV_INTEGER, team ); - clientstat( STAT_PROGRESS, EV_FLOAT, fProgressBar ); - clientstat( STAT_FLAGS, EV_FLOAT, flags ); - pointerstat( STAT_GAMETIME, EV_FLOAT, &fGameTime ); - pointerstat( STAT_GAMESTATE, EV_FLOAT, &fGameState ); - pointerstat( STAT_WON_T, EV_INTEGER, &iWon_T ); - pointerstat( STAT_WON_CT, EV_INTEGER, &iWon_CT ); + clientstat(4, EV_FLOAT, armor); + clientstat(STAT_MONEY, EV_FLOAT, fMoney); + clientstat(STAT_SLOT_MELEE, EV_FLOAT, fSlotMelee); + clientstat(STAT_SLOT_PRIMARY, EV_FLOAT, fSlotPrimary); + clientstat(STAT_SLOT_SECONDARY, EV_FLOAT, fSlotSecondary); + clientstat(STAT_SLOT_GRENADE, EV_FLOAT, fSlotGrenade); + clientstat(STAT_SLOT_C4BOMB, EV_FLOAT, fSlotC4Bomb); + clientstat(STAT_ITEM_FLASHBANG, EV_INTEGER, iAmmo_FLASHBANG); + clientstat(STAT_ITEM_HEGRENADE, EV_INTEGER, iAmmo_HEGRENADE); + clientstat(STAT_ITEM_SMOKEGRENADE, EV_INTEGER, iAmmo_SMOKEGRENADE); + clientstat(STAT_EQUIPMENT, EV_INTEGER, iEquipment); + clientstat(STAT_CURRENT_MAG, EV_INTEGER, iCurrentMag); + clientstat(STAT_CURRENT_CALIBER, EV_INTEGER, iCurrentCaliber); + clientstat(STAT_TEAM, EV_INTEGER, team); + clientstat(STAT_PROGRESS, EV_FLOAT, fProgressBar); + clientstat(STAT_FLAGS, EV_FLOAT, flags); + pointerstat(STAT_GAMETIME, EV_FLOAT, &fGameTime); + pointerstat(STAT_GAMESTATE, EV_FLOAT, &fGameState); + pointerstat(STAT_WON_T, EV_INTEGER, &iWon_T); + pointerstat(STAT_WON_CT, EV_INTEGER, &iWon_CT); iBombRadius = 1024; localcmd(sprintf("serverinfo slots %d\n", cvar("sv_playerslots"))); diff --git a/Source/server/cstrike/money.c b/Source/server/cstrike/money.c old mode 100755 new mode 100644 index d5ca082c..e34a5a01 --- a/Source/server/cstrike/money.c +++ b/Source/server/cstrike/money.c @@ -16,17 +16,18 @@ Money_AddMoney Gives a player money and caps it ================= */ -void Money_AddMoney( entity ePlayer, int iMoneyValue ) { +void Money_AddMoney(entity ePlayer, int iMoneyValue) +{ - dprint( sprintf( "[DEBUG]: Giving %s %i in cash\n", ePlayer.netname, iMoneyValue ) ); + dprint(sprintf("[DEBUG]: Giving %s %i in cash\n", ePlayer.netname, iMoneyValue)); ePlayer.fMoney += (float)iMoneyValue; - if ( ePlayer.fMoney > autocvar_fcs_maxmoney ) { + if (ePlayer.fMoney > autocvar_fcs_maxmoney) { ePlayer.fMoney = autocvar_fcs_maxmoney; } // Because people do tend to kill hostages... - if ( ePlayer.fMoney < 0 ) { + if (ePlayer.fMoney < 0) { ePlayer.fMoney = 0; } } @@ -38,8 +39,9 @@ Money_QueTeamReward Rewards are adding up throughout the match... ================= */ -void Money_QueTeamReward( float fTeam, int iMoneyValue ) { - if ( fTeam == TEAM_T ) { +void Money_QueTeamReward(float fTeam, int iMoneyValue) +{ + if (fTeam == TEAM_T) { iMoneyReward_T += iMoneyValue; } else { iMoneyReward_CT += iMoneyValue; @@ -53,11 +55,12 @@ Money_GiveTeamReward ...and eventually given when this is called ================= */ -void Money_GiveTeamReward( void ) { - if ( self.team == TEAM_T ) { - Money_AddMoney( self, iMoneyReward_T ); +void Money_GiveTeamReward(void) +{ + if (self.team == TEAM_T) { + Money_AddMoney(self, iMoneyReward_T); } else { - Money_AddMoney( self, iMoneyReward_CT ); + Money_AddMoney(self, iMoneyReward_CT); } } @@ -66,7 +69,8 @@ void Money_GiveTeamReward( void ) { Money_ResetTeamReward ================= */ -void Money_ResetTeamReward( void ) { +void Money_ResetTeamReward(void) +{ iMoneyReward_T = 0; iMoneyReward_CT = 0; } diff --git a/Source/server/cstrike/player.c b/Source/server/cstrike/player.c old mode 100755 new mode 100644 index eb386462..d497e01d --- a/Source/server/cstrike/player.c +++ b/Source/server/cstrike/player.c @@ -19,29 +19,30 @@ string sPainSounds[5] = { Player_SendEntity ================= */ -float Player_SendEntity( entity ePEnt, float fChanged ) { - if ( self.health <= 0 && ePEnt != self ) { +float Player_SendEntity(entity ePEnt, float fChanged) +{ + if (self.health <= 0 && ePEnt != self) { return FALSE; } - WriteByte( MSG_ENTITY, ENT_PLAYER ); - WriteShort( MSG_ENTITY, self.modelindex ); - WriteCoord( MSG_ENTITY, self.origin_x ); - WriteCoord( MSG_ENTITY, self.origin_y ); - WriteCoord( MSG_ENTITY, self.origin_z ); - WriteCoord( MSG_ENTITY, self.v_angle_x ); - WriteCoord( MSG_ENTITY, self.angles_y ); - WriteCoord( MSG_ENTITY, self.angles_z ); - WriteCoord( MSG_ENTITY, self.velocity_x ); - WriteCoord( MSG_ENTITY, self.velocity_y ); - WriteCoord( MSG_ENTITY, self.velocity_z ); - WriteFloat( MSG_ENTITY, self.flags ); - WriteFloat( MSG_ENTITY, self.pmove_flags ); - WriteByte( MSG_ENTITY, self.weapon ); - WriteByte( MSG_ENTITY, self.health ); - WriteFloat( MSG_ENTITY, self.movetype ); - WriteFloat( MSG_ENTITY, self.view_ofs[2] ); - WriteFloat( MSG_ENTITY, self.viewzoom ); + WriteByte(MSG_ENTITY, ENT_PLAYER); + WriteShort(MSG_ENTITY, self.modelindex); + WriteCoord(MSG_ENTITY, self.origin_x); + WriteCoord(MSG_ENTITY, self.origin_y); + WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.v_angle_x); + WriteCoord(MSG_ENTITY, self.angles_y); + WriteCoord(MSG_ENTITY, self.angles_z); + WriteCoord(MSG_ENTITY, self.velocity_x); + WriteCoord(MSG_ENTITY, self.velocity_y); + WriteCoord(MSG_ENTITY, self.velocity_z); + WriteFloat(MSG_ENTITY, self.flags); + WriteFloat(MSG_ENTITY, self.pmove_flags); + WriteByte(MSG_ENTITY, self.weapon); + WriteByte(MSG_ENTITY, self.health); + WriteFloat(MSG_ENTITY, self.movetype); + WriteFloat(MSG_ENTITY, self.view_ofs[2]); + WriteFloat(MSG_ENTITY, self.viewzoom); return TRUE; } @@ -50,15 +51,16 @@ float Player_SendEntity( entity ePEnt, float fChanged ) { Player_Pain ================= */ -void Player_Pain( int iHitBody ) { +void Player_Pain(int iHitBody) +{ /* - if ( iHitBody == BODY_HEAD ) { - Animation_PlayerTopTemp( ANIM_HEAD_FLINCH, 0.25f ); + if (iHitBody == BODY_HEAD) { + Animation_PlayerTopTemp(ANIM_HEAD_FLINCH, 0.25f); } else { - Animation_PlayerTopTemp( ANIM_GUT_FLINCH, 0.25f ); + Animation_PlayerTopTemp(ANIM_GUT_FLINCH, 0.25f); }*/ - sound( self, CHAN_VOICE, sPainSounds[ floor( random() * 5 ) ], 1, ATTN_IDLE ); + sound(self, CHAN_VOICE, sPainSounds[ floor(random() * 5) ], 1, ATTN_IDLE); self.velocity = '0 0 0'; } @@ -67,41 +69,42 @@ void Player_Pain( int iHitBody ) { Player_Death ================= */ -void Player_Death( int iHitBody ) { - if ( iHitBody == BODY_HEAD ) { - sound( self, CHAN_VOICE, sprintf( "player/headshot%d.wav", floor( ( random() * 3 ) + 1 ) ), 1, ATTN_NORM ); +void Player_Death(int iHitBody) +{ + if (iHitBody == BODY_HEAD) { + sound(self, CHAN_VOICE, sprintf("player/headshot%d.wav", floor((random() * 3) + 1)), 1, ATTN_NORM); } else { - sound( self, CHAN_VOICE, sprintf( "player/die%d.wav", floor( ( random() * 3 ) + 1 ) ), 1, ATTN_NORM ); + sound(self, CHAN_VOICE, sprintf("player/die%d.wav", floor((random() * 3) + 1)), 1, ATTN_NORM); } // Drop a corpse entity eCorpse = spawn(); eCorpse.classname = "remove_me"; - setorigin( eCorpse, self.origin ); - setmodel( eCorpse, self.model ); - setsize( eCorpse, self.mins, self.maxs ); + setorigin(eCorpse, self.origin); + setmodel(eCorpse, self.model); + setsize(eCorpse, self.mins, self.maxs); eCorpse.angles = [ 0, self.angles_y, 0 ]; eCorpse.movetype = MOVETYPE_BOUNCE; // Drop primary weapon as well as the bomb if present - if ( self.fSlotPrimary ) { - Weapon_DropWeapon( SLOT_PRIMARY ); + if (self.fSlotPrimary) { + Weapon_DropWeapon(SLOT_PRIMARY); } else { - if ( self.fSlotSecondary ) { - Weapon_DropWeapon( SLOT_SECONDARY ); + if (self.fSlotSecondary) { + Weapon_DropWeapon(SLOT_SECONDARY); } } - if ( self.fSlotGrenade ) { - Weapon_DropWeapon( SLOT_GRENADE ); + if (self.fSlotGrenade) { + Weapon_DropWeapon(SLOT_GRENADE); } // Make ourselves disappear self.modelindex = 0; - if ( self.flags & FL_CROUCHING ) { + if (self.flags & FL_CROUCHING) { eCorpse.frame = ANIM_CROUCH_DIE; } else { - switch ( iHitBody ) { + switch (iHitBody) { case BODY_HEAD: eCorpse.frame = ANIM_DIE_HEAD; break; @@ -117,7 +120,7 @@ void Player_Death( int iHitBody ) { eCorpse.frame = ANIM_DIE_RIGHT; break; default: - eCorpse.frame = ANIM_DEATH1 + floor( random() * 3 ); + eCorpse.frame = ANIM_DEATH1 + floor(random() * 3); break; } } @@ -125,13 +128,13 @@ void Player_Death( int iHitBody ) { Spawn_MakeSpectator(); self.classname = "player"; self.health = 0; - forceinfokey( self, "*dead", "1" ); - forceinfokey( self, "*team", ftos( self.team ) ); + forceinfokey(self, "*dead", "1"); + forceinfokey(self, "*team", ftos(self.team)); Rules_CountPlayers(); - if ( self.team == TEAM_VIP ) { - Rules_RoundOver( TEAM_T, 2500, FALSE ); + if (self.team == TEAM_VIP) { + Rules_RoundOver(TEAM_T, 2500, FALSE); return; } @@ -140,10 +143,10 @@ void Player_Death( int iHitBody ) { /* ==================== -Player_UseDown +UseWorkaround ==================== */ -void UseWorkaround( entity eTarget ) +void UseWorkaround(entity eTarget) { eActivator = self; entity eOldSelf = self; @@ -151,10 +154,17 @@ void UseWorkaround( entity eTarget ) self.PlayerUse(); self = eOldSelf; } -void Player_UseDown( void ) { - if ( self.health <= 0 ) { + +/* +==================== +Player_UseDown +==================== +*/ +void Player_UseDown(void) +{ + if (self.health <= 0) { return; - } else if ( !( self.flags & FL_USERELEASED ) ) { + } else if (!(self.flags & FL_USERELEASED)) { return; } @@ -162,18 +172,18 @@ void Player_UseDown( void ) { makevectors(self.v_angle); vSource = self.origin + self.view_ofs; - traceline ( vSource, vSource + ( v_forward * 64 ), FALSE, self); + traceline (vSource, vSource + (v_forward * 64), FALSE, self); if (trace_ent.PlayerUse) { - if ( ( trace_ent.classname != "c4bomb" ) && ( trace_ent.classname != "func_pushable" ) ) { - self.flags = ( self.flags - FL_USERELEASED ); - sound( self, CHAN_ITEM, "common/wpn_select.wav", 0.25, ATTN_IDLE ); + if ((trace_ent.classname != "c4bomb") && (trace_ent.classname != "func_pushable")) { + self.flags = (self.flags - FL_USERELEASED); + sound(self, CHAN_ITEM, "common/wpn_select.wav", 0.25, ATTN_IDLE); } UseWorkaround(trace_ent); } else { - sound( self, CHAN_ITEM, "common/wpn_denyselect.wav", 0.25, ATTN_IDLE ); - self.flags = ( self.flags - FL_USERELEASED ); + sound(self, CHAN_ITEM, "common/wpn_denyselect.wav", 0.25, ATTN_IDLE); + self.flags = (self.flags - FL_USERELEASED); } } @@ -182,8 +192,9 @@ void Player_UseDown( void ) { Player_UseUp ==================== */ -void Player_UseUp( void ) { - if ( !( self.frags & FL_USERELEASED ) ) { +void Player_UseUp(void) +{ + if (!(self.frags & FL_USERELEASED)) { self.flags = self.flags | FL_USERELEASED; self.fProgressBar = 0; } @@ -196,7 +207,8 @@ PlayerPreThink Run before physics ================= */ -void Game_PlayerPreThink( void ) { +void Game_PlayerPreThink(void) +{ BaseGun_ShotMultiplierUpdate(); } @@ -207,7 +219,8 @@ PlayerPreThink Run after physics ================= */ -void Game_PlayerPostThink( void ) { +void Game_PlayerPostThink(void) +{ Animation_PlayerUpdate(); Footsteps_Update(); diff --git a/Source/server/cstrike/spawn.c b/Source/server/cstrike/spawn.c old mode 100755 new mode 100644 index e8298529..46482225 --- a/Source/server/cstrike/spawn.c +++ b/Source/server/cstrike/spawn.c @@ -16,23 +16,24 @@ Spawn_FindSpawnPoint Recursive function that gets the next spawnpoint ================= */ -entity Spawn_FindSpawnPoint( float fTeam ) { +entity Spawn_FindSpawnPoint(float fTeam) +{ entity eSpot, eLastSpawn; entity eThing; int iCount; string sClassname; - if ( fTeam == TEAM_T ) { + if (fTeam == TEAM_T) { sClassname = "info_player_deathmatch"; eSpot = eLastSpawn = eLastTSpawn; - } else if ( fTeam == TEAM_CT ) { + } else if (fTeam == TEAM_CT) { sClassname = "info_player_start"; eSpot = eLastSpawn = eLastCTSpawn; - } else if ( fTeam == TEAM_VIP ) { - return find( world, classname, "info_vip_start" ); + } else if (fTeam == TEAM_VIP) { + return find(world, classname, "info_vip_start"); } - while ( 1 ) { + while (1) { eSpot = find(eSpot, classname, sClassname); if (eSpot == eLastSpawn) @@ -67,33 +68,34 @@ Spawn_ObserverCam Look for the next spawnpoint ================= */ -void Spawn_ObserverCam( void ) { +void Spawn_ObserverCam(void) +{ entity eTarget; // Go find a camera if we aren't dead - entity eCamera = find ( world, classname, "trigger_camera" ); + entity eCamera = find (world, classname, "trigger_camera"); - if ( eCamera ) { + if (eCamera) { self.origin = eCamera.origin; - if ( eCamera.target ) { - eTarget = find( world, targetname, eCamera.target ); - if ( eTarget ) { - self.angles = vectoangles( eTarget.origin - eCamera.origin ); + if (eCamera.target) { + eTarget = find(world, targetname, eCamera.target); + if (eTarget) { + self.angles = vectoangles(eTarget.origin - eCamera.origin); self.angles_x *= -1; } } } else { // Can't find a camera? Just do this lazy thing, CS seems to do the same - eCamera = find ( world, classname, "info_player_start" ); + eCamera = find (world, classname, "info_player_start"); - if ( eCamera ) { + if (eCamera) { self.origin = eCamera.origin; - if ( eCamera.target ) { - eTarget = find( world, targetname, eCamera.target ); - if ( eTarget ) { - self.angles = vectoangles( eTarget.origin - eCamera.origin ); + if (eCamera.target) { + eTarget = find(world, targetname, eCamera.target); + if (eTarget) { + self.angles = vectoangles(eTarget.origin - eCamera.origin); self.angles_x *= -1; } } @@ -110,14 +112,15 @@ Spawn_RespawnClient Called whenever a player just needs his basic properties to be reset ================= */ -void Spawn_RespawnClient( float fTeam ) { +void Spawn_RespawnClient(float fTeam) +{ entity eSpawn; - forceinfokey( self, "*spec", "0" ); - eSpawn = Spawn_FindSpawnPoint( self.team ); + forceinfokey(self, "*spec", "0"); + eSpawn = Spawn_FindSpawnPoint(self.team); self.classname = "player"; self.health = self.max_health = 100; - forceinfokey( self, "*dead", "0" ); + forceinfokey(self, "*dead", "0"); Rules_CountPlayers(); self.takedamage = DAMAGE_YES; @@ -135,12 +138,12 @@ void Spawn_RespawnClient( float fTeam ) { self.fixangle = TRUE; // Get the player-model from Defs.h's list - if ( self.team != TEAM_VIP ) { - setmodel( self, sCSPlayers[ self.fCharModel ] ); + if (self.team != TEAM_VIP) { + setmodel(self, sCSPlayers[ self.fCharModel ]); } else { - setmodel( self, "models/player/vip/vip.mdl" ); + setmodel(self, "models/player/vip/vip.mdl"); } - setsize( self, VEC_HULL_MIN, VEC_HULL_MAX ); + setsize(self, VEC_HULL_MIN, VEC_HULL_MAX); self.view_ofs = VEC_PLAYER_VIEWPOS; self.velocity = '0 0 0'; @@ -159,43 +162,44 @@ Spawn_CreateClient Called whenever a player becomes a completely new type of player ================= */ -void Spawn_CreateClient( float fCharModel ) { +void Spawn_CreateClient(float fCharModel) +{ // What team are we on - 0= Spectator, < 5 Terrorists, CT rest - if( fCharModel == 0 ) { + if(fCharModel == 0) { PutClientInServer(); Spawn_ObserverCam(); return; - } else if( fCharModel < 5 ) { - forceinfokey( self, "*team", "0" ); + } else if(fCharModel < 5) { + forceinfokey(self, "*team", "0"); self.team = TEAM_T; - Weapon_AddItem( WEAPON_KNIFE ); - if ( autocvar_fcs_knifeonly == FALSE ) { - Weapon_AddItem( WEAPON_GLOCK18 ); - Weapon_GiveAmmo( WEAPON_GLOCK18, 40 ); - Weapon_Draw( WEAPON_GLOCK18 ); + Weapon_AddItem(WEAPON_KNIFE); + if (autocvar_fcs_knifeonly == FALSE) { + Weapon_AddItem(WEAPON_GLOCK18); + Weapon_GiveAmmo(WEAPON_GLOCK18, 40); + Weapon_Draw(WEAPON_GLOCK18); } else { - Weapon_Draw( WEAPON_KNIFE ); + Weapon_Draw(WEAPON_KNIFE); } } else { self.team = TEAM_CT; - Weapon_AddItem( WEAPON_KNIFE ); - if ( autocvar_fcs_knifeonly == FALSE ) { - Weapon_AddItem( WEAPON_USP45 ); - Weapon_GiveAmmo( WEAPON_USP45, 24 ); - Weapon_Draw( WEAPON_USP45 ); + Weapon_AddItem(WEAPON_KNIFE); + if (autocvar_fcs_knifeonly == FALSE) { + Weapon_AddItem(WEAPON_USP45); + Weapon_GiveAmmo(WEAPON_USP45, 24); + Weapon_Draw(WEAPON_USP45); } else { - Weapon_Draw( WEAPON_KNIFE ); + Weapon_Draw(WEAPON_KNIFE); } } - if( self.iInGame == FALSE ) { + if(self.iInGame == FALSE) { self.iInGame = TRUE; } - forceinfokey( self, "*team", ftos( self.team ) ); - Spawn_RespawnClient( self.team ); + forceinfokey(self, "*team", ftos(self.team)); + Spawn_RespawnClient(self.team); self.fAttackFinished = time + 1; } @@ -206,7 +210,8 @@ Spawn_MakeSpectator Called on connect and whenever a player dies ================= */ -void Spawn_MakeSpectator( void ) { +void Spawn_MakeSpectator(void) +{ self.classname = "spectator"; self.health = 0; @@ -222,7 +227,7 @@ void Spawn_MakeSpectator( void ) { setsize (self, '-16 -16 -16', '16 16 16'); self.view_ofs = self.velocity = '0 0 0'; - forceinfokey( self, "*spec", "2" ); // Make sure we are known as a spectator + forceinfokey(self, "*spec", "2"); // Make sure we are known as a spectator Ammo_Clear(); @@ -237,16 +242,16 @@ CSEv_GamePlayerSpawn_f Event Handling, called by the Client codebase via 'sendevent' ================= */ -void CSEv_GamePlayerSpawn_f( float fChar ) { - - if ( self.team == TEAM_VIP ) { - centerprint( self, "You are the VIP!\nYou cannot switch roles now.\n" ); +void CSEv_GamePlayerSpawn_f(float fChar) +{ + if (self.team == TEAM_VIP) { + centerprint(self, "You are the VIP!\nYou cannot switch roles now.\n"); self.fAttackFinished = time + 1.0; return; } // Hey, we are alive and are trying to switch teams, so subtract us from the Alive_Team counter. - if ( self.health > 0 ) { + if (self.health > 0) { self.health = 0; Rules_CountPlayers(); Rules_DeathCheck(); @@ -256,27 +261,27 @@ void CSEv_GamePlayerSpawn_f( float fChar ) { Ammo_Clear(); // Spawn the players immediately when its in the freeze state - switch ( fGameState ) { + switch (fGameState) { case GAME_FREEZE: self.fCharModel = fChar; - Spawn_CreateClient( fChar ); + Spawn_CreateClient(fChar); - if ( ( self.team == TEAM_T ) && ( iAlivePlayers_T == 1 ) ) { - if ( iBombZones > 0 ) { + if ((self.team == TEAM_T) && (iAlivePlayers_T == 1)) { + if (iBombZones > 0) { Rules_MakeBomber(); } - } else if ( ( self.team == TEAM_CT ) && ( iAlivePlayers_CT == 1 ) ) { - if ( iVIPZones > 0 ) { + } else if ((self.team == TEAM_CT) && (iAlivePlayers_CT == 1)) { + if (iVIPZones > 0) { Rules_MakeVIP(); } } break; default: - if ( fChar == 0 ) { + if (fChar == 0) { PutClientInServer(); return; - } else if( fChar < 5 ) { + } else if(fChar < 5) { self.team = TEAM_T; } else { self.team = TEAM_CT; @@ -286,20 +291,20 @@ void CSEv_GamePlayerSpawn_f( float fChar ) { self.classname = "player"; self.fCharModel = fChar; self.health = 0; - forceinfokey( self, "*dead", "1" ); - forceinfokey( self, "*team", ftos( self.team ) ); + forceinfokey(self, "*dead", "1"); + forceinfokey(self, "*team", ftos(self.team)); break; } self.frags = 0; self.fDeaths = 0; - forceinfokey( self, "*deaths", "0" ); + forceinfokey(self, "*deaths", "0"); // Split up for readability and expandability? - if ( ( self.team == TEAM_T ) && ( iAlivePlayers_T == 0 ) ) { - Rules_RoundOver( FALSE, 0, FALSE ); - } else if ( ( self.team == TEAM_CT ) && ( iAlivePlayers_CT == 0 ) ) { - Rules_RoundOver( FALSE, 0, FALSE ); + if ((self.team == TEAM_T) && (iAlivePlayers_T == 0)) { + Rules_RoundOver(FALSE, 0, FALSE); + } else if ((self.team == TEAM_CT) && (iAlivePlayers_CT == 0)) { + Rules_RoundOver(FALSE, 0, FALSE); } } @@ -310,8 +315,9 @@ info_player_start Counter-Terrorist Spawnpoints ================= */ -void info_player_start( void ) { - if ( autocvar_fcs_swapteams == TRUE ) { +void info_player_start(void) +{ + if (autocvar_fcs_swapteams == TRUE) { self.classname = "info_player_deathmatch"; } } @@ -323,8 +329,9 @@ info_player_deathmatch Terrorist Spawnpoints ================= */ -void info_player_deathmatch( void ) { - if ( autocvar_fcs_swapteams == TRUE ) { +void info_player_deathmatch(void) +{ + if (autocvar_fcs_swapteams == TRUE) { self.classname = "info_player_start"; } } @@ -349,5 +356,6 @@ void info_player_terrorist(void) info_vip_start ================= */ -void info_vip_start( void ) { +void info_vip_start(void) +{ } diff --git a/Source/server/cstrike/timer.c b/Source/server/cstrike/timer.c old mode 100755 new mode 100644 index ca8a2d3b..a78054ec --- a/Source/server/cstrike/timer.c +++ b/Source/server/cstrike/timer.c @@ -13,7 +13,8 @@ Timer_Begin Initiates a new state timer ================= */ -void Timer_Begin(float fTime, float fMode) { +void Timer_Begin(float fTime, float fMode) +{ if (fMode == GAME_FREEZE) { fGameState = GAME_FREEZE; } else if (fMode == GAME_ACTIVE) { @@ -36,7 +37,8 @@ Timer_Update Called once every frame to check the status of things ================= */ -void Timer_Update(void) { +void Timer_Update(void) +{ static float fVoxTimer; if ( cvar( "sv_playerslots" ) == 1 ) { diff --git a/Source/server/entry.c b/Source/server/entry.c index a390450b..1e9de382 100644 --- a/Source/server/entry.c +++ b/Source/server/entry.c @@ -188,6 +188,7 @@ void worldspawn(void) lightstyle( 11, "abcdefghijklmnopqrrqponmlkjihgfedcba" ); Game_Worldspawn(); + Decals_Init(); } float ConsoleCmd(string cmd) diff --git a/Source/server/traceattack.c b/Source/server/traceattack.c old mode 100755 new mode 100644 index 59c16ec5..a1219fcb --- a/Source/server/traceattack.c +++ b/Source/server/traceattack.c @@ -15,117 +15,118 @@ TraceAttack_FireSingle Fires a single shot that can penetrate some materials ================= */ -void TraceAttack_FireSingle( vector vPos, vector vAngle ) { - static void TraceAttack_Penetrate( vector vPos, vector vAngle ) { - if ( iTotalPenetrations > 0 ) { +void TraceAttack_FireSingle(vector vPos, vector vAngle) +{ + static void TraceAttack_Penetrate(vector vPos, vector vAngle ) { + if (iTotalPenetrations > 0) { return; } - - TraceAttack_FireSingle( vPos, vAngle ); + + TraceAttack_FireSingle(vPos, vAngle); iTotalPenetrations = 1; } #ifdef CSTRIKE - traceline( vPos, vPos + ( vAngle * wptTable[ self.weapon ].fRange ), MOVE_HITMODEL, self); + traceline(vPos, vPos + (vAngle * wptTable[self.weapon].fRange), MOVE_HITMODEL, self); #else - traceline( vPos, vPos + ( vAngle * 8196 ), MOVE_HITMODEL, self); + traceline(vPos, vPos + (vAngle * 8196), MOVE_HITMODEL, self); #endif if (trace_fraction != 1.0) { - if ( trace_ent.takedamage == DAMAGE_YES ) { + if (trace_ent.takedamage == DAMAGE_YES) { #ifdef CSTRIKE - Damage_Apply( trace_ent, self, wptTable[ self.weapon ].iDamage, trace_endpos, FALSE ); + Damage_Apply(trace_ent, self, wptTable[self.weapon].iDamage, trace_endpos, FALSE); #endif } - - if ( trace_ent.iBleeds == TRUE ) { - Effect_Impact( IMPACT_FLESH, trace_endpos, trace_plane_normal ); + + if (trace_ent.iBleeds == TRUE) { + Effect_Impact(IMPACT_FLESH, trace_endpos, trace_plane_normal); } else { - string sTexture = getsurfacetexture( trace_ent, getsurfacenearpoint( trace_ent, trace_endpos ) ); - - switch( (float)hash_get( hashMaterials, sTexture ) ) { + string sTexture = getsurfacetexture(trace_ent, getsurfacenearpoint(trace_ent, trace_endpos)); + + switch((float)hash_get(hashMaterials, sTexture)) { case 'G': case 'V': - Effect_Impact( IMPACT_METAL, trace_endpos, trace_plane_normal ); + Effect_Impact(IMPACT_METAL, trace_endpos, trace_plane_normal); break; case 'M': case 'P': - Effect_Impact( IMPACT_METAL, trace_endpos, trace_plane_normal ); + Effect_Impact(IMPACT_METAL, trace_endpos, trace_plane_normal); break; case 'D': case 'W': - Effect_Impact( IMPACT_WOOD, trace_endpos, trace_plane_normal ); + Effect_Impact(IMPACT_WOOD, trace_endpos, trace_plane_normal); break; case 'Y': - Effect_Impact( IMPACT_GLASS, trace_endpos, trace_plane_normal ); + Effect_Impact(IMPACT_GLASS, trace_endpos, trace_plane_normal); break; case 'N': - Effect_Impact( IMPACT_DEFAULT, trace_endpos, trace_plane_normal ); + Effect_Impact(IMPACT_DEFAULT, trace_endpos, trace_plane_normal); break; case 'T': default: - Effect_Impact( IMPACT_DEFAULT, trace_endpos, trace_plane_normal ); + Effect_Impact(IMPACT_DEFAULT, trace_endpos, trace_plane_normal); break; } - - //TraceAttack_Penetrate( trace_endpos + ( v_forward * 2 ), vAngle ); + + //TraceAttack_Penetrate(trace_endpos + (v_forward * 2), vAngle); } } } -void TraceAttack_FireSingleLagged( vector vPos, vector vAngle ) { - static void TraceAttack_Penetrate( vector vPos, vector vAngle ) { - if ( iTotalPenetrations > 0 ) { +void TraceAttack_FireSingleLagged(vector vPos, vector vAngle) { + static void TraceAttack_Penetrate(vector vPos, vector vAngle ) { + if (iTotalPenetrations > 0) { return; } - TraceAttack_FireSingle( vPos, vAngle ); + TraceAttack_FireSingle(vPos, vAngle); iTotalPenetrations = 1; } #ifdef CSTRIKE - traceline( vPos, vPos + ( vAngle * wptTable[ self.weapon ].fRange ), MOVE_LAGGED | MOVE_HITMODEL, self); + traceline(vPos, vPos + (vAngle * wptTable[self.weapon].fRange), MOVE_LAGGED | MOVE_HITMODEL, self); #else - traceline( vPos, vPos + ( vAngle * 8196 ), MOVE_LAGGED | MOVE_HITMODEL, self); + traceline(vPos, vPos + (vAngle * 8196), MOVE_LAGGED | MOVE_HITMODEL, self); #endif if (trace_fraction != 1.0) { - if ( trace_ent.takedamage == DAMAGE_YES ) { + if (trace_ent.takedamage == DAMAGE_YES) { #ifdef CSTRIKE - Damage_Apply( trace_ent, self, wptTable[ self.weapon ].iDamage, trace_endpos, FALSE ); + Damage_Apply(trace_ent, self, wptTable[self.weapon].iDamage, trace_endpos, FALSE); #endif } - if ( trace_ent.iBleeds == TRUE ) { - Effect_Impact( IMPACT_FLESH, trace_endpos, trace_plane_normal ); + if (trace_ent.iBleeds == TRUE) { + Effect_Impact(IMPACT_FLESH, trace_endpos, trace_plane_normal); } else { - string sTexture = getsurfacetexture( trace_ent, getsurfacenearpoint( trace_ent, trace_endpos ) ); + string sTexture = getsurfacetexture(trace_ent, getsurfacenearpoint(trace_ent, trace_endpos)); - switch( (float)hash_get( hashMaterials, sTexture ) ) { + switch ((float)hash_get(hashMaterials, sTexture)) { case 'G': case 'V': - Effect_Impact( IMPACT_METAL, trace_endpos, trace_plane_normal ); - TraceAttack_Penetrate( trace_endpos + ( v_forward * 2 ), vAngle ); + Effect_Impact(IMPACT_METAL, trace_endpos, trace_plane_normal); + TraceAttack_Penetrate(trace_endpos + (v_forward * 2), vAngle); break; case 'M': case 'P': - Effect_Impact( IMPACT_METAL, trace_endpos, trace_plane_normal ); + Effect_Impact(IMPACT_METAL, trace_endpos, trace_plane_normal); break; case 'D': case 'W': - Effect_Impact( IMPACT_WOOD, trace_endpos, trace_plane_normal ); - TraceAttack_Penetrate( trace_endpos + ( v_forward * 2 ), vAngle ); + Effect_Impact(IMPACT_WOOD, trace_endpos, trace_plane_normal); + TraceAttack_Penetrate(trace_endpos + (v_forward * 2), vAngle); break; case 'Y': - Effect_Impact( IMPACT_GLASS, trace_endpos, trace_plane_normal ); + Effect_Impact(IMPACT_GLASS, trace_endpos, trace_plane_normal); break; case 'N': - Effect_Impact( IMPACT_DEFAULT, trace_endpos, trace_plane_normal ); - TraceAttack_Penetrate( trace_endpos + ( v_forward * 2 ), vAngle ); + Effect_Impact(IMPACT_DEFAULT, trace_endpos, trace_plane_normal); + TraceAttack_Penetrate(trace_endpos + (v_forward * 2), vAngle); break; case 'T': default: - Effect_Impact( IMPACT_DEFAULT, trace_endpos, trace_plane_normal ); + Effect_Impact(IMPACT_DEFAULT, trace_endpos, trace_plane_normal); break; } } @@ -139,19 +140,20 @@ TraceAttack_FireBullets Fire a given amount of shots ================= */ -void TraceAttack_FireBullets( int iShots, vector vPos ) { +void TraceAttack_FireBullets(int iShots, vector vPos) +{ vector vDir; makevectors(self.v_angle); - while ( iShots > 0 ) { + while (iShots > 0) { iTotalPenetrations = 0; #ifdef CSTRIKE - vDir = aim( self, 100000 ) + Math_CRandom()*self.fAccuracy*v_right + Math_CRandom()*self.fAccuracy*v_up; + vDir = aim(self, 100000) + Math_CRandom()*self.fAccuracy*v_right + Math_CRandom()*self.fAccuracy*v_up; #else - vDir = aim( self, 100000 ); + vDir = aim(self, 100000); #endif - TraceAttack_FireSingle( vPos, vDir ); - TraceAttack_FireSingleLagged( vPos, vDir ); + TraceAttack_FireSingle(vPos, vDir); + TraceAttack_FireSingleLagged(vPos, vDir); iShots--; } } diff --git a/Source/server/valve.src b/Source/server/valve.src index 5996ca8c..6167de5f 100755 --- a/Source/server/valve.src +++ b/Source/server/valve.src @@ -17,6 +17,7 @@ defs.h ../gs-entbase/server.src valve/monster_rat.cpp +../shared/decals.c ../shared/effects.c ../shared/spraylogo.cpp diff --git a/Source/server/valve/client.c b/Source/server/valve/client.c index 2e1989c9..51b6d15b 100644 --- a/Source/server/valve/client.c +++ b/Source/server/valve/client.c @@ -78,7 +78,7 @@ void Game_PutClientInServer(void) pl.classname = "player"; pl.health = self.max_health = 100; - //forceinfokey( self, "*dead", "0" ); + //forceinfokey(self, "*dead", "0"); pl.takedamage = DAMAGE_YES; pl.solid = SOLID_SLIDEBOX; pl.movetype = MOVETYPE_WALK; @@ -93,9 +93,9 @@ void Game_PutClientInServer(void) pl.customphysics = Empty; pl.vPain = Player_Pain; pl.vDeath = Player_Death; - forceinfokey(pl, "*spec", "0" ); + forceinfokey(pl, "*spec", "0"); - if ( cvar( "sv_playerslots" ) == 1 ) { + if (cvar("sv_playerslots") == 1) { Game_DecodeChangeParms(); if (startspot) { setorigin(pl, Landmark_GetSpot()); @@ -119,41 +119,41 @@ void Game_PutClientInServer(void) void SV_SendChat(entity eSender, string sMessage, entity eEnt, float fType) { - WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET ); - WriteByte( MSG_MULTICAST, fType == 0 ? EV_CHAT:EV_CHAT_TEAM ); - WriteByte( MSG_MULTICAST, num_for_edict( eSender ) - 1 ); - WriteByte( MSG_MULTICAST, eSender.team ); - WriteString( MSG_MULTICAST, sMessage ); + WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); + WriteByte(MSG_MULTICAST, fType == 0 ? EV_CHAT:EV_CHAT_TEAM); + WriteByte(MSG_MULTICAST, num_for_edict(eSender) - 1); + WriteByte(MSG_MULTICAST, eSender.team); + WriteString(MSG_MULTICAST, sMessage); if (eEnt) { msg_entity = eEnt; - multicast( [0,0,0], MULTICAST_ONE ); + multicast([0,0,0], MULTICAST_ONE); } else { - multicast( [0,0,0], MULTICAST_ALL ); + multicast([0,0,0], MULTICAST_ALL); } } void Game_ParseClientCommand(string cmd) { - tokenize( cmd ); + tokenize(cmd); - /*if ( argv( 1 ) == "timeleft" ) { - float fTimeLeft = cvar( "mp_timelimit" ) - ( time / 60 ); - Vox_Singlecast( self, sprintf( "we have %s minutes remaining", Vox_TimeToString( fTimeLeft ) ) ); + /*if (argv(1) == "timeleft") { + float fTimeLeft = cvar("mp_timelimit") - (time / 60); + Vox_Singlecast(self, sprintf("we have %s minutes remaining", Vox_TimeToString(fTimeLeft))); return; }*/ - string chat = substring( cmd, 4, strlen( cmd ) - 4 ); + string chat = substring(cmd, 4, strlen(cmd) - 4); // Players talk to players, spectators to spectators. - if ( argv( 0 ) == "say" ) { - localcmd( sprintf( "echo %s: %s\n", self.netname, chat ) ); - SV_SendChat( self, chat, world, 0 ); + if (argv(0) == "say") { + localcmd(sprintf("echo %s: %s\n", self.netname, chat)); + SV_SendChat(self, chat, world, 0); return; - } else if ( argv( 0 ) == "say_team" ) { - localcmd( sprintf( "echo [TEAM %d] %s: %s\n", self.team, self.netname, chat ) ); - for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) { - if ( eFind.team == self.team ) { - SV_SendChat( self, chat, eFind, 1 ); + } else if (argv(0) == "say_team") { + localcmd(sprintf("echo [TEAM %d] %s: %s\n", self.team, self.netname, chat)); + for (entity eFind = world; (eFind = find(eFind, classname, "player"));) { + if (eFind.team == self.team) { + SV_SendChat(self, chat, eFind, 1); } } return; diff --git a/Source/server/valve/damage.c b/Source/server/valve/damage.c old mode 100755 new mode 100644 index 5f2bfa24..f7a2c37a --- a/Source/server/valve/damage.c +++ b/Source/server/valve/damage.c @@ -13,16 +13,17 @@ Damage_CastOrbituary Sends a message to the clients to display a death message ================= */ -void Damage_CastOrbituary( entity eAttacker, entity eTarget, float fWeapon) { - WriteByte( MSG_BROADCAST, SVC_CGAMEPACKET ); - WriteByte( MSG_BROADCAST, EV_ORBITUARY ); - WriteByte( MSG_BROADCAST, num_for_edict( eAttacker ) - 1 ); - WriteByte( MSG_BROADCAST, eAttacker.team ); - WriteByte( MSG_BROADCAST, num_for_edict( eTarget ) - 1 ); - WriteByte( MSG_BROADCAST, eTarget.team ); - WriteByte( MSG_BROADCAST, fWeapon ); +void Damage_CastOrbituary(entity eAttacker, entity eTarget, float fWeapon) +{ + WriteByte(MSG_BROADCAST, SVC_CGAMEPACKET); + WriteByte(MSG_BROADCAST, EV_ORBITUARY); + WriteByte(MSG_BROADCAST, num_for_edict(eAttacker) - 1); + WriteByte(MSG_BROADCAST, eAttacker.team); + WriteByte(MSG_BROADCAST, num_for_edict(eTarget) - 1); + WriteByte(MSG_BROADCAST, eTarget.team); + WriteByte(MSG_BROADCAST, fWeapon); msg_entity = self; - multicast( [0,0,0], MULTICAST_ALL ); + multicast([0,0,0], MULTICAST_ALL); } /* @@ -35,7 +36,7 @@ Generic function that applies damage, pain and suffering void Damage_Apply(entity eTarget, entity eAttacker, float fDamage, vector vHitPos, int a) { // Apply the damage finally - if ( eTarget.armor ) { + if (eTarget.armor) { float flArmor; float flNewDamage; @@ -61,12 +62,12 @@ void Damage_Apply(entity eTarget, entity eAttacker, float fDamage, vector vHitPo if (eTarget.health <= 0) { if (eTarget.flags & FL_CLIENT) { //eTarget.fDeaths++; - //forceinfokey( eTarget, "*deaths", ftos( eTarget.fDeaths ) ); + //forceinfokey(eTarget, "*deaths", ftos(eTarget.fDeaths)); } if ((eTarget.flags & FL_CLIENT) && (eAttacker.flags & FL_CLIENT)) { eAttacker.frags++; - Damage_CastOrbituary(eAttacker, eTarget, eAttacker.weapon ); + Damage_CastOrbituary(eAttacker, eTarget, eAttacker.weapon); } } @@ -91,37 +92,38 @@ This verifies that the entity is actually able to receive some damage, from a plain geographical standpoint ================= */ -float Damage_CheckAttack( entity eTarget, vector vAttackPos ) { - if ( eTarget.movetype == MOVETYPE_PUSH ) { - traceline( vAttackPos, 0.5 * ( eTarget.absmin + eTarget.absmax ), TRUE, self ); +float Damage_CheckAttack(entity eTarget, vector vAttackPos) +{ + if (eTarget.movetype == MOVETYPE_PUSH) { + traceline(vAttackPos, 0.5 * (eTarget.absmin + eTarget.absmax), TRUE, self); - if ( trace_fraction == 1 ) { + if (trace_fraction == 1) { return TRUE; } - if ( trace_ent == eTarget ) { + if (trace_ent == eTarget) { return TRUE; } return FALSE; } - traceline( vAttackPos, eTarget.origin, TRUE, self ); - if ( trace_fraction == 1 ) { + traceline(vAttackPos, eTarget.origin, TRUE, self); + if (trace_fraction == 1) { return TRUE; } - traceline( vAttackPos, eTarget.origin + '15 15 0', TRUE, self ); - if ( trace_fraction == 1 ) { + traceline(vAttackPos, eTarget.origin + '15 15 0', TRUE, self); + if (trace_fraction == 1) { return TRUE; } - traceline( vAttackPos, eTarget.origin + '-15 -15 0', TRUE, self ); - if ( trace_fraction == 1 ) { + traceline(vAttackPos, eTarget.origin + '-15 -15 0', TRUE, self); + if (trace_fraction == 1) { return TRUE; } - traceline( vAttackPos, eTarget.origin + '-15 15 0', TRUE, self ); - if ( trace_fraction == 1 ) { + traceline(vAttackPos, eTarget.origin + '-15 15 0', TRUE, self); + if (trace_fraction == 1) { return TRUE; } - traceline( vAttackPos, eTarget.origin + '15 -15 0', TRUE, self ); - if ( trace_fraction == 1 ) { + traceline(vAttackPos, eTarget.origin + '15 -15 0', TRUE, self); + if (trace_fraction == 1) { return TRUE; } @@ -135,32 +137,33 @@ Damage_Radius Even more pain and suffering, mostly used for explosives ================= */ -void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadius, int iCheckClip ) { - for ( entity eDChain = world; ( eDChain = findfloat( eDChain, takedamage, DAMAGE_YES ) ); ) { +void Damage_Radius(vector vOrigin, entity eAttacker, float fDamage, float fRadius, int iCheckClip) +{ + for (entity eDChain = world; (eDChain = findfloat(eDChain, takedamage, DAMAGE_YES));) { vector vecRealPos; - vecRealPos[0] = eDChain.absmin[0] + ( 0.5 * ( eDChain.absmax[0] - eDChain.absmin[0] ) ); - vecRealPos[1] = eDChain.absmin[1] + ( 0.5 * ( eDChain.absmax[1] - eDChain.absmin[1] ) ); - vecRealPos[2] = eDChain.absmin[2] + ( 0.5 * ( eDChain.absmax[2] - eDChain.absmin[2] ) ); + vecRealPos[0] = eDChain.absmin[0] + (0.5 * (eDChain.absmax[0] - eDChain.absmin[0])); + vecRealPos[1] = eDChain.absmin[1] + (0.5 * (eDChain.absmax[1] - eDChain.absmin[1])); + vecRealPos[2] = eDChain.absmin[2] + (0.5 * (eDChain.absmax[2] - eDChain.absmin[2])); - float fDist = vlen( vOrigin - vecRealPos ); + float fDist = vlen(vOrigin - vecRealPos); //vector vPush; - if ( fDist > fRadius ) { + if (fDist > fRadius) { continue; } - if ( Damage_CheckAttack( eDChain, vOrigin ) || iCheckClip == FALSE ) { - float fDiff = vlen( vOrigin - vecRealPos ); + if (Damage_CheckAttack(eDChain, vOrigin) || iCheckClip == FALSE) { + float fDiff = vlen(vOrigin - vecRealPos); - fDiff = ( fRadius - fDiff ) / fRadius; + fDiff = (fRadius - fDiff) / fRadius; fDamage = rint(fDamage * fDiff); - if ( fDiff > 0 ) { - Damage_Apply( eDChain, eAttacker, fDamage, eDChain.origin, 0 ); - /*if ( eDChain.movetype != MOVETYPE_NONE ) { - vPush = vectoangles( vecRealPos - vOrigin ); - makevectors( vPush ); - eDChain.velocity += ( v_forward * fDamage * 5 ) + ( v_up * fDamage * 2.5 ); + if (fDiff > 0) { + Damage_Apply(eDChain, eAttacker, fDamage, eDChain.origin, 0); + /*if (eDChain.movetype != MOVETYPE_NONE) { + vPush = vectoangles(vecRealPos - vOrigin); + makevectors(vPush); + eDChain.velocity += (v_forward * fDamage * 5) + (v_up * fDamage * 2.5); }*/ } diff --git a/Source/server/valve/input.c b/Source/server/valve/input.c old mode 100755 new mode 100644 index ed959d69..5361489c --- a/Source/server/valve/input.c +++ b/Source/server/valve/input.c @@ -25,7 +25,7 @@ void Input_Handle(void) Weapons_Release(); } - if ( self.button5 ) { + if (self.button5) { Player_UseDown(); } else { Player_UseUp(); diff --git a/Source/server/valve/player.c b/Source/server/valve/player.c index 6f50f929..b7b835d4 100644 --- a/Source/server/valve/player.c +++ b/Source/server/valve/player.c @@ -24,7 +24,7 @@ void Player_Death(void) UseWorkaround ==================== */ -void UseWorkaround( entity eTarget ) +void UseWorkaround(entity eTarget) { eActivator = self; entity eOldSelf = self; @@ -40,9 +40,9 @@ Player_UseDown */ void Player_UseDown(void) { - if ( self.health <= 0 ) { + if (self.health <= 0) { return; - } else if ( !( self.gflags & GF_USE_RELEASED ) ) { + } else if (!(self.gflags & GF_USE_RELEASED)) { return; } @@ -50,17 +50,17 @@ void Player_UseDown(void) makevectors(self.v_angle); vSource = self.origin + self.view_ofs; - traceline ( vSource, vSource + ( v_forward * 64 ), FALSE, self); + traceline (vSource, vSource + (v_forward * 64), FALSE, self); if (trace_ent.PlayerUse) { if (trace_ent.classname != "func_pushable") { self.gflags &= ~GF_USE_RELEASED; - sound( self, CHAN_ITEM, "common/wpn_select.wav", 0.25, ATTN_IDLE ); + sound(self, CHAN_ITEM, "common/wpn_select.wav", 0.25, ATTN_IDLE); } UseWorkaround(trace_ent); } else { - sound( self, CHAN_ITEM, "common/wpn_denyselect.wav", 0.25, ATTN_IDLE ); + sound(self, CHAN_ITEM, "common/wpn_denyselect.wav", 0.25, ATTN_IDLE); self.gflags &= ~GF_USE_RELEASED; } } @@ -70,8 +70,8 @@ void Player_UseDown(void) Player_UseUp ==================== */ -void Player_UseUp( void ) { - if ( !( self.gflags & GF_USE_RELEASED ) ) { +void Player_UseUp(void) { + if (!(self.gflags & GF_USE_RELEASED)) { self.gflags |= GF_USE_RELEASED; } } diff --git a/Source/server/valve/server.c b/Source/server/valve/server.c index 317a2b5e..f40153b7 100644 --- a/Source/server/valve/server.c +++ b/Source/server/valve/server.c @@ -18,7 +18,6 @@ float Game_ConsoleCmd(string cmd) void Game_Worldspawn(void) { - precache_file("decals.wad"); precache_model("models/player.mdl"); Weapons_Init(); } diff --git a/Source/server/vox.c b/Source/server/vox.c old mode 100755 new mode 100644 index 918346ed..e48365b7 --- a/Source/server/vox.c +++ b/Source/server/vox.c @@ -14,21 +14,22 @@ Assumes time in minutes. TODO: Actually output proper, tokenized strings for not just 1-10 minutes ================= */ -string Vox_TimeToString( float fTime ) { - fTime = rint( fTime ); +string Vox_TimeToString(float fTime) +{ + fTime = rint(fTime); - switch ( fTime ) { - case 0: return "no"; - case 1: return "one"; - case 2: return "two"; - case 3: return "three"; - case 4: return "four"; - case 5: return "five"; - case 6: return "six"; - case 7: return "seven"; - case 8: return "eight"; - case 9: return "nine"; - case 10: return "ten"; + switch (fTime) { + case 0: return "less than one"; + case 1: return "one"; + case 2: return "two"; + case 3: return "three"; + case 4: return "four"; + case 5: return "five"; + case 6: return "six"; + case 7: return "seven"; + case 8: return "eight"; + case 9: return "nine"; + case 10: return "ten"; default: return "over ten"; } } @@ -40,13 +41,14 @@ Vox_Broadcast Broadcasts a VOX message to all players ================= */ -void Vox_Broadcast( string sMessage ) { - localcmd( sprintf( "echo [VOX] Broadcast: %s\n", sMessage ) ); - WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET ); - WriteByte( MSG_MULTICAST, EV_CHAT_VOX ); - WriteString( MSG_MULTICAST, sMessage ); +void Vox_Broadcast(string sMessage) +{ + localcmd(sprintf("echo [VOX] Broadcast: %s\n", sMessage)); + WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); + WriteByte(MSG_MULTICAST, EV_CHAT_VOX); + WriteString(MSG_MULTICAST, sMessage); msg_entity = world; - multicast( '0 0 0', MULTICAST_ALL ); + multicast([0,0,0], MULTICAST_ALL); } /* @@ -56,11 +58,12 @@ Vox_Singlecast Broadcasts a VOX message to one player ================= */ -void Vox_Singlecast( entity eClient, string sMessage ) { - localcmd( sprintf( "echo [VOX] Singlecast to %s: %s\n", eClient.netname, sMessage ) ); - WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET ); - WriteByte( MSG_MULTICAST, EV_CHAT_VOX ); - WriteString( MSG_MULTICAST, sMessage ); +void Vox_Singlecast(entity eClient, string sMessage) +{ + localcmd(sprintf("echo [VOX] Singlecast to %s: %s\n", eClient.netname, sMessage)); + WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); + WriteByte(MSG_MULTICAST, EV_CHAT_VOX); + WriteString(MSG_MULTICAST, sMessage); msg_entity = eClient; - multicast( '0 0 0', MULTICAST_ONE_R ); + multicast([0,0,0], MULTICAST_ONE_R); } diff --git a/Source/shared/decals.c b/Source/shared/decals.c new file mode 100644 index 00000000..e1e0f4f3 --- /dev/null +++ b/Source/shared/decals.c @@ -0,0 +1,54 @@ + + +#define DECALS_MAX 16 + +#ifdef SSQC +entity g_decals; +void Decals_Init(void) +{ + entity nextdecal = spawn(); + g_decals = nextdecal; + for ( int i = 0; i <= DECALS_MAX; i++ ) { + nextdecal.classname = "decal"; + nextdecal.owner = spawn(); + + if ( i == DECALS_MAX ) { + nextdecal.owner = g_decals; + } else { + nextdecal = nextdecal.owner; + } + } +} + +entity Decals_Next(void) +{ + entity ret = g_decals; + g_decals = g_decals.owner; + return ret; +} +#endif + +void Decals_PlaceSmall(vector pos) +{ +#ifdef CSQC + // TODO +#else + entity decal = Decals_Next(); + setorigin(decal, pos); + decal.texture = sprintf("{shot%d", floor(random(1,6))); + decal.think = infodecal; + decal.nextthink = time /*+ 0.1f*/; +#endif +} +void Decals_PlaceBig(vector pos) +{ +#ifdef CSQC + // TODO +#else + entity decal = Decals_Next(); + setorigin(decal, pos); + decal.texture = sprintf("{bigshot%d", floor(random(1,6))); + decal.think = infodecal; + decal.nextthink = time /*+ 0.1f*/; +#endif +} diff --git a/Source/shared/effects.c b/Source/shared/effects.c index 566b8195..70c9e31a 100755 --- a/Source/shared/effects.c +++ b/Source/shared/effects.c @@ -23,11 +23,13 @@ void Effect_CreateExplosion( vector vPos ) { sound( eExplosion, CHAN_WEAPON, sprintf( "weapons/explode%d.wav", floor( random() * 3 ) + 3 ), 1, ATTN_NORM ); //eExplosion.think = Effect_CreateExplosion_Animate; - eExplosion.nextthink = time + 0.05f; eExplosion.effects = EF_ADDITIVE; eExplosion.drawmask = MASK_ENGINE; eExplosion.maxframe = modelframecount( eExplosion.modelindex ); - + eExplosion.loops = 0; + eExplosion.framerate = 20; + eExplosion.nextthink = time + 0.05f; + te_explosion( vPos ); #endif } @@ -112,39 +114,54 @@ void Effect_Impact( int iType, vector vPos, vector vNormal ) { WriteCoord( MSG_MULTICAST, vNormal_z ); msg_entity = self; multicast( vPos, MULTICAST_PVS ); + + switch (iType) { + case IMPACT_MELEE: + Decals_PlaceSmall(vPos); + break; + default: + Decals_PlaceBig(vPos); + break; + } #else - switch ( iType ) { + switch (iType) { case IMPACT_MELEE: /*pointparticles( DECAL_SHOT, vPos, vNormal, 1 ); pointparticles( PARTICLE_PIECES_BLACK, vPos, vNormal, 1 );*/ pointsound( vPos, "weapons/knife_hitwall1.wav", 1, ATTN_STATIC ); + //Decals_PlaceSmall(vPos); break; case IMPACT_EXPLOSION: break; case IMPACT_GLASS: //pointparticles( DECAL_GLASS, vPos, vNormal, 1 ); pointparticles( PARTICLE_PIECES_BLACK, vPos, vNormal, 1 ); + //Decals_PlaceBig(vPos); break; case IMPACT_WOOD: //pointparticles( DECAL_SHOT, vPos, vNormal, 1 ); pointparticles( PARTICLE_SPARK, vPos, vNormal, 1 ); pointparticles( PARTICLE_PIECES_BLACK, vPos, vNormal, 1 ); pointparticles( PARTICLE_SMOKE_BROWN, vPos, vNormal, 1 ); + //Decals_PlaceBig(vPos); break; case IMPACT_METAL: //pointparticles( DECAL_SHOT, vPos, vNormal, 1 ); pointparticles( PARTICLE_SPARK, vPos, vNormal, 1 ); pointparticles( PARTICLE_SPARK, vPos, vNormal, 1 ); pointparticles( PARTICLE_PIECES_BLACK, vPos, vNormal, 1 ); + //Decals_PlaceBig(vPos); break; case IMPACT_FLESH: pointparticles( PARTICLE_BLOOD, vPos, vNormal, 1 ); + //Decals_PlaceBig(vPos); break; case IMPACT_DEFAULT: //pointparticles( DECAL_SHOT, vPos, vNormal, 1 ); pointparticles( PARTICLE_SPARK, vPos, vNormal, 1 ); pointparticles( PARTICLE_PIECES_BLACK, vPos, vNormal, 1 ); pointparticles( PARTICLE_SMOKE_GREY, vPos, vNormal, 1 ); + //Decals_PlaceBig(vPos); break; default: } @@ -287,7 +304,8 @@ void Effect_BreakModel( vector vMins, vector vMaxs, vector vVel, float fStyle ) } #ifdef CSQC -float Effect_Decal( void ) { +float Effect_Decal(void) +{ adddecal( self.classname, self.origin, self.mins, self.maxs, self.color, 1.0f ); addentity( self ); return PREDRAW_NEXT; diff --git a/Source/shared/valve/w_crowbar.c b/Source/shared/valve/w_crowbar.c index 23cc63d6..3ed84cea 100644 --- a/Source/shared/valve/w_crowbar.c +++ b/Source/shared/valve/w_crowbar.c @@ -90,7 +90,6 @@ void w_crowbar_primary(void) if (trace_fraction >= 1.0) { pl.w_attack_next = 0.5f; } else { - Weapons_PlaceDecal(); pl.w_attack_next = 0.25f; } #else @@ -109,6 +108,7 @@ void w_crowbar_primary(void) Weapons_PlaySound(pl, 8, "weapons/cbar_hit2.wav", 1, ATTN_NORM); } pl.w_attack_next = 0.25f; + Effect_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal); } #endif pl.w_idle_next = 2.5f; diff --git a/Source/shared/valve/weapons.c b/Source/shared/valve/weapons.c index 5e06e244..a3619cd2 100644 --- a/Source/shared/valve/weapons.c +++ b/Source/shared/valve/weapons.c @@ -36,10 +36,6 @@ void Weapons_Init(void) g_weapons[i].precache(); } } - -#ifdef SSQC - Decals_Init(); -#endif } void Weapons_Draw(void) @@ -192,55 +188,6 @@ void Weapons_PlaySound(entity t, float ch, string s, float vol, float at) #endif } -#ifdef SSQC -entity g_decals; -#define DECALS_MAX 16 -void Decals_Init(void) -{ - entity nextdecal = spawn(); - g_decals = nextdecal; - for ( int i = 0; i <= DECALS_MAX; i++ ) { - nextdecal.classname = "decal"; - nextdecal.owner = spawn(); - - if ( i == DECALS_MAX ) { - nextdecal.owner = g_decals; - } else { - nextdecal = nextdecal.owner; - } - } -} - -entity Decals_Next(void) -{ - entity ret = g_decals; - g_decals = g_decals.owner; - return ret; -} -#endif - -void Weapons_PlaceDecal(void) -{ -#ifdef SSQC - entity decal = Decals_Next(); - decal.think = infodecal; - decal.texture = sprintf("{shot%d", floor(random(1,6))); - decal.nextthink = time /*+ 0.1f*/; - setorigin(decal, trace_endpos); -#endif -} -void Weapons_PlaceBigDecal(void) -{ -#ifdef SSQC - entity decal = Decals_Next(); - decal.think = infodecal; - decal.texture = sprintf("{bigshot%d", floor(random(1,6))); - decal.nextthink = time /*+ 0.1f*/; - setorigin(decal, trace_endpos); - Effect_Impact(IMPACT_DEFAULT, trace_endpos, trace_plane_normal); -#endif -} - int Weapons_IsPresent(player pl, int w) { if (pl.items & g_weapons[w].id) { diff --git a/Source/shared/valve/weapons.h b/Source/shared/valve/weapons.h index afd70924..90c6bba4 100644 --- a/Source/shared/valve/weapons.h +++ b/Source/shared/valve/weapons.h @@ -67,8 +67,8 @@ enum }; void Weapons_DrawCrosshair(void); -void Weapons_PlaceDecal(void); -void Weapons_PlaceBigDecal(void); +void Decals_PlaceSmall(vector pos); +void Decals_PlaceBig(vector pos); void Weapons_MakeVectors(void); void Weapons_ViewAnimation(int i); void Weapons_ViewPunchAngle(vector add); diff --git a/cstrike/csprogs.dat b/cstrike/csprogs.dat index edddfcd7..4da07147 100644 Binary files a/cstrike/csprogs.dat and b/cstrike/csprogs.dat differ diff --git a/cstrike/progs.dat b/cstrike/progs.dat index d4918b69..c32d4e48 100644 Binary files a/cstrike/progs.dat and b/cstrike/progs.dat differ diff --git a/valve/csprogs.dat b/valve/csprogs.dat index 919b9174..65c8136f 100644 Binary files a/valve/csprogs.dat and b/valve/csprogs.dat differ diff --git a/valve/glsl/default2d.glsl b/valve/glsl/default2d.glsl index 782da22c..fdb4d2d5 100644 --- a/valve/glsl/default2d.glsl +++ b/valve/glsl/default2d.glsl @@ -1,6 +1,7 @@ !!ver 100-450 !!samps 1 !!cvardf gl_fake16bit=0 +!!cvardf gl_monochrome=0 //this shader is present for support for gles/gl3core contexts //it is single-texture-with-vertex-colours, and doesn't do anything special. @@ -28,9 +29,16 @@ void main () f.rgb *= f.a; #endif f *= texture2D(s_t0, tc); + #if gl_fake16bit == 1 f.rgb = floor(f.rgb * vec3(32,64,32))/vec3(32,64,32); #endif + +#if gl_monochrome == 1 + float m = (f.r + f.g + f.b) / 3.0f; + f.rgb = vec3(m,m,m); +#endif + gl_FragColor = f; } #endif diff --git a/valve/glsl/defaultadditivesprite.glsl b/valve/glsl/defaultadditivesprite.glsl new file mode 100644 index 00000000..2f9b5f9d --- /dev/null +++ b/valve/glsl/defaultadditivesprite.glsl @@ -0,0 +1,47 @@ +!!permu FOG +!!samps 1 +!!cvardf gl_fake16bit=0 +!!cvardf gl_monochrome=0 +!!cvardf gl_brighten=0 + +//meant to be used for additive stuff. presumably particles and sprites. though actually its only flashblend effects that use this at the time of writing. +//includes fog, apparently. + +#include "sys/fog.h" +#ifdef VERTEX_SHADER +attribute vec2 v_texcoord; +attribute vec4 v_colour; +varying vec2 tc; +varying vec4 vc; +void main () +{ + tc = v_texcoord; + vc = v_colour; + gl_Position = ftetransform(); +} +#endif +#ifdef FRAGMENT_SHADER +varying vec2 tc; +varying vec4 vc; +uniform vec4 e_colourident; +void main () +{ + vec4 diffuse_f = texture2D(s_t0, tc); + + +#if gl_brighten == 1 + diffuse_f.rgb += vec3(0.1f,0.1f,0.1f) * 0.9f; +#endif + +#if gl_fake16bit == 1 + diffuse_f.rgb = floor(diffuse_f.rgb * vec3(32,64,32))/vec3(32,64,32); +#endif + +#if gl_monochrome == 1 + float m = (diffuse_f.r + diffuse_f.g + diffuse_f.b) / 3.0f; + diffuse_f.rgb = vec3(m,m,m); +#endif + + gl_FragColor = fog4additive(diffuse_f * vc * e_colourident); +} +#endif diff --git a/valve/glsl/defaultskin.glsl b/valve/glsl/defaultskin.glsl index 9c24fe96..0020b378 100644 --- a/valve/glsl/defaultskin.glsl +++ b/valve/glsl/defaultskin.glsl @@ -5,6 +5,8 @@ !!samps diffuse !!cvardf gl_affinemodels=0 !!cvardf gl_fake16bit=0 +!!cvardf gl_monochrome=0 +!!cvardf gl_brighten=0 #include "sys/defs.h" @@ -58,9 +60,20 @@ varying vec3 light; vec4 diffuse_f = texture2D(s_diffuse, tex_c); diffuse_f.rgb *= light; diffuse_f *= e_colourident; + +#if gl_brighten == 1 + diffuse_f.rgb += vec3(0.1f,0.1f,0.1f) * 0.9f; +#endif + #if gl_fake16bit == 1 diffuse_f.rgb = floor(diffuse_f.rgb * vec3(32,64,32))/vec3(32,64,32); #endif + +#if gl_monochrome == 1 + float m = (diffuse_f.r + diffuse_f.g + diffuse_f.b) / 3.0f; + diffuse_f.rgb = vec3(m,m,m); +#endif + gl_FragColor = diffuse_f * e_colourident; } #endif diff --git a/valve/glsl/defaultskybox.glsl b/valve/glsl/defaultskybox.glsl index 8292e5d1..4e7cf622 100644 --- a/valve/glsl/defaultskybox.glsl +++ b/valve/glsl/defaultskybox.glsl @@ -2,6 +2,8 @@ !!permu FOG !!samps reflectcube !!cvardf gl_fake16bit=0 +!!cvardf gl_monochrome=0 +!!cvardf gl_brighten=0 #include "sys/defs.h" #include "sys/fog.h" @@ -19,9 +21,20 @@ void main () void main () { vec4 skybox = textureCube(s_reflectcube, pos); + +#if gl_brighten == 1 + skybox.rgb += vec3(0.1f,0.1f,0.1f) * 0.9f; +#endif + #if gl_fake16bit == 1 skybox.rgb = floor(skybox.rgb * vec3(32,64,32))/vec3(32,64,32); #endif + +#if gl_monochrome == 1 + float m = (skybox.r + skybox.g + skybox.b) / 3.0f; + skybox.rgb = vec3(m,m,m); +#endif + gl_FragColor = vec4(fog3(skybox.rgb), 1.0); } #endif diff --git a/valve/glsl/defaultsprite.glsl b/valve/glsl/defaultsprite.glsl index a13c7c80..b91fa7c5 100644 --- a/valve/glsl/defaultsprite.glsl +++ b/valve/glsl/defaultsprite.glsl @@ -1,6 +1,7 @@ !!permu FOG !!samps 1 !!cvardf gl_fake16bit=0 +!!cvardf gl_monochrome=0 //used by both particles and sprites. //note the fog blending mode is all that differs from defaultadditivesprite @@ -37,6 +38,11 @@ void main () col.rgb = floor(col.rgb * vec3(32,64,32))/vec3(32,64,32); #endif +#if gl_monochrome == 1 + float m = (col.r + col.g + col.b) / 3.0f; + col.rgb = vec3(m,m,m); +#endif + gl_FragColor = col; } #endif diff --git a/valve/glsl/defaultwall.glsl b/valve/glsl/defaultwall.glsl index 0a47e752..dce06ab7 100644 --- a/valve/glsl/defaultwall.glsl +++ b/valve/glsl/defaultwall.glsl @@ -1,6 +1,8 @@ !!ver 110 !!samps diffuse lightmap !!cvardf gl_fake16bit=0 +!!cvardf gl_monochrome=0 +!!cvardf gl_brighten=0 #include "sys/defs.h" @@ -39,9 +41,19 @@ varying vec2 lm_c; diffuse_f.rgb *= light.rgb; diffuse_f *= e_colourident; +#if gl_brighten == 1 + diffuse_f.rgb += vec3(0.1f,0.1f,0.1f) * 0.9f; +#endif + #if gl_fake16bit == 1 diffuse_f.rgb = floor(diffuse_f.rgb * vec3(32,64,32))/vec3(32,64,32); #endif + +#if gl_monochrome == 1 + float m = (diffuse_f.r + diffuse_f.g + diffuse_f.b) / 3.0f; + diffuse_f.rgb = vec3(m,m,m); +#endif + gl_FragColor = diffuse_f; } #endif diff --git a/valve/glsl/defaultwarp.glsl b/valve/glsl/defaultwarp.glsl new file mode 100644 index 00000000..b8f15311 --- /dev/null +++ b/valve/glsl/defaultwarp.glsl @@ -0,0 +1,60 @@ +!!ver 100 450 +!!permu FOG +!!cvarf r_wateralpha +!!samps diffuse lightmap +!!cvardf gl_fake16bit=0 +!!cvardf gl_monochrome=0 + +#include "sys/defs.h" + +//this is the shader that's responsible for drawing default q1 turbulant water surfaces +//this is expected to be moderately fast. + +#include "sys/fog.h" +varying vec2 tc; +#ifdef LIT +varying vec2 lm0; +#endif +#ifdef VERTEX_SHADER +void main () +{ + tc = v_texcoord.st; + #ifdef FLOW + tc.s += e_time * -0.5; + #endif + #ifdef LIT + lm0 = v_lmcoord; + #endif + gl_Position = ftetransform(); +} +#endif +#ifdef FRAGMENT_SHADER +#ifndef ALPHA +uniform float cvar_r_wateralpha; +#define USEALPHA cvar_r_wateralpha +#else +#define USEALPHA float(ALPHA) +#endif +void main () +{ + vec2 ntc; + ntc.s = tc.s + sin(tc.t+e_time)*0.125; + ntc.t = tc.t + sin(tc.s+e_time)*0.125; + vec3 ts = vec3(texture2D(s_diffuse, ntc)); + +#ifdef LIT + ts *= (texture2D(s_lightmap, lm0) * e_lmscale).rgb; +#endif + +#if gl_fake16bit == 1 + ts.rgb = floor(ts.rgb * vec3(32,64,32))/vec3(32,64,32); +#endif + +#if gl_monochrome == 1 + float m = (ts.r + ts.g + ts.b) / 3.0f; + ts.rgb = vec3(m,m,m); +#endif + + gl_FragColor = fog4(vec4(ts, USEALPHA) * e_colourident); +} +#endif diff --git a/valve/menu.dat b/valve/menu.dat index fd352500..6c4698f9 100644 Binary files a/valve/menu.dat and b/valve/menu.dat differ diff --git a/valve/progs.dat b/valve/progs.dat index 1cbedf0c..399c1467 100644 Binary files a/valve/progs.dat and b/valve/progs.dat differ