X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fclient.qc;h=d3cc3d3fed2f5928276d272167d5e68c3b03682d;hp=1211e8988ea98b65c5fb90ac8f952a3c0e540067;hb=0b9df86c9a55dd9ed9031b21e430fc3094fac709;hpb=19c09c8cfc6a4cb71c07e63bf739b7720ec6b0a0 diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 1211e8988..d3cc3d3fe 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -349,7 +349,7 @@ void PutObserverInServer(entity this) setthink(this, func_null); this.nextthink = 0; this.deadflag = DEAD_NO; - this.crouch = false; + UNSET_DUCKED(this); STAT(REVIVE_PROGRESS, this) = 0; this.revival_time = 0; this.draggable = drag_undraggable; @@ -614,8 +614,7 @@ void PutPlayerInServer(entity this) this.respawn_flags = 0; this.respawn_time = 0; STAT(RESPAWN_TIME, this) = 0; - bool q3dfcompat = autocvar_sv_q3defragcompat && autocvar_sv_q3defragcompat_changehitbox; - this.scale = ((q3dfcompat) ? 0.9 : autocvar_sv_player_scale); + this.scale = ((q3compat && autocvar_sv_q3compat_changehitbox) ? 0.9 : autocvar_sv_player_scale); this.fade_time = 0; this.pain_frame = 0; this.pain_finished = 0; @@ -678,7 +677,7 @@ void PutPlayerInServer(entity this) this.spawnpoint_targ = NULL; - this.crouch = false; + UNSET_DUCKED(this); this.view_ofs = STAT(PL_VIEW_OFS, this); setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this)); this.spawnorigin = spot.origin; @@ -1309,6 +1308,91 @@ void UpdateChatBubble(entity this) } } +void calculate_player_respawn_time(entity this) +{ + if(MUTATOR_CALLHOOK(CalculateRespawnTime, this)) + return; + + float gametype_setting_tmp; + float sdelay_max = GAMETYPE_DEFAULTED_SETTING(respawn_delay_max); + float sdelay_small = GAMETYPE_DEFAULTED_SETTING(respawn_delay_small); + float sdelay_large = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large); + float sdelay_small_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_small_count); + float sdelay_large_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large_count); + float waves = GAMETYPE_DEFAULTED_SETTING(respawn_waves); + + float pcount = 1; // Include myself whether or not team is already set right and I'm a "player". + if (teamplay) + { + FOREACH_CLIENT(IS_PLAYER(it) && it != this, { + if(it.team == this.team) + ++pcount; + }); + if (sdelay_small_count == 0) + sdelay_small_count = 1; + if (sdelay_large_count == 0) + sdelay_large_count = 1; + } + else + { + FOREACH_CLIENT(IS_PLAYER(it) && it != this, { + ++pcount; + }); + if (sdelay_small_count == 0) + { + if (IS_INDEPENDENT_PLAYER(this)) + { + // Players play independently. No point in requiring enemies. + sdelay_small_count = 1; + } + else + { + // Players play AGAINST each other. Enemies required. + sdelay_small_count = 2; + } + } + if (sdelay_large_count == 0) + { + if (IS_INDEPENDENT_PLAYER(this)) + { + // Players play independently. No point in requiring enemies. + sdelay_large_count = 1; + } + else + { + // Players play AGAINST each other. Enemies required. + sdelay_large_count = 2; + } + } + } + + float sdelay; + + if (pcount <= sdelay_small_count) + sdelay = sdelay_small; + else if (pcount >= sdelay_large_count) + sdelay = sdelay_large; + else // NOTE: this case implies sdelay_large_count > sdelay_small_count. + sdelay = sdelay_small + (sdelay_large - sdelay_small) * (pcount - sdelay_small_count) / (sdelay_large_count - sdelay_small_count); + + if(waves) + this.respawn_time = ceil((time + sdelay) / waves) * waves; + else + this.respawn_time = time + sdelay; + + if(sdelay < sdelay_max) + this.respawn_time_max = time + sdelay_max; + else + this.respawn_time_max = this.respawn_time; + + if((sdelay + waves >= 5.0) && (this.respawn_time - time > 1.75)) + this.respawn_countdown = 10; // first number to count down from is 10 + else + this.respawn_countdown = -1; // do not count down + + if(autocvar_g_forced_respawn) + this.respawn_flags = this.respawn_flags | RESPAWN_FORCE; +} // LordHavoc: this hack will be removed when proper _pants/_shirt layers are // added to the model skins @@ -2267,7 +2351,6 @@ bool PlayerThink(entity this) this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime); } - secrets_setstatus(this); monsters_setstatus(this); return true;