r_efrag.c no longer relies on cl*.h

This commit is contained in:
Bill Currie 2001-05-20 02:39:56 +00:00
parent e0512e4af3
commit d1c2b0ec52
21 changed files with 223 additions and 85 deletions

View file

@ -163,5 +163,7 @@ void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj);
void R_LoadSkys (const char *);
void R_ClearEfrags (void);
void R_ClearEnts (void);
struct entity_s **R_NewEntity (void);
#endif // __render_h

View file

@ -41,7 +41,7 @@ void R_RunSpikeEffect (vec3_t org, byte type);
#ifdef QUAKE2
void R_DarkFieldParticles (entity_t *ent);
#endif
void R_EntityParticles (entity_t *ent);
void R_EntityParticles (struct entity_s *ent);
void R_BlobExplosion (vec3_t org);
void R_ParticleExplosion (vec3_t org);
void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength);

View file

@ -333,6 +333,9 @@ extern int r_clipflags;
extern int r_dlightframecount;
extern qboolean r_fov_greater_than_90;
extern int r_numvisedicts;
extern struct entity_s *r_visedicts[];
void R_StoreEfrags (efrag_t **ppefrag);
void R_TimeRefresh_f (void);
void R_TimeGraph (void);

View file

@ -304,10 +304,6 @@ void CL_Disconnect (void);
void CL_Disconnect_f (void);
void CL_NextDemo (void);
#define MAX_VISEDICTS 256
extern int cl_numvisedicts;
extern entity_t *cl_visedicts[MAX_VISEDICTS];
/*
cl_input
@ -366,7 +362,6 @@ void CL_TEnts_Init (void);
void CL_ClearEnts (void);
void CL_ClearTEnts (void);
void CL_Init_Entity (struct entity_s *ent);
struct entity_s **CL_NewTempEntity (void);
void CL_ParseTEnt (void);
void CL_SignonReply (void);

View file

@ -73,7 +73,7 @@ client_LIBS= -L. -lqfnet $(qf_client_LIBS) $(NET_LIBS)
client_LIB_DEPS= libqfnet.a $(qf_client_LIBS)
client_SOURCES= cl_cam.c cl_cmd.c cl_demo.c cl_input.c cl_main.c cl_parse.c \
cl_tent.c console.c keys.c sbar.c r_cvar.c r_efrag.c r_part.c r_view.c \
cl_tent.c console.c keys.c sbar.c r_cvar.c r_efrag.c r_ent.c r_part.c r_view.c \
nonintel.c locs.c pcx.c tga.c
server_SOURCES= host.c host_cmd.c pr_cmds.c sv_cvar.c sv_main.c \

View file

@ -91,9 +91,6 @@ entity_state_t cl_static_entity_baselines[MAX_STATIC_ENTITIES];
lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
dlight_t cl_dlights[MAX_DLIGHTS];
int cl_numvisedicts;
entity_t *cl_visedicts[MAX_VISEDICTS];
void
CL_InitCvars (void)
@ -715,7 +712,7 @@ CL_RelinkEntities (void)
if (ent->effects & EF_NODRAW)
continue;
#endif
if ((_ent = CL_NewTempEntity ()))
if ((_ent = R_NewEntity ()))
*_ent = ent;
}
}
@ -748,7 +745,7 @@ CL_ReadFromServer (void)
if (cl_shownet->int_val)
Con_Printf ("\n");
cl_numvisedicts = 0;
R_ClearEnts ();
CL_RelinkEntities ();
CL_UpdateTEnts ();

View file

@ -418,16 +418,6 @@ CL_ParseTEnt (void)
}
entity_t **
CL_NewTempEntity (void)
{
if (cl_numvisedicts == MAX_VISEDICTS)
return NULL;
return &cl_visedicts[cl_numvisedicts++];
}
void
CL_UpdateBeams (void)
{
@ -473,7 +463,7 @@ CL_UpdateBeams (void)
d = VectorNormalize (dist);
b->ent_count = 0;
while (d > 0 && b->ent_count < MAX_BEAM_ENTS) {
ent = CL_NewTempEntity ();
ent = R_NewEntity ();
if (!ent)
return;
*ent = &b->ent_list[b->ent_count++];
@ -507,7 +497,7 @@ CL_UpdateExplosions (void)
continue;
}
ent = CL_NewTempEntity ();
ent = R_NewEntity ();
if (!ent)
return;
ex->ent.frame = f;

View file

@ -818,19 +818,19 @@ R_DrawEntitiesOnList (void)
}
// LordHavoc: split into 3 loops to simplify state changes
for (i = 0; i < cl_numvisedicts; i++) {
if (cl_visedicts[i]->model->type != mod_brush)
for (i = 0; i < r_numvisedicts; i++) {
if (r_visedicts[i]->model->type != mod_brush)
continue;
currententity = cl_visedicts[i];
currententity = r_visedicts[i];
modelalpha = currententity->alpha;
R_DrawBrushModel (currententity);
}
for (i = 0; i < cl_numvisedicts; i++) {
if (cl_visedicts[i]->model->type != mod_alias)
for (i = 0; i < r_numvisedicts; i++) {
if (r_visedicts[i]->model->type != mod_alias)
continue;
currententity = cl_visedicts[i];
currententity = r_visedicts[i];
modelalpha = currententity->alpha;
if (currententity == &cl_entities[cl.viewentity])
@ -839,10 +839,10 @@ R_DrawEntitiesOnList (void)
R_DrawAliasModel (currententity);
}
for (i = 0; i < cl_numvisedicts; i++) {
if (cl_visedicts[i]->model->type != mod_sprite)
for (i = 0; i < r_numvisedicts; i++) {
if (r_visedicts[i]->model->type != mod_sprite)
continue;
currententity = cl_visedicts[i];
currententity = r_visedicts[i];
modelalpha = currententity->alpha;
R_DrawSpriteModel (currententity);
@ -1107,7 +1107,7 @@ R_Mirror (void)
r_refdef.viewangles[1] = atan2 (vpn[1], vpn[0]) / M_PI * 180;
r_refdef.viewangles[2] = -r_refdef.viewangles[2];
ent = CL_NewTempEntity();
ent = R_NewEntity();
if (ent)
*ent = &cl_entities[cl.viewentity];

View file

@ -34,7 +34,6 @@
#include "QF/render.h"
#include "QF/sys.h"
#include "client.h"
#include "r_local.h"
mnode_t *r_pefragtopnode;
@ -248,7 +247,7 @@ R_StoreEfrags (efrag_t **ppefrag)
pent = pefrag->entity;
if (pent->visframe != r_framecount) {
entity_t **ent = CL_NewTempEntity ();
entity_t **ent = R_NewEntity ();
if (!ent)
return;
*ent = pent;

87
nq/source/r_ent.c Normal file
View file

@ -0,0 +1,87 @@
/*
r_tent.c
rendering entities
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <math.h>
#include <stdlib.h>
#include "QF/console.h"
#include "QF/model.h"
#include "QF/msg.h"
#include "QF/sound.h"
#include "QF/sys.h"
#include "r_dynamic.h"
#include "QF/render.h"
#define MAX_VISEDICTS 256
int r_numvisedicts;
entity_t *r_visedicts[MAX_VISEDICTS];
void
R_Ents_Init (void)
{
}
void
R_Init_Entity (entity_t *ent)
{
memset (ent, 0, sizeof (*ent));
ent->colormap = vid.colormap;
ent->glow_size = 0;
ent->glow_color = 254;
ent->alpha = 1;
ent->scale = 1;
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1;
ent->pose1 = ent->pose2 = -1;
}
void
R_ClearEnts (void)
{
r_numvisedicts = 0;
}
entity_t **
R_NewEntity (void)
{
if (r_numvisedicts == MAX_VISEDICTS)
return NULL;
return &r_visedicts[r_numvisedicts++];
}

View file

@ -494,8 +494,8 @@ R_DrawEntitiesOnList (void)
return;
}
for (i = 0; i < cl_numvisedicts; i++) {
currententity = cl_visedicts[i];
for (i = 0; i < r_numvisedicts; i++) {
currententity = r_visedicts[i];
if (currententity == &cl_entities[cl.viewentity]) {
if (!chase_active->int_val)
@ -693,8 +693,8 @@ R_DrawBEntitiesOnList (void)
insubmodel = true;
r_dlightframecount = r_framecount;
for (i = 0; i < cl_numvisedicts; i++) {
currententity = cl_visedicts[i];
for (i = 0; i < r_numvisedicts; i++) {
currententity = r_visedicts[i];
switch (currententity->model->type) {
case mod_brush:

View file

@ -48,10 +48,6 @@ qboolean CL_DemoBehind(void);
void CL_BeginServerConnect(void);
#define MAX_VISEDICTS 256
extern int cl_numvisedicts;
extern entity_t *cl_visedicts[MAX_VISEDICTS];
extern char emodel_name[], pmodel_name[], prespawn_name[], modellist_name[], soundlist_name[];
#endif // _CL_MAIN_H

View file

@ -33,7 +33,6 @@ void CL_TEnts_Init (void);
void CL_ClearEnts (void);
void CL_ClearTEnts (void);
void CL_Init_Entity (struct entity_s *ent);
struct entity_s **CL_NewTempEntity (void);
void CL_ParseTEnt (void);
void CL_UpdateTEnts (void);

View file

@ -98,7 +98,7 @@ client_LIB_DEPS= libqfnet.a $(qf_client_LIBS)
client_SOURCES= cl_cam.c cl_cmd.c cl_cvar.c cl_demo.c cl_ents.c cl_input.c \
cl_main.c cl_misc.c cl_parse.c cl_pred.c cl_skin.c cl_slist.c \
cl_tent.c console.c keys.c locs.c nonintel.c \
pcx.c r_cvar.c r_efrag.c r_view.c sbar.c skin.c teamplay.c tga.c wad.c cl_math.S $(syscl_SRC)
pcx.c r_cvar.c r_efrag.c r_ent.c r_view.c sbar.c skin.c teamplay.c tga.c wad.c cl_math.S $(syscl_SRC)
# Software-rendering clients
#

View file

@ -484,7 +484,7 @@ CL_LinkPacketEntities (void)
continue;
// create a new entity
ent = CL_NewTempEntity ();
ent = R_NewEntity ();
if (!ent)
break; // object list is full
@ -642,7 +642,7 @@ CL_LinkProjectiles (void)
continue;
// grab an entity to fill in
ent = CL_NewTempEntity ();
ent = R_NewEntity ();
if (!ent)
break; // object list is full
*ent = &pr->ent;
@ -790,7 +790,7 @@ CL_AddFlagModels (entity_t *ent, int team)
f = f + 7; // shotattack
}
newent = CL_NewTempEntity ();
newent = R_NewEntity ();
if (!newent)
return;
*newent = &cl_flag_ents[ent->keynum];
@ -864,7 +864,7 @@ CL_LinkPlayers (void)
continue;
// grab an entity to fill in
ent = CL_NewTempEntity ();
ent = R_NewEntity ();
if (!ent) // object list is full
break;
*ent = &cl_player_ents[state - frame->playerstate];
@ -1080,7 +1080,7 @@ CL_EmitEntities (void)
if (!cl.validsequence)
return;
cl_numvisedicts = 0;
R_ClearEnts ();
CL_LinkPlayers ();
CL_LinkPacketEntities ();

View file

@ -167,12 +167,6 @@ entity_t cl_static_entities[MAX_STATIC_ENTITIES];
lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
dlight_t cl_dlights[MAX_DLIGHTS];
// refresh list
// this is double buffered so the last frame
// can be scanned for oldorigins of trailing objects
int cl_numvisedicts;
entity_t *cl_visedicts[MAX_VISEDICTS];
double connect_time = -1; // for connection retransmits
quakeparms_t host_parms;

View file

@ -409,16 +409,6 @@ CL_ParseTEnt (void)
}
entity_t **
CL_NewTempEntity (void)
{
if (cl_numvisedicts == MAX_VISEDICTS)
return NULL;
return &cl_visedicts[cl_numvisedicts++];
}
void
CL_UpdateBeams (void)
{
@ -464,7 +454,7 @@ CL_UpdateBeams (void)
d = VectorNormalize (dist);
b->ent_count = 0;
while (d > 0 && b->ent_count < MAX_BEAM_ENTS) {
ent = CL_NewTempEntity ();
ent = R_NewEntity ();
if (!ent)
return;
*ent = &b->ent_list[b->ent_count++];
@ -498,7 +488,7 @@ CL_UpdateExplosions (void)
continue;
}
ent = CL_NewTempEntity ();
ent = R_NewEntity ();
if (!ent)
return;
ex->ent.frame = f;

View file

@ -831,28 +831,28 @@ R_DrawEntitiesOnList (void)
}
// LordHavoc: split into 3 loops to simplify state changes
for (i = 0; i < cl_numvisedicts; i++) {
if (cl_visedicts[i]->model->type != mod_brush)
for (i = 0; i < r_numvisedicts; i++) {
if (r_visedicts[i]->model->type != mod_brush)
continue;
currententity = cl_visedicts[i];
currententity = r_visedicts[i];
modelalpha = currententity->alpha;
R_DrawBrushModel (currententity);
}
for (i = 0; i < cl_numvisedicts; i++) {
if (cl_visedicts[i]->model->type != mod_alias)
for (i = 0; i < r_numvisedicts; i++) {
if (r_visedicts[i]->model->type != mod_alias)
continue;
currententity = cl_visedicts[i];
currententity = r_visedicts[i];
modelalpha = currententity->alpha;
R_DrawAliasModel (currententity);
}
for (i = 0; i < cl_numvisedicts; i++) {
if (cl_visedicts[i]->model->type != mod_sprite)
for (i = 0; i < r_numvisedicts; i++) {
if (r_visedicts[i]->model->type != mod_sprite)
continue;
currententity = cl_visedicts[i];
currententity = r_visedicts[i];
modelalpha = currententity->alpha;
R_DrawSpriteModel (currententity);
@ -1106,7 +1106,7 @@ R_Mirror (void)
r_refdef.viewangles[1] = atan2 (vpn[1], vpn[0]) / M_PI * 180;
r_refdef.viewangles[2] = -r_refdef.viewangles[2];
ent = CL_NewTempEntity();
ent = R_NewEntity();
if (ent)
*ent = &cl_entities[cl.viewentity];

View file

@ -34,7 +34,6 @@
#include "QF/render.h"
#include "QF/sys.h"
#include "cl_tent.h"
#include "r_local.h"
mnode_t *r_pefragtopnode;
@ -248,7 +247,7 @@ R_StoreEfrags (efrag_t **ppefrag)
pent = pefrag->entity;
if (pent->visframe != r_framecount) {
entity_t **ent = CL_NewTempEntity ();
entity_t **ent = R_NewEntity ();
if (!ent)
return;
*ent = pent;

87
qw/source/r_ent.c Normal file
View file

@ -0,0 +1,87 @@
/*
r_tent.c
rendering entities
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <math.h>
#include <stdlib.h>
#include "QF/console.h"
#include "QF/model.h"
#include "QF/msg.h"
#include "QF/sound.h"
#include "QF/sys.h"
#include "r_dynamic.h"
#include "QF/render.h"
#define MAX_VISEDICTS 256
int r_numvisedicts;
entity_t *r_visedicts[MAX_VISEDICTS];
void
R_Ents_Init (void)
{
}
void
R_Init_Entity (entity_t *ent)
{
memset (ent, 0, sizeof (*ent));
ent->colormap = vid.colormap;
ent->glow_size = 0;
ent->glow_color = 254;
ent->alpha = 1;
ent->scale = 1;
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1;
ent->pose1 = ent->pose2 = -1;
}
void
R_ClearEnts (void)
{
r_numvisedicts = 0;
}
entity_t **
R_NewEntity (void)
{
if (r_numvisedicts == MAX_VISEDICTS)
return NULL;
return &r_visedicts[r_numvisedicts++];
}

View file

@ -495,8 +495,8 @@ R_DrawEntitiesOnList (void)
return;
}
for (i = 0; i < cl_numvisedicts; i++) {
currententity = cl_visedicts[i];
for (i = 0; i < r_numvisedicts; i++) {
currententity = r_visedicts[i];
switch (currententity->model->type) {
case mod_sprite:
@ -685,8 +685,8 @@ R_DrawBEntitiesOnList (void)
insubmodel = true;
r_dlightframecount = r_framecount;
for (i = 0; i < cl_numvisedicts; i++) {
currententity = cl_visedicts[i];
for (i = 0; i < r_numvisedicts; i++) {
currententity = r_visedicts[i];
switch (currententity->model->type) {
case mod_brush: