From: Mario Date: Sun, 12 Jul 2015 10:46:34 +0000 (+1000) Subject: Merge branch 'master' into Penguinum/Antiwall X-Git-Tag: xonotic-v0.8.1~40^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6e12e42c14caa13f188ad12ce1fce1358428bee4;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into Penguinum/Antiwall --- 6e12e42c14caa13f188ad12ce1fce1358428bee4 diff --cc qcsrc/client/wall.qc index 6a9f5a440,f591268d3..f9bf9914c --- a/qcsrc/client/wall.qc +++ b/qcsrc/client/wall.qc @@@ -1,46 -1,16 +1,57 @@@ #include "wall.qh" + #include "_all.qh" + + #include "bgmscript.qh" + + #include "../common/util.qh" + + #include "../csqcmodellib/interpolate.qh" + + .float alpha; + .float scale; + .vector movedir; +void Ent_Wall_PreDraw() +{ + if (self.inactive) + { + self.alpha = 0; + } + else + { + vector org; + 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() { float f; diff --cc qcsrc/client/wall.qh index 3094b4373,57aef7e0c..d84fa46b6 --- a/qcsrc/client/wall.qh +++ b/qcsrc/client/wall.qh @@@ -1,22 -1,13 +1,23 @@@ #ifndef WALL_H #define WALL_H - .float lip; - .float bgmscriptangular; - .int lodmodelindex0, lodmodelindex1, lodmodelindex2; - .float loddistance1, loddistance2; - .vector saved; + entityclass(Wall); + class(Wall) .float lip; + class(Wall) .float bgmscriptangular; + class(Wall) .int lodmodelindex0, lodmodelindex1, lodmodelindex2; + class(Wall) .float loddistance1, loddistance2; + class(Wall) .vector saved; +// Needed for interactive clientwalls +.float inactive; // Clientwall disappears when inactive +.float alpha_max, alpha_min; +// If fade_start > fade_end, fadeout will be inverted +// fade_vertical_offset is a vertival offset for player position +.float fade_start, fade_end, fade_vertical_offset; +.float default_solid; +// This variable will be set by trigger +.float antiwall_flag; + void Ent_Wall_Draw(); void Ent_Wall_Remove();