Hopefully fixed some more linkage problems

This commit is contained in:
Aaron Dean 2023-09-07 11:30:58 -04:00
parent 408f36a92a
commit 5456034526
3 changed files with 70 additions and 69 deletions

View file

@ -736,69 +736,69 @@ edict_t *FindEdictByClassnum(const char *classname, int classnum)
// /********* Bulletholes/wall stuff ***********/
// void UpdateAttachedPos( edict_t *self )
// {
// vec3_t fwd, right, up;
void UpdateAttachedPos( edict_t *self )
{
vec3_t fwd, right, up;
// if( (self->wait && (level.framenum >= self->wait)) || ! self->movetarget->inuse )
// {
// G_FreeEdict(self);
// return;
// }
if( (self->wait && (level.time.milliseconds() >= self->wait)) || ! self->movetarget->inuse )
{
G_FreeEdict(self);
return;
}
// self->nextthink = level.framenum + 1;
self->nextthink = level.time + gtime_t::from_ms(1);
// if( self < self->movetarget )
// {
// // If the object we're attached to hasn't been updated yet this frame,
// // we need to move ahead one frame's worth so we stay aligned with it.
// VectorScale( self->movetarget->velocity, FRAMETIME, self->s.origin );
// VectorAdd( self->movetarget->s.origin, self->s.origin, self->s.origin );
// VectorScale( self->movetarget->avelocity, FRAMETIME, self->s.angles );
// VectorAdd( self->movetarget->s.angles, self->s.angles, self->s.angles );
// }
// else
// {
// VectorCopy( self->movetarget->s.origin, self->s.origin );
// VectorCopy( self->movetarget->s.angles, self->s.angles );
// }
if( self < self->movetarget )
{
// If the object we're attached to hasn't been updated yet this frame,
// we need to move ahead one frame's worth so we stay aligned with it.
VectorScale( self->movetarget->velocity, level.time.milliseconds(), self->s.origin );
VectorAdd( self->movetarget->s.origin, self->s.origin, self->s.origin );
VectorScale( self->movetarget->avelocity, level.time.milliseconds(), self->s.angles );
VectorAdd( self->movetarget->s.angles, self->s.angles, self->s.angles );
}
else
{
VectorCopy( self->movetarget->s.origin, self->s.origin );
VectorCopy( self->movetarget->s.angles, self->s.angles );
}
// AngleVectors( self->s.angles, fwd, right, up ); // At this point, this is the angles of the entity we attached to.
// self->s.origin[0] += fwd[0] * self->move_origin[0] + right[0] * self->move_origin[1] + up[0] * self->move_origin[2];
// self->s.origin[1] += fwd[1] * self->move_origin[0] + right[1] * self->move_origin[1] + up[1] * self->move_origin[2];
// self->s.origin[2] += fwd[2] * self->move_origin[0] + right[2] * self->move_origin[1] + up[2] * self->move_origin[2];
// VectorAdd( self->s.angles, self->move_angles, self->s.angles );
// VectorCopy( self->movetarget->velocity, self->velocity );
// VectorCopy( self->movetarget->avelocity, self->avelocity );
// }
AngleVectors( self->s.angles, fwd, right, up ); // At this point, this is the angles of the entity we attached to.
self->s.origin[0] += fwd[0] * self->move_origin[0] + right[0] * self->move_origin[1] + up[0] * self->move_origin[2];
self->s.origin[1] += fwd[1] * self->move_origin[0] + right[1] * self->move_origin[1] + up[1] * self->move_origin[2];
self->s.origin[2] += fwd[2] * self->move_origin[0] + right[2] * self->move_origin[1] + up[2] * self->move_origin[2];
VectorAdd( self->s.angles, self->move_angles, self->s.angles );
VectorCopy( self->movetarget->velocity, self->velocity );
VectorCopy( self->movetarget->avelocity, self->avelocity );
}
// // Decal/splat/knife attached to some moving entity.
// void AttachedThink( edict_t *self )
// {
// UpdateAttachedPos( self );
// gi.linkentity( self );
// }
void AttachedThink( edict_t *self )
{
UpdateAttachedPos( self );
gi.linkentity( self );
}
// // Attach a splat/decal/knife to a moving entity.
// void AttachToEntity( edict_t *self, edict_t *onto )
// {
// vec3_t fwd, right, up, offset;
void AttachToEntity( edict_t *self, edict_t *onto )
{
vec3_t fwd, right, up, offset;
// self->wait = self->nextthink; // Use old nextthink as despawn framenum (0 is never).
// self->movetype = MOVETYPE_NONE;
self->wait = self->nextthink.frames(); // Use old nextthink as despawn framenum (0 is never).
self->movetype = MOVETYPE_NONE;
// self->movetarget = onto;
// AngleVectors( onto->s.angles, fwd, right, up );
// VectorSubtract( self->s.origin, onto->s.origin, offset );
// self->move_origin[0] = DotProduct( offset, fwd );
// self->move_origin[1] = DotProduct( offset, right );
// self->move_origin[2] = DotProduct( offset, up );
// VectorSubtract( self->s.angles, onto->s.angles, self->move_angles );
self->movetarget = onto;
AngleVectors( onto->s.angles, fwd, right, up );
VectorSubtract( self->s.origin, onto->s.origin, offset );
self->move_origin[0] = DotProduct( offset, fwd );
self->move_origin[1] = DotProduct( offset, right );
self->move_origin[2] = DotProduct( offset, up );
VectorSubtract( self->s.angles, onto->s.angles, self->move_angles );
// self->think = AttachedThink;
self->think = AttachedThink;
// UpdateAttachedPos( self );
// }
UpdateAttachedPos( self );
}
// bool CanBeAttachedTo( const edict_t *ent )
// {

