X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fsv_main.qc;h=c2d3dc7dd855c3eb3f84e6f0dd0efde296a30e09;hb=931a2648cb8ff8083a0af9ea06841d548e4d461b;hp=538dcc62c624b173caa59b1ff53686a39dd50109;hpb=e63ba76493751c027455b946d0b94b3a5beace47;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index 538dcc62c..c2d3dc7dd 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -1,16 +1,41 @@ +#if defined(CSQC) +#elif defined(MENUQC) +#elif defined(SVQC) + #include "../dpdefs/progsdefs.qh" + #include "../dpdefs/dpextensions.qh" + #include "../warpzonelib/common.qh" + #include "../warpzonelib/server.qh" + #include "../common/constants.qh" + #include "../common/util.qh" + #include "../common/weapons/weapons.qh" + #include "weapons/csqcprojectile.qh" + #include "autocvars.qh" + #include "constants.qh" + #include "defs.qh" + #include "../common/deathtypes.qh" + #include "mutators/mutators_include.qh" + #include "vehicles/vehicles_def.qh" + #include "../common/mapinfo.qh" + #include "command/common.qh" + #include "../csqcmodellib/sv_model.qh" + #include "anticheat.qh" + #include "g_hook.qh" +#endif + void CreatureFrame (void) { entity oldself; float dm; - + oldself = self; - for(self = world; (self = findfloat(self, damagedbycontents, TRUE)); ) + for(self = world; (self = findfloat(self, damagedbycontents, true)); ) { if (self.movetype == MOVETYPE_NOCLIP) { continue; } - + float vehic = (self.vehicle_flags & VHF_ISVEHICLE); float projectile = (self.flags & FL_PROJECTILE); - + float monster = (self.flags & FL_MONSTER); + if (self.watertype <= CONTENT_WATER && self.waterlevel > 0) // workaround a retarded bug made by id software :P (yes, it's that old of a bug) { if (!(self.flags & FL_INWATER)) @@ -19,7 +44,7 @@ void CreatureFrame (void) self.dmgtime = 0; } - if(!vehic && !projectile) // vehicles and projectiles don't drown + if(!vehic && !projectile && !monster) // vehicles, monsters and projectiles don't drown { if (self.waterlevel != WATERLEVEL_SUBMERGED) { @@ -38,11 +63,11 @@ void CreatureFrame (void) } } } - + if (self.dmgtime < time) { - self.dmgtime = time + autocvar_g_balance_contents_damagerate; - + self.dmgtime = time + autocvar_g_balance_contents_damagerate; + if (projectile) { if (self.watertype == CONTENT_LAVA) @@ -61,7 +86,7 @@ void CreatureFrame (void) if (self.watersound_finished < time) { self.watersound_finished = time + 0.5; - sound (self, CH_PLAYER, "player/lava.wav", VOL_BASE, ATTN_NORM); + sound (self, CH_PLAYER_SINGLE, "player/lava.wav", VOL_BASE, ATTEN_NORM); } Damage (self, world, world, autocvar_g_balance_contents_playerdamage_lava * autocvar_g_balance_contents_damagerate * self.waterlevel, DEATH_LAVA, self.origin, '0 0 0'); } @@ -70,7 +95,7 @@ void CreatureFrame (void) if (self.watersound_finished < time) { self.watersound_finished = time + 0.5; - sound (self, CH_PLAYER, "player/slime.wav", VOL_BASE, ATTN_NORM); + sound (self, CH_PLAYER_SINGLE, "player/slime.wav", VOL_BASE, ATTEN_NORM); } Damage (self, world, world, autocvar_g_balance_contents_playerdamage_slime * autocvar_g_balance_contents_damagerate * self.waterlevel, DEATH_SLIME, self.origin, '0 0 0'); } @@ -82,7 +107,7 @@ void CreatureFrame (void) if (self.flags & FL_INWATER) { // play leave water sound - self.flags &~= FL_INWATER; + self.flags &= ~FL_INWATER; self.dmgtime = 0; } self.air_finished = time + 12; @@ -93,7 +118,7 @@ void CreatureFrame (void) { // check for falling damage float velocity_len = vlen(self.velocity); - if(!self.hook.state && !g_ca && !(g_cts && !autocvar_g_cts_selfdamage)) + if(!self.hook.state) { dm = vlen(self.oldvelocity) - velocity_len; // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage. if (self.deadflag) @@ -125,7 +150,7 @@ void CreatureFrame (void) else dprint(ftos(trace_dphitq3surfaceflags), "\n"); */ - if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS) + if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS)) { if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS) GlobalSound(globalsound_metalstep, CH_PLAYER, VOICETYPE_PLAYERSOUND); @@ -135,7 +160,7 @@ void CreatureFrame (void) } } } - + self.oldvelocity = self.velocity; } self = oldself; @@ -154,7 +179,6 @@ float game_delay; float game_delay_last; float RedirectionThink(); -entity SelectSpawnPoint (float anypoint); void StartFrame (void) { execute_next_frame(); @@ -210,32 +234,35 @@ void StartFrame (void) skill = autocvar_skill; // detect when the pre-game countdown (if any) has ended and the game has started - game_delay = (time < game_starttime) ? TRUE : FALSE; + game_delay = (time < game_starttime) ? true : false; - if(game_delay_last == TRUE) - if(game_delay == FALSE) + if(game_delay_last == true) + if(game_delay == false) if(autocvar_sv_eventlog) GameLogEcho(":startdelay_ended"); game_delay_last = game_delay; + CreatureFrame (); + CheckRules_World (); + // if in warmup stage and limit for warmup is hit start match - if (inWarmupStage) - if ((g_warmup_limit > 0 && time >= g_warmup_limit) + if(warmup_stage) + if(!gameover) + if((g_warmup_limit > 0 && time >= g_warmup_limit) || (g_warmup_limit == 0 && autocvar_timelimit != 0 && time >= autocvar_timelimit * 60)) { ReadyRestart(); return; } - CreatureFrame (); - CheckRules_World (); - bot_serverframe(); FOR_EACH_PLAYER(self) self.porto_forbidden = max(0, self.porto_forbidden - 1); + anticheat_startframe(); + MUTATOR_CALLHOOK(SV_StartFrame); } @@ -249,7 +276,7 @@ void SV_OnEntityPreSpawnFunction() { if (self) if (self.gametypefilter != "") - if not(isGametypeInFilter(MapInfo_LoadedGametype, teamplay, have_team_spawns, self.gametypefilter)) + if (!isGametypeInFilter(MapInfo_LoadedGametype, teamplay, have_team_spawns, self.gametypefilter)) { remove(self); return; @@ -349,14 +376,14 @@ void SV_OnEntityPreSpawnFunction() else { k = s; - if not(cvar(k)) + if (!cvar(k)) goto cvar_fail; } } inv = !inv; :cvar_fail // now inv is 1 if we want to keep the item, and 0 if we want to get rid of it - if not(inv) + if (!inv) { //print("cvarfilter fail\n"); remove(self); @@ -376,20 +403,20 @@ void SV_OnEntityPreSpawnFunction() else if (self.angles == '0 -2 0') self.angles = '+90 0 0'; - if(self.originjitter_x != 0) - self.origin_x = self.origin_x + (random() * 2 - 1) * self.originjitter_x; - if(self.originjitter_y != 0) - self.origin_y = self.origin_y + (random() * 2 - 1) * self.originjitter_y; - if(self.originjitter_z != 0) - self.origin_z = self.origin_z + (random() * 2 - 1) * self.originjitter_z; - if(self.anglesjitter_x != 0) - self.angles_x = self.angles_x + (random() * 2 - 1) * self.anglesjitter_x; - if(self.anglesjitter_y != 0) - self.angles_y = self.angles_y + (random() * 2 - 1) * self.anglesjitter_y; - if(self.anglesjitter_z != 0) - self.angles_z = self.angles_z + (random() * 2 - 1) * self.anglesjitter_z; + if(self.originjitter.x != 0) + self.origin_x = self.origin.x + (random() * 2 - 1) * self.originjitter.x; + if(self.originjitter.y != 0) + self.origin_y = self.origin.y + (random() * 2 - 1) * self.originjitter.y; + if(self.originjitter.z != 0) + self.origin_z = self.origin.z + (random() * 2 - 1) * self.originjitter.z; + if(self.anglesjitter.x != 0) + self.angles_x = self.angles.x + (random() * 2 - 1) * self.anglesjitter.x; + if(self.anglesjitter.y != 0) + self.angles_y = self.angles.y + (random() * 2 - 1) * self.anglesjitter.y; + if(self.anglesjitter.z != 0) + self.angles_z = self.angles.z + (random() * 2 - 1) * self.anglesjitter.z; if(self.anglejitter != 0) - self.angles_y = self.angles_y + (random() * 2 - 1) * self.anglejitter; + self.angles_y = self.angles.y + (random() * 2 - 1) * self.anglejitter; if(MUTATOR_CALLHOOK(OnEntityPreSpawn)) {