- Fully implemented ammo cubes. - Fixed environment map shaders (incorrect texture coords were being used). - HUD support for displaying Hexen keys. - Fixed "has no ammo" messages displaying more often than they should. - Fixed lack of footsteps with UT physics disabled. - Sneaky initial Strife compatibility work: - Impact Hammer will have reduced alert distance. - HUD support for displaying Strife keys.
425 lines
7.3 KiB
Text
425 lines
7.3 KiB
Text
// Heretic keys
|
|
Class UTHereticYellowKey : KeyYellow
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_YELLOWKEY";
|
|
Species "KeyYellow";
|
|
Inventory.PickupMessage "$I_YELLOWKEY";
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
UKEY B -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class UTHereticGreenKey : KeyGreen
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_GREENKEY";
|
|
Species "KeyGreen";
|
|
Inventory.PickupMessage "$I_GREENKEY";
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
UKEY D -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class UTHereticBlueKey : KeyBlue
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_BLUEKEY";
|
|
Species "KeyBlue";
|
|
Inventory.PickupMessage "$I_BLUEKEY";
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
UKEY C -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
// for heretic mods that add it
|
|
Class UTHereticRedKey : HereticKey
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_REDKEY";
|
|
Species "KeyRed";
|
|
Inventory.PickupMessage "$I_REDKEY";
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
UKEY A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
// Base class for items that can be activated from the inventory bar
|
|
Class UTActivatable : Inventory
|
|
{
|
|
Class<Inventory> GiveItem;
|
|
|
|
Property GiveItem: GiveItem;
|
|
|
|
override bool Use( bool pickup )
|
|
{
|
|
if ( !Owner ) return true;
|
|
let i = GetDefaultByType(GiveItem);
|
|
if ( Owner.GiveInventory(GiveItem,i.Amount) )
|
|
{
|
|
Owner.A_PlaySound(i.PickupSound,CHAN_ITEM);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
Default
|
|
{
|
|
+INVENTORY.INVBAR;
|
|
Inventory.DefMaxAmount;
|
|
Inventory.PickupSound "misc/p_pkup";
|
|
Inventory.UseSound "";
|
|
}
|
|
}
|
|
|
|
Class ActUDamage : UTActivatable
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_UDAMAGE";
|
|
Inventory.Icon "ItemUdmg";
|
|
Inventory.PickupMessage "$I_UDAMAGE";
|
|
+COUNTITEM;
|
|
+INVENTORY.BIGPOWERUP;
|
|
UTActivatable.GiveItem "UDamage";
|
|
Inventory.RespawnTics 4200;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
UDAM A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class ActUTInvulnerability : UTActivatable
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_UTINVUL";
|
|
Inventory.Icon "ItemInvl";
|
|
Inventory.PickupMessage "$I_UTINVUL";
|
|
+COUNTITEM;
|
|
+INVENTORY.BIGPOWERUP;
|
|
UTActivatable.GiveItem "UTInvulnerability";
|
|
Inventory.RespawnTics 4200;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
UKEY A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class ActUTInvisibility : UTActivatable
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_INVISIBILITY";
|
|
Inventory.Icon "ItemInvs";
|
|
Inventory.PickupMessage "$I_INVISIBILITY";
|
|
+COUNTITEM;
|
|
+INVENTORY.BIGPOWERUP;
|
|
UTActivatable.GiveItem "UTInvisibility";
|
|
Inventory.RespawnTics 4200;
|
|
}
|
|
override void PostBeginPlay()
|
|
{
|
|
Super.PostBeginPlay();
|
|
tracer = Spawn("UTInvisibilityX",pos);
|
|
tracer.angle = angle;
|
|
tracer.target = self;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
INVS A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class ActUTNightVision : UTActivatable
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_UTVISION";
|
|
Inventory.Icon "ItemLite";
|
|
Inventory.PickupMessage "$I_UTVISION";
|
|
+COUNTITEM;
|
|
+INVENTORY.BIGPOWERUP;
|
|
UTActivatable.GiveItem "UTNightVision";
|
|
Inventory.RespawnTics 4200;
|
|
}
|
|
override void PostBeginPlay()
|
|
{
|
|
Super.PostBeginPlay();
|
|
tracer = Spawn("UTNightVisionX",pos);
|
|
tracer.angle = angle;
|
|
tracer.target = self;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
UKEY A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class ActJumpBoots : UTActivatable
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_JUMPBOOTS";
|
|
Inventory.Icon "ItemBoot";
|
|
Inventory.PickupMessage "$I_JUMPBOOTS";
|
|
UTActivatable.GiveItem "UTJumpBoots";
|
|
Inventory.RespawnTics 1050;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
JBUT A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
// These have to be subclassed from HealthPickup for auto-use
|
|
Class UTActivatableHealth : HealthPickup
|
|
{
|
|
Default
|
|
{
|
|
+INVENTORY.INVBAR;
|
|
Inventory.DefMaxAmount;
|
|
Inventory.PickupSound "misc/p_pkup";
|
|
Inventory.UseSound "misc/ut_heal";
|
|
HealthPickup.Autouse 1;
|
|
}
|
|
}
|
|
|
|
Class ActHealthPack : UTActivatableHealth
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_SUPERHEALTH";
|
|
Inventory.Icon "ItemHbox";
|
|
Inventory.PickupMessage "$I_SUPERHEALTH";
|
|
+COUNTITEM;
|
|
Health 100;
|
|
Inventory.UseSound "misc/ut_keg";
|
|
Inventory.RespawnTics 3500;
|
|
HealthPickup.Autouse 2;
|
|
}
|
|
override bool Use( bool pickup )
|
|
{
|
|
return Owner.GiveBody(health,200);
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
HBOX A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class ActHealthBox : UTActivatableHealth
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_HEALTHBOX";
|
|
Inventory.Icon "ItemHbxb";
|
|
Inventory.PickupMessage "$I_HEALTHBOX";
|
|
Health 50;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
HBOX B -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
Class ActMedBox : UTActivatableHealth
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_MEDBOX";
|
|
Inventory.Icon "ItemMbox";
|
|
Inventory.PickupMessage "$I_MEDBOX";
|
|
Health 20;
|
|
Inventory.RespawnTics 700;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
HBOX C -1;
|
|
Stop;
|
|
}
|
|
}
|
|
|
|
// to compensate for hexen's shared ammo
|
|
Class UTHexenAmmoBox : Inventory
|
|
{
|
|
int AmmoFactor;
|
|
|
|
Property AmmoFactor : AmmoFactor;
|
|
|
|
default
|
|
{
|
|
UTHexenAmmoBox.AmmoFactor -1;
|
|
+FLOATBOB;
|
|
Inventory.PickupSound "misc/i_pkup";
|
|
}
|
|
|
|
override bool TryPickup( in out Actor toucher )
|
|
{
|
|
bool hasgiven = (AmmoFactor < 0); // always true
|
|
for ( int i=0; i<AllActorClasses.Size(); i++ )
|
|
{
|
|
let type = (class<Ammo>)(AllActorClasses[i]);
|
|
if ( !type || (type.GetParentClass() != 'Ammo') ) continue;
|
|
// check that it's for a valid weapon
|
|
bool isvalid = false;
|
|
for ( int j=0; j<AllActorClasses.Size(); j++ )
|
|
{
|
|
let type2 = (class<Weapon>)(AllActorClasses[j]);
|
|
if ( !type2 ) continue;
|
|
let rep = GetReplacement(type2);
|
|
if ( (rep != type2) && !(rep is "DehackedPickup") ) continue;
|
|
readonly<Weapon> weap = GetDefaultByType(type2);
|
|
if ( !toucher.player || !toucher.player.weapons.LocateWeapon(type2) || weap.bCheatNotWeapon ) continue;
|
|
if ( (weap.AmmoType1 == type) || (weap.AmmoType2 == type) )
|
|
{
|
|
isvalid = true;
|
|
break;
|
|
}
|
|
}
|
|
// sneaky fix for chainsaw ammo
|
|
if ( (type is 'ChainsawAmmo') && flak_sawammo && (GetReplacement(type) == type) ) isvalid = true;
|
|
if ( !isvalid ) continue;
|
|
let ammoitem = Ammo(toucher.FindInventory(type));
|
|
int amount = GetDefaultByType(type).BackpackAmount;
|
|
if ( AmmoFactor < 0 )
|
|
{
|
|
if ( ammoitem ) amount = ammoitem.MaxAmount;
|
|
else amount = GetDefaultByType(type).MaxAmount;
|
|
}
|
|
else
|
|
{
|
|
amount = (amount*AmmoFactor)/100;
|
|
// extra ammo in baby mode and nightmare mode
|
|
if ( !bIgnoreSkill ) amount = int(amount*G_SkillPropertyFloat(SKILLP_AmmoFactor));
|
|
}
|
|
if ( amount <= 0 ) continue;
|
|
if ( !ammoitem )
|
|
{
|
|
// The player did not have the ammoitem. Add it.
|
|
ammoitem = Ammo(Spawn(type));
|
|
ammoitem.Amount = amount;
|
|
if ( ammoitem.Amount > ammoitem.MaxAmount )
|
|
ammoitem.Amount = ammoitem.MaxAmount;
|
|
ammoitem.AttachToOwner(toucher);
|
|
hasgiven = true;
|
|
}
|
|
else
|
|
{
|
|
// The player had the ammoitem. Give some more.
|
|
if ( ammoitem.Amount < ammoitem.MaxAmount )
|
|
{
|
|
ammoitem.Amount += amount;
|
|
if ( ammoitem.Amount > ammoitem.MaxAmount )
|
|
ammoitem.Amount = ammoitem.MaxAmount;
|
|
hasgiven = true;
|
|
}
|
|
}
|
|
}
|
|
if ( !hasgiven ) return false;
|
|
GoAwayAndDie();
|
|
return true;
|
|
}
|
|
}
|
|
Class UTMinorAmmoBox : UTHexenAmmoBox
|
|
{
|
|
default
|
|
{
|
|
Tag "$T_AMMOBOXLOW";
|
|
Inventory.PickupMessage "$I_AMMOBOXLOW";
|
|
UTHexenAmmoBox.AmmoFactor 60;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
ABOX A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
Class UTMediumAmmoBox : UTHexenAmmoBox
|
|
{
|
|
default
|
|
{
|
|
Tag "$T_AMMOBOXMED";
|
|
Inventory.PickupMessage "$I_AMMOBOXMED";
|
|
UTHexenAmmoBox.AmmoFactor 90;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
ABOX A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
Class UTMajorAmmoBox : UTHexenAmmoBox
|
|
{
|
|
default
|
|
{
|
|
Tag "$T_AMMOBOXHIGH";
|
|
Inventory.PickupMessage "$I_AMMOBOXHIGH";
|
|
UTHexenAmmoBox.AmmoFactor 120;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
ABOX A -1;
|
|
Stop;
|
|
}
|
|
}
|
|
Class ActUTFullAmmoBox : UTActivatable
|
|
{
|
|
Default
|
|
{
|
|
Tag "$T_AMMOBOXFULL";
|
|
Inventory.Icon "ItemABox";
|
|
Inventory.PickupMessage "$I_AMMOBOXFULL";
|
|
+COUNTITEM;
|
|
+FLOATBOB;
|
|
+INVENTORY.BIGPOWERUP;
|
|
UTActivatable.GiveItem "UTHexenAmmoBox";
|
|
Inventory.RespawnTics 4200;
|
|
}
|
|
States
|
|
{
|
|
Spawn:
|
|
ABOX A -1;
|
|
Stop;
|
|
}
|
|
}
|