X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fwaypointsprites.qc;h=02ebdec920562847fb780067d94da3a9c36267df;hb=74941aea60c6fb7d875403113249410ee8af7c5e;hp=d58985312200f4754fefc2bf0d984cea063ed8dc;hpb=46227d344e48c3a06cf4a736046103722adb82f2;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/waypointsprites.qc b/qcsrc/server/waypointsprites.qc index d58985312..02ebdec92 100644 --- a/qcsrc/server/waypointsprites.qc +++ b/qcsrc/server/waypointsprites.qc @@ -1,10 +1,19 @@ -..entity owned_by_field; -.float rule; -.string model1; -.string model2; -.string model3; - -.float(entity) waypointsprite_visible_for_player; +#include "waypointsprites.qh" + +#if defined(CSQC) +#elif defined(MENUQC) +#elif defined(SVQC) + #include "../common/constants.qh" + #include "../common/util.qh" + #include "../common/buffs.qh" + #include "autocvars.qh" + #include "constants.qh" + #include "defs.qh" + #include "../common/deathtypes.qh" + #include "mutators/mutators_include.qh" + #include "../common/mapinfo.qh" + #include "miscfunctions.qh" +#endif void WaypointSprite_UpdateSprites(entity e, string m1, string m2, string m3) { @@ -81,8 +90,6 @@ void WaypointSprite_UpdateTeamRadar(entity e, float icon, vector col) e.SendFlags |= 32; } -.float waypointsprite_pingtime; -.float waypointsprite_helpmetime; void WaypointSprite_Ping(entity e) { // anti spam @@ -94,8 +101,6 @@ void WaypointSprite_Ping(entity e) e.SendFlags |= 32; } -float waypointsprite_limitedrange, waypointsprite_deployed_lifetime, waypointsprite_deadlifetime; - void WaypointSprite_HelpMePing(entity e) { WaypointSprite_Ping(e); @@ -131,6 +136,7 @@ void WaypointSprite_Init() waypointsprite_deployed_lifetime = autocvar_sv_waypointsprite_deployed_lifetime; waypointsprite_deadlifetime = autocvar_sv_waypointsprite_deadlifetime; } + void WaypointSprite_InitClient(entity e) { } @@ -168,12 +174,12 @@ void WaypointSprite_Think() { float doremove; - doremove = FALSE; + doremove = false; if(self.fade_time) { if(time >= self.teleport_time) - doremove = TRUE; + doremove = true; } if(self.exteriormodeltoclient) @@ -190,18 +196,18 @@ float WaypointSprite_visible_for_player(entity e) // personal waypoints if(self.enemy) if(self.enemy != e) - return FALSE; + return false; // team waypoints if(self.team && self.rule == SPRITERULE_DEFAULT) { if(self.team != e.team) - return FALSE; - if not(IS_PLAYER(e)) - return FALSE; + return false; + if (!IS_PLAYER(e)) + return false; } - return TRUE; + return true; } entity WaypointSprite_getviewentity(entity e) @@ -220,14 +226,14 @@ float WaypointSprite_isteammate(entity e, entity e2) if(teamplay) { if(e2.team != e.team) - return FALSE; + return false; } else { if(e2 != e) - return FALSE; + return false; } - return TRUE; + return true; } float WaypointSprite_Customize() @@ -239,7 +245,7 @@ float WaypointSprite_Customize() e = WaypointSprite_getviewentity(other); if(MUTATOR_CALLHOOK(CustomizeWaypoint)) - return FALSE; + return false; return self.waypointsprite_visible_for_player(e); } @@ -251,9 +257,9 @@ float WaypointSprite_SendEntity(entity to, float sendflags) WriteByte(MSG_ENTITY, ENT_CLIENT_WAYPOINT); sendflags = sendflags & 0x7F; - + if(g_nexball) - sendflags &~= 0x80; + sendflags &= ~0x80; else if(self.max_health || (self.pain_finished && (time < self.pain_finished + 0.25))) sendflags |= 0x80; @@ -276,9 +282,9 @@ float WaypointSprite_SendEntity(entity to, float sendflags) if(sendflags & 64) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); } if(sendflags & 1) @@ -313,9 +319,9 @@ float WaypointSprite_SendEntity(entity to, float sendflags) if(sendflags & 32) { WriteByte(MSG_ENTITY, self.cnt); // icon on radar - WriteByte(MSG_ENTITY, self.colormod_x * 255.0); - WriteByte(MSG_ENTITY, self.colormod_y * 255.0); - WriteByte(MSG_ENTITY, self.colormod_z * 255.0); + WriteByte(MSG_ENTITY, self.colormod.x * 255.0); + WriteByte(MSG_ENTITY, self.colormod.y * 255.0); + WriteByte(MSG_ENTITY, self.colormod.z * 255.0); if(WaypointSprite_isteammate(self.owner, WaypointSprite_getviewentity(to))) { @@ -330,7 +336,7 @@ float WaypointSprite_SendEntity(entity to, float sendflags) WriteByte(MSG_ENTITY, 0); } - return TRUE; + return true; } void WaypointSprite_Reset() @@ -343,7 +349,7 @@ void WaypointSprite_Reset() entity WaypointSprite_Spawn( string spr, // sprite - float lifetime, float maxdistance, // lifetime, max distance + float _lifetime, float maxdistance, // lifetime, max distance entity ref, vector ofs, // position entity showto, float t, // show to whom? Use a flag to indicate a team entity own, .entity ownfield, // remove when own gets killed @@ -354,8 +360,8 @@ entity WaypointSprite_Spawn( entity wp; wp = spawn(); wp.classname = "sprite_waypoint"; - wp.teleport_time = time + lifetime; - wp.fade_time = lifetime; + wp.teleport_time = time + _lifetime; + wp.fade_time = _lifetime; wp.exteriormodeltoclient = ref; if(ref) { @@ -384,7 +390,7 @@ entity WaypointSprite_Spawn( wp.reset2 = WaypointSprite_Reset; wp.cnt = icon; wp.colormod = rgb; - Net_LinkEntity(wp, FALSE, 0, WaypointSprite_SendEntity); + Net_LinkEntity(wp, false, 0, WaypointSprite_SendEntity); return wp; } @@ -396,10 +402,9 @@ entity WaypointSprite_SpawnFixed( float icon, vector rgb // initial icon and color ) { - return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, own, ownfield, TRUE, icon, rgb); + return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, own, ownfield, true, icon, rgb); } -.entity waypointsprite_deployed_fixed; entity WaypointSprite_DeployFixed( string spr, float limited_range, @@ -416,21 +421,18 @@ entity WaypointSprite_DeployFixed( maxdistance = waypointsprite_limitedrange; else maxdistance = 0; - return WaypointSprite_Spawn(spr, waypointsprite_deployed_lifetime, maxdistance, world, ofs, world, t, self, waypointsprite_deployed_fixed, FALSE, icon, rgb); + return WaypointSprite_Spawn(spr, waypointsprite_deployed_lifetime, maxdistance, world, ofs, world, t, self, waypointsprite_deployed_fixed, false, icon, rgb); } -.entity waypointsprite_deployed_personal; entity WaypointSprite_DeployPersonal( string spr, vector ofs, float icon, vector rgb // initial icon and color ) { - return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, self, waypointsprite_deployed_personal, FALSE, icon, rgb); + return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, self, waypointsprite_deployed_personal, false, icon, rgb); } -.entity waypointsprite_attached; -.entity waypointsprite_attachedforcarrier; entity WaypointSprite_Attach( string spr, float limited_range, @@ -448,7 +450,7 @@ entity WaypointSprite_Attach( maxdistance = waypointsprite_limitedrange; else maxdistance = 0; - return WaypointSprite_Spawn(spr, waypointsprite_deployed_lifetime, maxdistance, self, '0 0 64', world, t, self, waypointsprite_attached, FALSE, icon, rgb); + return WaypointSprite_Spawn(spr, waypointsprite_deployed_lifetime, maxdistance, self, '0 0 64', world, t, self, waypointsprite_attached, false, icon, rgb); } entity WaypointSprite_AttachCarrier( @@ -459,11 +461,11 @@ entity WaypointSprite_AttachCarrier( { entity e; WaypointSprite_Kill(carrier.waypointsprite_attached); // FC overrides attached - e = WaypointSprite_Spawn(spr, 0, 0, carrier, '0 0 64', world, carrier.team, carrier, waypointsprite_attachedforcarrier, FALSE, icon, rgb); + e = WaypointSprite_Spawn(spr, 0, 0, carrier, '0 0 64', world, carrier.team, carrier, waypointsprite_attachedforcarrier, false, icon, rgb); if(e) { - WaypointSprite_UpdateMaxHealth(e, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent) * 2); - WaypointSprite_UpdateHealth(e, '1 0 0' * healtharmor_maxdamage(carrier.health, carrier.armorvalue, autocvar_g_balance_armor_blockpercent)); + WaypointSprite_UpdateMaxHealth(e, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON) * 2); + WaypointSprite_UpdateHealth(e, '1 0 0' * healtharmor_maxdamage(carrier.health, carrier.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON)); } return e; }