X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fmutator%2Fgamemode_race.qc;h=756d975b156ad197febcbe333455f85d9eaf246f;hb=868c953a2bff5ddb11700a7d160e66014d9704de;hp=63fbd15a272476c1184fd26786daf3ce478b5d9c;hpb=4d9a40898926a8da83b788f9a862f35cdd4c8905;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/mutator/gamemode_race.qc b/qcsrc/server/mutators/mutator/gamemode_race.qc index 63fbd15a27..756d975b15 100644 --- a/qcsrc/server/mutators/mutator/gamemode_race.qc +++ b/qcsrc/server/mutators/mutator/gamemode_race.qc @@ -1,42 +1,5 @@ #include "gamemode_race.qh" -#ifndef GAMEMODE_RACE_H -#define GAMEMODE_RACE_H - -void rc_SetLimits(); -void race_Initialize(); - -REGISTER_MUTATOR(rc, false) -{ - MUTATOR_ONADD - { - if (time > 1) // game loads at time 1 - error("This is a game type and it cannot be added at runtime."); - - rc_SetLimits(); - race_Initialize(); - } - - MUTATOR_ONROLLBACK_OR_REMOVE - { - // we actually cannot roll back race_Initialize here - // BUT: we don't need to! If this gets called, adding always - // succeeds. - } - - MUTATOR_ONREMOVE - { - LOG_INFO("This is a game type and it cannot be removed at runtime."); - return -1; - } - - return 0; -} - -#endif - -#ifdef IMPLEMENTATION - #include #define autocvar_g_race_laps_limit cvar("g_race_laps_limit") @@ -78,7 +41,7 @@ void race_ScoreRules() ScoreRules_basics(race_teams, 0, 0, false); if(race_teams) { - ScoreInfo_SetLabel_TeamScore( ST_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY); + ScoreInfo_SetLabel_TeamScore( ST_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY); ScoreInfo_SetLabel_PlayerScore(SP_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY); ScoreInfo_SetLabel_PlayerScore(SP_RACE_TIME, "time", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME); ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest", SFL_LOWER_IS_BETTER | SFL_TIME); @@ -143,8 +106,9 @@ float WinningCondition_QualifyingThenRace(float limit) MUTATOR_HOOKFUNCTION(rc, PlayerPhysics) { entity player = M_ARGV(0, entity); + float dt = M_ARGV(1, float); - player.race_movetime_frac += PHYS_INPUT_TIMELENGTH; + player.race_movetime_frac += dt; float f = floor(player.race_movetime_frac); player.race_movetime_frac -= f; player.race_movetime_count += f; @@ -318,7 +282,7 @@ MUTATOR_HOOKFUNCTION(rc, PutClientInServer) MUTATOR_HOOKFUNCTION(rc, PlayerDies) { entity frag_target = M_ARGV(2, entity); - + frag_target.respawn_flags |= RESPAWN_FORCE; race_AbandonRaceCheck(frag_target); } @@ -504,5 +468,3 @@ void rc_SetLimits() g_race_qualifying = 0; SetLimits(fraglimit_override, leadlimit_override, timelimit_override, qualifying_override); } - -#endif