From df1e0c9ae7d49acbee5c022127e44f1d821d9d87 Mon Sep 17 00:00:00 2001 From: Penguinum Date: Wed, 6 May 2015 09:25:04 +0300 Subject: [PATCH] Xonotic-like code formatting --- qcsrc/client/wall.qc | 55 +++++++++++++++++++++----------------- qcsrc/client/wall.qh | 1 + qcsrc/server/g_models.qc | 14 +++++----- qcsrc/server/g_triggers.qc | 37 ++++++++++++++----------- 4 files changed, 60 insertions(+), 47 deletions(-) diff --git a/qcsrc/client/wall.qc b/qcsrc/client/wall.qc index 8ff162faa..d80787d73 100644 --- a/qcsrc/client/wall.qc +++ b/qcsrc/client/wall.qc @@ -2,25 +2,30 @@ 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.alpha = self.alpha_max / 100.0 * bound(0, - (self.fade_end - vlen(org - self.origin - 0.5 * (self.mins + self.maxs))) - / (self.fade_end - self.fade_start), 1); - } else { - self.alpha = 1; - } - } - if(self.alpha <= 0) - self.drawmask = 0; - else - self.drawmask = MASK_NORMAL; + 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.alpha = self.alpha_max / 100.0 * bound(0, + (self.fade_end - vlen(org - self.origin - 0.5 * (self.mins + self.maxs))) + / (self.fade_end - self.fade_start), 1); + } + else + { + self.alpha = 1; + } + } + if(self.alpha <= 0) + self.drawmask = 0; + else + self.drawmask = MASK_NORMAL; } void Ent_Wall_Draw() @@ -187,11 +192,11 @@ 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_start = ReadShort(); + self.fade_end = ReadShort(); + self.alpha_max = ReadShort(); + self.alpha_min = ReadShort(); + self.inactive = ReadShort(); BGMScript_InitEntity(self); } @@ -201,5 +206,5 @@ void Ent_Wall() self.entremove = Ent_Wall_Remove; self.draw = Ent_Wall_Draw; - self.predraw = Ent_Wall_PreDraw; + self.predraw = Ent_Wall_PreDraw; } diff --git a/qcsrc/client/wall.qh b/qcsrc/client/wall.qh index 85d025f81..cfed79050 100644 --- a/qcsrc/client/wall.qh +++ b/qcsrc/client/wall.qh @@ -12,6 +12,7 @@ .float alpha_max, alpha_min; .float fade_start, fade_end; .float default_solid; // Variable to store default self.solid for clientwalls +.float clientwall_flag; void Ent_Wall_Draw(); diff --git a/qcsrc/server/g_models.qc b/qcsrc/server/g_models.qc index cd25c53ef..bd23500c8 100644 --- a/qcsrc/server/g_models.qc +++ b/qcsrc/server/g_models.qc @@ -34,7 +34,7 @@ void g_clientmodel_setcolormaptoactivator (void) void g_clientmodel_use(void) { - g_clientmodel_setcolormaptoactivator(); + g_clientmodel_setcolormaptoactivator(); } void g_model_dropbyspawnflags() @@ -138,11 +138,11 @@ float g_clientmodel_genericsendentity (entity to, float sf) WriteCoord(MSG_ENTITY, self.movedir.z); WriteByte(MSG_ENTITY, floor(self.lip * 255)); } - WriteShort(MSG_ENTITY, self.fade_start); - WriteShort(MSG_ENTITY, self.fade_end); - WriteShort(MSG_ENTITY, self.alpha_max); - WriteShort(MSG_ENTITY, self.alpha_min); - WriteShort(MSG_ENTITY, self.inactive); + WriteShort(MSG_ENTITY, self.fade_start); + WriteShort(MSG_ENTITY, self.fade_end); + WriteShort(MSG_ENTITY, self.alpha_max); + WriteShort(MSG_ENTITY, self.alpha_min); + WriteShort(MSG_ENTITY, self.inactive); } return true; @@ -166,7 +166,7 @@ float g_clientmodel_genericsendentity (entity to, float sf) if(!self.solid) self.solid = (sol); else if(self.solid < 0) self.solid = SOLID_NOT; \ if(!self.bgmscriptsustain) self.bgmscriptsustain = 1; else if(self.bgmscriptsustain < 0) self.bgmscriptsustain = 0; \ Net_LinkEntity(self, true, 0, g_clientmodel_genericsendentity); \ - self.default_solid = sol; + self.default_solid = sol; // non-solid model entities: void spawnfunc_misc_gamemodel() { self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // model entity diff --git a/qcsrc/server/g_triggers.qc b/qcsrc/server/g_triggers.qc index 6851f2942..e2d088ae9 100644 --- a/qcsrc/server/g_triggers.qc +++ b/qcsrc/server/g_triggers.qc @@ -103,9 +103,9 @@ void SUB_UseTargets() } if (s != "") { - // Flag to set func_clientwall state - // 1 == deactivate, 2 == activate, 0 == do nothing - float aw_inactive = self.clientwall_flag; + // Flag to set func_clientwall state + // 1 == deactivate, 2 == activate, 0 == do nothing + float aw_inactive = self.clientwall_flag; for(t = world; (t = find(t, targetname, s)); ) if(t.use) { @@ -115,18 +115,25 @@ void SUB_UseTargets() } else { - if (t.classname == "func_clientwall" || t.classname == "func_clientillusionary") { - if (aw_inactive == 1) { - t.inactive = 1; - } else if (aw_inactive == 2) { - t.inactive = 0; - } - if (t.inactive) { - t.solid = SOLID_NOT; - } else { - t.solid = t.default_solid; - } - } + if (t.classname == "func_clientwall" || t.classname == "func_clientillusionary") + { + if (aw_inactive == 1) + { + t.inactive = 1; + } + else if (aw_inactive == 2) + { + t.inactive = 0; + } + if (t.inactive) + { + t.solid = SOLID_NOT; + } + else + { + t.solid = t.default_solid; + } + } self = t; other = stemp; activator = act; -- 2.39.2