game: Add scale entity field (without real usage)

This commit is contained in:
Denis Pauk 2024-11-18 00:43:15 +02:00
parent 3f4efa05a1
commit f856be3512
6 changed files with 33 additions and 7 deletions

View file

@ -158,7 +158,7 @@ Goals:
* [ ] Support textures/*/*_glow.png load from ReRelease,
* [ ] Support tactile/*/*.bnvib/.wav feedback load from ReRelease,
* [ ] Fix physics with incorrect floor height in psx/base0.bsp,
* [ ] Fix strange white flying boxes in psx/base0.bsp,
* [x] Fix strange white flying boxes in psx/base0.bsp,
* [x] RGB particles support instead palette based one,
* [x] Get rid of VID_PaletteColor client internal api use,
* [x] Broken maps groups from base2 to next,

View file

@ -1222,6 +1222,7 @@ typedef struct entity_state_s
int event; /* impulse events -- muzzle flashes, footsteps, etc */
/* events only go out for a single frame, they */
/* are automatically cleared each frame */
vec3_t scale;
} entity_state_t;
/* ============================================== */

View file

@ -3336,6 +3336,7 @@ SP_misc_flare(edict_t* ent)
ent->s.modelindex2 = st.fade_start_dist;
ent->s.modelindex3 = st.fade_end_dist;
ent->s.skinnum = st.rgba;
if (ent->targetname)
{

View file

@ -117,11 +117,27 @@ DynamicSpawnUpdate(edict_t *self, dynamicentity_t *data)
VectorCopy(data->mins, self->mins);
VectorCopy(data->maxs, self->maxs);
self->monsterinfo.scale = (
data->scale[0] +
data->scale[1] +
data->scale[2]
) / 3;
/* 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);
}
else
{
VectorCopy(data->scale, self->s.scale);
}
}
void
@ -510,6 +526,7 @@ ED_ParseField(const char *key, const char *value, edict_t *ent)
*(char **)(b + f->ofs) = ED_NewString(value, false);
break;
case F_VECTOR:
VectorClear(vec);
sscanf(value, "%f %f %f", &vec[0], &vec[1], &vec[2]);
((float *)(b + f->ofs))[0] = vec[0];
((float *)(b + f->ofs))[1] = vec[1];

View file

@ -411,10 +411,15 @@ typedef struct
float minpitch;
float maxpitch;
/* misc_flare */
float radius;
float fade_start_dist;
float fade_end_dist;
char *image;
unsigned rgba;
/* Addional fields for models */
vec3_t scale;
} spawn_temp_t;
typedef struct

View file

@ -58,7 +58,9 @@
{"origin", FOFS(s.origin), F_VECTOR},
{"angles", FOFS(s.angles), F_VECTOR},
{"angle", FOFS(s.angles), F_ANGLEHACK},
{"rgba", FOFS(s.skinnum), F_RGBA},
{"rgb", STOFS(rgba), F_RGBA, FFL_SPAWNTEMP},
{"rgba", STOFS(rgba), F_RGBA, FFL_SPAWNTEMP},
{"scale", STOFS(scale), F_VECTOR, FFL_SPAWNTEMP},
{"radius", STOFS(radius), F_FLOAT, FFL_SPAWNTEMP},
{"fade_start_dist", STOFS(fade_start_dist), F_FLOAT, FFL_SPAWNTEMP},
{"fade_end_dist", STOFS(fade_end_dist), F_FLOAT, FFL_SPAWNTEMP},