Get the player to spawn into the world. Added some simple definitions just to have some more entities show up.

This commit is contained in:
Marco Cawthorne 2022-11-14 18:13:51 -08:00
parent 6a401495c6
commit 071c2ba93f
Signed by: eukara
GPG key ID: CE2032F0A2882A22
19 changed files with 803 additions and 445 deletions

View file

@ -1,79 +0,0 @@
/* these are the standard Quake engine builtins */
void makevectors(vector ang) = #1
void setorigin(entity e, vector o) = #2;
void setmodel(entity e, string m) = #3;
void setsize(entity e, vector min, vector max) = #4;
/* 5 was removed */
void break(void) = #6;
float random(void) = #7;
void sound(entity e, float chan, string samp, float vol, float atten) = #8;
vector normalize(vector v) = #9;
void error(string e) = #10;
void objerror(string e) = #11;
float vlen(vector v) = #12;
float vectoyaw(vector v) = #13;
entity spawn(void) = #14;
void remove(entity e) = #15;
void traceline(vector v1, vector v2, float nomonsters, entity forent) = #16;
entity checkclient(void) = #17;
entity find(entity start, .string fld, string match) = #18;
string precache_sound(string s) = #19;
string precache_model(string s) = #20;
void stuffcmd(entity client, string s) = #21;
entity findradius(vector org, float rad) = #22;
void bprint(string s) = #23;
void sprint(entity client, string s) = #24;
void dprint(string s) = #25;
string ftos(float f) = #26;
string vtos(vector v) = #27;
void coredump(void) = #28;
void traceon(void) = #29;
void traceoff(void) = #30;
void eprint(entity e) = #31;
float walkmove(float yaw, float dist) = #32;
// #33 was removed
float droptofloor(float yaw, float dist) = #34;
void lightstyle(float style, string value) = #35;
float rint(float v) = #36;
float floor(float v) = #37;
float ceil(float v) = #38;
// #39 was removed
float checkbottom(entity e) = #40;
float pointcontents(vector v) = #41;
// #42 was removed
float fabs(float f) = #43;
vector aim(entity e, float speed) = #44;
float cvar(string s) = #45;
void localcmd(string s) = #46;
entity nextent(entity e) = #47;
void particle(vector o, vector d, float color, float count) = #48;
void ChangeYaw(void) = #49;
vector vectoangles(vector v) = #51;
void WriteByte(float to, float f) = #52;
void WriteChar(float to, float f) = #53;
void WriteShort(float to, float f) = #54;
void WriteLong(float to, float f) = #55;
void WriteCoord(float to, float f) = #56;
void WriteAngle(float to, float f) = #57;
void WriteString(float to, string s) = #58;
void WriteEntity(float to, entity s) = #59;
/* 60 was removed */
/* 61 was removed */
/* 62 was removed */
/* 63 was removed */
/* 64 was removed */
/* 65 was removed */
/* 66 was removed */
void movetogoal(float step) = #67;
string precache_file(string s) = #68;
void makestatic(entity e) = #69;
void changelevel(string s) = #70;
/* 71 was removed */
void cvar_set(string var, string val) = #72;
void centerprint(entity client, string s) = #73;
void ambientsound(vector pos, string samp, float vol, float atten) = #74;
string precache_model2(string s) = #75;
string precache_sound2(string s) = #76;
string precache_file2(string s) = #77;
void setspawnparms(entity e) = #78;

View file

@ -44,11 +44,11 @@ typedef enum
typedef enum typedef enum
{ {
SOLID_NOT, // no interaction with other objects SOLID_NOT, /* no interaction with other objects */
SOLID_TRIGGER, // touch on edge, but not blocking SOLID_TRIGGER, /* touch on edge, but not blocking */
SOLID_BBOX, // touch on edge, block SOLID_BBOX, /* touch on edge, block */
SOLID_SLIDEBOX, // touch on edge, but not an onground SOLID_SLIDEBOX, /* touch on edge, but not an onground */
SOLID_BSP // bsp clip, touch on edge, block SOLID_BSP /* bsp clip, touch on edge, block */
} solid_t; } solid_t;
// range values // range values
@ -161,6 +161,9 @@ typedef enum
CHAN_VOICE, /** voice channel */ CHAN_VOICE, /** voice channel */
CHAN_ITEM, /** item noise channel */ CHAN_ITEM, /** item noise channel */
CHAN_BODY, /** body sound channel */ CHAN_BODY, /** body sound channel */
CHAN_UNUSED1,
CHAN_UNUSED2,
CHAN_UNUSED3
} channel_t; } channel_t;
/** attenuation */ /** attenuation */

12
src/entities/func_wall.qc Normal file
View file

@ -0,0 +1,12 @@
class idFuncWall:idEntity {
void idFuncWall( void );
};
void idFuncWall:: idFuncWall( void ) {
SetAngles( [0, 0, 0] );
SetMovetype(MOVETYPE_PUSH);
SetSolid(SOLID_BSP);
SetModel(GetModel()); /* relink with the above properties */
}
LINK_ENTITY_TO_CLASS(func_wall, idFuncWall)

View file

@ -0,0 +1,30 @@
class idPlayerStart:idEntity {
void idPlayerStart( void );
/** Moves a player to the first starting spawn point and returns the result. */
nonvirtual idEntity MovePlayerToStart( idPlayer );
};
void idPlayerStart::idPlayerStart( void ) {
SetSolid( SOLID_NOT );
SetMovetype( MOVETYPE_NONE );
}
idEntity idPlayerStart::MovePlayerToStart( idPlayer player ) {
idEntity point = g_idEngine.Find( world, ::classname, "idPlayerStart" );
if ( point ) {
player.SetOrigin( point.GetOrigin() );
player.SetAngles( point.GetAngles() );
player.ForceUpdateClientAngle();
return point;
} else {
g_idEngine.Error( "Cannot find idPlayerStart on level." );
return __NULL__;
}
}
LINK_ENTITY_TO_CLASS(info_player_start, idPlayerStart)
LINK_ENTITY_TO_CLASS(info_player_deathmatch, idPlayerStart)
LINK_ENTITY_TO_CLASS(info_player_coop, idPlayerStart)
LINK_ENTITY_TO_CLASS(info_player_start2, idPlayerStart)

0
src/entities/light.qc Normal file
View file

5
src/entities/sources.src Normal file
View file

@ -0,0 +1,5 @@
#includelist
worldspawn.qc
info_player_start.qc
func_wall.qc
#endlist

View file

@ -0,0 +1,30 @@
class worldspawn {
void worldspawn( void );
nonvirtual void InitLight( void );
};
void worldspawn::worldspawn( void ) {
g_idEngine.Precache_Model( "progs/player.mdl" );
InitLight();
}
void worldspawn::InitLight( void ) {
g_idEngine.LightStyle( 0, "m" );
g_idEngine.LightStyle( 1, "mmnmmommommnonmmonqnmmo" );
g_idEngine.LightStyle( 2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba" );
g_idEngine.LightStyle( 3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg" );
g_idEngine.LightStyle( 4, "mamamamamama" );
g_idEngine.LightStyle( 5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj" );
g_idEngine.LightStyle( 6, "nmonqnmomnmomomno" );
g_idEngine.LightStyle( 7, "mmmaaaabcdefgmmmmaaaammmaamm" );
g_idEngine.LightStyle( 8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa" );
g_idEngine.LightStyle( 9, "aaaaaaaazzzzzzzz" );
g_idEngine.LightStyle( 10, "mmamammmmammamamaaamammma" );
g_idEngine.LightStyle( 11, "abcdefghijklmnopqrrqponmlkjihgfedcba" );
}
void worldspawn( void )
{
spawnfunc_worldspawn();
}

View file

@ -1,53 +1,50 @@
/* all standard game entry functions live here */ /* all standard game entry functions live here */
void main(void) void main( void ) {
{
} }
void StartFrame(void) void StartFrame( void ) {
{ /* if our rules class doesn't yet exist - create it! */
if (!g_gameRules) if ( !g_gameRules ) {
g_gameRules = spawn(idRules); g_gameRules = g_idEngine.Spawn();
self = g_gameRules;
spawnfunc_idRules();
self = world;
}
} }
void PlayerPreThink(void) void PlayerPreThink( void ) {
{ idPlayer pl = ( idPlayer ) self;
idPlayer pl = (idPlayer)self;
pl.PreThink(); pl.PreThink();
} }
void PlayerPostThink(void) void PlayerPostThink( void ) {
{ idPlayer pl = ( idPlayer ) self;
idPlayer pl = (idPlayer)self;
pl.PostThink(); pl.PostThink();
} }
void ClientKill(void) void ClientKill( void ) {
{
} }
void ClientConnect(void) void ClientConnect( void ) {
{
/* initialize the player as an NSEntity class type */ /* initialize the player as an NSEntity class type */
spawnfunc_idPlayer(); spawnfunc_idPlayer();
g_gameRules.PlayerConnects((idPlayer)self); g_gameRules.PlayerConnects( ( idPlayer ) self );
} }
void PutClientInServer(void) void PutClientInServer( void ) {
{ g_gameRules.PlayerFinishesJoining( ( idPlayer ) self );
g_gameRules.PlayerFinishesJoining((idPlayer)self);
} }
void ClientDisconnect(void) void ClientDisconnect( void ) {
{ g_gameRules.PlayerDisconnects( ( idPlayer ) self );
g_gameRules.PlayerDisconnects((idPlayer)self);
} }
void SetNewParms(void) void SetNewParms( void ) {
{
} }
void SetChangeParms(void) void SetChangeParms( void ) {
{
} }

View file

@ -3,12 +3,14 @@
#includelist #includelist
defs.qh defs.qh
builtins.qh
constants.qh constants.qh
events.qh events.qh
system/headers.src system/headers.src
entry.qc entry.qc
entities/sources.src
system/sources.src system/sources.src
#endlist #endlist

View file

@ -1,5 +1,6 @@
#includelist #includelist
idEntity.qh idEntity.qh
idEngine.qh
idPlayer.qh idPlayer.qh
idRules.qh idRules.qh
#endlist #endlist

327
src/system/idEngine.qc Normal file
View file

@ -0,0 +1,327 @@
/* these are the standard Quake engine builtins */
void makevectors(vector ang) = #1
void setorigin(entity e, vector o) = #2;
void setmodel(entity e, string m) = #3;
void setsize(entity e, vector min, vector max) = #4;
/* 5 was removed */
void break(void) = #6;
float random(void) = #7;
void sound(entity e, float chan, string samp, float vol, float atten) = #8;
vector normalize(vector v) = #9;
void error(string e) = #10;
void objerror(string e) = #11;
float vlen(vector v) = #12;
float vectoyaw(vector v) = #13;
entity spawn(void) = #14;
void remove(entity e) = #15;
void traceline(vector v1, vector v2, float nomonsters, entity forent) = #16;
entity checkclient(void) = #17;
entity find(entity start, .string fld, string match) = #18;
string precache_sound(string s) = #19;
string precache_model(string s) = #20;
void stuffcmd(entity client, string s) = #21;
entity findradius(vector org, float rad) = #22;
void bprint(string s) = #23;
void sprint(entity client, string s) = #24;
void dprint(string s) = #25;
string ftos(float f) = #26;
string vtos(vector v) = #27;
void coredump(void) = #28;
void traceon(void) = #29;
void traceoff(void) = #30;
void eprint(entity e) = #31;
float walkmove(float yaw, float dist) = #32;
// #33 was removed
float droptofloor(float yaw, float dist) = #34;
void lightstyle(float style, string value) = #35;
float rint(float v) = #36;
float floor(float v) = #37;
float ceil(float v) = #38;
// #39 was removed
float checkbottom(entity e) = #40;
float pointcontents(vector v) = #41;
// #42 was removed
float fabs(float f) = #43;
vector aim(entity e, float speed) = #44;
float cvar(string s) = #45;
void localcmd(string s) = #46;
entity nextent(entity e) = #47;
void particle(vector o, vector d, float color, float count) = #48;
void changeyaw(void) = #49;
vector vectoangles(vector v) = #51;
void writeByte(float to, float f) = #52;
void writeChar(float to, float f) = #53;
void writeShort(float to, float f) = #54;
void writeLong(float to, float f) = #55;
void writeCoord(float to, float f) = #56;
void writeAngle(float to, float f) = #57;
void writeString(float to, string s) = #58;
void writeEntity(float to, entity s) = #59;
/* 60 was removed */
/* 61 was removed */
/* 62 was removed */
/* 63 was removed */
/* 64 was removed */
/* 65 was removed */
/* 66 was removed */
void movetogoal(float step) = #67;
string precache_file(string s) = #68;
void makestatic(entity e) = #69;
void changelevel(string s) = #70;
/* 71 was removed */
void cvar_set(string var, string val) = #72;
void centerprint(entity client, string s) = #73;
void ambientsound(vector pos, string samp, float vol, float atten) = #74;
string precache_model2(string s) = #75;
string precache_sound2(string s) = #76;
string precache_file2(string s) = #77;
void setspawnparms(entity e) = #78;
void idEngine::MakeVectors( vector ang ) {
return makevectors( ang );
}
void idEngine::SetOrigin( idEntity e, vector o ) {
setorigin( e, o );
}
void idEngine::SetModel( idEntity e, string m ) {
setmodel( e, m );
}
void idEngine::SetSize( idEntity e, vector min, vector max ) {
setsize( e, min, max );
}
void idEngine::Break( void ) {
break ();
}
float idEngine::Random( void ) {
return random();
}
void idEngine::Sound( idEntity e, float chan, string samp, float vol, float atten ) {
sound( e, chan, samp, vol, atten );
}
vector idEngine::Normalize( vector v ) {
return normalize( v );
}
void idEngine::Error( string e ) {
error( e );
}
void idEngine::ObjError( string e ) {
objerror( e );
}
float idEngine::VLen( vector v ) {
return vlen( v );
}
float idEngine::VecToYaw( vector v ) {
return vectoyaw( v );
}
idEntity idEngine::Spawn( void ) {
return spawn();
}
void idEngine::Remove( idEntity e ) {
remove( e );
}
void idEngine::TraceLine( vector v1, vector v2, float nomonsters, idEntity forent ) {
traceline( v1, v2, nomonsters, forent );
}
idEntity idEngine::CheckClient( void ) {
return checkclient();
}
idEntity idEngine::Find( idEntity start,.string fld, string match ) {
return find( start, ::fld, match );
}
string idEngine::Precache_Sound( string s ) {
return precache_sound( s );
}
string idEngine::Precache_Model( string s ) {
return precache_model( s );
}
void idEngine::StuffCmd( idEntity client, string s ) {
stuffcmd( client, s );
}
idEntity idEngine::FindRadius( vector org, float rad ) {
return findradius( org, rad );
}
void idEngine::BPrint( string s ) {
bprint( s );
}
void idEngine::SPrint( idEntity client, string s ) {
sprint( client, s );
}
void idEngine::DPrint( string s ) {
dprint( s );
}
string idEngine::FloatToString( float f ) {
return ftos( f );
}
string idEngine::VectorToString( vector v ) {
return vtos( v );
}
void idEngine::CoreDump( void ) {
coredump();
}
void idEngine::TraceOn( void ) {
traceon();
}
void idEngine::TraceOff( void ) {
traceoff();
}
void idEngine::EPrint( idEntity e ) {
eprint( e );
}
float idEngine::WalkMove( float yaw, float dist ) {
return walkmove( yaw, dist );
}
float idEngine::DropToFloor( float yaw, float dist ) {
return droptofloor( yaw, dist );
}
void idEngine::LightStyle( float style, string value ) {
lightstyle( style, value );
}
float idEngine::RInt( float v ) {
return rint( v );
}
float idEngine::Floor( float v ) {
return floor( v );
}
float idEngine::Ceil( float v ) {
return ceil( v );
}
float idEngine::CheckBottom( idEntity e ) {
return checkbottom( e );
}
float idEngine::PointContents( vector v ) {
return pointcontents( v );
}
float idEngine::AbsoluteFloat( float f ) {
return fabs( f );
}
vector idEngine::Aim( idEntity e, float speed ) {
return aim( e, speed );
}
float idEngine::CVar( string s ) {
return cvar( s );
}
void idEngine::LocalCmd( string s ) {
localcmd( s );
}
idEntity idEngine::NextEnt( idEntity e ) {
return nextent( e );
}
void idEngine::Particle( vector o, vector d, float color, float count ) {
particle( o, d, color, count );
}
void idEngine::ChangeYaw( void ) {
changeyaw();
}
vector idEngine::VecToAngles( vector v ) {
return vectoangles( v );
}
void idEngine::WriteByte( float to, float f ) {
writeByte( to, f );
}
void idEngine::WriteChar( float to, float f ) {
writeChar( to, f );
}
void idEngine::WriteShort( float to, float f ) {
writeShort( to, f );
}
void idEngine::WriteLong( float to, float f ) {
writeLong( to, f );
}
void idEngine::WriteCoord( float to, float f ) {
writeCoord( to, f );
}
void idEngine::WriteAngle( float to, float f ) {
writeAngle( to, f );
}
void idEngine::WriteString( float to, string s ) {
writeString( to, s );
}
void idEngine::WriteEntity( float to, idEntity s ) {
writeEntity( to, s );
}
void idEngine::MoveToGoal( float step ) {
movetogoal( step );
}
string idEngine::Precache_File( string s ) {
return precache_file( s );
}
void idEngine::MakeStatic( idEntity e ) {
makestatic( e );
}
void idEngine::ChangeLevel( string s ) {
changelevel( s );
}
void idEngine::CVarSet( string variable, string val ) {
cvar_set( variable, val );
}
void idEngine::CenterPrint( idEntity client, string s ) {
centerprint( client, s );
}
void idEngine::AmbientSound( vector pos, string samp, float vol, float atten ) {
ambientsound( pos, samp, vol, atten );
}
void idEngine::SetSpawnParms( idEntity e ) {
setspawnparms( e );
}

68
src/system/idEngine.qh Normal file
View file

@ -0,0 +1,68 @@
class idEngine {
nonvirtual void MakeVectors( vector ang );
nonvirtual void SetOrigin( idEntity e, vector o );
nonvirtual void SetModel( idEntity e, string m );
nonvirtual void SetSize( idEntity e, vector min, vector max );
nonvirtual void Break( void );
nonvirtual float Random( void );
nonvirtual void Sound( idEntity e, float chan, string samp, float vol, float atten );
nonvirtual vector Normalize( vector v );
nonvirtual void Error( string e );
nonvirtual void ObjError( string e );
nonvirtual float VLen( vector v );
nonvirtual float VecToYaw( vector v );
nonvirtual idEntity Spawn( void );
nonvirtual void Remove( idEntity e );
nonvirtual void TraceLine( vector v1, vector v2, float nomonsters, idEntity forent );
nonvirtual idEntity CheckClient( void );
nonvirtual idEntity Find( idEntity start,.string fld, string match );
nonvirtual string Precache_Sound( string s );
nonvirtual string Precache_Model( string s );
nonvirtual void StuffCmd( idEntity client, string s );
nonvirtual idEntity FindRadius( vector org, float rad );
nonvirtual void BPrint( string s );
nonvirtual void SPrint( idEntity client, string s );
nonvirtual void DPrint( string s );
nonvirtual string FloatToString( float f );
nonvirtual string VectorToString( vector v );
nonvirtual void CoreDump( void );
nonvirtual void TraceOn( void );
nonvirtual void TraceOff( void );
nonvirtual void EPrint( idEntity e );
nonvirtual float WalkMove( float yaw, float dist );
nonvirtual float DropToFloor( float yaw, float dist );
nonvirtual void LightStyle( float style, string value );
nonvirtual float RInt( float v );
nonvirtual float Floor( float v );
nonvirtual float Ceil( float v );
nonvirtual float CheckBottom( idEntity e );
nonvirtual float PointContents( vector v );
nonvirtual float AbsoluteFloat( float f );
nonvirtual vector Aim( idEntity e, float speed );
nonvirtual float CVar( string s );
nonvirtual void LocalCmd( string s );
nonvirtual idEntity NextEnt( idEntity e );
nonvirtual void Particle( vector o, vector d, float color, float count );
nonvirtual void ChangeYaw( void );
nonvirtual vector VecToAngles( vector v );
nonvirtual void WriteByte( float to, float f );
nonvirtual void WriteChar( float to, float f );
nonvirtual void WriteShort( float to, float f );
nonvirtual void WriteLong( float to, float f );
nonvirtual void WriteCoord( float to, float f );
nonvirtual void WriteAngle( float to, float f );
nonvirtual void WriteString( float to, string s );
nonvirtual void WriteEntity( float to, idEntity s );
nonvirtual void MoveToGoal( float step );
nonvirtual string Precache_File( string s );
nonvirtual void MakeStatic( idEntity e );
nonvirtual void ChangeLevel( string s );
nonvirtual void CVarSet( string var, string val );
nonvirtual void CenterPrint( idEntity client, string s );
nonvirtual void AmbientSound( vector pos, string samp, float vol, float atten );
nonvirtual void SetSpawnParms( idEntity e );
};
idEngine g_idEngine;
#define LINK_ENTITY_TO_CLASS(cname,classa) void cname(void) { spawnfunc_##classa(); }

View file

@ -1,479 +1,386 @@
void idEntity::idEntity(void) void idEntity::idEntity( void ) {
{ health = 0;
max_health = 100;
} }
/* set functions */ /* set functions */
void idEntity::SetModelindex(float value) void idEntity::SetModelindex( float value ) {
{
modelindex = value; modelindex = value;
} }
void idEntity::SetMovetype(movetype_t value) void idEntity::SetMovetype( movetype_t value ) {
{
movetype = value; movetype = value;
} }
void idEntity::SetSolid(solid_t value) void idEntity::SetSolid( solid_t value ) {
{
solid = value; solid = value;
} }
void idEntity::SetOrigin(vector value) void idEntity::SetOrigin( vector value ) {
{ g_idEngine.SetOrigin( this, value );
setorigin(this, value);
} }
void idEntity::SetVelocity(vector value) void idEntity::SetVelocity( vector value ) {
{
velocity = value; velocity = value;
} }
void idEntity::SetAngles(vector value) void idEntity::SetAngles( vector value ) {
{
angles = value; angles = value;
} }
void idEntity::SetAngularVelocity(vector value) void idEntity::SetAngularVelocity( vector value ) {
{
avelocity = value; avelocity = value;
} }
void idEntity::SetPunchangle(vector value) void idEntity::SetPunchangle( vector value ) {
{
punchangle = value; punchangle = value;
} }
void idEntity::SetModel(string value) void idEntity::SetModel( string value ) {
{ g_idEngine.SetModel( this, value );
setmodel(this, value);
} }
void idEntity::SetFrame(float value) void idEntity::SetFrame( float value ) {
{
frame = value; frame = value;
} }
void idEntity::SetSkin(float value) void idEntity::SetSkin( float value ) {
{
skin = value; skin = value;
} }
void idEntity::AddEffect(effects_t value) void idEntity::AddEffect( effects_t value ) {
{
effects |= value; effects |= value;
} }
void idEntity::RemoveEffect(effects_t value) void idEntity::RemoveEffect( effects_t value ) {
{
effects &= ~value; effects &= ~value;
} }
void idEntity::ClearEffects(void) void idEntity::ClearEffects( void ) {
{
effects = 0; effects = 0;
} }
void idEntity::SetSize(vector min, vector max) void idEntity::SetSize( vector min, vector max ) {
{ g_idEngine.SetSize( this, min, max );
setsize(this, min, max);
} }
void idEntity::ScheduleThink(void(void) func, float timer) void idEntity::ScheduleThink( void ( void ) func, float timer ) {
{
} }
void idEntity::SetHealth(float value) void idEntity::SetHealth( float value ) {
{
health = value; health = value;
if (health > max_health) if ( health > max_health )
health = max_health; health = max_health;
} }
void idEntity::AddFrags(float value) void idEntity::AddFrags( float value ) {
{
frags += value; frags += value;
} }
void idEntity::RemoveFrags(float value) void idEntity::RemoveFrags( float value ) {
{
frags -= value; frags -= value;
} }
void idEntity::ClearFrags(void) void idEntity::ClearFrags( void ) {
{
frags = 0; frags = 0;
} }
void idEntity::SetWeapon(float value) void idEntity::SetWeapon( float value ) {
{
weapon = value; weapon = value;
} }
void idEntity::SetWeaponmodel(string value) void idEntity::SetWeaponmodel( string value ) {
{
weaponmodel = value; weaponmodel = value;
} }
void idEntity::SetWeaponframe(float value) void idEntity::SetWeaponframe( float value ) {
{
weaponframe = value; weaponframe = value;
} }
void idEntity::SetCurrentAmmo(float value) void idEntity::SetCurrentAmmo( float value ) {
{
currentammo = value; currentammo = value;
} }
void idEntity::SetAmmoType1(float value) void idEntity::SetAmmoType1( float value ) {
{
ammo_shells = value; ammo_shells = value;
} }
void idEntity::SetAmmoType2(float value) void idEntity::SetAmmoType2( float value ) {
{
ammo_nails = value; ammo_nails = value;
} }
void idEntity::SetAmmoType3(float value) void idEntity::SetAmmoType3( float value ) {
{
ammo_rockets = value; ammo_rockets = value;
} }
void idEntity::SetAmmoType4(float value) void idEntity::SetAmmoType4( float value ) {
{
ammo_cells = value; ammo_cells = value;
} }
void idEntity::SetTakedamage(damage_t value) void idEntity::SetTakedamage( damage_t value ) {
{
takedamage = value; takedamage = value;
} }
void idEntity::SetViewOffset(vector value) void idEntity::SetViewOffset( vector value ) {
{
view_ofs = value; view_ofs = value;
} }
void idEntity::ForceUpdateClientAngle(void) void idEntity::ForceUpdateClientAngle( void ) {
{
fixangle = 1; fixangle = 1;
} }
void idEntity::AddFlags(flags_t value) void idEntity::AddFlags( flags_t value ) {
{
flags |= value; flags |= value;
} }
void idEntity::RemoveFlags(flags_t value) void idEntity::RemoveFlags( flags_t value ) {
{
flags &= ~value; flags &= ~value;
} }
void idEntity::ClearFlags(void) void idEntity::ClearFlags( void ) {
{
flags = 0; flags = 0;
} }
void idEntity::SetColormap(float value) void idEntity::SetColormap( float value ) {
{
colormap = value; colormap = value;
} }
void idEntity::SetDisplayname(string value) void idEntity::SetDisplayname( string value ) {
{
netname = value; netname = value;
} }
void idEntity::SetMaxHealth(float value) void idEntity::SetMaxHealth( float value ) {
{
max_health = value; max_health = value;
} }
void idEntity::SetArmorType(float value) void idEntity::SetArmorType( float value ) {
{
armortype = value; armortype = value;
} }
void idEntity::SetArmor(float value) void idEntity::SetArmor( float value ) {
{
armorvalue = value; armorvalue = value;
} }
void idEntity::SetAimEntity(entity value) void idEntity::SetAimEntity( entity value ) {
{
aiment = value; aiment = value;
} }
void idEntity::SetGoalEntity(entity value) void idEntity::SetGoalEntity( entity value ) {
{
goalentity = value; goalentity = value;
} }
void idEntity::SetTarget(string value) void idEntity::SetTarget( string value ) {
{
target = value; target = value;
} }
void idEntity::SetTargetname(string value) void idEntity::SetTargetname( string value ) {
{
targetname = value; targetname = value;
} }
void idEntity::SetOwner(entity value) void idEntity::SetOwner( entity value ) {
{
owner = value; owner = value;
} }
void idEntity::SetMovementDirection(vector value) void idEntity::SetMovementDirection( vector value ) {
{
movedir = value; movedir = value;
} }
void idEntity::SetTriggerMessage(string value) void idEntity::SetTriggerMessage( string value ) {
{
message = value; message = value;
} }
void idEntity::SetSoundStyle(float value) void idEntity::SetSoundStyle( float value ) {
{
sounds = value; sounds = value;
} }
void idEntity::SetNoiseValue1(string value) void idEntity::SetNoiseValue1( string value ) {
{
noise = value; noise = value;
} }
void idEntity::SetNoiseValue2(string value) void idEntity::SetNoiseValue2( string value ) {
{
noise1 = value; noise1 = value;
} }
void idEntity::SetNoiseValue3(string value) void idEntity::SetNoiseValue3( string value ) {
{
noise2 = value; noise2 = value;
} }
void idEntity::SetNoiseValue4(string value) void idEntity::SetNoiseValue4( string value ) {
{
noise3 = value; noise3 = value;
} }
/* get functions */ /* get functions */
float idEntity::GetModelindex(void) float idEntity::GetModelindex( void ) {
{
return modelindex; return modelindex;
} }
movetype_t idEntity::GetMovetype(void) movetype_t idEntity::GetMovetype( void ) {
{ return ( movetype_t ) movetype;
return (movetype_t)movetype;
} }
solid_t idEntity::GetSolid(void) solid_t idEntity::GetSolid( void ) {
{ return ( solid_t ) solid;
return (solid_t)solid;
} }
vector idEntity::GetOrigin(void) vector idEntity::GetOrigin( void ) {
{
return origin; return origin;
} }
vector idEntity::GetVelocity(void) vector idEntity::GetVelocity( void ) {
{
return velocity; return velocity;
} }
vector idEntity::GetAngles(void) vector idEntity::GetAngles( void ) {
{
return angles; return angles;
} }
vector idEntity::GetAngularVelocity(void) vector idEntity::GetAngularVelocity( void ) {
{
return avelocity; return avelocity;
} }
vector idEntity::GetPunchangle(void) vector idEntity::GetPunchangle( void ) {
{
return punchangle; return punchangle;
} }
string idEntity::GetModel(void) string idEntity::GetModel( void ) {
{
return model; return model;
} }
float idEntity::GetFrame(void) float idEntity::GetFrame( void ) {
{
return frame; return frame;
} }
float idEntity::GetSkin(void) float idEntity::GetSkin( void ) {
{
return skin; return skin;
} }
bool idEntity::HasEffect(effects_t value) bool idEntity::HasEffect( effects_t value ) {
{ return ( effects & value ) ? 1 : 0;
return (effects & value) ? 1 : 0;
} }
vector idEntity::GetSize(void) vector idEntity::GetSize( void ) {
{
return size; return size;
} }
float idEntity::GetHealth(void) float idEntity::GetHealth( void ) {
{
return health; return health;
} }
float idEntity::GetFrags(void) float idEntity::GetFrags( void ) {
{
return frags; return frags;
} }
float idEntity::GetWeapon(void) float idEntity::GetWeapon( void ) {
{
return weapon; return weapon;
} }
string idEntity::GetWeaponmodel(void) string idEntity::GetWeaponmodel( void ) {
{
return weaponmodel; return weaponmodel;
} }
float idEntity::GetWeaponframe(void) float idEntity::GetWeaponframe( void ) {
{
return weaponframe; return weaponframe;
} }
float idEntity::GetCurrentAmmo(void) float idEntity::GetCurrentAmmo( void ) {
{
return currentammo; return currentammo;
} }
float idEntity::GetAmmoType1(void) float idEntity::GetAmmoType1( void ) {
{
return ammo_shells; return ammo_shells;
} }
float idEntity::GetAmmoType2(void) float idEntity::GetAmmoType2( void ) {
{
return ammo_nails; return ammo_nails;
} }
float idEntity::GetAmmoType3(void) float idEntity::GetAmmoType3( void ) {
{
return ammo_rockets; return ammo_rockets;
} }
float idEntity::GetAmmoType4(void) float idEntity::GetAmmoType4( void ) {
{
return ammo_cells; return ammo_cells;
} }
float idEntity::CanTakeDamage(void) float idEntity::CanTakeDamage( void ) {
{ return ( takedamage != DAMAGE_NO ) ? TRUE : FALSE;
return (takedamage != DAMAGE_NO) ? TRUE : FALSE;
} }
vector idEntity::GetViewOffset(void) vector idEntity::GetViewOffset( void ) {
{
return view_ofs; return view_ofs;
} }
bool idEntity::HasFlag(flags_t value) bool idEntity::HasFlag( flags_t value ) {
{ return ( flags & value ) ? 1 : 0;
return (flags & value) ? 1 : 0;
} }
float idEntity::GetColormap(void) float idEntity::GetColormap( void ) {
{
return colormap; return colormap;
} }
string idEntity::GetDisplayname(void) string idEntity::GetDisplayname( void ) {
{
return netname; return netname;
} }
float idEntity::GetMaxHealth(void) float idEntity::GetMaxHealth( void ) {
{
return max_health; return max_health;
} }
float idEntity::GetArmorType(void) float idEntity::GetArmorType( void ) {
{
return armortype; return armortype;
} }
float idEntity::GetArmor(void) float idEntity::GetArmor( void ) {
{
return armorvalue; return armorvalue;
} }
entity idEntity::GetAimEntity(void) entity idEntity::GetAimEntity( void ) {
{
return aiment; return aiment;
} }
entity idEntity::GetGoalEntity(void) entity idEntity::GetGoalEntity( void ) {
{
return goalentity; return goalentity;
} }
string idEntity::GetTarget(void) string idEntity::GetTarget( void ) {
{
return target; return target;
} }
string idEntity::GetTargetname(void) string idEntity::GetTargetname( void ) {
{
return targetname; return targetname;
} }
entity idEntity::GetOwner(void) entity idEntity::GetOwner( void ) {
{
return owner; return owner;
} }
vector idEntity::GetMovementDirection(void) vector idEntity::GetMovementDirection( void ) {
{
return movedir; return movedir;
} }
string idEntity::GetTriggerMessage(void) string idEntity::GetTriggerMessage( void ) {
{
return message; return message;
} }
float idEntity::GetSoundStyle(void) float idEntity::GetSoundStyle( void ) {
{
return sounds; return sounds;
} }
string idEntity::GetNoiseValue1(void) string idEntity::GetNoiseValue1( void ) {
{
return noise; return noise;
} }
string idEntity::GetNoiseValue2(void) string idEntity::GetNoiseValue2( void ) {
{
return noise1; return noise1;
} }
string idEntity::GetNoiseValue3(void) string idEntity::GetNoiseValue3( void ) {
{
return noise2; return noise2;
} }
string idEntity::GetNoiseValue4(void) string idEntity::GetNoiseValue4( void ) {
{
return noise3; return noise3;
} }

View file

@ -1,152 +1,187 @@
#define bool float class idEntity {
void idEntity( void );
class idEntity
{
void idEntity(void);
/* core engine tracked fields */ /* core engine tracked fields */
/** Sets the model of the entity via a model id. */ /** Sets the model of the entity via a model id. */
nonvirtual void SetModelindex(float); nonvirtual void SetModelindex( float );
/** Sets the movetype of the entity. See movetype_t for avalable options. */ /** Sets the movetype of the entity. See movetype_t for avalable options. */
nonvirtual void SetMovetype(movetype_t); nonvirtual void SetMovetype( movetype_t );
/** Sets the solid property of the entity. See solid_t for available options. */ /** Sets the solid property of the entity. See solid_t for available options. */
nonvirtual void SetSolid(solid_t); nonvirtual void SetSolid( solid_t );
/** Sets the absolute position of the entity within the world. */ /** Sets the absolute position of the entity within the world. */
nonvirtual void SetOrigin(vector); nonvirtual void SetOrigin( vector );
/** Sets the velocity of the entity within the world at units-per-second. */ /** Sets the velocity of the entity within the world at units-per-second. */
nonvirtual void SetVelocity(vector); nonvirtual void SetVelocity( vector );
/** Sets the angles the direction is facing via euler angles. */ /** Sets the angles the direction is facing via euler angles. */
nonvirtual void SetAngles(vector); nonvirtual void SetAngles( vector );
/** Sets the angular velocity of the entity at units-per-second per axis. */ /** Sets the angular velocity of the entity at units-per-second per axis. */
nonvirtual void SetAngularVelocity(vector); nonvirtual void SetAngularVelocity( vector );
/** Sets the punchangle of the entity (players only) */ /** Sets the punchangle of the entity (players only) */
nonvirtual void SetPunchangle(vector); nonvirtual void SetPunchangle( vector );
/** Sets the model of the entity via a full path pointing to a model. */ /** Sets the model of the entity via a full path pointing to a model. */
nonvirtual void SetModel(string); nonvirtual void SetModel( string );
/** Sets the framegroup of the entity. */ /** Sets the framegroup of the entity. */
nonvirtual void SetFrame(float); nonvirtual void SetFrame( float );
/** Sets the model skin of the entity. */ /** Sets the model skin of the entity. */
nonvirtual void SetSkin(float); nonvirtual void SetSkin( float );
/** Applies an effect to the entity. See effects_t for available options. */ /** Applies an effect to the entity. See effects_t for available options. */
nonvirtual void AddEffect(effects_t); nonvirtual void AddEffect( effects_t );
/** Removes an effect from the entity. See effects_t for available options. */ /** Removes an effect from the entity. See effects_t for available options. */
nonvirtual void RemoveEffect(effects_t); nonvirtual void RemoveEffect( effects_t );
/** Clears all the effects that are tied to the entity. */ /** Clears all the effects that are tied to the entity. */
nonvirtual void ClearEffects(void); nonvirtual void ClearEffects( void );
/** Sets the size of the entity, relative to its pivot point/origin. */ /** Sets the size of the entity, relative to its pivot point/origin. */
nonvirtual void SetSize(vector, vector); nonvirtual void SetSize( vector, vector );
/** Schedules a think, first parameter is function to call, second parm is the seconds to wait. */ /** Schedules a think, first parameter is function to call, second parm is the seconds to wait. */
nonvirtual void ScheduleThink(void(), float); nonvirtual void ScheduleThink( void (), float );
/** Sets the health of the entity. Will clamp to its maximum health. */ /** Sets the health of the entity. Will clamp to its maximum health. */
nonvirtual void SetHealth(float); nonvirtual void SetHealth( float );
/** Adds a frag to the entity its info. */ /** Adds a frag to the entity its info. */
nonvirtual void AddFrags(float); nonvirtual void AddFrags( float );
/** Removes a frag from the entity its info. */ /** Removes a frag from the entity its info. */
nonvirtual void RemoveFrags(float); nonvirtual void RemoveFrags( float );
/** Removes all frags. Should be called when they enter the game anew. */ /** Removes all frags. Should be called when they enter the game anew. */
nonvirtual void ClearFrags(void); nonvirtual void ClearFrags( void );
/** Sets the active weapon of the entity. */ /** Sets the active weapon of the entity. */
nonvirtual void SetWeapon(float); nonvirtual void SetWeapon( float );
/** Sets the active weapon model of the entity. */ /** Sets the active weapon model of the entity. */
nonvirtual void SetWeaponmodel(string); nonvirtual void SetWeaponmodel( string );
/** Sets the active weapon model frame group of the entity. */ /** Sets the active weapon model frame group of the entity. */
nonvirtual void SetWeaponframe(float); nonvirtual void SetWeaponframe( float );
/** Sets what the currently selected ammo on the heads up display. */ /** Sets what the currently selected ammo on the heads up display. */
nonvirtual void SetCurrentAmmo(float); nonvirtual void SetCurrentAmmo( float );
/** Sets the value for ammo type 1. */ /** Sets the value for ammo type 1. */
nonvirtual void SetAmmoType1(float); nonvirtual void SetAmmoType1( float );
/** Sets the value for ammo type 2. */ /** Sets the value for ammo type 2. */
nonvirtual void SetAmmoType2(float); nonvirtual void SetAmmoType2( float );
/** Sets the value for ammo type 3. */ /** Sets the value for ammo type 3. */
nonvirtual void SetAmmoType3(float); nonvirtual void SetAmmoType3( float );
/** Sets the value for ammo type 4. */ /** Sets the value for ammo type 4. */
nonvirtual void SetAmmoType4(float); nonvirtual void SetAmmoType4( float );
/** TODO: This needs to be changed. */ /** TODO: This needs to be changed. */
nonvirtual void SetTakedamage(damage_t); nonvirtual void SetTakedamage( damage_t );
/** Sets the eye position of the entity. As an offset relative to its origin. */ /** Sets the eye position of the entity. As an offset relative to its origin. */
nonvirtual void SetViewOffset(vector); nonvirtual void SetViewOffset( vector );
/** When called, will force the client to update its camera angles on the client-side. */ /** When called, will force the client to update its camera angles on the client-side. */
nonvirtual void ForceUpdateClientAngle(void); nonvirtual void ForceUpdateClientAngle( void );
/** Adds a flag to the entity. See flags_t for available options. */ /** Adds a flag to the entity. See flags_t for available options. */
nonvirtual void AddFlags(flags_t); nonvirtual void AddFlags( flags_t );
/** Removes a flag from the entity. See flags_t for available options. */ /** Removes a flag from the entity. See flags_t for available options. */
nonvirtual void RemoveFlags(flags_t); nonvirtual void RemoveFlags( flags_t );
/** Removes all flags from the entity. */ /** Removes all flags from the entity. */
nonvirtual void ClearFlags(void); nonvirtual void ClearFlags( void );
/** Sets the colormap value to an entity, needed for palette swaps. */ /** Sets the colormap value to an entity, needed for palette swaps. */
nonvirtual void SetColormap(float); nonvirtual void SetColormap( float );
/** Sets the display name of an entity. This is used for obituaries for example. */ /** Sets the display name of an entity. This is used for obituaries for example. */
nonvirtual void SetDisplayname(string); nonvirtual void SetDisplayname( string );
/** Sets the maximum amount of health this entity can have. Default is 100. */ /** Sets the maximum amount of health this entity can have. Default is 100. */
nonvirtual void SetMaxHealth(float); nonvirtual void SetMaxHealth( float );
/** Sets the armor type of an entity. This affects the HUD as well. */ /** Sets the armor type of an entity. This affects the HUD as well. */
nonvirtual void SetArmorType(float); nonvirtual void SetArmorType( float );
/** This sets the armor value of an entity. */ /** This sets the armor value of an entity. */
nonvirtual void SetArmor(float); nonvirtual void SetArmor( float );
/** Sets the aim entity of this entity. AI uses this. */ /** Sets the aim entity of this entity. AI uses this. */
nonvirtual void SetAimEntity(entity); nonvirtual void SetAimEntity( entity );
/** Sets the goal entity of this entity. AI uses this. */ /** Sets the goal entity of this entity. AI uses this. */
nonvirtual void SetGoalEntity(entity); nonvirtual void SetGoalEntity( entity );
/** Sets the target of this entity. It's referenced whenever we're being triggered. */ /** Sets the target of this entity. It's referenced whenever we're being triggered. */
nonvirtual void SetTarget(string); nonvirtual void SetTarget( string );
/** Sets the targetname of this entity. It's referenced when somebody targets us. */ /** Sets the targetname of this entity. It's referenced when somebody targets us. */
nonvirtual void SetTargetname(string); nonvirtual void SetTargetname( string );
/** Sets the owner of this entity. Entities don't collide with their owner. */ /** Sets the owner of this entity. Entities don't collide with their owner. */
nonvirtual void SetOwner(entity); nonvirtual void SetOwner( entity );
/** Sets the movement direction of this entity. This only affects movables. */ /** Sets the movement direction of this entity. This only affects movables. */
nonvirtual void SetMovementDirection(vector); nonvirtual void SetMovementDirection( vector );
/** Sets the message to be display when this entity gets triggered. */ /** Sets the message to be display when this entity gets triggered. */
nonvirtual void SetTriggerMessage(string); nonvirtual void SetTriggerMessage( string );
/** Sets the sound style of this entity. These can be variable and mean anything. */ /** Sets the sound style of this entity. These can be variable and mean anything. */
nonvirtual void SetSoundStyle(float); nonvirtual void SetSoundStyle( float );
nonvirtual void SetNoiseValue1(string); nonvirtual void SetNoiseValue1( string );
nonvirtual void SetNoiseValue2(string); nonvirtual void SetNoiseValue2( string );
nonvirtual void SetNoiseValue3(string); nonvirtual void SetNoiseValue3( string );
nonvirtual void SetNoiseValue4(string); nonvirtual void SetNoiseValue4( string );
nonvirtual float GetModelindex(void); /** Returns the model id of the entity. */
nonvirtual movetype_t GetMovetype(void); nonvirtual float GetModelindex( void );
nonvirtual solid_t GetSolid(void); /** Returns the movetype of the entity. */
nonvirtual vector GetOrigin(void); nonvirtual movetype_t GetMovetype( void );
nonvirtual vector GetVelocity(void); /** Returns the solidity of the entity. */
nonvirtual vector GetAngles(void); nonvirtual solid_t GetSolid( void );
nonvirtual vector GetAngularVelocity(void); /** Returns the world position of the entity. */
nonvirtual vector GetPunchangle(void); nonvirtual vector GetOrigin( void );
nonvirtual string GetModel(void); /** Returns the velocity of the entity. */
nonvirtual float GetFrame(void); nonvirtual vector GetVelocity( void );
nonvirtual float GetSkin(void); /** Returns the direction of the entity in euler-angles. */
nonvirtual bool HasEffect(effects_t); nonvirtual vector GetAngles( void );
nonvirtual vector GetSize(void); /** Returns the angular velocity in units-per-second per axis. */
nonvirtual float GetHealth(void); nonvirtual vector GetAngularVelocity( void );
nonvirtual float GetFrags(void); /** Returns the current punchangle of the entity. */
nonvirtual float GetWeapon(void); nonvirtual vector GetPunchangle( void );
nonvirtual string GetWeaponmodel(void); /** Returns the entity its model path. */
nonvirtual float GetWeaponframe(void); nonvirtual string GetModel( void );
nonvirtual float GetCurrentAmmo(void); /** Returns the framegroup of the current entity its model. */
nonvirtual float GetAmmoType1(void); nonvirtual float GetFrame( void );
nonvirtual float GetAmmoType2(void); /** Returns the model skin of the entity. */
nonvirtual float GetAmmoType3(void); nonvirtual float GetSkin( void );
nonvirtual float GetAmmoType4(void); /** Returns either TRUE or FALSE if the entity has a given effect. */
nonvirtual float CanTakeDamage(void); nonvirtual bool HasEffect( effects_t );
nonvirtual vector GetViewOffset(void); /** Returns the size of the entity relative to its origin. */
nonvirtual bool HasFlag(flags_t); nonvirtual vector GetSize( void );
nonvirtual float GetColormap(void); /** Returns the current health of the entity. */
nonvirtual string GetDisplayname(void); nonvirtual float GetHealth( void );
nonvirtual float GetMaxHealth(void); /** Returns the number of frags this entity has had. */
nonvirtual float GetArmorType(void); nonvirtual float GetFrags( void );
nonvirtual float GetArmor(void); /** Returns the active weapon of the entity. */
nonvirtual entity GetAimEntity(void); nonvirtual float GetWeapon( void );
nonvirtual entity GetGoalEntity(void); /** Returns the weapon model of the entity. */
nonvirtual string GetTarget(void); nonvirtual string GetWeaponmodel( void );
nonvirtual string GetTargetname(void); /** Returns the weapon model frame group of the entity. */
nonvirtual entity GetOwner(void); nonvirtual float GetWeaponframe( void );
nonvirtual vector GetMovementDirection(void); /** Returns the currently held ammo of the entity. */
nonvirtual string GetTriggerMessage(void); nonvirtual float GetCurrentAmmo( void );
nonvirtual float GetSoundStyle(void); /** Returns the amount of ammo type 1. */
nonvirtual string GetNoiseValue1(void); nonvirtual float GetAmmoType1( void );
nonvirtual string GetNoiseValue2(void); /** Returns the amount of ammo type 2. */
nonvirtual string GetNoiseValue3(void); nonvirtual float GetAmmoType2( void );
nonvirtual string GetNoiseValue4(void); /** Returns the amount of ammo type 3. */
nonvirtual float GetAmmoType3( void );
/** Returns the amount of ammo type 4. */
nonvirtual float GetAmmoType4( void );
/** Returns whether or not this entity can take damage. */
nonvirtual float CanTakeDamage( void );
/** Returns the eye position of the entity relative to its origin. */
nonvirtual vector GetViewOffset( void );
/** Returns either TRUE or FALSE if the entity has a given flag. */
nonvirtual bool HasFlag( flags_t );
/** Returns the colormap id of the entity. */
nonvirtual float GetColormap( void );
/** Returns the display name of the entity. Used in obituaries etc. */
nonvirtual string GetDisplayname( void );
/** Returns the maximum amount of health this entity can have. */
nonvirtual float GetMaxHealth( void );
/** Returns the armor type of the entity. */
nonvirtual float GetArmorType( void );
/** Returns the armor value of the entity. */
nonvirtual float GetArmor( void );
/** Returns the aim entity of the entity. */
nonvirtual entity GetAimEntity( void );
/** Returns the goal entity of the entity. */
nonvirtual entity GetGoalEntity( void );
/** Returns the target of the entity. */
nonvirtual string GetTarget( void );
/** Returns the target name of the entity. */
nonvirtual string GetTargetname( void );
/** Returns the owner of the entity. */
nonvirtual entity GetOwner( void );
/** Returns the movement direction of the entity. */
nonvirtual vector GetMovementDirection( void );
/** Returns the message the entity will display when triggered. */
nonvirtual string GetTriggerMessage( void );
/** Returns the sound style of the entity. */
nonvirtual float GetSoundStyle( void );
nonvirtual string GetNoiseValue1( void );
nonvirtual string GetNoiseValue2( void );
nonvirtual string GetNoiseValue3( void );
nonvirtual string GetNoiseValue4( void );
}; };

View file

@ -1,11 +1,23 @@
void idPlayer::idPlayer(void) void idPlayer::idPlayer( void ) {
{
} }
void idPlayer::PreThink(void) void idPlayer::PreThink( void ) {
{
} }
void idPlayer::PostThink(void) void idPlayer::PostThink( void ) {
{ }
void idPlayer::ResetPlayer( void ) {
ClearFlags();
ClearEffects();
ClearFrags();
SetModel( "progs/player.mdl" );
SetMovetype( MOVETYPE_WALK );
SetSolid( SOLID_SLIDEBOX );
SetViewOffset( [0, 0, 24] );
AddFlags( FL_CLIENT );
SetSize( VEC_HULL_MIN, VEC_HULL_MAX );
SetHealth( 100 );
SetArmorType( 0 );
SetArmor( 0 );
} }

View file

@ -1,7 +1,8 @@
class idPlayer:idEntity class idPlayer:idEntity {
{ void idPlayer( void );
void idPlayer(void);
nonvirtual void PreThink(void); nonvirtual void PreThink( void );
nonvirtual void PostThink(void); nonvirtual void PostThink( void );
nonvirtual void ResetPlayer( void );
}; };

View file

@ -1,18 +1,25 @@
void idRules:: idRules(void) void idRules::idRules( void ) {
{
} }
void idRules::PlayerConnects(idPlayer pl) void idRules::PlayerConnects( idPlayer pl ) {
{ g_idEngine.BPrint( "Player connected.\n" );
bprint("Player connected.\n");
} }
void idRules::PlayerDisconnects(idPlayer pl) void idRules::PlayerDisconnects( idPlayer pl ) {
{ g_idEngine.BPrint( "Player disconnected.\n" );
bprint("Player disconnected.\n");
} }
void idRules::PlayerFinishesJoining(idPlayer pl) void idRules::PlayerFinishesJoining( idPlayer player ) {
{ g_idEngine.BPrint( "Player joined the game fully.\n" );
bprint("Player joined the game fully.\n");
/* reset them fully */
player.ResetPlayer();
/* place them to the nearest spawn point */
{
idPlayerStart spawn = world;
spawn.MovePlayerToStart( player );
}
} }

View file

@ -1,10 +1,9 @@
class idRules class idRules {
{ void idRules( void );
void idRules(void);
nonvirtual void PlayerConnects(idPlayer); nonvirtual void PlayerConnects( idPlayer );
nonvirtual void PlayerDisconnects(idPlayer); nonvirtual void PlayerDisconnects( idPlayer );
nonvirtual void PlayerFinishesJoining(idPlayer); nonvirtual void PlayerFinishesJoining( idPlayer );
}; };
idRules g_gameRules; idRules g_gameRules;

View file

@ -1,4 +1,5 @@
#includelist #includelist
idEngine.qc
idEntity.qc idEntity.qc
idPlayer.qc idPlayer.qc
idRules.qc idRules.qc