From 50552c3289cf7c4ad36980b298cb28a4b8de9082 Mon Sep 17 00:00:00 2001 From: Richard Allen Date: Sat, 22 Mar 2003 20:29:26 +0000 Subject: [PATCH] wrapping linkent and unlinkent calls --- reaction/cgame/cg_main.c | 20 +++++++++--- reaction/game/g_active.c | 7 ++-- reaction/game/g_arenas.c | 7 ++-- reaction/game/g_client.c | 21 +++++++----- reaction/game/g_combat.c | 9 +++-- reaction/game/g_items.c | 17 ++++++---- reaction/game/g_local.h | 8 +++++ reaction/game/g_main.c | 67 +++++++++++++++++++++++++++++++++++++- reaction/game/g_misc.c | 29 +++++++++-------- reaction/game/g_missile.c | 13 +++++--- reaction/game/g_mover.c | 43 ++++++++++++------------ reaction/game/g_target.c | 11 ++++--- reaction/game/g_trigger.c | 17 ++++++---- reaction/game/g_unlagged.c | 9 +++-- reaction/game/g_utils.c | 9 +++-- reaction/game/g_weapon.c | 15 +++++---- 16 files changed, 212 insertions(+), 90 deletions(-) diff --git a/reaction/cgame/cg_main.c b/reaction/cgame/cg_main.c index f396b23c..66a5c384 100644 --- a/reaction/cgame/cg_main.c +++ b/reaction/cgame/cg_main.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.126 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.125 2003/03/22 20:19:20 jbravo // Item replacement fixes, tmp ban after votekicks and ignore now works on // players with colors. @@ -2300,11 +2303,18 @@ void CG_StartMusic(void) static qboolean JB_FileExists(const char *filename) { int len; + char hack[MAX_QPATH]; - len = trap_FS_FOpenFile(filename, 0, FS_READ); - if (len > 0) { + Com_sprintf(hack, MAX_QPATH, "%s", filename); + len = trap_FS_FOpenFile(hack, 0, FS_READ); + if (len > 0) return qtrue; - } + + Com_sprintf(hack, MAX_QPATH, "%s.tga", filename); + len = trap_FS_FOpenFile(hack, 0, FS_READ); + if (len > 0) + return qtrue; + return qfalse; } @@ -2425,7 +2435,7 @@ void CG_ReplaceModels(void) if (JB_FileExists(RQ3_handcannon_icon)) bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_handcannon_icon; else - CG_Printf("^1Error loading handcannonmp5 replacement icon %s\n", cg_RQ3_handcannon_skin.string); + CG_Printf("^1Error loading handcannon replacement icon %s\n", cg_RQ3_handcannon_skin.string); } } if (!strcmp(item->classname, "weapon_m3")) { @@ -2461,7 +2471,7 @@ void CG_ReplaceModels(void) if (JB_FileExists(RQ3_akimbo_icon)) bg_itemlist[item - bg_itemlist].icon = (char *)&RQ3_akimbo_icon; else - CG_Printf("^1Error loading akimbom3 replacement icon %s\n", cg_RQ3_akimbo_skin.string); + CG_Printf("^1Error loading akimbo replacement icon %s\n", cg_RQ3_akimbo_skin.string); } } if (!strcmp(item->classname, "weapon_grenade")) { diff --git a/reaction/game/g_active.c b/reaction/game/g_active.c index 4d86641f..b9ee1021 100644 --- a/reaction/game/g_active.c +++ b/reaction/game/g_active.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.98 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.97 2003/03/10 07:07:58 jbravo // Small unlagged fixes and voting delay added. // @@ -553,7 +556,7 @@ void SpectatorThink(gentity_t * ent, usercmd_t * ucmd) VectorCopy(client->ps.origin, ent->s.origin); G_TouchTriggers(ent); - trap_UnlinkEntity(ent); + trap_RQ3UnlinkEntity(ent, __LINE__, __FILE__); } // JBravo: Lets not allow bots to use any specmode other than FREE if (ent->r.svFlags & SVF_BOT) @@ -1300,7 +1303,7 @@ void ClientThink_real(gentity_t * ent) // link entity now, after any personal teleporters have been used // JBravo: this call reactivates gibbed players. if (!ent->client->gibbed) - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); if (!ent->client->noclip) { G_TouchTriggers(ent); } diff --git a/reaction/game/g_arenas.c b/reaction/game/g_arenas.c index 96d3d460..e9b9a2fa 100644 --- a/reaction/game/g_arenas.c +++ b/reaction/game/g_arenas.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.10 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.9 2002/09/24 05:06:16 blaze // fixed spectating so ref\'s can now use all the chasecam modes. // @@ -160,7 +163,7 @@ static gentity_t *SpawnModelOnVictoryPad(gentity_t * pad, vec3_t offset, gentity G_SetOrigin(body, vec); - trap_LinkEntity(body); + trap_RQ3LinkEntity(body, __LINE__, __FILE__); body->count = place; @@ -281,7 +284,7 @@ static gentity_t *SpawnPodium(void) VectorSubtract(level.intermission_origin, podium->r.currentOrigin, vec); podium->s.apos.trBase[YAW] = vectoyaw(vec); - trap_LinkEntity(podium); + trap_RQ3LinkEntity(podium, __LINE__, __FILE__); podium->think = PodiumPlacementThink; podium->nextthink = level.time + 100; diff --git a/reaction/game/g_client.c b/reaction/game/g_client.c index 537ef5b6..065db664 100644 --- a/reaction/game/g_client.c +++ b/reaction/game/g_client.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.127 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.126 2003/03/10 07:07:58 jbravo // Small unlagged fixes and voting delay added. // @@ -666,7 +669,7 @@ void ClearBodyQue(void) level.bodyQueIndex = 0; for (i = 0; i < BODY_QUEUE_SIZE; i++) { ent = level.bodyQue[i]; - trap_UnlinkEntity(ent); + trap_RQ3UnlinkEntity(ent, __LINE__, __FILE__); ent->physicsObject = qfalse; } } @@ -686,7 +689,7 @@ void BodySink(gentity_t * ent) if (level.time - ent->timestamp > 6500) { // the body ques are never actually freed, they are just unlinked - trap_UnlinkEntity(ent); + trap_RQ3UnlinkEntity(ent, __LINE__, __FILE__); ent->physicsObject = qfalse; return; } @@ -707,7 +710,7 @@ void CopyToBodyQue(gentity_t * ent) gentity_t *body; int contents; - trap_UnlinkEntity(ent); + trap_RQ3UnlinkEntity(ent, __LINE__, __FILE__); // if client is in a nodrop area, don't leave the body contents = trap_PointContents(ent->s.origin, -1); @@ -718,7 +721,7 @@ void CopyToBodyQue(gentity_t * ent) body = level.bodyQue[level.bodyQueIndex]; level.bodyQueIndex = (level.bodyQueIndex + 1) % BODY_QUEUE_SIZE; - trap_UnlinkEntity(body); + trap_RQ3UnlinkEntity(body, __LINE__, __FILE__); body->s = ent->s; @@ -786,7 +789,7 @@ void CopyToBodyQue(gentity_t * ent) } VectorCopy(body->s.pos.trBase, body->r.currentOrigin); - trap_LinkEntity(body); + trap_RQ3LinkEntity(body, __LINE__, __FILE__); } //====================================================================== @@ -1422,7 +1425,7 @@ void ClientBegin(int clientNum) client = level.clients + clientNum; if (ent->r.linked) { - trap_UnlinkEntity(ent); + trap_RQ3UnlinkEntity(ent, __LINE__, __FILE__); } G_InitGentity(ent); @@ -1803,7 +1806,7 @@ void ClientSpawn(gentity_t * ent) } else { G_KillBox(ent); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); // force the base weapon up //Blaze: Changed WP_MACHINEGUN to WP_PISTOL @@ -1898,7 +1901,7 @@ void ClientSpawn(gentity_t * ent) if (ent->client->sess.sessionTeam != TEAM_SPECTATOR) { BG_PlayerStateToEntityState(&client->ps, &ent->s, qtrue); VectorCopy(ent->client->ps.origin, ent->r.currentOrigin); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } // run the presend to set anything else // JBravo: We should not have to call this during TP spawns @@ -2036,7 +2039,7 @@ void ClientDisconnect(int clientNum) ClientUserinfoChanged(level.sortedClients[0]); } - trap_UnlinkEntity(ent); + trap_RQ3UnlinkEntity(ent, __LINE__, __FILE__); ent->s.modelindex = 0; ent->inuse = qfalse; ent->classname = "disconnected"; diff --git a/reaction/game/g_combat.c b/reaction/game/g_combat.c index a8e7e88c..015d37f3 100644 --- a/reaction/game/g_combat.c +++ b/reaction/game/g_combat.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.134 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.133 2003/03/09 21:30:38 jbravo // Adding unlagged. Still needs work. // @@ -1544,14 +1547,14 @@ void player_die(gentity_t * self, gentity_t * inflictor, gentity_t * attacker, i //GibEntity (self, killer); G_TempEntity(self->r.currentOrigin, EV_GIB_PLAYER); self->client->gibbed = qtrue; - trap_UnlinkEntity(self); + trap_RQ3UnlinkEntity(self, __LINE__, __FILE__); } } else if (meansOfDeath == MOD_HANDCANNON && g_RQ3_gib.integer > 1 && self->health <= -15) { self->client->noHead = qfalse; //GibEntity (self, killer); G_TempEntity(self->r.currentOrigin, EV_GIB_PLAYER); self->client->gibbed = qtrue; - trap_UnlinkEntity(self); + trap_RQ3UnlinkEntity(self, __LINE__, __FILE__); } } // never gib in a nodrop @@ -1605,7 +1608,7 @@ void player_die(gentity_t * self, gentity_t * inflictor, gentity_t * attacker, i // JBravo: lets not relink players that have been gibbed here. if (!self->client->gibbed) - trap_LinkEntity(self); + trap_RQ3LinkEntity(self, __LINE__, __FILE__); } /* diff --git a/reaction/game/g_items.c b/reaction/game/g_items.c index 6b8abf79..60766c40 100644 --- a/reaction/game/g_items.c +++ b/reaction/game/g_items.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.55 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.54 2002/10/30 20:04:34 jbravo // Adding helmet // @@ -477,7 +480,7 @@ void RespawnItem(gentity_t * ent) ent->r.contents = CONTENTS_TRIGGER; ent->s.eFlags &= ~EF_NODRAW; ent->r.svFlags &= ~SVF_NOCLIENT; - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); if (ent->item->giType == IT_POWERUP) { // play powerup spawn sound to all clients @@ -743,7 +746,7 @@ void Touch_Item(gentity_t * ent, gentity_t * other, trace_t * trace) ent->nextthink = level.time + respawn * 1000; ent->think = RespawnItem; } - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } //====================================================================== @@ -846,7 +849,7 @@ gentity_t *LaunchItem(gitem_t * item, vec3_t origin, vec3_t velocity, int xr_fla dropped->physicsBounce = 0.1f; } - trap_LinkEntity(dropped); + trap_RQ3LinkEntity(dropped, __LINE__, __FILE__); return dropped; } @@ -1012,7 +1015,7 @@ void FinishSpawningItem(gentity_t * ent) } } - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } qboolean itemRegistered[MAX_ITEMS]; @@ -1056,7 +1059,7 @@ void G_CheckTeamItems(void) ent->s.pos.trType = TR_STATIONARY; ent->s.modelindex = TEAM_RED; G_SetOrigin(ent, flag->s.origin); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } // NiceAss: Find the blue flag @@ -1073,7 +1076,7 @@ void G_CheckTeamItems(void) ent->s.pos.trType = TR_STATIONARY; ent->s.modelindex = TEAM_BLUE; G_SetOrigin(ent, flag->s.origin); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } } } @@ -1293,7 +1296,7 @@ void G_RunItem(gentity_t * ent) ent->s.angles[1] = (level.time & 1023) * 360 / 1024.0f; } - trap_LinkEntity(ent); // FIXME: avoid this for stationary? + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); // FIXME: avoid this for stationary? // check think function G_RunThink(ent); diff --git a/reaction/game/g_local.h b/reaction/game/g_local.h index 6383905e..28e75bfe 100644 --- a/reaction/game/g_local.h +++ b/reaction/game/g_local.h @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.137 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.136 2003/03/10 07:07:58 jbravo // Small unlagged fixes and voting delay added. // @@ -1245,6 +1248,11 @@ void QDECL G_Error(const char *fmt, ...); //Elder: added void RQ3_StartUniqueItems(void); +// JBravo: added +void trap_RQ3LinkEntity(gentity_t *ent, int line, char *file); +void trap_RQ3UnlinkEntity(gentity_t *ent, int line, char *file); +void trap_RQ3AdjustAreaPortalState(gentity_t *ent, qboolean open, int line, char *file); + // aasimon: init stuff void RQ3_ReadInitFile(void); void RQ3_ParseBuffer(char *buf, int len); diff --git a/reaction/game/g_main.c b/reaction/game/g_main.c index d899cd10..b834e8e4 100644 --- a/reaction/game/g_main.c +++ b/reaction/game/g_main.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.138 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.137 2003/03/22 20:19:20 jbravo // Item replacement fixes, tmp ban after votekicks and ignore now works on // players with colors. @@ -765,6 +768,68 @@ void QDECL G_Error(const char *fmt, ...) trap_Error(text); } +/* +================ +trap_RQ3LinkEntity, trap_RQ3UnlinkEntity and trap_RQ3AdjustAreaPortalState +Written by JBravo to catch the bad gEnt bug +// if (!((((btye*)ent - (byte*)g_entities)) % sizeof(gentity_t)) +// ((((btye*)ent - (byte*)g_entities)) / sizeof(gentity_t))) +================ +*/ +void trap_RQ3LinkEntity(gentity_t *ent, int line, char *file) +{ + if (ent == NULL) { + G_Printf("^1trap_LinkEntity got called with a NULL ent from line %d of file %s\n", line, file); + G_LogPrintf("trap_LinkEntity got called with a NULL ent from line %d of file %s\n", line, file); + } + if (ent-g_entities < 0 || ent-g_entities > level.num_entities) { + G_Printf("^1trap_LinkEntity got called with a unaligned ent from line %d of file %s\n", line, file); + G_LogPrintf("trap_LinkEntity got called with a unaligned ent from line %d of file %s\n", line, file); + } + if (ent->s.number <0 || ent->s.number > level.num_entities) { + G_Printf("^1trap_LinkEntity got called with s.number outof range from line %d of file %s\n", line, file); + G_LogPrintf("trap_LinkEntity got called with s.number outof range from line %d of file %s\n", line, file); + } + + trap_LinkEntity(ent); +} + +void trap_RQ3UnlinkEntity(gentity_t *ent, int line, char *file) +{ + if (ent == NULL) { + G_Printf("^1trap_UnlinkEntity got called with a NULL ent from line %d of file %s\n", line, file); + G_LogPrintf("trap_UnlinkEntity got called with a NULL ent from line %d of file %s\n", line, file); + } + if (ent-g_entities < 0 || ent-g_entities > level.num_entities) { + G_Printf("^1trap_UnlinkEntity got called with a unaligned ent from line %d of file %s\n", line, file); + G_LogPrintf("trap_UnlinkEntity got called with a unaligned ent from line %d of file %s\n", line, file); + } + if (ent->s.number <0 || ent->s.number > level.num_entities) { + G_Printf("^1trap_UnlinkEntity got called with s.number outof range from line %d of file %s\n", line, file); + G_LogPrintf("trap_UnlinkEntity got called with s.number outof range from line %d of file %s\n", line, file); + } + + trap_UnlinkEntity(ent); +} + +void trap_RQ3AdjustAreaPortalState(gentity_t *ent, qboolean open, int line, char *file) +{ + if (ent == NULL) { + G_Printf("^1trap_RQ3AdjustAreaPortalState got called with a NULL ent from line %d of file %s\n", line, file); + G_LogPrintf("trap_RQ3AdjustAreaPortalState got called with a NULL ent from line %d of file %s\n", line, file); + } + if (ent-g_entities < 0 || ent-g_entities > level.num_entities) { + G_Printf("^1trap_RQ3AdjustAreaPortalState got called with a unaligned ent from line %d of file %s\n", line, file); + G_LogPrintf("trap_RQ3AdjustAreaPortalState got called with a unaligned ent from line %d of file %s\n", line, file); + } + if (ent->s.number <0 || ent->s.number > level.num_entities) { + G_Printf("^1trap_RQ3AdjustAreaPortalState got called with s.number outof range from line %d of file %s\n", line, file); + G_LogPrintf("trap_RQ3AdjustAreaPortalState got called with s.number outof range from line %d of file %s\n", line, file); + } + + trap_AdjustAreaPortalState(ent, open); +} + /* ================ G_FindTeams @@ -2575,7 +2640,7 @@ void G_RunFrame(int levelTime) } else if (ent->unlinkAfterEvent) { // items that will respawn will hide themselves after their pickup event ent->unlinkAfterEvent = qfalse; - trap_UnlinkEntity(ent); + trap_RQ3UnlinkEntity(ent, __LINE__, __FILE__); } } // temporary entities don't think diff --git a/reaction/game/g_misc.c b/reaction/game/g_misc.c index 5baf7b2b..dd20575f 100644 --- a/reaction/game/g_misc.c +++ b/reaction/game/g_misc.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.67 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.66 2003/03/09 21:30:38 jbravo // Adding unlagged. Still needs work. // @@ -299,14 +302,14 @@ void SP_dlight(gentity_t * ent) ent->s.pos.trType = TR_STATIONARY; VectorCopy(ent->s.origin, ent->r.currentOrigin); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } /* // Nothing significant to do void G_RunDlight(gentity_t * ent) { - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } */ @@ -332,7 +335,7 @@ void TeleportPlayer(gentity_t * player, vec3_t origin, vec3_t angles) tent->s.clientNum = player->s.clientNum; } // unlink to make sure it can't possibly interfere with G_KillBox - trap_UnlinkEntity(player); + trap_RQ3UnlinkEntity(player, __LINE__, __FILE__); VectorCopy(origin, player->client->ps.origin); player->client->ps.origin[2] += 1; @@ -363,7 +366,7 @@ void TeleportPlayer(gentity_t * player, vec3_t origin, vec3_t angles) VectorCopy(player->client->ps.origin, player->r.currentOrigin); if (player->client->sess.sessionTeam != TEAM_SPECTATOR) { - trap_LinkEntity(player); + trap_RQ3LinkEntity(player, __LINE__, __FILE__); } } @@ -388,7 +391,7 @@ void SP_misc_model(gentity_t * ent) ent->s.modelindex = G_ModelIndex(ent->model); VectorSet(ent->mins, -16, -16, -16); VectorSet(ent->maxs, 16, 16, 16); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); G_SetOrigin(ent, ent->s.origin); VectorCopy(ent->s.angles, ent->s.apos.trBase); @@ -463,7 +466,7 @@ void SP_misc_portal_surface(gentity_t * ent) { VectorClear(ent->r.mins); VectorClear(ent->r.maxs); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); ent->r.svFlags = SVF_PORTAL; ent->s.eType = ET_PORTAL; @@ -504,7 +507,7 @@ void SP_misc_portal_camera(gentity_t * ent) VectorClear(ent->r.mins); VectorClear(ent->r.maxs); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); G_SpawnFloat("roll", "0", &roll); @@ -520,7 +523,7 @@ void SP_misc_sky_portal(gentity_t * ent) ent->r.svFlags |= SVF_PORTAL; VectorClear(ent->r.mins); VectorClear(ent->r.maxs); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); if (!info[0]) { gentity_t *skyportal = G_Find(NULL, FOFS(targetname), ent->target); @@ -628,7 +631,7 @@ void InitShooter(gentity_t * ent, int weapon) ent->think = InitShooter_Finish; ent->nextthink = level.time + 500; } - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } /*QUAKED shooter_rocket (1 0 0) (-16 -16 -16) (16 16 16) @@ -683,7 +686,7 @@ void func_breakable_die(gentity_t * self, gentity_t * inflictor, gentity_t * att if (self->damage > 0 && self->damage_radius > 0) G_RadiusDamage(self->s.origin, attacker, self->damage, self->damage_radius, self, meansOfDeath); // radius damage - trap_UnlinkEntity(self); + trap_RQ3UnlinkEntity(self, __LINE__, __FILE__); } @@ -860,7 +863,7 @@ void SP_func_breakable(gentity_t * ent) Info_SetValueForKey(breakinfo, "id", id); trap_SetConfigstring(CS_BREAKABLES + atoi(id), breakinfo); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } @@ -963,7 +966,7 @@ void G_BreakGlass(gentity_t * ent, gentity_t * inflictor, gentity_t * attacker, //tent = G_TempEntity( center, EV_BREAK_GLASS ); //tent->s.eventParm = eParm; //unlink it instead of freeing - trap_UnlinkEntity(ent); + trap_RQ3UnlinkEntity(ent, __LINE__, __FILE__); } else if (ent->chippable) { //Stil has some life left, so chip it @@ -1021,7 +1024,7 @@ void SP_func_pressure(gentity_t * ent) // Make it appear as the brush trap_SetBrushModel(ent, ent->model); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); VectorCopy(ent->s.origin, ent->s.pos.trBase); VectorCopy(ent->s.origin, ent->r.currentOrigin); diff --git a/reaction/game/g_missile.c b/reaction/game/g_missile.c index 7a984243..51f9e55b 100644 --- a/reaction/game/g_missile.c +++ b/reaction/game/g_missile.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.33 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.32 2003/03/09 21:30:38 jbravo // Adding unlagged. Still needs work. // @@ -137,7 +140,7 @@ void G_ExplodeMissile(gentity_t * ent) } //Elder: huhh? //G_Printf("exploding knife\n"); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } /* @@ -228,8 +231,8 @@ void G_MissileImpact(gentity_t * ent, trace_t * trace) ent->parent->client->ps.pm_flags |= PMF_GRAPPLE_PULL; VectorCopy(ent->r.currentOrigin, ent->parent->client->ps.grapplePoint); - trap_LinkEntity(ent); - trap_LinkEntity(nent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); + trap_RQ3LinkEntity(nent, __LINE__, __FILE__); return; } @@ -348,7 +351,7 @@ void G_MissileImpact(gentity_t * ent, trace_t * trace) } } - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } /* @@ -384,7 +387,7 @@ void G_RunMissile(gentity_t * ent) VectorCopy(tr.endpos, ent->r.currentOrigin); } - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); if (tr.fraction != 1) { // never explode or bounce on sky diff --git a/reaction/game/g_mover.c b/reaction/game/g_mover.c index 89464249..b6875ca7 100644 --- a/reaction/game/g_mover.c +++ b/reaction/game/g_mover.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.55 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.54 2003/01/05 22:36:50 makro // Added "inactive" field for entities // New "target_activate" entity @@ -295,7 +298,7 @@ qboolean G_TryPushingEntity(gentity_t * check, gentity_t * pusher, vec3_t move, } else { VectorCopy(check->s.pos.trBase, check->r.currentOrigin); } - trap_LinkEntity(check); + trap_RQ3LinkEntity(check, __LINE__, __FILE__); return qtrue; } // if it is ok to leave in the old position, do it @@ -365,7 +368,7 @@ qboolean G_TryPushingProxMine(gentity_t * check, gentity_t * pusher, vec3_t move ret = G_CheckProxMinePosition(check); if (ret) { VectorCopy(check->s.pos.trBase, check->r.currentOrigin); - trap_LinkEntity(check); + trap_RQ3LinkEntity(check, __LINE__, __FILE__); } return ret; } @@ -426,14 +429,14 @@ qboolean G_MoverPush(gentity_t * pusher, vec3_t move, vec3_t amove, gentity_t ** } // unlink the pusher so we don't get it in the entityList - trap_UnlinkEntity(pusher); + trap_RQ3UnlinkEntity(pusher, __LINE__, __FILE__); listedEntities = trap_EntitiesInBox(totalMins, totalMaxs, entityList, MAX_GENTITIES); // move the pusher to it's final position VectorAdd(pusher->r.currentOrigin, move, pusher->r.currentOrigin); VectorAdd(pusher->r.currentAngles, amove, pusher->r.currentAngles); - trap_LinkEntity(pusher); + trap_RQ3LinkEntity(pusher, __LINE__, __FILE__); // see if any solid entities are inside the final position for (e = 0; e < listedEntities; e++) { @@ -498,7 +501,7 @@ qboolean G_MoverPush(gentity_t * pusher, vec3_t move, vec3_t amove, gentity_t ** p->ent->client->ps.delta_angles[YAW] = p->deltayaw; //VectorCopy (p->origin, p->ent->client->ps.origin); } -// trap_LinkEntity (p->ent); +// trap_RQ3LinkEntity (p->ent, __LINE__, __FILE__); } // return qfalse; continue; @@ -521,7 +524,7 @@ qboolean G_MoverPush(gentity_t * pusher, vec3_t move, vec3_t amove, gentity_t ** p->ent->client->ps.delta_angles[YAW] = p->deltayaw; VectorCopy(p->origin, p->ent->client->ps.origin); } - trap_LinkEntity(p->ent); + trap_RQ3LinkEntity(p->ent, __LINE__, __FILE__); } return qfalse; } @@ -564,7 +567,7 @@ void G_MoverTeam(gentity_t * ent) part->s.apos.trTime += level.time - level.previousTime; G_EvaluateTrajectory(&part->s.pos, level.time, part->r.currentOrigin); G_EvaluateTrajectory(&part->s.apos, level.time, part->r.currentAngles); - trap_LinkEntity(part); + trap_RQ3LinkEntity(part, __LINE__, __FILE__); } // if the pusher has a "blocked" function, call it @@ -689,7 +692,7 @@ void SetMoverState(gentity_t * ent, moverState_t moverState, int time) G_EvaluateTrajectory(&ent->s.pos, level.time, ent->r.currentOrigin); G_EvaluateTrajectory(&ent->s.apos, level.time, ent->r.currentAngles); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } /* @@ -793,7 +796,7 @@ void Reached_BinaryMover(gentity_t * ent) } // close areaportals if (ent->teammaster == ent || !ent->teammaster) { - trap_AdjustAreaPortalState(ent, qfalse); + trap_RQ3AdjustAreaPortalState(ent, qfalse, __LINE__, __FILE__); } } else if (ent->moverState == ROTATOR_1TO2) { // Reaction @@ -832,7 +835,7 @@ void Reached_BinaryMover(gentity_t * ent) } // close areaportals if (ent->teammaster == ent || !ent->teammaster) { - trap_AdjustAreaPortalState(ent, qfalse); + trap_RQ3AdjustAreaPortalState(ent, qfalse, __LINE__, __FILE__); } } else { G_Error("Reached_BinaryMover: bad moverState"); @@ -898,7 +901,7 @@ void Use_BinaryMover(gentity_t * ent, gentity_t * other, gentity_t * activator) // open areaportal if (ent->teammaster == ent || !ent->teammaster) { - trap_AdjustAreaPortalState(ent, qtrue); + trap_RQ3AdjustAreaPortalState(ent, qtrue, __LINE__, __FILE__); } return; } @@ -974,7 +977,7 @@ void Use_BinaryMover(gentity_t * ent, gentity_t * other, gentity_t * activator) // open areaportal if (ent->teammaster == ent || !ent->teammaster) { - trap_AdjustAreaPortalState(ent, qtrue); + trap_RQ3AdjustAreaPortalState(ent, qtrue, __LINE__, __FILE__); } return; } @@ -1100,7 +1103,7 @@ void InitMover(gentity_t * ent) ent->r.svFlags = SVF_USE_CURRENT_ORIGIN; ent->s.eType = ET_MOVER; VectorCopy(ent->pos1, ent->r.currentOrigin); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); ent->s.pos.trType = TR_STATIONARY; VectorCopy(ent->pos1, ent->s.pos.trBase); @@ -1327,7 +1330,7 @@ void Think_SpawnNewDoorTrigger(gentity_t * ent) other->touch = Touch_DoorTrigger; // remember the thinnest axis other->count = best; - trap_LinkEntity(other); + trap_RQ3LinkEntity(other, __LINE__, __FILE__); } //Makro - some doors shouldn't have triggers for spectators if (!ent->unbreakable) { @@ -1355,7 +1358,7 @@ void Think_SpawnNewDoorTrigger(gentity_t * ent) other->touch = Touch_DoorTriggerSpectator; // remember the thinnest axis other->count = best; - trap_LinkEntity(other); + trap_RQ3LinkEntity(other, __LINE__, __FILE__); } MatchTeam(ent, ent->moverState, level.time); @@ -1514,7 +1517,7 @@ void SP_func_door(gentity_t * ent) } //Elder: open areaportals for start_open doors if ((ent->spawnflags & 1) == 1 && (ent->teammaster == ent || !ent->teammaster)) { - trap_AdjustAreaPortalState(ent, qtrue); + trap_RQ3AdjustAreaPortalState(ent, qtrue, __LINE__, __FILE__); } } @@ -1662,7 +1665,7 @@ void SP_func_door_rotating(gentity_t * ent) //Makro - copied from func_door //Elder: open areaportals for start_open doors if ((ent->spawnflags & 1) == 1 && (ent->teammaster == ent || !ent->teammaster)) { - trap_AdjustAreaPortalState(ent, qtrue); + trap_RQ3AdjustAreaPortalState(ent, qtrue, __LINE__, __FILE__); } } @@ -1725,7 +1728,7 @@ void InitRotator(gentity_t * ent) ent->r.svFlags = SVF_USE_CURRENT_ORIGIN; ent->s.eType = ET_MOVER; VectorCopy(ent->pos1, ent->r.currentAngles); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); ent->s.apos.trType = TR_STATIONARY; VectorCopy(ent->pos1, ent->s.apos.trBase); @@ -1829,7 +1832,7 @@ void SpawnPlatTrigger(gentity_t * ent) VectorCopy(tmin, trigger->r.mins); VectorCopy(tmax, trigger->r.maxs); - trap_LinkEntity(trigger); + trap_RQ3LinkEntity(trigger, __LINE__, __FILE__); } /*QUAKED func_plat (0 .5 .8) ? @@ -2369,7 +2372,7 @@ void SP_func_rotating(gentity_t * ent) VectorCopy(ent->s.pos.trBase, ent->r.currentOrigin); VectorCopy(ent->s.apos.trBase, ent->r.currentAngles); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } /* diff --git a/reaction/game/g_target.c b/reaction/game/g_target.c index d32f6a1f..2ab2c659 100644 --- a/reaction/game/g_target.c +++ b/reaction/game/g_target.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.11 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.10 2003/01/06 00:23:29 makro // no message // @@ -66,7 +69,7 @@ void Use_Target_Give(gentity_t * ent, gentity_t * other, gentity_t * activator) // make sure it isn't going to respawn or show any events t->nextthink = 0; - trap_UnlinkEntity(t); + trap_RQ3UnlinkEntity(t, __LINE__, __FILE__); } } @@ -267,7 +270,7 @@ void SP_target_speaker(gentity_t * ent) // must link the entity so we get areas and clusters so // the server can determine who to send updates to - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } //========================================================== @@ -302,7 +305,7 @@ void target_laser_think(gentity_t * self) VectorCopy(tr.endpos, self->s.origin2); - trap_LinkEntity(self); + trap_RQ3LinkEntity(self, __LINE__, __FILE__); self->nextthink = level.time + FRAMETIME; } @@ -315,7 +318,7 @@ void target_laser_on(gentity_t * self) void target_laser_off(gentity_t * self) { - trap_UnlinkEntity(self); + trap_RQ3UnlinkEntity(self, __LINE__, __FILE__); self->nextthink = 0; } diff --git a/reaction/game/g_trigger.c b/reaction/game/g_trigger.c index f10f696d..99bc5368 100644 --- a/reaction/game/g_trigger.c +++ b/reaction/game/g_trigger.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.25 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.24 2002/07/22 06:32:27 niceass // cleaned up the powerup code // @@ -157,7 +160,7 @@ void SP_trigger_multiple(gentity_t * ent) ent->use = Use_Multi; InitTrigger(ent); - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } /* @@ -299,7 +302,7 @@ void SP_trigger_push(gentity_t * self) self->touch = trigger_push_touch; self->think = AimAtTarget; self->nextthink = level.time + FRAMETIME; - trap_LinkEntity(self); + trap_RQ3LinkEntity(self, __LINE__, __FILE__); } void Use_target_push(gentity_t * self, gentity_t * other, gentity_t * activator) @@ -418,7 +421,7 @@ void SP_trigger_teleport(gentity_t * self) self->s.eType = ET_TELEPORT_TRIGGER; self->touch = trigger_teleporter_touch; - trap_LinkEntity(self); + trap_RQ3LinkEntity(self, __LINE__, __FILE__); } /* @@ -444,9 +447,9 @@ NO_PROTECTION *nothing* stops the damage void hurt_use(gentity_t * self, gentity_t * other, gentity_t * activator) { if (self->r.linked) { - trap_UnlinkEntity(self); + trap_RQ3UnlinkEntity(self, __LINE__, __FILE__); } else { - trap_LinkEntity(self); + trap_RQ3LinkEntity(self, __LINE__, __FILE__); } } @@ -500,10 +503,10 @@ void SP_trigger_hurt(gentity_t * self) // link in to the world if starting active if (!(self->spawnflags & 1)) { - trap_LinkEntity(self); + trap_RQ3LinkEntity(self, __LINE__, __FILE__); } else { //Makro - added - trap_UnlinkEntity(self); + trap_RQ3UnlinkEntity(self, __LINE__, __FILE__); } } diff --git a/reaction/game/g_unlagged.c b/reaction/game/g_unlagged.c index 2e8dad91..94be89b5 100644 --- a/reaction/game/g_unlagged.c +++ b/reaction/game/g_unlagged.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.2 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.1 2003/03/09 21:32:23 jbravo // *** empty log message *** // @@ -190,7 +193,7 @@ void G_TimeShiftClient(gentity_t * ent, int time, qboolean debug, gentity_t * de trap_SendServerCommand(debugger - g_entities, msg); } // this will recalculate absmin and absmax - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } else { // we wrapped, so grab the earliest VectorCopy(ent->client->history[k].currentOrigin, ent->r.currentOrigin); @@ -198,7 +201,7 @@ void G_TimeShiftClient(gentity_t * ent, int time, qboolean debug, gentity_t * de VectorCopy(ent->client->history[k].maxs, ent->r.maxs); // this will recalculate absmin and absmax - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } } else { // this only happens when the client is using a negative timenudge, because that @@ -297,7 +300,7 @@ void G_UnTimeShiftClient(gentity_t * ent) ent->client->saved.leveltime = 0; // this will recalculate absmin and absmax - trap_LinkEntity(ent); + trap_RQ3LinkEntity(ent, __LINE__, __FILE__); } } diff --git a/reaction/game/g_utils.c b/reaction/game/g_utils.c index 4c11ee67..b6729bf1 100644 --- a/reaction/game/g_utils.c +++ b/reaction/game/g_utils.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.20 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.19 2002/08/24 07:58:15 niceass // moved sanitizestring to g_util // @@ -462,7 +465,7 @@ Marks the entity as free void G_FreeEntity(gentity_t * ed) { - trap_UnlinkEntity(ed); // unlink from world + trap_RQ3UnlinkEntity(ed, __LINE__, __FILE__); // unlink from world if (ed->neverFree) { return; @@ -500,7 +503,7 @@ gentity_t *G_TempEntity(vec3_t origin, int event) G_SetOrigin(e, snapped); // find cluster for PVS - trap_LinkEntity(e); + trap_RQ3LinkEntity(e, __LINE__, __FILE__); return e; } @@ -529,7 +532,7 @@ gentity_t *G_TempEntity2(vec3_t origin, int event, int eParm) G_SetOrigin(e, snapped); // find cluster for PVS - trap_LinkEntity(e); + trap_RQ3LinkEntity(e, __LINE__, __FILE__); return e; } diff --git a/reaction/game/g_weapon.c b/reaction/game/g_weapon.c index b706237e..f6b02aab 100644 --- a/reaction/game/g_weapon.c +++ b/reaction/game/g_weapon.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.87 2003/03/22 20:29:26 jbravo +// wrapping linkent and unlinkent calls +// // Revision 1.86 2003/03/09 21:30:38 jbravo // Adding unlagged. Still needs work. // @@ -840,7 +843,7 @@ void weapon_railgun_fire(gentity_t * ent) break; // we hit something solid enough to stop the beam } // unlink this entity, so the next trace will go past it - trap_UnlinkEntity(traceEnt); + trap_RQ3UnlinkEntity(traceEnt, __LINE__, __FILE__); unlinkedEntities[unlinked] = traceEnt; unlinked++; } while (unlinked < MAX_RAIL_HITS); @@ -848,7 +851,7 @@ void weapon_railgun_fire(gentity_t * ent) // link back in any entities we unlinked for (i = 0; i < unlinked; i++) { - trap_LinkEntity(unlinkedEntities[i]); + trap_RQ3LinkEntity(unlinkedEntities[i], __LINE__, __FILE__); } // the final trace endpos will be the terminal point of the rail trail @@ -1370,7 +1373,7 @@ void Weapon_SSG3000_Fire(gentity_t * ent) if (hitBreakable == qfalse || OnSameTeam(traceEnt, ent) ) { - trap_UnlinkEntity(traceEnt); + trap_RQ3UnlinkEntity(traceEnt, __LINE__, __FILE__); unlinkedEntities[unlinked] = traceEnt; unlinked++; } @@ -1379,7 +1382,7 @@ void Weapon_SSG3000_Fire(gentity_t * ent) // link back in any entities we unlinked for (i = 0; i < unlinked; i++) { - trap_LinkEntity(unlinkedEntities[i]); + trap_RQ3LinkEntity(unlinkedEntities[i], __LINE__, __FILE__); } // snap the endpos to integers to save net bandwidth, but nudged towards the line @@ -1885,7 +1888,7 @@ void Laser_Think(gentity_t * self) //Did you not hit anything? if (tr.surfaceFlags & SURF_NOIMPACT || tr.surfaceFlags & SURF_SKY) { self->nextthink = level.time + 10; - trap_UnlinkEntity(self); + trap_RQ3UnlinkEntity(self, __LINE__, __FILE__); return; } @@ -1905,7 +1908,7 @@ void Laser_Think(gentity_t * self) vectoangles(tr.plane.normal, self->s.angles); - trap_LinkEntity(self); + trap_RQ3LinkEntity(self, __LINE__, __FILE__); //Prep next move self->nextthink = level.time + 10;