]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Rotate .obj entity models 180 degrees around the Y axis, workaround for an engine bug
authorMario <mario.mario@y7mail.com>
Sat, 28 Dec 2019 18:22:29 +0000 (04:22 +1000)
committerMario <mario.mario@y7mail.com>
Sat, 28 Dec 2019 18:22:29 +0000 (04:22 +1000)
qcsrc/common/mapobjects/func/breakable.qc
qcsrc/common/mapobjects/func/rainsnow.qc
qcsrc/common/mapobjects/models.qc
qcsrc/common/mapobjects/subs.qc
qcsrc/common/mapobjects/subs.qh

index 32926d4908cfa8fff4941f31773a3725ccb90bbc..e92af677cc565dabd71a4177c94b17983f0ab6a0 100644 (file)
@@ -343,7 +343,7 @@ spawnfunc(func_breakable)
                this.dmg_force = 200;
 
        this.mdl = this.model;
                this.dmg_force = 200;
 
        this.mdl = this.model;
-       SetBrushEntityModel(this);
+       SetBrushEntityModel(this, true);
 
        if(this.spawnflags & BREAKABLE_NODAMAGE)
                this.use = func_breakable_destroy;
 
        if(this.spawnflags & BREAKABLE_NODAMAGE)
                this.use = func_breakable_destroy;
index c765a4293b9e79c34fc5d922b6846058ebb3b440..644194c3541e982bba19d9108f451e2fa9399616 100644 (file)
@@ -36,7 +36,7 @@ spawnfunc(func_rain)
        this.angles = '0 0 0';
        set_movetype(this, MOVETYPE_NONE);
        this.solid = SOLID_NOT;
        this.angles = '0 0 0';
        set_movetype(this, MOVETYPE_NONE);
        this.solid = SOLID_NOT;
