mirror of
https://github.com/nzp-team/quakec.git
synced 2024-11-21 11:21:14 +00:00
SERVER: Add support for nzp_lockviewmodel builtin
This commit is contained in:
parent
6f43585c0f
commit
9ec5bf9de4
10 changed files with 35 additions and 23 deletions
|
@ -237,7 +237,7 @@ var struct guninventory_struct
|
|||
.float throw_delay;
|
||||
|
||||
//weapon frames
|
||||
void Set_W_Frame (float startframe, float endframe, float duration, float funccalledin, float animtype, void(optional float t) endanimfunc, string set_model, float dontstartnew, float side);
|
||||
void Set_W_Frame (float startframe, float endframe, float duration, float funccalledin, float animtype, void(optional float t) endanimfunc, string set_model, float dontstartnew, float side, float lock_viewmodel);
|
||||
.float weapon_animduration;
|
||||
.float weapon2_animduration;
|
||||
.float weapon_anim_type;
|
||||
|
|
|
@ -275,6 +275,8 @@ void (entity who)
|
|||
void (entity who, string name) nzp_setplayername = #505;
|
||||
void (entity who, float version) nzp_setdoubletapver = #506;
|
||||
void (entity who, float color, float duration, float type) nzp_screenflash = #507;
|
||||
void (entity who, float state) nzp_lockviewmodel = #508;
|
||||
|
||||
//
|
||||
// constants
|
||||
//
|
||||
|
|
|
@ -116,7 +116,7 @@ void DrinkPerk() {
|
|||
|
||||
self.knife_delay = self.reload_delay2 = self.fire_delay2 = self.fire_delay = self.reload_delay = 3 + time;
|
||||
W_HideCrosshair(self);
|
||||
Set_W_Frame (machine.weapon_animduration, machine.weapon2_animduration, 2.25, 0, PERK, GivePerk, machine.weapon2model, true, S_RIGHT);
|
||||
Set_W_Frame (machine.weapon_animduration, machine.weapon2_animduration, 2.25, 0, PERK, GivePerk, machine.weapon2model, true, S_RIGHT, true);
|
||||
sound(self, CHAN_ITEM, machine.oldmodel, 1, ATTN_NORM);
|
||||
|
||||
// Communicate to our engines that this client should display correct Double-Tap icon.
|
||||
|
|
|
@ -232,7 +232,7 @@ void(entity pap, entity buyer) PAP_UpgradeWeapon =
|
|||
|
||||
Weapon_RemoveWeapon(0);
|
||||
W_HideCrosshair(self);
|
||||
Set_W_Frame (0, 39, 2.0, 0, 0, W_PutOutHack, "models/machines/v_pap.mdl", true, S_BOTH);
|
||||
Set_W_Frame (0, 39, 2.0, 0, 0, W_PutOutHack, "models/machines/v_pap.mdl", true, S_BOTH, true);
|
||||
self.weapon2model = "";
|
||||
|
||||
#ifndef FTE
|
||||
|
|
|
@ -349,7 +349,7 @@ void () WallWeapon_TouchTrigger =
|
|||
entity tempz;
|
||||
tempz = self;
|
||||
self = other;
|
||||
Set_W_Frame(15, 30, 2.75, 0, 0, W_PlayTakeOut, "models/weapons/knife/v_bowie.mdl", false, S_BOTH);
|
||||
Set_W_Frame(15, 30, 2.75, 0, 0, W_PlayTakeOut, "models/weapons/knife/v_bowie.mdl", false, S_BOTH, true);
|
||||
self.bowie = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ void(entity client) LastStand_AssignWeapon =
|
|||
|
||||
float startframe = GetFrame(self.weapon,TAKE_OUT_START);
|
||||
float endframe = GetFrame(self.weapon,TAKE_OUT_END);
|
||||
Set_W_Frame (startframe, endframe, 0, 0, 0, SUB_Null, self.weaponmodel, false, S_BOTH);
|
||||
Set_W_Frame (startframe, endframe, 0, 0, 0, SUB_Null, self.weaponmodel, false, S_BOTH, false);
|
||||
|
||||
self = old_self;
|
||||
};
|
||||
|
@ -312,7 +312,7 @@ void(entity downed_client, entity revivee) LastStand_LinkRevivee =
|
|||
// Initiate an animation for morphine.
|
||||
entity old_self = self;
|
||||
self = revivee;
|
||||
Set_W_Frame (0, 21, 0, 0, SPRINT, SUB_Null, "models/weapons/morphine/v_morphine.mdl", false, S_RIGHT);
|
||||
Set_W_Frame (0, 21, 0, 0, SPRINT, SUB_Null, "models/weapons/morphine/v_morphine.mdl", false, S_RIGHT, true);
|
||||
self = old_self;
|
||||
};
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ void (float animation_type, void(optional float t) end_function, float playback_
|
|||
self.weapon2model = GetWeapon2Model(self.weapon);
|
||||
|
||||
W_AimOut();
|
||||
Set_W_Frame(start_frame, end_frame, playback_duration, 0, 0, end_function, GetWeaponModel(self.weapon, 0), false, S_BOTH);
|
||||
Set_W_Frame(start_frame, end_frame, playback_duration, 0, 0, end_function, GetWeaponModel(self.weapon, 0), false, S_BOTH, false);
|
||||
};
|
||||
|
||||
//
|
||||
|
|
|
@ -139,7 +139,7 @@ void() Betty_CheckForRelease =
|
|||
if(self.grenade_delay < time)
|
||||
self.grenade_delay = time + 0.05;
|
||||
self.isBuying = true;
|
||||
Set_W_Frame (13, 19, 0.3, 5, GRENADE, Betty_Drop, "models/weapons/grenade/v_betty.mdl", true, S_RIGHT);
|
||||
Set_W_Frame (13, 19, 0.3, 5, GRENADE, Betty_Drop, "models/weapons/grenade/v_betty.mdl", true, S_RIGHT, true);
|
||||
sound (self, CHAN_WEAPON, "sounds/weapons/grenade/throw.wav", 1, ATTN_NORM);
|
||||
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = time + 0.4;
|
||||
self.throw_delay = time + 0.9;
|
||||
|
@ -147,7 +147,7 @@ void() Betty_CheckForRelease =
|
|||
// Keep holding it
|
||||
else {
|
||||
self.isBuying = true;
|
||||
Set_W_Frame (13, 13, 0, 0, GRENADE, Betty_CheckForRelease, "models/weapons/grenade/v_betty.mdl", true, S_RIGHT);
|
||||
Set_W_Frame (13, 13, 0, 0, GRENADE, Betty_CheckForRelease, "models/weapons/grenade/v_betty.mdl", true, S_RIGHT, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ void() W_PrimeBetty =
|
|||
W_HideCrosshair(self);
|
||||
|
||||
// Play the "prime" animation for the betty viewmodel.
|
||||
Set_W_Frame (0, 13, 1, 0, GRENADE, Betty_CheckForRelease, "models/weapons/grenade/v_betty.mdl", true, S_RIGHT);
|
||||
Set_W_Frame (0, 13, 1, 0, GRENADE, Betty_CheckForRelease, "models/weapons/grenade/v_betty.mdl", true, S_RIGHT, true);
|
||||
|
||||
// Subtract a betty from our inventory, set up delays, prevent use spam.
|
||||
self.secondary_grenades -= 1;
|
||||
|
|
|
@ -43,7 +43,7 @@ void() ContinueRun =
|
|||
modelname = GetWeaponModel(self.weapon, 0);
|
||||
} else
|
||||
modelname = "";
|
||||
Set_W_Frame (startframe, endframe, 0, 0, SPRINT, ContinueRun, modelname, false, S_BOTH);
|
||||
Set_W_Frame (startframe, endframe, 0, 0, SPRINT, ContinueRun, modelname, false, S_BOTH, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -192,7 +192,7 @@ float(string path) model_should_hide_weapon2 =
|
|||
return false;
|
||||
}
|
||||
|
||||
void Set_W_Frame (float startframe, float endframe, float duration, float funccalledin, float animtype, void(optional float t) endanimfunc, string set_model, float dontstartnew, float side) =
|
||||
void Set_W_Frame (float startframe, float endframe, float duration, float funccalledin, float animtype, void(optional float t) endanimfunc, string set_model, float dontstartnew, float side, float lock_viewmodel) =
|
||||
{
|
||||
float math, reversed;
|
||||
|
||||
|
@ -248,4 +248,14 @@ void Set_W_Frame (float startframe, float endframe, float duration, float funcca
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef FTE
|
||||
|
||||
// For source ports where the viewmodel is able to be manipulated based on the camera
|
||||
// position, we explicitly communicate to those clients to prohibit that with
|
||||
// lock_viewmodel whenever we are drinking a Perk-A-Cola, meleeing, etc.
|
||||
nzp_lockviewmodel(self, lock_viewmodel);
|
||||
|
||||
#endif // FTE
|
||||
|
||||
}
|
||||
|
|
|
@ -358,7 +358,7 @@ void() ContinueReload = //Special reloads
|
|||
delay *= 0.5;
|
||||
}
|
||||
self.reload_delay = time + delay;
|
||||
Set_W_Frame (startframe, endframe, delay, 0, RELOAD, endanimfunc, modelname, false, S_RIGHT);
|
||||
Set_W_Frame (startframe, endframe, delay, 0, RELOAD, endanimfunc, modelname, false, S_RIGHT, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -378,7 +378,7 @@ void(float side) W_AdvanceAnim =
|
|||
|
||||
self.reload_delay = self.reload_delay2 = delay + time;
|
||||
|
||||
Set_W_Frame (startframe, endframe, delay, reloadcancelframe, RELOAD, W_Give_Ammo, modelname, false, side);
|
||||
Set_W_Frame (startframe, endframe, delay, reloadcancelframe, RELOAD, W_Give_Ammo, modelname, false, side, false);
|
||||
}
|
||||
|
||||
void(float side) W_Reload =
|
||||
|
@ -490,7 +490,7 @@ void(float side) W_Reload =
|
|||
self.reload_delay2 = delay + time;
|
||||
}
|
||||
|
||||
Set_W_Frame (startframe, endframe, delay, reloadcancelframe, RELOAD, endanimfunc, modelname, false, side);
|
||||
Set_W_Frame (startframe, endframe, delay, reloadcancelframe, RELOAD, endanimfunc, modelname, false, side, false);
|
||||
}
|
||||
|
||||
if (self.weapon != W_TRENCH) {
|
||||
|
@ -544,7 +544,7 @@ void () W_LoadAmmo =
|
|||
if (self.perks & P_DOUBLE)
|
||||
delay *= 0.66;
|
||||
|
||||
Set_W_Frame (startframe, endframe, delay, reloadcancelframe, FIRE, W_LoadAmmoDone, modelname, false, S_RIGHT);
|
||||
Set_W_Frame (startframe, endframe, delay, reloadcancelframe, FIRE, W_LoadAmmoDone, modelname, false, S_RIGHT, false);
|
||||
self.fire_delay = delay + time;
|
||||
}
|
||||
}
|
||||
|
@ -1137,10 +1137,10 @@ void(float side) W_Fire =
|
|||
|
||||
if (self.weapon == W_GUT || self.weapon == W_KAR_SCOPE || self.weapon == W_TRENCH || self.weapon == W_KAR || self.weapon == W_ARMAGEDDON || self.weapon == W_HEADCRACKER || self.weapon == W_SPRING || self.weapon == W_PULVERIZER)
|
||||
{
|
||||
Set_W_Frame (startframe, endframe, delay, 0, FIRE, W_LoadAmmo, modelname, FALSE, side);
|
||||
Set_W_Frame (startframe, endframe, delay, 0, FIRE, W_LoadAmmo, modelname, FALSE, side, false);
|
||||
self.NeedLoad = true;
|
||||
} else {
|
||||
Set_W_Frame (startframe, endframe, delay, 0, FIRE, WeaponCore_CheckForReload, modelname, FALSE, side);
|
||||
Set_W_Frame (startframe, endframe, delay, 0, FIRE, WeaponCore_CheckForReload, modelname, FALSE, side, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1281,7 +1281,7 @@ void() WeaponCore_Melee =
|
|||
// Apply camera punch, and begin playback.
|
||||
self.punchangle_x = -5;
|
||||
self.punchangle_y = -10;
|
||||
Set_W_Frame (start_frame, end_frame, anim_duration, 0, KNIFE, end_func, model_path, false, S_RIGHT);
|
||||
Set_W_Frame (start_frame, end_frame, anim_duration, 0, KNIFE, end_func, model_path, false, S_RIGHT, true);
|
||||
self.knife_delay = anim_duration + time;
|
||||
|
||||
// Now apply the lunge velocity, but only if we're Standing.
|
||||
|
@ -1420,7 +1420,7 @@ void() W_ThrowGrenade =
|
|||
startframe = GetFrame(self.weapon,TAKE_OUT_START);
|
||||
endframe = GetFrame(self.weapon,TAKE_OUT_END);
|
||||
modelname = GetWeaponModel(self.weapon, 0);
|
||||
Set_W_Frame (startframe, endframe, 0, 0, 0, ReturnWeaponModel, modelname, false, S_BOTH);
|
||||
Set_W_Frame (startframe, endframe, 0, 0, 0, ReturnWeaponModel, modelname, false, S_BOTH, false);
|
||||
|
||||
SetUpdate(self, UT_HUD, 6, 0, 0);
|
||||
}
|
||||
|
@ -1438,7 +1438,7 @@ void() checkHold =
|
|||
self.grenade_delay = time + 0.05;
|
||||
|
||||
self.isBuying = true;
|
||||
Set_W_Frame (3, 6, 0, 5, GRENADE, W_ThrowGrenade, "models/weapons/grenade/v_grenade.mdl", true, S_RIGHT);
|
||||
Set_W_Frame (3, 6, 0, 5, GRENADE, W_ThrowGrenade, "models/weapons/grenade/v_grenade.mdl", true, S_RIGHT, true);
|
||||
sound (self, CHAN_WEAPON, "sounds/weapons/grenade/throw.wav", 1, ATTN_NORM);
|
||||
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = time + 0.4;
|
||||
self.throw_delay = time + 0.9;
|
||||
|
@ -1457,7 +1457,7 @@ void() checkHold =
|
|||
grenade_pulse(self);
|
||||
}
|
||||
|
||||
Set_W_Frame (2, 2, 0, 0, GRENADE, checkHold, "models/weapons/grenade/v_grenade.mdl", true, S_RIGHT);
|
||||
Set_W_Frame (2, 2, 0, 0, GRENADE, checkHold, "models/weapons/grenade/v_grenade.mdl", true, S_RIGHT, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1471,7 +1471,7 @@ void() W_Grenade =
|
|||
W_SprintStop();
|
||||
|
||||
W_HideCrosshair(self);
|
||||
Set_W_Frame (0, 2, 0.6, 0, GRENADE, checkHold, "models/weapons/grenade/v_grenade.mdl", true, S_RIGHT);
|
||||
Set_W_Frame (0, 2, 0.6, 0, GRENADE, checkHold, "models/weapons/grenade/v_grenade.mdl", true, S_RIGHT, true);
|
||||
sound (self, CHAN_WEAPON, "sounds/weapons/grenade/prime.wav", 1, ATTN_NORM);
|
||||
self.primary_grenades -= 1;
|
||||
self.reload_delay2 = self.fire_delay2 = self.throw_delay = self.reload_delay = self.fire_delay = time + 6;
|
||||
|
|
Loading…
Reference in a new issue