Merge branch 'master' into terencehill/hud_code_cleanup
authorterencehill <piuntn@gmail.com>
Mon, 6 Jan 2014 00:53:05 +0000 (01:53 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 6 Jan 2014 00:53:05 +0000 (01:53 +0100)
20 files changed:
gamemodes.cfg
qcsrc/server/autocvars.qh
qcsrc/server/cl_client.qc
qcsrc/server/cl_impulse.qc
qcsrc/server/g_world.qc
qcsrc/server/mutators/gamemode_assault.qc
qcsrc/server/mutators/gamemode_ca.qc
qcsrc/server/mutators/gamemode_ca.qh
qcsrc/server/mutators/gamemode_freezetag.qc
qcsrc/server/mutators/gamemode_lms.qc
qcsrc/server/scores_rules.qc
qcsrc/server/teamplay.qc
qcsrc/server/vehicles/bumblebee.qc
qcsrc/server/vehicles/racer.qc
qcsrc/server/vehicles/raptor.qc
qcsrc/server/vehicles/spiderbot.qc
qcsrc/server/vehicles/vehicles.qc
qcsrc/server/vehicles/vehicles_def.qh
vehicle_raptor.cfg
vehicle_spiderbot.cfg

index feed748..b5b460f 100644 (file)
@@ -144,8 +144,9 @@ set g_ca_point_leadlimit 0
 set g_ca_spectate_enemies 0 "Allow spectating enemy player by dead player during clan arena games."
 set g_ca_warmup 10 "how long the players will have time to run around the map before the round starts"
 set g_ca_damage2score_multiplier 0.01
-set g_ca_round_timelimit 180
+set g_ca_round_timelimit 180 "round time limit in seconds"
 seta g_ca_teams_override 0
+set g_ca_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
 set g_ca_teams 0
 
 
@@ -231,7 +232,7 @@ set g_cts_finish_kill_delay 10 "prevent cheating by running back to the start li
 // ==========================
 set g_dm 1 "Deathmatch: killing any other player is one frag, player with most frags wins"
 set g_tdm_teams 2 "how many teams are in team deathmatch (set by mapinfo)"
-set g_tdm_team_spawns 0 "when 1, a map can define team spawnpoints for TDM"
+set g_tdm_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
 seta g_tdm_teams_override 0    "how many teams are in team deathmatch"
 
 
@@ -262,10 +263,11 @@ set g_freezetag_revive_clearspeed 1.6 "Speed at which reviving progress gets los
 set g_freezetag_revive_extra_size 100 "Distance in qu that you can stand from a frozen teammate to keep reviving him"
 set g_freezetag_revive_falldamage 0 "Enable reviving from this amount of fall damage"
 set g_freezetag_revive_falldamage_health 40 "Amount of health player has if they revived from falling"
-set g_freezetag_round_timelimit 180
+set g_freezetag_round_timelimit 180 "round time limit in seconds"
 set g_freezetag_frozen_force 0.6 "How much to multiply the force on a frozen player with"
 set g_freezetag_frozen_maxtime 60 "frozen players will be automatically unfrozen after this time in seconds"
 seta g_freezetag_teams_override 0
+set g_freezetag_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any"
 set g_freezetag_teams 0
 
 
index ada0d4b..bd1143d 100644 (file)
@@ -336,7 +336,6 @@ float autocvar_g_balance_health_regenstable;
 float autocvar_g_balance_health_rot;
 float autocvar_g_balance_health_rotlinear;
 float autocvar_g_balance_health_rotstable;
-float autocvar_g_balance_health_start;
 float autocvar_g_balance_hlac_primary_ammo;
 float autocvar_g_balance_hlac_primary_animtime;
 float autocvar_g_balance_hlac_primary_damage;
@@ -695,6 +694,7 @@ float autocvar_g_ca_round_timelimit;
 float autocvar_g_ca_spectate_enemies;
 float autocvar_g_ca_teams;
 float autocvar_g_ca_teams_override;
+float autocvar_g_ca_team_spawns;
 float autocvar_g_ca_warmup;
 float autocvar_g_campaign;
 #define autocvar_g_campaign_forceteam cvar("g_campaign_forceteam")
@@ -812,6 +812,7 @@ float autocvar_g_freezetag_revive_clearspeed;
 float autocvar_g_freezetag_round_timelimit;
 float autocvar_g_freezetag_teams;
 float autocvar_g_freezetag_teams_override;
+float autocvar_g_freezetag_team_spawns;
 float autocvar_g_freezetag_warmup;
 #define autocvar_g_friendlyfire cvar("g_friendlyfire")
 #define autocvar_g_friendlyfire_virtual cvar("g_friendlyfire_virtual")
index 2810c8b..93ee2a6 100644 (file)
@@ -400,6 +400,9 @@ void PutClientInServer (void)
 
                RemoveGrapplingHook(self); // Wazat's Grappling Hook
 
+               if(self.vehicle)
+                       vehicles_exit(VHEF_RELESE);
+
                self.classname = "player";
                self.wasplayer = TRUE;
                self.iscreature = TRUE;
index a4376bd..c9896bc 100644 (file)
@@ -46,8 +46,9 @@ void ImpulseCommands (void)
                return;
        self.impulse = 0;
 
-       // forbid impulses when not in round time
+       // allow only weapon change impulses when not in round time
        if(round_handler_IsActive() && !round_handler_IsRoundStarted())
+       if(imp == 17 || (imp >= 20 && imp < 200) || imp > 253)
                return;
 
        if (timeout_status == TIMEOUT_ACTIVE) //don't allow any impulses while the game is paused
@@ -55,8 +56,8 @@ void ImpulseCommands (void)
 
     if(self.vehicle)
         if(self.vehicle.deadflag == DEAD_NO)
-            if(self.vehicle.vehicles_impusle)
-                if(self.vehicle.vehicles_impusle(imp))
+            if(self.vehicle.vehicles_impulse)
+                if(self.vehicle.vehicles_impulse(imp))
                     return;
 
        if(CheatImpulse(imp))
index 42c2d7a..c51df59 100644 (file)
@@ -1853,7 +1853,7 @@ float WinningCondition_Scores(float limit, float leadlimit)
        if(WinningConditionHelper_zeroisworst)
                leadlimit = 0; // not supported in this mode
 
-       if(g_dm || g_tdm || g_ca || (g_race && !g_race_qualifying) || g_nexball)
+       if(g_dm || g_tdm || g_ca || g_freezetag || (g_race && !g_race_qualifying) || g_nexball)
        // these modes always score in increments of 1, thus this makes sense
        {
                if(leaderfrags != WinningConditionHelper_topscore)
index 0325067..60df95a 100644 (file)
@@ -212,31 +212,8 @@ void assault_wall_think()
 
 // trigger new round
 // reset objectives, toggle spawnpoints, reset triggers, ...
-void vehicles_clearrturn();
-void vehicles_spawn();
 void assault_new_round()
 {
-    entity oldself;
-       //bprint("ASSAULT: new round\n");
-
-       oldself = self;
-       // Eject players from vehicles
-    FOR_EACH_PLAYER(self)
-    {
-        if(self.vehicle)
-            vehicles_exit(VHEF_RELESE);
-    }
-
-    self = findchainflags(vehicle_flags, VHF_ISVEHICLE);
-    while(self)
-    {
-        vehicles_clearrturn();
-        vehicles_spawn();
-        self = self.chain;
-    }
-
-    self = oldself;
-
        // up round counter
        self.winning = self.winning + 1;
 
index 9fbd483..9df6b42 100644 (file)
@@ -144,6 +144,7 @@ MUTATOR_HOOKFUNCTION(ca_PutClientInServer)
        if(!allowed_to_spawn)
        {
                self.classname = "observer";
+               if(self.jointime != time) //not when connecting
                if(!self.caplayer)
                {
                        self.caplayer = 0.5;
@@ -158,6 +159,7 @@ MUTATOR_HOOKFUNCTION(ca_reset_map_players)
 {
        FOR_EACH_CLIENT(self)
        {
+               self.killcount = 0;
                if(self.caplayer)
                {
                        self.classname = "player";
@@ -182,12 +184,8 @@ MUTATOR_HOOKFUNCTION(ca_reset_map_global)
 
 MUTATOR_HOOKFUNCTION(ca_GetTeamCount)
 {
-       ca_teams = autocvar_g_ca_teams_override;
-       if(ca_teams < 2)
-               ca_teams = autocvar_g_ca_teams;
-       ca_teams = bound(2, ca_teams, 4);
        ret_float = ca_teams;
-       return 1;
+       return 0;
 }
 
 MUTATOR_HOOKFUNCTION(ca_PlayerDies)
@@ -224,16 +222,14 @@ MUTATOR_HOOKFUNCTION(ca_GiveFragsForKill)
 
 MUTATOR_HOOKFUNCTION(ca_SetStartItems)
 {
-       start_health = cvar("g_lms_start_health");
-       start_armorvalue = cvar("g_lms_start_armor");
-
-       start_ammo_shells = cvar("g_lms_start_ammo_shells");
-       start_ammo_nails = cvar("g_lms_start_ammo_nails");
-       start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
-       start_ammo_cells = cvar("g_lms_start_ammo_cells");
-       start_ammo_fuel = cvar("g_lms_start_ammo_fuel");
-
        start_items &= ~IT_UNLIMITED_AMMO;
+       start_health       = warmup_start_health       = cvar("g_lms_start_health");
+       start_armorvalue   = warmup_start_armorvalue   = cvar("g_lms_start_armor");
+       start_ammo_shells  = warmup_start_ammo_shells  = cvar("g_lms_start_ammo_shells");
+       start_ammo_nails   = warmup_start_ammo_nails   = cvar("g_lms_start_ammo_nails");
+       start_ammo_rockets = warmup_start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
+       start_ammo_cells   = warmup_start_ammo_cells   = cvar("g_lms_start_ammo_cells");
+       start_ammo_fuel    = warmup_start_ammo_fuel    = cvar("g_lms_start_ammo_fuel");
 
        return 0;
 }
@@ -272,23 +268,17 @@ MUTATOR_HOOKFUNCTION(ca_PlayerDamage_SplitHealthArmor)
        return FALSE;
 }
 
-// scoreboard setup
-void ca_ScoreRules()
-{
-       ScoreRules_basics(2, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
-       ScoreInfo_SetLabel_TeamScore  (ST_CA_ROUNDS,    "rounds",    SFL_SORT_PRIO_PRIMARY);
-       ScoreRules_basics_end();
-}
-
-void ca_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
-{
-       ca_ScoreRules();
-}
-
 void ca_Initialize()
 {
        allowed_to_spawn = TRUE;
 
+       ca_teams = autocvar_g_ca_teams_override;
+       if(ca_teams < 2)
+               ca_teams = autocvar_g_ca_teams;
+       ca_teams = bound(2, ca_teams, 4);
+       ret_float = ca_teams;
+       ScoreRules_ca(ca_teams);
+
        round_handler_Spawn(CA_CheckTeams, CA_CheckWinner, CA_RoundStart);
        round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
 
@@ -296,8 +286,6 @@ void ca_Initialize()
        addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat);
        addstat(STAT_YELLOWALIVE, AS_INT, yellowalive_stat);
        addstat(STAT_PINKALIVE, AS_INT, pinkalive_stat);
-
-       InitializeEntity(world, ca_DelayedInit, INITPRIO_GAMETYPE);
 }
 
 MUTATOR_DEFINITION(gamemode_ca)
index a333952..a7c1edf 100644 (file)
@@ -1,8 +1,2 @@
 // should be removed in the future, as other code should not have to care
 .float caplayer; // 0.5 if scheduled to join the next round
-
-#ifdef SVQC
-
-#define ST_CA_ROUNDS 1
-
-#endif
index 9bc0652..bfc2601 100644 (file)
@@ -100,7 +100,10 @@ float freezetag_CheckWinner()
                Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_OVER);
                Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_OVER);
                FOR_EACH_PLAYER(e)
+               {
                        e.freezetag_frozen_timeout = 0;
+                       e.freezetag_revive_progress = 0;
+               }
                round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
                return 1;
        }
@@ -123,7 +126,10 @@ float freezetag_CheckWinner()
        }
 
        FOR_EACH_PLAYER(e)
+       {
                e.freezetag_frozen_timeout = 0;
+               e.freezetag_revive_progress = 0;
+       }
        round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
        return 1;
 }
@@ -401,6 +407,7 @@ MUTATOR_HOOKFUNCTION(freezetag_reset_map_players)
 {
        FOR_EACH_PLAYER(self)
        {
+               self.killcount = 0;
                if (self.freezetag_frozen)
                        freezetag_Unfreeze(world);
                self.freezetag_frozen_timeout = -1;
@@ -468,7 +475,10 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerPreThink)
        if(n && self.freezetag_frozen) // OK, there is at least one teammate reviving us
        {
                self.freezetag_revive_progress = bound(0, self.freezetag_revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
-               self.health = max(1, self.freezetag_revive_progress * autocvar_g_balance_health_start);
+               if(warmup_stage)
+                       self.health = max(1, self.freezetag_revive_progress * warmup_start_health);
+               else
+                       self.health = max(1, self.freezetag_revive_progress * start_health);
 
                if(self.freezetag_revive_progress >= 1)
                {
@@ -509,7 +519,10 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerPreThink)
        else if(!n && self.freezetag_frozen) // only if no teammate is nearby will we reset
        {
                self.freezetag_revive_progress = bound(0, self.freezetag_revive_progress - frametime * autocvar_g_freezetag_revive_clearspeed, 1);
-               self.health = max(1, self.freezetag_revive_progress * autocvar_g_balance_health_start);
+               if(warmup_stage)
+                       self.health = max(1, self.freezetag_revive_progress * warmup_start_health);
+               else
+                       self.health = max(1, self.freezetag_revive_progress * start_health);
        }
        else if(!n)
        {
@@ -602,10 +615,6 @@ MUTATOR_HOOKFUNCTION(freezetag_SpectateCopy)
 
 MUTATOR_HOOKFUNCTION(freezetag_GetTeamCount)
 {
-       freezetag_teams = autocvar_g_freezetag_teams_override;
-       if(freezetag_teams < 2)
-               freezetag_teams = autocvar_g_freezetag_teams;
-       freezetag_teams = bound(2, freezetag_teams, 4);
        ret_float = freezetag_teams;
        return 0;
 }
@@ -621,7 +630,12 @@ MUTATOR_HOOKFUNCTION(freezetag_VehicleTouch)
 void freezetag_Initialize()
 {
        precache_model("models/ice/ice.md3");
-       ScoreRules_freezetag();
+
+       freezetag_teams = autocvar_g_freezetag_teams_override;
+       if(freezetag_teams < 2)
+               freezetag_teams = autocvar_g_freezetag_teams;
+       freezetag_teams = bound(2, freezetag_teams, 4);
+       ScoreRules_freezetag(freezetag_teams);
 
        round_handler_Spawn(freezetag_CheckTeams, freezetag_CheckWinner, func_null);
        round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
index 928c78b..e782fbf 100644 (file)
@@ -122,13 +122,13 @@ MUTATOR_HOOKFUNCTION(lms_GiveFragsForKill)
 MUTATOR_HOOKFUNCTION(lms_SetStartItems)
 {
        start_items &= ~IT_UNLIMITED_AMMO;
-       start_ammo_shells = cvar("g_lms_start_ammo_shells");
-       start_ammo_nails = cvar("g_lms_start_ammo_nails");
-       start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
-       start_ammo_cells = cvar("g_lms_start_ammo_cells");
-       start_ammo_fuel = cvar("g_lms_start_ammo_fuel");
-       start_health = cvar("g_lms_start_health");
-       start_armorvalue = cvar("g_lms_start_armor");
+       start_health       = warmup_start_health       = cvar("g_lms_start_health");
+       start_armorvalue   = warmup_start_armorvalue   = cvar("g_lms_start_armor");
+       start_ammo_shells  = warmup_start_ammo_shells  = cvar("g_lms_start_ammo_shells");
+       start_ammo_nails   = warmup_start_ammo_nails   = cvar("g_lms_start_ammo_nails");
+       start_ammo_rockets = warmup_start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
+       start_ammo_cells   = warmup_start_ammo_cells   = cvar("g_lms_start_ammo_cells");
+       start_ammo_fuel    = warmup_start_ammo_fuel    = cvar("g_lms_start_ammo_fuel");
 
        return FALSE;
 }
index b57666a..c55195c 100644 (file)
@@ -106,12 +106,18 @@ void ScoreRules_nexball(float teams)
        ScoreRules_basics_end();
 }
 
-// FreezeTag stuff
 #define SP_FREEZETAG_REVIVALS 4
-void ScoreRules_freezetag()
+void ScoreRules_freezetag(float teams)
 {
-       CheckAllowedTeams(world);
-       ScoreRules_basics(((c4>=0) ? 4 : (c3>=0) ? 3 : 2), SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE); // SFL_SORT_PRIO_PRIMARY
+       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE); // SFL_SORT_PRIO_PRIMARY
        ScoreInfo_SetLabel_PlayerScore(SP_FREEZETAG_REVIVALS,           "revivals",             0);
        ScoreRules_basics_end();
 }
+
+#define ST_CA_ROUNDS 1
+void ScoreRules_ca(float teams)
+{
+       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
+       ScoreInfo_SetLabel_TeamScore(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
+       ScoreRules_basics_end();
+}
index 5185b2c..49e824f 100644 (file)
@@ -121,6 +121,8 @@ void InitGameplayMode()
                fraglimit_override = autocvar_g_ca_point_limit;
                leadlimit_override = autocvar_g_ca_point_leadlimit;
                MUTATOR_ADD(gamemode_ca);
+               if(autocvar_g_ca_team_spawns)
+                       have_team_spawns = -1; // request team spawns
        }
 
        if(g_keyhunt)
@@ -137,6 +139,8 @@ void InitGameplayMode()
                fraglimit_override = autocvar_g_freezetag_point_limit;
                leadlimit_override = autocvar_g_freezetag_point_leadlimit;
                MUTATOR_ADD(gamemode_freezetag);
+               if(autocvar_g_freezetag_team_spawns)
+                       have_team_spawns = -1; // request team spawns
        }
 
        if(g_assault)
index bc5f03d..657d227 100644 (file)
@@ -792,10 +792,8 @@ void bumb_die()
 
 void bumb_impact()
 {
-    if(autocvar_g_vehicle_bumblebee_bouncepain_x)
-        vehilces_impact(autocvar_g_vehicle_bumblebee_bouncepain_x,
-                                               autocvar_g_vehicle_bumblebee_bouncepain_y,
-                                               autocvar_g_vehicle_bumblebee_bouncepain_z);
+       if(autocvar_g_vehicle_bumblebee_bouncepain_x)
+               vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
 }
 
 void bumb_spawn(float _f)
index ff54539..f009723 100644 (file)
@@ -74,7 +74,6 @@ float autocvar_g_vehicle_racer_bouncestop;
 vector autocvar_g_vehicle_racer_bouncepain;
 
 var vector racer_force_from_tag(string tag_name, float spring_length, float max_power);
-void racer_spawn_default();
 
 void racer_align4point(float _delta)
 {
@@ -529,8 +528,8 @@ void racer_exit(float eject)
 
 void racer_impact()
 {
-    if(autocvar_g_vehicle_racer_bouncepain_x)
-        vehilces_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
+       if(autocvar_g_vehicle_racer_bouncepain_x)
+               vehicles_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
 }
 
 void racer_blowup()
@@ -544,16 +543,16 @@ void racer_blowup()
                                        autocvar_g_vehicle_racer_blowup_forceintensity,
                                        DEATH_VH_WAKI_DEATH, world);
 
-    self.nextthink  = time + autocvar_g_vehicle_racer_respawntime;
-    self.think      = racer_spawn_default;
+       self.alpha      = -1;
     self.movetype   = MOVETYPE_NONE;
     self.effects    = EF_NODRAW;
-
     self.colormod  = '0 0 0';
     self.avelocity = '0 0 0';
     self.velocity  = '0 0 0';
 
     setorigin(self, self.pos1);
+       self.touch = func_null;
+       self.nextthink = 0;
 }
 
 void racer_deadtouch()
@@ -624,12 +623,6 @@ void racer_spawn(float _spawnflag)
     self.damageforcescale = 0.5;
     //self.destvec = autocvar_g_vehicle_racer_bouncepain;
 }
-void racer_spawn_default()
-{
-       racer_spawn(0);
-}
-
-
 
 void spawnfunc_vehicle_racer()
 {
index 58a640e..a6ef526 100644 (file)
@@ -70,6 +70,11 @@ float autocvar_g_vehicle_raptor_shield;
 float autocvar_g_vehicle_raptor_shield_regen;
 float autocvar_g_vehicle_raptor_shield_regen_pause;
 
+float autocvar_g_vehicle_raptor_blowup_radius;
+float autocvar_g_vehicle_raptor_blowup_coredamage;
+float autocvar_g_vehicle_raptor_blowup_edgedamage;
+float autocvar_g_vehicle_raptor_blowup_forceintensity;
+
 float autocvar_g_vehicle_raptor_bouncefactor;
 float autocvar_g_vehicle_raptor_bouncestop;
 vector autocvar_g_vehicle_raptor_bouncepain;
@@ -690,7 +695,10 @@ void raptor_blowup()
 {
     self.deadflag    = DEAD_DEAD;
     self.vehicle_exit(VHEF_NORMAL);
-    RadiusDamage (self, self.enemy, 250, 15, 250, world, 250, DEATH_VH_RAPT_DEATH, world);
+       RadiusDamage(self, self.enemy, autocvar_g_vehicle_raptor_blowup_coredamage,
+                               autocvar_g_vehicle_raptor_blowup_edgedamage,
+                               autocvar_g_vehicle_raptor_blowup_radius, world,
+                               autocvar_g_vehicle_raptor_blowup_forceintensity, DEATH_VH_RAPT_DEATH, world);
 
     self.alpha          = -1;
     self.movetype       = MOVETYPE_NONE;
@@ -742,8 +750,8 @@ void raptor_die()
 
 void raptor_impact()
 {
-    if(autocvar_g_vehicle_raptor_bouncepain_x)
-        vehilces_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
+       if(autocvar_g_vehicle_raptor_bouncepain_x)
+               vehicles_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
 }
 
 // If we dont do this ever now and then, the raptors rotors
@@ -798,7 +806,7 @@ void raptor_spawn(float _f)
         //FIXME: Camera is in a bad place in HUD model.
         //setorigin(self.vehicle_viewport, '25 0 5');
 
-        self.vehicles_impusle   = raptor_impulse;
+        self.vehicles_impulse   = raptor_impulse;
 
         self.frame = 0;
 
index a73997f..1085a90 100644 (file)
@@ -58,6 +58,11 @@ float autocvar_g_vehicle_spiderbot_rocket_noise;
 float autocvar_g_vehicle_spiderbot_rocket_turnrate;
 float autocvar_g_vehicle_spiderbot_rocket_lifetime;
 
+float autocvar_g_vehicle_spiderbot_blowup_radius;
+float autocvar_g_vehicle_spiderbot_blowup_coredamage;
+float autocvar_g_vehicle_spiderbot_blowup_edgedamage;
+float autocvar_g_vehicle_spiderbot_blowup_forceintensity;
+
 vector autocvar_g_vehicle_spiderbot_bouncepain;
 
 
@@ -634,8 +639,8 @@ void spiderbot_exit(float eject)
 
 void spider_impact()
 {
-    if(autocvar_g_vehicle_spiderbot_bouncepain_x)
-        vehilces_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
+       if(autocvar_g_vehicle_spiderbot_bouncepain_x)
+               vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
 }
 
 void spiderbot_headfade()
@@ -718,14 +723,18 @@ void spiderbot_blowup()
     SUB_SetFade(g1, time, min(autocvar_g_vehicle_spiderbot_respawntime, 10));
     SUB_SetFade(g2, time, min(autocvar_g_vehicle_spiderbot_respawntime, 10));
 
-    RadiusDamage (self, self.enemy, 250, 15, 250, world, 250, DEATH_VH_SPID_DEATH, world);
+       RadiusDamage(self, self.enemy, autocvar_g_vehicle_spiderbot_blowup_coredamage,
+                               autocvar_g_vehicle_spiderbot_blowup_edgedamage,
+                               autocvar_g_vehicle_spiderbot_blowup_radius, world,
+                               autocvar_g_vehicle_spiderbot_blowup_forceintensity, DEATH_VH_SPID_DEATH, world);
 
     self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = -1;
     self.movetype   = MOVETYPE_NONE;
     self.deadflag   = DEAD_DEAD;
     self.solid      = SOLID_NOT;
     self.tur_head.effects  &=  ~EF_FLAME;
-    self.vehicle_hudmodel.viewmodelforclient = self;
+       self.vehicle_hudmodel.viewmodelforclient = self;
+       setorigin(self, self.pos1);
 }
 
 void spiderbot_die()
@@ -784,7 +793,7 @@ void spiderbot_spawn(float _f)
 {
     if(!self.gun1)
     {
-        self.vehicles_impusle   = spiderbot_impulse;
+        self.vehicles_impulse   = spiderbot_impulse;
         self.gun1               = spawn();
         self.gun2               = spawn();
         setmodel(self.gun1, "models/vehicles/spiderbot_barrels.dpm");
index 1e5537a..b9740b5 100644 (file)
@@ -16,7 +16,7 @@ void vehicles_return();
 void vehicles_enter();
 void vehicles_touch();
 void vehicles_reset_colors();
-void vehicles_clearrturn();
+void vehicles_clearreturn();
 void vehicles_setreturn();
 
 
@@ -456,6 +456,30 @@ entity vehicles_projectile(string _mzlfx, string _mzlsound,
 }
 // End generic vehile projectile system
 
+void vehicles_reset()
+{
+       if(self.owner)
+       {
+               entity oldself = self;
+               self = self.owner;
+               vehicles_exit(VHEF_RELESE);
+               self = oldself;
+       }
+       self.alpha      = -1;
+       self.movetype   = MOVETYPE_NONE;
+       self.effects    = EF_NODRAW;
+       self.colormod  = '0 0 0';
+       self.avelocity = '0 0 0';
+       self.velocity  = '0 0 0';
+       self.event_damage = func_null;
+       self.solid = SOLID_NOT;
+       self.deadflag = DEAD_NO;
+
+       self.touch = func_null;
+       self.nextthink = 0;
+       vehicles_setreturn();
+}
+
 /** vehicles_spawn
     Exetuted for all vehicles on (re)spawn.
     Sets defaults for newly spawned units.
@@ -470,6 +494,7 @@ void vehicles_spawn()
     self.owner              = world;
     self.touch              = vehicles_touch;
     self.event_damage       = vehicles_damage;
+    self.reset              = vehicles_reset;
     self.iscreature         = TRUE;
     self.teleportable       = FALSE; // no teleporting for vehicles, too buggy
     self.damagedbycontents     = TRUE;
@@ -512,7 +537,7 @@ float vehicles_crushable(entity e)
     return FALSE;
 }
 
-void vehilces_impact(float _minspeed, float _speedfac, float _maxpain)
+void vehicles_impact(float _minspeed, float _speedfac, float _maxpain)
 {
     if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
         return;
@@ -658,7 +683,7 @@ void vehicles_enter()
         }
     }
 
-    vehicles_clearrturn();
+    vehicles_clearreturn();
 
     CSQCVehicleSetup(self.owner, self.hud);
 
@@ -964,7 +989,7 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, float deat
     }
 }
 
-void vehicles_clearrturn()
+void vehicles_clearreturn()
 {
     entity ret;
     // Remove "return helper", if any.
@@ -1055,7 +1080,7 @@ void vehicles_setreturn()
 {
     entity ret;
 
-    vehicles_clearrturn();
+    vehicles_clearreturn();
 
     ret = spawn();
     ret.classname   = "vehicle_return";
@@ -1063,19 +1088,16 @@ void vehicles_setreturn()
     ret.team        = self.team;
     ret.think       = vehicles_showwp;
 
-    if(self.deadflag != DEAD_NO)
-    {
-        ret.cnt         = time + self.vehicle_respawntime;
-        ret.nextthink   = min(time + self.vehicle_respawntime, time + self.vehicle_respawntime - 5);
-    }
-    else
-    {
-        ret.nextthink   = min(time + self.vehicle_respawntime, time + self.vehicle_respawntime - 1);
-    }
+       if(self.deadflag != DEAD_NO)
+       {
+               ret.cnt = max(game_starttime, time) + self.vehicle_respawntime;
+               ret.nextthink = max(game_starttime, time) + max(0, self.vehicle_respawntime - 5);
+       }
+       else
+               ret.nextthink = max(game_starttime, time) + max(0, self.vehicle_respawntime - 1);
 
     setmodel(ret, "null");
     setorigin(ret, self.pos1 + '0 0 96');
-
 }
 
 void vehicles_reset_colors()
@@ -1273,15 +1295,14 @@ float vehicle_initialize(string  net_name,
     self.event_damage        = func_null;
     self.touch               = vehicles_touch;
     self.think               = vehicles_spawn;
-    self.nextthink           = time;
-    self.vehicle_respawntime = _respawntime;
     self.vehicle_spawn       = spawnproc;
+       self.vehicle_respawntime = max(0, _respawntime);
     self.effects             = EF_NODRAW;
        self.dphitcontentsmask   = DPCONTENTS_BODY | DPCONTENTS_SOLID;
-    if(!autocvar_g_vehicles_delayspawn)
-        self.nextthink = time + game_starttime;
-    else
-        self.nextthink = time + _respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter);
+       if(!autocvar_g_vehicles_delayspawn || !self.vehicle_respawntime)
+               self.nextthink = time;
+       else
+               self.nextthink = max(time, game_starttime) + max(0, self.vehicle_respawntime + ((random() * 2 - 1) * autocvar_g_vehicles_delayspawn_jitter));
 
        if(autocvar_g_playerclip_collisions)
                self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
index 393563f..56fc9ea 100644 (file)
@@ -62,11 +62,9 @@ const float SVC_UPDATEENTITY  = 128; // Net.Protocol 0x80
 #define VHSF_NORMAL 0
 #define VHSF_FACTORY 2
 .void(float _spawnflag) vehicle_spawn;  /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
-.float(float _imp) vehicles_impusle;
+.float(float _imp) vehicles_impulse;
 .float vehicle_weapon2mode = volly_counter;
 
-//ยง .void() vehicle_factory()
-
 #ifdef VEHICLES_USE_ODE
 void(entity e, float physics_enabled) physics_enable = #540; // enable or disable physics on object
 void(entity e, vector force, vector force_pos) physics_addforce = #541; // apply a force from certain origin, length of force vector is power of force
index d91b79b..86864ee 100644 (file)
@@ -65,6 +65,11 @@ set g_vehicle_raptor_shield             75
 set g_vehicle_raptor_shield_regen       25
 set g_vehicle_raptor_shield_regen_pause 1.5
 
+set g_vehicle_raptor_blowup_radius           250
+set g_vehicle_raptor_blowup_coredamage       250
+set g_vehicle_raptor_blowup_edgedamage       15
+set g_vehicle_raptor_blowup_forceintensity   250
+
 set g_vehicle_raptor_bouncefactor 0.2
 set g_vehicle_raptor_bouncestop 0
 set g_vehicle_raptor_bouncepain "1 4 1000"
index 253ed31..4258095 100644 (file)
@@ -54,6 +54,11 @@ set g_vehicle_spiderbot_rocket_noise      0.2
 set g_vehicle_spiderbot_rocket_lifetime   20
 set g_vehicle_spiderbot_rocket_spread     0.05
 
+set g_vehicle_spiderbot_blowup_radius           250
+set g_vehicle_spiderbot_blowup_coredamage       250
+set g_vehicle_spiderbot_blowup_edgedamage       15
+set g_vehicle_spiderbot_blowup_forceintensity   250
+
 set g_vehicle_spiderbot_bouncefactor 0   // Factor of old velocity to keep after colission
 set g_vehicle_spiderbot_bouncestop 0        // if != 0, New veloctiy after bounce = 0 if new velocity < this
 set g_vehicle_spiderbot_bouncepain "0 0 0" // "minspeed_for_pain speedchange_to_pain_factor max_damage"