Base_Player: Network movetype and solid together.

This commit is contained in:
Marco Cawthorne 2022-04-26 14:10:17 -07:00
parent 9030ad82d9
commit 2e43e671a4
Signed by: eukara
GPG Key ID: C196CD8BA993248A
9 changed files with 58 additions and 46 deletions

View File

@ -415,7 +415,7 @@ CSQC_UpdateView(float w, float h, float focus)
GameText_Draw();
PointMessage_Draw();
if (!Client_IsSpectator(pl)) {
if (Client_IsSpectator(cl) == false) {
HUD_Draw();
} else {
HUD_DrawSpectator();

View File

@ -20,6 +20,7 @@ player::draw(void)
/* mouth flapping */
this.bonecontrol5 = getplayerkeyfloat(this.entnum - 1, "voiploudness");
#if 0
/* DEBUG! */
if (cvar("bonetest") == 1) {
this.bonecontrol1 = cvar("bonecontrol1");
@ -32,6 +33,7 @@ player::draw(void)
this.basesubblendfrac = cvar("basesubblendfrac");
this.basesubblend2frac = cvar("basesubblend2frac");
}
#endif
}
float
@ -71,8 +73,8 @@ player::predraw(void)
if (autocvar_cl_thirdperson == TRUE || !this_us) {
Voice_Draw3D(this);
Player_PreDraw(this, TRUE);
//if (p_model)
// addentity(p_model);
if (p_model)
addentity(p_model);
//addentity(this);
} else {
Player_PreDraw(this, FALSE);

View File

@ -32,8 +32,8 @@ Predict_EntityUpdate(player pl, float new)
pl.classname = "player";
if (pl.entnum == player_localentnum) {
pl.solid = SOLID_SLIDEBOX;
pl.movetype = MOVETYPE_NONE;
//pl.solid = SOLID_SLIDEBOX;
//pl.movetype = MOVETYPE_NONE;
pl.customphysics = Empty;
} else {
/* other players will act like missiles for interpolation purposes */

View File

@ -13,10 +13,10 @@ base_client:NSSurfacePropEntity
virtual void(void) PreFrame;
virtual void(void) PostFrame;
virtual int(void) IsFakeSpectator;
virtual int(void) IsRealSpectator;
virtual int(void) IsDead;
virtual int(void) IsPlayer;
virtual bool(void) IsFakeSpectator;
virtual bool(void) IsRealSpectator;
virtual bool(void) IsDead;
virtual bool(void) IsPlayer;
#ifdef CLIENT
/* gives the chance to override input variables before networking */

View File

@ -13,28 +13,28 @@ base_client::PostFrame(void)
{
}
int
bool
base_client::IsFakeSpectator(void)
{
return (FALSE);
return (false);
}
int
bool
base_client::IsRealSpectator(void)
{
return (FALSE);
return (false);
}
int
bool
base_client::IsDead(void)
{
return (FALSE);
return (false);
}
int
bool
base_client::IsPlayer(void)
{
return (FALSE);
return (false);
}
#ifdef CLIENT

View File

@ -75,10 +75,10 @@ base_player:spectator
virtual void(void) Physics_InputPostMove;
virtual void(void) Physics_Run;
virtual int(void) IsFakeSpectator;
virtual int(void) IsRealSpectator;
virtual int(void) IsDead;
virtual int(void) IsPlayer;
virtual bool(void) IsFakeSpectator;
virtual bool(void) IsRealSpectator;
virtual bool(void) IsDead;
virtual bool(void) IsPlayer;
#ifdef CLIENT
int sequence;

View File

@ -14,34 +14,34 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
int
bool
base_player::IsRealSpectator(void)
{
return (FALSE);
return (false);
}
int
bool
base_player::IsDead(void)
{
if (health > 0)
return (FALSE);
return (false);
else
return (TRUE);
return (true);
}
int
bool
base_player::IsPlayer(void)
{
return (FALSE);
return (false);
}
int
bool
base_player::IsFakeSpectator(void)
{
if (GetSolid() == SOLID_NOT)
return (TRUE);
return (true);
return (FALSE);
return (false);
}
void
@ -277,8 +277,10 @@ base_player::ReceiveEntity(float new, float fl)
health = readbyte();
if (fl & PLAYER_ARMOR)
armor = readbyte();
if (fl & PLAYER_MOVETYPE)
if (fl & PLAYER_MOVETYPE) {
movetype = readbyte();
solid = readbyte();
}
if (fl & PLAYER_VIEWOFS)
view_ofs[2] = readfloat();
@ -329,6 +331,7 @@ base_player::PredictPreFrame(void)
SAVE_STATE(health);
SAVE_STATE(armor);
SAVE_STATE(movetype);
SAVE_STATE(solid);
SAVE_STATE(view_ofs);
/* TO OPTIMISE */
@ -374,6 +377,7 @@ base_player::PredictPostFrame(void)
ROLL_BACK(health);
ROLL_BACK(armor);
ROLL_BACK(movetype);
ROLL_BACK(solid);
ROLL_BACK(view_ofs);
/* TO OPTIMISE */
@ -668,6 +672,9 @@ base_player::EvaluateEntity(void)
if (ATTR_CHANGED(movetype))
SetSendFlags(PLAYER_MOVETYPE);
if (ATTR_CHANGED(solid))
SetSendFlags(PLAYER_MOVETYPE);
if (ATTR_CHANGED(view_ofs))
SetSendFlags(PLAYER_VIEWOFS);
@ -684,6 +691,7 @@ base_player::EvaluateEntity(void)
SAVE_STATE(health);
SAVE_STATE(armor);
SAVE_STATE(movetype);
SAVE_STATE(solid);
SAVE_STATE(view_ofs);
/* TO OPTIMISE */
@ -770,8 +778,10 @@ base_player::SendEntity(entity ePEnt, float fChanged)
if (fChanged & PLAYER_ARMOR)
WriteByte(MSG_ENTITY, bound(0, armor, 255));
if (fChanged & PLAYER_MOVETYPE)
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)

View File

@ -44,10 +44,10 @@ class spectator:base_client
virtual void(void) PostFrame;
virtual void(void) SpectatorTrackPlayer;
virtual int(void) IsFakeSpectator;
virtual int(void) IsRealSpectator;
virtual int(void) IsDead;
virtual int(void) IsPlayer;
virtual bool(void) IsFakeSpectator;
virtual bool(void) IsRealSpectator;
virtual bool(void) IsDead;
virtual bool(void) IsPlayer;
#ifdef SERVER
virtual void(void) EvaluateEntity;

View File

@ -15,28 +15,28 @@
*/
int
bool
spectator::IsRealSpectator(void)
{
return (TRUE);
return (true);
}
int
bool
spectator::IsDead(void)
{
return (FALSE);
return (false);
}
int
bool
spectator::IsPlayer(void)
{
return (FALSE);
return (false);
}
int
bool
spectator::IsFakeSpectator(void)
{
return (FALSE);
return (false);
}
void
@ -470,7 +470,7 @@ Spectator_ReadEntity(float new)
if (new || self.classname != "spectator") {
spawnfunc_spectator();
spec.classname = "spectator";
spec.solid = SOLID_SLIDEBOX;
spec.solid = SOLID_NOT;
spec.drawmask = MASK_ENGINE;
spec.customphysics = Empty;
setsize(spec, [0,0,0], [0,0,0]);