Skip to content

Commit

Permalink
game: replace heretic2 hack to quake (edict_s)1 hack
Browse files Browse the repository at this point in the history
  • Loading branch information
0lvin committed Sep 7, 2024
1 parent 7905943 commit f07c856
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/client/cl_prediction.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,10 @@ CL_PMTrace(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end)
/* check against world */
t = CM_BoxTrace(start, end, mins, maxs, 0, MASK_PLAYERSOLID);

// jmarshall - c++ - this was wrong?
if (t.fraction < 1.0)
{
t.ent = (edict_t *)&cl_parse_entities[1];
t.ent = (struct edict_s *)1;
}
// jmarshall end

/* check all other solid models */
CL_ClipMoveToEntities(start, mins, maxs, end, &t);
Expand Down
2 changes: 1 addition & 1 deletion src/game/effects/fx_debris.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ static void FXDebris_Collision(client_entity_t *self, CE_Message_t *msg)
return;

// hit the world
if(trace->ent == (struct edict_s *)-1)
if(trace->ent == WALL_ENTITY)
{
if(trace->contents&CONTENTS_SOLID)
{//hit a solid surface, make noise and leave any decals
Expand Down
2 changes: 1 addition & 1 deletion src/game/effects/fx_halo.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static qboolean FXHaloThink(struct client_entity_s *self, centity_t *Owner)

if (trace.fraction < 1.0) //Hit something
{
if ((trace.ent != ((struct edict_s *)-1))) //Model
if (trace.ent != WALL_ENTITY) //Model
{
es = (entity_state_t *) trace.ent;

Expand Down
3 changes: 3 additions & 0 deletions src/game/effects/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ float GetGravity();
qboolean ReferencesInitialized(centity_t *owner);
qboolean RefPointsValid(centity_t *owner);

// NOTE: 1 means that the last entity was a wall...
#define WALL_ENTITY (struct edict_s *)1

#endif
2 changes: 1 addition & 1 deletion src/game/g_ai.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ int ai_hopdown(edict_t *self, vec3_t goalpos, float height_max)
}
else
{
if (trace.ent == (struct edict_s *)-1)
if (trace.ent == WALL_ENTITY)
return false;

if (trace.contents != CONTENTS_SOLID)
Expand Down
3 changes: 3 additions & 0 deletions src/game/header/local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,9 @@ struct edict_s
void *script;
};

// NOTE: 1 means that the last entity was a wall...
#define WALL_ENTITY (struct edict_s *)1

/*
* Uncomment for check that exported functions declarations are same as in
* implementation. (-Wmissing-prototypes )
Expand Down
8 changes: 5 additions & 3 deletions src/game/monster/plaguessithra/plaguessithra.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,8 +849,10 @@ void ssithraCheckJump (edict_t *self)
}
else
{
// if (trace.ent == (struct edict_s *)-1)
// return;
if (trace.ent == WALL_ENTITY)
{
return;
}

if (trace.contents != CONTENTS_SOLID)
{
Expand Down Expand Up @@ -991,7 +993,7 @@ void ssithraCheckJump (edict_t *self)
// }
else
{
if (trace.ent == (struct edict_s *)-1)
if (trace.ent == WALL_ENTITY)
return;

// if (trace.contents != CONTENTS_SOLID)
Expand Down
5 changes: 1 addition & 4 deletions src/game/player/weapon.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,10 +563,7 @@ void WeaponThink_SwordStaff(edict_t *Caster,char *Format,...)
AlertMonsters (Caster, Caster, 1, true);
gi.sound(Caster, CHAN_AUTO, gi.soundindex("weapons/staffhitwall.wav"), 1, ATTN_NORM, 0);

// NOTENOTE -1 means that the last entity was a wall...
// jmarshall - 64bit
Caster->client->lastentityhit = (edict_t*)-1; // 0xFFFFFFFF;
// jmarshall end
Caster->client->lastentityhit = WALL_ENTITY;
}
}
}
Expand Down

0 comments on commit f07c856

Please sign in to comment.