Slight cleanups and cvar changes.
This commit is contained in:
parent
8652d02464
commit
9544c98f04
|
@ -78,7 +78,7 @@ Viewmodel_CalcBob(void)
|
||||||
pViewBob->m_flBob = bound(-8, flBob, 4);
|
pViewBob->m_flBob = bound(-8, flBob, 4);
|
||||||
|
|
||||||
/* make sure it's adjusted for scale */
|
/* make sure it's adjusted for scale */
|
||||||
pViewBob->m_flBob *= autocvar_r_viewmodelscale;
|
pViewBob->m_flBob *= autocvar_cg_viewmodelScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -91,7 +91,7 @@ Viewmodel_ApplyBob(entity gun)
|
||||||
|
|
||||||
/* apply the gun offset based on our bob */
|
/* apply the gun offset based on our bob */
|
||||||
gun.origin += [0,0,-1] + (v_forward * (pViewBob->m_flBob * 0.4))
|
gun.origin += [0,0,-1] + (v_forward * (pViewBob->m_flBob * 0.4))
|
||||||
+ (v_forward * autocvar_v_gunofs[0])
|
+ (v_forward * autocvar_cg_viewmodelOffset[0])
|
||||||
+ (v_right * autocvar_v_gunofs[1])
|
+ (v_right * autocvar_cg_viewmodelOffset[1])
|
||||||
+ (v_up * autocvar_v_gunofs[2]);
|
+ (v_up * autocvar_cg_viewmodelOffset[2]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,12 +27,11 @@ HLGameRules::LevelDecodeParms(NSClientPlayer pp)
|
||||||
g_landmarkpos[0] = parm1;
|
g_landmarkpos[0] = parm1;
|
||||||
g_landmarkpos[1] = parm2;
|
g_landmarkpos[1] = parm2;
|
||||||
g_landmarkpos[2] = parm3;
|
g_landmarkpos[2] = parm3;
|
||||||
pl.angles[0] = parm4;
|
|
||||||
pl.angles[1] = parm5;
|
pl.SetAngles([parm4, parm5, parm6]);
|
||||||
pl.angles[2] = parm6;
|
pl.SetVelocity([parm7, parm8, parm9]);
|
||||||
pl.velocity[0] = parm7;
|
|
||||||
pl.velocity[1] = parm8;
|
/* game specific stuff */
|
||||||
pl.velocity[2] = parm9;
|
|
||||||
pl.g_items = parm10;
|
pl.g_items = parm10;
|
||||||
pl.activeweapon = parm11;
|
pl.activeweapon = parm11;
|
||||||
pl.flags = parm64;
|
pl.flags = parm64;
|
||||||
|
@ -58,10 +57,11 @@ HLGameRules::LevelDecodeParms(NSClientPlayer pp)
|
||||||
pl.rpg_mag = parm29;
|
pl.rpg_mag = parm29;
|
||||||
pl.satchel_chg = parm30;
|
pl.satchel_chg = parm30;
|
||||||
|
|
||||||
if (pl.flags & FL_CROUCHING) {
|
/* reset bounds */
|
||||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
if (pl.HasFlags(FL_CROUCHING)) {
|
||||||
|
pl.SetSize(VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||||
} else {
|
} else {
|
||||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
pl.SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ HLGameRules::LevelChangeParms(NSClientPlayer pp)
|
||||||
parm7 = pl.velocity[0];
|
parm7 = pl.velocity[0];
|
||||||
parm8 = pl.velocity[1];
|
parm8 = pl.velocity[1];
|
||||||
parm9 = pl.velocity[2];
|
parm9 = pl.velocity[2];
|
||||||
parm64 = pl.flags;
|
parm64 = pl.GetFlags();
|
||||||
parm10 = pl.g_items;
|
parm10 = pl.g_items;
|
||||||
parm11 = pl.activeweapon;
|
parm11 = pl.activeweapon;
|
||||||
parm12 = pl.ammo_9mm;
|
parm12 = pl.ammo_9mm;
|
||||||
|
@ -132,14 +132,6 @@ HLGameRules::PlayerDisconnect(NSClientPlayer pl)
|
||||||
{
|
{
|
||||||
if (Plugin_PlayerDisconnect(pl) == FALSE)
|
if (Plugin_PlayerDisconnect(pl) == FALSE)
|
||||||
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
||||||
|
|
||||||
/* Make this unusable */
|
|
||||||
pl.solid = SOLID_NOT;
|
|
||||||
pl.movetype = MOVETYPE_NONE;
|
|
||||||
pl.modelindex = 0;
|
|
||||||
pl.health = 0;
|
|
||||||
pl.takedamage = 0;
|
|
||||||
pl.SendFlags = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -94,7 +94,7 @@ HLMultiplayerRules::PlayerDeath(NSClientPlayer pl)
|
||||||
|
|
||||||
/* death-counter */
|
/* death-counter */
|
||||||
pl.deaths++;
|
pl.deaths++;
|
||||||
forceinfokey(pl, "*deaths", ftos(pl.deaths));
|
pl.SetInfoKey("*deaths", ftos(pl.deaths));
|
||||||
|
|
||||||
/* update score-counter */
|
/* update score-counter */
|
||||||
if (pl.flags & FL_CLIENT || pl.flags & FL_MONSTER)
|
if (pl.flags & FL_CLIENT || pl.flags & FL_MONSTER)
|
||||||
|
@ -121,15 +121,14 @@ HLMultiplayerRules::PlayerDeath(NSClientPlayer pl)
|
||||||
|
|
||||||
/* now let's make the real client invisible */
|
/* now let's make the real client invisible */
|
||||||
pl.Death();
|
pl.Death();
|
||||||
pl.takedamage = DAMAGE_NO;
|
pl.SetTakedamage(DAMAGE_NO);
|
||||||
pl.gflags &= ~GF_FLASHLIGHT;
|
pl.gflags &= ~GF_FLASHLIGHT;
|
||||||
pl.gflags &= ~GF_EGONBEAM;
|
pl.gflags &= ~GF_EGONBEAM;
|
||||||
|
|
||||||
Sound_Play(pl, CHAN_AUTO, "player.die");
|
Sound_Play(pl, CHAN_AUTO, "player.die");
|
||||||
|
|
||||||
/* force respawn */
|
/* force respawn */
|
||||||
pl.think = PutClientInServer;
|
pl.ScheduleThink(PutClientInServer, 4.0f);
|
||||||
pl.nextthink = time + 4.0f;
|
|
||||||
|
|
||||||
/* have we gone over the fraglimit? */
|
/* have we gone over the fraglimit? */
|
||||||
CheckRules();
|
CheckRules();
|
||||||
|
@ -139,38 +138,57 @@ void
|
||||||
HLMultiplayerRules::PlayerSpawn(NSClientPlayer pp)
|
HLMultiplayerRules::PlayerSpawn(NSClientPlayer pp)
|
||||||
{
|
{
|
||||||
player pl = (player)pp;
|
player pl = (player)pp;
|
||||||
|
string playerModel;
|
||||||
/* this is where the mods want to deviate */
|
/* this is where the mods want to deviate */
|
||||||
entity spot;
|
entity spot;
|
||||||
|
|
||||||
pl.classname = "player";
|
pl.classname = "player";
|
||||||
pl.health = pl.max_health = 100;
|
pl.SetMaxHealth(100);
|
||||||
pl.takedamage = DAMAGE_YES;
|
pl.SetHealth(100);
|
||||||
|
pl.SetTakedamage(DAMAGE_YES);
|
||||||
pl.SetSolid(SOLID_SLIDEBOX);
|
pl.SetSolid(SOLID_SLIDEBOX);
|
||||||
pl.SetMovetype(MOVETYPE_WALK);
|
pl.SetMovetype(MOVETYPE_WALK);
|
||||||
pl.flags = FL_CLIENT;
|
pl.AddFlags(FL_CLIENT);
|
||||||
pl.viewzoom = 1.0;
|
pl.viewzoom = 1.0;
|
||||||
pl.model = "models/player.mdl";
|
|
||||||
string mymodel = infokey(pl, "model");
|
|
||||||
|
|
||||||
if (mymodel) {
|
/* player model selection */
|
||||||
mymodel = sprintf("models/player/%s/%s.mdl", mymodel, mymodel);
|
if (IsTeamplay() == true) {
|
||||||
if (whichpack(mymodel)) {
|
int teamCount = tokenizebyseparator(m_strTeamList, ";");
|
||||||
pl.model = mymodel;
|
int playerTeam = (int)pl.GetTeam();
|
||||||
|
|
||||||
|
/* not part of a team? pick one of the ones we have */
|
||||||
|
/* TODO: this should sort us into the lowest team */
|
||||||
|
if (playerTeam == 0) {
|
||||||
|
playerTeam = 1i + (int)floor(random(0, (float)teamCount)); /* teams start at 1 after all */
|
||||||
|
pl.SetTeam(playerTeam);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* assign our player model */
|
||||||
|
playerModel = sprintf("models/player/%s/%s.mdl", argv(playerTeam - 1i), argv(playerTeam - 1i));
|
||||||
|
} else {
|
||||||
|
/* interpret the 'model' InfoKey */
|
||||||
|
playerModel = pl.GetInfoKey("model");
|
||||||
|
|
||||||
|
if (playerModel) {
|
||||||
|
playerModel = sprintf("models/player/%s/%s.mdl", playerModel, playerModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setmodel(pl, pl.model);
|
|
||||||
|
|
||||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
/* fallback is always models/player.mdl for Half-Life */
|
||||||
pl.velocity = [0,0,0];
|
if not (whichpack(playerModel)) {
|
||||||
|
playerModel = "models/player.mdl";
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetModel(playerModel);
|
||||||
|
pl.SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
|
||||||
|
pl.ClearVelocity();
|
||||||
pl.gravity = __NULL__;
|
pl.gravity = __NULL__;
|
||||||
pl.frame = 1;
|
pl.SetFrame(1);
|
||||||
//pl.SendEntity = Player_SendEntity;
|
|
||||||
pl.SendFlags = UPDATE_ALL;
|
pl.SendFlags = UPDATE_ALL;
|
||||||
pl.customphysics = Empty;
|
|
||||||
pl.iBleeds = TRUE;
|
pl.iBleeds = TRUE;
|
||||||
forceinfokey(pl, "*spec", "0");
|
pl.SetInfoKey("*spec", "0");
|
||||||
forceinfokey(pl, "*dead", "0");
|
pl.SetInfoKey("*dead", "0");
|
||||||
forceinfokey(pl, "*deaths", ftos(pl.deaths));
|
pl.SetInfoKey("*deaths", ftos(pl.deaths));
|
||||||
|
|
||||||
LevelNewParms();
|
LevelNewParms();
|
||||||
LevelDecodeParms(pl);
|
LevelDecodeParms(pl);
|
||||||
|
@ -180,30 +198,11 @@ HLMultiplayerRules::PlayerSpawn(NSClientPlayer pp)
|
||||||
pl.activeweapon = WEAPON_GLOCK;
|
pl.activeweapon = WEAPON_GLOCK;
|
||||||
pl.glock_mag = 18;
|
pl.glock_mag = 18;
|
||||||
pl.ammo_9mm = 44;
|
pl.ammo_9mm = 44;
|
||||||
|
|
||||||
if (IsTeamplay() == true) {
|
|
||||||
int c = tokenizebyseparator(m_strTeamList, ";");
|
|
||||||
|
|
||||||
/* not part of a team? pick one of the ones we have */
|
|
||||||
/* TODO: this should sort us into the lowest team */
|
|
||||||
if (pl.team == 0) {
|
|
||||||
pl.team = 1 + floor(random(0, c));
|
|
||||||
forceinfokey(pl, "*team", sprintf("%d", pl.team));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* assign our player model */
|
|
||||||
mymodel = sprintf("models/player/%s/%s.mdl", argv(pl.team - 1), argv(pl.team - 1));
|
|
||||||
|
|
||||||
if (whichpack(mymodel))
|
|
||||||
pl.model = mymodel;
|
|
||||||
|
|
||||||
setmodel(pl, pl.model);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spot = Spawn_SelectRandom("info_player_deathmatch");
|
spot = Spawn_SelectRandom("info_player_deathmatch");
|
||||||
setorigin(pl, spot.origin);
|
pl.SetOrigin(spot.origin);
|
||||||
pl.angles = spot.angles;
|
pl.SetAngles(spot.angles);
|
||||||
Weapons_RefreshAmmo(pl);
|
Weapons_RefreshAmmo(pl);
|
||||||
|
|
||||||
Client_FixAngle(pl, pl.angles);
|
Client_FixAngle(pl, pl.angles);
|
||||||
|
@ -252,27 +251,26 @@ HLMultiplayerRules::HLMultiplayerRules(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CSEv_HLDM_Chooseteam_s(string teamname)
|
CSEv_HLDM_Chooseteam_s(string teamName)
|
||||||
{
|
{
|
||||||
HLGameRules rules = (HLGameRules)g_grMode;
|
HLGameRules rules = (HLGameRules)g_grMode;
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (!teamname)
|
if (!teamName)
|
||||||
return;
|
return;
|
||||||
if (rules.IsMultiplayer() == false)
|
if (rules.IsMultiplayer() == false)
|
||||||
return;
|
return;
|
||||||
if (rules.IsTeamplay() == false)
|
if (rules.IsTeamplay() == false)
|
||||||
return;
|
return;
|
||||||
if (pl.health <= 0)
|
if (pl.IsDead() == true)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
HLMultiplayerRules mprules = (HLMultiplayerRules)rules;
|
HLMultiplayerRules mprules = (HLMultiplayerRules)rules;
|
||||||
int c = tokenizebyseparator(mprules.m_strTeamList, ";");
|
int c = tokenizebyseparator(mprules.m_strTeamList, ";");
|
||||||
|
|
||||||
for (int i = 0; i < c; i++) {
|
for (int i = 0; i < c; i++) {
|
||||||
if (argv(i) == teamname) {
|
if (argv(i) == teamName) {
|
||||||
pl.team = (float)i + 1;
|
pl.SetTeam((float)i + 1);
|
||||||
forceinfokey(pl, "*team", sprintf("%d", pl.team));
|
|
||||||
Damage_Apply(pl, pl, 100, 0, DMG_SKIP_ARMOR);
|
Damage_Apply(pl, pl, 100, 0, DMG_SKIP_ARMOR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,6 +187,31 @@ string Weapons_GetPlayermodel(player, int);
|
||||||
void
|
void
|
||||||
player::UpdatePlayerAttachments(bool visible)
|
player::UpdatePlayerAttachments(bool visible)
|
||||||
{
|
{
|
||||||
|
/* draw the flashlight */
|
||||||
|
if (gflags & GF_FLASHLIGHT) {
|
||||||
|
vector src;
|
||||||
|
vector ang;
|
||||||
|
|
||||||
|
if (entnum != player_localentnum) {
|
||||||
|
src = origin + view_ofs;
|
||||||
|
ang = v_angle;
|
||||||
|
} else {
|
||||||
|
src = pSeat->m_vecPredictedOrigin + [0,0,-8];
|
||||||
|
ang = view_angles;
|
||||||
|
}
|
||||||
|
|
||||||
|
makevectors(ang);
|
||||||
|
traceline(src, src + (v_forward * 8096), MOVE_NORMAL, this);
|
||||||
|
|
||||||
|
if (serverkeyfloat("*bspversion") == BSPVER_HL) {
|
||||||
|
dynamiclight_add(trace_endpos + (v_forward * -2), 128, [1,1,1]);
|
||||||
|
} else {
|
||||||
|
float p = dynamiclight_add(src, 512, [1,1,1], 0, "textures/flashlight");
|
||||||
|
dynamiclight_set(p, LFIELD_ANGLES, ang);
|
||||||
|
dynamiclight_set(p, LFIELD_FLAGS, 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* FIXME: this needs to be incorporated and simplified, now that we can handle it all in-class */
|
/* FIXME: this needs to be incorporated and simplified, now that we can handle it all in-class */
|
||||||
if (!visible)
|
if (!visible)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue