Merge branch 'fields' into rearrangecalls

This commit is contained in:
Denis Pauk 2024-10-20 15:09:44 +03:00
commit 72d77e0428
36 changed files with 239 additions and 60 deletions

View file

@ -2092,6 +2092,78 @@ CL_ClearEffects(void)
CL_ClearLightStyles(); CL_ClearLightStyles();
} }
void
CL_FlameEffects(vec3_t origin)
{
int n, count;
count = rand() & 0xF;
for(n = 0; n < count; n++)
{
cparticle_t *p;
int j;
if (!free_particles)
{
return;
}
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
VectorClear(p->accel);
p->time = cl.time;
p->alpha = 1.0;
p->alphavel = -1.0 / (1 + frandk() * 0.2);
p->color = CL_CombineColors(0xff0b0700, 0xff47477b,
(float)(randk() & 15) / 15.0);
for (j = 0; j < 3; j++)
{
p->org[j] = origin[j] + crandk() * 5;
p->vel[j] = crandk() * 5;
}
p->vel[2] = crandk() * -10;
p->accel[2] = -PARTICLE_GRAVITY;
}
count = rand() & 0x7;
for (n = 0; n < count; n++)
{
cparticle_t *p;
int j;
if (!free_particles)
{
return;
}
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
VectorClear(p->accel);
p->time = cl.time;
p->alpha = 1.0;
p->alphavel = -1.0 / (1 + frandk() * 0.5);
p->color = CL_CombineColors(0xff000000, 0xff2f2f2f,
(float)(randk() & 15) / 15.0);
for (j=0 ; j<3 ; j++)
{
p->org[j] = origin[j] + crandk() * 3;
}
p->vel[2] = 20 + crandk() * 5;
}
}
void void
CL_Flashlight(int ent, vec3_t pos) CL_Flashlight(int ent, vec3_t pos)
{ {

View file

@ -664,7 +664,7 @@ static unsigned int splash_color[] = {
void void
CL_ParseTEnt(void) CL_ParseTEnt(void)
{ {
int type; temp_event_t type;
vec3_t pos, pos2, dir; vec3_t pos, pos2, dir;
explosion_t *ex; explosion_t *ex;
int cnt; int cnt;
@ -864,6 +864,7 @@ CL_ParseTEnt(void)
break; break;
case TE_RAILTRAIL: /* railgun effect */ case TE_RAILTRAIL: /* railgun effect */
case TE_RAILTRAIL2:
MSG_ReadPos(&net_message, pos); MSG_ReadPos(&net_message, pos);
MSG_ReadPos(&net_message, pos2); MSG_ReadPos(&net_message, pos2);
CL_RailTrail(pos, pos2); CL_RailTrail(pos, pos2);
@ -1124,6 +1125,11 @@ CL_ParseTEnt(void)
S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0); S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
break; break;
case TE_FLAME:
MSG_ReadPos(&net_message, pos);
CL_FlameEffects(pos);
break;
case TE_LIGHTNING: case TE_LIGHTNING:
ent = CL_ParseLightning(cl_mod_lightning); ent = CL_ParseLightning(cl_mod_lightning);
S_StartSound(NULL, ent, CHAN_WEAPON, cl_sfx_lightning, S_StartSound(NULL, ent, CHAN_WEAPON, cl_sfx_lightning,
@ -1261,7 +1267,7 @@ CL_ParseTEnt(void)
break; break;
default: default:
Com_Error(ERR_DROP, "CL_ParseTEnt: bad type"); Com_Error(ERR_DROP, "%s: bad type", __func__);
} }
} }

View file

@ -405,7 +405,7 @@ void CL_SmokeTrail (vec3_t start, vec3_t end, unsigned int basecolor, unsigned i
int spacing); int spacing);
void CL_Flashlight (int ent, vec3_t pos); void CL_Flashlight (int ent, vec3_t pos);
void CL_ForceWall (vec3_t start, vec3_t end, int color); void CL_ForceWall (vec3_t start, vec3_t end, int color);
void CL_FlameEffects (centity_t *ent, vec3_t origin); void CL_FlameEffects (vec3_t origin);
void CL_GenericParticleEffect (vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor, void CL_GenericParticleEffect (vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor,
int count, int numcolors, int dirspread, float alphavel); int count, int numcolors, int dirspread, float alphavel);
void CL_BubbleTrail2 (vec3_t start, vec3_t end, int dist); void CL_BubbleTrail2 (vec3_t start, vec3_t end, int dist);

View file

@ -3273,3 +3273,84 @@ SP_misc_nuke_core(edict_t *ent)
ent->use = misc_nuke_core_use; ent->use = misc_nuke_core_use;
} }
/*
* QUAKED misc_flare (1.0 1.0 0.0) (-32 -32 -32) (32 32 32) RED GREEN BLUE LOCK_ANGLE
* Creates a flare seen in the N64 version.
*/
#define SPAWNFLAG_FLARE_RED 1
#define SPAWNFLAG_FLARE_GREEN 2
#define SPAWNFLAG_FLARE_BLUE 4
#define SPAWNFLAG_FLARE_LOCK_ANGLE 8
/* TODO: implement FX_FLARE */
#define RF_FLARE EF_BLUEHYPERBLASTER
#define RF_FLARE_LOCK_ANGLE 0
void
misc_flare_use(edict_t *ent, edict_t *other, edict_t *activator)
{
ent->svflags ^= SVF_NOCLIENT;
gi.linkentity(ent);
}
void
SP_misc_flare(edict_t* ent)
{
ent->s.modelindex = 0;
ent->s.renderfx = RF_FLARE;
ent->solid = SOLID_NOT;
/*
* TODO: Add scale field
* ent->s.scale = st.radius;
*/
if (ent->spawnflags & SPAWNFLAG_FLARE_RED)
{
ent->s.renderfx |= RF_SHELL_RED;
}
if (ent->spawnflags & SPAWNFLAG_FLARE_GREEN)
{
ent->s.renderfx |= RF_SHELL_GREEN;
}
if (ent->spawnflags & SPAWNFLAG_FLARE_BLUE)
{
ent->s.renderfx |= RF_SHELL_BLUE;
}
if (ent->spawnflags & SPAWNFLAG_FLARE_LOCK_ANGLE)
{
ent->s.renderfx |= RF_FLARE_LOCK_ANGLE;
}
if (st.image && *st.image)
{
ent->s.renderfx |= RF_CUSTOMSKIN;
ent->s.frame = gi.imageindex(st.image);
}
VectorSet(ent->mins, -32, -32, -32);
VectorSet(ent->maxs, 32, 32, 32);
ent->s.modelindex2 = st.fade_start_dist;
ent->s.modelindex3 = st.fade_end_dist;
if (ent->targetname)
{
ent->use = misc_flare_use;
}
gi.linkentity(ent);
}
/*
* QUAKED misc_model (1 0 0) (-8 -8 -8) (8 8 8)
*/
void SP_misc_model(edict_t *ent)
{
gi.setmodel(ent, ent->model);
gi.linkentity(ent);
}

