From afd0bb647a10128dd5212d54564f9448e8b8f2f8 Mon Sep 17 00:00:00 2001 From: TimePath Date: Tue, 27 Oct 2015 11:32:41 +1100 Subject: [PATCH] Uncrustify client/{commands,mutators,weapons}/* --- qcsrc/client/commands/cl_cmd.qc | 176 +++++++++++++++-------------- qcsrc/client/mutators/events.qh | 62 +++++----- qcsrc/client/weapons/projectile.qc | 159 +++++++++++++------------- qcsrc/client/weapons/projectile.qh | 28 ++--- qcsrc/uncrustify.cfg | 12 +- 5 files changed, 228 insertions(+), 209 deletions(-) diff --git a/qcsrc/client/commands/cl_cmd.qc b/qcsrc/client/commands/cl_cmd.qc index bed70f57f..db4d59a5c 100644 --- a/qcsrc/client/commands/cl_cmd.qc +++ b/qcsrc/client/commands/cl_cmd.qc @@ -22,7 +22,7 @@ void DrawDebugModel(entity this) { - if(time - floor(time) > 0.5) + if (time - floor(time) > 0.5) { PolyDrawModel(self); self.drawmask = 0; @@ -45,7 +45,7 @@ void LocalCommand_blurtest(int request) // Anyway, to enable it, just compile the client with -DBLURTEST and then you can use the command. #ifdef BLURTEST - switch(request) + switch (request) { case CMD_REQUEST_COMMAND: { @@ -66,7 +66,7 @@ void LocalCommand_blurtest(int request) } } #else - if(request) + if (request) { LOG_INFO("Blurtest is not enabled on this client.\n"); return; @@ -76,7 +76,7 @@ void LocalCommand_blurtest(int request) void LocalCommand_boxparticles(int request, int argc) { - switch(request) + switch (request) { case CMD_REQUEST_COMMAND: { @@ -87,7 +87,7 @@ void LocalCommand_boxparticles(int request, int argc) { int index = stoi(argv(2)); entity own; - if(index <= 0) + if (index <= 0) own = entitybyindex(-index); else own = findfloat(world, entnum, index); @@ -104,7 +104,9 @@ void LocalCommand_boxparticles(int request, int argc) } default: + { LOG_INFO("Incorrect parameters for ^2boxparticles^7\n"); + } case CMD_REQUEST_USAGE: { LOG_INFO("\nUsage:^3 lv_cmd boxparticles effectname own org_from org_to, dir_from, dir_to, countmultiplier, flags\n"); @@ -127,14 +129,14 @@ void LocalCommand_boxparticles(int request, int argc) void LocalCommand_create_scrshot_ent(int request) { - switch(request) + switch (request) { case CMD_REQUEST_COMMAND: { string filename = strcat(MapInfo_Map_bspname, "_scrshot_ent.txt"); int fh = fopen(filename, FILE_WRITE); - if(fh >= 0) + if (fh >= 0) { fputs(fh, "{\n"); fputs(fh, strcat("\"classname\" \"info_autoscreenshot\"\n")); @@ -165,7 +167,7 @@ void LocalCommand_create_scrshot_ent(int request) void LocalCommand_debugmodel(int request, int argc) { - switch(request) + switch (request) { case CMD_REQUEST_COMMAND: { @@ -195,14 +197,14 @@ void LocalCommand_debugmodel(int request, int argc) void LocalCommand_handlevote(int request, int argc) { - switch(request) + switch (request) { case CMD_REQUEST_COMMAND: { int vote_selection; string vote_string; - if(InterpretBoolean(argv(1))) + if (InterpretBoolean(argv(1))) { vote_selection = 2; vote_string = "yes"; @@ -213,9 +215,9 @@ void LocalCommand_handlevote(int request, int argc) vote_string = "no"; } - if(vote_selection) + if (vote_selection) { - if(uid2name_dialog) // handled by "uid2name" option + if (uid2name_dialog) // handled by "uid2name" option { vote_active = 0; vote_prev = 0; @@ -230,7 +232,9 @@ void LocalCommand_handlevote(int request, int argc) } default: + { LOG_INFO("Incorrect parameters for ^2handlevote^7\n"); + } case CMD_REQUEST_USAGE: { LOG_INFO("\nUsage:^3 cl_cmd handlevote vote\n"); @@ -252,11 +256,11 @@ void HUD_Radar_Show_Maximized(bool doshow, bool clickable); void LocalCommand_hud(int request, int argc) { - switch(request) + switch (request) { case CMD_REQUEST_COMMAND: { - switch(argv(1)) + switch (argv(1)) { case "configure": { @@ -266,16 +270,16 @@ void LocalCommand_hud(int request, int argc) case "quickmenu": { - if(QuickMenu_IsOpened()) + if (QuickMenu_IsOpened()) QuickMenu_Close(); else - QuickMenu_Open(argv(2), argv(3)); // mode, submenu + QuickMenu_Open(argv(2), argv(3)); // mode, submenu return; } case "minigame": { - if(HUD_MinigameMenu_IsOpened()) + if (HUD_MinigameMenu_IsOpened()) HUD_MinigameMenu_Close(); else HUD_MinigameMenu_Open(); @@ -284,14 +288,14 @@ void LocalCommand_hud(int request, int argc) case "save": { - if(argv(2)) + if (argv(2)) { HUD_Panel_ExportCfg(argv(2)); return; } else { - break; // go to usage, we're missing the paramater needed here. + break; // go to usage, we're missing the paramater needed here. } } @@ -309,23 +313,25 @@ void LocalCommand_hud(int request, int argc) case "radar": { - if(argv(2)) - HUD_Radar_Show_Maximized(InterpretBoolean(argv(2)),0); + if (argv(2)) + HUD_Radar_Show_Maximized(InterpretBoolean(argv(2)), 0); else - HUD_Radar_Show_Maximized(!hud_panel_radar_maximized,0); + HUD_Radar_Show_Maximized(!hud_panel_radar_maximized, 0); return; } case "clickradar": { - HUD_Radar_Show_Maximized(!hud_panel_radar_mouse,1); + HUD_Radar_Show_Maximized(!hud_panel_radar_mouse, 1); return; } } } default: + { LOG_INFO("Incorrect parameters for ^2hud^7\n"); + } case CMD_REQUEST_USAGE: { LOG_INFO("\nUsage:^3 cl_cmd hud action [configname | radartoggle | layout]\n"); @@ -334,7 +340,7 @@ void LocalCommand_hud(int request, int argc) LOG_INFO(" 'radartoggle' is to control hud_panel_radar_maximized for \"radar\" action,\n"); LOG_INFO(" and 'layout' is how to organize the scoreboard columns for the set action.\n"); LOG_INFO(" quickmenu [[default | file | \"\"] submenu]\n"); - LOG_INFO(" Called without options (or with "") loads either the default quickmenu or a quickmenu file if hud_panel_quickmenu_file is set to a valid filename.\n"); + LOG_INFO(" Called without options (or with " ") loads either the default quickmenu or a quickmenu file if hud_panel_quickmenu_file is set to a valid filename.\n"); LOG_INFO(" Submenu option allows to open quickmenu directly in a submenu, it requires to specify 'default', 'file' or '\"\"' option.\n"); LOG_INFO(" Full list of commands here: \"configure, minigame, save, scoreboard_columns_help, scoreboard_columns_set, radar.\"\n"); return; @@ -344,11 +350,11 @@ void LocalCommand_hud(int request, int argc) void LocalCommand_localprint(int request, int argc) { - switch(request) + switch (request) { case CMD_REQUEST_COMMAND: { - if(argv(1)) + if (argv(1)) { centerprint_hud(argv(1)); return; @@ -356,7 +362,9 @@ void LocalCommand_localprint(int request, int argc) } default: + { LOG_INFO("Incorrect parameters for ^2localprint^7\n"); + } case CMD_REQUEST_USAGE: { LOG_INFO("\nUsage:^3 cl_cmd localprint \"message\"\n"); @@ -368,11 +376,11 @@ void LocalCommand_localprint(int request, int argc) void LocalCommand_mv_download(int request, int argc) { - switch(request) + switch (request) { case CMD_REQUEST_COMMAND: { - if(argv(1)) + if (argv(1)) { Cmd_MapVote_MapDownload(argc); return; @@ -380,7 +388,9 @@ void LocalCommand_mv_download(int request, int argc) } default: + { LOG_INFO("Incorrect parameters for ^2mv_download^7\n"); + } case CMD_REQUEST_USAGE: { LOG_INFO("\nUsage:^3 cl_cmd mv_download mapid\n"); @@ -392,20 +402,22 @@ void LocalCommand_mv_download(int request, int argc) void LocalCommand_find(int request, int argc) { - switch(request) + switch (request) { case CMD_REQUEST_COMMAND: { entity client; - for(client = world; (client = find(client, classname, argv(1))); ) + for (client = world; (client = find(client, classname, argv(1))); ) LOG_INFO(etos(client), "\n"); return; } default: + { LOG_INFO("Incorrect parameters for ^2find^7\n"); + } case CMD_REQUEST_USAGE: { LOG_INFO("\nUsage:^3 cl_cmd find classname\n"); @@ -417,19 +429,19 @@ void LocalCommand_find(int request, int argc) void LocalCommand_sendcvar(int request, int argc) { - switch(request) + switch (request) { case CMD_REQUEST_COMMAND: { - if(argv(1)) + if (argv(1)) { // W_FixWeaponOrder will trash argv, so save what we need. string thiscvar = strzone(argv(1)); string s = cvar_string(thiscvar); - if(thiscvar == "cl_weaponpriority") + if (thiscvar == "cl_weaponpriority") s = W_FixWeaponOrder(W_NumberWeaponOrder(s), 1); - else if(substring(thiscvar, 0, 17) == "cl_weaponpriority" && strlen(thiscvar) == 18) + else if (substring(thiscvar, 0, 17) == "cl_weaponpriority" && strlen(thiscvar) == 18) s = W_FixWeaponOrder(W_NumberWeaponOrder(s), 0); localcmd("cmd sentcvar ", thiscvar, " \"", s, "\"\n"); @@ -439,7 +451,9 @@ void LocalCommand_sendcvar(int request, int argc) } default: + { LOG_INFO("Incorrect parameters for ^2sendcvar^7\n"); + } case CMD_REQUEST_USAGE: { LOG_INFO("\nUsage:^3 cl_cmd sendcvar \n"); @@ -453,22 +467,22 @@ void LocalCommand_sendcvar(int request, int argc) ** ADD ALL NEW COMMANDS TO commands.cfg WITH PROPER ALIASES IN THE SAME FASHION! void LocalCommand_(int request) { - switch(request) - { - case CMD_REQUEST_COMMAND: - { - - return; - } - - default: - case CMD_REQUEST_USAGE: - { - print("\nUsage:^3 cl_cmd \n"); - print(" No arguments required.\n"); - return; - } - } + switch(request) + { + case CMD_REQUEST_COMMAND: + { + + return; + } + + default: + case CMD_REQUEST_USAGE: + { + print("\nUsage:^3 cl_cmd \n"); + print(" No arguments required.\n"); + return; + } + } } */ @@ -478,7 +492,7 @@ void LocalCommand_(int request) // ================================== // Normally do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;) -#define CLIENT_COMMANDS(request,arguments) \ +#define CLIENT_COMMANDS(request, arguments) \ CLIENT_COMMAND("blurtest", LocalCommand_blurtest(request), "Feature for testing blur postprocessing") \ CLIENT_COMMAND("boxparticles", LocalCommand_boxparticles(request, arguments), "Spawn particles manually") \ CLIENT_COMMAND("create_scrshot_ent", LocalCommand_create_scrshot_ent(request), "Create an entity at this location for automatic screenshots") \ @@ -493,19 +507,17 @@ void LocalCommand_(int request) void LocalCommand_macro_help() { - #define CLIENT_COMMAND(name,function,description) \ - { if(strtolower(description) != "") { LOG_INFO(" ^2", name, "^7: ", description, "\n"); } } + #define CLIENT_COMMAND(name, function, description) \ + { if (strtolower(description) != "") { LOG_INFO(" ^2", name, "^7: ", description, "\n"); } } CLIENT_COMMANDS(0, 0); #undef CLIENT_COMMAND - - return; } bool LocalCommand_macro_command(int argc) { - #define CLIENT_COMMAND(name,function,description) \ - { if(name == strtolower(argv(0))) { function; return true; } } + #define CLIENT_COMMAND(name, function, description) \ + { if (name == strtolower(argv(0))) { function; return true; } } CLIENT_COMMANDS(CMD_REQUEST_COMMAND, argc); #undef CLIENT_COMMAND @@ -515,8 +527,8 @@ bool LocalCommand_macro_command(int argc) bool LocalCommand_macro_usage(int argc) { - #define CLIENT_COMMAND(name,function,description) \ - { if(name == strtolower(argv(1))) { function; return true; } } + #define CLIENT_COMMAND(name, function, description) \ + { if (name == strtolower(argv(1))) { function; return true; } } CLIENT_COMMANDS(CMD_REQUEST_USAGE, argc); #undef CLIENT_COMMAND @@ -526,13 +538,11 @@ bool LocalCommand_macro_usage(int argc) void LocalCommand_macro_write_aliases(int fh) { - #define CLIENT_COMMAND(name,function,description) \ - { if(strtolower(description) != "") { CMD_Write_Alias("qc_cmd_cl", name, description); } } + #define CLIENT_COMMAND(name, function, description) \ + { if (strtolower(description) != "") { CMD_Write_Alias("qc_cmd_cl", name, description); } } CLIENT_COMMANDS(0, 0); #undef CLIENT_COMMAND - - return; } @@ -552,7 +562,7 @@ void GameCommand(string command) string s = strtolower(argv(0)); if (s == "help") { - if(argc == 1) + if (argc == 1) { LOG_INFO("\nClient console commands:\n"); LocalCommand_macro_help(); @@ -565,25 +575,23 @@ void GameCommand(string command) return; } - else if(GenericCommand_macro_usage(argc)) // Instead of trying to call a command, we're going to see detailed information about it + else if (GenericCommand_macro_usage(argc)) // Instead of trying to call a command, we're going to see detailed information about it { return; } - else if(LocalCommand_macro_usage(argc)) // now try for normal commands too + else if (LocalCommand_macro_usage(argc)) // now try for normal commands too { return; } } // continue as usual and scan for normal commands - if (GenericCommand(command)// handled by common/command/generic.qc - || LocalCommand_macro_command(argc) // handled by one of the above LocalCommand_* functions - || MUTATOR_CALLHOOK(CSQC_ConsoleCommand, s, argc, command) // handled by a mutator - ) return; + if (GenericCommand(command) // handled by common/command/generic.qc + || LocalCommand_macro_command(argc) // handled by one of the above LocalCommand_* functions + || MUTATOR_CALLHOOK(CSQC_ConsoleCommand, s, argc, command) // handled by a mutator + ) return; // nothing above caught the command, must be invalid LOG_INFO(((command != "") ? strcat("Unknown client command \"", command, "\"") : "No command provided"), ". For a list of supported commands, try cl_cmd help.\n"); - - return; } @@ -622,7 +630,7 @@ void GameCommand(string command) void ConsoleCommand_macro_init() { // first init normal commands - #define CONSOLE_COMMAND(name,execution) \ + #define CONSOLE_COMMAND(name, execution) \ { registercommand(name); } CONSOLE_COMMANDS_NORMAL(); @@ -630,22 +638,22 @@ void ConsoleCommand_macro_init() // then init movement commands #ifndef CAMERATEST - if(isdemo()) + if (isdemo()) { #endif - #define CONSOLE_COMMAND(name,execution) \ - { registercommand(name); } + #define CONSOLE_COMMAND(name, execution) \ + registercommand(name); - CONSOLE_COMMANDS_MOVEMENT(); + CONSOLE_COMMANDS_MOVEMENT(); #undef CONSOLE_COMMAND #ifndef CAMERATEST - } +} #endif } bool ConsoleCommand_macro_normal(string s, int argc) { - #define CONSOLE_COMMAND(name,execution) \ + #define CONSOLE_COMMAND(name, execution) \ { if (name == s) { { execution } return true; } } CONSOLE_COMMANDS_NORMAL(); @@ -656,9 +664,9 @@ bool ConsoleCommand_macro_normal(string s, int argc) bool ConsoleCommand_macro_movement(string s, int argc) { - if(camera_active) + if (camera_active) { - #define CONSOLE_COMMAND(name,execution) \ + #define CONSOLE_COMMAND(name, execution) \ { if (name == s) { { execution } return true; } } CONSOLE_COMMANDS_MOVEMENT(); @@ -679,7 +687,7 @@ bool CSQC_ConsoleCommand(string command) int argc = tokenize_console(command); string s = strtolower(argv(0)); // Return value should be true if CSQC handled the command, otherwise return false to have the engine handle it. - return (ConsoleCommand_macro_normal(s, argc) - || ConsoleCommand_macro_movement(s, argc) - ); + return ConsoleCommand_macro_normal(s, argc) + || ConsoleCommand_macro_movement(s, argc) + ; } diff --git a/qcsrc/client/mutators/events.qh b/qcsrc/client/mutators/events.qh index a79e0b471..678d7ca66 100644 --- a/qcsrc/client/mutators/events.qh +++ b/qcsrc/client/mutators/events.qh @@ -29,10 +29,10 @@ string cmd_string; * } */ #define EV_CSQC_ConsoleCommand(i, o) \ - /** command name */ i(string, cmd_name) \ - /** also, argv() can be used */ i(int, cmd_argc) \ - /** whole command, use only if you really have to */ i(string, cmd_string) \ - /**/ + /** command name */ i(string, cmd_name) \ + /** also, argv() can be used */ i(int, cmd_argc) \ + /** whole command, use only if you really have to */ i(string, cmd_string) \ + /**/ MUTATOR_HOOKABLE(CSQC_ConsoleCommand, EV_CSQC_ConsoleCommand); /* Called when the crosshair is being updated */ @@ -46,8 +46,8 @@ MUTATOR_HOOKABLE(UpdateCrosshair, EV_NO_ARGS); * return = true; */ #define EV_CSQC_Parse_TempEntity(i, o) \ - /** mutator id */ i(int, mutator_argv_int_0) \ - /**/ + /** mutator id */ i(int, mutator_argv_int_0) \ + /**/ MUTATOR_HOOKABLE(CSQC_Parse_TempEntity, EV_CSQC_Parse_TempEntity); /** @@ -57,21 +57,21 @@ MUTATOR_HOOKABLE(CSQC_Parse_TempEntity, EV_CSQC_Parse_TempEntity); * return = true; */ #define EV_CSQC_Ent_Update(i, o) \ - /** mutator id */ i(int, mutator_argv_int_0) \ - /** bIsNewEntity */ i(bool, mutator_argv_bool_0) \ - /**/ + /** mutator id */ i(int, mutator_argv_int_0) \ + /** bIsNewEntity */ i(bool, mutator_argv_bool_0) \ + /**/ MUTATOR_HOOKABLE(CSQC_Ent_Update, EV_CSQC_Ent_Update); /** Called when a projectile is linked with CSQC */ #define EV_Ent_Projectile(i, o) \ - /** entity id */ i(entity, __self) \ - /**/ + /** entity id */ i(entity, __self) \ + /**/ MUTATOR_HOOKABLE(Ent_Projectile, EV_Ent_Projectile); /** Called when a projectile's properties are being modified */ #define EV_EditProjectile(i, o) \ - /** entity id */ i(entity, __self) \ - /**/ + /** entity id */ i(entity, __self) \ + /**/ MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile); /* Called when projectiles are precached */ @@ -79,26 +79,26 @@ MUTATOR_HOOKABLE(PrecacheProjectiles, EV_NO_ARGS); /** Called when updating the attached tags index */ #define EV_TagIndex_Update(i, o) \ - /** entity id */ i(entity, __self) \ - /**/ + /** entity id */ i(entity, __self) \ + /**/ MUTATOR_HOOKABLE(TagIndex_Update, EV_TagIndex_Update); /** Called when setting the attached tags */ #define EV_TagIndex_Apply(i, o) \ - /** entity id */ i(entity, __self) \ - /**/ + /** entity id */ i(entity, __self) \ + /**/ MUTATOR_HOOKABLE(TagIndex_Apply, EV_TagIndex_Apply); /** Called when setting up skeleton bones */ #define EV_Skeleton_CheckBones(i, o) \ - /** entity id */ i(entity, __self) \ - /**/ + /** entity id */ i(entity, __self) \ + /**/ MUTATOR_HOOKABLE(Skeleton_CheckBones, EV_Skeleton_CheckBones); /** Called when setting up bones from the loaded model */ #define EV_Skeleton_CheckModel(i, o) \ - /** entity id */ i(entity, __self) \ - /**/ + /** entity id */ i(entity, __self) \ + /**/ MUTATOR_HOOKABLE(Skeleton_CheckModel, EV_Skeleton_CheckModel); /** Called when clearing the global parameters for a model */ @@ -106,27 +106,27 @@ MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS); /** Called when getting the global parameters for a model */ #define EV_GetModelParams(i, o) \ - /** entity id */ i(string, checkmodel_input) \ - /** entity id */ i(string, checkmodel_command) \ - /**/ + /** entity id */ i(string, checkmodel_input) \ + /** entity id */ i(string, checkmodel_command) \ + /**/ string checkmodel_input, checkmodel_command; MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams); /** called when a player presses the jump key */ #define EV_PlayerJump(i, o) \ - /**/ i(float, player_multijump) \ - /**/ i(float, player_jumpheight) \ - /**/ o(float, player_multijump) \ - /**/ o(float, player_jumpheight) \ - /**/ + /**/ i(float, player_multijump) \ + /**/ i(float, player_jumpheight) \ + /**/ o(float, player_multijump) \ + /**/ o(float, player_jumpheight) \ + /**/ float player_multijump; float player_jumpheight; MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump); /** Called checking if 3rd person mode should be forced on */ #define EV_WantEventchase(i, o) \ - /** entity id */ i(entity, __self) \ - /**/ + /** entity id */ i(entity, __self) \ + /**/ MUTATOR_HOOKABLE(WantEventchase, EV_WantEventchase); #endif diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 807d95cb4..7d6abf312 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -6,8 +6,8 @@ #include "../mutators/events.qh" #include "../../common/constants.qh" -#include "../../common/nades/all.qh" #include "../../common/movetypes/movetypes.qh" +#include "../../common/nades/all.qh" #include "../../lib/csqcmodel/interpolate.qh" @@ -18,7 +18,8 @@ .vector colormod; void SUB_Stop() -{SELFPARAM(); +{ + SELFPARAM(); self.move_velocity = self.move_avelocity = '0 0 0'; self.move_movetype = MOVETYPE_NONE; } @@ -37,8 +38,8 @@ void Projectile_DrawTrail(entity this, vector to) this.trail_oldtime = time; // force the effect even for stationary firemine - if(this.cnt == PROJECTILE_FIREMINE) - if(from == to) + if (this.cnt == PROJECTILE_FIREMINE) + if (from == to) from.z += 1; if (this.traileffect) @@ -59,20 +60,20 @@ void Projectile_Draw(entity this) f = self.move_flags; - if(self.count & 0x80) + if (self.count & 0x80) { - //self.move_flags &= ~FL_ONGROUND; - if(self.move_movetype == MOVETYPE_NONE || self.move_movetype == MOVETYPE_FLY) + // self.move_flags &= ~FL_ONGROUND; + if (self.move_movetype == MOVETYPE_NONE || self.move_movetype == MOVETYPE_FLY) Movetype_Physics_NoMatchServer(); - // the trivial movetypes do not have to match the - // server's ticrate as they are ticrate independent - // NOTE: this assumption is only true if MOVETYPE_FLY - // projectiles detonate on impact. If they continue - // moving, we might still be ticrate dependent. + // the trivial movetypes do not have to match the + // server's ticrate as they are ticrate independent + // NOTE: this assumption is only true if MOVETYPE_FLY + // projectiles detonate on impact. If they continue + // moving, we might still be ticrate dependent. else Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy); - if(!(self.move_flags & FL_ONGROUND)) - if(self.velocity != '0 0 0') + if (!(self.move_flags & FL_ONGROUND)) + if (self.velocity != '0 0 0') self.move_angles = self.angles = vectoangles(self.velocity); } else @@ -80,7 +81,7 @@ void Projectile_Draw(entity this) InterpolateOrigin_Do(); } - if(self.count & 0x80) + if (self.count & 0x80) { drawn = (time >= self.spawntime - 0.02); t = max(time, self.spawntime); @@ -91,27 +92,27 @@ void Projectile_Draw(entity this) t = time; } - if(!(f & FL_ONGROUND)) + if (!(f & FL_ONGROUND)) { rot = '0 0 0'; - switch(self.cnt) + switch (self.cnt) { /* case PROJECTILE_GRENADE: - rot = '-2000 0 0'; // forward - break; + rot = '-2000 0 0'; // forward + break; */ case PROJECTILE_GRENADE_BOUNCING: rot = '0 -1000 0'; // sideways break; case PROJECTILE_HOOKBOMB: - rot = '1000 0 0'; // forward + rot = '1000 0 0'; // forward break; default: break; } - if(Nade_FromProjectile(self.cnt) != NADE_TYPE_Null) + if (Nade_FromProjectile(self.cnt) != NADE_TYPE_Null) rot = self.avelocity; self.angles = AnglesTransform_ToAngles(AnglesTransform_Multiply(AnglesTransform_FromAngles(self.angles), rot * (t - self.spawntime))); @@ -124,12 +125,12 @@ void Projectile_Draw(entity this) a = 1 - (time - self.fade_time) * self.fade_rate; self.alpha = bound(0, self.alphamod * a, 1); - if(self.alpha <= 0) + if (self.alpha <= 0) drawn = 0; self.renderflags = 0; trailorigin = self.origin; - switch(self.cnt) + switch (self.cnt) { case PROJECTILE_GRENADE: case PROJECTILE_GRENADE_BOUNCING: @@ -139,20 +140,20 @@ void Projectile_Draw(entity this) break; } - if(Nade_FromProjectile(self.cnt) != NADE_TYPE_Null) + if (Nade_FromProjectile(self.cnt) != NADE_TYPE_Null) trailorigin += v_up * 4; - if(drawn) + if (drawn) Projectile_DrawTrail(self, trailorigin); else Projectile_ResetTrail(self, trailorigin); self.drawmask = 0; - if(!drawn) + if (!drawn) return; - switch(self.cnt) + switch (self.cnt) { // Possibly add dlights here. default: @@ -163,8 +164,9 @@ void Projectile_Draw(entity this) } void loopsound(entity e, int ch, string samp, float vol, float attn) -{SELFPARAM(); - if(self.silent) +{ + SELFPARAM(); + if (self.silent) return; _sound(e, ch, samp, vol, attn); @@ -172,8 +174,9 @@ void loopsound(entity e, int ch, string samp, float vol, float attn) } void Ent_RemoveProjectile() -{SELFPARAM(); - if(self.count & 0x80) +{ + SELFPARAM(); + if (self.count & 0x80) { tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 0.05, MOVE_NORMAL, self); Projectile_DrawTrail(self, trace_endpos); @@ -181,7 +184,8 @@ void Ent_RemoveProjectile() } void Ent_Projectile() -{SELFPARAM(); +{ + SELFPARAM(); int f; // projectile properties: @@ -202,17 +206,17 @@ void Ent_Projectile() self.count = (f & 0x80); self.iflags = (self.iflags & IFLAG_INTERNALMASK) | IFLAG_AUTOANGLES | IFLAG_ANGLES | IFLAG_ORIGIN; self.solid = SOLID_TRIGGER; - //self.effects = EF_NOMODELFLAGS; + // self.effects = EF_NOMODELFLAGS; // this should make collisions with bmodels more exact, but it leads to // projectiles no longer being able to lie on a bmodel self.move_nomonsters = MOVE_WORLDONLY; - if(f & 0x40) + if (f & 0x40) self.move_flags |= FL_ONGROUND; else self.move_flags &= ~FL_ONGROUND; - if(!self.move_time) + if (!self.move_time) { // for some unknown reason, we don't need to care for // sv_gameplayfix_delayprojectiles here. @@ -220,38 +224,40 @@ void Ent_Projectile() self.spawntime = time; } else + { self.move_time = max(self.move_time, time); + } - if(!(self.count & 0x80)) + if (!(self.count & 0x80)) InterpolateOrigin_Undo(); - if(f & 1) + if (f & 1) { self.origin_x = ReadCoord(); self.origin_y = ReadCoord(); self.origin_z = ReadCoord(); setorigin(self, self.origin); - if(self.count & 0x80) + if (self.count & 0x80) { self.velocity_x = ReadCoord(); self.velocity_y = ReadCoord(); self.velocity_z = ReadCoord(); - if(f & 0x10) + if (f & 0x10) self.gravity = ReadCoord(); else - self.gravity = 0; // none + self.gravity = 0; // none self.move_origin = self.origin; self.move_velocity = self.velocity; } - if(time == self.spawntime || (self.count & 0x80) || (f & 0x08)) + if (time == self.spawntime || (self.count & 0x80) || (f & 0x08)) { self.trail_oldorigin = self.origin; - if(!(self.count & 0x80)) + if (!(self.count & 0x80)) InterpolateOrigin_Reset(); } - if(f & 0x20) + if (f & 0x20) { self.fade_time = time + ReadByte() * ticrate; self.fade_rate = 1 / (ReadByte() * ticrate); @@ -265,7 +271,7 @@ void Ent_Projectile() self.team = ReadByte() - 1; } - if(f & 2) + if (f & 2) { self.cnt = ReadByte(); @@ -274,8 +280,9 @@ void Ent_Projectile() self.scale = 1; self.traileffect = 0; - switch (self.cnt) { -#define CASE(id) case PROJECTILE_##id: setmodel(self, MDL_PROJECTILE_##id); + switch (self.cnt) + { + #define CASE(id) case PROJECTILE_##id: setmodel(self, MDL_PROJECTILE_##id); CASE(ELECTRO) self.traileffect = EFFECT_TR_NEXUIZPLASMA.m_id; break; CASE(ROCKET) self.traileffect = EFFECT_TR_ROCKET.m_id; self.scale = 2; break; CASE(CRYLINK) self.traileffect = EFFECT_TR_CRYLINKPLASMA.m_id; break; @@ -291,7 +298,7 @@ void Ent_Projectile() CASE(HOOKBOMB) self.traileffect = EFFECT_TR_KNIGHTSPIKE.m_id; break; CASE(HAGAR) self.traileffect = EFFECT_HAGAR_ROCKET.m_id; self.scale = 0.75; break; CASE(HAGAR_BOUNCING) self.traileffect = EFFECT_HAGAR_ROCKET.m_id; self.scale = 0.75; break; - CASE(NAPALM_FOUNTAIN) // fallthrough // sself.modelindex = 0; self.traileffect = _particleeffectnum("torch_small"); break; + CASE(NAPALM_FOUNTAIN) // fallthrough // sself.modelindex = 0; self.traileffect = _particleeffectnum("torch_small"); break; CASE(FIREBALL) self.modelindex = 0; self.traileffect = EFFECT_FIREBALL.m_id; break; // particle effect is good enough CASE(FIREMINE) self.modelindex = 0; self.traileffect = EFFECT_FIREMINE.m_id; break; // particle effect is good enough CASE(TAG) self.traileffect = EFFECT_TR_ROCKET.m_id; break; @@ -317,7 +324,7 @@ void Ent_Projectile() CASE(ROCKETMINSTA_LASER) self.traileffect = EFFECT_ROCKETMINSTA_LASER(self.team).m_id; break; #undef CASE default: - if(MUTATOR_CALLHOOK(Ent_Projectile, self)) + if (MUTATOR_CALLHOOK(Ent_Projectile, self)) break; if (Nade_FromProjectile(self.cnt) != NADE_TYPE_Null) @@ -338,7 +345,7 @@ void Ent_Projectile() self.move_movetype = MOVETYPE_TOSS; self.alphamod = 1; - switch(self.cnt) + switch (self.cnt) { case PROJECTILE_ELECTRO: // only new engines support sound moving with object @@ -424,39 +431,39 @@ void Ent_Projectile() self.mins = '-4 -4 -4'; self.maxs = '4 4 4'; break; - case PROJECTILE_RAPTORBOMB: + case PROJECTILE_RAPTORBOMB: self.mins = '-3 -3 -3'; self.maxs = '3 3 3'; break; - case PROJECTILE_RAPTORBOMBLET: - break; - case PROJECTILE_RAPTORCANNON: + case PROJECTILE_RAPTORBOMBLET: break; - case PROJECTILE_SPIDERROCKET: - loopsound(self, CH_SHOTS_SINGLE, SND(TAG_ROCKET_FLY), VOL_BASE, ATTEN_NORM); + case PROJECTILE_RAPTORCANNON: break; - case PROJECTILE_WAKIROCKET: - loopsound(self, CH_SHOTS_SINGLE, SND(TAG_ROCKET_FLY), VOL_BASE, ATTEN_NORM); + case PROJECTILE_SPIDERROCKET: + loopsound(self, CH_SHOTS_SINGLE, SND(TAG_ROCKET_FLY), VOL_BASE, ATTEN_NORM); break; - /* - case PROJECTILE_WAKICANNON: + case PROJECTILE_WAKIROCKET: + loopsound(self, CH_SHOTS_SINGLE, SND(TAG_ROCKET_FLY), VOL_BASE, ATTEN_NORM); break; + /* + case PROJECTILE_WAKICANNON: + break; case PROJECTILE_BUMBLE_GUN: - // only new engines support sound moving with object - loopsound(self, CH_SHOTS_SINGLE, SND(ELECTRO_FLY), VOL_BASE, ATTEN_NORM); - self.mins = '0 0 -4'; - self.maxs = '0 0 -4'; - self.move_movetype = MOVETYPE_BOUNCE; - self.move_touch = func_null; - self.move_bounce_factor = g_balance_electro_secondary_bouncefactor; - self.move_bounce_stopspeed = g_balance_electro_secondary_bouncestop; - break; + // only new engines support sound moving with object + loopsound(self, CH_SHOTS_SINGLE, SND(ELECTRO_FLY), VOL_BASE, ATTEN_NORM); + self.mins = '0 0 -4'; + self.maxs = '0 0 -4'; + self.move_movetype = MOVETYPE_BOUNCE; + self.move_touch = func_null; + self.move_bounce_factor = g_balance_electro_secondary_bouncefactor; + self.move_bounce_stopspeed = g_balance_electro_secondary_bouncestop; + break; */ default: break; } - if(Nade_FromProjectile(self.cnt) != NADE_TYPE_Null) + if (Nade_FromProjectile(self.cnt) != NADE_TYPE_Null) { entity nade_type = Nade_FromProjectile(self.cnt); self.mins = '-16 -16 -16'; @@ -467,7 +474,7 @@ void Ent_Projectile() self.scale = 1.5; self.avelocity = randomvec() * 720; - if(nade_type == NADE_TYPE_TRANSLOCATE || nade_type == NADE_TYPE_SPAWN) + if (nade_type == NADE_TYPE_TRANSLOCATE || nade_type == NADE_TYPE_SPAWN) self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP; else self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY; @@ -478,22 +485,22 @@ void Ent_Projectile() setsize(self, self.mins, self.maxs); } - if(self.gravity) + if (self.gravity) { - if(self.move_movetype == MOVETYPE_FLY) + if (self.move_movetype == MOVETYPE_FLY) self.move_movetype = MOVETYPE_TOSS; - if(self.move_movetype == MOVETYPE_BOUNCEMISSILE) + if (self.move_movetype == MOVETYPE_BOUNCEMISSILE) self.move_movetype = MOVETYPE_BOUNCE; } else { - if(self.move_movetype == MOVETYPE_TOSS) + if (self.move_movetype == MOVETYPE_TOSS) self.move_movetype = MOVETYPE_FLY; - if(self.move_movetype == MOVETYPE_BOUNCE) + if (self.move_movetype == MOVETYPE_BOUNCE) self.move_movetype = MOVETYPE_BOUNCEMISSILE; } - if(!(self.count & 0x80)) + if (!(self.count & 0x80)) InterpolateOrigin_Note(); self.classname = "csqcprojectile"; diff --git a/qcsrc/client/weapons/projectile.qh b/qcsrc/client/weapons/projectile.qh index 5a0deb499..847f3db49 100644 --- a/qcsrc/client/weapons/projectile.qh +++ b/qcsrc/client/weapons/projectile.qh @@ -2,20 +2,20 @@ #define CLIENT_WEAPONS_PROJECTILE_H entityclass(Projectile); -class(Projectile) .int traileffect; - -class(Projectile) .vector iorigin1, iorigin2; -class(Projectile) .float spawntime; -class(Projectile) .vector trail_oldorigin; -class(Projectile) .float trail_oldtime; -class(Projectile) .float fade_time, fade_rate; - -class(Projectile) .float alphamod; -class(Projectile) .int count; // set if clientside projectile -class(Projectile) .int cnt; // sound index -class(Projectile) .float gravity; -class(Projectile) .int snd_looping; -class(Projectile) .bool silent; +class(Projectile).int traileffect; + +class(Projectile).vector iorigin1, iorigin2; +class(Projectile).float spawntime; +class(Projectile).vector trail_oldorigin; +class(Projectile).float trail_oldtime; +class(Projectile).float fade_time, fade_rate; + +class(Projectile).float alphamod; +class(Projectile).int count; // set if clientside projectile +class(Projectile).int cnt; // sound index +class(Projectile).float gravity; +class(Projectile).int snd_looping; +class(Projectile).bool silent; void SUB_Stop(); diff --git a/qcsrc/uncrustify.cfg b/qcsrc/uncrustify.cfg index 4709cdc2d..5af29fc9b 100644 --- a/qcsrc/uncrustify.cfg +++ b/qcsrc/uncrustify.cfg @@ -1636,7 +1636,7 @@ mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. -mod_sort_include = false # false/true +mod_sort_include = true # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. # WARNING: Code doesn't seem to use this feature - delete from the config? @@ -1645,7 +1645,7 @@ mod_move_case_break = false # false/true # Will add or remove the braces around a fully braced case statement. # Will only remove the braces if there are no variable declarations in the block. # NOTE: is 78 worse than ignore -mod_case_brace = remove # ignore/add/remove/force +mod_case_brace = add # ignore/add/remove/force # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = true # false/true #force @@ -1696,7 +1696,7 @@ cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines # WARNING: Code doesn't seem to use this feature - delete from the config? -cmt_star_cont = false # false/true +cmt_star_cont = true # false/true # The number of spaces to insert at the start of subsequent comment lines # WARNING: Code doesn't seem to use this feature - delete from the config? @@ -1788,11 +1788,15 @@ pp_define_at_level = true # false/true # type myfoo1 myfoo2 type void +type bool +type int type float type vector type entity type string type .void +type .bool +type .int type .float type .vector type .entity @@ -1809,7 +1813,7 @@ type .string # You can assign any keyword to any type with the set option. # set func_call_user _ N_ -# menu QC OO +# QC OO macro-open CLASS macro-else EXTENDS macro-close ENDCLASS -- 2.39.2