-       SetBrushEntityModel(this);
+       SetBrushEntityModel(this, true);
        if (!this.cnt)
        {
                this.cnt = 12;
        if (!this.cnt)
        {
                this.cnt = 12;
@@ -76,7 +76,7 @@ spawnfunc(func_snow)
        this.angles = '0 0 0';
        set_movetype(this, MOVETYPE_NONE);
        this.solid = SOLID_NOT;
        this.angles = '0 0 0';
        set_movetype(this, MOVETYPE_NONE);
        this.solid = SOLID_NOT;
-       SetBrushEntityModel(this);
+       SetBrushEntityModel(this, true);
        if (!this.cnt)
        {
                this.cnt = 12;
        if (!this.cnt)
        {
                this.cnt = 12;
index 44a13522a4c5b348dcf0bb224c5775b342c72292..18d033663eaff85541fadfffe49dcbf849370484 100644 (file)
@@ -168,7 +168,7 @@ bool g_clientmodel_genericsendentity(entity this, entity to, int sf)
 #define G_MODEL_INIT(ent,sol) \
        if(ent.geomtype && autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) set_movetype(ent, MOVETYPE_PHYSICS); \
        if(!ent.scale) ent.scale = ent.modelscale; \
 #define G_MODEL_INIT(ent,sol) \
        if(ent.geomtype && autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) set_movetype(ent, MOVETYPE_PHYSICS); \
        if(!ent.scale) ent.scale = ent.modelscale; \
-       SetBrushEntityModel(ent); \
+       SetBrushEntityModel(ent,true); \
        ent.use = g_model_setcolormaptoactivator; \
        InitializeEntity(ent, g_model_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
        if(!ent.solid) ent.solid = (sol); \
        ent.use = g_model_setcolormaptoactivator; \
        InitializeEntity(ent, g_model_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
        if(!ent.solid) ent.solid = (sol); \
@@ -177,7 +177,7 @@ bool g_clientmodel_genericsendentity(entity this, entity to, int sf)
 #define G_CLIENTMODEL_INIT(ent,sol) \
        if(ent.geomtype && autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) set_movetype(ent, MOVETYPE_PHYSICS); \
        if(!ent.scale) ent.scale = ent.modelscale; \
 #define G_CLIENTMODEL_INIT(ent,sol) \
        if(ent.geomtype && autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) set_movetype(ent, MOVETYPE_PHYSICS); \
        if(!ent.scale) ent.scale = ent.modelscale; \
-       SetBrushEntityModel(ent); \
+       SetBrushEntityModel(ent,true); \
        ent.use = g_clientmodel_use; \
        InitializeEntity(ent, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
        if(!ent.solid) ent.solid = (sol); \
        ent.use = g_clientmodel_use; \
        InitializeEntity(ent, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
        if(!ent.solid) ent.solid = (sol); \
index f9e50dcf8f19d819509c9c6a460050da0a120954..9adccb4924e3721a91ae31c4c6a4d90ff458e442 100644 (file)
@@ -398,7 +398,7 @@ void ApplyMinMaxScaleAngles(entity e)
                setsize(e, e.mins, e.maxs);
 }
 
                setsize(e, e.mins, e.maxs);
 }
 
-void SetBrushEntityModel(entity this)
+void SetBrushEntityModel(entity this, bool with_lod)
 {
        if(this.model != "")
        {
 {
        if(this.model != "")
        {
@@ -412,26 +412,11 @@ void SetBrushEntityModel(entity this)
                }
                else
                        _setmodel(this, this.model); // no precision needed
                }
                else
                        _setmodel(this, this.model); // no precision needed
-               InitializeEntity(this, LODmodel_attach, INITPRIO_FINDTARGET);
-       }
-       setorigin(this, this.origin);
-       ApplyMinMaxScaleAngles(this);
-}
+               if(with_lod)
+                       InitializeEntity(this, LODmodel_attach, INITPRIO_FINDTARGET);
 
 
-void SetBrushEntityModelNoLOD(entity this)
-{
-       if(this.model != "")
-       {
-               precache_model(this.model);
-               if(this.mins != '0 0 0' || this.maxs != '0 0 0')
-               {
-                       vector mi = this.mins;
-                       vector ma = this.maxs;
-                       _setmodel(this, this.model); // no precision needed
-                       setsize(this, mi, ma);
-               }
-               else
-                       _setmodel(this, this.model); // no precision needed
+               if(endsWith(this.model, ".obj")) // WORKAROUND: darkplaces currently rotates .obj models on entities incorrectly, we need to add 180 degrees to the Y axis
+                       this.angles_y = anglemods(this.angles_y - 180);
        }
        setorigin(this, this.origin);
        ApplyMinMaxScaleAngles(this);
        }
        setorigin(this, this.origin);
        ApplyMinMaxScaleAngles(this);
@@ -553,7 +538,7 @@ void InitTrigger(entity this)
 // to mean no restrictions, so use a yaw of 360 instead.
        SetMovedir(this);
        this.solid = SOLID_TRIGGER;
 // to mean no restrictions, so use a yaw of 360 instead.
        SetMovedir(this);
        this.solid = SOLID_TRIGGER;
-       SetBrushEntityModelNoLOD(this);
+       SetBrushEntityModel(this, false);
        set_movetype(this, MOVETYPE_NONE);
        this.modelindex = 0;
        this.model = "";
        set_movetype(this, MOVETYPE_NONE);
        this.modelindex = 0;
        this.model = "";
@@ -565,7 +550,7 @@ void InitSolidBSPTrigger(entity this)
 // to mean no restrictions, so use a yaw of 360 instead.
        SetMovedir(this);
        this.solid = SOLID_BSP;
 // to mean no restrictions, so use a yaw of 360 instead.
        SetMovedir(this);
        this.solid = SOLID_BSP;
-       SetBrushEntityModelNoLOD(this);
+       SetBrushEntityModel(this, false);
        set_movetype(this, MOVETYPE_NONE); // why was this PUSH? -div0
 //     this.modelindex = 0;
        this.model = "";
        set_movetype(this, MOVETYPE_NONE); // why was this PUSH? -div0
 //     this.modelindex = 0;
        this.model = "";
@@ -576,7 +561,7 @@ bool InitMovingBrushTrigger(entity this)
 // trigger angles are used for one-way touches.  An angle of 0 is assumed
 // to mean no restrictions, so use a yaw of 360 instead.
        this.solid = SOLID_BSP;
 // trigger angles are used for one-way touches.  An angle of 0 is assumed
 // to mean no restrictions, so use a yaw of 360 instead.
        this.solid = SOLID_BSP;
-       SetBrushEntityModel(this);
+       SetBrushEntityModel(this, true);
        set_movetype(this, MOVETYPE_PUSH);
        if(this.modelindex == 0)
        {
        set_movetype(this, MOVETYPE_PUSH);
        if(this.modelindex == 0)
        {
index 861d73e72f28d6522ea9c488d91a6ae465f6a87d..c1d4d06e56f276cc1bff37f9d93e7e250f01788b 100644 (file)
@@ -115,9 +115,7 @@ void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed,
 #ifdef SVQC
 void ApplyMinMaxScaleAngles(entity e);
 
 #ifdef SVQC
 void ApplyMinMaxScaleAngles(entity e);
 
-void SetBrushEntityModel(entity this);
-
-void SetBrushEntityModelNoLOD(entity this);
+void SetBrushEntityModel(entity this, bool with_lod);
 
 int autocvar_loddebug;
 .string lodtarget1;
 
 int autocvar_loddebug;
 .string lodtarget1;