#define SERVERFLAG_ALLOW_FULLBRIGHT 1
#define SERVERFLAG_TEAMPLAY 2
#define SERVERFLAG_PLAYERSTATS 4
+
+var vector autocvar_sv_player_maxs = '16 16 45';
+var vector autocvar_sv_player_mins = '-16 -16 -24';
+var vector autocvar_sv_player_viewoffset = '0 0 20';
+var vector autocvar_sv_player_crouch_maxs = '16 16 25';
+var vector autocvar_sv_player_crouch_mins = '-16 -16 -24';
+var vector autocvar_sv_player_crouch_viewoffset = '0 0 20';
+var vector autocvar_sv_player_headsize = '24 24 12';
+
+#define PL_VIEW_OFS autocvar_sv_player_viewoffset
+#define PL_MIN autocvar_sv_player_mins
+#define PL_MAX autocvar_sv_player_maxs
+#define PL_CROUCH_VIEW_OFS autocvar_sv_player_crouch_viewoffset
+#define PL_CROUCH_MIN autocvar_sv_player_crouch_mins
+#define PL_CROUCH_MAX autocvar_sv_player_crouch_maxs
+#define PL_HEAD autocvar_sv_player_headsize
+
+// helpers
+#define PL_VIEW_OFS_z autocvar_sv_player_viewoffset_z
+#define PL_MIN_z autocvar_sv_player_mins_z
+#define PL_MAX_z autocvar_sv_player_maxs_z
+#define PL_CROUCH_VIEW_OFS_z autocvar_sv_player_crouch_viewoffset_z
+#define PL_CROUCH_MIN_z autocvar_sv_player_mins_z
+#define PL_HEAD_x autocvar_sv_player_headsize_x
+#define PL_HEAD_y autocvar_sv_player_headsize_y
+#define PL_HEAD_z autocvar_sv_player_headsize_z
var float autocvar_chase_back;
.float pmove_flags;
+#define PMF_DUCKED 4
entity csqcplayer;
vector csqcplayer_origin, csqcplayer_velocity;
self.pmove_flags = player_pmflags;
}
+void CSQCPlayer_SetMinsMaxs()
+{
+ if(self.pmove_flags & PMF_DUCKED)
+ {
+ self.mins = PL_CROUCH_MIN;
+ self.maxs = PL_CROUCH_MAX;
+ self.view_ofs = PL_CROUCH_VIEW_OFS;
+ }
+ else
+ {
+ self.mins = PL_MIN;
+ self.maxs = PL_MAX;
+ self.view_ofs = PL_VIEW_OFS;
+ }
+}
+
void CSQCPlayer_SavePrediction()
{
player_pmflags = self.pmove_flags;
void CSQCPlayer_PredictTo(float endframe)
{
CSQCPlayer_Unpredict();
+ CSQCPlayer_SetMinsMaxs();
csqcplayer_status = CSQCPLAYERSTATUS_PREDICTED;
break;
}
runstandardplayerphysics(self);
-
+ CSQCPlayer_SetMinsMaxs();
csqcplayer_moveframe++;
}
if(servercommandframe == 0)
{
InterpolateOrigin_Do();
+ self.view_ofs = '0 0 1' * getstati(STAT_VIEWHEIGHT);
}
else
{
CSQCPlayer_SetPredictionError(o - self.origin);
self.origin = o;
self.velocity = v;
+
+ // get crouch state from the server
+ if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
+ self.pmove_flags &~= PMF_DUCKED;
+ else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
+ self.pmove_flags |= PMF_DUCKED;
+
CSQCPlayer_SavePrediction();
}
CSQCPlayer_PredictTo(clientcommandframe);
self = oldself;
- org = csqcplayer.origin + '0 0 1' * getstati(STAT_VIEWHEIGHT) + CSQCPlayer_GetPredictionError();
+ org = csqcplayer.origin + self.view_ofs + CSQCPlayer_GetPredictionError();
ang = R_SetView3fv(VF_ANGLES);
// simulate missing engine features
#define CSQCMODELS_HOOK_PREUPDATE
#define CSQCMODELS_HOOK_POSTUPDATE
#define CSQCMODELS_HOOK_PREDRAW
+
+// mod must define:
+//vector PL_MIN = ...;
+//vector PL_MAX = ...;
+//vector PL_VIEW_OFS = ...;
+//vector PL_CROUCH_MIN = ...;
+//vector PL_CROUCH_MAX = ...;
+//vector PL_CROUCH_VIEW_OFS = ...;
float autocvar_sv_maxairstrafespeed;
float autocvar_sv_maxspeed;
string autocvar_sv_motd;
-string autocvar_sv_player_crouch_maxs;
-string autocvar_sv_player_crouch_mins;
-string autocvar_sv_player_crouch_viewoffset;
-string autocvar_sv_player_headsize;
-string autocvar_sv_player_maxs;
-string autocvar_sv_player_mins;
-string autocvar_sv_player_viewoffset;
float autocvar_sv_player_jumpanim_minfall;
float autocvar_sv_precacheplayermodels;
float autocvar_sv_precacheweapons;
float MSG_INIT = 3; // initialization
float MSG_ENTITY = 5; // csqc
-vector PL_VIEW_OFS = '0 0 35';
-vector PL_MIN = '-16 -16 -24';
-vector PL_MAX = '16 16 45';
-vector PL_CROUCH_VIEW_OFS = '0 0 15';
-vector PL_CROUCH_MIN = '-16 -16 -24';
-vector PL_CROUCH_MAX = '16 16 25';
-
// Sajt - added these, just as constants. Not sure how you want them actually put in the game, but I just
// did this so at least they worked
// NOTE: instagib IS NOT compatible with rocket-arena, so make sure to prevent selecting both in a menu
}
}
-vector PL_VIEW_OFS;
-vector PL_MIN;
-vector PL_MAX;
-vector PL_HEAD;
-vector PL_CROUCH_VIEW_OFS;
-vector PL_CROUCH_MIN;
-vector PL_CROUCH_MAX;
-
float spawnpoint_nag;
void relocate_spawnpoint()
{
- PL_VIEW_OFS = stov(autocvar_sv_player_viewoffset);
- PL_MIN = stov(autocvar_sv_player_mins);
- PL_MAX = stov(autocvar_sv_player_maxs);
- PL_HEAD = stov(autocvar_sv_player_headsize);
- PL_CROUCH_VIEW_OFS = stov(autocvar_sv_player_crouch_viewoffset);
- PL_CROUCH_MIN = stov(autocvar_sv_player_crouch_mins);
- PL_CROUCH_MAX = stov(autocvar_sv_player_crouch_maxs);
-
// nudge off the floor
setorigin(self, self.origin + '0 0 1');