View file

@ -123,12 +123,26 @@ DynamicSpawnUpdate(edict_t *self, dynamicentity_t *data)
) / 3; ) / 3;
} }
void
dynamicspawn_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */,
csurface_t *surf /* unused */)
{
if (!self || !other || !self->message || !self->message[0])
{
return;
}
gi.centerprintf(other, "Entity description: %s", self->message);
}
static void static void
DynamicSpawn(edict_t *self) DynamicSpawn(edict_t *self, dynamicentity_t *data)
{ {
/* All other properties could be updated in DynamicSpawnUpdate */ /* All other properties could be updated in DynamicSpawnUpdate */
self->movetype = MOVETYPE_NONE; self->movetype = MOVETYPE_NONE;
self->solid = SOLID_BBOX; self->solid = SOLID_BBOX;
self->message = data->description;
self->touch = dynamicspawn_touch;
gi.linkentity(self); gi.linkentity(self);
} }
@ -279,7 +293,7 @@ ED_CallSpawn(edict_t *ent)
if (dyn_id >= 0 && dynamicentities[dyn_id].model_path[0]) if (dyn_id >= 0 && dynamicentities[dyn_id].model_path[0])
{ {
/* spawn only if know model */ /* spawn only if know model */
DynamicSpawn(ent); DynamicSpawn(ent, &dynamicentities[dyn_id]);
return; return;
} }
@ -299,7 +313,7 @@ ED_CallSpawn(edict_t *ent)
if (gi.FS_LoadFile(self.model_path, NULL) > 4) if (gi.FS_LoadFile(self.model_path, NULL) > 4)
{ {
DynamicSpawnUpdate(ent, &self); DynamicSpawnUpdate(ent, &self);
DynamicSpawn(ent); DynamicSpawn(ent, &self);
return; return;
} }
} }
@ -372,8 +386,6 @@ ED_ParseColorField(const char *value)
is_float = false; is_float = false;
} }
printf(">%f<\n", v[i]);
if (!tmp) if (!tmp)
{ {
break; break;

View file

@ -617,6 +617,7 @@ extern void drawbbox ( edict_t * self ) ;
extern void drop_make_touchable ( edict_t * ent ) ; extern void drop_make_touchable ( edict_t * ent ) ;
extern void drop_temp_touch ( edict_t * ent , edict_t * other , cplane_t * plane , csurface_t * surf ) ; extern void drop_temp_touch ( edict_t * ent , edict_t * other , cplane_t * plane , csurface_t * surf ) ;
extern void droptofloor ( edict_t * ent ) ; extern void droptofloor ( edict_t * ent ) ;
extern void dynamicspawn_touch(edict_t *self, edict_t *other, cplane_t *plane /* unused */, csurface_t *surf /* unused */);
extern void enfbolt_touch ( edict_t * self , edict_t * other , cplane_t * plane, csurface_t *surf); extern void enfbolt_touch ( edict_t * self , edict_t * other , cplane_t * plane, csurface_t *surf);
extern void enforcer_attack ( edict_t * self ) ; extern void enforcer_attack ( edict_t * self ) ;
extern void enforcer_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ; extern void enforcer_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ;
@ -1026,6 +1027,7 @@ extern void misc_easterchick2_think ( edict_t * self ) ;
extern void misc_easterchick_think ( edict_t * self ) ; extern void misc_easterchick_think ( edict_t * self ) ;
extern void misc_eastertank_think ( edict_t * self ) ; extern void misc_eastertank_think ( edict_t * self ) ;
extern void misc_nuke_core_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void misc_nuke_core_use ( edict_t * self , edict_t * other , edict_t * activator ) ;
extern void misc_flare_use ( edict_t * self , edict_t * other , edict_t * activator ) ;
extern void misc_satellite_dish_think ( edict_t * self ) ; extern void misc_satellite_dish_think ( edict_t * self ) ;
extern void misc_satellite_dish_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void misc_satellite_dish_use ( edict_t * self , edict_t * other , edict_t * activator ) ;
extern void misc_strogg_ship_use ( edict_t * self , edict_t * other , edict_t * activator ) ; extern void misc_strogg_ship_use ( edict_t * self , edict_t * other , edict_t * activator ) ;

View file

@ -579,6 +579,7 @@
{"drop_make_touchable", (byte *)drop_make_touchable}, {"drop_make_touchable", (byte *)drop_make_touchable},
{"drop_temp_touch", (byte *)drop_temp_touch}, {"drop_temp_touch", (byte *)drop_temp_touch},
{"droptofloor", (byte *)droptofloor}, {"droptofloor", (byte *)droptofloor},
{"dynamicspawn_touch", (byte *)dynamicspawn_touch},
{"enfbolt_touch", (byte *)enfbolt_touch}, {"enfbolt_touch", (byte *)enfbolt_touch},
{"enforcer_attack", (byte *)enforcer_attack}, {"enforcer_attack", (byte *)enforcer_attack},
{"enforcer_die", (byte *)enforcer_die}, {"enforcer_die", (byte *)enforcer_die},
@ -1004,6 +1005,7 @@
{"misc_easterchick_think", (byte *)misc_easterchick_think}, {"misc_easterchick_think", (byte *)misc_easterchick_think},
{"misc_eastertank_think", (byte *)misc_eastertank_think}, {"misc_eastertank_think", (byte *)misc_eastertank_think},
{"misc_nuke_core_use", (byte *)misc_nuke_core_use}, {"misc_nuke_core_use", (byte *)misc_nuke_core_use},
{"misc_flare_use", (byte *)misc_flare_use},
{"misc_satellite_dish_think", (byte *)misc_satellite_dish_think}, {"misc_satellite_dish_think", (byte *)misc_satellite_dish_think},
{"misc_satellite_dish_use", (byte *)misc_satellite_dish_use}, {"misc_satellite_dish_use", (byte *)misc_satellite_dish_use},
{"misc_strogg_ship_use", (byte *)misc_strogg_ship_use}, {"misc_strogg_ship_use", (byte *)misc_strogg_ship_use},

View file

@ -89,6 +89,8 @@ extern void SP_misc_gib_leg ( edict_t * ent ) ;
extern void SP_misc_insane(edict_t * self); extern void SP_misc_insane(edict_t * self);
extern void SP_misc_nuke ( edict_t * ent ) ; extern void SP_misc_nuke ( edict_t * ent ) ;
extern void SP_misc_nuke_core ( edict_t * ent ) ; extern void SP_misc_nuke_core ( edict_t * ent ) ;
extern void SP_misc_flare ( edict_t * ent ) ;
extern void SP_misc_model ( edict_t * ent ) ;
extern void SP_misc_satellite_dish ( edict_t * ent ) ; extern void SP_misc_satellite_dish ( edict_t * ent ) ;
extern void SP_misc_strogg_ship ( edict_t * ent ) ; extern void SP_misc_strogg_ship ( edict_t * ent ) ;
extern void SP_misc_teleporter ( edict_t * ent ) ; extern void SP_misc_teleporter ( edict_t * ent ) ;

View file

@ -94,6 +94,8 @@
{"misc_insane", SP_misc_insane}, {"misc_insane", SP_misc_insane},
{"misc_nuke", SP_misc_nuke}, {"misc_nuke", SP_misc_nuke},
{"misc_nuke_core", SP_misc_nuke_core}, {"misc_nuke_core", SP_misc_nuke_core},
{"misc_flare", SP_misc_flare},
{"misc_model", SP_misc_model},
{"misc_satellite_dish", SP_misc_satellite_dish}, {"misc_satellite_dish", SP_misc_satellite_dish},
{"misc_strogg_ship", SP_misc_strogg_ship}, {"misc_strogg_ship", SP_misc_strogg_ship},
{"misc_teleporter", SP_misc_teleporter}, {"misc_teleporter", SP_misc_teleporter},