Clean up the base classes, get rid of having to manually include the entbase

defs.h for the respective progs.
This commit is contained in:
Marco Cawthorne 2022-01-20 16:23:29 -08:00
parent fbb53d62f4
commit 06d07738b6
Signed by: eukara
GPG Key ID: C196CD8BA993248A
24 changed files with 76 additions and 45 deletions

View File

@ -8,7 +8,6 @@
#includelist
/* engine, then nuclide headers & functions */
../../../src/shared/fteextensions.qc
../../../src/gs-entbase/server/defs.h
../../../src/shared/defs.h
../../../src/server/defs.h
../../../src/gs-entbase/server.src

View File

@ -53,6 +53,7 @@ var float autocvar_cl_hudaspect = 0.0f;
/* particle descriptors */
var float PART_DUSTMOTE;
var float PART_BURNING;
/* muzzleflash indices */
var int MUZZLE_SMALL;

View File

@ -125,6 +125,7 @@ CSQC_RendererRestarted(string rstr)
/* Particles */
PART_DUSTMOTE = particleeffectnum("volume.dustmote");
PART_BURNING = particleeffectnum("burn.burning");
/* 2D Pics */
precache_pic("gfx/vgui/icntlk_sv");
@ -195,8 +196,8 @@ CSQC_UpdateView(float w, float h, float focus)
setproperty(VF_ENVMAP, "$whiteimage");
setproperty(VF_ORIGIN, g_vecCubePos);
setproperty(VF_AFOV, 90);
setproperty(VF_CL_VIEWANGLES, [0,0,0]);
setproperty(VF_ANGLES, [0,0,0]);
//setproperty(VF_CL_VIEWANGLES, [0,0,0]);
//setproperty(VF_ANGLES, [0,0,0]);
SkyCamera_Setup(g_vecCubePos);
CSQC_RenderScene();
return;
@ -929,14 +930,14 @@ CSQC_Ent_Update(float new)
if (new) {
spawnfunc_NSEntity();
}
me.ReceiveEntity(readfloat());
me.ReceiveEntity(new, readfloat());
break;
case ENT_ENTITYRENDERABLE:
NSRenderableEntity rend = (NSRenderableEntity)self;
if (new) {
spawnfunc_NSRenderableEntity();
}
rend.ReceiveEntity(readfloat());
rend.ReceiveEntity(new, readfloat());
break;
case ENT_MONSTER:
NSMonster_ReadEntity(new);
@ -983,7 +984,7 @@ CSQC_Ent_Update(float new)
if (new) {
spawnfunc_env_sprite();
}
spr.ReceiveEntity(readfloat());
spr.ReceiveEntity(new, readfloat());
break;
case ENT_SPRAY:
Spray_Parse();
@ -999,42 +1000,42 @@ CSQC_Ent_Update(float new)
if (new) {
spawnfunc_trigger_camera();
}
tc.ReceiveEntity(readfloat());
tc.ReceiveEntity(new, readfloat());
break;
case ENT_MONITOR:
func_monitor fc = (func_monitor)self;
if (new) {
spawnfunc_func_monitor();
}
fc.ReceiveEntity(readfloat());
fc.ReceiveEntity(new, readfloat());
break;
case ENT_DLIGHT:
light_dynamic dl = (light_dynamic)self;
if (new) {
spawnfunc_light_dynamic();
}
dl.ReceiveEntity(readfloat());
dl.ReceiveEntity(new, readfloat());
break;
case ENT_PROJECTEDTEXTURE:
env_projectedtexture ept = (env_projectedtexture)self;
if (new) {
spawnfunc_env_projectedtexture();
}
ept.ReceiveEntity(readfloat());
ept.ReceiveEntity(new, readfloat());
break;
case ENT_ENVLASER:
env_laser l = (env_laser)self;
if (new) {
spawnfunc_env_laser();
}
l.ReceiveEntity(readfloat());
l.ReceiveEntity(new, readfloat());
break;
case ENT_PARTSYSTEM:
info_particle_system ips = (info_particle_system)self;
if (new) {
spawnfunc_info_particle_system();
}
ips.ReceiveEntity(readfloat());
ips.ReceiveEntity(new, readfloat());
break;
default:
if (ClientGame_EntityUpdate(t, new) == FALSE) {

View File

@ -37,6 +37,8 @@ player::draw(void)
float
player::predraw(void)
{
super::predraw();
/* run animations regardless of rendering the player */
draw();

View File

@ -14,8 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../shared/baseentity.h"
vector g_vecSunDir;
/* TODO: Find a better way to figure out what's a NSEntity at heart */

View File

@ -33,7 +33,7 @@ class env_laser
void(void) env_laser;
virtual void(float flChanged) ReceiveEntity;
virtual void(float,float) ReceiveEntity;
virtual float(void) predraw;
};
@ -51,7 +51,7 @@ float env_laser::predraw(void)
}
void
env_laser::ReceiveEntity(float flChanged)
env_laser::ReceiveEntity(float flNew, float flChanged)
{
if (flChanged & ENVLASER_CHANGED_ORIGIN) {
origin[0] = readcoord();

View File

@ -22,7 +22,7 @@ class env_sprite:NSRenderableEntity
virtual void(void) Init;
virtual void(void) Initialized;
virtual void(float flChanged) ReceiveEntity;
virtual void(float,float) ReceiveEntity;
virtual void(void) think;
};
@ -43,7 +43,7 @@ env_sprite::think(void)
}
void
env_sprite::ReceiveEntity(float flChanged)
env_sprite::ReceiveEntity(float flNew, float flChanged)
{
origin[0] = readcoord();
origin[1] = readcoord();

View File

@ -27,7 +27,7 @@ class NSEntity:NSTrigger
vector m_vecMaxs;
#ifdef CLIENT
virtual void(float flChanged) ReceiveEntity;
virtual void(float,float) ReceiveEntity;
virtual void(void) postdraw;
virtual void(void) RendererRestarted;
#endif

View File

@ -35,7 +35,7 @@ NSEntity::ReceiveEntity
============
*/
void
NSEntity::ReceiveEntity(float flChanged)
NSEntity::ReceiveEntity(float flNew, float flChanged)
{
if (flChanged & BASEFL_CHANGED_ORIGIN) {
origin[0] = readcoord();

View File

@ -267,7 +267,7 @@ class NSMonster:NSSurfacePropEntity
#else
virtual void(void) customphysics;
virtual float(void) predraw;
virtual void(float) ReceiveEntity;
virtual void(float,float) ReceiveEntity;
#endif
};

View File

@ -728,6 +728,7 @@ NSMonster::SendEntity(entity ePEnt, float fChanged)
}
if (fChanged & BASEFL_CHANGED_FRAME) {
WriteByte(MSG_ENTITY, frame);
WriteFloat(MSG_ENTITY, frame1time);
}
if (fChanged & BASEFL_CHANGED_SKIN) {
WriteByte(MSG_ENTITY, skin + 128);
@ -795,7 +796,7 @@ NSMonster::ReceiveEntity
============
*/
void
NSMonster::ReceiveEntity(float flChanged)
NSMonster::ReceiveEntity(float flNew, float flChanged)
{
if (flChanged & BASEFL_CHANGED_ORIGIN) {
origin[0] = readcoord();
@ -830,9 +831,9 @@ NSMonster::ReceiveEntity(float flChanged)
setsize(this, mins, maxs);
}
if (flChanged & BASEFL_CHANGED_FRAME) {
frame1time = 0.0;
frame2time = 0.0f;
frame = readbyte();
frame1time = readfloat();
frame2time = frame1time;
}
if (flChanged & BASEFL_CHANGED_SKIN) {
skin = readbyte() - 128;
@ -915,6 +916,6 @@ NSMonster_ReadEntity(float new)
if (new) {
spawnfunc_NSMonster();
}
me.ReceiveEntity(readfloat());
me.ReceiveEntity(new, readfloat());
}
#endif

View File

@ -34,7 +34,7 @@ class NSRenderableEntity:NSEntity
virtual void(float) Save;
virtual void(string,string) Restore;
#else
virtual void(float flChanged) ReceiveEntity;
virtual void(float,float) ReceiveEntity;
virtual float(void) predraw;
#endif

View File

@ -329,7 +329,7 @@ NSRenderableEntity::ReceiveEntity
============
*/
void
NSRenderableEntity::ReceiveEntity(float flChanged)
NSRenderableEntity::ReceiveEntity(float flNew, float flChanged)
{
if (flChanged & BASEFL_CHANGED_ORIGIN) {
origin[0] = readcoord();

View File

@ -16,6 +16,8 @@
class NSSurfacePropEntity:NSRenderableEntity
{
float m_flBurnNext;
void(void) NSSurfacePropEntity;
/* overrides */
@ -27,6 +29,8 @@ class NSSurfacePropEntity:NSRenderableEntity
virtual void(entity, string, string) Input;
virtual void(string, string) SpawnKey;
virtual void(void) ParentUpdate;
#else
virtual float(void) predraw;
#endif
/* new */
@ -35,7 +39,6 @@ class NSSurfacePropEntity:NSRenderableEntity
entity m_eBurner;
int m_iBurnWeapon;
float m_flBurnTime;
float m_flBurnNext;
/* I/O */
string m_strOnBreak;

View File

@ -260,6 +260,23 @@ NSSurfacePropEntity::PropDataFinish(void)
PropData_SetStage(m_strPropData);
m_iPropData = PropData_Finish();
}
#else
float
NSSurfacePropEntity::predraw(void)
{
if (flags & FL_ONFIRE) {
vector someorg;
if (m_flBurnNext < time) {
someorg[0] = absmin[0] + ( random() * ( absmax[0] - absmin[0] ) );
someorg[1] = absmin[1] + ( random() * ( absmax[1] - absmin[1] ) );
someorg[2] = absmin[2] + ( random() * ( absmax[2] - absmin[2] ) );
pointparticles(PART_BURNING, someorg, [0,0,0], 1);
m_flBurnNext = time + 0.1f;
}
}
super::predraw();
}
#endif
void

View File

@ -684,6 +684,7 @@ NSTalkMonster::SendEntity(entity ePEnt, float fChanged)
}
if (fChanged & BASEFL_CHANGED_FRAME) {
WriteByte(MSG_ENTITY, frame);
WriteFloat(MSG_ENTITY, frame1time);
}
if (fChanged & BASEFL_CHANGED_SKIN) {
WriteByte(MSG_ENTITY, skin + 128);
@ -875,6 +876,6 @@ NSTalkMonster_ReadEntity(float new)
if (new) {
spawnfunc_NSTalkMonster();
}
me.ReceiveEntity(readfloat());
me.ReceiveEntity(new, readfloat());
}
#endif

View File

@ -14,6 +14,9 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef BASEENTITY
#define BASEENTITY
#include "NSIO.h"
#include "NSTrigger.h"
#include "NSEntity.h"
@ -56,4 +59,5 @@ void
CBaseTrigger::CBaseTrigger(void)
{
CBaseEntity::CBaseEntity();
}
}
#endif

View File

@ -79,7 +79,7 @@ class env_projectedtexture:NSPointTrigger
void(void) env_projectedtexture;
#ifdef CLIENT
virtual void(float) ReceiveEntity;
virtual void(float,float) ReceiveEntity;
virtual float(void) predraw;
#else
@ -111,7 +111,7 @@ env_projectedtexture::predraw(void)
}
void
env_projectedtexture::ReceiveEntity(float flFlags)
env_projectedtexture::ReceiveEntity(float flNew, float flFlags)
{
if (flFlags & PRTEXFL_CHANGED_ORIGIN) {
origin[0] = readcoord();

View File

@ -90,7 +90,7 @@ class func_monitor:NSRenderableEntity
#ifdef CLIENT
int m_iValue;
virtual void(float) ReceiveEntity;
virtual void(float,float) ReceiveEntity;
#else
virtual void(void) Respawn;
virtual void(void) EvaluateEntity;
@ -103,7 +103,7 @@ class func_monitor:NSRenderableEntity
#ifdef CLIENT
void
func_monitor::ReceiveEntity(float flFlags)
func_monitor::ReceiveEntity(float flNew, float flFlags)
{
if (flFlags & MONITORFL_CHANGED_ORIGIN) {
modelindex = readfloat();

View File

@ -58,7 +58,7 @@ class info_particle_system:NSPointTrigger
int m_iEffectID;
virtual void(void) Emit;
virtual void(float) ReceiveEntity;
virtual void(float,float) ReceiveEntity;
#else
virtual void(void) Respawn;
virtual void(void) EvaluateEntity;
@ -83,7 +83,7 @@ info_particle_system::Emit(void)
}
void
info_particle_system::ReceiveEntity(float flFlags)
info_particle_system::ReceiveEntity(float flNew, float flFlags)
{
if (flFlags & PARTSYSFL_CHANGED_ORIGIN) {
origin[0] = readcoord();

View File

@ -84,7 +84,7 @@ class light_dynamic:NSPointTrigger
virtual void(string, string) SpawnKey;
#ifdef CLIENT
virtual void(float) ReceiveEntity;
virtual void(float,float) ReceiveEntity;
virtual float(void) predraw;
virtual void(void) Initialized;
virtual void(void) RendererRestarted;
@ -116,7 +116,7 @@ light_dynamic::predraw(void)
}
void
light_dynamic::ReceiveEntity(float flFlags)
light_dynamic::ReceiveEntity(float flNew, float flFlags)
{
if (flFlags & DLIGHTFL_CHANGED_ORIGIN) {
origin[0] = readcoord();

View File

@ -54,7 +54,7 @@ class trigger_camera:NSPointTrigger
void(void) trigger_camera;
#ifdef CLIENT
virtual void(float) ReceiveEntity;
virtual void(float,float) ReceiveEntity;
#else
virtual void(void) NextPath;
virtual void(void) GoToTarget;
@ -68,7 +68,7 @@ class trigger_camera:NSPointTrigger
#ifdef CLIENT
void
trigger_camera::ReceiveEntity(float flFlags)
trigger_camera::ReceiveEntity(float flNew, float flFlags)
{
if (flFlags & OCAMFL_CHANGED_ORIGIN) {
origin[0] = readcoord();

View File

@ -14,6 +14,15 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "sound.h"
#ifdef CLIENT
#include "../gs-entbase/client/defs.h"
#else
#include "../gs-entbase/server/defs.h"
#endif
#include "../gs-entbase/shared/baseentity.h"
#include "player.h"
#include "damage.h"
#include "flags.h"
@ -23,7 +32,6 @@
#include "hitmesh.h"
#include "materials.h"
#include "math.h"
#include "sound.h"
#include "pmove.h"
#include "memory.h"
#include "spectator.h"

View File

@ -29,11 +29,7 @@
#define VEC_CHANGED(x,y) (x ##_net[y] != x[y])
class
#ifdef SERVER
base_player:NSSurfacePropEntity
#else
base_player
#endif
{
PREDICTED_FLOAT(health);
PREDICTED_FLOAT(armor);