Partial Hexen compatibility. Ammo pickups are not yet implemented.
This commit is contained in:
parent
7c0fe5b1b5
commit
cd0d7d0ec7
10 changed files with 184 additions and 13 deletions
BIN
models/AmmoCube_a.3d
Normal file
BIN
models/AmmoCube_a.3d
Normal file
Binary file not shown.
BIN
models/AmmoCube_d.3d
Normal file
BIN
models/AmmoCube_d.3d
Normal file
Binary file not shown.
BIN
models/JAmmoBox1.png
Normal file
BIN
models/JAmmoBox1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
BIN
models/S_Ammo.png
Normal file
BIN
models/S_Ammo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
models/newblue.png
Normal file
BIN
models/newblue.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
BIN
models/newgold.png
Normal file
BIN
models/newgold.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
BIN
models/newgreen.png
Normal file
BIN
models/newgreen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
BIN
models/newred.png
Normal file
BIN
models/newred.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
|
|
@ -276,3 +276,145 @@ Class ActMedBox : UTActivatableHealth
|
|||
Stop;
|
||||
}
|
||||
}
|
||||
|
||||
// to compensate for hexen's shared ammo
|
||||
Class UTHexenAmmoBox : Inventory
|
||||
{
|
||||
int AmmoFactor;
|
||||
|
||||
Property AmmoFactor : AmmoFactor;
|
||||
|
||||
default
|
||||
{
|
||||
UTHexenAmmoBox.AmmoFactor -1;
|
||||
+INVENTORY.ALWAYSPICKUP;
|
||||
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 ) isvalid = true;
|
||||
if ( !isvalid ) continue;
|
||||
let ammoitem = Ammo(toucher.FindInventory(type));
|
||||
int amount;
|
||||
if ( AmmoFactor < 0 ) amount = GetDefaultByType(type).MaxAmount;
|
||||
else
|
||||
{
|
||||
amount = (GetDefaultByType(type).Amount*100)/AmmoFactor;
|
||||
// extra ammo in baby mode and nightmare mode
|
||||
if ( !bIgnoreSkill ) amount = int(amount*G_SkillPropertyFloat(SKILLP_AmmoFactor));
|
||||
}
|
||||
if ( amount < 0 ) amount = 0;
|
||||
if ( !ammoitem )
|
||||
{
|
||||
// The player did not have the ammoitem. Add it.
|
||||
ammoitem = Ammo(Spawn(type));
|
||||
ammoitem.Amount = bDepleted?0: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 ( !bDepleted && (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 120;
|
||||
}
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
ABOX B -1;
|
||||
Stop;
|
||||
}
|
||||
}
|
||||
Class UTMajorAmmoBox : UTHexenAmmoBox
|
||||
{
|
||||
default
|
||||
{
|
||||
Tag "$T_AMMOBOXHIGH";
|
||||
Inventory.PickupMessage "$I_AMMOBOXHIGH";
|
||||
UTHexenAmmoBox.AmmoFactor 180;
|
||||
}
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
ABOX C -1;
|
||||
Stop;
|
||||
}
|
||||
}
|
||||
Class ActUTFullAmmoBox : UTActivatable
|
||||
{
|
||||
Default
|
||||
{
|
||||
Tag "$T_AMMOBOXFULL";
|
||||
Inventory.Icon "ItemABox";
|
||||
Inventory.PickupMessage "$I_AMMOBOXFULL";
|
||||
+COUNTITEM;
|
||||
+INVENTORY.BIGPOWERUP;
|
||||
UTActivatable.GiveItem "UTHexenAmmoBox";
|
||||
Inventory.RespawnTics 4200;
|
||||
}
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
ABOX D -1;
|
||||
Stop;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2955,6 +2955,17 @@ Class UTStaticHandler : StaticEventHandler
|
|||
}
|
||||
}
|
||||
|
||||
// nothing at all
|
||||
Class UTNothing : Actor
|
||||
{
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
TNT1 A 1;
|
||||
Stop;
|
||||
}
|
||||
}
|
||||
|
||||
Class UTMainHandler : EventHandler
|
||||
{
|
||||
Array<QueuedFlash> flashes;
|
||||
|
|
@ -3050,29 +3061,28 @@ Class UTMainHandler : EventHandler
|
|||
}
|
||||
else if ( e.Replacee == 'InvulnerabilitySphere' ) e.Replacement = 'UTInvulnerability';
|
||||
else if ( e.Replacee == 'Berserk' ) e.Replacement = 'UDamage';
|
||||
else if ( (e.Replacee == 'ArtiTomeOfPower') || (e.Replacee == 'ArtiEgg') ) e.Replacement = 'ActUDamage';
|
||||
else if ( (e.Replacee == 'ArtiTomeOfPower') || (e.Replacee == 'ArtiEgg') || (e.Replacee == 'ArtiPork') ) e.Replacement = 'ActUDamage';
|
||||
else if ( e.Replacee == 'Soulsphere' ) e.Replacement = 'UTHealthPack';
|
||||
else if ( e.Replacee == 'ArtiSuperHealth' ) e.Replacement = 'ActHealthPack';
|
||||
else if ( e.Replacee == 'Megasphere' ) e.Replacement = 'UTShieldBelt';
|
||||
else if ( e.Replacee == 'ArtiInvulnerability' ) e.Replacement = 'ActUTInvulnerability';
|
||||
else if ( (e.Replacee == 'Megasphere') || (e.Replacee == 'EnchantedShield') || (e.Replacee == 'ArtiBoostArmor') ) e.Replacement = 'UTShieldBelt';
|
||||
else if ( (e.Replacee == 'ArtiInvulnerability') || (e.Replacee == 'ArtiInvulnerability2') ) e.Replacement = 'ActUTInvulnerability';
|
||||
else if ( (e.Replacee == 'Allmap') || (e.Replacee == 'SuperMap') ) e.Replacement = 'UTMapRevealer';
|
||||
else if ( e.Replacee == 'BlurSphere' ) e.Replacement = 'UTInvisibility';
|
||||
else if ( e.Replacee == 'ArtiInvisibility' ) e.Replacement = 'ActUTInvisibility';
|
||||
else if ( e.Replacee == 'Infrared' ) e.Replacement = 'UTNightVision';
|
||||
else if ( e.Replacee == 'ArtiTorch' ) e.Replacement = 'ActUTNightVision';
|
||||
else if ( e.Replacee == 'RadSuit' ) e.Replacement = 'UTJumpBoots';
|
||||
else if ( e.Replacee == 'ArtiFly' ) e.Replacement = 'ActJumpBoots';
|
||||
else if ( (e.Replacee == 'Backpack') || (e.Replacee == 'BagOfHolding') ) e.Replacement = 'UTBackpack';
|
||||
else if ( (e.Replacee == 'ArmorBonus') || (e.Replacee == 'ArtiTimeBomb') ) e.Replacement = 'UTArmorBonus';
|
||||
else if ( (e.Replacee == 'ArtiFly') || (e.Replacee == 'ArtiSpeedBoots') ) e.Replacement = 'ActJumpBoots';
|
||||
else if ( (e.Replacee == 'Backpack') || (e.Replacee == 'BagOfHolding') || (e.Replacee == 'ArtiHealingRadius') ) e.Replacement = 'UTBackpack';
|
||||
else if ( (e.Replacee == 'ArmorBonus') || (e.Replacee == 'ArtiTimeBomb') || (e.Replacee is 'ArtiPoisonBag') || (e.Replacee is 'ArtiBlastRadius') ) e.Replacement = 'UTArmorBonus';
|
||||
else if ( (e.Replacee == 'HealthBonus') || (e.Replacee == 'CrystalVial') ) e.Replacement = 'UTHealthBonus';
|
||||
else if ( e.Replacee == 'GreenArmor' ) e.Replacement = 'UTThighPads';
|
||||
else if ( (e.Replacee == 'GreenArmor') || (e.Replacee == 'AmuletOfWarding') || (e.Replacee == 'PlatinumHelm') ) e.Replacement = 'UTThighPads';
|
||||
else if ( e.Replacee == 'Silvershield' )
|
||||
{
|
||||
if ( Random[Replacements](0,1) ) e.Replacement = 'UTThighPads';
|
||||
else e.Replacement = 'UTBodyArmor';
|
||||
}
|
||||
else if ( e.Replacee == 'BlueArmor' ) e.Replacement = 'UTBodyArmor';
|
||||
else if ( e.Replacee == 'EnchantedShield' ) e.Replacement = 'UTShieldBelt';
|
||||
else if ( (e.Replacee == 'BlueArmor') || (e.Replacee == 'FalconShield') || (e.Replacee == 'MeshArmor') ) e.Replacement = 'UTBodyArmor';
|
||||
else if ( e.Replacee == 'Stimpack' ) e.Replacement = 'UTMedBox';
|
||||
else if ( e.Replacee == 'Medikit' ) e.Replacement = 'UTHealthBox';
|
||||
else if ( e.Replacee == 'ArtiHealth' )
|
||||
|
|
@ -3080,10 +3090,11 @@ Class UTMainHandler : EventHandler
|
|||
if ( !Random[Replacements](0,3) ) e.Replacement = 'ActHealthBox';
|
||||
else e.Replacement = 'ActMedBox';
|
||||
}
|
||||
else if ( e.Replacee == 'ArtiTeleport' )
|
||||
else if ( (e.Replacee == 'ArtiTeleport') || (e.Replacee == 'ArtiTeleportOther') || (e.Replacee == 'ArtiDarkServant') )
|
||||
{
|
||||
// I have no idea what to replace this with, so just have some random stuff
|
||||
if ( Random[Replacements](0,1) ) e.Replacement = 'ActHealthPack';
|
||||
if ( (gameinfo.gametype&GAME_Hexen) && Random[Replacements](0,1) ) e.Replacement = 'UTBackpack';
|
||||
else if ( Random[Replacements](0,1) ) e.Replacement = 'ActHealthPack';
|
||||
else e.Replacement = 'ActUDamage';
|
||||
}
|
||||
else if ( e.Replacee == 'RedCard' ) e.Replacement = 'UTRedKey';
|
||||
|
|
@ -3094,7 +3105,7 @@ Class UTMainHandler : EventHandler
|
|||
else if ( e.Replacee == 'YellowSkull' ) e.Replacement = 'UTGoldSkull';
|
||||
else if ( e.Replacee == 'TeleportFog' ) e.Replacement = 'UTTeleportFog';
|
||||
else if ( e.Replacee == 'ItemFog' ) e.Replacement = 'UTItemFog';
|
||||
else if ( flak_blood && (e.Replacee == 'Blood') ) e.Replacement = 'UTBlood';
|
||||
else if ( flak_blood && ((e.Replacee == 'Blood') || (e.Replacee == 'BloodSplatter') || (e.Replacee == 'AxeBlood')) ) e.Replacement = 'UTBlood';
|
||||
else if ( e.Replacee == 'KeyYellow' ) e.Replacement = 'UTHereticYellowKey';
|
||||
else if ( e.Replacee == 'KeyGreen' ) e.Replacement = 'UTHereticGreenKey';
|
||||
else if ( e.Replacee == 'KeyBlue' ) e.Replacement = 'UTHereticBlueKey';
|
||||
|
|
@ -3103,7 +3114,25 @@ Class UTMainHandler : EventHandler
|
|||
// pretty sure that is a standardized name, so it should work for any heretic mod that adds it
|
||||
e.Replacement = 'UTHereticRedKey';
|
||||
}
|
||||
// TODO Hexen replacements
|
||||
// Hexen weapon replacements will attempt to follow some sort of progression
|
||||
// (also additional support for Hexmas because of course)
|
||||
else if ( (e.Replacee == 'FWeapFist') || (e.Replacee == 'CWeapMace') || (e.Replacee == 'MWeapWand') )
|
||||
e.Replacement = 'ImpactHammer';
|
||||
else if ( e.Replacee == 'FWeapAxe' ) e.Replacement = 'BioRifle';
|
||||
else if ( e.Replacee == 'CWeapStaff' ) e.Replacement = 'ShockRifle';
|
||||
else if ( e.Replacee == 'MWeapFrost' ) e.Replacement = 'PulseGun';
|
||||
else if ( (e.Replacee == 'FWeaponPiece3') || (e.Replacee == 'FWeapQuietus') || (e.Replacee.GetClassName() == 'mkFullQuietus') ) e.Replacement = 'FlakCannon';
|
||||
else if ( e.Replacee == 'CWeaponPiece3' ) e.Replacement = 'UTBackpack';
|
||||
else if ( e.Replacee == 'MWeaponPiece3' ) e.Replacement = 'Enforcer';
|
||||
else if ( e.Replacee == 'FWeapHammer' ) e.Replacement = 'Ripper2';
|
||||
else if ( e.Replacee == 'CWeapFlame' ) e.Replacement = 'Minigun';
|
||||
else if ( e.Replacee == 'MWeapLightning' ) e.Replacement = 'SniperRifle';
|
||||
else if ( e.Replacee == 'FWeaponPiece2' ) e.Replacement = 'UTChainsaw';
|
||||
else if ( (e.Replacee == 'CWeaponPiece2') || (e.Replacee == 'CWeapWraithverge') || (e.Replacee.GetClassName() == 'mkFullWraithverge') ) e.Replacement = 'UTRocketLauncher';
|
||||
else if ( e.Replacee == 'MWeaponPiece2' ) e.Replacement = 'UTBackpack';
|
||||
else if ( e.Replacee == 'FWeaponPiece1' ) e.Replacement = 'WarheadAmmo';
|
||||
else if ( e.Replacee == 'CWeaponPiece1' ) e.Replacement = 'UTBackpack';
|
||||
else if ( (e.Replacee == 'MWeaponPiece1') || (e.Replacee == 'MWeapBloodscourge') || (e.Replacee.GetClassName() == 'mkFullBloodscourge') ) e.Replacement = 'WarheadLauncher';
|
||||
// TODO Strife replacements
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue