Reset weapon pickup voicelines only when inventory is wiped.

This commit is contained in:
Mari the Deer 2023-11-27 15:44:23 +01:00
commit 6a6c26f307
5 changed files with 31 additions and 23 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1024 \cu(Sun 26 Nov 20:45:51 CET 2023)\c-";
SWWM_SHORTVER="\cw1.3pre r1024 \cu(2023-11-26 20:45:51)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1025 \cu(Mon 27 Nov 15:44:23 CET 2023)\c-";
SWWM_SHORTVER="\cw1.3pre r1025 \cu(2023-11-27 15:44:23)\c-";

View file

@ -100,27 +100,8 @@ extend Class SWWMHandler
s.GotWeapon(Weapon(i).GetClass());
}
}
else if ( (s.lastcluster != level.cluster) || !(level.clusterflags&LevelLocals.CLUSTER_HUB) || (level.info.flags2&LEVEL2_RESETINVENTORY && !e.IsReturn) )
{
// clear the "weapon got" lists for weapons we don't have anymore (unless we're in a hub)
// so the obtain lines play again
for ( int i=0; i<s.alreadygot.Size(); i++ )
{
// special case for dual weapons
String cn = s.alreadygot[i].GetClassName();
if ( (cn.Left(4) ~== "Dual") )
{
int ss = p.mo.CountInv(GetDefaultByType(s.alreadygot[i]).SisterWeaponType);
if ( ss == 2 ) continue;
s.alreadygot.Delete(i);
i--;
continue;
}
if ( p.mo.FindInventory(s.alreadygot[i]) ) continue;
s.alreadygot.Delete(i);
i--;
}
}
else if ( level.info.flags2&LEVEL2_RESETINVENTORY && !e.IsReturn )
s.CleanGotWeapons(); // clean up the "got weapons" so their obtain lines are played again
// reset some vars
multilevel[e.playernumber] = 0;
spreecount[e.playernumber] = 0;

View file

@ -48,6 +48,8 @@ extend Class Demolitionist
}
else last = i;
}
// clean up the "got weapons" so their obtain lines are played again
if ( mystats ) mystats.CleanGotWeapons();
}
override void RemoveInventory( Inventory item )

View file

@ -118,6 +118,28 @@ Class SWWMStats : SWWMStaticThinker
return false;
}
void CleanGotWeapons()
{
// clean up the list of weapons we don't have anymore
// so the obtain lines play again
for ( int i=0; i<alreadygot.Size(); i++ )
{
// special case for dual weapons
String cn = alreadygot[i].GetClassName();
if ( (cn.Left(4) ~== "Dual") )
{
int ss = myplayer.mo.CountInv(GetDefaultByType(alreadygot[i]).SisterWeaponType);
if ( ss == 2 ) continue;
alreadygot.Delete(i);
i--;
continue;
}
if ( myplayer.mo.FindInventory(alreadygot[i]) ) continue;
alreadygot.Delete(i);
i--;
}
}
private Class<Weapon> WeaponFromInflictor( Actor inflictor, Name damagetype )
{
Class<Weapon> which = myplayer.ReadyWeapon?myplayer.ReadyWeapon.GetClass():null;

View file

@ -31,6 +31,9 @@ extend Class SWWMUtility
p.mo.GiveDefaultInventory();
p.mo.BringUpWeapon();
p.health = p.mo.Health = p.mo.SpawnHealth();
// weapon pickup line stuff
SWWMStats s = SWWMStats.Find(p);
if ( s ) s.CleanGotWeapons();
}
// sets all carried ammo back to zero