game: fix scale for non dynamic definitions

This commit is contained in:
Denis Pauk 2024-11-21 00:15:06 +02:00
parent e0ea452e9a
commit 12fa246a6d
9 changed files with 48 additions and 35 deletions

View file

@ -74,6 +74,24 @@ static dynamicentity_t *dynamicentities;
static int ndynamicentities;
static int nstaticentities;
static void
DynamicSpawnSetScale(edict_t *self)
{
/* copy to other parts if zero */
if (!st.scale[1])
{
st.scale[1] = st.scale[0];
}
if (!st.scale[2])
{
st.scale[2] = st.scale[0];
}
/* Copy to entity scale field */
VectorCopy(st.scale, self->s.scale);
}
static void
DynamicSpawnUpdate(edict_t *self, dynamicentity_t *data)
{
@ -120,19 +138,7 @@ DynamicSpawnUpdate(edict_t *self, dynamicentity_t *data)
/* has updated scale */
if (st.scale[0] || st.scale[1] || st.scale[2])
{
/* copy to other parts if zero */
if (!st.scale[1])
{
st.scale[1] = st.scale[0];
}
if (!st.scale[2])
{
st.scale[2] = st.scale[0];
}
/* Copy to entity scale field */
VectorCopy(st.scale, self->s.scale);
DynamicSpawnSetScale(self);
}
else
{
@ -324,6 +330,19 @@ ED_CallSpawn(edict_t *ent)
}
}
/* No dynamic description */
if (dyn_id < 0)
{
if (st.scale[0])
{
DynamicSpawnSetScale(ent);
}
else
{
VectorSet(ent->s.scale, 1.0, 1.0, 1.0);
}
}
/* check item spawn functions */
for (i = 0, item = itemlist; i < game.num_items; i++, item++)
{
@ -2120,7 +2139,6 @@ DynamicSpawnInit(void)
if (*curr && *curr != '\n' && *curr != '\r' && *curr != ',')
{
char *line, scale[MAX_QPATH];
int i;
line = curr;
line = DynamicStringParse(line, dynamicentities[curr_pos].classname, MAX_QPATH, ',');
@ -2182,11 +2200,6 @@ DynamicSpawnInit(void)
* max attenuation
*/
for (i = 0; i < 3; i++)
{
dynamicentities[curr_pos].scale[i] = 1.0f;
}
/* Fix path */
Q_replacebackslash(dynamicentities[curr_pos].model_path);

View file

@ -657,7 +657,7 @@ void
SP_target_spawner(edict_t *self)
{
vec3_t forward;
vec3_t fact2spawnpoint1 = {-1504,512,72};
vec3_t fact2spawnpoint1 = {-1504, 512, 72};
if (!self)
{

View file

@ -485,21 +485,21 @@ void SP_misc_actor (edict_t *self)
{
if (deathmatch->value)
{
G_FreeEdict (self);
G_FreeEdict(self);
return;
}
if (!self->targetname)
{
gi.dprintf("untargeted %s at %s\n", self->classname, vtos(self->s.origin));
G_FreeEdict (self);
G_FreeEdict(self);
return;
}
if (!self->target)
{
gi.dprintf("%s with no target at %s\n", self->classname, vtos(self->s.origin));
G_FreeEdict (self);
G_FreeEdict(self);
return;
}

View file

@ -130,7 +130,7 @@ enfbolt_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
if (surf && (surf->flags & SURF_SKY))
{
G_FreeEdict (self);
G_FreeEdict(self);
return;
}

View file

@ -154,7 +154,7 @@ magic_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
if (surf && (surf->flags & SURF_SKY))
{
G_FreeEdict (self);
G_FreeEdict(self);
return;
}
if (other->takedamage)

View file

@ -149,7 +149,7 @@ spit_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
if (surf && (surf->flags & SURF_SKY))
{
G_FreeEdict (self);
G_FreeEdict(self);
return;
}
if (other->takedamage)

View file

@ -104,10 +104,10 @@ ChasecamRemove(edict_t *ent)
ent->s.modelindex = ent->client->oldplayer->s.modelindex;
ent->svflags &= ~SVF_NOCLIENT;
G_FreeEdict (ent->client->oldplayer);
G_FreeEdict(ent->client->oldplayer);
ent->client->oldplayer = NULL;
ent->client->chasetoggle = 0;
G_FreeEdict (ent->client->chasecam);
G_FreeEdict(ent->client->chasecam);
ent->client->chasecam = NULL;
}

View file

@ -1942,13 +1942,13 @@ respawn(edict_t *self)
if (self->client->oldplayer)
{
G_FreeEdict (self->client->oldplayer);
G_FreeEdict(self->client->oldplayer);
}
self->client->oldplayer = NULL;
if (self->client->chasecam)
{
G_FreeEdict (self->client->chasecam);
G_FreeEdict(self->client->chasecam);
}
self->client->chasecam = NULL;

View file

@ -590,12 +590,12 @@ character_corvus7|models/player/morcalavin_scene/tris.fm|1.0|1.0|1.0|general|-17
character_corvus8|models/player/siernan_scene/tris.fm|1.0|1.0|1.0|general|-17.0|-25.0|-32.0|22.0|12.0|32.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|cinematic corvus for the Siernan scenes|0.3|0.3|1.0
character_corvus9|models/player/t'chekrikscene/tris.fm|1.0|1.0|1.0|general|-17.0|-25.0|-32.0|22.0|12.0|32.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|cinematic corvus for the T'chekrik scenes|0.3|0.3|1.0
character_dranor|models/monsters/plaguelf/dranor/tris.fm|1.0|1.0|1.0|general|-17.0|-25.0|-32.0|22.0|12.0|32.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Dranor|0.3|0.3|1.0
character_elflord|models/monsters/elflord/cinematic/tris.fm|1.0|1.0|1.0|general|-24.0|-24.0|-78.0|24.0|24.0|16.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Celestial Watcher|0.3|0.3|1.0
character_elflord|models/monsters/elflord/cinematic/tris.fm|2.0|2.0|2.0|general|-24.0|-24.0|-78.0|24.0|24.0|16.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Celestial Watcher|0.3|0.3|1.0
character_highpriestess|models/monsters/highpriestess/cinematic/tris.fm|1.0|1.0|1.0|general|-24.0|-24.0|-36.0|24.0|24.0|36.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|High Priestess|0.3|0.3|1.0
character_highpriestess2|models/monsters/highpriestess/pod_scene/tris.fm|1.0|1.0|1.0|general|-24.0|-24.0|-36.0|24.0|24.0|36.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|High Priestess|0.3|0.3|1.0
character_morcalavin|models/monsters/morcalavin/cinematic/tris.fm|1.0|1.0|1.0|general|-24.0|-24.0|-50.0|24.0|24.0|50.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Morcalavin|0.3|0.3|1.0
character_sidhe_guard|models/monsters/plaguelf/tris.fm|1.0|1.0|1.0|general|-16|-16|-26|16|16|26|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none||1|.5|0
character_siernan1|models/monsters/siernan/standing/tris.fm|1.0|1.0|1.0|general|-10.0|-10.0|-20.0|10.0|10.0|20.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Siernan standing|0.3|0.3|1.0
character_siernan1|models/monsters/siernan/standing/tris.fm|1.2|1.2|1.2|general|-10.0|-10.0|-20.0|10.0|10.0|20.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Siernan standing|0.3|0.3|1.0
character_siernan2|models/monsters/siernan/laying/tris.fm|1.0|1.0|1.0|general|-17.0|-25.0|0.0|22.0|12.0|16.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Siernan laying down|0.3|0.3|1.0
character_ssithra_scout|models/monsters/ssithra/scout_scene/tris.fm|1.0|1.0|1.0|general|-26.0|-16.0|-13.0|26.0|16.0|13.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Ssithra scout|0.3|0.3|1.0
character_ssithra_victim|models/monsters/Ssithra/cinematics/tris.fm|1.0|1.0|1.0|general|-40.0|-16.0|-2.0|40.0|16.0|2.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Ssithra torture victim|0.3|0.3|1.0
@ -697,11 +697,11 @@ monster_palace_plague_guard|models/monsters/plaguelf/tris.fm|1.0|1.0|1.0|general
monster_palace_plague_guard_invisible|models/monsters/plaguelf/tris.fm|1.0|1.0|1.0|general|-17.0|-25.0|-1.0|22.0|12.0|63.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Invisible Plague Guard|1.0|0.5|0.0
monster_plagueElf|models/monsters/plaguelf/tris.fm|1.0|1.0|1.0|general|-17.0|-25.0|-1.0|22.0|12.0|63.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Elf|1.0|0.5|0.0
monster_rat|models/monsters/rat/tris.fm|1.0|1.0|1.0|general|-16.0|-16.0|-0.0|16.0|16.0|32.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Rat|1.0|0.5|0.0
monster_rat_giant|models/monsters/rat/superduperat/tris.fm|1.0|1.0|1.0|general|-16.0|-16.0|-0.0|16.0|16.0|32.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Giant Rat|1.0|0.5|0.0
monster_seraph_guard|models/monsters/guard/tris.fm|1.0|1.0|1.0|general|-24.0|-24.0|-34.0|24.0|24.0|34.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Seraph Guard|1.0|0.5|0.0
monster_rat_giant|models/monsters/rat/superduperat/tris.fm|2.0|2.0|2.0|general|-8.0|-8.0|-0.0|8.0|8.0|16.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Giant Rat|1.0|0.5|0.0
monster_seraph_guard|models/monsters/guard/tris.fm|2.5|2.5|2.5|general|-12.0|-12.0|-17.0|12.0|12.0|17.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Seraph Guard|1.0|0.5|0.0
monster_seraph_overlord|models/monsters/overlord/tris.fm|1.0|1.0|1.0|general|-24.0|-24.0|-34.0|24.0|24.0|34.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Seraph Overlord|1.0|0.5|0.0
monster_spreader|models/monsters/spreader/tris.fm|1.0|1.0|1.0|general|-16.0|-16.0|-0.0|16.0|16.0|32.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Spreader|1.0|0.5|0.0
monster_ssithra|models/monsters/ssithra/tris.fm|1.0|1.0|1.0|general|-16.0|-16.0|-32.0|16.0|16.0|26.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Plague Ssithra|1.0|0.5|0.0
monster_ssithra|models/monsters/ssithra/tris.fm|1.1|1.1|1.1|general|-16.0|-16.0|-32.0|16.0|16.0|26.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Plague Ssithra|1.0|0.5|0.0
monster_tcheckrik_female|models/monsters/tcheckrik/female/tris.fm|1.0|1.0|1.0|general|-16.0|-16.0|-32.0|16.0|16.0|32.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Female Tcheckrik|1.0|0.5|0.0
monster_tcheckrik_male|models/monsters/tcheckrik/male/tris.fm|1.0|1.0|1.0|general|-16.0|-16.0|-32.0|16.0|16.0|32.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Male Tcheckrik|1.0|0.5|0.0
monster_tcheckrik_mothers|models/monsters/mother/tris.fm|1.0|1.0|1.0|general|-40.0|-40.0|-75.0|40.0|40.0|75.0|shadow|0|0.0|0.0|0|0|0|0:0|0|0|none|Tcheckrik Mother|1.0|0.5|0.0