X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fgamemodes%2Fgamemode%2Fonslaught%2Fsv_onslaught.qc;h=7f2def318011cb2a17f497345a0ba09784483e75;hb=812dd3215ba88d7bcd2b38b9c4acd19d84a5152b;hp=9675634ec7b5c64780e8707421028ef821b7b11f;hpb=3a9017e6791a5dd7de4ba669c3b1ff08d4347a5b;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc index 9675634ec..7f2def318 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc @@ -2,6 +2,15 @@ #include "sv_controlpoint.qh" #include "sv_generator.qh" +#include +#include +#include +#include +#include +#include +#include +#include + bool g_onslaught; float autocvar_g_onslaught_teleport_wait; @@ -39,9 +48,7 @@ bool clientcamera_send(entity this, entity to, int sf) WriteVector(MSG_ENTITY, this.origin); - WriteAngle(MSG_ENTITY, this.angles_x); - WriteAngle(MSG_ENTITY, this.angles_y); - WriteAngle(MSG_ENTITY, this.angles_z); + WriteAngleVector(MSG_ENTITY, this.angles); return true; } @@ -84,14 +91,14 @@ void ons_CaptureShield_Reset(entity this) this.team = this.enemy.team; } -void ons_CaptureShield_Spawn(entity generator, bool is_generator) +void ons_CaptureShield_Spawn(entity this, Model shield_model) { entity shield = new(ons_captureshield); IL_PUSH(g_onsshields, shield); - shield.enemy = generator; - shield.team = generator.team; - shield.colormap = generator.colormap; + shield.enemy = this; + shield.team = this.team; + shield.colormap = this.colormap; shield.reset = ons_CaptureShield_Reset; settouch(shield, ons_CaptureShield_Touch); setcefc(shield, ons_CaptureShield_Customize); @@ -99,13 +106,12 @@ void ons_CaptureShield_Spawn(entity generator, bool is_generator) set_movetype(shield, MOVETYPE_NOCLIP); shield.solid = SOLID_TRIGGER; shield.avelocity = '7 0 11'; - shield.scale = 1; - shield.model = ((is_generator) ? "models/onslaught/generator_shield.md3" : "models/onslaught/controlpoint_shield.md3"); + shield.scale = this.scale; - precache_model(shield.model); - setorigin(shield, generator.origin); - _setmodel(shield, shield.model); - setsize(shield, shield.scale * shield.mins, shield.scale * shield.maxs); + float shield_extra_size = 1.20; // hitbox is 20% larger than the object itself + setorigin(shield, this.origin); + setmodel(shield, shield_model); + setsize(shield, shield_extra_size * this.mins, shield_extra_size * this.maxs); } @@ -760,7 +766,7 @@ void ons_DelayedControlPoint_Setup(entity this) onslaught_updatelinks(); // captureshield setup - ons_CaptureShield_Spawn(this, false); + ons_CaptureShield_Spawn(this, MDL_ONS_CP_SHIELD); CSQCMODEL_AUTOINIT(this); } @@ -876,6 +882,7 @@ void ons_camSetup(entity this) FOREACH_CLIENT(true, it.clientcamera = cam;); + // NOTE: engine networked WriteByte(MSG_ALL, SVC_SETVIEWANGLES); WriteAngle(MSG_ALL, cam.angles_x); WriteAngle(MSG_ALL, cam.angles_y); @@ -998,7 +1005,7 @@ void ons_GeneratorThink(entity this) { Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_ONS_NOTSHIELDED_TEAM); msg_entity = it; - soundto(MSG_ONE, this, CHAN_AUTO, SND(ONS_GENERATOR_ALARM), VOL_BASE, ATTEN_NONE); + soundto(MSG_ONE, this, CHAN_AUTO, SND(ONS_GENERATOR_ALARM), VOL_BASE, ATTEN_NONE, 0); } else Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(this.team, CENTER_ONS_NOTSHIELDED)); @@ -1042,7 +1049,7 @@ void ons_DelayedGeneratorSetup(entity this) this.bot_basewaypoint = this.nearestwaypoint; // captureshield setup - ons_CaptureShield_Spawn(this, true); + ons_CaptureShield_Spawn(this, MDL_ONS_GEN_SHIELD); onslaught_updatelinks(); @@ -1070,7 +1077,6 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o ons_worldgeneratorlist = gen; gen.netname = sprintf("%s generator", Team_ColoredFullName(teamnum)); - gen.classname = "onslaught_generator"; gen.solid = SOLID_BBOX; gen.team_saved = teamnum; IL_PUSH(g_saved_team, gen); @@ -1120,7 +1126,7 @@ void Onslaught_count_generators() total_generators = 0; for (int i = 1; i <= NUM_TEAMS; ++i) { - Team_SetNumberOfControlPoints(Team_GetTeamFromIndex(i), 0); + Team_SetNumberOfOwnedItems(Team_GetTeamFromIndex(i), 0); } for(e = ons_worldgeneratorlist; e; e = e.ons_worldgeneratornext) { @@ -1130,35 +1136,10 @@ void Onslaught_count_generators() continue; } entity team_ = Entity_GetTeam(e); - int num_control_points = Team_GetNumberOfControlPoints(team_); - ++num_control_points; - Team_SetNumberOfControlPoints(team_, num_control_points); - } -} - -int Onslaught_GetWinnerTeam() -{ - int winner_team = 0; - if (Team_GetNumberOfControlPoints(Team_GetTeamFromIndex(1)) >= 1) - { - winner_team = NUM_TEAM_1; - } - for (int i = 2; i <= NUM_TEAMS; ++i) - { - if (Team_GetNumberOfControlPoints(Team_GetTeamFromIndex(i)) >= 1) - { - if (winner_team != 0) - { - return 0; - } - winner_team = Team_IndexToTeam(i); - } - } - if (winner_team) - { - return winner_team; + int num_generators = Team_GetNumberOfOwnedItems(team_); + ++num_generators; + Team_SetNumberOfOwnedItems(team_, num_generators); } - return -1; // no generators left? } void nades_Clear(entity e); @@ -1207,13 +1188,9 @@ bool Onslaught_CheckWinner() else { wpforenemy_announced = false; ons_stalemate = false; } Onslaught_count_generators(); - - if (Team_GetNumberOfTeamsWithControlPoints() > 1) - { + int winner_team = Team_GetWinnerTeam_WithOwnedItems(1); + if (!winner_team) return 0; - } - - int winner_team = Onslaught_GetWinnerTeam(); if(winner_team > 0) { @@ -2174,6 +2151,7 @@ void ons_DelayedInit(entity this) // Do this check with a delay so we can wait f void ons_Initialize() { g_onslaught = true; + g_onsshields = IL_NEW(); ons_captureshield_force = autocvar_g_onslaught_shield_force; cam = new(objective_camera);