Skip to content

Commit

Permalink
Improve zombie viewmodels (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
FortyTwoFortyTwo authored Aug 15, 2023
1 parent 792ebbc commit 4c23b3b
Show file tree
Hide file tree
Showing 87 changed files with 270 additions and 360 deletions.
67 changes: 38 additions & 29 deletions addons/sourcemod/configs/szf/classes.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@
// message Description of the special infected.
// worldmodel Custom world model to set as.
// viewmodel Custom view model to set as.
// viewmodel_angles Viewmodel angles offset to set.
// viewmodel_height Viewmodel height offset to set.
// viewmodel_anim 0 to bonemerge from default viewmodel, 1 to override with custom anims
// sound_spawn Sound to play survivors on spawn.
// ragecooldown Amount of seconds to use rage again.
// callback_spawn Callback to use on spawn.
// callback_rage Callback to use on rage.
// callback_think Callback to use on every frame.
// callback_touch Callback to use when player touches someone
// callback_anim Callback to use on changing player animations.
// callback_death Callback to use on death.
//Below is for "weapon"
Expand Down Expand Up @@ -116,8 +114,9 @@
"scout"
{
"health" "15"
"health" "15"
"menu" "Menu_ClassesInfectedScout"
"viewmodel" "models/kirillian/weapons/c_models/c_scout_arms_zombie.mdl"
"weapon"
{
Expand All @@ -134,6 +133,7 @@
"maxspree" "10.0"
"maxhorde" "10.0"
"menu" "Menu_ClassesInfectedSoldier"
"viewmodel" "models/kirillian/weapons/c_models/c_soldier_arms_zombie.mdl"
"weapon"
{
Expand All @@ -150,6 +150,7 @@
"maxspree" "10.0"
"maxhorde" "10.0"
"menu" "Menu_ClassesInfectedPyro"
"viewmodel" "models/kirillian/weapons/c_models/c_pyro_arms_zombie.mdl"
"weapon"
{
Expand All @@ -167,6 +168,7 @@
"maxspree" "10.0"
"maxhorde" "10.0"
"menu" "Menu_ClassesInfectedDemoman"
"viewmodel" "models/kirillian/weapons/c_models/c_demo_arms_zombie.mdl"
"weapon"
{
Expand All @@ -183,6 +185,7 @@
"maxspree" "10.0"
"maxhorde" "10.0"
"menu" "Menu_ClassesInfectedHeavy"
"viewmodel" "models/kirillian/weapons/c_models/c_heavy_arms_zombie.mdl"
"weapon"
{
Expand All @@ -207,6 +210,7 @@
"regen" "-1"
"degen" "4"
"menu" "Menu_ClassesInfectedMedic"
"viewmodel" "models/kirillian/weapons/c_models/c_medic_arms_zombie.mdl"
"weapon"
{
Expand All @@ -217,6 +221,7 @@
"sniper"
{
"menu" "Menu_ClassesInfectedSniper"
"viewmodel" "models/kirillian/weapons/c_models/c_sniper_arms_zombie.mdl"
"weapon"
{
Expand All @@ -227,6 +232,7 @@
"spy"
{
"menu" "Menu_ClassesInfectedSpy"
"viewmodel" "models/kirillian/weapons/c_models/c_spy_arms_zombie.mdl"
"weapon"
{
Expand All @@ -251,20 +257,20 @@
"menu" "Menu_ClassesInfectedSpecialTank"
"worldmodel" "models/kirillian/infected/hank_v4.mdl"
"viewmodel" "models/kirillian/weapons/hank_viewmodel.mdl"
"viewmodel_angles" "0.0 0.0 0.0"
"viewmodel_height" "-2.0"
"viewmodel" "models/kirillian/weapons/hank_viewmodel_v2f.mdl"
"viewmodel_anim" "1"
"callback_spawn" "Infected_OnTankSpawn"
"callback_rage" "Infected_DoNoRage"
"callback_anim" "Infected_OnTankAnim"
"callback_touch" "Infected_OnTankTouch"
"callback_death" "Infected_OnTankDeath"
"weapon"
{
"index" "5" // Fists
"attrib" "329 ; 0.0 ; 405 ; 0.0 ; 107 ; 1.8" // Airblast immunity, vertical airblast immunity, move speed bonus
"logname" "warrior_spirit"
"iconname" "warrior_spirit"
}
}
Expand All @@ -275,18 +281,18 @@
"menu" "Menu_ClassesInfectedSpecialBoomer"
"worldmodel" "models/kirillian/infected/hoomer_v4.mdl"
"viewmodel" "models/kirillian/weapons/hoomer_viewmodel.mdl"
"viewmodel_angles" "-5.0 0.0 0.0"
"viewmodel_height" "-4.0"
"viewmodel" "models/kirillian/weapons/hoomer_viewmodel_v2f.mdl"
"viewmodel_anim" "1"
"sound_spawn" "szf/music/bacteria/boomerbacterias.mp3"
"callback_rage" "Infected_DoBoomerRage"
"callback_anim" "Infected_OnBoomerAnim"
"callback_death" "Infected_OnBoomerDeath"
"weapon"
{
"index" "5" // Fists
"logname" "warrior_spirit"
"iconname" "warrior_spirit"
}
}
Expand All @@ -297,20 +303,20 @@
"menu" "Menu_ClassesInfectedSpecialCharger"
"worldmodel" "models/kirillian/infected/coomer_v4.mdl"
"viewmodel" "models/kirillian/weapons/coomer_viewmodel.mdl"
"viewmodel_angles" "-35.0 0.0 0.0"
"viewmodel_height" "-30.0"
"viewmodel" "models/kirillian/weapons/coomer_viewmodel_v2f.mdl"
"viewmodel_anim" "1"
"sound_spawn" "szf/music/bacteria/chargerbacterias.mp3"
"ragecooldown" "16"
"callback_spawn" "Infected_OnChargerSpawn"
"callback_rage" "Infected_DoChargerCharge"
"callback_think" "Infected_OnChargerThink"
"callback_anim" "Infected_OnChargerAnim"
"weapon"
{
"index" "5" // Fists
"logname" "gloves"
"iconname" "gloves"
}
}
Expand Down Expand Up @@ -363,22 +369,21 @@
"menu" "Menu_ClassesInfectedSpecialHunter"
"worldmodel" "models/kirillian/infected/scunter_v4.mdl"
"viewmodel" "models/kirillian/weapons/scunter_viewmodel.mdl"
"viewmodel_angles" "-5.0 0.0 0.0"
"viewmodel_height" "-4.0"
"viewmodel" "models/kirillian/weapons/scunter_viewmodel_v2f.mdl"
"viewmodel_anim" "1"
"sound_spawn" "szf/music/bacteria/hunterbacterias.mp3"
"ragecooldown" "3"
"callback_rage" "Infected_DoHunterJump"
"callback_think" "Infected_OnHunterThink"
"callback_anim" "Infected_OnHunterAnim"
"callback_touch" "Infected_OnHunterTouch"
"callback_death" "Infected_OnHunterDeath"
"weapon"
{
"index" "5" // Fists
"attrib" "1 ; 0.54 ; 396 ; 0.625" // Less damage and faster attack speed to match with bat
"logname" "unarmed_combat"
"iconname" "unarmed_combat"
}
}
Expand All @@ -390,16 +395,18 @@
"menu" "Menu_ClassesInfectedSpecialSmoker"
"worldmodel" "models/kirillian/infected/wanker_v4.mdl"
"viewmodel" "models/kirillian/weapons/wank_viewmodel.mdl"
"viewmodel" "models/kirillian/weapons/wank_viewmodel_v2f.mdl"
"viewmodel_anim" "1"
"sound_spawn" "szf/music/bacteria/smokerbacterias.mp3"
"callback_rage" "Infected_DoNoRage"
"callback_think" "Infected_OnSmokerThink"
"callback_anim" "Infected_OnSmokerAnim"
"weapon"
{
"index" "5" // Fists
"logname" "unarmed_combat"
"iconname" "unarmed_combat"
}
}
Expand All @@ -410,13 +417,12 @@
"menu" "Menu_ClassesInfectedSpecialSpitter"
"worldmodel" "models/kirillian/infected/spyro_v4.mdl"
"viewmodel" "models/kirillian/weapons/spyro_viewmodel.mdl"
"viewmodel_height" "-4.0"
"viewmodel" "models/kirillian/weapons/spyro_viewmodel_v2f.mdl"
"viewmodel_anim" "1"
"sound_spawn" "szf/music/bacteria/spitterbacterias.mp3"
"ragecooldown" "16"
"callback_rage" "Infected_DoSpitterGas"
"callback_anim" "Infected_OnSpitterAnim"
"callback_death" "Infected_OnSpitterDeath"
"weapon"
Expand All @@ -428,6 +434,8 @@
"weapon"
{
"index" "5" // Fists
"logname" "hot_hand"
"iconname" "hot_hand"
}
}
Expand All @@ -438,20 +446,21 @@
"menu" "Menu_ClassesInfectedSpecialJockey"
"worldmodel" "models/kirillian/infected/sock_v4.mdl"
"viewmodel" "models/kirillian/weapons/sock_viewmodel.mdl"
"viewmodel_height" "-4.0"
"viewmodel" "models/kirillian/weapons/sock_viewmodel_v2f.mdl"
"viewmodel_anim" "1"
"sound_spawn" "szf/music/bacteria/jockeybacterias.mp3"
"ragecooldown" "6"
"callback_rage" "Infected_DoJockeyJump"
"callback_think" "Infected_OnJockeyThink"
"callback_touch" "Infected_OnJockeyTouch"
"callback_anim" "Infected_OnJockeyAnim"
"callback_death" "Infected_OnJockeyDeath"
"weapon"
{
"index" "5" // Fists
"logname" "unarmed_combat"
"iconname" "unarmed_combat"
}
}
}
Expand Down
24 changes: 0 additions & 24 deletions addons/sourcemod/gamedata/szf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
"linux" "@_ZN9CTFPlayer20PlaySpecificSequenceEPKc"
"windows" "\x55\x8B\xEC\x53\x56\x8B\x75\x08\x57\x56\x8B\xF9\xE8\x2A\x2A\x2A\x2A\x8B\xD8"
}
"CTFPlayer::DoAnimationEvent"
{
"library" "server"
"linux" "@_ZN9CTFPlayer16DoAnimationEventE17PlayerAnimEvent_ti"
"windows" "\x55\x8B\xEC\x51\x53\x56\x8B\x35\x2A\x2A\x2A\x2A\x8B\xD9\x8B\xCE"
}
"CTFPlayer::GetLoadoutItem"
{
"library" "server"
Expand Down Expand Up @@ -86,24 +80,6 @@
}
"Functions"
{
"CTFPlayer::DoAnimationEvent"
{
"signature" "CTFPlayer::DoAnimationEvent"
"callconv" "thiscall"
"return" "void"
"this" "entity"
"arguments"
{
"event"
{
"type" "int"
}
"nData"
{
"type" "int"
}
}
}
"CTFPlayer::TeamFortress_CalculateMaxSpeed"
{
"signature" "CTFPlayer::TeamFortress_CalculateMaxSpeed"
Expand Down
31 changes: 12 additions & 19 deletions addons/sourcemod/scripting/superzombiefortress.sp
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,13 @@ enum struct ClientClasses
char sMenu[64];
char sWorldModel[PLATFORM_MAX_PATH];
char sViewModel[PLATFORM_MAX_PATH];
float vecViewModelAngles[3];
float flViewModelHeight;
bool bViewModelAnim;
char sSoundSpawn[PLATFORM_MAX_PATH];
int iRageCooldown;
Function callback_spawn;
Function callback_rage;
Function callback_think;
Function callback_touch;
Function callback_anim;
Function callback_death;

//Infected
Expand Down Expand Up @@ -763,7 +761,7 @@ public void TF2_OnConditionRemoved(int iClient, TFCond nCond)
SDKCall_SetSpeed(iClient);

if (nCond == TFCond_Taunting)
ViewModel_Hide(iClient);
ViewModel_UpdateClient(iClient); // taunting removes EF_NODRAW from weapon, readd it back
else if (nCond == TFCond_Disguised)
SetEntProp(iClient, Prop_Send, "m_nModelIndexOverrides", 0, _, VISION_MODE_ROME); //Reset disguise model
}
Expand Down Expand Up @@ -1861,6 +1859,7 @@ void HandleSurvivorLoadout(int iClient)
return;

CheckClientWeapons(iClient);
ViewModel_RemoveWearable(iClient);

for (int iSlot = WeaponSlot_Melee; iSlot <= WeaponSlot_InvisWatch; iSlot++)
{
Expand Down Expand Up @@ -1926,9 +1925,6 @@ void HandleSurvivorLoadout(int iClient)
SetVariantString("");
AcceptEntityInput(iClient, "SetCustomModel");

//Remove any existing viewmodels
ViewModel_Destroy(iClient);

//Prevent Survivors with voodoo-cursed souls
SetEntProp(iClient, Prop_Send, "m_bForcedSkin", 0);
SetEntProp(iClient, Prop_Send, "m_nForcedSkin", 0);
Expand All @@ -1946,6 +1942,8 @@ void HandleZombieLoadout(int iClient)
while (g_ClientClasses[iClient].GetWeapon(iPos, weapon))
TF2_CreateAndEquipWeapon(iClient, weapon.iIndex, weapon.sAttribs);

ViewModel_UpdateClient(iClient);

if (g_ClientClasses[iClient].sWorldModel[0])
{
SetVariantString(g_ClientClasses[iClient].sWorldModel);
Expand All @@ -1961,19 +1959,8 @@ void HandleZombieLoadout(int iClient)
ApplyVoodooCursedSoul(iClient);
}

ViewModel_Destroy(iClient);

if (g_ClientClasses[iClient].sViewModel[0])
{
ViewModel_Create(iClient, g_ClientClasses[iClient].sViewModel, g_ClientClasses[iClient].vecViewModelAngles, g_ClientClasses[iClient].flViewModelHeight);
ViewModel_Hide(iClient);
}

if (g_ClientClasses[iClient].bThirdperson)
{
SetEntProp(GetEntPropEnt(iClient, Prop_Send, "m_hViewModel"), Prop_Send, "m_fEffects", EF_NODRAW);
RequestFrame(SetThirdperson, GetClientSerial(iClient));
}

//Reset metal for TF2 to give back correct amount from attribs
TF2_SetMetal(iClient, 0);
Expand All @@ -1982,7 +1969,10 @@ void HandleZombieLoadout(int iClient)
int iMelee = TF2_GetItemInSlot(iClient, WeaponSlot_Melee);
if (iMelee > MaxClients)
{
SetEntPropEnt(iClient, Prop_Send, "m_hActiveWeapon", iMelee);
TF2_SwitchActiveWeapon(iClient, iMelee);
if (g_ClientClasses[iClient].bViewModelAnim) // needed for some reason for custom anims
ViewModel_SetAnimation(iClient, "ACT_FISTS_VM_DRAW");

AddWeaponVision(iMelee, TF_VISION_FILTER_HALLOWEEN); //Allow see Voodoo souls
AddWeaponVision(iMelee, TF_VISION_FILTER_ROME); //Allow see spy's custom model disguise detour fix
}
Expand Down Expand Up @@ -2502,6 +2492,9 @@ public Action OnPlayerRunCmd(int iClient, int &iButtons, int &iImpulse, float fV

Action OnGiveNamedItem(int iClient, const char[] sClassname, int iIndex)
{
// Reset arms so generated weapons don't get the wrong viewmodel
ViewModel_ResetArms(iClient);

if (g_bGiveNamedItemSkip || TF2_IsPlayerInCondition(iClient, TFCond_Disguised))
return Plugin_Continue;

Expand Down
Loading

0 comments on commit 4c23b3b

Please sign in to comment.