View file

@ -2708,7 +2708,7 @@ blocked_jump_result_t blocked_checkjump(edict_t *self, float dist);
bool inback(edict_t *self, edict_t *other);
float realrange(edict_t *self, edict_t *other);
edict_t *SpawnBadArea(const vec3_t &mins, const vec3_t &maxs, gtime_t lifespan, edict_t *owner);
edict_t *CheckForBadArea(edict_t *ent);
//edict_t *CheckForBadArea(edict_t *ent);
//bool MarkTeslaArea(edict_t *self, edict_t *tesla);
//void InitHintPaths();
void PredictAim(edict_t *self, edict_t *target, const vec3_t &start, float bolt_speed, bool eye_height, float offset, vec3_t *aimdir,

View file

@ -567,17 +567,17 @@ static bool SV_flystep(edict_t *ent, vec3_t move, bool relink, edict_t *current_
}
// ROGUE
if ((trace.fraction == 1) && (!trace.allsolid) && (!trace.startsolid))
//if ((trace.fraction == 1) && (!trace.allsolid) && (!trace.startsolid))
// ROGUE
{
ent->s.origin = trace.endpos;
//=====
// PGM
if (!current_bad && CheckForBadArea(ent))
if (!current_bad) // && CheckForBadArea(ent))
ent->s.origin = oldorg;
else
{
if (relink)
if (relink)
{
gi.linkentity(ent);
G_TouchTriggers(ent);
@ -619,19 +619,20 @@ bool SV_movestep(edict_t *ent, vec3_t move, bool relink)
// PMM - who cares about bad areas if you're dead?
if (ent->health > 0)
{
current_bad = CheckForBadArea(ent);
if (current_bad)
{
ent->bad_area = current_bad;
// current_bad = CheckForBadArea(ent);
// if (current_bad)
// {
// ent->bad_area = current_bad;
if (ent->enemy && !strcmp(ent->enemy->classname, "tesla_mine"))
{
// if the tesla is in front of us, back up...
if (IsBadAhead(ent, current_bad, move))
move *= -1;
}
}
else if (ent->bad_area)
// if (ent->enemy && !strcmp(ent->enemy->classname, "tesla_mine"))
// {
// // if the tesla is in front of us, back up...
// if (IsBadAhead(ent, current_bad, move))
// move *= -1;
// }
// }
// else
if (ent->bad_area)
{
// if we're no longer in a bad area, get back to business.
ent->bad_area = nullptr;
@ -776,8 +777,8 @@ bool SV_movestep(edict_t *ent, vec3_t move, bool relink)
if (ent->health > 0)
{
// use AI_BLOCKED to tell the calling layer that we're now mad at a tesla
new_bad = CheckForBadArea(ent);
if (!current_bad && new_bad)
//new_bad = CheckForBadArea(ent);
if (!current_bad) // && new_bad)
{
if (new_bad->owner)
{