From: TimePath Date: Thu, 29 Jan 2015 06:17:16 +0000 (+1100) Subject: Clean up SVQC #includes X-Git-Tag: xonotic-v0.8.1~133^2~15 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=74941aea60c6fb7d875403113249410ee8af7c5e Clean up SVQC #includes --- diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index f5a3d14c11..74f3816f43 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -381,7 +381,6 @@ float Monster_CanRespawn(entity ent) return true; } -float monster_initialize(float mon_id); void monster_respawn() { // is this function really needed? diff --git a/qcsrc/common/monsters/sv_monsters.qh b/qcsrc/common/monsters/sv_monsters.qh index 0ca54e54ba..2ec816f7d1 100644 --- a/qcsrc/common/monsters/sv_monsters.qh +++ b/qcsrc/common/monsters/sv_monsters.qh @@ -89,4 +89,13 @@ const int MONSTER_MOVE_ENEMY = 5; // used only as a movestate const int MONSTER_STATE_ATTACK_LEAP = 1; const int MONSTER_STATE_ATTACK_MELEE = 2; + +float monster_initialize(float mon_id); +float monster_leap (float anm, void() touchfunc, vector vel, float anim_finished); +void monster_makevectors(entity e); +float monster_melee(entity targ, float damg, float anim, float er, float anim_finished, float deathtype, float dostop); +void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_run, float manim_walk, float manim_idle); +void monster_setupcolors(entity mon); +float Monster_SkillModifier(); +void MonsterTouch (); #endif \ No newline at end of file diff --git a/qcsrc/common/nades.qc b/qcsrc/common/nades.qc index 42334575e8..12a86eedd4 100644 --- a/qcsrc/common/nades.qc +++ b/qcsrc/common/nades.qc @@ -14,8 +14,6 @@ #include "../server/constants.qh" #endif -.float healer_lifetime; -.float healer_radius; #ifdef SVQC float healer_send(entity to, float sf) diff --git a/qcsrc/common/nades.qh b/qcsrc/common/nades.qh index 60338c32dd..5033a7d059 100644 --- a/qcsrc/common/nades.qh +++ b/qcsrc/common/nades.qh @@ -1,6 +1,9 @@ #ifndef NADES_H #define NADES_H +.float healer_lifetime; +.float healer_radius; + // use slots 70-100 const int PROJECTILE_NADE = 71; const int PROJECTILE_NADE_BURN = 72; @@ -100,6 +103,10 @@ string Nade_TrailEffect(float proj, float nade_team) return ""; } +#ifdef SVQC +float healer_send(entity to, float sf); +#endif + #ifdef CSQC // misc functions void ent_healer(); diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index 834f9623e8..62f3997ad3 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -1,6 +1,14 @@ // TODO: include once //#ifndef WEAPONS_ALL_H //#define WEAPONS_ALL_H + +#include "../util.qh" + +#ifdef SVQC +# include "config.qh" +# include "../../server/bot/aim.qh" +#endif + // ONLY EVER ADD NEW WEAPONS AT THE END. IF YOU REMOVE ONE, PUT THE LAST ONE ON // ITS PLACE. THIS IS TO AVOID UNNECESSARY RENUMBERING OF WEAPON IMPULSES. // IF YOU DISREGARD THIS NOTICE, I'LL KILL YOU WITH THE @!#%'N TUBA diff --git a/qcsrc/common/weapons/weapons.qc b/qcsrc/common/weapons/weapons.qc index 0cd72b64ea..627b1fd483 100644 --- a/qcsrc/common/weapons/weapons.qc +++ b/qcsrc/common/weapons/weapons.qc @@ -1,3 +1,6 @@ +#ifndef WEAPONS_C +#define WEAPONS_C + #if defined(CSQC) #include "../../dpdefs/csprogsdefs.qh" #include "../../client/defs.qh" @@ -369,3 +372,4 @@ float GetAmmoStat(.float ammotype) } } #endif +#endif \ No newline at end of file diff --git a/qcsrc/csqcmodellib/sv_model.qh b/qcsrc/csqcmodellib/sv_model.qh index c9af594cfe..4b9293e55b 100644 --- a/qcsrc/csqcmodellib/sv_model.qh +++ b/qcsrc/csqcmodellib/sv_model.qh @@ -1,5 +1,3 @@ -#ifndef SV_MODEL_H -#define SV_MODEL_H /* * Copyright (c) 2011 Rudolf Polzer * @@ -21,6 +19,10 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ + #ifndef SV_MODEL_H + #define SV_MODEL_H + + #include "common.qh" // generic CSQC model code diff --git a/qcsrc/server/anticheat.qc b/qcsrc/server/anticheat.qc index e6893ba397..dab5fa3008 100644 --- a/qcsrc/server/anticheat.qc +++ b/qcsrc/server/anticheat.qc @@ -1,14 +1,16 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "../warpzonelib/mathlib.qh" - #include "autocvars.qh" - #include "defs.qh" - #include "command/common.qh" - #include "anticheat.qh" -#endif +#include "anticheat.qh" + +#include "antilag.qh" +#include "autocvars.qh" +#include "defs.qh" +#include "miscfunctions.qh" + +#include "../dpdefs/progsdefs.qh" +#include "../dpdefs/dpextensions.qh" + +#include "../warpzonelib/mathlib.qh" + +#include "command/common.qh" .float anticheat_jointime; diff --git a/qcsrc/server/bot/waypoints.qh b/qcsrc/server/bot/waypoints.qh index c2f1d86f73..11d11dd48d 100644 --- a/qcsrc/server/bot/waypoints.qh +++ b/qcsrc/server/bot/waypoints.qh @@ -53,6 +53,7 @@ void waypoint_saveall(); void waypoint_spawnforitem_force(entity e, vector org); void waypoint_spawnforitem(entity e); void waypoint_spawnforteleporter(entity e, vector destination, float timetaken); +void waypoint_spawnforteleporter_v(entity e, vector org, vector destination, float timetaken); void botframe_showwaypointlinks(); float waypoint_loadall(); diff --git a/qcsrc/server/campaign.qc b/qcsrc/server/campaign.qc index 0f174ff9de..2c091d56e1 100644 --- a/qcsrc/server/campaign.qc +++ b/qcsrc/server/campaign.qc @@ -1,15 +1,9 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "autocvars.qh" - #include "defs.qh" - #include "campaign.qh" - #include "../common/campaign_common.qh" - #include "../common/mapinfo.qh" - #include "cheats.qh" -#endif +#include "campaign.qh" +#include "cheats.qh" +#include "miscfunctions.qh" +#include "g_world.qh" + +#include "../common/campaign_common.qh" // campaign cvars: // _campaign_index: index of CURRENT map diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index a38e14b81c..561208f5f2 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -1,3 +1,8 @@ +#include "cheats.qh" +#include "g_damage.qh" +#include "race.qh" +#include "t_teleporters.qh" + #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) @@ -15,7 +20,6 @@ #include "../common/deathtypes.qh" #include "mutators/mutators_include.qh" #include "../csqcmodellib/sv_model.qh" - #include "cheats.qh" #endif void CopyBody(float keepvelocity); @@ -788,6 +792,16 @@ float CheatFrame() // ENTITY DRAGGING +// on dragger: +.float draggravity; +.float dragspeed; // speed of mouse wheel action +.float dragdistance; // distance of dragentity's draglocalvector from view_ofs +.vector draglocalvector; // local attachment vector of the dragentity +.float draglocalangle; +// on draggee: +.entity draggedby; +.float dragmovetype; + float Drag(float force_allow_pick, float ischeat) { BEGIN_CHEAT_FUNCTION(); @@ -889,15 +903,6 @@ float Drag(float force_allow_pick, float ischeat) return false; } -// on dragger: -.float draggravity; -.float dragspeed; // speed of mouse wheel action -.float dragdistance; // distance of dragentity's draglocalvector from view_ofs -.vector draglocalvector; // local attachment vector of the dragentity -.float draglocalangle; -// on draggee: -.entity draggedby; -.float dragmovetype; void Drag_Begin(entity dragger, entity draggee, vector touchpoint) { float tagscale; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 0e9f0dc919..659fae4b26 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1,41 +1,29 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "../warpzonelib/server.qh" - #include "../common/constants.qh" - #include "../common/teams.qh" - #include "../common/util.qh" - #include "../common/net_notice.qh" - #include "../common/monsters/monsters.qh" - #include "../common/monsters/sv_monsters.qh" - #include "../common/weapons/weapons.qh" - #include "t_items.qh" - #include "autocvars.qh" - #include "constants.qh" - #include "defs.qh" - #include "../common/notifications.qh" - #include "../common/deathtypes.qh" - #include "mutators/mutators_include.qh" - #include "vehicles/vehicles_def.qh" - #include "campaign.qh" - #include "../common/mapinfo.qh" - #include "command/common.qh" - #include "command/vote.qh" - #include "../csqcmodellib/sv_model.qh" - #include "anticheat.qh" - #include "cheats.qh" - #include "../common/playerstats.qh" - #include "portals.qh" - #include "g_hook.qh" - #include "scores.qh" - #include "spawnpoints.qh" - #include "ipban.qh" - #include "race.qh" - #include "antilag.qh" - #include "playerdemo.qh" -#endif +#include "waypointsprites.qh" + +#include "cl_impulse.qh" +#include "cl_player.qh" +#include "ent_cs.qh" +#include "g_subs.qh" +#include "ipban.qh" +#include "miscfunctions.qh" +#include "portals.qh" +#include "teamplay.qh" +#include "playerdemo.qh" +#include "secret.qh" + +#include "bot/bot.qh" +#include "bot/navigation.qh" + +#include "weapons/hitplot.qh" +#include "weapons/weaponsystem.qh" + +#include "../common/net_notice.qh" + +#include "../common/monsters/sv_monsters.qh" + +#include "../warpzonelib/server.qh" + +float c1, c2, c3, c4; void send_CSQC_teamnagger() { WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/cl_impulse.qc index e712465098..40c7e318bd 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/cl_impulse.qc @@ -1,19 +1,10 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "../common/constants.qh" - #include "../common/weapons/weapons.qh" - #include "autocvars.qh" - #include "defs.qh" - #include "mutators/mutators_include.qh" - #include "vehicles/vehicles_def.qh" - #include "command/common.qh" - #include "../csqcmodellib/sv_model.qh" - #include "cheats.qh" - #include "round_handler.qh" -#endif +#include "round_handler.qh" + +#include "bot/waypoints.qh" + +#include "weapons/throwing.qh" + +#include "../common/weapons/weapons.qh" /* * Impulse map: diff --git a/qcsrc/server/cl_impulse.qh b/qcsrc/server/cl_impulse.qh new file mode 100644 index 0000000000..c604c56b22 --- /dev/null +++ b/qcsrc/server/cl_impulse.qh @@ -0,0 +1,40 @@ +#ifndef CL_IMPULSE_H +#define CL_IMPULSE_H + +/* + * Impulse map: + * + * 0 reserved (no input) + * 1 to 9, 14: weapon shortcuts + * 10: next weapon according to linear list + * 11: most recently used weapon + * 12: previous weapon according to linear list + * 13: best weapon according to priority list + * 15: next weapon according to priority list + * 16: previous weapon according to priority list + * 17: throw weapon + * 18: next weapon according to sbar_hudselector 1 list + * 19: previous weapon according to sbar_hudselector 1 list + * 20: reload if needed + * + * 30 to 39: create waypoints + * 47: clear personal waypoints + * 48: clear team waypoints + * + * 99: loaded + * + * 140: moving clone + * 141: ctf speedrun + * 142: fixed clone + * 143: emergency teleport + * 148: unfairly eliminate + * + * TODO: + * 200 to 209: prev weapon shortcuts + * 210 to 219: best weapon shortcuts + * 220 to 229: next weapon shortcuts + * 230 to 253: individual weapons (up to 24) + */ + +void ImpulseCommands (void); +#endif \ No newline at end of file diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 9e222690af..8ba66f78d0 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -1,34 +1,10 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "../common/constants.qh" - #include "../common/teams.qh" - #include "../common/util.qh" - #include "../common/animdecide.qh" - #include "../common/weapons/weapons.qh" - #include "weapons/accuracy.qh" - #include "t_items.qh" - #include "autocvars.qh" - #include "constants.qh" - #include "defs.qh" - #include "../common/deathtypes.qh" - #include "mutators/mutators_include.qh" - #include "../common/mapinfo.qh" - #include "command/common.qh" - #include "../csqcmodellib/sv_model.qh" - #include "cheats.qh" - #include "../common/playerstats.qh" - #include "portals.qh" -#endif - -.entity pusher; -.float pushltime; -.float istypefrag; - -.float CopyBody_nextthink; -.void(void) CopyBody_think; +#include "cl_player.qh" +#include "g_triggers.qh" +#include "g_violence.qh" +#include "miscfunctions.qh" + +#include "weapons/weaponstats.qh" + void CopyBody_Think(void) { if(self.CopyBody_nextthink && time > self.CopyBody_nextthink) @@ -223,18 +199,6 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float } } -// g__str: -// If 0, default is used. -// If <0, 0 is used. -// Otherwise, g_str (default value) is used. -// For consistency, negative values there are mapped to zero too. -#define GAMETYPE_DEFAULTED_SETTING(str) \ - ((gametype_setting_tmp = cvar(strcat("g_", GetGametype(), "_" #str))), \ - (gametype_setting_tmp < 0) ? 0 : \ - (gametype_setting_tmp == 0) ? max(0, autocvar_g_##str) : \ - gametype_setting_tmp) - - void calculate_player_respawn_time() { if(g_ca) @@ -322,8 +286,6 @@ void calculate_player_respawn_time() self.respawn_flags = self.respawn_flags | RESPAWN_FORCE; } -void ClientKill_Now_TeamChange(); - void PlayerDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) { float take, save, dh, da, j; @@ -663,7 +625,6 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht } } -.float muted; // to be used by prvm_edictset server playernumber muted 1 float Say(entity source, float teamsay, entity privatesay, string msgin, float floodcontrol) // message "": do not say, just test flood control // return value: @@ -945,7 +906,6 @@ float GetVoiceMessageVoiceType(string type) return VOICETYPE_TEAMRADIO; } -string allvoicesamples; .string GetVoiceMessageSampleField(string type) { GetPlayerSoundSampleField_notFound = 0; @@ -1051,8 +1011,6 @@ float LoadPlayerSounds(string f, float first) return 1; } -.float modelindex_for_playersound; -.float skin_for_playersound; void UpdatePlayerSounds() { if(self.modelindex == self.modelindex_for_playersound) diff --git a/qcsrc/server/cl_player.qh b/qcsrc/server/cl_player.qh new file mode 100644 index 0000000000..6f2aceec3a --- /dev/null +++ b/qcsrc/server/cl_player.qh @@ -0,0 +1,75 @@ +#ifndef CL_PLAYER_H +#define CL_PLAYER_H + +.entity pusher; +.float pushltime; +.float istypefrag; + +.float CopyBody_nextthink; +.void(void) CopyBody_think; +void CopyBody_Think(void); +void CopyBody(float keepvelocity); + +float player_getspecies(); + +void player_setupanimsformodel(); + +void player_anim (void); + +void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force); + +// g__str: +// If 0, default is used. +// If <0, 0 is used. +// Otherwise, g_str (default value) is used. +// For consistency, negative values there are mapped to zero too. +#define GAMETYPE_DEFAULTED_SETTING(str) \ + ((gametype_setting_tmp = cvar(strcat("g_", GetGametype(), "_" #str))), \ + (gametype_setting_tmp < 0) ? 0 : \ + (gametype_setting_tmp == 0) ? max(0, autocvar_g_##str) : \ + gametype_setting_tmp) + + +void calculate_player_respawn_time(); + +void ClientKill_Now_TeamChange(); + +void PlayerDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force); + +.float muted; // to be used by prvm_edictset server playernumber muted 1 +float Say(entity source, float teamsay, entity privatesay, string msgin, float floodcontrol); +// message "": do not say, just test flood control +// return value: +// 1 = accept +// 0 = reject +// -1 = fake accept + +float GetVoiceMessageVoiceType(string type); + +string allvoicesamples; +.string GetVoiceMessageSampleField(string type); + +.string GetPlayerSoundSampleField(string type); + +void PrecacheGlobalSound(string samplestring); + +void PrecachePlayerSounds(string f); + +void ClearPlayerSounds(); + +float LoadPlayerSounds(string f, float first); + +.float modelindex_for_playersound; +.float skin_for_playersound; +void UpdatePlayerSounds(); + +void FakeGlobalSound(string sample, float chan, float voicetype); + +void GlobalSound(string sample, float chan, float voicetype); + +void PlayerSound(.string samplefield, float chan, float voicetype); + +void VoiceMessage(string type, string msg); + +void MoveToTeam(entity client, float team_colour, float type); +#endif \ No newline at end of file diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 19ebcb712a..665f9a3146 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -1,18 +1,7 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../../dpdefs/progsdefs.qh" - #include "../../dpdefs/dpextensions.qh" - #include "../../common/util.qh" - #include "../../common/counting.qh" - #include "../../common/command/shared_defs.qh" - #include "../autocvars.qh" - #include "../defs.qh" - #include "../../common/notifications.qh" - #include "common.qh" - #include "vote.qh" - #include "../scores.qh" -#endif +#include "common.qh" + +#include "../../common/counting.qh" + // ==================================================== // Shared code for server commands, written by Samual @@ -676,70 +665,3 @@ void CommonCommand_(float request, entity caller) } } */ - - -// ================================== -// Macro system for common commands -// ================================== - -// Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;) -#define COMMON_COMMANDS(request,caller,arguments,command) \ - COMMON_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, caller), "Prints a list of all changed server cvars") \ - COMMON_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, caller), "Prints a list of all changed gameplay cvars") \ - COMMON_COMMAND("info", CommonCommand_info(request, caller, arguments), "Request for unique server information set up by admin") \ - COMMON_COMMAND("ladder", CommonCommand_ladder(request, caller), "Get information about top players if supported") \ - COMMON_COMMAND("lsmaps", CommonCommand_lsmaps(request, caller), "List maps which can be used with the current game mode") \ - COMMON_COMMAND("printmaplist", CommonCommand_printmaplist(request, caller), "Display full server maplist reply") \ - COMMON_COMMAND("rankings", CommonCommand_rankings(request, caller), "Print information about rankings") \ - COMMON_COMMAND("records", CommonCommand_records(request, caller), "List top 10 records for the current map") \ - COMMON_COMMAND("teamstatus", CommonCommand_teamstatus(request, caller), "Show information about player and team scores") \ - COMMON_COMMAND("time", CommonCommand_time(request, caller), "Print different formats/readouts of time") \ - COMMON_COMMAND("timein", CommonCommand_timein(request, caller), "Resume the game from being paused with a timeout") \ - COMMON_COMMAND("timeout", CommonCommand_timeout(request, caller), "Call a timeout which pauses the game for certain amount of time unless unpaused") \ - COMMON_COMMAND("vote", VoteCommand(request, caller, arguments, command), "Request an action to be voted upon by players") \ - COMMON_COMMAND("who", CommonCommand_who(request, caller, arguments), "Display detailed client information about all players") \ - /* nothing */ - -void CommonCommand_macro_help(entity caller) -{ - #define COMMON_COMMAND(name,function,description) \ - { print_to(caller, strcat(" ^2", name, "^7: ", description)); } - - COMMON_COMMANDS(0, caller, 0, ""); - #undef COMMON_COMMAND - - return; -} - -float CommonCommand_macro_command(float argc, entity caller, string command) -{ - #define COMMON_COMMAND(name,function,description) \ - { if(name == strtolower(argv(0))) { function; return true; } } - - COMMON_COMMANDS(CMD_REQUEST_COMMAND, caller, argc, command); - #undef COMMON_COMMAND - - return false; -} - -float CommonCommand_macro_usage(float argc, entity caller) -{ - #define COMMON_COMMAND(name,function,description) \ - { if(name == strtolower(argv(1))) { function; return true; } } - - COMMON_COMMANDS(CMD_REQUEST_USAGE, caller, argc, ""); - #undef COMMON_COMMAND - - return false; -} - -void CommonCommand_macro_write_aliases(float fh) -{ - #define COMMON_COMMAND(name,function,description) \ - { CMD_Write_Alias("qc_cmd_svcmd", name, description); } - - COMMON_COMMANDS(0, world, 0, ""); - #undef COMMON_COMMAND - - return; -} diff --git a/qcsrc/server/command/common.qh b/qcsrc/server/command/common.qh index a11ea856a9..4e45af377e 100644 --- a/qcsrc/server/command/common.qh +++ b/qcsrc/server/command/common.qh @@ -1,6 +1,11 @@ #ifndef COMMAND_COMMON_H #define COMMAND_COMMON_H +#include "vote.qh" + +#include "../../common/command/generic.qh" +#include "../../common/command/shared_defs.qh" + // ============================================================ // Shared declarations for server commands, written by Samual // Last updated: December 30th, 2011 @@ -39,4 +44,138 @@ void CommonCommand_macro_write_aliases(float fh); // keep track of the next token to use for argc float next_token; + +// select the proper prefix for usage and other messages +string GetCommandPrefix(entity caller); + +// if client return player nickname, or if server return admin nickname +string GetCallerName(entity caller); + +// verify that the client provided is acceptable for use +float VerifyClientEntity(entity client, float must_be_real, float must_be_bots); + +// if the client is not acceptable, return a string to be used for error messages +string GetClientErrorString(float clienterror, string original_input); + +// is this entity number even in the possible range of entities? +float VerifyClientNumber(float tmp_number); + +entity GetIndexedEntity(float argc, float start_index); + +// find a player which matches the input string, and return their entity +entity GetFilteredEntity(string input); + +// same thing, but instead return their edict number +float GetFilteredNumber(string input); + +// switch between sprint and print depending on whether the receiver is the server or a player +void print_to(entity to, string input); + +// ========================================== +// Supporting functions for common commands +// ========================================== + +// used by CommonCommand_timeout() and CommonCommand_timein() to handle game pausing and messaging and such. +void timeout_handler_reset(); + +void timeout_handler_think(); + +// =================================================== +// Common commands used in both sv_cmd.qc and cmd.qc +// =================================================== + +void CommonCommand_cvar_changes(float request, entity caller); + +void CommonCommand_cvar_purechanges(float request, entity caller); + +void CommonCommand_info(float request, entity caller, float argc); + +void CommonCommand_ladder(float request, entity caller); + +void CommonCommand_lsmaps(float request, entity caller); + +void CommonCommand_printmaplist(float request, entity caller); + +void CommonCommand_rankings(float request, entity caller); + +void CommonCommand_records(float request, entity caller); + +void CommonCommand_teamstatus(float request, entity caller); + +void CommonCommand_time(float request, entity caller); + +void CommonCommand_timein(float request, entity caller); + +void CommonCommand_timeout(float request, entity caller); + +void CommonCommand_who(float request, entity caller, float argc); + + +// ================================== +// Macro system for common commands +// ================================== + +// Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;) +#define COMMON_COMMANDS(request,caller,arguments,command) \ + COMMON_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, caller), "Prints a list of all changed server cvars") \ + COMMON_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, caller), "Prints a list of all changed gameplay cvars") \ + COMMON_COMMAND("info", CommonCommand_info(request, caller, arguments), "Request for unique server information set up by admin") \ + COMMON_COMMAND("ladder", CommonCommand_ladder(request, caller), "Get information about top players if supported") \ + COMMON_COMMAND("lsmaps", CommonCommand_lsmaps(request, caller), "List maps which can be used with the current game mode") \ + COMMON_COMMAND("printmaplist", CommonCommand_printmaplist(request, caller), "Display full server maplist reply") \ + COMMON_COMMAND("rankings", CommonCommand_rankings(request, caller), "Print information about rankings") \ + COMMON_COMMAND("records", CommonCommand_records(request, caller), "List top 10 records for the current map") \ + COMMON_COMMAND("teamstatus", CommonCommand_teamstatus(request, caller), "Show information about player and team scores") \ + COMMON_COMMAND("time", CommonCommand_time(request, caller), "Print different formats/readouts of time") \ + COMMON_COMMAND("timein", CommonCommand_timein(request, caller), "Resume the game from being paused with a timeout") \ + COMMON_COMMAND("timeout", CommonCommand_timeout(request, caller), "Call a timeout which pauses the game for certain amount of time unless unpaused") \ + COMMON_COMMAND("vote", VoteCommand(request, caller, arguments, command), "Request an action to be voted upon by players") \ + COMMON_COMMAND("who", CommonCommand_who(request, caller, arguments), "Display detailed client information about all players") \ + /* nothing */ + +void CommonCommand_macro_help(entity caller) +{ + #define COMMON_COMMAND(name,function,description) \ + { print_to(caller, strcat(" ^2", name, "^7: ", description)); } + + COMMON_COMMANDS(0, caller, 0, ""); + #undef COMMON_COMMAND + + return; +} + +float CommonCommand_macro_command(float argc, entity caller, string command) +{ + #define COMMON_COMMAND(name,function,description) \ + { if(name == strtolower(argv(0))) { function; return true; } } + + COMMON_COMMANDS(CMD_REQUEST_COMMAND, caller, argc, command); + #undef COMMON_COMMAND + + return false; +} + +float CommonCommand_macro_usage(float argc, entity caller) +{ + #define COMMON_COMMAND(name,function,description) \ + { if(name == strtolower(argv(1))) { function; return true; } } + + COMMON_COMMANDS(CMD_REQUEST_USAGE, caller, argc, ""); + #undef COMMON_COMMAND + + return false; +} + +void CommonCommand_macro_write_aliases(float fh) +{ + #define COMMON_COMMAND(name,function,description) \ + { CMD_Write_Alias("qc_cmd_svcmd", name, description); } + + COMMON_COMMANDS(0, world, 0, ""); + #undef COMMON_COMMAND + + return; +} + + #endif \ No newline at end of file diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index a761c5b9ab..f8e8952f98 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -1,6 +1,8 @@ #ifndef SERVER_DEFS_H #define SERVER_DEFS_H +#include "../common/weapons/weapons.qh" + #define INDEPENDENT_ATTACK_FINISHED noref float require_spawnfunc_prefix; // if this float exists, only functions with spawnfunc_ name prefix qualify as spawn functions diff --git a/qcsrc/server/ent_cs.qh b/qcsrc/server/ent_cs.qh new file mode 100644 index 0000000000..0d11f5cb27 --- /dev/null +++ b/qcsrc/server/ent_cs.qh @@ -0,0 +1,32 @@ +#ifndef ENT_CS_H +#define ENT_CS_H + +/** + * The point of these entities is to avoid the problems + * with clientprediction. + * If you add SendEntity to players, the engine will not + * do any prediction anymore, and you'd have to write the whole + * prediction code in CSQC, you want that? :P + * Data can depend on gamemode. For now, it serves as GPS entities + * in onslaught... YAY ;) + */ + +// Beware: do not redefine those in other files +// and NO, you cannot use ".version", which already exists (at least +// it did when I added this) But you have to use .Version +// Capital V + +.entity entcs; + +void entcs_init(); + +float entcs_customize(); + +float entcs_send(entity to, float sf); + +void entcs_think(); + +entity attach_entcs(); + +void detach_entcs(); +#endif \ No newline at end of file diff --git a/qcsrc/server/func_breakable.qc b/qcsrc/server/func_breakable.qc index a4ece016fe..10a0ed2c2f 100644 --- a/qcsrc/server/func_breakable.qc +++ b/qcsrc/server/func_breakable.qc @@ -1,18 +1,4 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "../common/constants.qh" - #include "../common/util.qh" - #include "../common/monsters/monsters.qh" - #include "../common/weapons/weapons.qh" - #include "constants.qh" - #include "defs.qh" - #include "../common/deathtypes.qh" - #include "mutators/mutators_include.qh" - #include "../csqcmodellib/sv_model.qh" -#endif +#include "weapons/common.qh" .entity sprite; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 1809974236..cf2d53c72d 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -1,8 +1,8 @@ +#include "g_damage.qh" + #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #include "../warpzonelib/common.qh" #include "../common/constants.qh" #include "../common/teams.qh" @@ -27,11 +27,6 @@ #include "spawnpoints.qh" #endif -.float dmg; -.float dmg_edge; -.float dmg_force; -.float dmg_radius; - float Damage_DamageInfo_SendEntity(entity to, float sf) { WriteByte(MSG_ENTITY, ENT_CLIENT_DAMAGEINFO); @@ -71,20 +66,6 @@ void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad Net_LinkEntity(e, false, 0.2, Damage_DamageInfo_SendEntity); } -float checkrules_firstblood; - -float yoda; -float damage_goodhits; -float damage_gooddamage; - -.float dmg_team; -.float teamkill_complain; -.float teamkill_soundtime; -.entity teamkill_soundsource; -.entity pusher; -.float istypefrag; -.float taunt_soundtime; - float IsFlying(entity a) { if(a.flags & FL_ONGROUND) @@ -102,9 +83,6 @@ void UpdateFrags(entity player, float f) PlayerTeamScore_AddScore(player, f); } -// NOTE: f=0 means still count as a (positive) kill, but count no frags for it -void W_SwitchWeapon_Force(entity e, float w); -entity GiveFrags_randomweapons; void GiveFrags (entity attacker, entity targ, float f, float deathtype) { // TODO route through PlayerScores instead @@ -304,7 +282,6 @@ void Obituary_SpecialDeath( else { backtrace("Obituary_SpecialDeath called without a special deathtype?\n"); return; } } -float w_deathtype; float Obituary_WeaponDeath( entity notif_target, float murder, @@ -658,11 +635,6 @@ void Unfreeze (entity targ) targ.iceblock = world; } -// these are updated by each Damage call for use in button triggering and such -entity damage_targ; -entity damage_inflictor; -entity damage_attacker; - void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) { float mirrordamage; @@ -977,7 +949,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float } } -float RadiusDamage_running; float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float inflictorselfdamage, float forceintensity, float deathtype, entity directhitentity) // Returns total damage applies to creatures { @@ -1172,15 +1143,6 @@ float RadiusDamage (entity inflictor, entity attacker, float coredamage, float e return RadiusDamageForSource (inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, cantbe, mustbe, false, forceintensity, deathtype, directhitentity); } -.float fire_damagepersec; -.float fire_endtime; -.float fire_deathtype; -.entity fire_owner; -.float fire_hitsound; -.entity fire_burner; - -void fireburner_think(); - float Fire_IsBurning(entity e) { return (time < e.fire_endtime); diff --git a/qcsrc/server/g_damage.qh b/qcsrc/server/g_damage.qh new file mode 100644 index 0000000000..15248515ce --- /dev/null +++ b/qcsrc/server/g_damage.qh @@ -0,0 +1,123 @@ +#ifndef G_DAMAGE_H +#define G_DAMAGE_H + +#if defined(CSQC) +#elif defined(MENUQC) +#elif defined(SVQC) + #include "../dpdefs/progsdefs.qh" + #include "../dpdefs/dpextensions.qh" + #include "../warpzonelib/common.qh" + #include "../common/constants.qh" + #include "../common/teams.qh" + #include "../common/util.qh" + #include "../common/weapons/weapons.qh" + #include "weapons/accuracy.qh" + #include "weapons/csqcprojectile.qh" + #include "weapons/selection.qh" + #include "t_items.qh" + #include "autocvars.qh" + #include "constants.qh" + #include "defs.qh" + #include "../common/notifications.qh" + #include "../common/deathtypes.qh" + #include "mutators/mutators_include.qh" + #include "tturrets/include/turrets_early.qh" + #include "vehicles/vehicles_def.qh" + #include "../csqcmodellib/sv_model.qh" + #include "../common/playerstats.qh" + #include "g_hook.qh" + #include "scores.qh" + #include "spawnpoints.qh" +#endif + +.float dmg; +.float dmg_edge; +.float dmg_force; +.float dmg_radius; + +float Damage_DamageInfo_SendEntity(entity to, float sf); + +void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad, vector force, float deathtype, float bloodtype, entity dmgowner); + +float checkrules_firstblood; + +float yoda; +float damage_goodhits; +float damage_gooddamage; + +.float dmg_team; +.float teamkill_complain; +.float teamkill_soundtime; +.entity teamkill_soundsource; +.entity pusher; +.float istypefrag; +.float taunt_soundtime; + +float IsFlying(entity a); + +void UpdateFrags(entity player, float f); + +// NOTE: f=0 means still count as a (positive) kill, but count no frags for it +void W_SwitchWeapon_Force(entity e, float w); +entity GiveFrags_randomweapons; +void GiveFrags (entity attacker, entity targ, float f, float deathtype); + +string AppendItemcodes(string s, entity player); + +void LogDeath(string mode, float deathtype, entity killer, entity killed); + +void Obituary_SpecialDeath( + entity notif_target, + float murder, + float deathtype, + string s1, string s2, string s3, + float f1, float f2, float f3); + +float w_deathtype; +float Obituary_WeaponDeath( + entity notif_target, + float murder, + float deathtype, + string s1, string s2, string s3, + float f1, float f2); + +void Obituary(entity attacker, entity inflictor, entity targ, float deathtype); + +void Ice_Think(); + +void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypoint); + +void Unfreeze (entity targ); + +// these are updated by each Damage call for use in button triggering and such +entity damage_targ; +entity damage_inflictor; +entity damage_attacker; + +void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force); + +float RadiusDamage_running; +float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float inflictorselfdamage, float forceintensity, float deathtype, entity directhitentity); + // Returns total damage applies to creatures + +float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, float deathtype, entity directhitentity); + +.float fire_damagepersec; +.float fire_endtime; +.float fire_deathtype; +.entity fire_owner; +.float fire_hitsound; +.entity fire_burner; + +void fireburner_think(); + +float Fire_IsBurning(entity e); + +float Fire_AddDamage(entity e, entity o, float d, float t, float dt); + +void Fire_ApplyDamage(entity e); + +void Fire_ApplyEffect(entity e); + +void fireburner_think(); +#endif \ No newline at end of file diff --git a/qcsrc/server/g_subs.qc b/qcsrc/server/g_subs.qc index 856de9ca63..f5fd6b438b 100644 --- a/qcsrc/server/g_subs.qc +++ b/qcsrc/server/g_subs.qc @@ -1,24 +1,7 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "../warpzonelib/common.qh" - #include "../common/util.qh" - #include "autocvars.qh" - #include "defs.qh" - #include "command/common.qh" - #include "../csqcmodellib/sv_model.qh" - #include "antilag.qh" -#endif +#include "g_subs.qh" void SUB_NullThink(void) { } -void() SUB_CalcMoveDone; -void() SUB_CalcAngleMoveDone; -//void() SUB_UseTargets; -void() SUB_Remove; - void spawnfunc_info_null (void) { remove(self); @@ -88,7 +71,6 @@ SUB_Friction Applies some friction to self ================== */ -.float friction; void SUB_Friction (void) { self.nextthink = time; @@ -166,7 +148,6 @@ void SUB_CalcMoveDone (void) self.think1 (); } -.float platmovetype_turn; void SUB_CalcMove_controller_think (void) { entity oldself; @@ -250,12 +231,6 @@ void SUB_CalcMove_controller_setlinear (entity controller, vector org, vector de controller.destvec2 = '0 0 0'; } -float TSPEED_TIME = -1; -float TSPEED_LINEAR = 0; -float TSPEED_START = 1; -float TSPEED_END = 2; -// TODO average too? - void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void() func) { float traveltime; @@ -718,16 +693,6 @@ float angc (float a1, float a2) return a; } -.string lodtarget1; -.string lodtarget2; -.string lodmodel1; -.string lodmodel2; -.float lodmodelindex0; -.float lodmodelindex1; -.float lodmodelindex2; -.float loddistance1; -.float loddistance2; - float LOD_customize() { float d; diff --git a/qcsrc/server/g_subs.qh b/qcsrc/server/g_subs.qh new file mode 100644 index 0000000000..8cc02ebffb --- /dev/null +++ b/qcsrc/server/g_subs.qh @@ -0,0 +1,197 @@ +#ifndef G_SUBS_H +#define G_SUBS_H + +void SUB_NullThink(void); + +void() SUB_CalcMoveDone; +void() SUB_CalcAngleMoveDone; +//void() SUB_UseTargets; +void() SUB_Remove; + +void spawnfunc_info_null (void); + +void setanim(entity e, vector anim, float looping, float override, float restart); + +void updateanim(entity e); + +/* +================== +SUB_Remove + +Remove self +================== +*/ +void SUB_Remove (void); + +/* +================== +SUB_Friction + +Applies some friction to self +================== +*/ +.float friction; +void SUB_Friction (void); + +/* +================== +SUB_VanishOrRemove + +Makes client invisible or removes non-client +================== +*/ +void SUB_VanishOrRemove (entity ent); + +void SUB_SetFade_Think (void); + +/* +================== +SUB_SetFade + +Fade 'ent' out when time >= 'when' +================== +*/ +void SUB_SetFade (entity ent, float when, float fadetime); + +/* +============= +SUB_CalcMove + +calculate self.velocity and self.nextthink to reach dest from +self.origin traveling at speed +=============== +*/ +void SUB_CalcMoveDone (void); + +.float platmovetype_turn; +void SUB_CalcMove_controller_think (void); + +void SUB_CalcMove_controller_setbezier (entity controller, vector org, vector control, vector dest); + +void SUB_CalcMove_controller_setlinear (entity controller, vector org, vector dest); + +float TSPEED_TIME = -1; +float TSPEED_LINEAR = 0; +float TSPEED_START = 1; +float TSPEED_END = 2; +// TODO average too? + +void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void() func); + +void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func); + +void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func); + +/* +============= +SUB_CalcAngleMove + +calculate self.avelocity and self.nextthink to reach destangle from +self.angles rotating + +The calling function should make sure self.think is valid +=============== +*/ +void SUB_CalcAngleMoveDone (void); + +// FIXME: I fixed this function only for rotation around the main axes +void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void() func); + +void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func); + +/* +================== +main + +unused but required by the engine +================== +*/ +void main (void); + +// Misc + +/* +================== +traceline_antilag + +A version of traceline that must be used by SOLID_SLIDEBOX things that want to hit SOLID_CORPSE things with a trace attack +Additionally it moves players back into the past before the trace and restores them afterward. +================== +*/ +void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag, float wz); +void traceline_antilag_force (entity source, vector v1, vector v2, float nomonst, entity forent, float lag); +void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag); +void tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag); +void WarpZone_traceline_antilag_force (entity source, vector v1, vector v2, float nomonst, entity forent, float lag); +void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag); +void WarpZone_tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag); + +float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity); // returns the number of traces done, for benchmarking + +void traceline_inverted (vector v1, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity); + +/* +================== +findbetterlocation + +Returns a point at least 12 units away from walls +(useful for explosion animations, although the blast is performed where it really happened) +Ripped from DPMod +================== +*/ +vector findbetterlocation (vector org, float mindist); + +/* +================== +crandom + +Returns a random number between -1.0 and 1.0 +================== +*/ +float crandom (void); + +/* +================== +Angc used for animations +================== +*/ + + +float angc (float a1, float a2); + +.string lodtarget1; +.string lodtarget2; +.string lodmodel1; +.string lodmodel2; +.float lodmodelindex0; +.float lodmodelindex1; +.float lodmodelindex2; +.float loddistance1; +.float loddistance2; + +float LOD_customize(); + +void LOD_uncustomize(); + +void LODmodel_attach(); + +void ApplyMinMaxScaleAngles(entity e); + +void SetBrushEntityModel(); + +void SetBrushEntityModelNoLOD(); + +/* +================ +InitTrigger +================ +*/ + +void SetMovedir(); + +void InitTrigger(); + +void InitSolidBSPTrigger(); + +float InitMovingBrushTrigger(); +#endif \ No newline at end of file diff --git a/qcsrc/server/g_triggers.qc b/qcsrc/server/g_triggers.qc index a9bc9cce14..e2a3ceaaf6 100644 --- a/qcsrc/server/g_triggers.qc +++ b/qcsrc/server/g_triggers.qc @@ -1,29 +1,11 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "../warpzonelib/util_server.qh" - #include "../common/constants.qh" - #include "../common/util.qh" - #include "../common/monsters/monsters.qh" - #include "../common/weapons/weapons.qh" - #include "weapons/csqcprojectile.qh" - #include "autocvars.qh" - #include "constants.qh" - #include "defs.qh" - #include "../common/notifications.qh" - #include "../common/deathtypes.qh" - #include "../common/mapinfo.qh" -#endif +#include "g_triggers.qh" +#include "t_jumppads.qh" void SUB_DontUseTargets() { } -void() SUB_UseTargets; - void DelayThink() { activator = self.enemy; @@ -155,9 +137,6 @@ void SUB_UseTargets() //============================================================================= -const float SPAWNFLAG_NOMESSAGE = 1; -const float SPAWNFLAG_NOTOUCH = 1; - // the wait time has passed, so set back up for another activation void multi_wait() { @@ -450,7 +429,6 @@ void trigger_hurt_use() self.enemy = world; // let's just destroy it, if taking over is too much work } -.float triggerhurttime; void trigger_hurt_touch() { if (self.active != ACTIVE_ACTIVE) @@ -497,9 +475,6 @@ Any object touching this will be hurt set dmg to damage amount defalt dmg = 5 */ -.entity trigger_hurt_next; -entity trigger_hurt_last; -entity trigger_hurt_first; void spawnfunc_trigger_hurt() { EXACTTRIGGER_INIT; @@ -541,7 +516,6 @@ float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end) // ////////////////////////////////////////////////////////////// -.float triggerhealtime; void trigger_heal_touch() { if (self.active != ACTIVE_ACTIVE) @@ -591,7 +565,6 @@ void spawnfunc_trigger_heal() // ////////////////////////////////////////////////////////////// -.entity trigger_gravity_check; void trigger_gravity_remove(entity own) { if(own.trigger_gravity_check.owner == own) @@ -699,8 +672,6 @@ void spawnfunc_trigger_gravity() //============================================================================= // TODO add a way to do looped sounds with sound(); then complete this entity -.float volume, atten; -void target_speaker_use_off(); void target_speaker_use_activator() { if (!IS_REAL_CLIENT(activator)) @@ -836,11 +807,6 @@ void spawnfunc_func_stardust() { self.effects = EF_STARDUST; } -.string bgmscript; -.float bgmscriptattack; -.float bgmscriptdecay; -.float bgmscriptsustain; -.float bgmscriptrelease; float pointparticles_SendEntity(entity to, float fl) { WriteByte(MSG_ENTITY, ENT_CLIENT_POINTPARTICLES); @@ -1109,7 +1075,6 @@ void spawnfunc_func_snow() Net_LinkEntity(self, false, 0, rainsnow_SendEntity); } -.float modelscale; void misc_laser_aim() { vector a; @@ -1155,7 +1120,6 @@ void misc_laser_init() self.enemy = find(world, targetname, self.target); } -.entity pusher; void misc_laser_think() { vector o; @@ -1366,10 +1330,6 @@ void spawnfunc_misc_laser() } // tZorks trigger impulse / gravity -.float radius; -.float falloff; -.float strength; -.float lastpushtime; // targeted (directional) mode void trigger_impulse_touch1() @@ -1745,11 +1705,6 @@ void spawnfunc_trigger_gamestart() { -.entity voicescript; // attached voice script -.float voicescript_index; // index of next voice, or -1 to use the randomized ones -.float voicescript_nextthink; // time to play next voice -.float voicescript_voiceend; // time when this voice ends - void target_voicescript_clear(entity pl) { pl.voicescript = world; @@ -1913,8 +1868,6 @@ void spawnfunc_trigger_disablerelay() self.use = trigger_disablerelay_use; } -float magicear_matched; -float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorepitch, float mintempo, float maxtempo); string trigger_magicear_processmessage(entity ear, entity source, float teamsay, entity privatesay, string msgin) { float domatch, dotrigger, matchstart, l; @@ -2063,7 +2016,6 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay, return msgin; } -entity magicears; string trigger_magicear_processmessage_forallears(entity source, float teamsay, entity privatesay, string msgin) { entity ear; @@ -2160,7 +2112,6 @@ void spawnfunc_relay_activatetoggle() self.use = relay_activators_use; } -.string chmap, gametype; void spawnfunc_target_changelevel_use() { if(self.gametype != "") diff --git a/qcsrc/server/g_triggers.qh b/qcsrc/server/g_triggers.qh new file mode 100644 index 0000000000..c7e14392a5 --- /dev/null +++ b/qcsrc/server/g_triggers.qh @@ -0,0 +1,388 @@ +#ifndef G_TRIGGERS_H +#define G_TRIGGERS_H + +void SUB_DontUseTargets(); + + +void() SUB_UseTargets; + +void DelayThink(); + +/* +============================== +SUB_UseTargets + +the global "activator" should be set to the entity that initiated the firing. + +If self.delay is set, a DelayedUse entity will be created that will actually +do the SUB_UseTargets after that many seconds have passed. + +Centerprints any self.message to the activator. + +Removes all entities with a targetname that match self.killtarget, +and removes them, so some events can remove other triggers. + +Search for (string)targetname in all entities that +match (string)self.target and call their .use function + +============================== +*/ +void SUB_UseTargets(); + + +//============================================================================= + +const float SPAWNFLAG_NOMESSAGE = 1; +const float SPAWNFLAG_NOTOUCH = 1; + +// the wait time has passed, so set back up for another activation +void multi_wait(); + + +// the trigger was just touched/killed/used +// self.enemy should be set to the activator so it can be held through a delay +// so wait for the delay time before firing +void multi_trigger(); + +void multi_use(); + +void multi_touch(); + +void multi_eventdamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force); + +void multi_reset(); + +/*QUAKED spawnfunc_trigger_multiple (.5 .5 .5) ? notouch +Variable sized repeatable trigger. Must be targeted at one or more entities. If "health" is set, the trigger must be killed to activate each time. +If "delay" is set, the trigger waits some time after activating before firing. +"wait" : Seconds between triggerings. (.2 default) +If notouch is set, the trigger is only fired by other entities, not by touching. +NOTOUCH has been obsoleted by spawnfunc_trigger_relay! +sounds +1) secret +2) beep beep +3) large switch +4) +set "message" to text string +*/ +void spawnfunc_trigger_multiple(); + + +/*QUAKED spawnfunc_trigger_once (.5 .5 .5) ? notouch +Variable sized trigger. Triggers once, then removes itself. You must set the key "target" to the name of another object in the level that has a matching +"targetname". If "health" is set, the trigger must be killed to activate. +If notouch is set, the trigger is only fired by other entities, not by touching. +if "killtarget" is set, any objects that have a matching "target" will be removed when the trigger is fired. +if "angle" is set, the trigger will only fire when someone is facing the direction of the angle. Use "360" for an angle of 0. +sounds +1) secret +2) beep beep +3) large switch +4) +set "message" to text string +*/ +void spawnfunc_trigger_once(); + +//============================================================================= + +/*QUAKED spawnfunc_trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8) +This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages. +*/ +void spawnfunc_trigger_relay(); + +void delay_use(); + +void delay_reset(); + +void spawnfunc_trigger_delay(); + +//============================================================================= + + +void counter_use(); + +void counter_reset(); + +/*QUAKED spawnfunc_trigger_counter (.5 .5 .5) ? nomessage +Acts as an intermediary for an action that takes multiple inputs. + +If nomessage is not set, t will print "1 more.. " etc when triggered and "sequence complete" when finished. + +After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself. +*/ +void spawnfunc_trigger_counter(); + +void trigger_hurt_use(); + +.float triggerhurttime; +void trigger_hurt_touch(); + +/*QUAKED spawnfunc_trigger_hurt (.5 .5 .5) ? +Any object touching this will be hurt +set dmg to damage amount +defalt dmg = 5 +*/ +.entity trigger_hurt_next; +entity trigger_hurt_last; +entity trigger_hurt_first; +void spawnfunc_trigger_hurt(); + +float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end); + +////////////////////////////////////////////////////////////// +// +// +// +//Trigger heal --a04191b92fbd93aa67214ef7e72d6d2e +// +////////////////////////////////////////////////////////////// + +.float triggerhealtime; +void trigger_heal_touch(); + +void spawnfunc_trigger_heal(); + + +////////////////////////////////////////////////////////////// +// +// +// +//End trigger_heal +// +////////////////////////////////////////////////////////////// + +.entity trigger_gravity_check; +void trigger_gravity_remove(entity own); +void trigger_gravity_check_think(); + +void trigger_gravity_use(); + +void trigger_gravity_touch(); + +void spawnfunc_trigger_gravity(); + +//============================================================================= + +// TODO add a way to do looped sounds with sound(); then complete this entity +.float volume, atten; +void target_speaker_use_off(); +void target_speaker_use_activator(); +void target_speaker_use_on(); +void target_speaker_use_off(); +void target_speaker_reset(); + +void spawnfunc_target_speaker(); + + +void spawnfunc_func_stardust(); + +.string bgmscript; +.float bgmscriptattack; +.float bgmscriptdecay; +.float bgmscriptsustain; +.float bgmscriptrelease; +float pointparticles_SendEntity(entity to, float fl); + +void pointparticles_use(); + +void pointparticles_think(); + +void pointparticles_reset(); + +void spawnfunc_func_pointparticles(); + +void spawnfunc_func_sparks(); + +float rainsnow_SendEntity(entity to, float sf); + +/*QUAKED spawnfunc_func_rain (0 .5 .8) ? +This is an invisible area like a trigger, which rain falls inside of. + +Keys: +"velocity" + falling direction (should be something like '0 0 -700', use the X and Y velocity for wind) +"cnt" + sets color of rain (default 12 - white) +"count" + adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000 +*/ +void spawnfunc_func_rain(); + + +/*QUAKED spawnfunc_func_snow (0 .5 .8) ? +This is an invisible area like a trigger, which snow falls inside of. + +Keys: +"velocity" + falling direction (should be something like '0 0 -300', use the X and Y velocity for wind) +"cnt" + sets color of rain (default 12 - white) +"count" + adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000 +*/ +void spawnfunc_func_snow(); + +.float modelscale; +void misc_laser_aim(); + +void misc_laser_init(); + +.entity pusher; +void misc_laser_think(); + +float laser_SendEntity(entity to, float fl); + +/*QUAKED spawnfunc_misc_laser (.5 .5 .5) ? START_ON DEST_IS_FIXED +Any object touching the beam will be hurt +Keys: +"target" + spawnfunc_target_position where the laser ends +"mdl" + name of beam end effect to use +"colormod" + color of the beam (default: red) +"dmg" + damage per second (-1 for a laser that kills immediately) +*/ +void laser_use(); + +void laser_reset(); + +void spawnfunc_misc_laser(); + +// tZorks trigger impulse / gravity +.float radius; +.float falloff; +.float strength; +.float lastpushtime; + +// targeted (directional) mode +void trigger_impulse_touch1(); + +// Directionless (accelerator/decelerator) mode +void trigger_impulse_touch2(); + +// Spherical (gravity/repulsor) mode +void trigger_impulse_touch3(); + +/*QUAKED spawnfunc_trigger_impulse (.5 .5 .5) ? +-------- KEYS -------- +target : If this is set, this points to the spawnfunc_target_position to which the player will get pushed. + If not, this trigger acts like a damper/accelerator field. + +strength : This is how mutch force to add in the direction of .target each second + when .target is set. If not, this is hoe mutch to slow down/accelerate + someting cought inside this trigger. (1=no change, 0,5 half speed rougthly each tic, 2 = doubble) + +radius : If set, act as a spherical device rather then a liniar one. + +falloff : 0 = none, 1 = liniar, 2 = inverted liniar + +-------- NOTES -------- +Use a brush textured with common/origin in the trigger entity to determine the origin of the force +in directional and sperical mode. For damper/accelerator mode this is not nessesary (and has no effect). +*/ + +void spawnfunc_trigger_impulse(); + +/*QUAKED spawnfunc_trigger_flipflop (.5 .5 .5) (-8 -8 -8) (8 8 8) START_ENABLED +"Flip-flop" trigger gate... lets only every second trigger event through +*/ +void flipflop_use(); + +void spawnfunc_trigger_flipflop(); + +/*QUAKED spawnfunc_trigger_monoflop (.5 .5 .5) (-8 -8 -8) (8 8 8) +"Mono-flop" trigger gate... turns one trigger event into one "on" and one "off" event, separated by a delay of "wait" +*/ +void monoflop_use(); +void monoflop_fixed_use(); + +void monoflop_think(); + +void monoflop_reset(); + +void spawnfunc_trigger_monoflop(); + +void multivibrator_send(); + +void multivibrator_toggle(); + +void multivibrator_reset(); + +/*QUAKED trigger_multivibrator (.5 .5 .5) (-8 -8 -8) (8 8 8) START_ON +"Multivibrator" trigger gate... repeatedly sends trigger events. When triggered, turns on or off. +-------- KEYS -------- +target: trigger all entities with this targetname when it goes off +targetname: name that identifies this entity so it can be triggered; when off, it always uses the OFF state +phase: offset of the timing +wait: "on" cycle time (default: 1) +respawntime: "off" cycle time (default: same as wait) +-------- SPAWNFLAGS -------- +START_ON: assume it is already turned on (when targeted) +*/ +void spawnfunc_trigger_multivibrator(); + + +void follow_init(); + +void spawnfunc_misc_follow(); + + + +void gamestart_use(); + +void spawnfunc_trigger_gamestart(); + + + + +.entity voicescript; // attached voice script +.float voicescript_index; // index of next voice, or -1 to use the randomized ones +.float voicescript_nextthink; // time to play next voice +.float voicescript_voiceend; // time when this voice ends + +void target_voicescript_clear(entity pl); + +void target_voicescript_use(); + +void target_voicescript_next(entity pl); + +void spawnfunc_target_voicescript(); + + + +void trigger_relay_teamcheck_use(); + +void trigger_relay_teamcheck_reset(); + +void spawnfunc_trigger_relay_teamcheck(); + + + +void trigger_disablerelay_use(); + +void spawnfunc_trigger_disablerelay(); + +float magicear_matched; +float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorepitch, float mintempo, float maxtempo); +string trigger_magicear_processmessage(entity ear, entity source, float teamsay, entity privatesay, string msgin); + +entity magicears; +string trigger_magicear_processmessage_forallears(entity source, float teamsay, entity privatesay, string msgin); + +void spawnfunc_trigger_magicear(); + +void relay_activators_use(); + +void spawnfunc_relay_activate(); + +void spawnfunc_relay_deactivate(); + +void spawnfunc_relay_activatetoggle(); + +.string chmap, gametype; +void spawnfunc_target_changelevel_use(); + +void spawnfunc_target_changelevel(); +#endif \ No newline at end of file diff --git a/qcsrc/server/g_violence.qc b/qcsrc/server/g_violence.qc index dc337c1a5c..fdff4a66f3 100644 --- a/qcsrc/server/g_violence.qc +++ b/qcsrc/server/g_violence.qc @@ -1,14 +1,4 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "../common/constants.qh" - #include "../common/util.qh" - #include "constants.qh" - #include "defs.qh" - #include "../common/mapinfo.qh" -#endif +#include "g_violence.qh" float Violence_GibSplash_SendEntity(entity to, float sf) { diff --git a/qcsrc/server/g_violence.qh b/qcsrc/server/g_violence.qh new file mode 100644 index 0000000000..19072c8211 --- /dev/null +++ b/qcsrc/server/g_violence.qh @@ -0,0 +1,10 @@ +#ifndef G_VIOLENCE_H +#define G_VIOLENCE_H + +float Violence_GibSplash_SendEntity(entity to, float sf); + +// TODO maybe convert this to a TE? +void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker); + +void Violence_GibSplash(entity source, float type, float amount, entity attacker); +#endif \ No newline at end of file diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 1557fdc526..4be3789647 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1,8 +1,10 @@ +#include "g_world.qh" + +#include "../common/buffs.qh" + #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #include "../common/constants.qh" #include "../common/stats.qh" #include "../common/teams.qh" @@ -1578,15 +1580,6 @@ void CheckRules_Player() // (div0: and that in CheckRules_World please) } -float checkrules_equality; -float checkrules_suddendeathwarning; -float checkrules_suddendeathend; -float checkrules_overtimesadded; //how many overtimes have been already added - -const float WINNING_NO = 0; // no winner, but time limits may terminate the game -const float WINNING_YES = 1; // winner found -const float WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached -const float WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW float InitiateSuddenDeath() { diff --git a/qcsrc/server/g_world.qh b/qcsrc/server/g_world.qh new file mode 100644 index 0000000000..db51c3b1bf --- /dev/null +++ b/qcsrc/server/g_world.qh @@ -0,0 +1,17 @@ +#ifndef G_WORLD_H +#define G_WORLD_H + +float checkrules_equality; +float checkrules_suddendeathwarning; +float checkrules_suddendeathend; +float checkrules_overtimesadded; //how many overtimes have been already added + +const float WINNING_NO = 0; // no winner, but time limits may terminate the game +const float WINNING_YES = 1; // winner found +const float WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached +const float WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW + +void CheckRules_Player(); +void IntermissionThink(); + +#endif \ No newline at end of file diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 6ff694ab4b..a7ba7314da 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -519,7 +519,7 @@ vector randompos(vector m1, vector m2) -float sound_allowed(float dest, entity e) +float sound_allowed(float _dest, entity e) { // sounds from world may always pass for(0;;) @@ -534,7 +534,7 @@ float sound_allowed(float dest, entity e) break; } // sounds to self may always pass - if (dest == MSG_ONE) + if (_dest == MSG_ONE) if (e == msg_entity) return true; // sounds by players can be removed @@ -546,18 +546,18 @@ float sound_allowed(float dest, entity e) } #undef sound -void sound(entity e, float chan, string samp, float vol, float atten) +void sound(entity e, float chan, string samp, float vol, float _atten) { if (!sound_allowed(MSG_BROADCAST, e)) return; - sound7(e, chan, samp, vol, atten, 0, 0); + sound7(e, chan, samp, vol, _atten, 0, 0); } -void soundtoat(float dest, entity e, vector o, float chan, string samp, float vol, float atten) +void soundtoat(float _dest, entity e, vector o, float chan, string samp, float vol, float _atten) { float entno, idx; - if (!sound_allowed(dest, e)) + if (!sound_allowed(_dest, e)) return; entno = num_for_edict(e); @@ -566,61 +566,61 @@ void soundtoat(float dest, entity e, vector o, float chan, string samp, float vo float sflags; sflags = 0; - atten = floor(atten * 64); + _atten = floor(_atten * 64); vol = floor(vol * 255); if (vol != 255) sflags |= SND_VOLUME; - if (atten != 64) + if (_atten != 64) sflags |= SND_ATTENUATION; if (entno >= 8192 || chan < 0 || chan > 7) sflags |= SND_LARGEENTITY; if (idx >= 256) sflags |= SND_LARGESOUND; - WriteByte(dest, SVC_SOUND); - WriteByte(dest, sflags); + WriteByte(_dest, SVC_SOUND); + WriteByte(_dest, sflags); if (sflags & SND_VOLUME) - WriteByte(dest, vol); + WriteByte(_dest, vol); if (sflags & SND_ATTENUATION) - WriteByte(dest, atten); + WriteByte(_dest, _atten); if (sflags & SND_LARGEENTITY) { - WriteShort(dest, entno); - WriteByte(dest, chan); + WriteShort(_dest, entno); + WriteByte(_dest, chan); } else { - WriteShort(dest, entno * 8 + chan); + WriteShort(_dest, entno * 8 + chan); } if (sflags & SND_LARGESOUND) - WriteShort(dest, idx); + WriteShort(_dest, idx); else - WriteByte(dest, idx); + WriteByte(_dest, idx); - WriteCoord(dest, o.x); - WriteCoord(dest, o.y); - WriteCoord(dest, o.z); + WriteCoord(_dest, o.x); + WriteCoord(_dest, o.y); + WriteCoord(_dest, o.z); } -void soundto(float dest, entity e, float chan, string samp, float vol, float atten) +void soundto(float _dest, entity e, float chan, string samp, float vol, float _atten) { vector o; - if (!sound_allowed(dest, e)) + if (!sound_allowed(_dest, e)) return; o = e.origin + 0.5 * (e.mins + e.maxs); - soundtoat(dest, e, o, chan, samp, vol, atten); + soundtoat(_dest, e, o, chan, samp, vol, _atten); } -void soundat(entity e, vector o, float chan, string samp, float vol, float atten) +void soundat(entity e, vector o, float chan, string samp, float vol, float _atten) { - soundtoat(((chan & 8) ? MSG_ALL : MSG_BROADCAST), e, o, chan, samp, vol, atten); + soundtoat(((chan & 8) ? MSG_ALL : MSG_BROADCAST), e, o, chan, samp, vol, _atten); } -void stopsoundto(float dest, entity e, float chan) +void stopsoundto(float _dest, entity e, float chan) { float entno; - if (!sound_allowed(dest, e)) + if (!sound_allowed(_dest, e)) return; entno = num_for_edict(e); @@ -632,22 +632,22 @@ void stopsoundto(float dest, entity e, float chan) sflags = SND_LARGEENTITY; if (idx >= 256) sflags |= SND_LARGESOUND; - WriteByte(dest, SVC_SOUND); - WriteByte(dest, sflags); - WriteShort(dest, entno); - WriteByte(dest, chan); + WriteByte(_dest, SVC_SOUND); + WriteByte(_dest, sflags); + WriteShort(_dest, entno); + WriteByte(_dest, chan); if (sflags & SND_LARGESOUND) - WriteShort(dest, idx); + WriteShort(_dest, idx); else - WriteByte(dest, idx); - WriteCoord(dest, e.origin.x); - WriteCoord(dest, e.origin.y); - WriteCoord(dest, e.origin.z); + WriteByte(_dest, idx); + WriteCoord(_dest, e.origin.x); + WriteCoord(_dest, e.origin.y); + WriteCoord(_dest, e.origin.z); } else { - WriteByte(dest, SVC_STOPSOUND); - WriteShort(dest, entno * 8 + chan); + WriteByte(_dest, SVC_STOPSOUND); + WriteShort(_dest, entno * 8 + chan); } } void stopsound(entity e, float chan) @@ -668,7 +668,7 @@ void play2(entity e, string filename) // use this one if you might be causing spam (e.g. from touch functions that might get called more than once per frame) .float spamtime; -float spamsound(entity e, float chan, string samp, float vol, float atten) +float spamsound(entity e, float chan, string samp, float vol, float _atten) { if (!sound_allowed(MSG_BROADCAST, e)) return false; @@ -676,7 +676,7 @@ float spamsound(entity e, float chan, string samp, float vol, float atten) if (time > e.spamtime) { e.spamtime = time; - sound(e, chan, samp, vol, atten); + sound(e, chan, samp, vol, _atten); return true; } return false; @@ -1000,8 +1000,6 @@ void InitializeEntitiesRun() remove = remove_unsafely; } -.float uncustomizeentityforclient_set; -.void(void) uncustomizeentityforclient; void UncustomizeEntitiesRun() { entity oldself; @@ -1017,10 +1015,7 @@ void SetCustomizer(entity e, float(void) customizer, void(void) uncustomizer) e.uncustomizeentityforclient_set = !!uncustomizer; } -.float nottargeted; -#define IFTARGETED if(!self.nottargeted && self.targetname != "") -void() SUB_Remove; void Net_LinkEntity(entity e, float docull, float dt, float(entity, float) sendfunc) { vector mi, ma; @@ -1239,10 +1234,7 @@ float WarpZone_Projectile_Touch_ImpactFilter_Callback() UpdateCSQCProjectile(self); return false; } -#define PROJECTILE_TOUCH if(WarpZone_Projectile_Touch()) return -#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) -#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER) || ((dt) == DEATH_SLIME) || ((dt) == DEATH_LAVA) || ((dt) == DEATH_SWAMP)) void URI_Get_Callback(float id, float status, string data) { @@ -1728,26 +1720,6 @@ float ExponentialFalloff(float mindist, float maxdist, float halflifedist, float } - - -#ifdef RELEASE -#define cvar_string_normal builtin_cvar_string -#define cvar_normal builtin_cvar -#else -string cvar_string_normal(string n) -{ - if (!(cvar_type(n) & 1)) - backtrace(strcat("Attempt to access undefined cvar: ", n)); - return builtin_cvar_string(n); -} - -float cvar_normal(string n) -{ - return stof(cvar_string_normal(n)); -} -#endif -#define cvar_set_normal builtin_cvar_set - void defer_think() { entity oself; diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh index a6d92ab8a2..a38d6046a4 100644 --- a/qcsrc/server/miscfunctions.qh +++ b/qcsrc/server/miscfunctions.qh @@ -1,20 +1,110 @@ #ifndef MISCFUNCTIONS_H #define MISCFUNCTIONS_H +#include "t_items.qh" + +#include "mutators/base.qh" +#include "mutators/gamemode_race.qh" + +#include "../common/constants.qh" +#include "../common/mapinfo.qh" + +#ifdef RELEASE +#define cvar_string_normal builtin_cvar_string +#define cvar_normal builtin_cvar +#else +string cvar_string_normal(string n) +{ + if (!(cvar_type(n) & 1)) + backtrace(strcat("Attempt to access undefined cvar: ", n)); + return builtin_cvar_string(n); +} + +float cvar_normal(string n) +{ + return stof(cvar_string_normal(n)); +} +#endif +#define cvar_set_normal builtin_cvar_set + +.vector dropped_origin; +.void(void) uncustomizeentityforclient; +.float uncustomizeentityforclient_set; +.float nottargeted; + + +float DistributeEvenly_amount; +float DistributeEvenly_totalweight; var void remove(entity e); void objerror(string s); void droptofloor(); -.vector dropped_origin; +void() spawnfunc_info_player_deathmatch; // needed for the other spawnpoints +void() spawnpoint_use; +void() SUB_Remove; + +void attach_sameorigin(entity e, entity to, string tag); + +void crosshair_trace(entity pl); + +void crosshair_trace_plusvisibletriggers(entity pl); + +void detach_sameorigin(entity e); + +void follow_sameorigin(entity e, entity to); + +string formatmessage(string msg); + +void GameLogEcho(string s); + +void GameLogInit(); + +void GameLogClose(); + +void GetCvars(float f); + +string GetMapname(); + +float isPushable(entity e); + +float LostMovetypeFollow(entity ent); + +float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance); + +string NearestLocation(vector p); + +void play2(entity e, string filename); + +string playername(entity p); + +void precache(); + +void remove_safely(entity e); + +void remove_unsafely(entity e); + +void SetMovetypeFollow(entity ent, entity e); + +vector shotorg_adjust_values(vector vecs, float y_is_right, float visual, float algn); + +void soundto(float dest, entity e, float chan, string samp, float vol, float atten); + +void stopsound(entity e, float chan); + +float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma); void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag); + +void WarpZone_crosshair_trace(entity pl); + void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag); -void() spawnfunc_info_player_deathmatch; // needed for the other spawnpoints -void() spawnpoint_use; -string GetMapname(); -float DistributeEvenly_amount; -float DistributeEvenly_totalweight; +#define IFTARGETED if(!self.nottargeted && self.targetname != "") + +#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) +#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER) || ((dt) == DEATH_SLIME) || ((dt) == DEATH_LAVA) || ((dt) == DEATH_SWAMP)) + +#define PROJECTILE_TOUCH if(WarpZone_Projectile_Touch()) return #define move_out_of_solid(e) WarpZoneLib_MoveOutOfSolid(e) diff --git a/qcsrc/server/pathlib/debug.qc b/qcsrc/server/pathlib/debug.qc index d432221f25..4f73b24733 100644 --- a/qcsrc/server/pathlib/debug.qc +++ b/qcsrc/server/pathlib/debug.qc @@ -65,19 +65,19 @@ void pathlib_showsquare2(entity node ,vector ncolor,float align) } } -void pathlib_showsquare(vector where,float goodsquare,float lifetime) +void pathlib_showsquare(vector where,float goodsquare,float _lifetime) { entity s; - if(!lifetime) - lifetime = time + 30; + if(!_lifetime) + _lifetime = time + 30; else - lifetime += time; + _lifetime += time; s = spawn(); s.alpha = 0.25; s.think = SUB_Remove; - s.nextthink = lifetime; + s.nextthink = _lifetime; s.scale = pathlib_gridsize / 512.001; s.solid = SOLID_NOT; @@ -95,19 +95,19 @@ void pathlib_showsquare(vector where,float goodsquare,float lifetime) setorigin(s,where); } -void pathlib_showedge(vector where,float lifetime,float rot) +void pathlib_showedge(vector where,float _lifetime,float rot) { entity e; - if(!lifetime) - lifetime = time + 30; + if(!_lifetime) + _lifetime = time + 30; else - lifetime += time; + _lifetime += time; e = spawn(); e.alpha = 0.25; e.think = SUB_Remove; - e.nextthink = lifetime; + e.nextthink = _lifetime; e.scale = pathlib_gridsize / 512; e.solid = SOLID_NOT; setorigin(e,where); diff --git a/qcsrc/server/progs.src b/qcsrc/server/progs.src index e0078e0875..b2401bce58 100644 --- a/qcsrc/server/progs.src +++ b/qcsrc/server/progs.src @@ -1,4 +1,4 @@ -../../progs.dat // output filename +../../progs.dat ../common/util-pre.qh sys-pre.qh @@ -6,148 +6,72 @@ sys-pre.qh ../dpdefs/dpextensions.qh sys-post.qh -../warpzonelib/anglestransform.qh -../warpzonelib/mathlib.qh -../warpzonelib/common.qh -../warpzonelib/util_server.qh -../warpzonelib/server.qh -../common/constants.qh -../common/stats.qh -../common/teams.qh -../common/util.qh -../common/nades.qh -../common/buffs.qh -../common/test.qh -../common/counting.qh -../common/urllib.qh -../common/command/markup.qh -../common/command/rpn.qh -../common/command/generic.qh -../common/command/shared_defs.qh -../common/net_notice.qh -../common/animdecide.qh -../common/monsters/monsters.qh -../common/monsters/sv_monsters.qh -../common/monsters/spawn.qh - -../common/weapons/config.qh -../common/weapons/weapons.qh // TODO -weapons/accuracy.qh -weapons/common.qh -weapons/csqcprojectile.qh // TODO -weapons/hitplot.qh -weapons/selection.qh -weapons/spawning.qh -weapons/throwing.qh -weapons/tracing.qh -weapons/weaponstats.qh -weapons/weaponsystem.qh - -t_items.qh - -autocvars.qh -constants.qh -defs.qh // Should rename this, it has fields and globals - -../common/notifications.qh // must be after autocvars -../common/deathtypes.qh // must be after notifications - -mutators/mutators_include.qh - -//// tZork Turrets //// -tturrets/include/turrets_early.qh -vehicles/vehicles_def.qh - -campaign.qh -../common/campaign_common.qh -../common/mapinfo.qh - -command/common.qh -command/banning.qh -command/radarmap.qh -command/vote.qh -command/getreplies.qh -command/cmd.qh -command/sv_cmd.qh - - -../common/csqcmodel_settings.qh -../csqcmodellib/common.qh -../csqcmodellib/sv_model.qh +anticheat.qc +antilag.qc +// assault.qc +campaign.qc +cheats.qc +cl_client.qc +cl_impulse.qc +cl_physics.qc +cl_player.qc csqceffects.qc - -anticheat.qh -cheats.qh -../common/playerstats.qh - -portals.qh - -g_hook.qh // TODO - -scores.qh - -spawnpoints.qh - -mapvoting.qh - -ipban.qh - -race.qh - -antilag.qh - -playerdemo.qh - -round_handler.qh - -// singleplayer stuff -item_key.qh -secret.qh - -scores_rules.qc - -miscfunctions.qc - -mutators/mutators.qc - -waypointsprites.qc - -bot/bot.qc - +// ctf.qc +// domination.qc +ent_cs.qc +func_breakable.qc +g_casings.qc +g_damage.qc +g_hook.qc +g_models.qc g_subs.qc - g_tetris.qc - -//runematch.qc - +g_triggers.qc g_violence.qc -g_damage.qc - -teamplay.qc - -cl_physics.qc - -// tZork's libs -movelib.qc -steerlib.qc -pathlib/pathlib.qh - g_world.qc -g_casings.qc - +ipban.qc +item_key.qc mapvoting.qc - +miscfunctions.qc +// mode_onslaught.qc +movelib.qc +// nexball.qc +playerdemo.qc +portals.qc +race.qc +round_handler.qc +// runematch.qc +scores.qc +scores_rules.qc +secret.qc +spawnpoints.qc +steerlib.qc +sv_main.qc +target_music.qc +target_spawn.qc +teamplay.qc +t_halflife.qc +t_items.qc t_jumppads.qc +t_plats.qc +t_quake3.qc +t_quake.qc +t_swamp.qc t_teleporters.qc +waypointsprites.qc -sv_main.qc +bot/bot.qc -g_triggers.qc -g_models.qc +command/banning.qc +command/cmd.qc +command/common.qc +command/getreplies.qc +command/radarmap.qc +command/sv_cmd.qc +command/vote.qc -// singleplayer stuff -item_key.qc -secret.qc +mutators/mutators_include.qc +mutators/mutators.qc weapons/accuracy.qc weapons/common.qc @@ -159,99 +83,32 @@ weapons/throwing.qc weapons/tracing.qc weapons/weaponstats.qc weapons/weaponsystem.qc -../common/weapons/config.qc -../common/weapons/weapons.qc // TODO - -t_items.qc -cl_impulse.qc - -ent_cs.qc - -cl_player.qc -cl_client.qc -t_plats.qc -antilag.qc -//ctf.qc -//domination.qc -//mode_onslaught.qc -//nexball.qc -g_hook.qc - -t_swamp.qc - -campaign.qc +../common/animdecide.qc +../common/buffs.qc ../common/campaign_file.qc ../common/campaign_setup.qc -../common/urllib.qc - +../common/command/generic.qc ../common/command/markup.qc ../common/command/rpn.qc -../common/command/generic.qc -../common/net_notice.qc - -command/common.qc -command/banning.qc -command/radarmap.qc -command/vote.qc -command/getreplies.qc -command/cmd.qc -command/sv_cmd.qc - -//assault.qc - -ipban.qc - ../common/mapinfo.qc - -t_quake3.qc -t_halflife.qc -t_quake.qc - -race.qc - - -//// tZork Turrets //// -tturrets/include/turrets.qh -vehicles/vehicles.qh - -scores.qc - -spawnpoints.qc - -portals.qc - -target_spawn.qc -func_breakable.qc -target_music.qc - -../common/nades.qc -../common/buffs.qc - -../csqcmodellib/sv_model.qc - -playerdemo.qc - -anticheat.qc -cheats.qc -../common/playerstats.qc - -round_handler.qc - -../common/monsters/sv_monsters.qc ../common/monsters/monsters.qc - ../common/monsters/spawn.qc +../common/monsters/sv_monsters.qc +../common/nades.qc +../common/net_notice.qc +../common/notifications.qc +../common/playerstats.qc +../common/test.qc +../common/urllib.qc +../common/util.qc +../common/weapons/config.qc +../common/weapons/weapons.qc // TODO -mutators/mutators_include.qc +../csqcmodellib/sv_model.qc ../warpzonelib/anglestransform.qc -../warpzonelib/mathlib.qc ../warpzonelib/common.qc -../warpzonelib/util_server.qc +../warpzonelib/mathlib.qc ../warpzonelib/server.qc - -../common/animdecide.qc -../common/test.qc -../common/util.qc -../common/notifications.qc +../warpzonelib/util_server.qc \ No newline at end of file diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index e87f402efd..bb7f0eccc2 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -1,23 +1,6 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "../warpzonelib/util_server.qh" - #include "../common/constants.qh" - #include "../common/util.qh" - #include "autocvars.qh" - #include "defs.qh" - #include "../common/notifications.qh" - #include "../common/deathtypes.qh" - #include "mutators/mutators_include.qh" - #include "../common/mapinfo.qh" - #include "command/sv_cmd.qh" - #include "portals.qh" - #include "scores.qh" - #include "spawnpoints.qh" - #include "race.qh" -#endif +#include "race.qh" + +void W_Porto_Fail(float failhard); float race_readTime(string map, float pos) { diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index b940294fd9..6ece837e83 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -1,19 +1,4 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "../common/constants.qh" - #include "../common/teams.qh" - #include "../common/util.qh" - #include "autocvars.qh" - #include "constants.qh" - #include "defs.qh" - #include "mutators/mutators_include.qh" - #include "../common/mapinfo.qh" - #include "../common/playerstats.qh" - #include "scores.qh" -#endif +#include "scores.qh" .entity scorekeeper; entity teamscorekeepers[16]; diff --git a/qcsrc/server/scores_rules.qc b/qcsrc/server/scores_rules.qc index c00434afd6..4d5296c816 100644 --- a/qcsrc/server/scores_rules.qc +++ b/qcsrc/server/scores_rules.qc @@ -8,7 +8,7 @@ #include "scores.qh" #endif -float c1, c2, c3, c4; +//float c1, c2, c3, c4; void CheckAllowedTeams (entity for_whom); // NOTE: SP_ constants may not be >= MAX_SCORE; ST_constants may not be >= MAX_TEAMSCORE diff --git a/qcsrc/server/steerlib.qc b/qcsrc/server/steerlib.qc index fbd8f4533d..4391c17821 100644 --- a/qcsrc/server/steerlib.qc +++ b/qcsrc/server/steerlib.qc @@ -176,13 +176,13 @@ vector steerlib_dodge(vector point,vector dodge_dir,float min_distance) Group will move towards the unified direction while keeping close to eachother. **/ .float flock_id; -vector steerlib_flock(float radius, float standoff,float separation_force,float flock_force) +vector steerlib_flock(float _radius, float standoff,float separation_force,float flock_force) { entity flock_member; vector push = '0 0 0', pull = '0 0 0'; float ccount = 0; - flock_member = findradius(self.origin,radius); + flock_member = findradius(self.origin, _radius); while(flock_member) { if(flock_member != self) @@ -190,7 +190,7 @@ vector steerlib_flock(float radius, float standoff,float separation_force,float { ++ccount; push = push + (steerlib_repell(flock_member.origin,standoff) * separation_force); - pull = pull + (steerlib_arrive(flock_member.origin + flock_member.velocity,radius) * flock_force); + pull = pull + (steerlib_arrive(flock_member.origin + flock_member.velocity, _radius) * flock_force); } flock_member = flock_member.chain; } @@ -202,13 +202,13 @@ vector steerlib_flock(float radius, float standoff,float separation_force,float Group will move towards the unified direction while keeping close to eachother. xy only version (for ground movers). **/ -vector steerlib_flock2d(float radius, float standoff,float separation_force,float flock_force) +vector steerlib_flock2d(float _radius, float standoff,float separation_force,float flock_force) { entity flock_member; vector push = '0 0 0', pull = '0 0 0'; float ccount = 0; - flock_member = findradius(self.origin,radius); + flock_member = findradius(self.origin,_radius); while(flock_member) { if(flock_member != self) @@ -216,7 +216,7 @@ vector steerlib_flock2d(float radius, float standoff,float separation_force,floa { ++ccount; push = push + (steerlib_repell(flock_member.origin, standoff) * separation_force); - pull = pull + (steerlib_arrive(flock_member.origin + flock_member.velocity, radius) * flock_force); + pull = pull + (steerlib_arrive(flock_member.origin + flock_member.velocity, _radius) * flock_force); } flock_member = flock_member.chain; } @@ -233,13 +233,13 @@ vector steerlib_flock2d(float radius, float standoff,float separation_force,floa This results in a aligned movement (?!) much like flocking. **/ -vector steerlib_swarm(float radius, float standoff,float separation_force,float swarm_force) +vector steerlib_swarm(float _radius, float standoff,float separation_force,float swarm_force) { entity swarm_member; vector force = '0 0 0', center = '0 0 0'; float ccount = 0; - swarm_member = findradius(self.origin,radius); + swarm_member = findradius(self.origin,_radius); while(swarm_member) { @@ -253,7 +253,7 @@ vector steerlib_swarm(float radius, float standoff,float separation_force,float } center = center * (1 / ccount); - force = force + (steerlib_arrive(center,radius) * swarm_force); + force = force + (steerlib_arrive(center,_radius) * swarm_force); return force; } diff --git a/qcsrc/server/t_jumppads.qc b/qcsrc/server/t_jumppads.qc index 3db56c6ee0..17b574d158 100644 --- a/qcsrc/server/t_jumppads.qc +++ b/qcsrc/server/t_jumppads.qc @@ -1,28 +1,4 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "../warpzonelib/util_server.qh" - #include "../common/constants.qh" - #include "../common/util.qh" - #include "../common/animdecide.qh" - #include "../common/weapons/weapons.qh" - #include "weapons/csqcprojectile.qh" - #include "constants.qh" - #include "defs.qh" -#endif - -const float PUSH_ONCE = 1; -const float PUSH_SILENT = 2; - -.float pushltime; -.float istypefrag; -.float height; - -void() SUB_UseTargets; - -float trigger_push_calculatevelocity_flighttime; +#include "t_jumppads.qh" void trigger_push_use() { @@ -261,7 +237,6 @@ void trigger_push_touch() } } -.vector dest; void trigger_push_findtarget() { entity e, t; diff --git a/qcsrc/server/t_jumppads.qh b/qcsrc/server/t_jumppads.qh new file mode 100644 index 0000000000..e517324480 --- /dev/null +++ b/qcsrc/server/t_jumppads.qh @@ -0,0 +1,55 @@ +#ifndef T_JUMPPADS_H +#define T_JUMPPADS_H + +const float PUSH_ONCE = 1; +const float PUSH_SILENT = 2; + +.float pushltime; +.float istypefrag; +.float height; + +void() SUB_UseTargets; + +float trigger_push_calculatevelocity_flighttime; + +void trigger_push_use(); + +/* + trigger_push_calculatevelocity + + Arguments: + org - origin of the object which is to be pushed + tgt - target entity (can be either a point or a model entity; if it is + the latter, its midpoint is used) + ht - jump height, measured from the higher one of org and tgt's midpoint + + Returns: velocity for the jump + the global trigger_push_calculatevelocity_flighttime is set to the total + jump time + */ + +vector trigger_push_calculatevelocity(vector org, entity tgt, float ht); + +void trigger_push_touch(); + +.vector dest; +void trigger_push_findtarget(); + +/* + * ENTITY PARAMETERS: + * + * target: target of jump + * height: the absolute value is the height of the highest point of the jump + * trajectory above the higher one of the player and the target. + * the sign indicates whether the highest point is INSIDE (positive) + * or OUTSIDE (negative) of the jump trajectory. General rule: use + * positive values for targets mounted on the floor, and use negative + * values to target a point on the ceiling. + * movedir: if target is not set, this * speed * 10 is the velocity to be reached. + */ +void spawnfunc_trigger_push(); + +void spawnfunc_target_push(); +void spawnfunc_info_notnull(); +void spawnfunc_target_position(); +#endif \ No newline at end of file diff --git a/qcsrc/server/t_quake.qc b/qcsrc/server/t_quake.qc index 8281ef4430..9b25c88609 100644 --- a/qcsrc/server/t_quake.qc +++ b/qcsrc/server/t_quake.qc @@ -1,8 +1,4 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" -#endif +#include "../common/weapons/weapons.qc" //*********************** //QUAKE 1 ENTITIES - So people can play quake1 maps with the xonotic weapons diff --git a/qcsrc/server/t_quake3.qc b/qcsrc/server/t_quake3.qc index b0f4f1ab4c..35b81c699a 100644 --- a/qcsrc/server/t_quake3.qc +++ b/qcsrc/server/t_quake3.qc @@ -1,13 +1,4 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "../common/buffs.qh" - #include "../common/weapons/weapons.qh" - #include "defs.qh" - #include "../common/mapinfo.qh" -#endif +#include "../common/weapons/weapons.qc" //*********************** //QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons diff --git a/qcsrc/server/t_teleporters.qc b/qcsrc/server/t_teleporters.qc index 60a1ca7f01..46df0eb786 100644 --- a/qcsrc/server/t_teleporters.qc +++ b/qcsrc/server/t_teleporters.qc @@ -1,8 +1,8 @@ +#include "t_teleporters.qh" + #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #include "../warpzonelib/common.qh" #include "../warpzonelib/util_server.qh" #include "../warpzonelib/server.qh" @@ -25,29 +25,6 @@ void trigger_teleport_use() self.team = activator.team; } -#define TDEATHLOOP(o) \ - entity head; \ - vector deathmin; \ - vector deathmax; \ - float deathradius; \ - deathmin = (o) + player.mins; \ - deathmax = (o) + player.maxs; \ - if(telefragmin != telefragmax) \ - { \ - if(deathmin.x > telefragmin.x) deathmin_x = telefragmin.x; \ - if(deathmin.y > telefragmin.y) deathmin_y = telefragmin.y; \ - if(deathmin.z > telefragmin.z) deathmin_z = telefragmin.z; \ - if(deathmax.x < telefragmax.x) deathmax_x = telefragmax.x; \ - if(deathmax.y < telefragmax.y) deathmax_y = telefragmax.y; \ - if(deathmax.z < telefragmax.z) deathmax_z = telefragmax.z; \ - } \ - deathradius = max(vlen(deathmin), vlen(deathmax)); \ - for(head = findradius(o, deathradius); head; head = head.chain) \ - if(head != player) \ - if(head.takedamage) \ - if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax)) - - float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax) { if (IS_PLAYER(player) && player.health >= 1) @@ -62,7 +39,7 @@ float check_tdeath(entity player, vector org, vector telefragmin, vector telefra } return 0; } -float tdeath_hit; + void tdeath(entity player, entity teleporter, entity telefragger, vector telefragmin, vector telefragmax) { TDEATHLOOP(player.origin) @@ -87,21 +64,6 @@ void spawn_tdeath(vector v0, entity e, vector v) tdeath(e, e, e, '0 0 0', '0 0 0'); } -.entity pusher; -const float TELEPORT_FLAG_SOUND = 1; -const float TELEPORT_FLAG_PARTICLES = 2; -const float TELEPORT_FLAG_TDEATH = 4; -const float TELEPORT_FLAG_FORCE_TDEATH = 8; - -#define TELEPORT_FLAGS_WARPZONE 0 -#define TELEPORT_FLAGS_PORTAL (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH | TELEPORT_FLAG_FORCE_TDEATH) -#define TELEPORT_FLAGS_TELEPORTER (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH) - -// types for .teleportable entity setting -const float TELEPORT_NORMAL = 1; // play sounds/effects etc -const float TELEPORT_SIMPLE = 2; // only do teleport, nothing special - -void Reset_ArcBeam(entity player, vector forward); void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags) { entity telefragger; @@ -334,8 +296,6 @@ entity Teleport_Find(vector mi, vector ma) return world; } -entity teleport_first; -.entity teleport_next; void spawnfunc_trigger_teleport (void) { self.angles = '0 0 0'; diff --git a/qcsrc/server/t_teleporters.qh b/qcsrc/server/t_teleporters.qh new file mode 100644 index 0000000000..4b1750cd33 --- /dev/null +++ b/qcsrc/server/t_teleporters.qh @@ -0,0 +1,71 @@ +#ifndef T_TELEPORTERS_H +#define T_TELEPORTERS_H + +void trigger_teleport_use(); + +#define TDEATHLOOP(o) \ + entity head; \ + vector deathmin; \ + vector deathmax; \ + float deathradius; \ + deathmin = (o) + player.mins; \ + deathmax = (o) + player.maxs; \ + if(telefragmin != telefragmax) \ + { \ + if(deathmin.x > telefragmin.x) deathmin_x = telefragmin.x; \ + if(deathmin.y > telefragmin.y) deathmin_y = telefragmin.y; \ + if(deathmin.z > telefragmin.z) deathmin_z = telefragmin.z; \ + if(deathmax.x < telefragmax.x) deathmax_x = telefragmax.x; \ + if(deathmax.y < telefragmax.y) deathmax_y = telefragmax.y; \ + if(deathmax.z < telefragmax.z) deathmax_z = telefragmax.z; \ + } \ + deathradius = max(vlen(deathmin), vlen(deathmax)); \ + for(head = findradius(o, deathradius); head; head = head.chain) \ + if(head != player) \ + if(head.takedamage) \ + if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax)) + + +float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax); +float tdeath_hit; +void tdeath(entity player, entity teleporter, entity telefragger, vector telefragmin, vector telefragmax); + +void spawn_tdeath(vector v0, entity e, vector v); + +.entity pusher; +const float TELEPORT_FLAG_SOUND = 1; +const float TELEPORT_FLAG_PARTICLES = 2; +const float TELEPORT_FLAG_TDEATH = 4; +const float TELEPORT_FLAG_FORCE_TDEATH = 8; + +#define TELEPORT_FLAGS_WARPZONE 0 +#define TELEPORT_FLAGS_PORTAL (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH | TELEPORT_FLAG_FORCE_TDEATH) +#define TELEPORT_FLAGS_TELEPORTER (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH) + +// types for .teleportable entity setting +const float TELEPORT_NORMAL = 1; // play sounds/effects etc +const float TELEPORT_SIMPLE = 2; // only do teleport, nothing special + +void Reset_ArcBeam(entity player, vector forward); +void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags); + +entity Simple_TeleportPlayer(entity teleporter, entity player); + +void Teleport_Touch (void); + +void spawnfunc_info_teleport_destination (void); + +void spawnfunc_misc_teleporter_dest (void); + +void spawnfunc_target_teleporter (void); + +void teleport_findtarget (void); + +entity Teleport_Find(vector mi, vector ma); + +entity teleport_first; +.entity teleport_next; +void spawnfunc_trigger_teleport (void); + +void WarpZone_PostTeleportPlayer_Callback(entity pl); +#endif \ No newline at end of file diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index e303bd5807..ba1b4e6eed 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -1,39 +1,10 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" - #include "../common/constants.qh" - #include "../common/teams.qh" - #include "../common/util.qh" - #include "autocvars.qh" - #include "defs.qh" - #include "../common/notifications.qh" - #include "../common/deathtypes.qh" - #include "mutators/mutators_include.qh" - #include "../common/mapinfo.qh" - #include "command/vote.qh" - #include "scores.qh" - #include "race.qh" -#endif - -string cache_mutatormsg; -string cache_lastmutatormsg; - -// client counts for each team -//float c1, c2, c3, c4; -// # of bots on those teams -float cb1, cb2, cb3, cb4; - -//float audit_teams_time; +#include "teamplay.qh" void TeamchangeFrags(entity e) { PlayerScore_Clear(e); } -void entcs_init(); - void LogTeamchange(float player_id, float team_number, float type) { if(!autocvar_sv_eventlog) diff --git a/qcsrc/server/teamplay.qh b/qcsrc/server/teamplay.qh new file mode 100644 index 0000000000..e6146aa60d --- /dev/null +++ b/qcsrc/server/teamplay.qh @@ -0,0 +1,55 @@ +#ifndef TEAMPLAY_H +#define TEAMPLAY_H + +string cache_mutatormsg; +string cache_lastmutatormsg; + +// client counts for each team +//float c1, c2, c3, c4; +// # of bots on those teams +float cb1, cb2, cb3, cb4; + +//float audit_teams_time; + +void TeamchangeFrags(entity e); + +void entcs_init(); + +void LogTeamchange(float player_id, float team_number, float type); + +void default_delayedinit(); + +void ActivateTeamplay(); + +void InitGameplayMode(); + +string GetClientVersionMessage(); + +string getwelcomemessage(void); + +void SetPlayerColors(entity pl, float _color); + +void SetPlayerTeam(entity pl, float t, float s, float noprint); + +// set c1...c4 to show what teams are allowed +void CheckAllowedTeams (entity for_whom); + +float PlayerValue(entity p); + +// c1...c4 should be set to -1 (not allowed) or 0 (allowed). +// teams that are allowed will now have their player counts stored in c1...c4 +void GetTeamCounts(entity ignore); + +float TeamSmallerEqThanTeam(float ta, float tb, entity e); + +// returns # of smallest team (1, 2, 3, 4) +// NOTE: Assumes CheckAllowedTeams has already been called! +float FindSmallestTeam(entity pl, float ignore_pl); + +float JoinBestTeam(entity pl, float only_return_best, float forcebestteam); + +//void() ctf_playerchanged; +void SV_ChangeTeam(float _color); + +void ShufflePlayerOutOfTeam (float source_team); +#endif \ No newline at end of file diff --git a/qcsrc/server/vehicles/vehicles_def.qh b/qcsrc/server/vehicles/vehicles_def.qh index 8a76ecc3cc..1e3cff4cda 100644 --- a/qcsrc/server/vehicles/vehicles_def.qh +++ b/qcsrc/server/vehicles/vehicles_def.qh @@ -1,6 +1,8 @@ #ifndef VEHICLES_DEF_H #define VEHICLES_DEF_H +#include "../tturrets/include/turrets_early.qh" + // #define VEHICLES_USE_ODE #define VEHICLES_ENABLED #ifdef VEHICLES_ENABLED diff --git a/qcsrc/server/waypointsprites.qc b/qcsrc/server/waypointsprites.qc index 4b7cf024ee..02ebdec920 100644 --- a/qcsrc/server/waypointsprites.qc +++ b/qcsrc/server/waypointsprites.qc @@ -1,8 +1,8 @@ +#include "waypointsprites.qh" + #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #include "../common/constants.qh" #include "../common/util.qh" #include "../common/buffs.qh" @@ -15,14 +15,6 @@ #include "miscfunctions.qh" #endif -..entity owned_by_field; -.float rule; -.string model1; -.string model2; -.string model3; - -.float(entity) waypointsprite_visible_for_player; - void WaypointSprite_UpdateSprites(entity e, string m1, string m2, string m3) { if(m1 != e.model1) @@ -98,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 @@ -111,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); @@ -148,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) { } @@ -360,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 @@ -371,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) { @@ -416,7 +405,6 @@ entity WaypointSprite_SpawnFixed( 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, @@ -436,7 +424,6 @@ entity WaypointSprite_DeployFixed( 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, @@ -446,8 +433,6 @@ entity WaypointSprite_DeployPersonal( 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, diff --git a/qcsrc/server/waypointsprites.qh b/qcsrc/server/waypointsprites.qh new file mode 100644 index 0000000000..db310a0037 --- /dev/null +++ b/qcsrc/server/waypointsprites.qh @@ -0,0 +1,113 @@ +#ifndef SERVER_WAYPOINTSPRITES_H +#define SERVER_WAYPOINTSPRITES_H + +..entity owned_by_field; +.float rule; +.string model1; +.string model2; +.string model3; + +.float(entity) waypointsprite_visible_for_player; + +void WaypointSprite_UpdateSprites(entity e, string m1, string m2, string m3); + +void WaypointSprite_UpdateHealth(entity e, float f); + +void WaypointSprite_UpdateMaxHealth(entity e, float f); + +void WaypointSprite_UpdateBuildFinished(entity e, float f); + +void WaypointSprite_UpdateOrigin(entity e, vector o); + +void WaypointSprite_UpdateRule(entity e, float t, float r); + +void WaypointSprite_UpdateTeamRadar(entity e, float icon, vector col); + +.float waypointsprite_pingtime; +.float waypointsprite_helpmetime; +void WaypointSprite_Ping(entity e); + +float waypointsprite_limitedrange, waypointsprite_deployed_lifetime, waypointsprite_deadlifetime; + +void WaypointSprite_HelpMePing(entity e); + +void WaypointSprite_FadeOutIn(entity e, float t); + +void WaypointSprite_Init(); +void WaypointSprite_InitClient(entity e); + +void WaypointSprite_Kill(entity wp); + +void WaypointSprite_Disown(entity wp, float fadetime); + +void WaypointSprite_Think(); + +float WaypointSprite_visible_for_player(entity e); + +entity WaypointSprite_getviewentity(entity e); + +float WaypointSprite_isteammate(entity e, entity e2); + +float WaypointSprite_Customize(); + +float WaypointSprite_SendEntity(entity to, float sendflags); + +void WaypointSprite_Reset(); + +entity WaypointSprite_Spawn( + string spr, // sprite + 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 + float hideable, // true when it should be controlled by cl_hidewaypoints + float icon, vector rgb // initial icon and color +); + +entity WaypointSprite_SpawnFixed( + string spr, + vector ofs, + entity own, + .entity ownfield, + float icon, vector rgb // initial icon and color +); + +.entity waypointsprite_deployed_fixed; +entity WaypointSprite_DeployFixed( + string spr, + float limited_range, + vector ofs, + float icon, vector rgb // initial icon and color +); + +.entity waypointsprite_deployed_personal; +entity WaypointSprite_DeployPersonal( + string spr, + vector ofs, + float icon, vector rgb // initial icon and color +); + +.entity waypointsprite_attached; +.entity waypointsprite_attachedforcarrier; +entity WaypointSprite_Attach( + string spr, + float limited_range, + float icon, vector rgb // initial icon and color +); + +entity WaypointSprite_AttachCarrier( + string spr, + entity carrier, + float icon, vector rgb // initial icon and color +); + +void WaypointSprite_DetachCarrier(entity carrier); + +void WaypointSprite_ClearPersonal(); + +void WaypointSprite_ClearOwned(); + +void WaypointSprite_PlayerDead(); + +void WaypointSprite_PlayerGone(); +#endif \ No newline at end of file diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index b7ccbeb2df..1f34034761 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -42,13 +42,6 @@ float W_WeaponRateFactor() return t; } -// VorteX: static frame globals -const float WFRAME_DONTCHANGE = -1; -const float WFRAME_FIRE1 = 0; -const float WFRAME_FIRE2 = 1; -const float WFRAME_IDLE = 2; -const float WFRAME_RELOAD = 3; -.float wframe; void(float fr, float t, void() func) weapon_thinkf; @@ -978,7 +971,6 @@ void W_Reload(float sent_ammo_min, string sent_sound) self.clip_load = self.(weapon_load[self.weapon]) = -1; } -entity weapon_dropevent_item; void W_DropEvent(float event, entity player, float weapon_type, entity weapon_item) { entity oldself = self; diff --git a/qcsrc/server/weapons/weaponsystem.qh b/qcsrc/server/weapons/weaponsystem.qh index 47bcadea4d..20370d1b83 100644 --- a/qcsrc/server/weapons/weaponsystem.qh +++ b/qcsrc/server/weapons/weaponsystem.qh @@ -1,10 +1,43 @@ #ifndef WEAPONSYSTEM_H #define WEAPONSYSTEM_H -float weaponswapping; +.float wframe; + float internalteam; +float weaponswapping; +entity weapon_dropevent_item; -void W_DropEvent(float event, entity player, float weapon_type, entity weapon_item); +// VorteX: static frame globals +const float WFRAME_DONTCHANGE = -1; +const float WFRAME_FIRE1 = 0; +const float WFRAME_FIRE2 = 1; +const float WFRAME_IDLE = 2; +const float WFRAME_RELOAD = 3; + +void CL_SpawnWeaponentity(); + +vector CL_Weapon_GetShotOrg(float wpn); float forbidWeaponUse(); + +void W_AttachToShotorg(entity flash, vector offset); + +void W_DecreaseAmmo(float ammo_use); + +void W_DropEvent(float event, entity player, float weapon_type, entity weapon_item); + +void W_Reload(float sent_ammo_min, string sent_sound); + +void W_WeaponFrame(); + +float W_WeaponRateFactor(); + +float weapon_prepareattack(float secondary, float attacktime); + +float weapon_prepareattack_check(float secondary, float attacktime); + +float weapon_prepareattack_do(float secondary, float attacktime); + +void weapon_thinkf(float fr, float t, void() func); + #endif \ No newline at end of file