Spring cleaning part one.
This commit is contained in:
parent
a039a69dd3
commit
25c54af62c
89 changed files with 573 additions and 2078 deletions
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
void
|
||||
Player_PreDraw(base_player pl, int thirdperson)
|
||||
Player_PreDraw(NSClientPlayer pl, int thirdperson)
|
||||
{
|
||||
/* Handle the flashlights... */
|
||||
if (pl.gflags & GF_FLASHLIGHT) {
|
||||
|
|
|
@ -16,21 +16,21 @@
|
|||
|
||||
class GameRules:CGameRules
|
||||
{
|
||||
virtual void(base_player) PlayerConnect;
|
||||
virtual void(base_player) PlayerDisconnect;
|
||||
virtual void(base_player) PlayerKill;
|
||||
virtual void(base_player) PlayerPostFrame;
|
||||
virtual void(NSClientPlayer) PlayerConnect;
|
||||
virtual void(NSClientPlayer) PlayerDisconnect;
|
||||
virtual void(NSClientPlayer) PlayerKill;
|
||||
virtual void(NSClientPlayer) PlayerPostFrame;
|
||||
|
||||
virtual void(base_player) LevelDecodeParms;
|
||||
virtual void(base_player) LevelChangeParms;
|
||||
virtual void(NSClientPlayer) LevelDecodeParms;
|
||||
virtual void(NSClientPlayer) LevelChangeParms;
|
||||
virtual void(void) LevelNewParms;
|
||||
};
|
||||
|
||||
class SingleplayerRules:GameRules
|
||||
{
|
||||
/* client */
|
||||
virtual void(base_player) PlayerSpawn;
|
||||
virtual void(base_player) PlayerDeath;
|
||||
virtual void(NSClientPlayer) PlayerSpawn;
|
||||
virtual void(NSClientPlayer) PlayerDeath;
|
||||
};
|
||||
|
||||
class MultiplayerRules:GameRules
|
||||
|
@ -41,7 +41,7 @@ class MultiplayerRules:GameRules
|
|||
virtual void(void) FrameStart;
|
||||
|
||||
/* client */
|
||||
virtual void(base_player) PlayerSpawn;
|
||||
virtual void(base_player) PlayerDeath;
|
||||
virtual float(base_player, string) ConsoleCommand;
|
||||
virtual void(NSClientPlayer) PlayerSpawn;
|
||||
virtual void(NSClientPlayer) PlayerDeath;
|
||||
virtual float(NSClientPlayer, string) ConsoleCommand;
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
var int autocvar_sv_playerkeepalive = TRUE;
|
||||
|
||||
void
|
||||
GameRules::LevelDecodeParms(base_player pp)
|
||||
GameRules::LevelDecodeParms(NSClientPlayer pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
g_landmarkpos[0] = parm1;
|
||||
|
@ -41,7 +41,7 @@ GameRules::LevelDecodeParms(base_player pp)
|
|||
}
|
||||
|
||||
void
|
||||
GameRules::LevelChangeParms(base_player pp)
|
||||
GameRules::LevelChangeParms(NSClientPlayer pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
parm1 = g_landmarkpos[0];
|
||||
|
@ -72,19 +72,19 @@ GameRules::LevelNewParms(void)
|
|||
/* we check what fields have changed over the course of the frame and network
|
||||
* only the ones that have actually changed */
|
||||
void
|
||||
GameRules::PlayerPostFrame(base_player pl)
|
||||
GameRules::PlayerPostFrame(NSClientPlayer pl)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
GameRules::PlayerConnect(base_player pl)
|
||||
GameRules::PlayerConnect(NSClientPlayer pl)
|
||||
{
|
||||
if (Plugin_PlayerConnect(pl) == FALSE)
|
||||
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
||||
}
|
||||
|
||||
void
|
||||
GameRules::PlayerDisconnect(base_player pl)
|
||||
GameRules::PlayerDisconnect(NSClientPlayer pl)
|
||||
{
|
||||
if (Plugin_PlayerDisconnect(pl) == FALSE)
|
||||
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
||||
|
@ -99,7 +99,7 @@ GameRules::PlayerDisconnect(base_player pl)
|
|||
}
|
||||
|
||||
void
|
||||
GameRules::PlayerKill(base_player pl)
|
||||
GameRules::PlayerKill(NSClientPlayer pl)
|
||||
{
|
||||
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ MultiplayerRules::FrameStart(void)
|
|||
}
|
||||
|
||||
void
|
||||
MultiplayerRules::PlayerDeath(base_player pl)
|
||||
MultiplayerRules::PlayerDeath(NSClientPlayer pl)
|
||||
{
|
||||
Plugin_PlayerObituary(g_dmg_eAttacker, g_dmg_eTarget, g_dmg_iWeapon, g_dmg_iHitBody, g_dmg_iDamage);
|
||||
|
||||
|
@ -61,7 +61,7 @@ MultiplayerRules::PlayerDeath(base_player pl)
|
|||
}
|
||||
|
||||
void
|
||||
MultiplayerRules::PlayerSpawn(base_player pp)
|
||||
MultiplayerRules::PlayerSpawn(NSClientPlayer pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
/* this is where the mods want to deviate */
|
||||
|
@ -99,7 +99,7 @@ MultiplayerRules::PlayerSpawn(base_player pp)
|
|||
}
|
||||
|
||||
float
|
||||
MultiplayerRules::ConsoleCommand(base_player pp, string cmd)
|
||||
MultiplayerRules::ConsoleCommand(NSClientPlayer pp, string cmd)
|
||||
{
|
||||
tokenize(cmd);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
void
|
||||
SingleplayerRules::PlayerDeath(base_player pl)
|
||||
SingleplayerRules::PlayerDeath(NSClientPlayer pl)
|
||||
{
|
||||
pl.movetype = MOVETYPE_NONE;
|
||||
pl.solid = SOLID_NOT;
|
||||
|
@ -31,7 +31,7 @@ SingleplayerRules::PlayerDeath(base_player pl)
|
|||
}
|
||||
|
||||
void
|
||||
SingleplayerRules::PlayerSpawn(base_player pl)
|
||||
SingleplayerRules::PlayerSpawn(NSClientPlayer pl)
|
||||
{
|
||||
pl.classname = "player";
|
||||
pl.health = pl.max_health = 100;
|
||||
|
|
|
@ -29,7 +29,7 @@ item_pickup::Touch(entity eToucher)
|
|||
}
|
||||
|
||||
/* don't remove if AddItem fails */
|
||||
if (Weapons_AddItem((base_player)eToucher, id, m_iClip) == FALSE) {
|
||||
if (Weapons_AddItem((NSClientPlayer)eToucher, id, m_iClip) == FALSE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ enumflags
|
|||
PLAYER_UNUSED7
|
||||
};
|
||||
|
||||
class player:base_player
|
||||
class player:NSClientPlayer
|
||||
{
|
||||
PREDICTED_INT(mode_tempstate);
|
||||
|
||||
|
@ -68,7 +68,7 @@ player::ReceiveEntity
|
|||
void
|
||||
player::ReceiveEntity(float new, float fl)
|
||||
{
|
||||
base_player::ReceiveEntity(new, fl);
|
||||
NSClientPlayer::ReceiveEntity(new, fl);
|
||||
setorigin(this, origin);
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ so we can roll them back later.
|
|||
void
|
||||
player::PredictPreFrame(void)
|
||||
{
|
||||
base_player::PredictPreFrame();
|
||||
NSClientPlayer::PredictPreFrame();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -96,14 +96,14 @@ Where we roll back our values to the ones last sent/verified by the server.
|
|||
void
|
||||
player::PredictPostFrame(void)
|
||||
{
|
||||
base_player::PredictPostFrame();
|
||||
NSClientPlayer::PredictPostFrame();
|
||||
}
|
||||
|
||||
#else
|
||||
void
|
||||
player::EvaluateEntity(void)
|
||||
{
|
||||
base_player::EvaluateEntity();
|
||||
NSClientPlayer::EvaluateEntity();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -132,7 +132,7 @@ player::SendEntity(entity ePEnt, float fChanged)
|
|||
WriteFloat(MSG_ENTITY, fChanged);
|
||||
|
||||
/* the generic client attributes */
|
||||
base_player::SendEntity(ePEnt, fChanged);
|
||||
NSClientPlayer::SendEntity(ePEnt, fChanged);
|
||||
return (1);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -72,7 +72,7 @@ vector Weapons_GetCameraPos(player pl);
|
|||
void Weapons_ViewAnimation(player pl, int);
|
||||
void Weapons_ViewPunchAngle(player pl, vector);
|
||||
int Weapons_IsPresent(player, int);
|
||||
void Weapons_UpdateAmmo(base_player, int, int, int);
|
||||
void Weapons_UpdateAmmo(NSClientPlayer, int, int, int);
|
||||
int Weapons_GetAnimation(player pl);
|
||||
void Weapons_EnableModel(void);
|
||||
void Weapons_DisableModel(void);
|
||||
|
|
|
@ -436,7 +436,7 @@ Sets .a_ammoX fields and clamps them so they can be networked as a single byte.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
Weapons_UpdateAmmo(base_player pl, int a1, int a2, int a3)
|
||||
Weapons_UpdateAmmo(NSClientPlayer pl, int a1, int a2, int a3)
|
||||
{
|
||||
/* no change */
|
||||
if (a1 == -1)
|
||||
|
|
|
@ -207,8 +207,8 @@ bot::CheckRoute(void)
|
|||
|
||||
/* we're inside the radius */
|
||||
if (flDist <= flRadius) {
|
||||
dprint(sprintf("^2bot::^3CheckRoute^7: " \
|
||||
"%s reached node\n", this.targetname));
|
||||
NSLog("^2bot::^3CheckRoute^7: " \
|
||||
"%s reached node\n", this.targetname);
|
||||
m_iCurNode--;
|
||||
|
||||
/* if we're inside an actual node (not a virtual one */
|
||||
|
@ -314,8 +314,8 @@ bot::RunAI(void)
|
|||
if (!m_iNodes && autocvar_bot_aimless == 0) {
|
||||
CreateObjective();
|
||||
|
||||
dprint(sprintf("bot::RunAI: %s is calculating first bot route\n",
|
||||
this.netname));
|
||||
NSLog("bot::RunAI: %s is calculating first bot route",
|
||||
this.netname);
|
||||
|
||||
/* our route probably has not been processed yet */
|
||||
if (!m_iNodes) {
|
||||
|
|
|
@ -51,7 +51,7 @@ DetailTex_Parse(string maptex, string detailtex, float xscale, float yscale)
|
|||
xscale *= autocvar(r_detailtextures_xscale, 1.0, "X scale multiplier for detail tex");
|
||||
yscale *= autocvar(r_detailtextures_yscale, 1.0, "Y scale multiplier for detail tex");
|
||||
|
||||
dprint(sprintf("DETAIL: %s %s %f %f\n", maptex, detailtex, xscale, yscale));
|
||||
NSLog("DETAIL: %s %s %f %f", maptex, detailtex, xscale, yscale);
|
||||
|
||||
#if 1
|
||||
shaderforname(strcat(maptex, "_detail"), sprintf(g_detail_shader, detailtex, xscale, yscale));
|
||||
|
|
|
@ -318,8 +318,8 @@ EFX_UpdateListener(void)
|
|||
}
|
||||
g_flEFXTime += clframetime;
|
||||
#else
|
||||
dprint(sprintf("EFX_UpdateListener: Changed style to %s (%i)\n",
|
||||
g_efx_name[g_iEFX], g_iEFX));
|
||||
NSLog("EFX_UpdateListener: Changed style to %s (%i)",
|
||||
g_efx_name[g_iEFX], g_iEFX);
|
||||
|
||||
old_dsp = g_iEFX;
|
||||
setup_reverb(12, &g_efx[g_iEFX], sizeof(reverbinfo_t));
|
||||
|
|
|
@ -147,8 +147,8 @@ void
|
|||
CSQC_UpdateView(float w, float h, float focus)
|
||||
{
|
||||
player pl = __NULL__;
|
||||
base_client cl = __NULL__;
|
||||
spectator spec;
|
||||
NSClient cl = __NULL__;
|
||||
NSClientSpectator spec;
|
||||
int s;
|
||||
entity c;
|
||||
|
||||
|
@ -208,14 +208,14 @@ CSQC_UpdateView(float w, float h, float focus)
|
|||
|
||||
pSeat->m_ePlayer = self = findfloat(world, entnum, player_localentnum);
|
||||
pl = (player)self;
|
||||
cl = (base_client)self;
|
||||
cl = (NSClient)self;
|
||||
|
||||
/* player slot not present */
|
||||
if (!self) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* this needs to be moved into a base_client method */
|
||||
/* this needs to be moved into a NSClient method */
|
||||
#if 1
|
||||
cl.PreFrame();
|
||||
|
||||
|
@ -259,7 +259,7 @@ CSQC_UpdateView(float w, float h, float focus)
|
|||
|
||||
pl.viewzoom = oldzoom;
|
||||
} else if (Client_IsSpectator(pl)) {
|
||||
spec = (spectator)self;
|
||||
spec = (NSClientSpectator)self;
|
||||
|
||||
if (spec.spec_mode == SPECMODE_FIRSTPERSON || spec.spec_mode == SPECMODE_THIRDPERSON) {
|
||||
c = findfloat(world, ::entnum, spec.spec_ent);
|
||||
|
@ -277,7 +277,7 @@ CSQC_UpdateView(float w, float h, float focus)
|
|||
#endif
|
||||
addentities(MASK_ENGINE);
|
||||
|
||||
/* ideally move this into a base_player method */
|
||||
/* ideally move this into a NSClientPlayer method */
|
||||
#if 1
|
||||
if (pSeat->m_flCameraTime > time || pSeat->m_flCameraTime == -1) {
|
||||
view_angles = pSeat->m_vecCameraAngle;
|
||||
|
@ -307,7 +307,7 @@ CSQC_UpdateView(float w, float h, float focus)
|
|||
Shake_Update(pl);
|
||||
setproperty(VF_ANGLES, view_angles + pl.punchangle);
|
||||
} else if (Client_IsSpectator(pl)) {
|
||||
spec = (spectator)self;
|
||||
spec = (NSClientSpectator)self;
|
||||
switch (spec.spec_mode) {
|
||||
case SPECMODE_THIRDPERSON:
|
||||
makevectors(view_angles);
|
||||
|
@ -364,7 +364,7 @@ CSQC_UpdateView(float w, float h, float focus)
|
|||
View_DrawViewModel();
|
||||
} else {
|
||||
if (Client_IsSpectator(pl)) {
|
||||
spec = (spectator)self;
|
||||
spec = (NSClientSpectator)self;
|
||||
|
||||
/* 0 means world */
|
||||
if (spec.spec_ent) {
|
||||
|
@ -437,7 +437,7 @@ CSQC_UpdateView(float w, float h, float focus)
|
|||
}
|
||||
}
|
||||
|
||||
/* move this into base_client methods */
|
||||
/* move this into NSClient methods */
|
||||
#if 1
|
||||
cl.PostFrame();
|
||||
#endif
|
||||
|
@ -527,7 +527,7 @@ CSQC_Input_Frame(void)
|
|||
me = pSeat->m_ePlayer;
|
||||
|
||||
if (me.classname == "player" || me.classname == "spectator") {
|
||||
base_client pl = (base_client)me;
|
||||
NSClient pl = (NSClient)me;
|
||||
pl.ClientInputFrame();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,13 +48,13 @@ player::predraw(void)
|
|||
|
||||
/* make sure we're enabling shadow rendering on us */
|
||||
effects &= ~EF_NOSHADOW;
|
||||
base_client cl = (base_client)pSeat->m_ePlayer;
|
||||
NSClient cl = (NSClient)pSeat->m_ePlayer;
|
||||
|
||||
RenderFire();
|
||||
|
||||
/* it's either us or us spectating */
|
||||
if (Client_IsSpectator(cl)) {
|
||||
spectator spec = (spectator)pSeat->m_ePlayer;
|
||||
NSClientSpectator spec = (NSClientSpectator)pSeat->m_ePlayer;
|
||||
if (entnum == spec.spec_ent && spec.spec_mode == SPECMODE_FIRSTPERSON) {
|
||||
this_us = 1;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ Propagate our pmove state to whatever the current frame before its stomped on
|
|||
=================
|
||||
*/
|
||||
void
|
||||
Predict_SpectatorPreFrame(spectator pl)
|
||||
Predict_SpectatorPreFrame(NSClientSpectator pl)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -116,6 +116,6 @@ Rewind our pmove state back to before we started predicting.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
Predict_SpectatorPostFrame(spectator pl)
|
||||
Predict_SpectatorPostFrame(NSClientSpectator pl)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/* Returns if the specified client is a spectator, doesn't matter if real or fake */
|
||||
float Client_IsSpectator(base_client);
|
||||
/* Returns if the specified client is a NSClientSpectator, doesn't matter if real or fake */
|
||||
float Client_IsSpectator(NSClient);
|
||||
|
||||
/* Returns if we're a permanent spectator, USE THIS if you want to access spectator class attributes */
|
||||
float Client_IsRealSpectator(base_client cl);
|
||||
/* Returns if we're a permanent NSClientSpectator, USE THIS if you want to access NSClientSpectator class attributes */
|
||||
float Client_IsRealSpectator(NSClient cl);
|
||||
|
||||
/* Returns if we're a fake spectator, in case you need to be certain */
|
||||
float Client_IsFakeSpectator(base_client cl);
|
||||
/* Returns if we're a fake NSClientSpectator, in case you need to be certain */
|
||||
float Client_IsFakeSpectator(NSClient cl);
|
||||
|
||||
/* Return if the specified client is dead. If they're a spectator they're always alive. */
|
||||
float Client_IsDead(base_client);
|
||||
/* Return if the specified client is dead. If they're a NSClientSpectator they're always alive. */
|
||||
float Client_IsDead(NSClient);
|
||||
|
||||
/* Returns if the specified client is a playable client class */
|
||||
float Client_IsPlayer(base_client cl);
|
||||
float Client_IsPlayer(NSClient cl);
|
||||
|
||||
/* Are we in an intermission? (Match ending screen) */
|
||||
float Client_InIntermission(void);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
float
|
||||
Client_IsSpectator(base_client cl)
|
||||
Client_IsSpectator(NSClient cl)
|
||||
{
|
||||
if (cl.IsRealSpectator() || cl.IsFakeSpectator())
|
||||
return true;
|
||||
|
@ -9,25 +9,25 @@ Client_IsSpectator(base_client cl)
|
|||
}
|
||||
|
||||
float
|
||||
Client_IsRealSpectator(base_client cl)
|
||||
Client_IsRealSpectator(NSClient cl)
|
||||
{
|
||||
return cl.IsRealSpectator();
|
||||
}
|
||||
|
||||
float
|
||||
Client_IsFakeSpectator(base_client cl)
|
||||
Client_IsFakeSpectator(NSClient cl)
|
||||
{
|
||||
return cl.IsFakeSpectator();
|
||||
}
|
||||
|
||||
float
|
||||
Client_IsDead(base_client cl)
|
||||
Client_IsDead(NSClient cl)
|
||||
{
|
||||
return cl.IsDead();
|
||||
}
|
||||
|
||||
float
|
||||
Client_IsPlayer(base_client cl)
|
||||
Client_IsPlayer(NSClient cl)
|
||||
{
|
||||
return cl.IsPlayer();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,11 +130,11 @@ View_DrawViewModel(void)
|
|||
entity m_eMuzzleflashL = pSeat->m_eMuzzleflashL;
|
||||
|
||||
player pl = __NULL__;
|
||||
base_client cl = (base_client)pSeat->m_ePlayer;
|
||||
NSClient cl = (NSClient)pSeat->m_ePlayer;
|
||||
|
||||
/* it's either us or us spectating */
|
||||
if (Client_IsSpectator(cl)) {
|
||||
spectator spec = (spectator)self;
|
||||
NSClientSpectator spec = (NSClientSpectator)self;
|
||||
pl = (player)findfloat(world, ::entnum, spec.spec_ent);
|
||||
|
||||
if (spec.spec_mode != SPECMODE_FIRSTPERSON)
|
||||
|
|
|
@ -50,6 +50,7 @@ server/func_rotating.qc
|
|||
server/func_rot_button.qc
|
||||
server/func_physbox.qc
|
||||
server/func_plat.qc
|
||||
server/func_platrot.qc
|
||||
server/func_pendulum.qc
|
||||
server/func_vehicle.qc
|
||||
server/func_vehiclecontrols.qc
|
||||
|
|
|
@ -91,22 +91,22 @@ env_render::Trigger(entity act, int state)
|
|||
(e = find(e, ::targetname, target));) {
|
||||
NSRenderableEntity trigger = (NSRenderableEntity)e;
|
||||
|
||||
dprint(sprintf("^2env_render::^3Trigger^7: with spawnflags %d\n", spawnflags));
|
||||
dprint(sprintf("\tTarget: %s\n", target));
|
||||
NSLog("^2env_render::^3Trigger^7: with spawnflags %d", spawnflags);
|
||||
NSLog("\tTarget: %s", target);
|
||||
if (!HasSpawnFlags(SF_NORENDERMODE)) {
|
||||
dprint(sprintf("\tMode change from %d to %d\n", trigger.m_iRenderMode, m_iRenderMode));
|
||||
NSLog("\tMode change from %d to %d", trigger.m_iRenderMode, m_iRenderMode);
|
||||
trigger.SetRenderMode(m_iRenderMode);
|
||||
}
|
||||
if (!HasSpawnFlags(SF_NORENDERCOLOR)) {
|
||||
dprint(sprintf("\tColor change from %v to %v\n", trigger.m_vecRenderColor, m_vecRenderColor));
|
||||
NSLog("\tColor change from %v to %v", trigger.m_vecRenderColor, m_vecRenderColor);
|
||||
trigger.SetRenderColor(m_vecRenderColor);
|
||||
}
|
||||
if (!HasSpawnFlags(SF_NORENDERAMT)) {
|
||||
dprint(sprintf("\tAmt change from %d to %d\n", trigger.m_flRenderAmt, m_flRenderAmt));
|
||||
NSLog("\tAmt change from %d to %d", trigger.m_flRenderAmt, m_flRenderAmt);
|
||||
trigger.SetRenderAmt(m_flRenderAmt);
|
||||
}
|
||||
if (!HasSpawnFlags(SF_NORENDERFX)) {
|
||||
dprint(sprintf("\tFX change from %d to %d\n", trigger.m_iRenderFX, m_iRenderFX));
|
||||
NSLog("\tFX change from %d to %d", trigger.m_iRenderFX, m_iRenderFX);
|
||||
trigger.SetRenderFX(m_iRenderFX);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -349,7 +349,7 @@ func_door_rotating::RotToDest(vector vDestAngle, void(void) func)
|
|||
float flTravelLength, flTravelTime;
|
||||
|
||||
if (!m_flSpeed) {
|
||||
dprint(sprintf("^1func_door_rotating::^3RotToDest^7: No speed defined for %s!", targetname));
|
||||
NSLog("^1func_door_rotating::^3RotToDest^7: No speed defined for %s!", targetname);
|
||||
func_door_rotating::Respawn();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ func_guntarget::Move(void)
|
|||
node = (path_corner)find(world, ::targetname, target);
|
||||
|
||||
if (!node) {
|
||||
dprint(sprintf("^1func_guntarget::^3Move^7: Path node for %s not found!\n", targetname));
|
||||
NSLog("^1func_guntarget::^3Move^7: Path node for %s not found!", targetname);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ func_guntarget::NextPath(void)
|
|||
{
|
||||
path_corner node;
|
||||
|
||||
dprint(sprintf("^2func_guntarget::^3NextPath^7: Talking to current target %s... ", target));
|
||||
NSLog("^2func_guntarget::^3NextPath^7: Talking to current target %s... ", target);
|
||||
node = (path_corner)find(world, ::targetname, target);
|
||||
|
||||
if (!node) {
|
||||
|
|
241
src/gs-entbase/server/func_platrot.qc
Normal file
241
src/gs-entbase/server/func_platrot.qc
Normal file
|
@ -0,0 +1,241 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*QUAKED func_platrot (0 .5 .8) ?
|
||||
A vertically moving platform that rotates.
|
||||
|
||||
-------- KEYS --------
|
||||
"targetname" : Name
|
||||
"noise1" : Sound when moving
|
||||
"noise2" : Sound when stopped
|
||||
"speed" : Speed of rotation in u/s
|
||||
"height" : Vertical travel distance
|
||||
"rotation" : Rotation amount, in degrees
|
||||
|
||||
-------- NOTES --------
|
||||
|
||||
-------- HISTORY --------
|
||||
This entity was introduced in Half-Life (1998).
|
||||
*/
|
||||
|
||||
enumflags
|
||||
{
|
||||
FNCPLAT_TRIGGER,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PLATSTATE_RAISED,
|
||||
PLATSTATE_LOWERED,
|
||||
PLATSTATE_UP,
|
||||
PLATSTATE_DOWN
|
||||
};
|
||||
|
||||
class func_platrot:NSRenderableEntity
|
||||
{
|
||||
int m_iState;
|
||||
float m_flSpeed;
|
||||
float m_flHeight;
|
||||
string m_strNoise1;
|
||||
string m_strNoise2;
|
||||
float m_flRotation;
|
||||
|
||||
void(void) func_platrot;
|
||||
|
||||
virtual void(float) Save;
|
||||
virtual void(string, string) Restore;
|
||||
virtual void(entity, int) Trigger;
|
||||
virtual void(void) ArrivedUp;
|
||||
virtual void(void) ArrivedDown;
|
||||
virtual void(vector, vector, void(void)) Move;
|
||||
virtual void(void) MoveToggle;
|
||||
virtual void(void) Respawn;
|
||||
virtual void(entity) Touch;
|
||||
virtual void(string, string) SpawnKey;
|
||||
};
|
||||
|
||||
void
|
||||
func_platrot::Save(float handle)
|
||||
{
|
||||
SaveInt(handle, "state", m_iState);
|
||||
SaveFloat(handle, "speed", m_flSpeed);
|
||||
SaveFloat(handle, "height", m_flHeight);
|
||||
SaveString(handle, "noise1", m_strNoise1);
|
||||
SaveString(handle, "noise2", m_strNoise2);
|
||||
SaveFloat(handle, "rotation", m_flRotation);
|
||||
super::Save(handle);
|
||||
}
|
||||
|
||||
void
|
||||
func_platrot::Restore(string strKey, string strValue)
|
||||
{
|
||||
switch (strKey) {
|
||||
case "state":
|
||||
m_iState = ReadInt(strValue);
|
||||
break;
|
||||
case "spped":
|
||||
m_flSpeed = ReadFloat(strValue);
|
||||
break;
|
||||
case "height":
|
||||
m_flHeight = ReadFloat(strValue);
|
||||
break;
|
||||
case "noise1":
|
||||
m_strNoise1 = ReadString(strValue);
|
||||
break;
|
||||
case "noise2":
|
||||
m_strNoise2 = ReadString(strValue);
|
||||
break;
|
||||
case "rotation":
|
||||
m_flRotation = ReadFloat(strValue);
|
||||
break;
|
||||
default:
|
||||
super::Restore(strKey, strValue);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
func_platrot::ArrivedUp(void)
|
||||
{
|
||||
avelocity = velocity = [0,0,0];
|
||||
m_iState = PLATSTATE_RAISED;
|
||||
|
||||
sound(this, CHAN_VOICE, "common/null.wav", 1.0f, ATTN_NORM);
|
||||
|
||||
if (m_strNoise2)
|
||||
sound(this, CHAN_WEAPON, m_strNoise2, 1.0f, ATTN_NORM);
|
||||
}
|
||||
|
||||
void
|
||||
func_platrot::ArrivedDown(void)
|
||||
{
|
||||
avelocity = velocity = [0,0,0];
|
||||
m_iState = PLATSTATE_LOWERED;
|
||||
|
||||
sound(this, CHAN_VOICE, "common/null.wav", 1.0f, ATTN_NORM);
|
||||
|
||||
if (m_strNoise2)
|
||||
sound(this, CHAN_WEAPON, m_strNoise2, 1.0f, ATTN_NORM);
|
||||
}
|
||||
|
||||
void
|
||||
func_platrot::Move(vector vecDest, vector vecADest, void() vFunc)
|
||||
{
|
||||
vector vecDifference, vecADifference;
|
||||
float flTravel, fTravelTime;
|
||||
|
||||
m_iState = PLATSTATE_DOWN;
|
||||
vecDifference = (vecDest - origin);
|
||||
vecADifference = vecADest - angles;
|
||||
flTravel = vlen(vecDifference);
|
||||
fTravelTime = (flTravel / m_flSpeed);
|
||||
think = vFunc;
|
||||
|
||||
if (fTravelTime < 0.1) {
|
||||
velocity = [0,0,0];
|
||||
nextthink = ltime + 0.1f;
|
||||
return;
|
||||
}
|
||||
|
||||
avelocity = (vecADifference * (1.0f / fTravelTime));
|
||||
velocity = (vecDifference * (1.0f / fTravelTime));
|
||||
nextthink = (ltime + fTravelTime);
|
||||
|
||||
if (m_strNoise1)
|
||||
sound(this, CHAN_VOICE, m_strNoise1, 1.0f, ATTN_NORM);
|
||||
}
|
||||
|
||||
void
|
||||
func_platrot::MoveToggle(void)
|
||||
{
|
||||
if (m_iState == PLATSTATE_RAISED) {
|
||||
Move(GetSpawnOrigin() - [0,0,m_flHeight], GetSpawnAngles() + [0, m_flRotation, 0], ArrivedDown);
|
||||
} else if (m_iState == PLATSTATE_LOWERED) {
|
||||
Move(GetSpawnOrigin(), GetSpawnAngles(), ArrivedUp);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
func_platrot::Trigger(entity act, int state)
|
||||
{
|
||||
if (HasSpawnFlags(FNCPLAT_TRIGGER))
|
||||
return;
|
||||
|
||||
switch (state) {
|
||||
case TRIG_OFF:
|
||||
Move(GetSpawnOrigin() - [0,0,m_flHeight], GetSpawnAngles() + [0, m_flRotation, 0], ArrivedDown);
|
||||
break;
|
||||
case TRIG_ON:
|
||||
Move(GetSpawnOrigin(), GetSpawnAngles(), ArrivedUp);
|
||||
break;
|
||||
default:
|
||||
MoveToggle();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
func_platrot::Touch(entity eToucher)
|
||||
{
|
||||
if (eToucher.movetype != MOVETYPE_WALK) {
|
||||
return;
|
||||
}
|
||||
|
||||
MoveToggle();
|
||||
}
|
||||
|
||||
void
|
||||
func_platrot::Respawn(void)
|
||||
{
|
||||
SetMovetype(MOVETYPE_PUSH);
|
||||
SetSolid(SOLID_BSP);
|
||||
SetModel(GetSpawnModel());
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
SetAngles(GetSpawnAngles());
|
||||
|
||||
m_iState = PLATSTATE_RAISED;
|
||||
think = __NULL__;
|
||||
nextthink = 0.0f;
|
||||
}
|
||||
|
||||
void
|
||||
func_platrot::SpawnKey(string strKey, string strValue)
|
||||
{
|
||||
switch (strKey) {
|
||||
case "height":
|
||||
m_flHeight = stof(strValue);
|
||||
break;
|
||||
case "speed":
|
||||
m_flSpeed = stof(strValue);
|
||||
break;
|
||||
case "noise1":
|
||||
m_strNoise1 = strValue;
|
||||
break;
|
||||
case "noise2":
|
||||
m_strNoise2 = strValue;
|
||||
break;
|
||||
case "rotation":
|
||||
m_flRotation = stof(strValue);
|
||||
break;
|
||||
default:
|
||||
super::SpawnKey(strKey, strValue);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
func_platrot::func_platrot(void)
|
||||
{
|
||||
m_flSpeed = 100.0f;
|
||||
super::NSRenderableEntity();
|
||||
}
|
|
@ -133,7 +133,7 @@ func_recharge::OnPlayerUse(void)
|
|||
return;
|
||||
}
|
||||
|
||||
base_player pl = (base_player)eActivator;
|
||||
NSClientPlayer pl = (NSClientPlayer)eActivator;
|
||||
if (pl.armor >= 100) {
|
||||
eActivator.flags &= ~FL_USE_RELEASED;
|
||||
sound(this, CHAN_VOICE, m_strSndDone, 1.0, ATTN_NORM);
|
||||
|
|
|
@ -213,7 +213,7 @@ void
|
|||
func_tank::customphysics(void)
|
||||
{
|
||||
if (m_eDriver && m_eDriver.health <= 0)
|
||||
PlayerLeave((base_player)m_eDriver);
|
||||
PlayerLeave((NSClientPlayer)m_eDriver);
|
||||
|
||||
if (m_eDriver) {
|
||||
vector endorg;
|
||||
|
@ -223,7 +223,7 @@ func_tank::customphysics(void)
|
|||
PlayerUpdateFlags();
|
||||
|
||||
if (vlen(m_eDriver.origin - origin) > 128)
|
||||
PlayerLeave((base_player)m_eDriver);
|
||||
PlayerLeave((NSClientPlayer)m_eDriver);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ func_tank::Respawn(void)
|
|||
SetAngles(GetSpawnAngles());
|
||||
|
||||
if (m_eDriver)
|
||||
PlayerLeave((base_player)m_eDriver);
|
||||
PlayerLeave((NSClientPlayer)m_eDriver);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -54,9 +54,9 @@ func_tankcontrols::OnPlayerUse(void)
|
|||
|
||||
if (tank) {
|
||||
if (!tank.m_eDriver)
|
||||
tank.PlayerEnter((base_player)eActivator);
|
||||
tank.PlayerEnter((NSClientPlayer)eActivator);
|
||||
else if (tank.m_eDriver == eActivator)
|
||||
tank.PlayerLeave((base_player)eActivator);
|
||||
tank.PlayerLeave((NSClientPlayer)eActivator);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -313,7 +313,7 @@ func_vehicle::customphysics(void)
|
|||
{
|
||||
/* eject the dead */
|
||||
if (m_eDriver && m_eDriver.health <= 0) {
|
||||
PlayerLeave((base_player)m_eDriver);
|
||||
PlayerLeave((NSClientPlayer)m_eDriver);
|
||||
}
|
||||
|
||||
if (m_eDriver) {
|
||||
|
@ -429,9 +429,9 @@ func_vehicle::OnPlayerUse(void)
|
|||
return;
|
||||
|
||||
if (m_eDriver == eActivator) {
|
||||
PlayerLeave((base_player)eActivator);
|
||||
PlayerLeave((NSClientPlayer)eActivator);
|
||||
} else if (!m_eDriver) {
|
||||
PlayerEnter((base_player)eActivator);
|
||||
PlayerEnter((NSClientPlayer)eActivator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -509,7 +509,7 @@ func_vehicle::Respawn(void)
|
|||
PlayerUse = OnPlayerUse;
|
||||
|
||||
if (m_eDriver)
|
||||
PlayerLeave((base_player)m_eDriver);
|
||||
PlayerLeave((NSClientPlayer)m_eDriver);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -100,8 +100,8 @@ game_player_equip::SpawnUnit(string cname, vector org)
|
|||
unit.nextthink = time;
|
||||
unit.real_owner = this;
|
||||
setorigin(unit, org);
|
||||
dprint(sprintf("^2game_player_equip::^3Trigger^7: Spawning %s\n",
|
||||
cname));
|
||||
NSLog("^2game_player_equip::^3Trigger^7: Spawning %s",
|
||||
cname);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -157,7 +157,7 @@ logic_auto::Processing(void)
|
|||
UseOutput(this, m_strOnBackgroundMap);
|
||||
|
||||
if (HasSpawnFlags(1)) {
|
||||
dprint(sprintf("^2logic_auto::^3think^7: %s triggerer removed self\n", target));
|
||||
NSLog("^2logic_auto::^3think^7: %s triggerer removed self", target);
|
||||
remove(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ monstermaker::Spawner(void)
|
|||
unit.think = monstermaker_spawnunit;
|
||||
unit.nextthink = time + 0.1f;
|
||||
unit.real_owner = this;
|
||||
dprint(sprintf("^2monstermaker::^3Trigger^7: Spawning %s\n", m_strMonster));
|
||||
NSLog("^2monstermaker::^3Trigger^7: Spawning %s", m_strMonster);
|
||||
setorigin(unit, origin);
|
||||
unit.angles = angles;
|
||||
m_iMonsterSpawned++;
|
||||
|
@ -194,7 +194,7 @@ monstermaker::Spawner(void)
|
|||
unit.spawnflags |= MSF_MONSTERCLIP;
|
||||
}
|
||||
} else {
|
||||
print(sprintf("^1monstermaker::^3Trigger^7: cannot call spawnfunction for %s\n", m_strMonster));
|
||||
NSLog("^1monstermaker::^3Trigger^7: cannot call spawnfunction for %s", m_strMonster);
|
||||
remove(this);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -195,8 +195,8 @@ multi_manager::Trigger(entity act, int state)
|
|||
|
||||
entity eFind = find(world, ::targetname, wow.target);
|
||||
|
||||
dprint(sprintf("^2%s::^3Trigger^7: %s (%s)\n",
|
||||
this.classname, wow.target, eFind.classname));
|
||||
NSLog("^2%s::^3Trigger^7: %s (%s)",
|
||||
this.classname, wow.target, eFind.classname);
|
||||
|
||||
m_iValue = TRUE;
|
||||
UseTargets(wow.m_eActivator, TRIG_TOGGLE, 0.0f);
|
||||
|
|
|
@ -111,12 +111,12 @@ void
|
|||
multisource::Trigger(entity act, int unused)
|
||||
{
|
||||
if (QueryTargets() == FALSE) {
|
||||
dprint(sprintf("[^1MULTISOURCE^7] %s is inactive.\n", targetname));
|
||||
NSLog("[^1MULTISOURCE^7] %s is inactive.", targetname);
|
||||
m_iValue = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
dprint(sprintf("[^1MULTISOURCE^7] %s is now active.\n", targetname));
|
||||
NSLog("[^1MULTISOURCE^7] %s is now active.", targetname);
|
||||
m_iValue = TRUE;
|
||||
UseTargets(act, TRIG_TOGGLE, m_flDelay);
|
||||
}
|
||||
|
|
|
@ -34,13 +34,13 @@ class player_weaponstrip:NSPointTrigger
|
|||
void
|
||||
player_weaponstrip::Trigger(entity act, int unused)
|
||||
{
|
||||
base_player pl;
|
||||
NSClientPlayer pl;
|
||||
|
||||
if (!(act.flags & FL_CLIENT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
pl = (base_player)act;
|
||||
pl = (NSClientPlayer)act;
|
||||
|
||||
for (int i = 1; i < Weapon_GetCount(); i++) {
|
||||
pl.g_items &= ~Weapon_GetBitID(i);
|
||||
|
|
|
@ -79,7 +79,7 @@ prop_door_rotating::Turn(vector vecDest, void(void) vFunc)
|
|||
float flTravelLength, flTravelTime;
|
||||
|
||||
if (!m_flSpeed) {
|
||||
dprint(sprintf("^1prop_door_rotating::^3RotToDest^7: No speed defined for %s!", targetname));
|
||||
NSLog("^1prop_door_rotating::^3RotToDest^7: No speed defined for %s!", targetname);
|
||||
prop_door_rotating::Respawn();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ scripted_sentence::Trigger(entity act, int unused)
|
|||
return;
|
||||
}
|
||||
|
||||
dprint(sprintf("^2scripted_sentence::^3Trigger^7: %s on %s\n", m_strSentence, m_strSpeaker));
|
||||
NSLog("^2scripted_sentence::^3Trigger^7: %s on %s", m_strSentence, m_strSpeaker);
|
||||
|
||||
NSTalkMonster npc = (NSTalkMonster)spe;
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
|
|
|
@ -170,9 +170,9 @@ scripted_sequence::RunOnEntity(entity targ)
|
|||
if (!HasSpawnFlags(SSFL_REPEATABLE))
|
||||
m_iEnabled = FALSE;
|
||||
|
||||
dprint(sprintf("\tName: %s\n", targetname));
|
||||
dprint(sprintf("\tTarget: %s\n", m_strMonster));
|
||||
dprint(sprintf("\tStarted: %f\n", time));
|
||||
NSLog("\tName: %s", targetname);
|
||||
NSLog("\tTarget: %s", m_strMonster);
|
||||
NSLog("\tStarted: %f", time);
|
||||
|
||||
/* if we're told an anim, we better have it... or else. */
|
||||
if (m_strActionAnim) {
|
||||
|
@ -185,7 +185,7 @@ scripted_sequence::RunOnEntity(entity targ)
|
|||
|
||||
/* entity to trigger after sequence ends */
|
||||
if (target) {
|
||||
dprint(sprintf("\tTrigger when finished: %s\n", target));
|
||||
NSLog("\tTrigger when finished: %s", target);
|
||||
f.m_strRouteEnded = target;
|
||||
f.m_ssLast = this;
|
||||
m_iValue = FALSE; /* will be marked as used once triggered */
|
||||
|
@ -228,20 +228,20 @@ scripted_sequence::RunOnEntity(entity targ)
|
|||
if (m_strActionAnim) {
|
||||
duration = frameduration(f.modelindex, f.m_flSequenceEnd);
|
||||
f.nextthink = time + duration;
|
||||
dprint(sprintf(
|
||||
NSLog(
|
||||
"\tAnimation: %s Duration: %f seconds (modelindex %d, frame %d)\n",
|
||||
m_strActionAnim,
|
||||
duration,
|
||||
f.modelindex,
|
||||
f.m_flSequenceEnd
|
||||
));
|
||||
);
|
||||
} else {
|
||||
f.nextthink = time;
|
||||
dprint(sprintf(
|
||||
NSLog(
|
||||
"\t^1WARNING: %s skipping animation on script type %i\n",
|
||||
f.targetname,
|
||||
m_iMove
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
f.m_iSequenceState = SEQUENCESTATE_ENDING;
|
||||
|
@ -251,7 +251,7 @@ scripted_sequence::RunOnEntity(entity targ)
|
|||
else
|
||||
f.think = NSMonster::FreeStateMoved;
|
||||
|
||||
dprint(sprintf("\tEnding: %f\n", f.nextthink));
|
||||
NSLog("\tEnding: %f", f.nextthink);
|
||||
|
||||
/* make sure we're forgetting about enemies and attack states in sequence */
|
||||
f.m_eEnemy = __NULL__;
|
||||
|
@ -264,7 +264,7 @@ scripted_sequence::Trigger(entity act, int unused)
|
|||
{
|
||||
NSMonster f;
|
||||
|
||||
dprint(sprintf("^2scripted_sequence::^3Trigger^7: with spawnflags %d\n", spawnflags));
|
||||
NSLog("^2scripted_sequence::^3Trigger^7: with spawnflags %d", spawnflags);
|
||||
f = (NSMonster)find(world, ::targetname, m_strMonster);
|
||||
|
||||
/* target doesn't exist/hasn't spawned */
|
||||
|
@ -291,7 +291,7 @@ scripted_sequence::InitIdle(void)
|
|||
{
|
||||
NSMonster f;
|
||||
|
||||
dprint(sprintf("^2scripted_sequence::^3InitIdle^7: with spawnflags %d\n", spawnflags));
|
||||
NSLog("^2scripted_sequence::^3InitIdle^7: with spawnflags %d", spawnflags);
|
||||
f = (NSMonster)find(world, ::targetname, m_strMonster);
|
||||
|
||||
/* target doesn't exist/hasn't spawned */
|
||||
|
@ -307,7 +307,7 @@ scripted_sequence::InitIdle(void)
|
|||
|
||||
/* cancel out. this trigger is broken. */
|
||||
if (!f) {
|
||||
dprint(sprintf("^1scripted_sequence::^3InitIdle^7: Unknown target %s\n", m_strMonster));
|
||||
NSLog("^1scripted_sequence::^3InitIdle^7: Unknown target %s", m_strMonster);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,8 +73,8 @@ target_cdaudio::Touch(entity eToucher)
|
|||
return;
|
||||
}
|
||||
|
||||
dprint(sprintf("^2target_cdaudio::^3Trigger^7: CD Track %i requested\n",
|
||||
m_iCDTrack));
|
||||
NSLog("^2target_cdaudio::^3Trigger^7: CD Track %i requested",
|
||||
m_iCDTrack);
|
||||
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_MUSICTRACK);
|
||||
|
|
|
@ -89,7 +89,7 @@ trigger_auto::Processing(void)
|
|||
UseTargets(this, m_iTriggerState, m_flDelay);
|
||||
|
||||
if (HasSpawnFlags(1)) {
|
||||
dprint(sprintf("^2trigger_auto::^3think^7: %s triggerer removed self\n", target));
|
||||
NSLog("^2trigger_auto::^3think^7: %s triggerer removed self", target);
|
||||
remove(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,8 +70,8 @@ trigger_autosave::Touch(entity eToucher)
|
|||
msg_entity = this;
|
||||
multicast(origin, MULTICAST_ALL);
|
||||
|
||||
dprint(sprintf("^2trigger_autosave::^3Touch^7: %s called autosave\n",
|
||||
eToucher.netname));
|
||||
NSLog("^2trigger_autosave::^3Touch^7: %s called autosave",
|
||||
eToucher.netname);
|
||||
|
||||
localcmd("save autosave\n");
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ trigger_cdaudio::Trigger(entity act, int unused)
|
|||
return;
|
||||
}
|
||||
|
||||
dprint(sprintf("^2trigger_cdaudio::^3Trigger^7: CD Track %i requested\n",
|
||||
m_iCDTrack));
|
||||
NSLog("^2trigger_cdaudio::^3Trigger^7: CD Track %i requested",
|
||||
m_iCDTrack);
|
||||
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_MUSICTRACK);
|
||||
|
|
|
@ -153,8 +153,8 @@ trigger_changelevel::Change(void)
|
|||
|
||||
/* standard level change */
|
||||
if (!m_strLandmark) {
|
||||
dprint(sprintf("^2trigger_changelevel::^3Change^7: Change to `%s`\n",
|
||||
m_strMap));
|
||||
NSLog("^2trigger_changelevel::^3Change^7: Change to `%s`",
|
||||
m_strMap);
|
||||
parm_string = m_strChangeTarget;
|
||||
changelevel(m_strMap);
|
||||
return;
|
||||
|
@ -185,7 +185,7 @@ trigger_changelevel::Change(void)
|
|||
info_landmark lm = (info_landmark)e;
|
||||
/* found it */
|
||||
if (lm.targetname == m_strLandmark) {
|
||||
dprint(sprintf("^2trigger_changelevel::^3Change^7: Found landmark for %s\n", m_strLandmark));
|
||||
NSLog("^2trigger_changelevel::^3Change^7: Found landmark for %s", m_strLandmark);
|
||||
g_landmarkpos = m_activator.origin - lm.origin;
|
||||
changelevel(m_strMap, m_strLandmark);
|
||||
break;
|
||||
|
@ -285,7 +285,7 @@ Landmark_GetSpot(void)
|
|||
info_landmark lm = (info_landmark)e;
|
||||
/* found it */
|
||||
if (lm.targetname == startspot) {
|
||||
dprint(sprintf("^3Landmark_GetSpot^7: Found landmark for %s\n", startspot));
|
||||
NSLog("^3Landmark_GetSpot^7: Found landmark for %s", startspot);
|
||||
return lm.origin + g_landmarkpos;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,8 +204,8 @@ trigger_hurt::Touch(entity eToucher)
|
|||
|
||||
Damage_Apply(eToucher, this, m_iDamage, 0, type);
|
||||
|
||||
dprint(sprintf("^2trigger_hurt::^3Touch^7: Hurting '%s' with %i\n",
|
||||
eToucher.netname, m_iDamage));
|
||||
NSLog("^2trigger_hurt::^3Touch^7: Hurting '%s' with %i",
|
||||
eToucher.netname, m_iDamage);
|
||||
|
||||
/* shut it down if used once */
|
||||
if (HasSpawnFlags(SF_HURT_ONCE)) {
|
||||
|
|
|
@ -112,7 +112,7 @@ trigger_look::Touch(entity eToucher)
|
|||
/* find the looktarget */
|
||||
lt = find(world, ::targetname, m_strLookTarget);
|
||||
if (!lt) {
|
||||
dprint(sprintf("^1trigger_look:Touch^7: Invalid m_strLookTarget %s!\n", m_strLookTarget));
|
||||
NSLog("^1trigger_look:Touch^7: Invalid m_strLookTarget %s!", m_strLookTarget);
|
||||
remove(this);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@ trigger_teleport::Touch(entity eToucher)
|
|||
if (eTarget) {
|
||||
vector endpos = eTarget.origin + [0,0,16];
|
||||
setorigin(eToucher, endpos);
|
||||
dprint(sprintf("^2trigger_teleport::^3Touch^7: Teleported '%s' to `%v`\n",
|
||||
eToucher.netname, endpos));
|
||||
NSLog("^2trigger_teleport::^3Touch^7: Teleported '%s' to `%v`",
|
||||
eToucher.netname, endpos);
|
||||
} else {
|
||||
print(sprintf("^2trigger_teleport::^3Touch^7: Failed to teleport '%s'\n",
|
||||
eToucher.netname));
|
||||
|
|
|
@ -105,12 +105,12 @@ NSIO::CreateOutput(string outmsg)
|
|||
new_minion.m_iOldCount = new_minion.m_iCount;
|
||||
|
||||
/* print final debug output */
|
||||
dprint(sprintf("^2%s::CreateOutput report:\n", classname));
|
||||
dprint(sprintf("Target: %s\n", new_minion.m_strTarget));
|
||||
dprint(sprintf("Input: %s\n", new_minion.m_strInput));
|
||||
dprint(sprintf("Data Message: %s\n", new_minion.m_strData));
|
||||
dprint(sprintf("Delay: %f\n", new_minion.m_flDelay));
|
||||
dprint(sprintf("Uses: %i\n\n", new_minion.m_iCount));
|
||||
NSLog("^2%s::CreateOutput report:", classname);
|
||||
NSLog("Target: %s", new_minion.m_strTarget);
|
||||
NSLog("Input: %s", new_minion.m_strInput);
|
||||
NSLog("Data Message: %s", new_minion.m_strData);
|
||||
NSLog("Delay: %f", new_minion.m_flDelay);
|
||||
NSLog("Uses: %i\n", new_minion.m_iCount);
|
||||
}
|
||||
|
||||
/* return the name that'll act as the trigger for all outputs */
|
||||
|
@ -315,8 +315,8 @@ NSIO::SpawnKey(string strKey, string strValue)
|
|||
break;
|
||||
#endif
|
||||
default:
|
||||
dprint(sprintf("^3%s^7::SpawnKey:: Unknown key '%s' with value '%s'\n",
|
||||
classname, strKey, strValue));
|
||||
NSLog("^3%s^7::SpawnKey:: Unknown key '%s' with value '%s'",
|
||||
classname, strKey, strValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -341,4 +341,4 @@ NSIO::NSIO(void)
|
|||
m_strOnUser3 = CreateOutput(m_strOnUser3);
|
||||
m_strOnUser4 = CreateOutput(m_strOnUser4);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ NSMonster::AlertNearby(void)
|
|||
if (vlen(origin - w.origin) > 512)
|
||||
continue;
|
||||
|
||||
//dprint(sprintf("Alert! %s get %s\n", w.classname, m_eEnemy.classname));
|
||||
//NSLog("Alert! %s get %s", w.classname, m_eEnemy.classname);
|
||||
NSMonster f = (NSMonster)w;
|
||||
|
||||
/* we shouldn't override this when they already got a target */
|
||||
|
@ -310,14 +310,14 @@ NSMonster::AttackRanged(void)
|
|||
void
|
||||
NSMonster::AttackDraw(void)
|
||||
{
|
||||
dprint(sprintf("^1%s::AttackDraw: Not defined!\n", classname));
|
||||
NSLog("^1%s::AttackDraw: Not defined!", classname);
|
||||
m_flAttackThink = time + 0.5f;
|
||||
}
|
||||
|
||||
void
|
||||
NSMonster::AttackHolster(void)
|
||||
{
|
||||
dprint(sprintf("^1%s::AttackHolster: Not defined!\n", classname));
|
||||
NSLog("^1%s::AttackHolster: Not defined!", classname);
|
||||
m_flAttackThink = time + 0.5f;
|
||||
}
|
||||
|
||||
|
@ -398,8 +398,8 @@ NSMonster::CheckRoute(void)
|
|||
flDist = floor(vlen(evenpos - origin));
|
||||
|
||||
if (flDist < 8) {
|
||||
dprint(sprintf("^2NSMonster::^3CheckRoute^7: " \
|
||||
"%s reached node\n", this.targetname));
|
||||
NSLog("^2NSMonster::^3CheckRoute^7: " \
|
||||
"%s reached node\n", this.targetname);
|
||||
m_iCurNode--;
|
||||
velocity = [0,0,0]; /* clamp friction */
|
||||
|
||||
|
@ -419,7 +419,7 @@ NSMonster::CheckRoute(void)
|
|||
|
||||
if (m_iCurNode < -1) {
|
||||
ClearRoute();
|
||||
dprint(sprintf("^2NSMonster::^3CheckRoute^7: %s reached end\n", this.targetname));
|
||||
NSLog("^2NSMonster::^3CheckRoute^7: %s reached end", this.targetname);
|
||||
|
||||
/* mark that we've ended a sequence, if we're in one and que anim */
|
||||
if (m_iSequenceState == SEQUENCESTATE_ACTIVE) {
|
||||
|
@ -428,12 +428,12 @@ NSMonster::CheckRoute(void)
|
|||
m_iSequenceState = SEQUENCESTATE_ENDING;
|
||||
think = (m_iSequenceFlags & SSFL_NOSCRIPTMOVE) ? FreeState : FreeStateMoved;
|
||||
nextthink = time + duration;
|
||||
dprint(sprintf("^2NSMonster::^3CheckRoute^7: %s overriding anim for %f seconds (modelindex %d, frame %d)\n", this.targetname, duration, modelindex, m_flSequenceEnd));
|
||||
NSLog("^2NSMonster::^3CheckRoute^7: %s overriding anim for %f seconds (modelindex %d, frame %d)", this.targetname, duration, modelindex, m_flSequenceEnd);
|
||||
} else {
|
||||
/* we still need to trigger targets */
|
||||
think = (m_iSequenceFlags & SSFL_NOSCRIPTMOVE) ? FreeState : FreeStateMoved;
|
||||
nextthink = time;
|
||||
dprint(sprintf("^2NSMonster::^3CheckRoute^7: %s has no anim, finished sequence.\n", this.targetname));
|
||||
NSLog("^2NSMonster::^3CheckRoute^7: %s has no anim, finished sequence.", this.targetname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -714,7 +714,7 @@ NSTalkMonster::ProcessWordQue(void)
|
|||
|
||||
SentenceSample(m_pSentenceQue[m_iSentencePos].m_strSnd);
|
||||
|
||||
dprint(sprintf("^2NSEntity::^3ProcessWordQue^7: Speaking %s\n", m_pSentenceQue[m_iSentencePos].m_strSnd));
|
||||
NSLog("^2NSEntity::^3ProcessWordQue^7: Speaking %s", m_pSentenceQue[m_iSentencePos].m_strSnd);
|
||||
m_iSentencePos++;
|
||||
|
||||
if (m_iSentencePos == m_iSentenceCount) {
|
||||
|
@ -908,14 +908,14 @@ NSTalkMonster_ParseSentence(void)
|
|||
|
||||
if (ent) {
|
||||
if (ent.classname != "NSTalkMonster" && ent.classname != "ambient_generic")
|
||||
dprint(sprintf("^3 NSTalkMonster_ParseSentence ^7: Entity %d not a NSTalkMonster!\n", e));
|
||||
NSLog("^3 NSTalkMonster_ParseSentence ^7: Entity %d not a NSTalkMonster!", e);
|
||||
else {
|
||||
targ = (NSTalkMonster)ent;
|
||||
targ.Sentence(sentence);
|
||||
dprint(sprintf("^3 NSTalkMonster_ParseSentence ^7: Entity %d saying %s\n", e, sentence));
|
||||
NSLog("^3 NSTalkMonster_ParseSentence ^7: Entity %d saying %s", e, sentence);
|
||||
}
|
||||
} else {
|
||||
dprint(sprintf("^3 NSTalkMonster_ParseSentence ^7: Entity %d not in PVS\n", e));
|
||||
NSLog("^3 NSTalkMonster_ParseSentence ^7: Entity %d not in PVS", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
void
|
||||
NSTrigger::Trigger(entity act, int state)
|
||||
{
|
||||
dprint(sprintf("^2%s::^3Input^7: Triggerd by %s with no consequence\n",
|
||||
this.classname, act.classname));
|
||||
NSLog("^2%s::^3Input^7: Triggerd by %s with no consequence",
|
||||
this.classname, act.classname);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -35,8 +35,8 @@ NSTrigger::UseTargets(entity act, int state, float fDelay)
|
|||
return;
|
||||
|
||||
if (fDelay > 0.0f) {
|
||||
dprint(sprintf("^2%s::^3UseTargets^7: Triggering `%s`\n",
|
||||
this.classname, target));
|
||||
NSLog("^2%s::^3UseTargets^7: Triggering `%s`",
|
||||
this.classname, target);
|
||||
|
||||
NSTrigger eTimer = spawn(NSTrigger);
|
||||
eTimer.owner = act;
|
||||
|
@ -48,10 +48,10 @@ NSTrigger::UseTargets(entity act, int state, float fDelay)
|
|||
for (entity f = world; (f = find(f, ::targetname, target));) {
|
||||
NSTrigger trigger = (NSTrigger)f;
|
||||
|
||||
dprint(sprintf("^2%s::^3UseTargets^7:" \
|
||||
NSLog("^2%s::^3UseTargets^7:" \
|
||||
"Triggering %s `%s` from %s\n", \
|
||||
this.classname, f.classname, \
|
||||
trigger.targetname, act.classname));
|
||||
trigger.targetname, act.classname);
|
||||
|
||||
if (trigger.Trigger != __NULL__) {
|
||||
trigger.Trigger(act, state);
|
||||
|
@ -91,7 +91,7 @@ NSTrigger::GetMaster(void)
|
|||
|
||||
/* default to success */
|
||||
if (!m_strMaster) {
|
||||
/*dprint(sprintf("^2%s::^3GetMaster^7: No master, return success\n",
|
||||
/*NSLog("^2%s::^3GetMaster^7: No master, return success",
|
||||
this.classname));*/
|
||||
return (1);
|
||||
}
|
||||
|
@ -100,17 +100,17 @@ NSTrigger::GetMaster(void)
|
|||
|
||||
/* we couldn't find it, so let's not even bother going further */
|
||||
if (!t) {
|
||||
dprint(sprintf("^2%s::^3GetMaster^7: Invalid master (%s), return success\n",
|
||||
this.classname, m_strMaster));
|
||||
NSLog("^2%s::^3GetMaster^7: Invalid master (%s), return success",
|
||||
this.classname, m_strMaster);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (t.GetValue() == 1)
|
||||
dprint(sprintf("^2%s::^3GetMaster^7: %s learns %s ^2POSITIVE\n",
|
||||
this.classname, targetname, m_strMaster));
|
||||
NSLog("^2%s::^3GetMaster^7: %s learns %s ^2POSITIVE",
|
||||
this.classname, targetname, m_strMaster);
|
||||
else
|
||||
dprint(sprintf("^2%s::^3GetMaster^7: %s learns %s ^1NEGATIVE\n",
|
||||
this.classname, targetname, m_strMaster));
|
||||
NSLog("^2%s::^3GetMaster^7: %s learns %s ^1NEGATIVE",
|
||||
this.classname, targetname, m_strMaster);
|
||||
|
||||
return t.GetValue();
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ class NSVehicle:NSSurfacePropEntity
|
|||
virtual entity(void) GetDriver;
|
||||
virtual void(void) PlayerUpdateFlags;
|
||||
virtual void(void) PlayerAlign;
|
||||
virtual void(base_player) PlayerEnter;
|
||||
virtual void(base_player) PlayerLeave;
|
||||
virtual void(NSClientPlayer) PlayerEnter;
|
||||
virtual void(NSClientPlayer) PlayerLeave;
|
||||
virtual void() PlayerInput;
|
||||
virtual float(void) DriverAnimation;
|
||||
|
||||
|
@ -84,15 +84,3 @@ enumflags
|
|||
#ifdef CLIENT
|
||||
void basevehicle_readentity(float isnew);
|
||||
#endif
|
||||
|
||||
/* vehicle hakku */
|
||||
class CBaseVehicle:NSVehicle
|
||||
{
|
||||
void(void) CBaseVehicle;
|
||||
};
|
||||
|
||||
void
|
||||
CBaseVehicle::CBaseVehicle(void)
|
||||
{
|
||||
NSVehicle::NSVehicle();
|
||||
}
|
||||
|
|
|
@ -55,9 +55,9 @@ NSVehicle::DriverRelink(void)
|
|||
if (!driver_entnum)
|
||||
m_eDriver = __NULL__;
|
||||
else {
|
||||
base_player pl;
|
||||
NSClientPlayer pl;
|
||||
m_eDriver = findentity(world, ::entnum, driver_entnum);
|
||||
pl = (base_player)m_eDriver;
|
||||
pl = (NSClientPlayer)m_eDriver;
|
||||
pl.vehicle = this;
|
||||
}
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ NSVehicle::PlayerAlign(void)
|
|||
}
|
||||
|
||||
void
|
||||
NSVehicle::PlayerEnter(base_player pl)
|
||||
NSVehicle::PlayerEnter(NSClientPlayer pl)
|
||||
{
|
||||
vector offs;
|
||||
|
||||
|
@ -379,7 +379,7 @@ NSVehicle::PlayerEnter(base_player pl)
|
|||
}
|
||||
|
||||
void
|
||||
NSVehicle::PlayerLeave(base_player pl)
|
||||
NSVehicle::PlayerLeave(NSClientPlayer pl)
|
||||
{
|
||||
if (!pl)
|
||||
return;
|
||||
|
|
|
@ -148,8 +148,8 @@ ambient_generic::Restore(string strKey, string strValue)
|
|||
void
|
||||
ambient_generic::UseNormal(entity act, int state)
|
||||
{
|
||||
dprint(sprintf("Sound once: %S Volume: %f; Radius: %d; Pitch: %d\n", \
|
||||
m_strActivePath, m_flVolume, m_flRadius, m_flPitch));
|
||||
NSLog("Sound once: %S Volume: %f; Radius: %d; Pitch: %d", \
|
||||
m_strActivePath, m_flVolume, m_flRadius, m_flPitch);
|
||||
|
||||
if (substring(m_strActivePath, 0, 1) == "!") {
|
||||
string seq = Sentences_GetSamples(m_strActivePath);
|
||||
|
@ -171,13 +171,13 @@ void
|
|||
ambient_generic::UseLoop(entity act, int state)
|
||||
{
|
||||
if (m_bToggle == TRUE) {
|
||||
dprint(sprintf("^2ambient_generic::^3UseLoop^7: %s stops `%s`\n",
|
||||
target, m_strActivePath));
|
||||
NSLog("^2ambient_generic::^3UseLoop^7: %s stops `%s`",
|
||||
target, m_strActivePath);
|
||||
m_strActivePath = "common/null.wav";
|
||||
} else {
|
||||
m_strActivePath = m_strSpawnPath;
|
||||
dprint(sprintf("^2ambient_generic::^3UseLoop^7: %s plays `%s`\n",
|
||||
target, m_strActivePath));
|
||||
NSLog("^2ambient_generic::^3UseLoop^7: %s plays `%s`",
|
||||
target, m_strActivePath);
|
||||
}
|
||||
|
||||
m_bToggle = 1 - m_bToggle;
|
||||
|
@ -307,7 +307,7 @@ ambient_generic::ReceiveEntity(float isnew, float flChanged)
|
|||
if (flChanged & AMBIENT_ENABLED)
|
||||
m_bLoops = readbyte();
|
||||
|
||||
dprint(sprintf("Sound received: %S Volume: %f; Radius: %d; Pitch: %d\n", m_strActivePath, m_flVolume, m_flRadius, m_flPitch));
|
||||
NSLog("Sound received: %S Volume: %f; Radius: %d; Pitch: %d", m_strActivePath, m_flVolume, m_flRadius, m_flPitch);
|
||||
|
||||
|
||||
if (m_bLoops == true)
|
||||
|
|
|
@ -297,7 +297,7 @@ func_tankmortar::PlayerInput(void)
|
|||
{
|
||||
#ifdef SERVER
|
||||
if (m_eDriver && m_eDriver.health <= 0)
|
||||
PlayerLeave((base_player)m_eDriver);
|
||||
PlayerLeave((NSClientPlayer)m_eDriver);
|
||||
#else
|
||||
print("foooo\n");
|
||||
#endif
|
||||
|
@ -368,7 +368,7 @@ func_tankmortar::Respawn(void)
|
|||
SetAngles(GetSpawnAngles());
|
||||
|
||||
if (m_eDriver)
|
||||
PlayerLeave((base_player)m_eDriver);
|
||||
PlayerLeave((NSClientPlayer)m_eDriver);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -548,7 +548,7 @@ prop_vehicle_driveable::RunVehiclePhysics(void)
|
|||
#if SERVER
|
||||
/* eject the dead */
|
||||
if (m_eDriver && m_eDriver.health <= 0) {
|
||||
PlayerLeave((base_player)m_eDriver);
|
||||
PlayerLeave((NSClientPlayer)m_eDriver);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -645,10 +645,10 @@ prop_vehicle_driveable::OnPlayerUse(void)
|
|||
return;
|
||||
|
||||
if (m_eDriver == eActivator) {
|
||||
PlayerLeave((base_player)eActivator);
|
||||
PlayerLeave((NSClientPlayer)eActivator);
|
||||
setorigin(eActivator, GetExitPos());
|
||||
} else if (!m_eDriver) {
|
||||
PlayerEnter((base_player)eActivator);
|
||||
PlayerEnter((NSClientPlayer)eActivator);
|
||||
m_vecPlayerPos = [0,0,0];
|
||||
}
|
||||
m_flUseTime = time + 2.0f;
|
||||
|
@ -677,7 +677,7 @@ prop_vehicle_driveable::Respawn(void)
|
|||
setsize( this, [-50,-50,0], [50,50,64]);
|
||||
|
||||
if (m_eDriver)
|
||||
PlayerLeave((base_player)m_eDriver);
|
||||
PlayerLeave((NSClientPlayer)m_eDriver);
|
||||
|
||||
SendFlags = -1;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,14 @@
|
|||
var int autocvar_menu_intro = TRUE;
|
||||
var int autocvar__menu_singleplayer;
|
||||
|
||||
void
|
||||
_NSLog(string msg)
|
||||
{
|
||||
if (cvar("g_developer"))
|
||||
print(sprintf("%f %s\n", time, msg));
|
||||
}
|
||||
#define NSLog(x, ...) _NSLog(sprintf(x, __VA_ARGS__))
|
||||
|
||||
#define KEY_UNKNOWN -1
|
||||
#define KEY_GAME 0
|
||||
#define KEY_MENU 2
|
||||
|
|
|
@ -765,16 +765,16 @@ games_init_2(void)
|
|||
games[id].steambg = 0;
|
||||
|
||||
if (games_check_manifest(id, gamedirname) == 1) {
|
||||
dprint(sprintf("[MENU] Found manifest for %s\n", gamedirname));
|
||||
NSLog("[MENU] Found manifest for %s", gamedirname);
|
||||
games[id].info_type = GAMEINFO_MANIFEST;
|
||||
} else if (games_check_gtxt(id, gamedirname) == 1) {
|
||||
dprint(sprintf("[MENU] Found gameinfo for %s\n", gamedirname));
|
||||
NSLog("[MENU] Found gameinfo for %s", gamedirname);
|
||||
games[id].info_type = GAMEINFO_GITXT;
|
||||
} else if (games_check_liblist(id, gamedirname) == 1) {
|
||||
dprint(sprintf("[MENU] Found liblist for %s\n", gamedirname));
|
||||
NSLog("[MENU] Found liblist for %s", gamedirname);
|
||||
games[id].info_type = GAMEINFO_LIBLIST;
|
||||
} else {
|
||||
dprint(sprintf("[MENU] Found nothing for %s\n", gamedirname));
|
||||
NSLog("[MENU] Found nothing for %s", gamedirname);
|
||||
games[id].info_type = GAMEINFO_NONE;
|
||||
}
|
||||
|
||||
|
@ -827,16 +827,16 @@ games_init(void)
|
|||
|
||||
#ifndef WEBMENU
|
||||
if (games_check_manifest(id, gamedirname) == 1) {
|
||||
dprint(sprintf("[MENU] Found manifest for %s\n", gamedirname));
|
||||
NSLog("[MENU] Found manifest for %s", gamedirname);
|
||||
games[id].info_type = GAMEINFO_MANIFEST;
|
||||
} else if (games_check_gtxt(id, gamedirname) == 1) {
|
||||
dprint(sprintf("[MENU] Found gameinfo for %s\n", gamedirname));
|
||||
NSLog("[MENU] Found gameinfo for %s", gamedirname);
|
||||
games[id].info_type = GAMEINFO_GITXT;
|
||||
} else if (games_check_liblist(id, gamedirname) == 1) {
|
||||
dprint(sprintf("[MENU] Found liblist for %s\n", gamedirname));
|
||||
NSLog("[MENU] Found liblist for %s", gamedirname);
|
||||
games[id].info_type = GAMEINFO_LIBLIST;
|
||||
} else {
|
||||
dprint(sprintf("[MENU] Found nothing for %s\n", gamedirname));
|
||||
NSLog("[MENU] Found nothing for %s", gamedirname);
|
||||
games[id].info_type = GAMEINFO_NONE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -136,10 +136,10 @@ inet_refreshframe(void)
|
|||
inet_lbServers_Game.AddEntry(gethostcachestring(srv_fldGame, i));
|
||||
inet_lbServers_Players.AddEntry(players);
|
||||
inet_lbServers_Addresses.AddEntry(address);
|
||||
dprint(sprintf("Adding %s to the Internet server list\n", address));
|
||||
NSLog("Adding %s to the Internet server list", address);
|
||||
added++;
|
||||
}
|
||||
dprint(sprintf("Added %i Internet servers.\n", added));
|
||||
NSLog("Added %i Internet servers.", added);
|
||||
inet_sbServers.SetMax(added);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ Master_GetTotalServers(void)
|
|||
int a = gethostcachevalue(SLIST_HOSTCACHETOTALCOUNT);
|
||||
|
||||
if (a) {
|
||||
dprint(sprintf("Master reports a total of %i servers.\n", a));
|
||||
NSLog("Master reports a total of %i servers.", a);
|
||||
}
|
||||
return gethostcachevalue(SLIST_HOSTCACHETOTALCOUNT);
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ Master_RefreshCache(void)
|
|||
int a = gethostcachevalue(SLIST_HOSTCACHETOTALCOUNT);
|
||||
|
||||
if (a) {
|
||||
dprint(sprintf("Master reports a total of %i servers.\n", a));
|
||||
NSLog("Master reports a total of %i servers.", a);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ Master_UpdateCache(void)
|
|||
int a = gethostcachevalue(SLIST_HOSTCACHETOTALCOUNT);
|
||||
|
||||
if (a) {
|
||||
dprint(sprintf("Master reports a total of %i servers.\n", a));
|
||||
NSLog("Master reports a total of %i servers.", a);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ Music_ParseTrack(string parm)
|
|||
|
||||
track = stof(parm);
|
||||
path = Music_GetPath(track);
|
||||
dprint(sprintf("^2Music_ParseTrack:^7 Single track %i from %s\n", track, path));
|
||||
NSLog("^2Music_ParseTrack:^7 Single track %i from %s", track, path);
|
||||
localcmd(sprintf("music %s -\n", path));
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ Music_ParseLoop(string parm)
|
|||
|
||||
track = stof(parm);
|
||||
path = Music_GetPath(track);
|
||||
dprint(sprintf("^2Music_ParseLoop:^7 Looping track %i from %s\n", track, path));
|
||||
NSLog("^2Music_ParseLoop:^7 Looping track %i from %s", track, path);
|
||||
localcmd(sprintf("music %s\n", path));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ TCP_Connect(tcpinfo_t *in, string path)
|
|||
in.m_fSocket = fopen(path, -1);
|
||||
|
||||
if (in.m_fSocket < 0) {
|
||||
dprint(sprintf("^1TCP_Connect^7: Unable to access %s\n", path));
|
||||
print(sprintf("^1TCP_Connect^7: Unable to access %s\n", path));
|
||||
} else {
|
||||
/* we got at least this far */
|
||||
in.m_iState = STATE_CONNECTING;
|
||||
|
|
|
@ -91,7 +91,7 @@ ChatLoadFile(string filename)
|
|||
c = tokenizebyseparator(g_table[i].sample, ";");
|
||||
for (int x = 0; x < c; x++) {
|
||||
precache_sound(argv(x));
|
||||
dprint(sprintf("[CHATSOUNDS] Caching: %s\n", argv(x)));
|
||||
print(sprintf("[CHATSOUNDS] Caching: %s\n", argv(x)));
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ ClientConnect(void)
|
|||
}
|
||||
|
||||
if (g_ents_initialized)
|
||||
g_grMode.PlayerConnect((base_player)self);
|
||||
g_grMode.PlayerConnect((NSClientPlayer)self);
|
||||
|
||||
for (entity a = world; (a = find(a, ::classname, "player"));)
|
||||
playercount++;
|
||||
|
@ -97,7 +97,7 @@ void
|
|||
ClientDisconnect(void)
|
||||
{
|
||||
if (g_ents_initialized)
|
||||
g_grMode.PlayerDisconnect((base_player)self);
|
||||
g_grMode.PlayerDisconnect((NSClientPlayer)self);
|
||||
|
||||
/* this will hide/remove the player from other clients */
|
||||
player pl = (player)self;
|
||||
|
@ -116,15 +116,15 @@ void
|
|||
ClientKill(void)
|
||||
{
|
||||
if (g_ents_initialized)
|
||||
g_grMode.PlayerKill((base_player)self);
|
||||
g_grMode.PlayerKill((NSClientPlayer)self);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
SpectatorThink
|
||||
|
||||
Run every frame on every spectator.
|
||||
The 'self' global refers to one of any given amount of spectators.
|
||||
Run every frame on every NSClientSpectator.
|
||||
The 'self' global refers to one of any given amount of NSClientSpectators.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
|
@ -133,7 +133,7 @@ SpectatorThink(void)
|
|||
Game_SpectatorThink();
|
||||
|
||||
if (self.classname == "spectator") {
|
||||
spectator spec = (spectator)self;
|
||||
NSClientSpectator spec = (NSClientSpectator)self;
|
||||
spec.PreFrame();
|
||||
spec.PostFrame();
|
||||
return;
|
||||
|
@ -144,23 +144,23 @@ SpectatorThink(void)
|
|||
=================
|
||||
SpectatorConnect
|
||||
|
||||
Called when a spectator joins the server.
|
||||
The 'self' global is the connecting spectator in question.
|
||||
Called when a NSClientSpectator joins the server.
|
||||
The 'self' global is the connecting NSClientSpectator in question.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
SpectatorConnect(void)
|
||||
{
|
||||
Game_SpectatorConnect();
|
||||
spawnfunc_spectator();
|
||||
spawnfunc_NSClientSpectator();
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
SpectatorDisconnect
|
||||
|
||||
Called when a spectator leaves the server.
|
||||
The 'self' global is the leaving spectator in question.
|
||||
Called when a NSClientSpectator leaves the server.
|
||||
The 'self' global is the leaving NSClientSpectator in question.
|
||||
Attributes cleared when this function is done executing.
|
||||
=================
|
||||
*/
|
||||
|
@ -185,9 +185,9 @@ void
|
|||
PutClientInServer(void)
|
||||
{
|
||||
if (g_ents_initialized)
|
||||
g_grMode.PlayerSpawn((base_player)self);
|
||||
g_grMode.PlayerSpawn((NSClientPlayer)self);
|
||||
|
||||
Plugin_PlayerEntered((base_player)self);
|
||||
Plugin_PlayerEntered((NSClientPlayer)self);
|
||||
|
||||
/* activate all game_playerspawn entities */
|
||||
for (entity a = world; (a = find(a, ::targetname, "game_playerspawn"));) {
|
||||
|
@ -211,7 +211,7 @@ void
|
|||
PlayerPreThink(void)
|
||||
{
|
||||
if (self.classname == "spectator") {
|
||||
//spectator spec = (spectator)self;
|
||||
//NSClientSpectator spec = (NSClientSpectator)self;
|
||||
//spec.PreFrame();
|
||||
return;
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ PlayerPreThink(void)
|
|||
#endif
|
||||
|
||||
if (g_ents_initialized)
|
||||
g_grMode.PlayerPreFrame((base_player)self);
|
||||
g_grMode.PlayerPreFrame((NSClientPlayer)self);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -259,7 +259,7 @@ PlayerPostThink(void)
|
|||
|
||||
if (g_ents_initialized) {
|
||||
player pl = (player)self;
|
||||
g_grMode.PlayerPostFrame((base_player)self);
|
||||
g_grMode.PlayerPostFrame((NSClientPlayer)self);
|
||||
pl.EvaluateEntity();
|
||||
}
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ SetChangeParms(void)
|
|||
print("--------- Setting Level-Change Parameters ----------\n");
|
||||
|
||||
if (g_ents_initialized)
|
||||
g_grMode.LevelChangeParms((base_player)self);
|
||||
g_grMode.LevelChangeParms((NSClientPlayer)self);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -317,7 +317,7 @@ void
|
|||
SV_RunClientCommand(void)
|
||||
{
|
||||
if (self.classname == "spectator") {
|
||||
spectator spec = (spectator)self;
|
||||
NSClientSpectator spec = (NSClientSpectator)self;
|
||||
spec.RunClientCommand();
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ SV_ParseClientCommand(string cmd)
|
|||
if (self.classname != "player")
|
||||
break;
|
||||
ClientKill();
|
||||
spawnfunc_spectator();
|
||||
spawnfunc_NSClientSpectator();
|
||||
break;
|
||||
case "play":
|
||||
if (self.classname != "spectator")
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
void Footsteps_Init(void);
|
||||
void Footsteps_HLBSP(base_player target);
|
||||
void Footsteps_VVBSP(base_player target);
|
||||
void Footsteps_Default(base_player target);
|
||||
void Footsteps_HLBSP(NSClientPlayer target);
|
||||
void Footsteps_VVBSP(NSClientPlayer target);
|
||||
void Footsteps_Default(NSClientPlayer target);
|
||||
void Footsteps_Update(void);
|
||||
|
|
|
@ -73,7 +73,7 @@ to specify materials.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
Footsteps_HLBSP(base_player target)
|
||||
Footsteps_HLBSP(NSClientPlayer target)
|
||||
{
|
||||
string mat_name = "";
|
||||
string tex_name = "";
|
||||
|
@ -154,7 +154,7 @@ Modern BSP format which uses surfaceflags to specify materials on surfaces.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
Footsteps_VVBSP(base_player target)
|
||||
Footsteps_VVBSP(NSClientPlayer target)
|
||||
{
|
||||
string mat_name = "";
|
||||
|
||||
|
@ -234,7 +234,7 @@ materials for.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
Footsteps_Default(base_player target)
|
||||
Footsteps_Default(NSClientPlayer target)
|
||||
{
|
||||
string mat_name = "";
|
||||
|
||||
|
@ -262,12 +262,12 @@ Run every frame for each player, plays material based footsteps
|
|||
void
|
||||
Footsteps_Update(void)
|
||||
{
|
||||
base_player pl;
|
||||
NSClientPlayer pl;
|
||||
|
||||
if (self.classname != "player")
|
||||
return;
|
||||
|
||||
pl = (base_player)self;
|
||||
pl = (NSClientPlayer)self;
|
||||
|
||||
if (pl.movetype == MOVETYPE_WALK) {
|
||||
if ((pl.velocity[0] == 0 && pl.velocity[1] == 0) || pl.step_time > time) {
|
||||
|
|
|
@ -26,22 +26,22 @@ class CGameRules
|
|||
|
||||
/* logic */
|
||||
virtual void(void) FrameStart;
|
||||
virtual float(base_player,string) ConsoleCommand;
|
||||
virtual float(NSClientPlayer,string) ConsoleCommand;
|
||||
|
||||
/* client */
|
||||
virtual void(base_player) PlayerConnect;
|
||||
virtual void(base_player) PlayerDisconnect;
|
||||
virtual void(base_player) PlayerKill;
|
||||
virtual void(base_player) PlayerSpawn;
|
||||
virtual void(base_player) PlayerPreFrame;
|
||||
virtual void(base_player) PlayerPostFrame;
|
||||
virtual void(base_player) PlayerDeath;
|
||||
virtual void(base_player) PlayerPain;
|
||||
virtual bool(base_player) PlayerCanAttack;
|
||||
virtual void(NSClientPlayer) PlayerConnect;
|
||||
virtual void(NSClientPlayer) PlayerDisconnect;
|
||||
virtual void(NSClientPlayer) PlayerKill;
|
||||
virtual void(NSClientPlayer) PlayerSpawn;
|
||||
virtual void(NSClientPlayer) PlayerPreFrame;
|
||||
virtual void(NSClientPlayer) PlayerPostFrame;
|
||||
virtual void(NSClientPlayer) PlayerDeath;
|
||||
virtual void(NSClientPlayer) PlayerPain;
|
||||
virtual bool(NSClientPlayer) PlayerCanAttack;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(void) LevelNewParms;
|
||||
virtual void(base_player) LevelChangeParms;
|
||||
virtual void(NSClientPlayer) LevelChangeParms;
|
||||
|
||||
/* Entities/Item manipulation */
|
||||
virtual int(int) MaxItemPerSlot;
|
||||
|
@ -59,9 +59,9 @@ class CGameRules
|
|||
virtual float(void) IsTeamPlay;
|
||||
|
||||
/* spectator */
|
||||
/*virtual void(base_player) SpectatorConnect;
|
||||
virtual void(base_player) SpectatorDisconnect;
|
||||
virtual void(base_player) SpectatorThink;*/
|
||||
/*virtual void(NSClientPlayer) SpectatorConnect;
|
||||
virtual void(NSClientPlayer) SpectatorDisconnect;
|
||||
virtual void(NSClientPlayer) SpectatorThink;*/
|
||||
};
|
||||
|
||||
/* our currently running mode */
|
||||
|
|
|
@ -30,51 +30,51 @@ CGameRules::FrameStart(void)
|
|||
//print("StartFrame!\n");
|
||||
}
|
||||
float
|
||||
CGameRules::ConsoleCommand(base_player pl, string cmd)
|
||||
CGameRules::ConsoleCommand(NSClientPlayer pl, string cmd)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* client */
|
||||
void
|
||||
CGameRules::PlayerConnect(base_player pl)
|
||||
CGameRules::PlayerConnect(NSClientPlayer pl)
|
||||
{
|
||||
//print("ClientConnect!\n");
|
||||
}
|
||||
void
|
||||
CGameRules::PlayerDisconnect(base_player pl)
|
||||
CGameRules::PlayerDisconnect(NSClientPlayer pl)
|
||||
{
|
||||
//print("ClientDisconnect!\n");
|
||||
}
|
||||
void
|
||||
CGameRules::PlayerKill(base_player pl)
|
||||
CGameRules::PlayerKill(NSClientPlayer pl)
|
||||
{
|
||||
//print("PlayerKill!\n");
|
||||
}
|
||||
void
|
||||
CGameRules::PlayerDeath(base_player pl)
|
||||
CGameRules::PlayerDeath(NSClientPlayer pl)
|
||||
{
|
||||
//print("PlayerDeath!\n");
|
||||
pl.Death();
|
||||
}
|
||||
void
|
||||
CGameRules::PlayerPain(base_player pl)
|
||||
CGameRules::PlayerPain(NSClientPlayer pl)
|
||||
{
|
||||
//print("ClientKill!\n");
|
||||
pl.Pain();
|
||||
}
|
||||
void
|
||||
CGameRules::PlayerSpawn(base_player pl)
|
||||
CGameRules::PlayerSpawn(NSClientPlayer pl)
|
||||
{
|
||||
//print("PutClientInServer!\n");
|
||||
}
|
||||
void
|
||||
CGameRules::PlayerPreFrame(base_player pl)
|
||||
CGameRules::PlayerPreFrame(NSClientPlayer pl)
|
||||
{
|
||||
//print("PlayerPreThink!\n");
|
||||
}
|
||||
void
|
||||
CGameRules::PlayerPostFrame(base_player pl)
|
||||
CGameRules::PlayerPostFrame(NSClientPlayer pl)
|
||||
{
|
||||
//print("PlayerPostThink!\n");
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ CGameRules::LevelNewParms(void)
|
|||
//print("LevelNewParms!\n");
|
||||
}
|
||||
void
|
||||
CGameRules::LevelChangeParms(base_player pl)
|
||||
CGameRules::LevelChangeParms(NSClientPlayer pl)
|
||||
{
|
||||
//print("LevelChangeParms!\n");
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ CGameRules::DamageApply(entity t, entity c, float dmg, int w, damageType_t type)
|
|||
|
||||
/* only clients have armor */
|
||||
if (eTarget.flags & FL_CLIENT) {
|
||||
base_player tp = (base_player)t;
|
||||
NSClientPlayer tp = (NSClientPlayer)t;
|
||||
|
||||
/* don't allow any damage */
|
||||
if (PlayerCanAttack(tp) == false) {
|
||||
|
@ -414,7 +414,7 @@ Gamerules_IsTeamPlay(void)
|
|||
}
|
||||
|
||||
bool
|
||||
CGameRules::PlayerCanAttack(base_player bp)
|
||||
CGameRules::PlayerCanAttack(NSClientPlayer bp)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -33,17 +33,17 @@ Event_ServerModelEvent(float flTimeStamp, int iCode, string strData)
|
|||
NSEntity trigger = (NSEntity)f;
|
||||
if (trigger.Trigger != __NULL__) {
|
||||
trigger.Trigger(self, TRIG_TOGGLE);
|
||||
dprint(sprintf("^2%s^7::^3ModelEvent^7: " \
|
||||
NSLog("^2%s^7::^3ModelEvent^7: " \
|
||||
"Calling trigger '%s'\n",
|
||||
self.classname, strData));
|
||||
self.classname, strData);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1004:
|
||||
break;
|
||||
default:
|
||||
dprint(sprintf("^3[SERVER]^7 Unknown model-event code " \
|
||||
"%i with data %s\n", iCode, strData));
|
||||
NSLog("^3[SERVER]^7 Unknown model-event code " \
|
||||
"%i with data %s\n", iCode, strData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ void Plugin_Shutdown(void);
|
|||
void Plugin_InitEnts(void);
|
||||
int Plugin_RunClientCommand(void);
|
||||
string Plugin_ParseClientCommand(string);
|
||||
int Plugin_PlayerConnect(base_player);
|
||||
int Plugin_PlayerDisconnect(base_player);
|
||||
int Plugin_PlayerEntered(base_player);
|
||||
int Plugin_PlayerConnect(NSClientPlayer);
|
||||
int Plugin_PlayerDisconnect(NSClientPlayer);
|
||||
int Plugin_PlayerEntered(NSClientPlayer);
|
||||
void Plugin_PlayerObituary(entity, entity, int, bodyType_t, int);
|
||||
|
|
|
@ -214,7 +214,7 @@ Called whenever a new client connect to the game
|
|||
=================
|
||||
*/
|
||||
int
|
||||
Plugin_PlayerConnect(base_player cl)
|
||||
Plugin_PlayerConnect(NSClientPlayer cl)
|
||||
{
|
||||
int rval;
|
||||
int tval;
|
||||
|
@ -249,7 +249,7 @@ Called whenever a client leaves the game
|
|||
=================
|
||||
*/
|
||||
int
|
||||
Plugin_PlayerDisconnect(base_player cl)
|
||||
Plugin_PlayerDisconnect(NSClientPlayer cl)
|
||||
{
|
||||
int rval;
|
||||
int tval;
|
||||
|
@ -284,7 +284,7 @@ Called when a player has fully connected and entered the server
|
|||
=================
|
||||
*/
|
||||
int
|
||||
Plugin_PlayerEntered(base_player cl)
|
||||
Plugin_PlayerEntered(NSClientPlayer cl)
|
||||
{
|
||||
int rval;
|
||||
int tval;
|
||||
|
|
|
@ -98,7 +98,7 @@ Sentences_GetSamples(string word)
|
|||
/* check if the word is present at all */
|
||||
for (int i = 0; i < g_sentences_count; i++) {
|
||||
if (g_sentences[i] == word) {
|
||||
dprint(sprintf("^3Sentences_GetSamples^7: Found %s\n", word));
|
||||
NSLog("^3Sentences_GetSamples^7: Found %s", word);
|
||||
return word;
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ Sentences_GetSamples(string word)
|
|||
/* if we've got one, choose a random sample of them */
|
||||
if (gc) {
|
||||
int r = floor(random(0, gc));
|
||||
dprint(sprintf("^3Sentences_GetSamples^7: Choosing %s%i\n", word, r));
|
||||
NSLog("^3Sentences_GetSamples^7: Choosing %s%i", word, r);
|
||||
return sprintf("%s%i", word, r);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
void Spawn_ObserverCam(base_player);
|
||||
void Spawn_ObserverCam(NSClientPlayer);
|
||||
float Spawn_PlayerRange(entity);
|
||||
entity Spawn_SelectRandom(string);
|
||||
|
|
|
@ -22,7 +22,7 @@ Find a spawnpoint for spectators and set origin and angle of the 'pl' target.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
Spawn_ObserverCam(base_player pl)
|
||||
Spawn_ObserverCam(NSClientPlayer pl)
|
||||
{
|
||||
entity eTarget;
|
||||
entity eCamera = find(world, ::classname, "trigger_camera");
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
void Weapons_PickupNotify(base_player pl, int w);
|
||||
void Weapons_RefreshAmmo(base_player pl);
|
||||
void Weapons_SwitchBest(base_player pl, optional float skip);
|
||||
int Weapons_AddItem(base_player pl, int w, int startammo);
|
||||
void Weapons_RemoveItem(base_player pl, int w);
|
||||
void Weapons_PickupNotify(NSClientPlayer pl, int w);
|
||||
void Weapons_RefreshAmmo(NSClientPlayer pl);
|
||||
void Weapons_SwitchBest(NSClientPlayer pl, optional float skip);
|
||||
int Weapons_AddItem(NSClientPlayer pl, int w, int startammo);
|
||||
void Weapons_RemoveItem(NSClientPlayer pl, int w);
|
||||
void Weapons_InitItem(int w);
|
||||
void Weapons_UpdateAmmo(base_player pl, int a1, int a2, int a3);
|
||||
void Weapons_ReloadWeapon(base_player pl, .int mag, .int ammo, int max);
|
||||
void Weapon_DropCurrentWeapon(base_player pl);
|
||||
void Weapons_UpdateAmmo(NSClientPlayer pl, int a1, int a2, int a3);
|
||||
void Weapons_ReloadWeapon(NSClientPlayer pl, .int mag, .int ammo, int max);
|
||||
void Weapon_DropCurrentWeapon(NSClientPlayer pl);
|
||||
int Weapon_GetCount();
|
||||
int Weapon_GetBitID(int);
|
||||
|
|
|
@ -51,7 +51,7 @@ Tells the client if we picked up a NEW weapon item.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
Weapons_PickupNotify(base_player pl, int w)
|
||||
Weapons_PickupNotify(NSClientPlayer pl, int w)
|
||||
{
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_WEAPON_PICKUP);
|
||||
|
@ -68,7 +68,7 @@ Just calls updateammo() when available... maybe a bit redundant.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
Weapons_RefreshAmmo(base_player pl)
|
||||
Weapons_RefreshAmmo(NSClientPlayer pl)
|
||||
{
|
||||
if (g_weapons[pl.activeweapon].updateammo != __NULL__) {
|
||||
g_weapons[pl.activeweapon].updateammo((player)pl);
|
||||
|
@ -83,7 +83,7 @@ Switch to the 'best' weapon according to our weight system.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
Weapons_SwitchBest(base_player pl, optional float skip = 0)
|
||||
Weapons_SwitchBest(NSClientPlayer pl, optional float skip = 0)
|
||||
{
|
||||
entity oldself = self;
|
||||
self = pl;
|
||||
|
@ -120,7 +120,7 @@ returns TRUE if weapon pickup gets removed from this world
|
|||
=================
|
||||
*/
|
||||
int
|
||||
Weapons_AddItem(base_player pl, int w, int startammo)
|
||||
Weapons_AddItem(NSClientPlayer pl, int w, int startammo)
|
||||
{
|
||||
int value;
|
||||
|
||||
|
@ -202,7 +202,7 @@ Makes sure the item bit of g_items is reliably unset without errors.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
Weapons_RemoveItem(base_player pl, int w)
|
||||
Weapons_RemoveItem(NSClientPlayer pl, int w)
|
||||
{
|
||||
if (pl.activeweapon == w)
|
||||
pl.activeweapon = WEAPON_NONE;
|
||||
|
@ -236,7 +236,7 @@ Manipulates the .mag and .ammo field pointer with some basic reload logic.
|
|||
=================
|
||||
*/
|
||||
void
|
||||
Weapons_ReloadWeapon(base_player pl, .int mag, .int ammo, int max)
|
||||
Weapons_ReloadWeapon(NSClientPlayer pl, .int mag, .int ammo, int max)
|
||||
{
|
||||
int iNeed = max - pl.(mag);
|
||||
int iHave = pl.(ammo);
|
||||
|
@ -256,7 +256,7 @@ Weapon_DropCurrentWeapon
|
|||
=================
|
||||
*/
|
||||
void
|
||||
Weapon_DropCurrentWeapon(base_player pl)
|
||||
Weapon_DropCurrentWeapon(NSClientPlayer pl)
|
||||
{
|
||||
|
||||
static void DropWeapon_Enable(void)
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/* both base_player and base_spectator are based off this class */
|
||||
class
|
||||
base_client:NSSurfacePropEntity
|
||||
{
|
||||
vector origin_net;
|
||||
vector velocity_net;
|
||||
|
||||
NSXRSpace m_xrSpace;
|
||||
NSXRInput m_xrInputHead;
|
||||
NSXRInput m_xrInputLeft;
|
||||
NSXRInput m_xrInputRight;
|
||||
|
||||
void(void) base_client;
|
||||
|
||||
/* final input handling of the client */
|
||||
virtual void(void) ClientInput;
|
||||
|
||||
virtual void(void) PreFrame;
|
||||
virtual void(void) PostFrame;
|
||||
|
||||
virtual bool(void) IsFakeSpectator;
|
||||
virtual bool(void) IsRealSpectator;
|
||||
virtual bool(void) IsDead;
|
||||
virtual bool(void) IsPlayer;
|
||||
|
||||
virtual void(void) OnRemoveEntity;
|
||||
|
||||
#ifdef CLIENT
|
||||
/* gives the chance to override input variables before networking */
|
||||
virtual void(void) ClientInputFrame;
|
||||
|
||||
/* our camera when we're dead */
|
||||
virtual void(void) UpdateDeathcam;
|
||||
|
||||
/* run every frame before renderscene() */
|
||||
virtual float(void) predraw;
|
||||
#endif
|
||||
};
|
|
@ -1,84 +0,0 @@
|
|||
void
|
||||
base_client::OnRemoveEntity(void)
|
||||
{
|
||||
XR_Shutdown(this);
|
||||
}
|
||||
|
||||
void
|
||||
base_client::ClientInput(void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
base_client::PreFrame(void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
base_client::PostFrame(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
base_client::IsFakeSpectator(void)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
bool
|
||||
base_client::IsRealSpectator(void)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
bool
|
||||
base_client::IsDead(void)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
bool
|
||||
base_client::IsPlayer(void)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
base_client::ClientInputFrame(void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
base_client::UpdateDeathcam(void)
|
||||
{
|
||||
/* death cam */
|
||||
view_angles[2] = 45.0f;
|
||||
setproperty(VF_ORIGIN, pSeat->m_vecPredictedOrigin);
|
||||
setproperty(VF_CL_VIEWANGLES, view_angles);
|
||||
setproperty(VF_ANGLES, view_angles);
|
||||
}
|
||||
|
||||
float
|
||||
base_client::predraw(void)
|
||||
{
|
||||
return (PREDRAW_NEXT);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
base_client::base_client(void)
|
||||
{
|
||||
XR_Init(this);
|
||||
}
|
||||
|
||||
|
||||
float
|
||||
Client_InIntermission(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
return g_iIntermission;
|
||||
#else
|
||||
return (float)g_grMode.InIntermission();
|
||||
#endif
|
||||
}
|
|
@ -32,6 +32,13 @@
|
|||
#define ATTR_CHANGED(x) (x ##_net != x)
|
||||
#define VEC_CHANGED(x,y) (x ##_net[y] != x[y])
|
||||
|
||||
void
|
||||
_NSLog(string msg)
|
||||
{
|
||||
print(sprintf("%f %s\n", time, msg));
|
||||
}
|
||||
#define NSLog(x, ...) _NSLog(sprintf(x, __VA_ARGS__))
|
||||
|
||||
#include "sound.h"
|
||||
|
||||
#ifdef CLIENT
|
||||
|
@ -42,9 +49,9 @@
|
|||
|
||||
#include "../gs-entbase/shared/baseentity.h"
|
||||
#include "../xr/defs.h"
|
||||
#include "client.h"
|
||||
#include "spectator.h"
|
||||
#include "player.h"
|
||||
#include "NSClient.h"
|
||||
#include "NSClientSpectator.h"
|
||||
#include "NSClientPlayer.h"
|
||||
#include "damage.h"
|
||||
#include "flags.h"
|
||||
#include "entities.h"
|
||||
|
@ -73,13 +80,6 @@
|
|||
|
||||
#define printf(x, ...) print(sprintf(x, ...))
|
||||
|
||||
void
|
||||
_NSLog(string msg)
|
||||
{
|
||||
print(sprintf("%f %s\n", time, msg));
|
||||
}
|
||||
#define NSLog(x, ...) _NSLog(sprintf(x, ...))
|
||||
|
||||
const vector VEC_HULL_MIN = [-16,-16,-36];
|
||||
const vector VEC_HULL_MAX = [16,16,36];
|
||||
const vector VEC_CHULL_MIN = [-16,-16,-18];
|
||||
|
@ -184,9 +184,9 @@ __wrap string
|
|||
precache_model(string m)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
dprint(sprintf("^3Client precaching model ^7%s\n", m));
|
||||
NSLog("^3Client precaching model ^7%s\n", m);
|
||||
#else
|
||||
dprint(sprintf("^3Server precaching model ^7%s\n", m));
|
||||
NSLog("^3Server precaching model ^7%s\n", m);
|
||||
#endif
|
||||
return prior(m);
|
||||
}
|
||||
|
@ -291,4 +291,4 @@ string Util_FixModel(string mdl)
|
|||
mdl = substring(mdl, 1, -1);
|
||||
|
||||
return mdl;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#includelist
|
||||
client.qc
|
||||
spectator.qc
|
||||
NSClient.qc
|
||||
NSClientSpectator.qc
|
||||
pmove.qc
|
||||
pmove_custom.qc
|
||||
sound.qc
|
||||
math.qc
|
||||
player.qc
|
||||
NSClientPlayer.qc
|
||||
player_pmove.qc
|
||||
propdata.qc
|
||||
surfaceproperties.qc
|
||||
|
|
|
@ -215,9 +215,9 @@ const int CONTENTBIT_SKY = 0x80000000i; /* Q1BSP only! */
|
|||
* prefixes and limit our material-name to 12 chars for everything to be
|
||||
* identified correctly */
|
||||
string
|
||||
Materials_FixName(string tex_name)
|
||||
Materials_FixName(string old_name)
|
||||
{
|
||||
dprint(sprintf("^3Materials_FixName^7: %s > ", tex_name));
|
||||
string tex_name = old_name;
|
||||
|
||||
/* strip the first 2 chars when they're frame/random indicators */
|
||||
if (str2chr(tex_name, 0) == '-')
|
||||
|
@ -234,7 +234,7 @@ Materials_FixName(string tex_name)
|
|||
/* limit to 12 chars! */
|
||||
tex_name = substring(tex_name, 0, 12);
|
||||
|
||||
dprint(sprintf("%s\n", tex_name));
|
||||
NSLog("%s > %s", old_name, tex_name);
|
||||
|
||||
return tex_name;
|
||||
}
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
class
|
||||
base_player:spectator
|
||||
{
|
||||
#ifdef SERVER
|
||||
PREDICTED_INT_N(weaponframe);
|
||||
#else
|
||||
PREDICTED_INT(weaponframe);
|
||||
PREDICTED_FLOAT(vehicle_entnum);
|
||||
#endif
|
||||
PREDICTED_FLOAT(health);
|
||||
PREDICTED_FLOAT(armor);
|
||||
|
||||
PREDICTED_FLOAT_N(colormap);
|
||||
PREDICTED_FLOAT_N(gflags);
|
||||
PREDICTED_FLOAT(viewzoom);
|
||||
PREDICTED_VECTOR_N(view_ofs);
|
||||
PREDICTED_VECTOR(v_angle);
|
||||
PREDICTED_FLOAT_N(pmove_flags);
|
||||
|
||||
PREDICTED_FLOAT(w_attack_next);
|
||||
PREDICTED_FLOAT(w_idle_next);
|
||||
PREDICTED_FLOAT(teleport_time);
|
||||
PREDICTED_FLOAT(weapontime);
|
||||
PREDICTED_VECTOR(punchangle);
|
||||
|
||||
/* We can't use the default .items field, because FTE will assume
|
||||
* effects of some bits. Such as invisibility, quad, etc.
|
||||
* also, modders probably want 32 bits for items. */
|
||||
PREDICTED_INT(g_items);
|
||||
PREDICTED_FLOAT(activeweapon);
|
||||
|
||||
/* vehicle info */
|
||||
PREDICTED_ENT(vehicle);
|
||||
|
||||
/* these are NOT networked */
|
||||
int a_ammo1;
|
||||
int a_ammo2;
|
||||
int a_ammo3;
|
||||
|
||||
/* any mods that use hooks */
|
||||
entity hook;
|
||||
|
||||
void(void) base_player;
|
||||
|
||||
virtual void(void) ClientInput;
|
||||
|
||||
virtual void(void) PreFrame;
|
||||
virtual void(void) PostFrame;
|
||||
|
||||
virtual void(float) Physics_Fall;
|
||||
virtual void(void) Physics_Crouch;
|
||||
virtual void(void) Physics_Jump;
|
||||
virtual void(float) Physics_CheckJump;
|
||||
virtual void(void) Physics_SetViewParms;
|
||||
virtual void(void) Physics_WaterJump;
|
||||
virtual void(void) Physics_WaterMove;
|
||||
virtual float(void) Physics_MaxSpeed;
|
||||
virtual void(void) Physics_InputPreMove;
|
||||
virtual void(void) Physics_InputPostMove;
|
||||
virtual void(void) Physics_Run;
|
||||
|
||||
virtual bool(void) IsFakeSpectator;
|
||||
virtual bool(void) IsRealSpectator;
|
||||
virtual bool(void) IsDead;
|
||||
virtual bool(void) IsPlayer;
|
||||
|
||||
#ifdef CLIENT
|
||||
int sequence;
|
||||
|
||||
/* external weapon model */
|
||||
entity p_model;
|
||||
int p_hand_bone;
|
||||
int p_model_bone;
|
||||
float lastweapon;
|
||||
|
||||
virtual void(void) VehicleRelink;
|
||||
virtual void(void) OnRemoveEntity;
|
||||
virtual void(float, float) ReceiveEntity;
|
||||
virtual void(void) PredictPreFrame;
|
||||
virtual void(void) PredictPostFrame;
|
||||
virtual void(void) ClientInputFrame;
|
||||
#else
|
||||
int voted;
|
||||
int step;
|
||||
float step_time;
|
||||
|
||||
float underwater_time;
|
||||
float underwater_dmg;
|
||||
float pain_time;
|
||||
|
||||
entity last_used;
|
||||
|
||||
virtual void(float) Save;
|
||||
virtual void(string,string) Restore;
|
||||
virtual void(void) Respawn;
|
||||
virtual void(void) EvaluateEntity;
|
||||
virtual float(entity, float) SendEntity;
|
||||
|
||||
virtual void(void) Death;
|
||||
virtual void(void) MakePlayer;
|
||||
virtual void(void) MakeTempSpectator;
|
||||
|
||||
virtual void(void) InputUse_Down;
|
||||
virtual void(void) InputUse_Up;
|
||||
#endif
|
||||
};
|
|
@ -1,951 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
bool
|
||||
base_player::IsRealSpectator(void)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
bool
|
||||
base_player::IsDead(void)
|
||||
{
|
||||
if (health > 0)
|
||||
return (false);
|
||||
else
|
||||
return (true);
|
||||
}
|
||||
|
||||
bool
|
||||
base_player::IsPlayer(void)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
bool
|
||||
base_player::IsFakeSpectator(void)
|
||||
{
|
||||
if (GetFlags() & FL_FAKESPEC)
|
||||
return (true);
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
void
|
||||
base_player::PreFrame(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
/* this is where a game/mod would decide to add more prediction rollback
|
||||
* information. */
|
||||
PredictPreFrame();
|
||||
|
||||
if (vehicle) {
|
||||
NSVehicle veh = (NSVehicle)vehicle;
|
||||
veh.PredictPreFrame();
|
||||
}
|
||||
|
||||
/* run physics code for all the input frames which we've not heard back
|
||||
* from yet. This continues on in Player_ReceiveEntity! */
|
||||
for (int i = sequence + 1; i <= clientcommandframe; i++) {
|
||||
float flSuccess = getinputstate(i);
|
||||
if (flSuccess == FALSE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* don't do partial frames, aka incomplete input packets */
|
||||
if (input_timelength == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (i==clientcommandframe){
|
||||
CSQC_Input_Frame();
|
||||
}
|
||||
|
||||
/* this global is for our shared random number seed */
|
||||
input_sequence = i;
|
||||
|
||||
/* run our custom physics */
|
||||
Physics_Run();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
void
|
||||
base_player::PostFrame(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
/* give the game/mod a chance to roll back its values too */
|
||||
PredictPostFrame();
|
||||
setorigin(this, origin); /* update bounds */
|
||||
|
||||
if (vehicle) {
|
||||
NSVehicle veh = (NSVehicle)vehicle;
|
||||
veh.PredictPostFrame();
|
||||
setorigin(veh, veh.origin);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
base_player::ClientInput(void)
|
||||
{
|
||||
XR_InputFrame(this);
|
||||
|
||||
if (!Client_InIntermission() && IsFakeSpectator()) {
|
||||
spectator::ClientInput();
|
||||
SpectatorTrackPlayer();
|
||||
return;
|
||||
}
|
||||
|
||||
/* allow vehicles to prevent weapon logic from happening */
|
||||
if (vehicle) {
|
||||
NSVehicle veh = (NSVehicle)vehicle;
|
||||
|
||||
if (veh.PlayerInput)
|
||||
veh.PlayerInput();
|
||||
}
|
||||
|
||||
/* weapon/item logic of what the player controls */
|
||||
Game_Input((player)this);
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
base_player::VehicleRelink(void)
|
||||
{
|
||||
if (!vehicle_entnum)
|
||||
vehicle = __NULL__;
|
||||
else
|
||||
vehicle = findentity(world, ::entnum, vehicle_entnum);
|
||||
}
|
||||
|
||||
void
|
||||
base_player::OnRemoveEntity(void)
|
||||
{
|
||||
if (p_model)
|
||||
remove(p_model);
|
||||
|
||||
super::OnRemoveEntity();
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
base_player::ClientInputFrame
|
||||
|
||||
This is basically CSQC_Input_Frame! So games can override this as they please.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
base_player::ClientInputFrame(void)
|
||||
{
|
||||
if (IsFakeSpectator()) {
|
||||
spectator::ClientInputFrame();
|
||||
return;
|
||||
}
|
||||
|
||||
/* If we are inside a VGUI, don't let the client do stuff outside */
|
||||
if (VGUI_Active()) {
|
||||
input_impulse = 0;
|
||||
input_buttons = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* background maps have no input */
|
||||
if (serverkeyfloat("background") == 1)
|
||||
return;
|
||||
|
||||
if (pSeat->m_iInputAttack2 == TRUE) {
|
||||
input_buttons |= INPUT_BUTTON3;
|
||||
}
|
||||
|
||||
if (pSeat->m_iInputReload == TRUE) {
|
||||
input_buttons |= INPUT_BUTTON4;
|
||||
}
|
||||
|
||||
if (pSeat->m_iInputUse == TRUE) {
|
||||
input_buttons |= INPUT_BUTTON5;
|
||||
}
|
||||
|
||||
if (pSeat->m_iInputDuck == TRUE) {
|
||||
input_buttons |= INPUT_BUTTON8;
|
||||
}
|
||||
|
||||
/* The HUD needs more time */
|
||||
if (pSeat->m_iHUDWeaponSelected) {
|
||||
if ((input_buttons & INPUT_BUTTON0))
|
||||
HUD_DrawWeaponSelect_Trigger();
|
||||
else if ((input_buttons & INPUT_BUTTON3))
|
||||
pSeat->m_iHUDWeaponSelected = pSeat->m_flHUDWeaponSelectTime = 0;
|
||||
|
||||
pSeat->m_flInputBlockTime = time + 0.2;
|
||||
}
|
||||
|
||||
/* prevent accidental input packets */
|
||||
if (pSeat->m_flInputBlockTime > time) {
|
||||
input_buttons &= ~INPUT_BUTTON0;
|
||||
input_buttons &= ~INPUT_BUTTON3;
|
||||
pSeat->m_iInputAttack2 = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* some input overrides for XR */
|
||||
if (XR_Available(this)) {
|
||||
if (pSeat->m_bMoveForward) {
|
||||
input_movevalues[0] = 100;
|
||||
}
|
||||
|
||||
if (pSeat->m_iInputAttack) {
|
||||
input_buttons |= INPUT_BUTTON0;
|
||||
}
|
||||
}
|
||||
|
||||
/* compat*/
|
||||
if (input_impulse == 201) {
|
||||
sendevent("Spraylogo", "");
|
||||
}
|
||||
|
||||
if (pSeat->m_flCameraTime > time) {
|
||||
/* TODO: Supress the changing of view_angles/input_angles. */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
base_player::ReceiveEntity
|
||||
|
||||
Receive the generic client attributes from the server.
|
||||
If you want to override this, do not call this
|
||||
at the top of player::ReceiveEntity
|
||||
=================
|
||||
*/
|
||||
void
|
||||
base_player::ReceiveEntity(float new, float fl)
|
||||
{
|
||||
/* store which input sequence we're on, this helps us
|
||||
* later when we run prediction again between last/latest
|
||||
* servercommandframe */
|
||||
sequence = servercommandframe;
|
||||
|
||||
/* HACK: we need to make this more reliable */
|
||||
if (fl == UPDATE_ALL) {
|
||||
/* we respawned */
|
||||
gravity = 1.0f;
|
||||
}
|
||||
|
||||
if (fl & PLAYER_MODELINDEX) {
|
||||
modelindex = readshort();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_ORIGIN) {
|
||||
origin[0] = readcoord();
|
||||
origin[1] = readcoord();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_ORIGIN_Z)
|
||||
origin[2] = readcoord();
|
||||
if (fl & PLAYER_ANGLES_X) {
|
||||
v_angle[0] = readshort() / (32767 / 360);
|
||||
v_angle[1] = readshort() / (32767 / 360);
|
||||
v_angle[2] = readshort() / (32767 / 360);
|
||||
}
|
||||
if (fl & PLAYER_ANGLES_Y) {
|
||||
angles[0] = readshort() / (32767 / 360);
|
||||
angles[1] = readshort() / (32767 / 360);
|
||||
angles[2] = readshort() / (32767 / 360);
|
||||
}
|
||||
if (fl & PLAYER_COLORMAP)
|
||||
colormap = readbyte();
|
||||
|
||||
if (fl & PLAYER_VELOCITY) {
|
||||
velocity[0] = readcoord();
|
||||
velocity[1] = readcoord();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_VELOCITY_Z)
|
||||
velocity[2] = readcoord();
|
||||
if (fl & PLAYER_FLAGS) {
|
||||
flags = readfloat();
|
||||
gflags = readfloat();
|
||||
pmove_flags = readfloat();
|
||||
|
||||
/* mainly used for other players receiving us */
|
||||
if (flags & FL_CROUCHING)
|
||||
setsize(self, PHY_HULL_CROUCHED_MIN, PHY_HULL_CROUCHED_MAX);
|
||||
else
|
||||
setsize(self, PHY_HULL_MIN, PHY_HULL_MAX);
|
||||
}
|
||||
if (fl & PLAYER_WEAPON) {
|
||||
activeweapon = readbyte();
|
||||
weaponframe = (int)readbyte();
|
||||
}
|
||||
if (fl & PLAYER_ITEMS)
|
||||
g_items = (__variant)readfloat();
|
||||
if (fl & PLAYER_HEALTH)
|
||||
health = readbyte();
|
||||
if (fl & PLAYER_ARMOR)
|
||||
armor = readbyte();
|
||||
if (fl & PLAYER_MOVETYPE) {
|
||||
movetype = readbyte();
|
||||
solid = readbyte();
|
||||
}
|
||||
if (fl & PLAYER_VIEWOFS)
|
||||
view_ofs[2] = readfloat();
|
||||
|
||||
/* TO OPTIMISE */
|
||||
teleport_time = readfloat();
|
||||
viewzoom = readfloat();
|
||||
weapontime = readfloat();
|
||||
w_attack_next = readfloat();
|
||||
w_idle_next = readfloat();
|
||||
punchangle[0] = readfloat();
|
||||
punchangle[1] = readfloat();
|
||||
punchangle[2] = readfloat();
|
||||
vehicle_entnum = readentitynum();
|
||||
VehicleRelink();
|
||||
|
||||
/* FIXME: Make this temp spec only */
|
||||
spec_ent = readbyte();
|
||||
spec_mode = readbyte();
|
||||
spec_flags = readbyte();
|
||||
|
||||
PredictPreFrame();
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
base_player::PredictPreFrame
|
||||
|
||||
Save the state of the last server-confirmed attributes.
|
||||
If you want to override this, do not call this
|
||||
at the top of player::PredictPreFrame
|
||||
=================
|
||||
*/
|
||||
void
|
||||
base_player::PredictPreFrame(void)
|
||||
{
|
||||
/* base player attributes/fields we're going to roll back */
|
||||
SAVE_STATE(modelindex);
|
||||
SAVE_STATE(origin);
|
||||
SAVE_STATE(angles);
|
||||
SAVE_STATE(v_angle);
|
||||
SAVE_STATE(colormap);
|
||||
SAVE_STATE(velocity);
|
||||
SAVE_STATE(flags);
|
||||
SAVE_STATE(gflags);
|
||||
SAVE_STATE(pmove_flags);
|
||||
SAVE_STATE(activeweapon);
|
||||
SAVE_STATE(g_items);
|
||||
SAVE_STATE(health);
|
||||
SAVE_STATE(armor);
|
||||
SAVE_STATE(movetype);
|
||||
SAVE_STATE(solid);
|
||||
SAVE_STATE(view_ofs);
|
||||
|
||||
/* TO OPTIMISE */
|
||||
SAVE_STATE(teleport_time);
|
||||
SAVE_STATE(viewzoom);
|
||||
SAVE_STATE(weaponframe);
|
||||
SAVE_STATE(weapontime);
|
||||
SAVE_STATE(w_attack_next);
|
||||
SAVE_STATE(w_idle_next);
|
||||
SAVE_STATE(punchangle);
|
||||
SAVE_STATE(vehicle_entnum);
|
||||
|
||||
SAVE_STATE(spec_ent);
|
||||
SAVE_STATE(spec_mode);
|
||||
SAVE_STATE(spec_flags);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
base_player::PredictPostFrame
|
||||
|
||||
After running prediction on the client, roll back the values
|
||||
to the server's confirmed saved attributes from PredictPreFrame.
|
||||
If you want to override this, do not call this
|
||||
at the top of player::PredictPostFrame
|
||||
=================
|
||||
*/
|
||||
void
|
||||
base_player::PredictPostFrame(void)
|
||||
{
|
||||
/* finally roll the values back */
|
||||
ROLL_BACK(modelindex);
|
||||
ROLL_BACK(origin);
|
||||
ROLL_BACK(angles);
|
||||
ROLL_BACK(v_angle);
|
||||
ROLL_BACK(colormap);
|
||||
ROLL_BACK(velocity);
|
||||
ROLL_BACK(flags);
|
||||
ROLL_BACK(gflags);
|
||||
ROLL_BACK(pmove_flags);
|
||||
ROLL_BACK(activeweapon);
|
||||
ROLL_BACK(g_items);
|
||||
ROLL_BACK(health);
|
||||
ROLL_BACK(armor);
|
||||
ROLL_BACK(movetype);
|
||||
ROLL_BACK(solid);
|
||||
ROLL_BACK(view_ofs);
|
||||
|
||||
/* TO OPTIMISE */
|
||||
ROLL_BACK(teleport_time);
|
||||
ROLL_BACK(viewzoom);
|
||||
ROLL_BACK(weaponframe);
|
||||
ROLL_BACK(weapontime);
|
||||
ROLL_BACK(w_attack_next);
|
||||
ROLL_BACK(w_idle_next);
|
||||
ROLL_BACK(punchangle);
|
||||
ROLL_BACK(vehicle_entnum);
|
||||
|
||||
ROLL_BACK(spec_ent);
|
||||
ROLL_BACK(spec_mode);
|
||||
ROLL_BACK(spec_flags);
|
||||
}
|
||||
#else
|
||||
void
|
||||
base_player::Save(float handle)
|
||||
{
|
||||
SaveFloat(handle, "health", health);
|
||||
SaveFloat(handle, "armor", armor);
|
||||
SaveFloat(handle, "modelindex", modelindex);
|
||||
SaveVector(handle, "origin", origin);
|
||||
SaveVector(handle, "velocity", velocity);
|
||||
SaveVector(handle, "angles", angles);
|
||||
SaveFloat(handle, "colormap", colormap);
|
||||
SaveFloat(handle, "flags", flags);
|
||||
SaveFloat(handle, "gflags", gflags);
|
||||
SaveFloat(handle, "viewzoom", viewzoom);
|
||||
SaveVector(handle, "view_ofs", view_ofs);
|
||||
SaveVector(handle, "v_angle", v_angle);
|
||||
SaveVector(handle, "punchangle", punchangle);
|
||||
SaveFloat(handle, "movetype", movetype);
|
||||
SaveFloat(handle, "pmove_flags", pmove_flags);
|
||||
SaveFloat(handle, "w_attack_next", w_attack_next);
|
||||
SaveFloat(handle, "w_idle_next", w_idle_next);
|
||||
SaveFloat(handle, "teleport_time", teleport_time);
|
||||
SaveInt(handle, "weaponframe", weaponframe);
|
||||
SaveFloat(handle, "weapontime", weapontime);
|
||||
SaveInt(handle, "g_items", g_items);
|
||||
SaveFloat(handle, "activeweapon", activeweapon);
|
||||
SaveFloat(handle, "vehicle", num_for_edict(vehicle));
|
||||
}
|
||||
|
||||
void
|
||||
base_player::Restore(string strKey, string strValue)
|
||||
{
|
||||
switch (strKey) {
|
||||
case "health":
|
||||
health = ReadFloat(strValue);
|
||||
break;
|
||||
case "armor":
|
||||
armor = ReadFloat(strValue);
|
||||
break;
|
||||
case "modelindex":
|
||||
modelindex = ReadFloat(strValue);
|
||||
break;
|
||||
case "origin":
|
||||
origin = ReadVector(strValue);
|
||||
break;
|
||||
case "velocity":
|
||||
velocity = ReadVector(strValue);
|
||||
break;
|
||||
case "angles":
|
||||
angles = ReadVector(strValue);
|
||||
break;
|
||||
case "colormap":
|
||||
colormap = ReadFloat(strValue);
|
||||
break;
|
||||
case "flags":
|
||||
flags = ReadFloat(strValue);
|
||||
break;
|
||||
case "gflags":
|
||||
gflags = ReadFloat(strValue);
|
||||
break;
|
||||
case "view_ofs":
|
||||
view_ofs = ReadVector(strValue);
|
||||
break;
|
||||
case "v_angle":
|
||||
v_angle = ReadVector(strValue);
|
||||
break;
|
||||
case "punchangle":
|
||||
punchangle = ReadVector(strValue);
|
||||
break;
|
||||
case "movetype":
|
||||
movetype = ReadFloat(strValue);
|
||||
break;
|
||||
case "pmove_flags":
|
||||
pmove_flags = ReadFloat(strValue);
|
||||
break;
|
||||
case "w_attack_next":
|
||||
w_attack_next = ReadFloat(strValue);
|
||||
break;
|
||||
case "w_idle_next":
|
||||
w_idle_next = ReadFloat(strValue);
|
||||
break;
|
||||
case "teleport_time":
|
||||
teleport_time = ReadFloat(strValue);
|
||||
break;
|
||||
case "weaponframe":
|
||||
weaponframe = ReadInt(strValue);
|
||||
break;
|
||||
case "weapontime":
|
||||
weapontime = ReadFloat(strValue);
|
||||
break;
|
||||
case "g_items":
|
||||
g_items = ReadInt(strValue);
|
||||
break;
|
||||
case "activeweapon":
|
||||
activeweapon = ReadFloat(strValue);
|
||||
break;
|
||||
case "vehicle":
|
||||
vehicle = edict_num(ReadFloat(strValue));
|
||||
break;
|
||||
default:
|
||||
super::Restore(strKey, strValue);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
base_player::Respawn
|
||||
|
||||
it'd be pretty unfortunate if 'sv respawn_ents' or something called this
|
||||
=================
|
||||
*/
|
||||
void
|
||||
base_player::Respawn(void)
|
||||
{
|
||||
/* make sure nothing happens here */
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
base_player::MakeTempSpectator
|
||||
|
||||
This is what dead players in round matches become, or when we spawn
|
||||
for the first time before selecting a loadout or something.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
base_player::MakeTempSpectator(void)
|
||||
{
|
||||
classname = "player";
|
||||
flags = FL_CLIENT;
|
||||
SetModelindex(0);
|
||||
SetSolid(SOLID_NOT);
|
||||
SetMovetype(MOVETYPE_NOCLIP);
|
||||
SetTakedamage(DAMAGE_NO);
|
||||
maxspeed = 250;
|
||||
flags |= FL_FAKESPEC;
|
||||
max_health = health = 0;
|
||||
armor = 0;
|
||||
g_items = 0;
|
||||
activeweapon = 0;
|
||||
effects = 0;
|
||||
alpha = 0.0f;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
base_player::MakeDead
|
||||
|
||||
Sets all the appropriate attributes to make sure we're dead
|
||||
=================
|
||||
*/
|
||||
void
|
||||
base_player::Death(void)
|
||||
{
|
||||
classname = "player";
|
||||
health = max_health = 0;
|
||||
armor = 0;
|
||||
g_items = 0;
|
||||
activeweapon = 0;
|
||||
effects = 0;
|
||||
alpha = 1.0f;
|
||||
SetModelindex(0);
|
||||
SetMovetype(MOVETYPE_NONE);
|
||||
SetSolid(SOLID_NOT);
|
||||
SetTakedamage(DAMAGE_NO);
|
||||
viewzoom = 1.0;
|
||||
view_ofs = [0,0,0];
|
||||
vehicle = __NULL__;
|
||||
SetVelocity([0,0,0]);
|
||||
SetGravity(1.0f);
|
||||
customphysics = Empty;
|
||||
iBleeds = FALSE;
|
||||
forceinfokey(this, "*deaths", ftos(deaths));
|
||||
setsize(this, [0,0,0], [0,0,0]);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
base_player::MakePlayer
|
||||
|
||||
True participating player, can walk around and everything.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
base_player::MakePlayer(void)
|
||||
{
|
||||
classname = "player";
|
||||
flags = FL_CLIENT;
|
||||
health = max_health = 100;
|
||||
armor = 0;
|
||||
g_items = 0;
|
||||
activeweapon = 0;
|
||||
effects = 0;
|
||||
alpha = 1.0f;
|
||||
SetSolid(SOLID_SLIDEBOX);
|
||||
SetMovetype(MOVETYPE_WALK);
|
||||
SetTakedamage(DAMAGE_YES);
|
||||
SetVelocity([0,0,0]);
|
||||
viewzoom = 1.0;
|
||||
vehicle = __NULL__;
|
||||
SetGravity(1.0f);
|
||||
SendFlags = UPDATE_ALL;
|
||||
customphysics = Empty;
|
||||
iBleeds = TRUE;
|
||||
forceinfokey(this, "*deaths", ftos(deaths));
|
||||
SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
base_player::EvaluateEntity
|
||||
|
||||
Check which attributes have changed and flag the ones that did.
|
||||
If you want to override this, do not call this
|
||||
at the top of player::EvaluateEntity
|
||||
=================
|
||||
*/
|
||||
void
|
||||
base_player::EvaluateEntity(void)
|
||||
{
|
||||
SetSendFlags(PLAYER_KEEPALIVE);
|
||||
|
||||
if (ATTR_CHANGED(modelindex))
|
||||
SetSendFlags(PLAYER_MODELINDEX);
|
||||
|
||||
if (VEC_CHANGED(origin, 0))
|
||||
SetSendFlags(PLAYER_ORIGIN);
|
||||
|
||||
if (VEC_CHANGED(origin, 1))
|
||||
SetSendFlags(PLAYER_ORIGIN);
|
||||
|
||||
if (VEC_CHANGED(origin, 2))
|
||||
SetSendFlags(PLAYER_ORIGIN_Z);
|
||||
|
||||
if (VEC_CHANGED(v_angle, 0) || VEC_CHANGED(v_angle, 1) || VEC_CHANGED(v_angle, 2))
|
||||
SetSendFlags(PLAYER_ANGLES_X);
|
||||
|
||||
if (VEC_CHANGED(angles, 0) || VEC_CHANGED(angles, 1) || VEC_CHANGED(angles, 2))
|
||||
SetSendFlags(PLAYER_ANGLES_Y);
|
||||
|
||||
if (ATTR_CHANGED(colormap))
|
||||
SetSendFlags(PLAYER_COLORMAP);
|
||||
|
||||
if (VEC_CHANGED(velocity, 0))
|
||||
SetSendFlags(PLAYER_VELOCITY);
|
||||
|
||||
if (VEC_CHANGED(velocity, 1))
|
||||
SetSendFlags(PLAYER_VELOCITY);
|
||||
|
||||
if (VEC_CHANGED(velocity, 2))
|
||||
SetSendFlags(PLAYER_VELOCITY_Z);
|
||||
|
||||
if (ATTR_CHANGED(flags))
|
||||
SetSendFlags(PLAYER_FLAGS);
|
||||
|
||||
if (ATTR_CHANGED(gflags))
|
||||
SetSendFlags(PLAYER_FLAGS);
|
||||
|
||||
if (ATTR_CHANGED(pmove_flags))
|
||||
SetSendFlags(PLAYER_FLAGS);
|
||||
|
||||
if (ATTR_CHANGED(weaponframe))
|
||||
SetSendFlags(PLAYER_WEAPON);
|
||||
|
||||
if (ATTR_CHANGED(activeweapon))
|
||||
SetSendFlags(PLAYER_WEAPON);
|
||||
|
||||
if (ATTR_CHANGED(g_items))
|
||||
SetSendFlags(PLAYER_ITEMS);
|
||||
|
||||
if (ATTR_CHANGED(health))
|
||||
SetSendFlags(PLAYER_HEALTH);
|
||||
|
||||
if (ATTR_CHANGED(armor))
|
||||
SetSendFlags(PLAYER_ARMOR);
|
||||
|
||||
if (ATTR_CHANGED(movetype))
|
||||
SetSendFlags(PLAYER_MOVETYPE);
|
||||
|
||||
if (ATTR_CHANGED(solid))
|
||||
SetSendFlags(PLAYER_MOVETYPE);
|
||||
|
||||
if (ATTR_CHANGED(view_ofs))
|
||||
SetSendFlags(PLAYER_VIEWOFS);
|
||||
|
||||
SAVE_STATE(modelindex);
|
||||
SAVE_STATE(origin);
|
||||
SAVE_STATE(angles);
|
||||
SAVE_STATE(colormap);
|
||||
SAVE_STATE(velocity);
|
||||
SAVE_STATE(flags);
|
||||
SAVE_STATE(gflags);
|
||||
SAVE_STATE(pmove_flags);
|
||||
SAVE_STATE(activeweapon);
|
||||
SAVE_STATE(g_items);
|
||||
SAVE_STATE(health);
|
||||
SAVE_STATE(armor);
|
||||
SAVE_STATE(movetype);
|
||||
SAVE_STATE(solid);
|
||||
SAVE_STATE(view_ofs);
|
||||
|
||||
/* TO OPTIMISE */
|
||||
SAVE_STATE(teleport_time);
|
||||
SAVE_STATE(viewzoom);
|
||||
SAVE_STATE(weaponframe);
|
||||
SAVE_STATE(weapontime);
|
||||
SAVE_STATE(w_attack_next);
|
||||
SAVE_STATE(w_idle_next);
|
||||
SAVE_STATE(punchangle);
|
||||
SAVE_STATE(vehicle);
|
||||
|
||||
/* FIXME: Make this temp spec only */
|
||||
SAVE_STATE(spec_ent);
|
||||
SAVE_STATE(spec_mode);
|
||||
SAVE_STATE(spec_flags);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
base_player::SendEntity
|
||||
|
||||
Network any attributes that have been flagged for networking.
|
||||
If you want to override this, do not call this
|
||||
at the top of player::SendEntity
|
||||
=================
|
||||
*/
|
||||
float
|
||||
base_player::SendEntity(entity ePEnt, float fChanged)
|
||||
{
|
||||
/* really trying to get our moneys worth with 23 bits of mantissa */
|
||||
if (fChanged & PLAYER_MODELINDEX) {
|
||||
WriteShort(MSG_ENTITY, modelindex);
|
||||
}
|
||||
|
||||
/* if origin[0] changes, it's very likely [1] changes too, since
|
||||
* we rarely ever walk in a straight line on the world grid */
|
||||
if (fChanged & PLAYER_ORIGIN) {
|
||||
WriteCoord(MSG_ENTITY, origin[0]);
|
||||
WriteCoord(MSG_ENTITY, origin[1]);
|
||||
}
|
||||
/* the height doesn't change as much */
|
||||
if (fChanged & PLAYER_ORIGIN_Z)
|
||||
WriteCoord(MSG_ENTITY, origin[2]);
|
||||
|
||||
if (fChanged & PLAYER_ANGLES_X) {
|
||||
WriteShort(MSG_ENTITY, v_angle[0] * 32767 / 360);
|
||||
WriteShort(MSG_ENTITY, v_angle[1] * 32767 / 360);
|
||||
WriteShort(MSG_ENTITY, v_angle[2] * 32767 / 360);
|
||||
}
|
||||
if (fChanged & PLAYER_ANGLES_Y) {
|
||||
WriteShort(MSG_ENTITY, angles[0] * 32767 / 360);
|
||||
WriteShort(MSG_ENTITY, angles[1] * 32767 / 360);
|
||||
WriteShort(MSG_ENTITY, angles[2] * 32767 / 360);
|
||||
}
|
||||
if (fChanged & PLAYER_COLORMAP)
|
||||
WriteByte(MSG_ENTITY, colormap);
|
||||
|
||||
/* similar as with origin, we separate x/y from z */
|
||||
if (fChanged & PLAYER_VELOCITY) {
|
||||
WriteCoord(MSG_ENTITY, velocity[0]);
|
||||
WriteCoord(MSG_ENTITY, velocity[1]);
|
||||
}
|
||||
if (fChanged & PLAYER_VELOCITY_Z)
|
||||
WriteCoord(MSG_ENTITY, velocity[2]);
|
||||
|
||||
if (fChanged & PLAYER_FLAGS) {
|
||||
WriteFloat(MSG_ENTITY, flags);
|
||||
WriteFloat(MSG_ENTITY, gflags);
|
||||
WriteFloat(MSG_ENTITY, pmove_flags);
|
||||
}
|
||||
if (fChanged & PLAYER_WEAPON) {
|
||||
WriteByte(MSG_ENTITY, activeweapon);
|
||||
WriteByte(MSG_ENTITY, weaponframe);
|
||||
}
|
||||
|
||||
/* g_items is a proper integer, so we can't let WriteFloat truncate it (hence __variant) */
|
||||
if (fChanged & PLAYER_ITEMS)
|
||||
WriteFloat(MSG_ENTITY, (__variant)g_items);
|
||||
|
||||
/* only got byte precision, clamp to avoid weird values on the client-side */
|
||||
if (fChanged & PLAYER_HEALTH)
|
||||
WriteByte(MSG_ENTITY, bound(0, health, 255));
|
||||
if (fChanged & PLAYER_ARMOR)
|
||||
WriteByte(MSG_ENTITY, bound(0, armor, 255));
|
||||
|
||||
if (fChanged & PLAYER_MOVETYPE) {
|
||||
WriteByte(MSG_ENTITY, movetype);
|
||||
WriteByte(MSG_ENTITY, solid);
|
||||
}
|
||||
|
||||
/* the view_ofs[0] and [1] are rarely changed */
|
||||
if (fChanged & PLAYER_VIEWOFS)
|
||||
WriteFloat(MSG_ENTITY, view_ofs[2]);
|
||||
|
||||
/* TO OPTIMISE */
|
||||
WriteFloat(MSG_ENTITY, teleport_time);
|
||||
WriteFloat(MSG_ENTITY, viewzoom);
|
||||
WriteFloat(MSG_ENTITY, weapontime);
|
||||
WriteFloat(MSG_ENTITY, w_attack_next);
|
||||
WriteFloat(MSG_ENTITY, w_idle_next);
|
||||
WriteFloat(MSG_ENTITY, punchangle[0]);
|
||||
WriteFloat(MSG_ENTITY, punchangle[1]);
|
||||
WriteFloat(MSG_ENTITY, punchangle[2]);
|
||||
|
||||
if (vehicle)
|
||||
WriteEntity(MSG_ENTITY, vehicle);
|
||||
else
|
||||
WriteEntity(MSG_ENTITY, __NULL__);
|
||||
|
||||
/* FIXME: Make this fake spectator only. */
|
||||
WriteByte(MSG_ENTITY, spec_ent);
|
||||
WriteByte(MSG_ENTITY, spec_mode);
|
||||
WriteByte(MSG_ENTITY, spec_flags);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
_base_player_useworkaround
|
||||
|
||||
A wrapper to cleanly reset 'self' as to not mess up the QC VM
|
||||
====================
|
||||
*/
|
||||
void
|
||||
_base_player_useworkaround(entity eTarget)
|
||||
{
|
||||
eActivator = self;
|
||||
entity eOldSelf = self;
|
||||
self = eTarget;
|
||||
self.PlayerUse();
|
||||
self = eOldSelf;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
_base_player_useworkaround
|
||||
|
||||
A wrapper to cleanly reset 'self' as to not mess up the QC VM
|
||||
====================
|
||||
*/
|
||||
void
|
||||
_base_player_unuseworkaround(entity eTarget)
|
||||
{
|
||||
eActivator = self;
|
||||
entity eOldSelf = self;
|
||||
self = eTarget;
|
||||
if (self.PlayerUseUnpressed)
|
||||
self.PlayerUseUnpressed();
|
||||
self = eOldSelf;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
base_player:: InputUse_Down
|
||||
|
||||
Called when we hold down the +use button for the first time,
|
||||
looks for an entity that has the .PlayerUse field set to a function and calls it.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
base_player::InputUse_Down(void)
|
||||
{
|
||||
if (health <= 0) {
|
||||
return;
|
||||
} else if (!(flags & FL_USE_RELEASED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
vector vecSource;
|
||||
entity eRad;
|
||||
bool found_use = false;
|
||||
|
||||
makevectors(v_angle);
|
||||
vecSource = origin + view_ofs;
|
||||
traceline(vecSource, vecSource + (v_forward * 64), MOVE_EVERYTHING, this);
|
||||
|
||||
/* first see if we traced something head-on, else we'll findradius something */
|
||||
if (trace_ent.PlayerUse) {
|
||||
found_use = true;
|
||||
eRad = trace_ent;
|
||||
} else {
|
||||
/* find anything in a 8 unit radius, including certain non-solids (func_door, func_rot_button etc. */
|
||||
eRad = findradius(trace_endpos, 8);
|
||||
|
||||
/* loop through our chain and just pick the first valid one */
|
||||
while (eRad) {
|
||||
if (eRad.PlayerUse) {
|
||||
found_use = true;
|
||||
break;
|
||||
}
|
||||
eRad = eRad.chain;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: maybe eRad will return something in the future that'll suppress a successfull use? */
|
||||
if (eRad && found_use == true) {
|
||||
flags &= ~FL_USE_RELEASED;
|
||||
_base_player_useworkaround(eRad);
|
||||
last_used = eRad;
|
||||
|
||||
/* Some entities want to support Use spamming */
|
||||
if (!(flags & FL_USE_RELEASED)) {
|
||||
sound(this, CHAN_ITEM, "common/wpn_select.wav", 0.25, ATTN_IDLE);
|
||||
}
|
||||
} else {
|
||||
sound(this, CHAN_ITEM, "common/wpn_denyselect.wav", 0.25, ATTN_IDLE);
|
||||
flags &= ~FL_USE_RELEASED;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
base_player:: InputUse_Down
|
||||
|
||||
Called when we let go of the +use button
|
||||
=================
|
||||
*/
|
||||
void
|
||||
base_player::InputUse_Up(void)
|
||||
{
|
||||
if (!(flags & FL_USE_RELEASED)) {
|
||||
_base_player_unuseworkaround(last_used);
|
||||
last_used = world;
|
||||
flags |= FL_USE_RELEASED;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
base_player::base_player(void)
|
||||
{
|
||||
super::spectator();
|
||||
vehicle = __NULL__;
|
||||
}
|
|
@ -3,7 +3,7 @@ vector saved_input_movevalues;
|
|||
int saved_input_buttons;
|
||||
|
||||
void
|
||||
base_player::Physics_Fall(float flDownforce)
|
||||
NSClientPlayer::Physics_Fall(float flDownforce)
|
||||
{
|
||||
if (flDownforce > 580) {
|
||||
#ifdef SERVER
|
||||
|
@ -21,7 +21,7 @@ base_player::Physics_Fall(float flDownforce)
|
|||
}
|
||||
|
||||
void
|
||||
base_player::Physics_Crouch(void)
|
||||
NSClientPlayer::Physics_Crouch(void)
|
||||
{
|
||||
int iFixCrouch = FALSE;
|
||||
if (input_buttons & INPUT_BUTTON8) {
|
||||
|
@ -58,7 +58,7 @@ base_player::Physics_Crouch(void)
|
|||
|
||||
|
||||
void
|
||||
base_player::Physics_Jump(void)
|
||||
NSClientPlayer::Physics_Jump(void)
|
||||
{
|
||||
/* climb out of substances when underwater */
|
||||
if (waterlevel >= 2) {
|
||||
|
@ -77,7 +77,7 @@ base_player::Physics_Jump(void)
|
|||
|
||||
/* check if we're elligible to jump */
|
||||
void
|
||||
base_player::Physics_CheckJump(float premove)
|
||||
NSClientPlayer::Physics_CheckJump(float premove)
|
||||
{
|
||||
/* unset jump-key whenever it's not set */
|
||||
if (!(input_buttons & INPUT_BUTTON2)) {
|
||||
|
@ -107,7 +107,7 @@ base_player::Physics_CheckJump(float premove)
|
|||
|
||||
/* establish the right size and camera position */
|
||||
void
|
||||
base_player::Physics_SetViewParms(void)
|
||||
NSClientPlayer::Physics_SetViewParms(void)
|
||||
{
|
||||
if (flags & FL_CROUCHING) {
|
||||
mins = PHY_HULL_CROUCHED_MIN;
|
||||
|
@ -122,7 +122,7 @@ base_player::Physics_SetViewParms(void)
|
|||
}
|
||||
|
||||
void
|
||||
base_player::Physics_WaterJump(void)
|
||||
NSClientPlayer::Physics_WaterJump(void)
|
||||
{
|
||||
vector vStart;
|
||||
vector vEnd;
|
||||
|
@ -152,7 +152,7 @@ base_player::Physics_WaterJump(void)
|
|||
|
||||
/* handle your time underwater */
|
||||
void
|
||||
base_player::Physics_WaterMove(void)
|
||||
NSClientPlayer::Physics_WaterMove(void)
|
||||
{
|
||||
if (movetype == MOVETYPE_NOCLIP) {
|
||||
return;
|
||||
|
@ -219,13 +219,13 @@ base_player::Physics_WaterMove(void)
|
|||
}
|
||||
|
||||
float
|
||||
base_player::Physics_MaxSpeed(void)
|
||||
NSClientPlayer::Physics_MaxSpeed(void)
|
||||
{
|
||||
return (flags & FL_CROUCHING) ? 135 : 270;
|
||||
}
|
||||
|
||||
void
|
||||
base_player::Physics_InputPreMove(void)
|
||||
NSClientPlayer::Physics_InputPreMove(void)
|
||||
{
|
||||
NSVehicle veh = (NSVehicle)vehicle;
|
||||
|
||||
|
@ -256,7 +256,7 @@ base_player::Physics_InputPreMove(void)
|
|||
|
||||
/* timers get processed here after physics are run */
|
||||
void
|
||||
base_player::Physics_InputPostMove(void)
|
||||
NSClientPlayer::Physics_InputPostMove(void)
|
||||
{
|
||||
float punch;
|
||||
/* timers, these are predicted and shared across client and server */
|
||||
|
@ -279,7 +279,7 @@ base_player::Physics_InputPostMove(void)
|
|||
|
||||
/* the main physics routine, the head */
|
||||
void
|
||||
base_player::Physics_Run(void)
|
||||
NSClientPlayer::Physics_Run(void)
|
||||
{
|
||||
float flFallVel = (flags & FL_ONGROUND) ? 0 : -velocity[2];
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ PropData_ForModel(string modelname)
|
|||
fh = fopen(strcat(modelname, ".propdata"), FILE_READ);
|
||||
if (fh < 0) {
|
||||
g_propdata_count--;
|
||||
dprint(sprintf("Can't find propdata for model %s\n", modelname));
|
||||
NSLog("Can't find propdata for model %s", modelname);
|
||||
return -1;
|
||||
}
|
||||
while ((line = fgets(fh))) {
|
||||
|
|
|
@ -277,7 +277,7 @@ Sound_Precache(string shader)
|
|||
cache = (int)hash_get(g_hashsounds, shader, -1);
|
||||
|
||||
if (cache >= 0) {
|
||||
dprint(sprintf("^1Sound_Precache: shader %s already precached\n", shader));
|
||||
NSLog("^1Sound_Precache: shader %s already precached", shader);
|
||||
return cache;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
typedef enumflags
|
||||
{
|
||||
SPECFL_ORIGIN,
|
||||
SPECFL_VELOCITY,
|
||||
SPECFL_TARGET,
|
||||
SPECFL_MODE,
|
||||
SPECFL_FLAGS
|
||||
} spectatorFlags_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SPECMODE_FREE,
|
||||
SPECMODE_THIRDPERSON,
|
||||
SPECMODE_FIRSTPERSON,
|
||||
SPECMODE_OVERVIEW
|
||||
} spectatorMode_t;
|
||||
|
||||
typedef enumflags
|
||||
{
|
||||
SPECFLAG_BUTTON_RELEASED,
|
||||
};
|
||||
|
||||
class spectator:base_client
|
||||
{
|
||||
PREDICTED_FLOAT(spec_ent);
|
||||
PREDICTED_FLOAT(spec_flags);
|
||||
spectatorMode_t spec_mode; spectatorMode_t spec_mode_net;
|
||||
|
||||
vector spec_org;
|
||||
|
||||
int sequence;
|
||||
|
||||
void(void) spectator;
|
||||
|
||||
virtual void(void) ClientInput;
|
||||
|
||||
virtual void(void) InputNext;
|
||||
virtual void(void) InputPrevious;
|
||||
virtual void(void) InputMode;
|
||||
|
||||
virtual void(void) WarpToTarget;
|
||||
|
||||
virtual void(void) PreFrame;
|
||||
virtual void(void) PostFrame;
|
||||
virtual void(void) SpectatorTrackPlayer;
|
||||
|
||||
virtual bool(void) IsFakeSpectator;
|
||||
virtual bool(void) IsRealSpectator;
|
||||
virtual bool(void) IsDead;
|
||||
virtual bool(void) IsPlayer;
|
||||
|
||||
#ifdef SERVER
|
||||
virtual void(void) EvaluateEntity;
|
||||
virtual float(entity, float) SendEntity;
|
||||
virtual void(void) RunClientCommand;
|
||||
#else
|
||||
virtual void(void) ClientInputFrame;
|
||||
virtual void(float,float) ReceiveEntity;
|
||||
virtual float(void) predraw;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CLIENT
|
||||
void Spectator_ReadEntity(float new);
|
||||
#endif
|
|
@ -1,483 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
bool
|
||||
spectator::IsRealSpectator(void)
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
|
||||
bool
|
||||
spectator::IsDead(void)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
bool
|
||||
spectator::IsPlayer(void)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
bool
|
||||
spectator::IsFakeSpectator(void)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
void
|
||||
spectator::ClientInput(void)
|
||||
{
|
||||
if (input_buttons & INPUT_BUTTON0) {
|
||||
InputNext();
|
||||
} else if (input_buttons & INPUT_BUTTON3) {
|
||||
InputPrevious();
|
||||
} else if (input_buttons & INPUT_BUTTON2) {
|
||||
InputMode();
|
||||
} else {
|
||||
spec_flags &= ~SPECFLAG_BUTTON_RELEASED;
|
||||
}
|
||||
|
||||
input_buttons = 0;
|
||||
//crossprint(sprintf("%d %d %d\n", spec_ent, spec_mode, spec_flags));
|
||||
}
|
||||
|
||||
void
|
||||
spectator::WarpToTarget(void)
|
||||
{
|
||||
entity b = edict_num(spec_ent);
|
||||
|
||||
setorigin(this, b.origin);
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
float
|
||||
spectator::SendEntity(entity ePVSent, float flChangedFlags)
|
||||
{
|
||||
if (this != ePVSent) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (clienttype(ePVSent) != CLIENTTYPE_REAL) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
WriteByte(MSG_ENTITY, ENT_SPECTATOR);
|
||||
WriteFloat(MSG_ENTITY, flChangedFlags);
|
||||
|
||||
if (flChangedFlags & SPECFL_ORIGIN) {
|
||||
WriteCoord(MSG_ENTITY, origin[0]);
|
||||
WriteCoord(MSG_ENTITY, origin[1]);
|
||||
WriteCoord(MSG_ENTITY, origin[2]);
|
||||
}
|
||||
|
||||
if (flChangedFlags & SPECFL_VELOCITY) {
|
||||
WriteFloat(MSG_ENTITY, velocity[0]);
|
||||
WriteFloat(MSG_ENTITY, velocity[1]);
|
||||
WriteFloat(MSG_ENTITY, velocity[2]);
|
||||
}
|
||||
|
||||
if (flChangedFlags & SPECFL_TARGET)
|
||||
WriteByte(MSG_ENTITY, spec_ent);
|
||||
|
||||
if (flChangedFlags & SPECFL_MODE)
|
||||
WriteByte(MSG_ENTITY, spec_mode);
|
||||
|
||||
if (flChangedFlags & SPECFL_FLAGS)
|
||||
WriteByte(MSG_ENTITY, spec_flags);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
spectator::RunClientCommand(void)
|
||||
{
|
||||
runstandardplayerphysics(this);
|
||||
ClientInput();
|
||||
}
|
||||
|
||||
#else
|
||||
void
|
||||
spectator::ClientInputFrame(void)
|
||||
{
|
||||
/* If we are inside a VGUI, don't let the client do stuff outside */
|
||||
if (VGUI_Active()) {
|
||||
input_impulse = 0;
|
||||
input_buttons = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* background maps have no input */
|
||||
if (serverkeyfloat("background") == 1)
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
spectator::ReceiveEntity(float new, float fl)
|
||||
{
|
||||
if (new == FALSE) {
|
||||
/* Go through all the physics code between the last received frame
|
||||
* and the newest frame and keep the changes this time around instead
|
||||
* of rolling back, because we'll apply the new server-verified values
|
||||
* right after anyway. */
|
||||
/* FIXME: splitscreen */
|
||||
if (entnum == player_localentnum) {
|
||||
/* FIXME: splitscreen */
|
||||
pSeat = &g_seats[0];
|
||||
|
||||
for (int i = sequence+1; i <= servercommandframe; i++) {
|
||||
/* ...maybe the input state is too old? */
|
||||
if (!getinputstate(i)) {
|
||||
break;
|
||||
}
|
||||
input_sequence = i;
|
||||
runstandardplayerphysics(this);
|
||||
ClientInput();
|
||||
}
|
||||
|
||||
/* any differences in things that are read below are now
|
||||
* officially from prediction misses. */
|
||||
}
|
||||
}
|
||||
|
||||
/* seed for our prediction table */
|
||||
sequence = servercommandframe;
|
||||
|
||||
if (fl & SPECFL_ORIGIN) {
|
||||
origin[0] = readcoord();
|
||||
origin[1] = readcoord();
|
||||
origin[2] = readcoord();
|
||||
}
|
||||
|
||||
if (fl & SPECFL_VELOCITY) {
|
||||
velocity[0] = readfloat();
|
||||
velocity[1] = readfloat();
|
||||
velocity[2] = readfloat();
|
||||
}
|
||||
|
||||
if (fl & SPECFL_TARGET)
|
||||
spec_ent = readbyte();
|
||||
|
||||
if (fl & SPECFL_MODE)
|
||||
spec_mode = readbyte();
|
||||
|
||||
if (fl & SPECFL_FLAGS)
|
||||
spec_flags = readbyte();
|
||||
};
|
||||
float
|
||||
spectator::predraw(void)
|
||||
{
|
||||
addentity(this);
|
||||
return (PREDRAW_NEXT);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
spectator::InputNext(void)
|
||||
{
|
||||
if (spec_flags & SPECFLAG_BUTTON_RELEASED)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
float max_edict;
|
||||
|
||||
max_edict = serverkeyfloat("sv_playerslots");
|
||||
|
||||
spec_ent++;
|
||||
|
||||
if (spec_ent > max_edict)
|
||||
spec_ent = 1;
|
||||
|
||||
print(sprintf("edict: %d\n", spec_ent));
|
||||
#else
|
||||
float max_edict;
|
||||
float sep = spec_ent;
|
||||
float best = 0;
|
||||
base_client cl;
|
||||
|
||||
max_edict = serverkeyfloat("sv_playerslots");
|
||||
|
||||
for (float i = 1; i <= max_edict; i++) {
|
||||
entity f;
|
||||
|
||||
if (i <= sep && best == 0) {
|
||||
f = edict_num(i);
|
||||
if (f && f.classname == "player" && f != this) {
|
||||
cl = (base_client)f;
|
||||
if (!cl.IsFakeSpectator())
|
||||
best = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (i > sep) {
|
||||
f = edict_num(i);
|
||||
if (f && f.classname == "player" && f != this) {
|
||||
cl = (base_client)f;
|
||||
if (!cl.IsFakeSpectator()) {
|
||||
best = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (best == 0)
|
||||
return;
|
||||
|
||||
spec_ent = best;
|
||||
#endif
|
||||
spec_flags |= SPECFLAG_BUTTON_RELEASED;
|
||||
WarpToTarget();
|
||||
|
||||
if (spec_mode == SPECMODE_FREE)
|
||||
spec_mode = SPECMODE_THIRDPERSON;
|
||||
}
|
||||
|
||||
void
|
||||
spectator::InputPrevious(void)
|
||||
{
|
||||
if (spec_flags & SPECFLAG_BUTTON_RELEASED)
|
||||
return;
|
||||
#if 0
|
||||
float max_edict;
|
||||
|
||||
max_edict = serverkeyfloat("sv_playerslots");
|
||||
|
||||
spec_ent--;
|
||||
|
||||
if (spec_ent < 1)
|
||||
spec_ent = max_edict;
|
||||
#else
|
||||
float max_edict;
|
||||
float sep = spec_ent;
|
||||
float best = 0;
|
||||
base_client cl;
|
||||
|
||||
max_edict = serverkeyfloat("sv_playerslots");
|
||||
|
||||
for (float i = max_edict; i > 0; i--) {
|
||||
entity f;
|
||||
|
||||
/* remember the first valid one here */
|
||||
if (i >= sep && best == 0) {
|
||||
f = edict_num(i);
|
||||
|
||||
if (f && f.classname == "player") {
|
||||
cl = (base_client)f;
|
||||
|
||||
if (!cl.IsFakeSpectator())
|
||||
best = i;
|
||||
}
|
||||
}
|
||||
|
||||
/* find the first good one and take it */
|
||||
if (i < sep) {
|
||||
f = edict_num(i);
|
||||
if (f && f.classname == "player") {
|
||||
cl = (base_client)f;
|
||||
if (!cl.IsFakeSpectator()) {
|
||||
best = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (best == 0)
|
||||
return;
|
||||
|
||||
spec_ent = best;
|
||||
#endif
|
||||
|
||||
spec_flags |= SPECFLAG_BUTTON_RELEASED;
|
||||
|
||||
WarpToTarget();
|
||||
|
||||
if (spec_mode == SPECMODE_FREE)
|
||||
spec_mode = SPECMODE_THIRDPERSON;
|
||||
}
|
||||
|
||||
void
|
||||
spectator::InputMode(void)
|
||||
{
|
||||
if (spec_flags & SPECFLAG_BUTTON_RELEASED)
|
||||
return;
|
||||
|
||||
base_client f;
|
||||
#ifdef CLIENT
|
||||
f = (base_client)findfloat(world, ::entnum, spec_ent);
|
||||
#else
|
||||
f = (base_client)edict_num(spec_ent);
|
||||
#endif
|
||||
|
||||
if (f == this || f.classname != "player")
|
||||
spec_mode = SPECMODE_FREE;
|
||||
else {
|
||||
spec_mode++;
|
||||
|
||||
if (spec_mode > SPECMODE_FIRSTPERSON)
|
||||
spec_mode = SPECMODE_FREE;
|
||||
}
|
||||
|
||||
spec_flags |= SPECFLAG_BUTTON_RELEASED;
|
||||
}
|
||||
|
||||
void
|
||||
spectator::PreFrame(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
/* base player attributes/fields we're going to roll back */
|
||||
SAVE_STATE(origin);
|
||||
SAVE_STATE(velocity);
|
||||
SAVE_STATE(spec_ent);
|
||||
SAVE_STATE(spec_mode);
|
||||
SAVE_STATE(spec_flags);
|
||||
|
||||
/* run physics code for all the input frames which we've not heard back
|
||||
* from yet. This continues on in Player_ReceiveEntity! */
|
||||
for (int i = sequence + 1; i <= clientcommandframe; i++) {
|
||||
float flSuccess = getinputstate(i);
|
||||
if (flSuccess == FALSE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i==clientcommandframe){
|
||||
CSQC_Input_Frame();
|
||||
}
|
||||
|
||||
/* don't do partial frames, aka incomplete input packets */
|
||||
if (input_timelength == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* this global is for our shared random number seed */
|
||||
input_sequence = i;
|
||||
|
||||
/* run our custom physics */
|
||||
runstandardplayerphysics(this);
|
||||
ClientInput();
|
||||
}
|
||||
#endif
|
||||
|
||||
SpectatorTrackPlayer();
|
||||
}
|
||||
|
||||
void
|
||||
spectator::SpectatorTrackPlayer(void)
|
||||
{
|
||||
if (spec_mode == SPECMODE_THIRDPERSON || spec_mode == SPECMODE_FIRSTPERSON ) {
|
||||
base_client b;
|
||||
|
||||
#ifdef CLIENT
|
||||
b = (base_client)findfloat(world, ::entnum, spec_ent);
|
||||
#else
|
||||
b = (base_client)edict_num(spec_ent);
|
||||
#endif
|
||||
|
||||
if (b && b.classname == "player")
|
||||
if (b.IsFakeSpectator()) {
|
||||
b = 0;
|
||||
spec_mode = SPECMODE_FREE;
|
||||
InputNext();
|
||||
}
|
||||
|
||||
/* if the ent is dead... or not available in this current frame
|
||||
just warp to the last 'good' one */
|
||||
if (b) {
|
||||
setorigin(this, b.origin);
|
||||
spec_org = b.origin;
|
||||
} else {
|
||||
setorigin(this, spec_org);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
spectator::EvaluateEntity(void)
|
||||
{
|
||||
/* check for which values have changed in this frame
|
||||
and announce to network said changes */
|
||||
if (origin != origin_net)
|
||||
SetSendFlags(SPECFL_ORIGIN);
|
||||
|
||||
if (velocity != velocity_net)
|
||||
SetSendFlags(SPECFL_VELOCITY);
|
||||
|
||||
if (spec_ent != spec_ent_net)
|
||||
SetSendFlags(SPECFL_TARGET);
|
||||
|
||||
if (spec_mode != spec_mode_net)
|
||||
SetSendFlags(SPECFL_MODE);
|
||||
|
||||
if (spec_flags != spec_flags_net)
|
||||
SetSendFlags(SPECFL_FLAGS);
|
||||
|
||||
SAVE_STATE(origin);
|
||||
SAVE_STATE(velocity);
|
||||
SAVE_STATE(spec_ent);
|
||||
SAVE_STATE(spec_mode);
|
||||
SAVE_STATE(spec_flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
spectator::PostFrame(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
ROLL_BACK(origin);
|
||||
ROLL_BACK(velocity);
|
||||
ROLL_BACK(spec_ent);
|
||||
ROLL_BACK(spec_mode);
|
||||
ROLL_BACK(spec_flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
spectator::spectator(void)
|
||||
{
|
||||
super::base_client();
|
||||
modelindex = 0;
|
||||
flags = FL_CLIENT;
|
||||
SetSolid(SOLID_NOT);
|
||||
SetMovetype(MOVETYPE_NOCLIP);
|
||||
think = __NULL__;
|
||||
nextthink = 0.0f;
|
||||
maxspeed = 250;
|
||||
spec_ent = 0;
|
||||
spec_mode = 0;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
Spectator_ReadEntity(float new)
|
||||
{
|
||||
spectator spec = (spectator)self;
|
||||
|
||||
if (new || self.classname != "spectator") {
|
||||
spawnfunc_spectator();
|
||||
spec.classname = "spectator";
|
||||
spec.solid = SOLID_NOT;
|
||||
spec.drawmask = MASK_ENGINE;
|
||||
spec.customphysics = Empty;
|
||||
setsize(spec, [0,0,0], [0,0,0]);
|
||||
}
|
||||
|
||||
float flags = readfloat();
|
||||
spec.ReceiveEntity(new, flags);
|
||||
}
|
||||
#endif
|
|
@ -152,7 +152,7 @@ int CUIList::GetOffset(void)
|
|||
void CUIList::SetItemCount (int iCount)
|
||||
{
|
||||
if (!m_iItemCount) {
|
||||
dprint(sprintf("CUIList: Initialized with a maximum of %i entries\n", iCount));
|
||||
NSLog("CUIList: Initialized with a maximum of %i entries", iCount);
|
||||
m_iItemCount = iCount;
|
||||
m_strItems = memalloc(iCount * sizeof(string));
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ void CUIListBox::SetSize (vector vecSize)
|
|||
void CUIListBox::SetItemCount (int iCount)
|
||||
{
|
||||
if (!m_iItemCount) {
|
||||
dprint(sprintf("CUIListBox: Initialized with a maximum of %i entries\n", iCount));
|
||||
NSLog("CUIListBox: Initialized with a maximum of %i entries", iCount);
|
||||
m_iItemCount = iCount;
|
||||
m_strItems = memalloc(iCount * sizeof(string));
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ NSXRInput::SetParentSpace(NSXRSpace xrSpace)
|
|||
void
|
||||
NSXRInput::PrintInfo(void)
|
||||
{
|
||||
string deviceType;
|
||||
string deviceType = "UNKNOWN";
|
||||
|
||||
switch (m_inputType) {
|
||||
case XR_INPUT_HEAD:
|
||||
|
|
12
src/xr/xr.qc
12
src/xr/xr.qc
|
@ -30,7 +30,7 @@
|
|||
void
|
||||
XR_Init(entity ePlayer)
|
||||
{
|
||||
base_client pl = (base_client)ePlayer;
|
||||
NSClient pl = (NSClient)ePlayer;
|
||||
|
||||
print("--------- Initializing XR ----------\n");
|
||||
pl.m_xrSpace = spawn(NSXRSpace);
|
||||
|
@ -50,7 +50,7 @@ XR_Init(entity ePlayer)
|
|||
void
|
||||
XR_Shutdown(entity ePlayer)
|
||||
{
|
||||
base_client pl = (base_client)ePlayer;
|
||||
NSClient pl = (NSClient)ePlayer;
|
||||
remove(pl.m_xrInputHead);
|
||||
remove(pl.m_xrInputLeft);
|
||||
remove(pl.m_xrInputRight);
|
||||
|
@ -61,7 +61,7 @@ XR_Shutdown(entity ePlayer)
|
|||
void
|
||||
XR_UpdateView(entity ePlayer)
|
||||
{
|
||||
base_client pl = (base_client)ePlayer;
|
||||
NSClient pl = (NSClient)ePlayer;
|
||||
|
||||
/* not yet ready */
|
||||
if (!pl.m_xrSpace)
|
||||
|
@ -88,7 +88,7 @@ XR_UpdateView(entity ePlayer)
|
|||
void
|
||||
XR_InputFrame(entity ePlayer)
|
||||
{
|
||||
base_client pl = (base_client)ePlayer;
|
||||
NSClient pl = (NSClient)ePlayer;
|
||||
|
||||
/* not yet ready */
|
||||
if (!pl.m_xrSpace)
|
||||
|
@ -118,8 +118,8 @@ XR_InputFrame(entity ePlayer)
|
|||
bool
|
||||
XR_Available(entity ePlayer)
|
||||
{
|
||||
base_client pl = (base_client)ePlayer;
|
||||
NSClient pl = (NSClient)ePlayer;
|
||||
|
||||
/* we only care about the HMD... otherwise why even bother? */
|
||||
return pl.m_xrInputHead.IsAvailable();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue