mirror of
https://github.com/nzp-team/quakec.git
synced 2025-01-31 13:40:52 +00:00
SERVER: Add new utility for streamlined Viewmodel animations, start integrating; add support for 'first raise'
This commit is contained in:
parent
316aba63e7
commit
0e3a08206f
4 changed files with 91 additions and 109 deletions
|
@ -112,15 +112,12 @@ void GivePerk(optional float p) {
|
||||||
GiveAchievement(6, self);
|
GiveAchievement(6, self);
|
||||||
|
|
||||||
sound_perk_delay = time + 4.5;
|
sound_perk_delay = time + 4.5;
|
||||||
|
|
||||||
self.isBuying = false;
|
self.isBuying = false;
|
||||||
string modelname = GetWeaponModel(self.weapon, 0);
|
|
||||||
|
|
||||||
local float startframe = GetFrame(self.weapon,TAKE_OUT_START);
|
|
||||||
local float endframe = GetFrame(self.weapon,TAKE_OUT_END);
|
|
||||||
|
|
||||||
self.weaponskin = backupWepSkin;
|
self.weaponskin = backupWepSkin;
|
||||||
self.perk_delay = self.fire_delay;
|
self.perk_delay = self.fire_delay;
|
||||||
Set_W_Frame (startframe, endframe, 0, 0, 0, SUB_Null, modelname, false, S_BOTH);
|
|
||||||
|
Weapon_PlayViewModelAnimation(ANIM_TAKE_OUT, SUB_Null, 0);
|
||||||
|
|
||||||
SetPerk(self, self.perks);
|
SetPerk(self, self.perks);
|
||||||
}
|
}
|
||||||
|
@ -1464,8 +1461,6 @@ void() mystery_box_tp_spot =
|
||||||
void() mystery_touch =
|
void() mystery_touch =
|
||||||
{
|
{
|
||||||
entity tempe;
|
entity tempe;
|
||||||
float startframe, endframe;
|
|
||||||
string modelname;
|
|
||||||
|
|
||||||
if (other.classname != "player" || other.downed)
|
if (other.classname != "player" || other.downed)
|
||||||
return;
|
return;
|
||||||
|
@ -1581,10 +1576,12 @@ void() mystery_touch =
|
||||||
sound(self, 0,"sounds/misc/ching.wav", 1, 1);
|
sound(self, 0,"sounds/misc/ching.wav", 1, 1);
|
||||||
tempe = self;
|
tempe = self;
|
||||||
self = other;
|
self = other;
|
||||||
startframe = GetFrame(self.weapon,TAKE_OUT_START);
|
|
||||||
endframe = GetFrame(self.weapon,TAKE_OUT_END);
|
if (GetFrame(self.weapon, FIRST_TAKE_START) != 0)
|
||||||
modelname = GetWeaponModel(self.weapon, 0);
|
Weapon_PlayViewModelAnimation(ANIM_FIRST_TAKE, SUB_Null, 0);
|
||||||
Set_W_Frame (startframe, endframe, 0, 0, 0, SUB_Null, modelname, false, S_BOTH);//FIXME
|
else
|
||||||
|
Weapon_PlayViewModelAnimation(ANIM_TAKE_OUT, SUB_Null, 0);
|
||||||
|
|
||||||
SwitchWeapon(self.weapon);
|
SwitchWeapon(self.weapon);
|
||||||
self = tempe;
|
self = tempe;
|
||||||
remove (self.boxweapon);
|
remove (self.boxweapon);
|
||||||
|
@ -1842,10 +1839,6 @@ void touch_pap() {
|
||||||
centerprint (other, STR_NOTENOUGHPOINTS);
|
centerprint (other, STR_NOTENOUGHPOINTS);
|
||||||
}
|
}
|
||||||
} else if (self.papState == 2) {
|
} else if (self.papState == 2) {
|
||||||
float startframe;
|
|
||||||
float endframe;
|
|
||||||
string modelname;
|
|
||||||
|
|
||||||
useprint (other, 7, 0, 0);
|
useprint (other, 7, 0, 0);
|
||||||
|
|
||||||
if (other.button7) {
|
if (other.button7) {
|
||||||
|
@ -1866,19 +1859,14 @@ void touch_pap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
entity tempe = self;
|
entity tempe = self;
|
||||||
startframe = GetFrame(other.weapon,TAKE_OUT_START);
|
|
||||||
endframe = GetFrame(other.weapon,TAKE_OUT_END);
|
|
||||||
modelname = GetWeaponModel(other.weapon, 0);
|
|
||||||
other.weaponmodel = GetWeaponModel(other.weapon, 0);// Give weapon model
|
|
||||||
|
|
||||||
// Kar Scope
|
|
||||||
if (other.weapon == W_HEADCRACKER)
|
|
||||||
other.weapon2model = "models/weapons/kar/v_karscope.mdl";
|
|
||||||
|
|
||||||
self = other;
|
self = other;
|
||||||
|
|
||||||
SwitchWeapon(self.weapon);
|
SwitchWeapon(self.weapon);
|
||||||
UpdateV2model(other.weapon2model, 0);
|
|
||||||
Set_W_Frame (startframe, endframe, 0, 0, 0, SUB_Null, modelname, true, S_BOTH);//FIXME
|
if (GetFrame(self.weapon, FIRST_TAKE_START) != 0)
|
||||||
|
Weapon_PlayViewModelAnimation(ANIM_FIRST_TAKE, SUB_Null, 0);
|
||||||
|
else
|
||||||
|
Weapon_PlayViewModelAnimation(ANIM_TAKE_OUT, SUB_Null, 0);
|
||||||
|
|
||||||
#ifndef FTE
|
#ifndef FTE
|
||||||
|
|
||||||
|
|
|
@ -53,9 +53,6 @@ float(string params) Command_give =
|
||||||
WeaponSwitch(self);
|
WeaponSwitch(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
float startframe, endframe;
|
|
||||||
string modelname;
|
|
||||||
|
|
||||||
self.weapon = wep;
|
self.weapon = wep;
|
||||||
self.currentammo = getWeaponAmmo(wep);
|
self.currentammo = getWeaponAmmo(wep);
|
||||||
self.currentmag = getWeaponMag(wep);
|
self.currentmag = getWeaponMag(wep);
|
||||||
|
@ -63,15 +60,10 @@ float(string params) Command_give =
|
||||||
self.currentmag2 = self.currentmag;
|
self.currentmag2 = self.currentmag;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.weaponskin = GetWepSkin(self.weapon);
|
if (GetFrame(self.weapon, FIRST_TAKE_START) != 0)
|
||||||
|
Weapon_PlayViewModelAnimation(ANIM_FIRST_TAKE, SUB_Null, 0);
|
||||||
startframe = GetFrame(self.weapon,TAKE_OUT_START);
|
else
|
||||||
endframe = GetFrame(self.weapon,TAKE_OUT_END);
|
Weapon_PlayViewModelAnimation(ANIM_TAKE_OUT, SUB_Null, 0);
|
||||||
modelname = GetWeaponModel(wep, 0);
|
|
||||||
|
|
||||||
SwitchWeapon(wep);
|
|
||||||
|
|
||||||
Set_W_Frame (startframe, endframe, 0, 0, 0, SUB_Null, modelname, false, S_BOTH);
|
|
||||||
|
|
||||||
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0;
|
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,18 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// TODO: Actually implement some of these..
|
||||||
|
// Frame types, generalized.
|
||||||
|
#define ANIM_FIRE 0
|
||||||
|
#define ANIM_RELOAD 1
|
||||||
|
#define ANIM_SPRINT_START 2
|
||||||
|
#define ANIM_SPRINT 3
|
||||||
|
#define ANIM_SPRINT_STOP 4
|
||||||
|
#define ANIM_FIRST_TAKE 5
|
||||||
|
#define ANIM_TAKE_OUT 6
|
||||||
|
#define ANIM_PUT_AWAY 7
|
||||||
|
#define ANIM_AIM 8
|
||||||
|
|
||||||
//
|
//
|
||||||
// Weapon_GetPlayerAmmoInSlot(person, slot)
|
// Weapon_GetPlayerAmmoInSlot(person, slot)
|
||||||
// Returns the reserve ammo the player has in a weapon slot.
|
// Returns the reserve ammo the player has in a weapon slot.
|
||||||
|
@ -38,7 +50,7 @@ float(entity person, float slot) Weapon_GetPlayerAmmoInSlot =
|
||||||
case 3: return person.thirdammo; break;
|
case 3: return person.thirdammo; break;
|
||||||
default: return 0; break;
|
default: return 0; break;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Weapon_SetPlayerAmmoInSlot(person, slot, ammo)
|
// Weapon_SetPlayerAmmoInSlot(person, slot, ammo)
|
||||||
|
@ -104,7 +116,7 @@ float(float weapon) Weapon_IsSemiAutomatic =
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Weapon_FiresTraceshot(weapon)
|
// Weapon_FiresTraceshot(weapon)
|
||||||
|
@ -120,4 +132,48 @@ float(float weapon) Weapon_FiresTraceshot =
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Weapon_PlayViewModelAnimation(animation_type, end_function, playback_duration)
|
||||||
|
// Sets up and plays the weapon sequence for you.
|
||||||
|
//
|
||||||
|
void (float animation_type, void(optional float t) end_function, float playback_duration) Weapon_PlayViewModelAnimation =
|
||||||
|
{
|
||||||
|
float start_frame = 0;
|
||||||
|
float end_frame = 0;
|
||||||
|
|
||||||
|
switch(animation_type) {
|
||||||
|
case ANIM_SPRINT_START:
|
||||||
|
start_frame = GetFrame(self.weapon, SPRINT_IN_START);
|
||||||
|
end_frame = GetFrame(self.weapon, SPRINT_IN_END);
|
||||||
|
break;
|
||||||
|
case ANIM_SPRINT:
|
||||||
|
start_frame = GetFrame(self.weapon, SPRINT_START);
|
||||||
|
end_frame = GetFrame(self.weapon, SPRINT_END);
|
||||||
|
break;
|
||||||
|
case ANIM_SPRINT_STOP:
|
||||||
|
start_frame = GetFrame(self.weapon, SPRINT_OUT_START);
|
||||||
|
end_frame = GetFrame(self.weapon, SPRINT_OUT_END);
|
||||||
|
break;
|
||||||
|
case ANIM_TAKE_OUT:
|
||||||
|
start_frame = GetFrame(self.weapon, TAKE_OUT_START);
|
||||||
|
end_frame = GetFrame(self.weapon, TAKE_OUT_END);
|
||||||
|
break;
|
||||||
|
case ANIM_PUT_AWAY:
|
||||||
|
start_frame = GetFrame(self.weapon, PUT_OUT_START);
|
||||||
|
end_frame = GetFrame(self.weapon, PUT_OUT_END);
|
||||||
|
break;
|
||||||
|
case ANIM_FIRST_TAKE:
|
||||||
|
start_frame = GetFrame(self.weapon, FIRST_TAKE_START);
|
||||||
|
end_frame = GetFrame(self.weapon, FIRST_TAKE_END);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateVmodel(self.weaponmodel, GetWepSkin(self.weapon));
|
||||||
|
UpdateV2model(self.weapon2model, GetWepSkin(self.weapon));
|
||||||
|
|
||||||
|
Set_W_Frame(start_frame, end_frame, playback_duration, 0, 0, end_function, GetWeaponModel(self.weapon, 0), false, S_BOTH);
|
||||||
|
};
|
|
@ -51,13 +51,7 @@ void() ReturnWeaponModel =
|
||||||
|
|
||||||
void() W_PlayTakeOut =
|
void() W_PlayTakeOut =
|
||||||
{
|
{
|
||||||
float startframe, endframe;
|
Weapon_PlayViewModelAnimation(ANIM_TAKE_OUT, ReturnWeaponModel, 0);
|
||||||
string modelname;
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.float scopetime;
|
.float scopetime;
|
||||||
|
@ -134,17 +128,12 @@ void() W_SprintStop =
|
||||||
self.sprint_duration = self.sprint_timer;
|
self.sprint_duration = self.sprint_timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
float startframe = GetFrame(self.weapon,SPRINT_OUT_START);
|
|
||||||
float endframe = GetFrame(self.weapon,SPRINT_OUT_END);
|
|
||||||
string modelname = GetWeaponModel(self.weapon, 0);
|
|
||||||
|
|
||||||
if (self.isBuying || !self.sprinting)
|
if (self.isBuying || !self.sprinting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Weapon_PlayViewModelAnimation(ANIM_SPRINT_STOP, SUB_Null, 0);
|
||||||
|
|
||||||
self.zoom = 0;
|
self.zoom = 0;
|
||||||
|
|
||||||
Set_W_Frame (startframe, endframe, 0, 0, SPRINT, SUB_Null, modelname, false, S_BOTH); // BUG IS HERE
|
|
||||||
|
|
||||||
self.sprinting = 0;
|
self.sprinting = 0;
|
||||||
self.into_sprint = 0;
|
self.into_sprint = 0;
|
||||||
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0;
|
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0;
|
||||||
|
@ -180,16 +169,9 @@ void W_SprintStart () {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float startframe = GetFrame(self.weapon,SPRINT_IN_START);
|
Weapon_PlayViewModelAnimation(ANIM_SPRINT_START, ContinueRun, 0);
|
||||||
float endframe = GetFrame(self.weapon,SPRINT_IN_END);
|
|
||||||
string modelname = GetWeaponModel(self.weapon, 0);
|
|
||||||
|
|
||||||
self.zoom = 3;
|
self.zoom = 3;
|
||||||
|
|
||||||
if (startframe || endframe) {
|
|
||||||
Set_W_Frame (startframe, endframe, 0, 0, SPRINT, ContinueRun, modelname, false, S_BOTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
self.sprint_delay = time + 1;
|
self.sprint_delay = time + 1;
|
||||||
self.sprinting = true;
|
self.sprinting = true;
|
||||||
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0;
|
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0;
|
||||||
|
@ -200,9 +182,6 @@ void() W_Switch =
|
||||||
if (self.secondaryweapon && self.secondaryweapon != 0 && !self.new_anim_stop && !other.button7)
|
if (self.secondaryweapon && self.secondaryweapon != 0 && !self.new_anim_stop && !other.button7)
|
||||||
{
|
{
|
||||||
float tempf,tempf1,tempf2,tempf3,tempf4;
|
float tempf,tempf1,tempf2,tempf3,tempf4;
|
||||||
float startframe;
|
|
||||||
float endframe;
|
|
||||||
string modelname;
|
|
||||||
|
|
||||||
// un-zoom camera
|
// un-zoom camera
|
||||||
self.zoom = false;
|
self.zoom = false;
|
||||||
|
@ -261,27 +240,8 @@ void() W_Switch =
|
||||||
self.secondaryweaponskin = tempf4;
|
self.secondaryweaponskin = tempf4;
|
||||||
}
|
}
|
||||||
|
|
||||||
startframe = GetFrame(self.weapon,TAKE_OUT_START);
|
|
||||||
endframe = GetFrame(self.weapon,TAKE_OUT_END);
|
|
||||||
modelname = GetWeaponModel(self.weapon, 0);
|
|
||||||
|
|
||||||
SwitchWeapon(self.weapon);
|
SwitchWeapon(self.weapon);
|
||||||
|
Weapon_PlayViewModelAnimation(ANIM_TAKE_OUT, ReturnWeaponModel, 0);
|
||||||
if (IsDualWeapon(self.weapon)) {
|
|
||||||
self.weapon2model = GetLeftWeaponModel(self.weapon);
|
|
||||||
} else if (self.weapon == W_KAR_SCOPE || self.weapon == W_HEADCRACKER)
|
|
||||||
self.weapon2model = "models/weapons/kar/v_karscope.mdl";
|
|
||||||
else
|
|
||||||
self.weapon2model = "";
|
|
||||||
|
|
||||||
UpdateV2model(self.weapon2model, 0);
|
|
||||||
|
|
||||||
// TEMP
|
|
||||||
if (self.weapon == W_M2 || self.weapon == W_FIW)
|
|
||||||
UpdateVmodel(modelname, GetWepSkin(self.weapon));
|
|
||||||
|
|
||||||
|
|
||||||
Set_W_Frame (startframe, endframe, 0, 0, 0, ReturnWeaponModel, modelname, false, S_BOTH);//FIXME
|
|
||||||
|
|
||||||
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0;
|
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0;
|
||||||
|
|
||||||
|
@ -308,32 +268,18 @@ void() W_PutOut =
|
||||||
|
|
||||||
if (self.secondaryweapon && !self.new_anim_stop)
|
if (self.secondaryweapon && !self.new_anim_stop)
|
||||||
{
|
{
|
||||||
float startframe;
|
Weapon_PlayViewModelAnimation(ANIM_PUT_AWAY, W_Switch, 0);
|
||||||
float endframe;
|
|
||||||
string modelname;
|
|
||||||
startframe = GetFrame(self.weapon,PUT_OUT_START);
|
|
||||||
endframe = GetFrame(self.weapon,PUT_OUT_END);
|
|
||||||
modelname = GetWeaponModel(self.weapon, 0);
|
|
||||||
|
|
||||||
Set_W_Frame (startframe, endframe, (endframe - startframe)/10, 0, SWITCHWEP, W_Switch, modelname, false, S_BOTH);//FIXME
|
|
||||||
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0;
|
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void() W_TakeOut =
|
void() W_TakeOut =
|
||||||
{
|
{
|
||||||
W_AimOut();
|
|
||||||
|
|
||||||
float startframe;
|
|
||||||
float endframe;
|
|
||||||
string modelname;
|
|
||||||
startframe = GetFrame(self.weapon,TAKE_OUT_START);
|
|
||||||
endframe = GetFrame(self.weapon,TAKE_OUT_END);
|
|
||||||
modelname = GetWeaponModel(self.weapon, 0);
|
|
||||||
|
|
||||||
self.isBuying = false;
|
self.isBuying = false;
|
||||||
|
|
||||||
Set_W_Frame (startframe, endframe, (endframe - startframe)/10, 0, SWITCHWEP, SUB_Null, modelname, false, S_BOTH);//FIXME
|
W_AimOut();
|
||||||
|
Weapon_PlayViewModelAnimation(ANIM_TAKE_OUT, SUB_Null, 0);
|
||||||
|
|
||||||
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0;
|
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue