From: Mario Date: Sun, 2 Aug 2020 05:02:13 +0000 (+1000) Subject: Some more cleanup of defs.qh, use a flag to indicate crouch state instead of a separa... X-Git-Tag: xonotic-v0.8.5~804 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=969dc49d01d650a812706aba16c765af488605d0;p=xonotic%2Fxonotic-data.pk3dir.git Some more cleanup of defs.qh, use a flag to indicate crouch state instead of a separate field, matching client behaviour --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 388d1a982..319784a4a 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/qcsrc/common/ent_cs.qc b/qcsrc/common/ent_cs.qc index a7aa27961..4ef6b2f79 100644 --- a/qcsrc/common/ent_cs.qc +++ b/qcsrc/common/ent_cs.qc @@ -170,7 +170,7 @@ ENTCS_PROP(SOLID, true, sv_solid, solid, ENTCS_SET_NORMAL, do { if (IS_PLAYER(player)) { - if (radar_showennemies) break; + if (radar_showenemies) break; if (SAME_TEAM(to, player)) break; if (!(IS_PLAYER(to) || to.caplayer) && time > game_starttime) break; } diff --git a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc index 9a9a654de..8c175554b 100644 --- a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc +++ b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc @@ -1,6 +1,7 @@ #include "sv_assault.qh" #include +#include .entity sprite; #define AS_ROUND_DELAY 5 diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc index 9166f4f80..bf0db40cd 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc @@ -3,6 +3,7 @@ #include #include #include +#include #include #include diff --git a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc index 735b01b30..0066af451 100644 --- a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc +++ b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc @@ -2,6 +2,7 @@ #include #include +#include .entity ballcarried; diff --git a/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc index 079b181f0..cd73ea556 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc @@ -953,7 +953,7 @@ REGISTER_MUTATOR(nb, false) CVTOV(g_nexball_delay_idle); //10 CVTOV(g_nexball_football_physics); //0 */ - radar_showennemies = autocvar_g_nexball_radar_showallplayers; + radar_showenemies = autocvar_g_nexball_radar_showallplayers; InitializeEntity(NULL, nb_delayedinit, INITPRIO_GAMETYPE); WEP_NEXBALL.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED; diff --git a/qcsrc/common/gamemodes/gamemode/race/sv_race.qc b/qcsrc/common/gamemodes/gamemode/race/sv_race.qc index 29415649e..35a7d950a 100644 --- a/qcsrc/common/gamemodes/gamemode/race/sv_race.qc +++ b/qcsrc/common/gamemodes/gamemode/race/sv_race.qc @@ -445,7 +445,7 @@ void race_Initialize() race_ScoreRules(); if(g_race_qualifying == 2) warmup_stage = 0; - radar_showennemies = true; + radar_showenemies = true; } void rc_SetLimits() diff --git a/qcsrc/common/mapobjects/defs.qh b/qcsrc/common/mapobjects/defs.qh index f65a9c22b..40af5252e 100644 --- a/qcsrc/common/mapobjects/defs.qh +++ b/qcsrc/common/mapobjects/defs.qh @@ -31,6 +31,8 @@ const int STATE_BOTTOM = 1; const int STATE_UP = 2; const int STATE_DOWN = 3; +.int active; +.void (entity this, int act_state) setactive; const int ACTIVE_NOT = 0; const int ACTIVE_ACTIVE = 1; const int ACTIVE_IDLE = 2; diff --git a/qcsrc/common/mapobjects/models.qh b/qcsrc/common/mapobjects/models.qh index 8d2e98d15..e1fb9095a 100644 --- a/qcsrc/common/mapobjects/models.qh +++ b/qcsrc/common/mapobjects/models.qh @@ -10,6 +10,11 @@ classfield(Wall) .int lodmodelindex0, lodmodelindex1, lodmodelindex2; classfield(Wall) .float loddistance1, loddistance2; classfield(Wall) .vector saved; +void Ent_Wall_Draw(entity this); + +void Ent_Wall_Remove(entity this); +#endif + // Needed for interactive clientwalls .bool inactive; // Clientwall disappears when inactive .float alpha_max, alpha_min; @@ -17,8 +22,3 @@ classfield(Wall) .vector saved; // fade_vertical_offset is a vertival offset for player position .float fade_start, fade_end, fade_vertical_offset; .float default_solid; - -void Ent_Wall_Draw(entity this); - -void Ent_Wall_Remove(entity this); -#endif diff --git a/qcsrc/common/mapobjects/trigger/hurt.qh b/qcsrc/common/mapobjects/trigger/hurt.qh index e992154aa..66f7568bd 100644 --- a/qcsrc/common/mapobjects/trigger/hurt.qh +++ b/qcsrc/common/mapobjects/trigger/hurt.qh @@ -1,3 +1,7 @@ #pragma once +#ifdef SVQC const int HURT_SLOW = BIT(4); + +bool tracebox_hits_trigger_hurt(vector start, vector e_min, vector e_max, vector end); +#endif diff --git a/qcsrc/common/mapobjects/triggers.qh b/qcsrc/common/mapobjects/triggers.qh index 73113b4b5..513ff127e 100644 --- a/qcsrc/common/mapobjects/triggers.qh +++ b/qcsrc/common/mapobjects/triggers.qh @@ -46,7 +46,6 @@ void generic_netlinked_legacy_use(entity this, entity actor, entity trigger); void trigger_common_read(entity this, bool withtarget); void trigger_remove_generic(entity this); -.float active; .string target; .string targetname; #endif diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 136f3c411..611321c45 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -9,7 +9,9 @@ #include "../weapons/_mod.qh" #include #include +#include #include "../deathtypes/all.qh" +#include #include #include #include "../turrets/sv_turrets.qh" @@ -1145,7 +1147,7 @@ void Monster_Anim(entity this) int animbits = deadbits; if(STAT(FROZEN, this)) animbits |= ANIMSTATE_FROZEN; - if(this.crouch) + if(IS_DUCKED(this)) animbits |= ANIMSTATE_DUCK; // not that monsters can crouch currently... animdecide_setstate(this, animbits, false); animdecide_setimplicitstate(this, (IS_ONGROUND(this))); diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc b/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc index 2243c9872..5c7505614 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc @@ -1,5 +1,7 @@ #include "sv_spawn_near_teammate.qh" +#include + #include string autocvar_g_spawn_near_teammate; diff --git a/qcsrc/common/notifications/all.qc b/qcsrc/common/notifications/all.qc index d6db436d0..c8fb372d6 100644 --- a/qcsrc/common/notifications/all.qc +++ b/qcsrc/common/notifications/all.qc @@ -8,7 +8,7 @@ #include #include #include - #include + #include #include #endif diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 2fd66af67..76bfb0334 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -5,6 +5,7 @@ #ifdef SVQC #include +#include #include "../mapobjects/trigger/viewloc.qh" // client side physics @@ -40,7 +41,7 @@ void Physics_UpdateStats(entity this) STAT(MOVEVARS_HIGHSPEED, this) = autocvar_g_movement_highspeed; MUTATOR_CALLHOOK(PlayerPhysics_UpdateStats, this); - float maxspd_mod = PHYS_HIGHSPEED(this) * ((this.swampslug.active) ? this.swampslug.swamp_slowdown : 1); + float maxspd_mod = PHYS_HIGHSPEED(this) * ((this.swampslug.active == ACTIVE_ACTIVE) ? this.swampslug.swamp_slowdown : 1); STAT(MOVEVARS_MAXSPEED, this) = Physics_ClientOption(this, "maxspeed", autocvar_sv_maxspeed) * maxspd_mod; // also slow walking if (autocvar_g_movement_highspeed_q3_compat) { STAT(MOVEVARS_AIRACCEL_QW, this) = Physics_ClientOption(this, "airaccel_qw", autocvar_sv_airaccel_qw); diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index fc11cfab2..4efb16f9d 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -7,6 +7,8 @@ #include #endif +const int FL_DUCKED = BIT(19); + .entity conveyor; .float race_penalty; @@ -155,6 +157,10 @@ STATIC_INIT(PHYS_INPUT_BUTTON) #define WAS_ONGROUND(s) boolean((s).lastflags & FL_ONGROUND) #define WAS_ONSLICK(s) boolean((s).lastflags & FL_ONSLICK) +#define IS_DUCKED(s) (boolean((s).flags & FL_DUCKED)) +#define SET_DUCKED(s) ((s).flags |= FL_DUCKED) +#define UNSET_DUCKED(s) ((s).flags &= ~FL_DUCKED) + #define ITEMS_STAT(s) ((s).items) .float teleport_time; @@ -224,10 +230,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON) #define PHYS_INPUT_BUTTON_BUTTON15(s) boolean(input_buttons & BIT(17)) #define PHYS_INPUT_BUTTON_BUTTON16(s) boolean(input_buttons & BIT(18)) - #define IS_DUCKED(s) (boolean((s).flags & FL_DUCKED)) - #define SET_DUCKED(s) ((s).flags |= FL_DUCKED) - #define UNSET_DUCKED(s) ((s).flags &= ~FL_DUCKED) - #define PHYS_INVEHICLE(s) (boolean(hud != HUD_NORMAL)) #define PHYS_JUMPSPEEDCAP_MIN autocvar_cl_jumpspeedcap_min @@ -278,10 +280,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON) #define PHYS_INPUT_BUTTON_BUTTON15(s) (CS(s).button15) #define PHYS_INPUT_BUTTON_BUTTON16(s) (CS(s).button16) - #define IS_DUCKED(s) ((s).crouch) - #define SET_DUCKED(s) ((s).crouch = true) - #define UNSET_DUCKED(s) ((s).crouch = false) - #define PHYS_INVEHICLE(s) (boolean((s).vehicle != NULL)) #define PHYS_JUMPSPEEDCAP_MIN autocvar_sv_jumpspeedcap_min diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 4b852d598..e72b62559 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -1,6 +1,7 @@ #include "sv_turrets.qh" #ifdef SVQC #include +#include #include #include @@ -426,11 +427,11 @@ void turret_projectile_explode(entity this) this.event_damage = func_null; #ifdef TURRET_DEBUG float d; - d = RadiusDamage (this, this.owner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, DMG_NOWEP, NULL); + d = RadiusDamage (this, this.owner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.projectiledeathtype, DMG_NOWEP, NULL); this.owner.tur_debug_dmg_t_h = this.owner.tur_debug_dmg_t_h + d; this.owner.tur_debug_dmg_t_f = this.owner.tur_debug_dmg_t_f + this.owner.shot_dmg; #else - RadiusDamage (this, this.realowner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, DMG_NOWEP, NULL); + RadiusDamage (this, this.realowner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.projectiledeathtype, DMG_NOWEP, NULL); #endif delete(this); } @@ -472,7 +473,7 @@ entity turret_projectile(entity actor, Sound _snd, float _size, float _health, f IL_PUSH(g_projectiles, proj); IL_PUSH(g_bot_dodge, proj); proj.enemy = actor.enemy; - proj.totalfrags = _death; + proj.projectiledeathtype = _death; PROJECTILE_MAKETRIGGER(proj); if(_health) { diff --git a/qcsrc/common/turrets/turret/flac_weapon.qc b/qcsrc/common/turrets/turret/flac_weapon.qc index 64b5e2054..ef7b60c8e 100644 --- a/qcsrc/common/turrets/turret/flac_weapon.qc +++ b/qcsrc/common/turrets/turret/flac_weapon.qc @@ -41,11 +41,11 @@ void turret_flac_projectile_think_explode(entity this) setorigin(this, this.enemy.origin + randomvec() * this.owner.shot_radius); #ifdef TURRET_DEBUG - float d = RadiusDamage (this, this.owner, this.owner.shot_dmg, this.owner.shot_dmg, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, DMG_NOWEP, NULL); + float d = RadiusDamage (this, this.owner, this.owner.shot_dmg, this.owner.shot_dmg, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.projectiledeathtype, DMG_NOWEP, NULL); this.owner.tur_debug_dmg_t_h = this.owner.tur_debug_dmg_t_h + d; this.owner.tur_debug_dmg_t_f = this.owner.tur_debug_dmg_t_f + this.owner.shot_dmg; #else - RadiusDamage (this, this.realowner, this.owner.shot_dmg, this.owner.shot_dmg, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.totalfrags, DMG_NOWEP, NULL); + RadiusDamage (this, this.realowner, this.owner.shot_dmg, this.owner.shot_dmg, this.owner.shot_radius, this, NULL, this.owner.shot_force, this.projectiledeathtype, DMG_NOWEP, NULL); #endif delete(this); } diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index f03e9dc6b..066066f0b 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -1,5 +1,6 @@ #include "sv_vehicles.qh" +#include #include bool SendAuxiliaryXhair(entity this, entity to, int sf) @@ -232,7 +233,7 @@ void vehicles_projectile_explode(entity this, entity toucher) PROJECTILE_TOUCH(this, toucher); this.event_damage = func_null; - RadiusDamage (this, this.realowner, this.shot_dmg, 0, this.shot_radius, this, NULL, this.shot_force, this.totalfrags, DMG_NOWEP, toucher); + RadiusDamage (this, this.realowner, this.shot_dmg, 0, this.shot_radius, this, NULL, this.shot_force, this.projectiledeathtype, DMG_NOWEP, toucher); delete(this); } @@ -264,7 +265,7 @@ entity vehicles_projectile(entity this, entity _mzlfx, Sound _mzlsound, proj.shot_dmg = _dmg; proj.shot_radius = _radi; proj.shot_force = _force; - proj.totalfrags = _deahtype; + proj.projectiledeathtype = _deahtype; proj.solid = SOLID_BBOX; set_movetype(proj, MOVETYPE_FLYMISSILE); proj.flags = FL_PROJECTILE; @@ -1029,7 +1030,7 @@ void vehicles_enter(entity pl, entity veh) veh.vehicle_hudmodel.viewmodelforclient = pl; - pl.crouch = false; + UNSET_DUCKED(pl); pl.view_ofs = STAT(PL_VIEW_OFS, pl); setsize(pl, STAT(PL_MIN, pl), STAT(PL_MAX, pl)); diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index da2660b89..3bc225820 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -27,7 +27,7 @@ void W_HLAC_Attack(Weapon thiswep, entity actor, .entity weaponentity) spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * actor.(weaponentity).misc_bulletcounter); spread = min(spread,WEP_CVAR_PRI(hlac, spread_max)); - if(actor.crouch) + if(IS_DUCKED(actor)) spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod); W_SetupShot(actor, weaponentity, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage), thiswep.m_id); @@ -77,7 +77,7 @@ void W_HLAC_Attack2(Weapon thiswep, entity actor, .entity weaponentity) spread = WEP_CVAR_SEC(hlac, spread); - if(actor.crouch) + if(IS_DUCKED(actor)) spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod); W_SetupShot(actor, weaponentity, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage), thiswep.m_id | HITTYPE_SECONDARY); diff --git a/qcsrc/common/weapons/weapon/porto.qh b/qcsrc/common/weapons/weapon/porto.qh index 29820ef06..6c1a6e7f2 100644 --- a/qcsrc/common/weapons/weapon/porto.qh +++ b/qcsrc/common/weapons/weapon/porto.qh @@ -50,4 +50,5 @@ void Porto_Draw(entity this); .float porto_forbidden; void W_Porto_Fail(entity this, float failhard); +void W_Porto_Remove (entity p); #endif diff --git a/qcsrc/lib/csqcmodel/cl_player.qh b/qcsrc/lib/csqcmodel/cl_player.qh index 92948dc5a..af708da25 100644 --- a/qcsrc/lib/csqcmodel/cl_player.qh +++ b/qcsrc/lib/csqcmodel/cl_player.qh @@ -35,8 +35,6 @@ const int PMF_JUMP_HELD = 1; //const int PMF_DUCKED = 4; //const int PMF_ONGROUND = 8; -const int FL_DUCKED = BIT(19); - void CSQCPlayer_SetCamera(); float CSQCPlayer_PreUpdate(entity this); float CSQCPlayer_PostUpdate(entity this); diff --git a/qcsrc/server/anticheat.qc b/qcsrc/server/anticheat.qc index fa4af040b..7637424c1 100644 --- a/qcsrc/server/anticheat.qc +++ b/qcsrc/server/anticheat.qc @@ -4,6 +4,7 @@ #include "autocvars.qh" #include "defs.qh" #include +#include #include "miscfunctions.qh" #include "command/common.qh" diff --git a/qcsrc/server/bot/api.qh b/qcsrc/server/bot/api.qh index 81baa2c19..6c3d3141b 100644 --- a/qcsrc/server/bot/api.qh +++ b/qcsrc/server/bot/api.qh @@ -95,6 +95,11 @@ float havocbot_symmetry_origin_order; .float ignoregoaltime; .entity ignoregoal; +bool bots_would_leave; + +int player_count; +int currentbots; + .entity bot_basewaypoint; .bool navigation_dynamicgoal; void navigation_dynamicgoal_init(entity this, bool initially_static); diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index bcf02da4b..90ef1e2c9 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -18,6 +18,7 @@ #include "../../client.qh" #include "../../constants.qh" #include "../../defs.qh" +#include #include "../../race.qh" #include diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index 296114539..d388b1505 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -24,6 +24,7 @@ #include #include +#include #include #include diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 26d69abbd..4b65a69cc 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -14,6 +14,7 @@ #include #include #include +#include #include .float speed; diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index eda0838fd..9167ca5e7 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -4,6 +4,7 @@ #include #include #include +#include #include "g_damage.qh" #include "clientkill.qh" diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index c0d389837..0458b07af 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; @@ -678,7 +678,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; diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 328726df9..2ad2d8f8d 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -231,10 +231,22 @@ METHOD(Client, m_unwind, bool(Client this)) return false; } +//flood fields +.float nickspamtime; // time of last nick change +.float nickspamcount; +.float floodcontrol_chat; +.float floodcontrol_chatteam; +.float floodcontrol_chattell; +.float floodcontrol_voice; +.float floodcontrol_voiceteam; + +// respawning .int respawn_flags; .float respawn_time; .float respawn_time_max; +.float respawn_countdown; // next number to count + // g__str: // If 0, default is used. // If <0, 0 is used. @@ -252,6 +264,19 @@ bool PlayerInList(entity player, string list); void ClientData_Touch(entity e); +int nJoinAllowed(entity this, entity ignore); + +void FixIntermissionClient(entity e); + +void checkSpectatorBlock(entity this); + +void PlayerUseKey(entity this); + +void FixClientCvars(entity e); + +// called when a client connects, useful for updating sounds and such of static objects +.void(entity this, entity player) init_for_player; + /// \brief Print the string to the client's chat. /// \param[in] client Client to print to. /// \param[in] text Text to print. diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 32ccd883e..c9e8b595e 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -1,5 +1,6 @@ #include "common.qh" +#include #include #include diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 3d1e61478..7b8e06371 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -18,15 +18,6 @@ bool sv_ready_restart_repeatable; float sv_clones; float sv_foginterval; -float player_count; -float currentbots; -float bots_would_leave; - -.int totalfrags; // NOTE: reused for multiple purposes - -// flag set on worldspawn so that the code knows if it is dedicated or not -float server_is_dedicated; - // Fields .void(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) event_damage; @@ -37,15 +28,9 @@ float server_is_dedicated; //.string map; //.float worldtype; -// Needed for dynamic clientwalls -.bool inactive; // Clientwall disappears when inactive -.float alpha_max, alpha_min; -.float fade_start, fade_end, fade_vertical_offset; -.float default_solid; // Variable to store default .solid for clientwalls .float pain_finished; //Added by Supajoe .float pain_frame; //" -.float crouch; // Crouching or not? .float superweapons_finished; // NOTE: this field is used only by map entities, it does not directly apply the superweapons stat const .float air_finished = _STAT(AIR_FINISHED); @@ -71,11 +56,6 @@ const .float air_finished = _STAT(AIR_FINISHED); .float respawntimestart; //.float chasecam; -.float damageforcescale; -const float MIN_DAMAGEEXTRARADIUS = 2; -const float MAX_DAMAGEEXTRARADIUS = 16; -.float damageextraradius; - //.float gravity; .float dmg; @@ -118,7 +98,6 @@ float alreadychangedlevel; float blockSpectators; //if set, new or existing spectators or observers will be removed unless they become a player within g_maxplayers_spectator_blocktime seconds .float spectatortime; //point in time since the client is spectating or observing -void checkSpectatorBlock(entity this); .float winning; .float jointime; // time of connecting @@ -126,10 +105,7 @@ void checkSpectatorBlock(entity this); .float alivetime; // time of being alive .float motd_actived_time; // used for both motd and campaign_message -int nJoinAllowed(entity this, entity ignore); - .float spawnshieldtime; -.float item_spawnshieldtime; .int playerid; .float noalign; // if set to 1, the item or spawnpoint won't be dropped to the floor @@ -164,11 +140,6 @@ float default_weapon_alpha; string gamemode_name; -void FixIntermissionClient(entity e); -void FixClientCvars(entity e); - -.float respawn_countdown; // next number to count - float bot_waypoints_for_items; // speedrun: when 1, player auto teleports back when capture timeout happens @@ -186,8 +157,6 @@ int have_team_spawns_forteams; // if Xth bit is 1 then team X has spawns else it .bool canteamdamage; -void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force); - // WEAPONTODO #define DMG_NOWEP (weaponentities[0]) @@ -196,8 +165,6 @@ float sv_maxidle_spectatorsareidle; int sv_maxidle_slots; bool sv_maxidle_slots_countbots; -float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end); - // autotaunt system .float cvar_cl_autotaunt; .float cvar_cl_voice_directional; @@ -222,8 +189,6 @@ float cvar_purechanges_count; //float game_starttime; //point in time when the countdown to game start is over //float round_starttime; //point in time when the countdown to round start is over -void W_Porto_Remove (entity p); - .int projectiledeathtype; .string message2; @@ -238,26 +203,11 @@ float g_nexball_meter_period; .void(entity this) reset; // if set, an entity is reset using this .void(entity this) reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities) -//vector debug_shotorg; // if non-zero, overrides the shot origin of all weapons - .bool wasplayer; -float servertime, serverprevtime, serverframetime; - -.float ammo_fuel; - -//flood fields -.float nickspamtime; // time of last nick change -.float nickspamcount; -.float floodcontrol_chat; -.float floodcontrol_chatteam; -.float floodcontrol_chattell; -.float floodcontrol_voice; -.float floodcontrol_voiceteam; - string matchid; -bool radar_showennemies; +bool radar_showenemies; .int minelayer_mines; .float vortex_charge; @@ -295,8 +245,6 @@ const int FROZEN_NORMAL = 1; const int FROZEN_TEMP_REVIVING = 2; const int FROZEN_TEMP_DYING = 3; -.int active; -.void (entity this, int act_state) setactive; .entity realowner; //float serverflags; @@ -311,32 +259,12 @@ const int FROZEN_TEMP_DYING = 3; .float misc_bulletcounter; // replaces uzi & hlac bullet counter. -void PlayerUseKey(entity this); - -USING(spawn_evalfunc_t, vector(entity this, entity player, entity spot, vector current)); -.spawn_evalfunc_t spawn_evalfunc; - string modname; -.int missile_flags; -const int MIF_SPLASH = BIT(1); -const int MIF_ARC = BIT(2); -const int MIF_PROXY = BIT(3); -const int MIF_GUIDED_MANUAL = BIT(4); -const int MIF_GUIDED_HEAT = BIT(5); -const int MIF_GUIDED_LASER = BIT(6); -const int MIF_GUIDED_AI = BIT(7); -const int MIF_GUIDED_TAG = BIT(7); -const int MIF_GUIDED_ALL = MIF_GUIDED_MANUAL | MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG; -const int MIF_GUIDED_TRACKING = MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG; -const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI; - //// .string cvar_cl_physics; -.void(entity this, entity player) init_for_player; - .WepSet dual_weapons; IntrusiveList g_monsters; diff --git a/qcsrc/server/g_damage.qh b/qcsrc/server/g_damage.qh index 794b27ccc..771bf216e 100644 --- a/qcsrc/server/g_damage.qh +++ b/qcsrc/server/g_damage.qh @@ -52,6 +52,8 @@ float damage_gooddamage; .bool istypefrag; .float taunt_soundtime; +.int totalfrags; + float IsFlying(entity a); void UpdateFrags(entity player, int f); @@ -96,6 +98,11 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity); +.float damageforcescale; +const float MIN_DAMAGEEXTRARADIUS = 2; +const float MAX_DAMAGEEXTRARADIUS = 16; +.float damageextraradius; + // Calls .event_heal on the target so that they can handle healing themselves // a limit of RES_LIMIT_NONE should be handled by the entity as its max health (if applicable) bool Heal(entity targ, entity inflictor, float amount, float limit); diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 4894b2724..e1b435207 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -1,6 +1,7 @@ #include "g_hook.qh" #include +#include #include #include #include "weapons/common.qh" diff --git a/qcsrc/server/g_world.qh b/qcsrc/server/g_world.qh index da950f185..6b9a9f8ec 100644 --- a/qcsrc/server/g_world.qh +++ b/qcsrc/server/g_world.qh @@ -5,6 +5,9 @@ float checkrules_suddendeathwarning; float checkrules_suddendeathend; float checkrules_overtimesadded; //how many overtimes have been already added +// flag set on worldspawn so that the code knows if it is dedicated or not +bool server_is_dedicated; + string cache_mutatormsg; string cache_lastmutatormsg; diff --git a/qcsrc/server/impulse.qc b/qcsrc/server/impulse.qc index ee26d65a7..f066615f3 100644 --- a/qcsrc/server/impulse.qc +++ b/qcsrc/server/impulse.qc @@ -4,6 +4,7 @@ #include "weapons/throwing.qh" #include "command/common.qh" #include "cheats.qh" +#include "client.qh" #include "clientkill.qh" #include "weapons/selection.qh" #include "weapons/tracing.qh" diff --git a/qcsrc/server/items/items.qh b/qcsrc/server/items/items.qh index d135ee387..406f424fa 100644 --- a/qcsrc/server/items/items.qh +++ b/qcsrc/server/items/items.qh @@ -18,6 +18,9 @@ const float ITEM_RESPAWN_TICKS = 10; .float item_respawncounter; +// delay before this item can be picked up +.float item_spawnshieldtime; + void Item_Show (entity e, int mode); void Item_Respawn (entity this); diff --git a/qcsrc/server/mapvoting.qc b/qcsrc/server/mapvoting.qc index e42748306..8d747e254 100644 --- a/qcsrc/server/mapvoting.qc +++ b/qcsrc/server/mapvoting.qc @@ -1,5 +1,6 @@ #include "mapvoting.qh" +#include #include #include #include diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 73b732978..84901fa32 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -4,6 +4,7 @@ #include "command/common.qh" #include "constants.qh" #include "g_hook.qh" +#include "g_world.qh" #include #include "ipban.qh" #include @@ -25,6 +26,7 @@ #include "../common/playerstats.qh" #include "../common/teams.qh" #include "../common/mapobjects/subs.qh" +#include #include "../common/util.qh" #include "../common/turrets/sv_turrets.qh" #include diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index 8a626642e..4af7b4f8a 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -167,7 +167,7 @@ void player_anim(entity this) animbits |= ANIMSTATE_FROZEN; if(this.move_movetype == MOVETYPE_FOLLOW) animbits |= ANIMSTATE_FOLLOW; - if(this.crouch) + if(IS_DUCKED(this)) animbits |= ANIMSTATE_DUCK; animdecide_setstate(this, animbits, false); animdecide_setimplicitstate(this, IS_ONGROUND(this)); diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 0eb325699..8ba789e7b 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -16,6 +16,7 @@ #include "../lib/warpzone/common.qh" #include "../common/vehicles/vehicle.qh" #include "../common/vehicles/sv_vehicles.qh" +#include #include #define PORTALS_ARE_NOT_SOLID diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 43443a11f..22cd21f2d 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -1,6 +1,7 @@ #include "race.qh" #include +#include #include #include "client.qh" #include "portals.qh" diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 12175bb76..d9cea92db 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -2,6 +2,7 @@ #include "command/common.qh" #include "defs.qh" +#include "client.qh" #include #include #include diff --git a/qcsrc/server/spawnpoints.qh b/qcsrc/server/spawnpoints.qh index fe6adaebf..1609201c2 100644 --- a/qcsrc/server/spawnpoints.qh +++ b/qcsrc/server/spawnpoints.qh @@ -13,3 +13,6 @@ entity Spawn_FilterOutBadSpots(entity this, entity firstspot, float mindist, flo entity SelectSpawnPoint(entity this, bool anypoint); spawnfunc(info_player_deathmatch); void spawnpoint_use(entity this, entity actor, entity trigger); + +USING(spawn_evalfunc_t, vector(entity this, entity player, entity spot, vector current)); +.spawn_evalfunc_t spawn_evalfunc; diff --git a/qcsrc/server/sv_main.qh b/qcsrc/server/sv_main.qh index 46284fde2..a70228667 100644 --- a/qcsrc/server/sv_main.qh +++ b/qcsrc/server/sv_main.qh @@ -7,6 +7,8 @@ float client_cefc_accumulator; float client_cefc_accumulatortime; #endif +float servertime, serverprevtime, serverframetime; + /* ================== main diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index d6432d698..ce41941c5 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -2,6 +2,7 @@ #include "client.qh" #include +#include #include "race.qh" #include "scores.qh" #include "scores_rules.qh" diff --git a/qcsrc/server/weapons/common.qh b/qcsrc/server/weapons/common.qh index 1b4b179d2..5839a425d 100644 --- a/qcsrc/server/weapons/common.qh +++ b/qcsrc/server/weapons/common.qh @@ -7,3 +7,16 @@ void W_GiveWeapon (entity e, float wep); void W_PlayStrengthSound(entity player); float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception); void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode); + +.int missile_flags; +const int MIF_SPLASH = BIT(1); +const int MIF_ARC = BIT(2); +const int MIF_PROXY = BIT(3); +const int MIF_GUIDED_MANUAL = BIT(4); +const int MIF_GUIDED_HEAT = BIT(5); +const int MIF_GUIDED_LASER = BIT(6); +const int MIF_GUIDED_AI = BIT(7); +const int MIF_GUIDED_TAG = BIT(7); +const int MIF_GUIDED_ALL = MIF_GUIDED_MANUAL | MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG; +const int MIF_GUIDED_TRACKING = MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG; +const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI;