]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/csqc_models
authorMario <mario.mario@y7mail.com>
Sat, 2 Nov 2013 07:32:28 +0000 (18:32 +1100)
committerMario <mario.mario@y7mail.com>
Sat, 2 Nov 2013 07:32:28 +0000 (18:32 +1100)
qcsrc/client/hud.qc
qcsrc/client/miscfunctions.qc
qcsrc/common/csqcmodel_settings.qh
qcsrc/csqcmodellib/cl_model.qc
qcsrc/csqcmodellib/common.qh
qcsrc/server/func_breakable.qc
qcsrc/server/mutators/gamemode_onslaught.qc
qcsrc/server/mutators/sandbox.qc

index 293ad379e1d9bd3550a3cc20d7895196a1e754b4..fa22178ecc9f77065a90a21acaf4f870393dd7cf 100644 (file)
@@ -142,16 +142,16 @@ float stringwidth_nocolors(string s, vector theSize)
        return stringwidth(s, FALSE, theSize);
 }
 
-void drawstringright(vector position, string text, vector scale, vector rgb, float theAlpha, float flag)
+void drawstringright(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag)
 {
-       position_x -= 2 / 3 * strlen(text) * scale_x;
-       drawstring(position, text, scale, rgb, theAlpha, flag);
+       position_x -= 2 / 3 * strlen(text) * theScale_x;
+       drawstring(position, text, theScale, rgb, theAlpha, flag);
 }
 
-void drawstringcenter(vector position, string text, vector scale, vector rgb, float theAlpha, float flag)
+void drawstringcenter(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag)
 {
-       position_x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * scale_x);
-       drawstring(position, text, scale, rgb, theAlpha, flag);
+       position_x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * theScale_x);
+       drawstring(position, text, theScale, rgb, theAlpha, flag);
 }
 
 // return the string of the onscreen race timer
index 7f1b893a7c5c28691d5a8ce127ea0bd9ed1d0a8b..eb91814f670bb2cfa707a1f25a32483874d1ce86 100644 (file)
@@ -302,18 +302,18 @@ var string _drawpic_picpath;
                _drawpic_picpath = string_null;\
        } while(0)
 
-void drawpic_aspect_skin_expanding(vector position, string pic, vector scale, vector rgb, float theAlpha, float flag, float fadelerp)
+void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
 {
        float sz;
        sz = expandingbox_sizefactor_from_fadelerp(fadelerp);
 
-       drawpic_aspect_skin(position + expandingbox_resize_centered_box_offset(sz, scale, 1), pic, scale * sz, rgb, theAlpha * (1 - fadelerp), flag);
+       drawpic_aspect_skin(position + expandingbox_resize_centered_box_offset(sz, theScale, 1), pic, theScale * sz, rgb, theAlpha * (1 - fadelerp), flag);
 }
 
-void drawpic_aspect_skin_expanding_two(vector position, string pic, vector scale, vector rgb, float theAlpha, float flag, float fadelerp)
+void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
 {
-       drawpic_aspect_skin_expanding(position, pic, scale, rgb, theAlpha, flag, fadelerp);
-       drawpic_skin(position, pic, scale, rgb, theAlpha * fadelerp, flag);
+       drawpic_aspect_skin_expanding(position, pic, theScale, rgb, theAlpha, flag, fadelerp);
+       drawpic_skin(position, pic, theScale, rgb, theAlpha * fadelerp, flag);
 }
 #define SET_POS_AND_SZ_Y_ASPECT(allow_colors)\
        float textaspect, oldsz;\
@@ -341,14 +341,14 @@ void drawcolorcodedstring_aspect(vector pos, string text, vector sz, float theAl
 }
 
 vector drawfontscale;
-void drawstring_expanding(vector position, string text, vector scale, vector rgb, float theAlpha, float flag, float fadelerp)
+void drawstring_expanding(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
 {
        float sz;
        sz = expandingbox_sizefactor_from_fadelerp(fadelerp);
 
        drawfontscale = sz * '1 1 0';
        dummyfunction(0, 0, 0, 0, 0, 0, 0, 0);
-       drawstring(position + expandingbox_resize_centered_box_offset(sz, scale, stringwidth(text, FALSE, scale * (sz / drawfontscale_x)) / (scale_x * sz)), text, scale * (sz / drawfontscale_x), rgb, theAlpha * (1 - fadelerp), flag);
+       drawstring(position + expandingbox_resize_centered_box_offset(sz, theScale, stringwidth(text, FALSE, theScale * (sz / drawfontscale_x)) / (theScale_x * sz)), text, theScale * (sz / drawfontscale_x), rgb, theAlpha * (1 - fadelerp), flag);
        // width parameter:
        //    (scale_x * sz / drawfontscale_x) * drawfontscale_x * SIZE1 / (scale_x * sz)
        //    SIZE1
@@ -361,14 +361,14 @@ void drawstring_aspect_expanding(vector pos, string text, vector sz, vector colo
        drawstring_expanding(pos, text, '1 1 0' * sz_y, color, theAlpha, drawflag, fadelerp);
 }
 
-void drawcolorcodedstring_expanding(vector position, string text, vector scale, float theAlpha, float flag, float fadelerp)
+void drawcolorcodedstring_expanding(vector position, string text, vector theScale, float theAlpha, float flag, float fadelerp)
 {
        float sz;
        sz = expandingbox_sizefactor_from_fadelerp(fadelerp);
 
        drawfontscale = sz * '1 1 0';
        dummyfunction(0, 0, 0, 0, 0, 0, 0, 0);
-       drawcolorcodedstring(position + expandingbox_resize_centered_box_offset(sz, scale, stringwidth(text, TRUE, scale * (sz / drawfontscale_x)) / (scale_x * sz)), text, scale * (sz / drawfontscale_x), theAlpha * (1 - fadelerp), flag);
+       drawcolorcodedstring(position + expandingbox_resize_centered_box_offset(sz, theScale, stringwidth(text, TRUE, theScale * (sz / drawfontscale_x)) / (theScale_x * sz)), text, theScale * (sz / drawfontscale_x), theAlpha * (1 - fadelerp), flag);
        drawfontscale = '1 1 0';
 }
 
index a9ed986deef9e774a4a3c38b0eaaf50a30dfce82..c53a19d04e3e87f6b0662fec9ae4e42b86cc5b4b 100644 (file)
@@ -45,7 +45,8 @@
                CSQCMODEL_PROPERTY(512, float, ReadChar, WriteChar, anim_upper_action) \
                CSQCMODEL_PROPERTY(512, float, ReadApproxPastTime, WriteApproxPastTime, anim_upper_time) \
                CSQCMODEL_PROPERTY(1024, float, ReadAngle, WriteAngle, v_angle_x) \
-       CSQCMODEL_ENDIF
+       CSQCMODEL_ENDIF \
+       CSQCMODEL_PROPERTY_SCALED(4096, float, ReadShort, WriteShort, scale, 256, 0, 99999999)
 // TODO get rid of colormod/glowmod here, find good solution for nex charge glowmod hack; also get rid of some useless properties on non-players that only exist for CopyBody
 
 // add hook function calls here
index 2c7bc2d925da89fc0c1d971ad86e2ca696cddb2c..3333096423ec0b04337349dd5985f1bdcd5d9fbf 100644 (file)
@@ -236,8 +236,11 @@ void CSQCModel_Read(float isnew)
 #undef CSQCMODEL_IF
 
        if(sf & CSQCMODEL_PROPERTY_MODELINDEX)
+       {
+               vector oldmins = self.mins, oldmaxs = self.maxs;
                setmodelindex(self, self.modelindex); // this retrieves the .model key and sets mins/maxs/absmin/absmax
-               // FIXME do we WANT this to override mins/maxs?
+               setsize(self, oldmins, oldmaxs);
+       }
 
        if(sf & CSQCMODEL_PROPERTY_TELEPORTED)
        {
index f6044cb283f3cf3b9b87959121df6c9abfff81b2..f0a3d5243ea8a7deac6a4e13797f55d8fec6e527 100644 (file)
@@ -58,6 +58,7 @@ IN THE SOFTWARE.\
 #define CSQCMODEL_PROPERTY_PITCHROLL 1024
 #define CSQCMODEL_PROPERTY_FRAME2 512
 #define CSQCMODEL_PROPERTY_LERPFRAC 256
+#define CSQCMODEL_PROPERTY_SIZE 128
 
 #define ALLPROPERTIES_COMMON \
        CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME, float, ReadByte, WriteByte, frame) \
@@ -65,6 +66,12 @@ IN THE SOFTWARE.\
        CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, float, ReadCoord, WriteCoord, origin_x) \
        CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, float, ReadCoord, WriteCoord, origin_y) \
        CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, float, ReadCoord, WriteCoord, origin_z) \
+       CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadCoord, WriteCoord, mins_x) \
+       CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadCoord, WriteCoord, mins_y) \
+       CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadCoord, WriteCoord, mins_z) \
+       CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadCoord, WriteCoord, maxs_x) \
+       CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadCoord, WriteCoord, maxs_y) \
+       CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadCoord, WriteCoord, maxs_z) \
        CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_PITCHROLL, float, ReadAngle, WriteAngle, angles_x) \
        CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_YAW, float, ReadAngle, WriteAngle, angles_y) \
        CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_PITCHROLL, float, ReadAngle, WriteAngle, angles_z) \
