]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Make saturation depend on the amount of armor the player has (post process effect)
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 8 Jul 2011 14:54:26 +0000 (17:54 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 8 Jul 2011 14:54:26 +0000 (17:54 +0300)
data/defaultVT.cfg
data/qcsrc/client/Main.qc
data/qcsrc/client/View.qc
data/qcsrc/client/main.qh
data/qcsrc/server/cl_client.qc

index 14c081c990e4464bec1dc390e5b5de0c70cb8391..4655a8afd76992ab9c0f28da477465b985a6ddd9 100644 (file)
@@ -1118,6 +1118,8 @@ seta hud_damage_pain_threshold_pulsating_period 0.8 "one pulse every X seconds"
 \r
 seta hud_powerup 0 "power of the sharpen effect when owning the shield or strength powerups, default is 0.5"\r
 \r
+seta hud_saturation 0 "saturation changes based on the amount of armor you have"\r
+\r
 seta hud_stomach 0.65 "displays a splash on the screen when inside the stomach, value specifies alpha"\r
 seta hud_stomach_color "0.75 1 0" "color of the stomach screen splash"\r
 seta hud_stomach_fade_in 0.2 "how quickly the stomach splash appears when you get swallowed"\r
index 3f9c72927e22bb6636cf010b59f025ffca3a8510..e4fadc50ff3906e52edf2c3101f304e0fbe03654 100644 (file)
@@ -1035,6 +1035,8 @@ void Ent_Init()
        g_vore = ReadCoord();\r
        g_balance_vore_swallow_limit = ReadCoord();\r
 \r
+       armor_enabled = ReadByte();\r
+\r
        if(!postinit)\r
                PostInit();\r
 }\r
index 3daed15576e4d181a64aa3272457ad572c5ca250..843d0df23e2f572117cc9d1ac0802e94b8f33343 100644 (file)
@@ -808,6 +808,24 @@ void CSQC_UpdateView(float w, float h)
                cvar_set("r_glsl_postprocess_uservec2_enable", "0");\r
        }\r
 \r
+       if(cvar("hud_postprocessing") && cvar("hud_saturation"))\r
+       {\r
+               // change saturation based on the amount of armor we have\r
+               // ranges between 0 and 50 armor. 0 armor is saturation 0.5, and 0.5 armor or above is saturation 1\r
+\r
+               if(armor_enabled && spectatee_status != -1 && getstati(STAT_HEALTH) > 0)\r
+               {\r
+                       float saturation;\r
+                       saturation = 0.5 + (getstati(STAT_ARMOR) * 1 * 0.01);\r
+                       saturation = bound(0, saturation, 1);\r
+\r
+                       if(cvar("r_glsl_saturation") != saturation)\r
+                               cvar_set("r_glsl_saturation", ftos(saturation));\r
+               }\r
+               else if(cvar("r_glsl_saturation") != 1)\r
+                       cvar_set("r_glsl_saturation", "1");\r
+       }\r
+\r
        // volume cutting\r
        if(cvar("cl_vore_cutvolume_sound") < 1 || cvar("cl_vore_cutvolume_music") < 1)\r
        {\r
index db40270fc22a0c4a04401b8b186999e8c9b880e1..68bc2300f2015b5e38b0590a4a4c8ced382b3564 100644 (file)
@@ -168,6 +168,7 @@ float g_weaponswitchdelay;
 \r
 float g_vore;\r
 float g_balance_vore_swallow_limit;\r
+float armor_enabled;\r
 \r
 //hooks\r
 float calledhooks;\r
index 1fb6ab0a7f7951eb01ac47eba0b92f5f18278659..8f058155c16a32c95245724dd31d9a967fafb382 100644 (file)
@@ -1044,6 +1044,13 @@ float ClientInit_SendEntity(entity to, float sf)
 \r
        WriteCoord(MSG_ENTITY, cvar("g_vore"));\r
        WriteCoord(MSG_ENTITY, g_balance_vore_swallow_limit);\r
+\r
+       // tell the client if this server uses armor\r
+       float armor_enabled;\r
+       if(cvar("g_balance_armor_start") || (cvar("g_lms") && cvar("g_lms_start_armor")) || (inWarmupStage && cvar("g_warmup_start_armor")) || cvar("g_balance_armor_regen") || cvar("g_balance_armor_regenlinear"))\r
+               armor_enabled = TRUE;\r
+       WriteByte(MSG_ENTITY, armor_enabled);\r
+\r
        return TRUE;\r
 }\r
 \r