X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Fwall.qc;h=f17b54a5caa7bf0f877593c1cd1a811d148fcb46;hp=98a2318d7b74de9d4a3dc9f31e3907ec18dc8c89;hb=9ae63d858415772fdb60bd549758825103c0ba17;hpb=0f64a49d36ce2363cb3052153b7d8e4f2addeb6c diff --git a/qcsrc/client/wall.qc b/qcsrc/client/wall.qc index 98a2318d7b..f17b54a5ca 100644 --- a/qcsrc/client/wall.qc +++ b/qcsrc/client/wall.qc @@ -1,8 +1,7 @@ #include "wall.qh" +#include "_all.qh" -#include "autocvars.qh" #include "bgmscript.qh" -#include "main.qh" #include "../common/util.qh" @@ -12,7 +11,47 @@ .float scale; .vector movedir; -void Ent_Wall_Draw() +void Ent_Wall_PreDraw() +{SELFPARAM(); + if (self.inactive) + { + self.alpha = 0; + } + else + { + vector org = getpropertyvec(VF_ORIGIN); + if(!checkpvs(org, self)) + self.alpha = 0; + else if(self.fade_start || self.fade_end) { + vector offset = '0 0 0'; + offset_z = self.fade_vertical_offset; + float player_dist = vlen(org - self.origin - 0.5 * (self.mins + self.maxs) + offset); + if (self.fade_end == self.fade_start) + { + if (player_dist >= self.fade_start) + self.alpha = 0; + else + self.alpha = 1; + } + else + { + self.alpha = (self.alpha_min + self.alpha_max * bound(0, + (self.fade_end - player_dist) + / (self.fade_end - self.fade_start), 1)) / 100.0; + } + } + else + { + self.alpha = 1; + } + } + if(self.alpha <= 0) + self.drawmask = 0; + else + self.drawmask = MASK_NORMAL; +} + +void Ent_Wall_Draw(entity this) { float f; var .vector fld; @@ -52,7 +91,7 @@ void Ent_Wall_Draw() self.saved = self.(fld); - f = BGMScript(self); + f = doBGMScript(self); if(f >= 0) { if(self.lip < 0) // < 0: alpha goes from 1 to 1-|lip| when toggled (toggling subtracts lip) @@ -71,14 +110,14 @@ void Ent_Wall_Draw() } void Ent_Wall_Remove() -{ +{SELFPARAM(); if(self.bgmscript) strunzone(self.bgmscript); self.bgmscript = string_null; } void Ent_Wall() -{ +{SELFPARAM(); int f; var .vector fld; @@ -176,6 +215,12 @@ void Ent_Wall() self.movedir_z = ReadCoord(); self.lip = ReadByte() / 255.0; } + self.fade_start = ReadShort(); + self.fade_end = ReadShort(); + self.alpha_max = ReadShort(); + self.alpha_min = ReadShort(); + self.inactive = ReadShort(); + self.fade_vertical_offset = ReadShort(); BGMScript_InitEntity(self); } @@ -185,4 +230,5 @@ void Ent_Wall() self.entremove = Ent_Wall_Remove; self.draw = Ent_Wall_Draw; + self.predraw = Ent_Wall_PreDraw; }