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 14c081c..4655a8a 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 3f9c729..e4fadc5 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 3daed15..843d0df 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 db40270..68bc230 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 1fb6ab0..8f05815 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