From 69d811984c3706da6d093525db65c9d94a228f13 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 18 Jul 2017 12:26:31 +1000 Subject: [PATCH] Portal specialcommand to ClientState --- gfx/smile.tga | Bin 0 -> 65580 bytes qcsrc/client/view.qc | 66 +++++++++++++++++++++++++++++++++ qcsrc/common/physics/player.qc | 9 ++++- qcsrc/common/stats.qh | 1 + qcsrc/server/player.qc | 2 + 5 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 gfx/smile.tga diff --git a/gfx/smile.tga b/gfx/smile.tga new file mode 100644 index 0000000000000000000000000000000000000000..54ba1bc76ed03979bea5e30eb77b030893873b20 GIT binary patch literal 65580 zcmeI5S4fB&wBAAb1uXP$ZH z-dA3EFn#T zzy9(E9(ds9!C-LklTSVwq|eZ#(&$?s^8GVXADh@tZCpWHJ@1ocVEy{_$8FuZ_58hi z_g?e#(@!556H|}1_W@6P8O7c6)i0DcpiSBaL&Ea^(<&xQ%Q4^jdFP#X#!WZfbk)(L zNAI?CyT&ExqMl>dDaLc+8_KDk%UU;K*$<|K?et?l026ZXl1nZ*@9w+r{{3sOz4mA$ zHZ>NFJjL6~DBjX}T)Wa;Wu+g24UAx&5KYHivv7Iuz4z{Z_uY4&O0lh6TiWC0`Q!8| zM;X%oQ9YGWp7dTvI+e|NU5?FSy`>GxzP=_dD*(Q+&kpV&w3{4?leVg%@5( zw`~vHbjvNb{5Jhv%)Q$gXPj~Bi6@?T(yz)NX>{aKhO*r2Q8(Fm&ib0i*|A73nfpP) z{vv+mgmO82Knb^P-?MN&Ay9Y)V-6CQPvpsJ~X+=4bW^9})+@$g#xBFTec4GHxfH6lbJ#k-OoWZ@&5X zop;`O-KnRZx?v^0-u(<0w%B-cKPEz%t^xmTr3yIEY(lXSev;gw(}wK;@l}c zc=5#-AH4S3YqzHR^HZkHU!EDj2FB6{qE8&FZ!0hB;DYDQY4d3{@ND0{eGA{2#)UYk zaSr_==QG~R^?sV4p}@xXfsIYOZ;HA6)Nz(@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N%KN^1avn%s_h2`D>n!?fD?aMqF23OMmfl%9B()RYo?VUis3; za&Av$T^G~&7+>&d*52VxvQP5fjrmc$Cl2S9Vk7?jSo|ZERyjZRwAWYJF6nk zG1!^2}V%&3wl+=XH0-?}SyZOT0ObACIr+dAy>XR$eUQ$KJ*OtYDt@xtg=o zAK;RE=Cty^&+X_K~DgAJBh=JHs;&ORtSSFHrB=gP4VuhsT} zIs0i}#7#VR@$R1ANMoO5-mx;Tliy59d#dxh^e>P`$2&O6P?kE>Wp71aOR(Cwd;2{D zJp(-hJp(-hJp(-hJp(-hJp(-hJp(-hJp(-hJp(-hJp(-hJp(-hJp(-hJp(-hJp(-h d%VprQO@7uZV{{Wb**k=F$ literal 0 HcmV?d00001 diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 9b78e4907..0f8b59495 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -1347,6 +1347,71 @@ void HUD_Crosshair(entity this) } } +const int MAX_SPECIALCOMMAND = 15; +vector specialcommand_slots[MAX_SPECIALCOMMAND]; +vector specialcommand_colors[MAX_SPECIALCOMMAND]; +const float SPECIALCOMMAND_SPEED = 150; +const float SPECIALCOMMAND_TURNSPEED = 2; +const float SPECIALCOMMAND_SIZE = 0.025; +const float SPECIALCOMMAND_CHANCE = 0.35; +float sc_spawntime, sc_changetime; +vector sc_color = '1 1 1'; +void SpecialCommand() +{ + if(!STAT(MOVEVARS_SPECIALCOMMAND)) + return; + + if(time >= sc_changetime) + { + sc_changetime = time + 1; + sc_color = randomvec() * 1.5; + sc_color.x = bound(0.2, sc_color.x, 0.75); + sc_color.y = bound(0.2, sc_color.y, 0.75); + sc_color.z = bound(0.2, sc_color.z, 0.75); + } + drawfill('0 0 0', vec2(vid_conwidth, vid_conheight), sc_color, autocvar_hud_colorflash_alpha * bound(0.1, sc_changetime - time, 0.3), DRAWFLAG_ADDITIVE); + + if(!precache_pic("gfx/smile")) + return; // damn party poopers + + for(int j = MAX_SPECIALCOMMAND - 1; j >= 0; --j) + { + vector slot = specialcommand_slots[j]; + if(slot.y) + slot.y += SPECIALCOMMAND_SPEED * frametime; + if(slot.z) + slot.z = sin(SPECIALCOMMAND_TURNSPEED * M_PI * time); + if(slot.y >= vid_conheight) + slot = '0 0 0'; + + if(slot == '0 0 0') + { + if(random() <= SPECIALCOMMAND_CHANCE && time > sc_spawntime) // low chance to spawn! + { + slot.x = bound(0, (random() * vid_conwidth + 1), vid_conwidth); + slot.y = 1; // start it off 0 so we can use it + slot.z = random(); + sc_spawntime = time + bound(0.4, random(), 0.75); // prevent spawning another one for this amount of time! + vector newcolor = randomvec() * 2; + newcolor.x = bound(0.4, newcolor.x, 1); + newcolor.y = bound(0.4, newcolor.y, 1); + newcolor.z = bound(0.4, newcolor.z, 1); + specialcommand_colors[j] = newcolor; + } + } + else + { + vector splash_size = '0 0 0'; + splash_size.x = max(vid_conwidth, vid_conheight) * SPECIALCOMMAND_SIZE; + splash_size.y = max(vid_conwidth, vid_conheight) * SPECIALCOMMAND_SIZE; + drawpic(vec2(slot), "gfx/smile", vec2(splash_size), specialcommand_colors[j], 0.95, DRAWFLAG_NORMAL); + //drawrotpic(vec2(slot), slot.z, "gfx/smile", vec2(splash_size), vec2(splash_size) / 2, specialcommand_colors[j], 0.95, DRAWFLAG_NORMAL); + } + + specialcommand_slots[j] = slot; + } +} + void HUD_Draw(entity this) { // if we don't know gametype and scores yet avoid drawing the scoreboard @@ -1402,6 +1467,7 @@ void HUD_Draw(entity this) } // crosshair goes VERY LAST + SpecialCommand(); UpdateDamage(); HUD_Crosshair(this); HitSound(); diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 5a41e91da..b73942b87 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -488,8 +488,13 @@ string specialcommand = "xwxwxsxsxaxdxaxdx1x "; .float specialcommand_pos; void SpecialCommand(entity this) { - if (!CheatImpulse(this, CHIMPULSE_GIVE_ALL.impulse)) - LOG_INFO("A hollow voice says \"Plugh\".\n"); + if(autocvar_sv_cheats || this.maycheat) + { + if (!CheatImpulse(this, CHIMPULSE_GIVE_ALL.impulse)) + LOG_INFO("A hollow voice says \"Plugh\".\n"); + } + else + STAT(MOVEVARS_SPECIALCOMMAND, this) = true; } #endif diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index bfed4390d..c1503ca68 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -341,6 +341,7 @@ REGISTER_STAT(MOVEVARS_MAXAIRSPEED, float) REGISTER_STAT(MOVEVARS_STEPHEIGHT, float, autocvar_sv_stepheight) REGISTER_STAT(MOVEVARS_AIRACCEL_QW, float) REGISTER_STAT(MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, float) +REGISTER_STAT(MOVEVARS_SPECIALCOMMAND, bool) #ifdef CSQC diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index 2d7d99229..c40f87de3 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -616,6 +616,8 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, // dying animation this.deadflag = DEAD_DYING; + STAT(MOVEVARS_SPECIALCOMMAND, this) = false; // sweet release + // when to allow respawn calculate_player_respawn_time(this); -- 2.39.2