index a8dea48ef31640c84aaa9df219ab8192da304e15..d67e79cd4d3396e45b74e9747291036680fc968d 100644 (file)
@@ -79,6 +79,8 @@ void func_breakable_colormod()
                self.colormod = '1 0 0' + '0 1 0' * (2 * h - 0.5);
        else
                self.colormod = '1 1 1';
+               
+       CSQCMODEL_AUTOUPDATE();
 }
 
 void func_breakable_look_destroyed()
@@ -140,12 +142,16 @@ void func_breakable_destroyed()
 {
        func_breakable_look_destroyed();
        func_breakable_behave_destroyed();
+       
+       CSQCMODEL_AUTOUPDATE();
 }
 
 void func_breakable_restore()
 {
        func_breakable_look_restore();
        func_breakable_behave_restore();
+       
+       CSQCMODEL_AUTOUPDATE();
 }
 
 vector debrisforce; // global, set before calling this
@@ -217,6 +223,8 @@ void func_breakable_reset()
                func_breakable_behave_destroyed();
        else
                func_breakable_behave_restore();
+               
+       CSQCMODEL_AUTOUPDATE();
 }
 
 // destructible walls that can be used to trigger target_objective_decrease
@@ -268,6 +276,8 @@ void spawnfunc_func_breakable() {
 
        self.reset = func_breakable_reset;
        func_breakable_reset();
+       
+       CSQCMODEL_AUTOINIT();
 }
 
 // for use in maps with a "model" key set
index a419d7b1f3b416525f2839ecc4f218d98aef9483..fd7f305c910c2859bd528e72d5fb9ec29ae62aba 100644 (file)
@@ -1304,6 +1304,12 @@ void onslaught_controlpoint_touch()
        onslaught_updatelinks();
 }
 
+void onslaught_controlpoint_think()
+{
+       self.nextthink = time;
+       CSQCMODEL_AUTOUPDATE();
+}
+
 void onslaught_controlpoint_reset()
 {
        if(self.goalentity && self.goalentity != world)
@@ -1316,8 +1322,9 @@ void onslaught_controlpoint_reset()
        self.isshielded = TRUE;
        self.enemy.solid = SOLID_NOT;
        self.enemy.colormap = self.colormap;
-       self.think = self.enemy.think = func_null;
-       self.nextthink = 0; // don't like func_null :P
+       self.think = onslaught_controlpoint_think;
+       self.enemy.think = func_null;
+       self.nextthink = time; // don't like func_null :P
        setmodel(self, "models/onslaught/controlpoint_pad.md3");
        //setsize(self, '-32 -32 0', '32 32 8');
 
@@ -1327,6 +1334,8 @@ void onslaught_controlpoint_reset()
 
        activator = self;
        SUB_UseTargets(); // to reset the structures, playerspawns etc.
+       
+       CSQCMODEL_AUTOUPDATE();
 }
 
 /*QUAKED spawnfunc_onslaught_controlpoint (0 .5 .8) (-32 -32 0) (32 32 128)
@@ -1397,6 +1406,9 @@ void spawnfunc_onslaught_controlpoint()
        self.enemy.colormap = self.colormap;
 
        waypoint_spawnforitem(self);
+       
+       self.think = onslaught_controlpoint_think;
+       self.nextthink = time;
 
        WaypointSprite_SpawnFixed(string_null, self.origin + '0 0 128', self, sprite, RADARICON_NONE, '0 0 0');
        WaypointSprite_UpdateRule(self.sprite, NUM_TEAM_2, SPRITERULE_TEAMPLAY);
@@ -1404,6 +1416,8 @@ void spawnfunc_onslaught_controlpoint()
        onslaught_updatelinks();
 
        self.reset = onslaught_controlpoint_reset;
+       
+       CSQCMODEL_AUTOINIT();
 }
 
 float onslaught_link_send(entity to, float sendflags)
index a077b213a00b6b60f21a7f7844273843ea7f626b..e84c6d696a91e691ccadabf6c68cd927febbc97f 100644 (file)
@@ -56,6 +56,8 @@ void sandbox_ObjectFunction_Think()
        }
 
        self.nextthink = time;
+       
+       CSQCMODEL_AUTOUPDATE();
 }
 
 .float old_solid, old_movetype;
@@ -137,7 +139,7 @@ entity sandbox_ObjectSpawn(float database)
 {
        // spawn a new object with default properties
 
-       entity e;
+       entity e, oldself;
        e = spawn();
        e.classname = "object";
        e.takedamage = DAMAGE_AIM;
@@ -172,6 +174,11 @@ entity sandbox_ObjectSpawn(float database)
                setorigin(e, trace_endpos);
                e.angles_y = self.v_angle_y;
        }
+       
+       oldself = self;
+       self = e;
+       CSQCMODEL_AUTOINIT();
+       self = oldself;
 
        object_count += 1;
        return e;