Client: Move CSQC_Ent_Update into entry.c as it's an entry function. Move Entities_ParseLump into entities.c
This commit is contained in:
parent
a0a593ef6b
commit
340db972be
2 changed files with 107 additions and 100 deletions
|
@ -14,57 +14,67 @@
|
||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
float
|
||||||
=================
|
Entities_ParseLump(void)
|
||||||
CSQC_Ent_Update
|
|
||||||
|
|
||||||
Called whenever an entity is sent manually via .SendFlags and so on
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
CSQC_Ent_Update(float new)
|
|
||||||
{
|
{
|
||||||
float t;
|
entity eOld;
|
||||||
t = readbyte();
|
CBaseEntity eEnt = __NULL__;
|
||||||
|
string strField, strValue;
|
||||||
|
__fullspawndata = "";
|
||||||
|
int iClass = FALSE;
|
||||||
|
|
||||||
switch (t) {
|
eOld = self;
|
||||||
case ENT_ENTITY:
|
|
||||||
CBaseEntity me = (CBaseEntity)self;
|
while (1) {
|
||||||
if (new) {
|
strField = getentitytoken();
|
||||||
spawnfunc_CBaseEntity();
|
|
||||||
|
if (!strField) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
me.ReadEntity(readfloat());
|
|
||||||
break;
|
if (strField == "}") {
|
||||||
case ENT_PLAYER:
|
/* invalid entity */
|
||||||
Player_ReadEntity(new);
|
if (!eEnt.classname) {
|
||||||
break;
|
break;
|
||||||
case ENT_SPRITE:
|
}
|
||||||
env_sprite spr = (env_sprite)self;
|
/* when we've reached the end of the lump, initialize the class! */
|
||||||
if (new) {
|
if (iClass == TRUE) {
|
||||||
spawnfunc_env_sprite();
|
eEnt.Init();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* remove if we've found no valid class to go with us */
|
||||||
|
if (eEnt) {
|
||||||
|
remove(eEnt);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
spr.ReadEntity(readfloat());
|
|
||||||
break;
|
strValue = getentitytoken();
|
||||||
break;
|
if (!strValue) {
|
||||||
case ENT_SPRAY:
|
break;
|
||||||
Spray_Parse();
|
|
||||||
break;
|
|
||||||
case ENT_DECAL:
|
|
||||||
Decal_Parse();
|
|
||||||
break;
|
|
||||||
case ENT_AMBIENTSOUND:
|
|
||||||
Sound_ParseLoopingEntity(self, new);
|
|
||||||
break;
|
|
||||||
case ENT_ENVLASER:
|
|
||||||
env_laser l = (env_laser)self;
|
|
||||||
if (new) {
|
|
||||||
spawnfunc_env_laser();
|
|
||||||
}
|
}
|
||||||
l.ReadEntity(readfloat());
|
|
||||||
break;
|
switch (strField) {
|
||||||
default:
|
case "classname":
|
||||||
if (Game_Entity_Update(t, new) == FALSE) {
|
eEnt = (CBaseEntity)spawn();
|
||||||
error("Unknown entity type update received.\n");
|
|
||||||
|
/* check if our classname has a matching class */
|
||||||
|
if (isfunction(strcat("spawnfunc_", strValue))) {
|
||||||
|
self = eEnt;
|
||||||
|
callfunction(strcat("spawnfunc_", strValue));
|
||||||
|
self = eOld;
|
||||||
|
iClass = TRUE;
|
||||||
|
} else {
|
||||||
|
eEnt.classname = strValue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
__fullspawndata = sprintf("%s\"%s\" \"%s\" ",
|
||||||
|
__fullspawndata, strField, strValue);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* This file houses all of the callbacks and entry points the engine
|
||||||
|
calls by itself */
|
||||||
|
|
||||||
void
|
void
|
||||||
CSQC_Init(float apilevel, string enginename, float engineversion)
|
CSQC_Init(float apilevel, string enginename, float engineversion)
|
||||||
{
|
{
|
||||||
|
@ -333,7 +336,6 @@ CSQC_UpdateView(float w, float h, float focus)
|
||||||
} else if (focus == TRUE) {
|
} else if (focus == TRUE) {
|
||||||
GameText_Draw();
|
GameText_Draw();
|
||||||
|
|
||||||
// The spectator sees things... differently
|
|
||||||
if (getplayerkeyvalue(player_localnum, "*spec") != "0") {
|
if (getplayerkeyvalue(player_localnum, "*spec") != "0") {
|
||||||
HUD_DrawSpectator();
|
HUD_DrawSpectator();
|
||||||
} else {
|
} else {
|
||||||
|
@ -344,7 +346,7 @@ CSQC_UpdateView(float w, float h, float focus)
|
||||||
Chat_Draw();
|
Chat_Draw();
|
||||||
Print_Draw();
|
Print_Draw();
|
||||||
|
|
||||||
// Don't even try to draw centerprints and VGUI menus when scores are shown
|
/* no prints overlapping scoreboards */
|
||||||
if (pSeat->m_iScoresVisible == TRUE) {
|
if (pSeat->m_iScoresVisible == TRUE) {
|
||||||
Scores_Draw();
|
Scores_Draw();
|
||||||
} else {
|
} else {
|
||||||
|
@ -769,66 +771,57 @@ CSQC_Parse_CenterPrint(string sMessage)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
CSQC_Ent_ParseMapEntity
|
CSQC_Ent_Update
|
||||||
|
|
||||||
|
Called whenever an entity is sent manually via .SendFlags and so on
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
float
|
void
|
||||||
CSQC_Ent_ParseMapEntity(void)
|
CSQC_Ent_Update(float new)
|
||||||
{
|
{
|
||||||
entity eOld;
|
float t;
|
||||||
CBaseEntity eEnt = __NULL__;
|
t = readbyte();
|
||||||
string strField, strValue;
|
|
||||||
__fullspawndata = "";
|
|
||||||
int iClass = FALSE;
|
|
||||||
|
|
||||||
eOld = self;
|
switch (t) {
|
||||||
|
case ENT_ENTITY:
|
||||||
while (1) {
|
CBaseEntity me = (CBaseEntity)self;
|
||||||
strField = getentitytoken();
|
if (new) {
|
||||||
|
spawnfunc_CBaseEntity();
|
||||||
if (!strField) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
me.ReadEntity(readfloat());
|
||||||
if (strField == "}") {
|
break;
|
||||||
if (!eEnt.classname) {
|
case ENT_PLAYER:
|
||||||
break;
|
Player_ReadEntity(new);
|
||||||
}
|
break;
|
||||||
if (iClass == TRUE) {
|
case ENT_SPRITE:
|
||||||
eEnt.Init();
|
env_sprite spr = (env_sprite)self;
|
||||||
return TRUE;
|
if (new) {
|
||||||
}
|
spawnfunc_env_sprite();
|
||||||
if (eEnt) {
|
|
||||||
remove(eEnt);
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
spr.ReadEntity(readfloat());
|
||||||
strValue = getentitytoken();
|
break;
|
||||||
if (!strValue) {
|
break;
|
||||||
break;
|
case ENT_SPRAY:
|
||||||
|
Spray_Parse();
|
||||||
|
break;
|
||||||
|
case ENT_DECAL:
|
||||||
|
Decal_Parse();
|
||||||
|
break;
|
||||||
|
case ENT_AMBIENTSOUND:
|
||||||
|
Sound_ParseLoopingEntity(self, new);
|
||||||
|
break;
|
||||||
|
case ENT_ENVLASER:
|
||||||
|
env_laser l = (env_laser)self;
|
||||||
|
if (new) {
|
||||||
|
spawnfunc_env_laser();
|
||||||
}
|
}
|
||||||
|
l.ReadEntity(readfloat());
|
||||||
switch (strField) {
|
break;
|
||||||
case "classname":
|
default:
|
||||||
eEnt = (CBaseEntity)spawn();
|
if (Game_Entity_Update(t, new) == FALSE) {
|
||||||
if (isfunction(strcat("spawnfunc_", strValue))) {
|
error("Unknown entity type update received.\n");
|
||||||
self = eEnt;
|
|
||||||
callfunction(strcat("spawnfunc_", strValue));
|
|
||||||
self = eOld;
|
|
||||||
iClass = TRUE;
|
|
||||||
} else {
|
|
||||||
eEnt.classname = strValue;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
__fullspawndata = sprintf("%s\"%s\" \"%s\" ",
|
|
||||||
__fullspawndata, strField, strValue);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -850,6 +843,7 @@ CSQC_WorldLoaded(void)
|
||||||
|
|
||||||
string strTokenized;
|
string strTokenized;
|
||||||
getentitytoken(0);
|
getentitytoken(0);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
strTokenized = getentitytoken();
|
strTokenized = getentitytoken();
|
||||||
if (strTokenized == "") {
|
if (strTokenized == "") {
|
||||||
|
@ -859,11 +853,14 @@ CSQC_WorldLoaded(void)
|
||||||
print("^1[WARNING] ^7Bad entity data\n");
|
print("^1[WARNING] ^7Bad entity data\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!CSQC_Ent_ParseMapEntity()) {
|
if (!Entities_ParseLump()) {
|
||||||
print("^1[WARNING] ^7Bad entity data\n");
|
print("^1[WARNING] ^7Bad entity data\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* we've gone through all ent-lumps, so we can read sky-overrides from
|
||||||
|
worldspawn now. */
|
||||||
Sky_Update();
|
Sky_Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue