From 8e1c85cf32ace753f3443fe70d9a4d74653c49e4 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sat, 31 Dec 2011 12:50:14 +0100 Subject: [PATCH] support negative alpha --- qcsrc/common/csqcmodel_settings.qh | 2 +- qcsrc/csqcmodellib/cl_model.qc | 2 +- qcsrc/csqcmodellib/sv_model.qc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/qcsrc/common/csqcmodel_settings.qh b/qcsrc/common/csqcmodel_settings.qh index 0f3ca3859..e0dfce4ca 100644 --- a/qcsrc/common/csqcmodel_settings.qh +++ b/qcsrc/common/csqcmodel_settings.qh @@ -19,7 +19,7 @@ CSQCMODEL_PROPERTY(1, float, ReadShort, WriteShort, colormap) \ CSQCMODEL_PROPERTY(2, float, ReadInt24_t, WriteInt24_t, effects) \ CSQCMODEL_PROPERTY(4, float, ReadByte, WriteByte, modelflags) \ - CSQCMODEL_PROPERTY_SCALED(8, float, ReadByte, WriteByte, alpha, 255, 0, 255) \ + CSQCMODEL_PROPERTY_SCALED(8, float, ReadByte, WriteByte, alpha, 254, -1, 254) \ CSQCMODEL_PROPERTY(16, float, ReadByte, WriteByte, skin) \ CSQCMODEL_IF(isplayer) \ CSQCMODEL_ENDIF \ diff --git a/qcsrc/csqcmodellib/cl_model.qc b/qcsrc/csqcmodellib/cl_model.qc index 24f3c60e0..b77507bb6 100644 --- a/qcsrc/csqcmodellib/cl_model.qc +++ b/qcsrc/csqcmodellib/cl_model.qc @@ -195,7 +195,7 @@ void CSQCModel_Read(float isnew) self.f = r(); #define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) \ if(sf & flag) \ - self.f = r() / s; + self.f = (r() + mi) / s; ALLPROPERTIES #undef CSQCMODEL_PROPERTY_SCALED #undef CSQCMODEL_PROPERTY diff --git a/qcsrc/csqcmodellib/sv_model.qc b/qcsrc/csqcmodellib/sv_model.qc index 3646370ce..bf6eefa69 100644 --- a/qcsrc/csqcmodellib/sv_model.qc +++ b/qcsrc/csqcmodellib/sv_model.qc @@ -92,7 +92,7 @@ void CSQCModel_CheckUpdate() } #define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) \ { \ - t tmp = bound(mi, s * self.f, ma); \ + t tmp = bound(mi, s * self.f, ma) - mi; \ if(tmp != self.csqcmodel_##f) \ { \ self.csqcmodel_##f = tmp; \ -- 2.39.2