Migrate replacements to CheckReplacement.

Added support for bridge actors on Biorifle (may be a bit glitchy).
Corrected air movement, added UT jump height, set dodge height to actual UT value.
This commit is contained in:
Marisa the Magician 2018-08-27 20:15:23 +02:00
commit 4ea4eb0e3b
14 changed files with 251 additions and 146 deletions

View file

@ -54,6 +54,8 @@ Sprite "GELXI0",1,1{}
Sprite "GELXJ0",1,1{}
Sprite "GELXK0",1,1{}
Sprite "GELXL0",1,1{}
Sprite "BIOPA0",1,1{}
Sprite "BIOPB0",1,1{}
Sprite "BIOSA0",1,1{}
Sprite "BIOSB0",1,1{}
Sprite "BIOSC0",1,1{}

View file

@ -26,7 +26,7 @@ Class UTArmor : Armor
}
}
Class UTArmorBonus : UTArmor replaces ArmorBonus
Class UTArmorBonus : UTArmor
{
override void AbsorbDamage( int damage, Name damageType, out int newdamage )
{
@ -53,7 +53,7 @@ Class UTArmorBonus : UTArmor replaces ArmorBonus
}
}
Class UTThighPads : UTArmor replaces GreenArmor
Class UTThighPads : UTArmor
{
override bool HandlePickup( Inventory item )
{
@ -92,7 +92,7 @@ Class UTThighPads : UTArmor replaces GreenArmor
}
}
Class UTBodyArmor : UTArmor replaces BlueArmor
Class UTBodyArmor : UTArmor
{
override bool HandlePickup( Inventory item )
{
@ -131,7 +131,7 @@ Class UTBodyArmor : UTArmor replaces BlueArmor
}
}
Class UTShieldBelt : UTArmor replaces Megasphere
Class UTShieldBelt : UTArmor
{
override void AbsorbDamage( int damage, Name damageType, out int newdamage )
{

View file

@ -1,30 +1,3 @@
Class Tier3Ammo : RandomSpawner2 replaces Shell
{
Default
{
DropItem "BioAmmo2", 255, 1;
DropItem "ShockAmmo2", 255, 1;
}
}
Class Tier3Ammo2 : RandomSpawner2 replaces ShellBox
{
Default
{
DropItem "BioAmmo", 255, 1;
DropItem "ShockAmmo", 255, 1;
}
}
Class Tier3Weapon : RandomSpawner2 replaces Shotgun
{
Default
{
DropItem "BioRifle", 255, 1;
DropItem "ShockRifle", 255, 1;
}
}
Class Tier3Weapon2 : Tier3Weapon replaces SuperShotgun {}
Class BioAmmo : Ammo
{
Default
@ -214,6 +187,9 @@ Class BioGel : Actor
double atz;
double rollvel, pitchvel, yawvel;
Vector3 normal;
Actor atbridge;
bool onbridge;
Vector3 atbridgeofs;
override void PostBeginPlay()
{
@ -253,6 +229,15 @@ Class BioGel : Actor
}
if ( deadtimer > -2 )
{
if ( onbridge ) // attempt to follow the movement of the bridge (if it's moving)
{
if ( atbridge )
{
if ( !Warp(atbridge,atbridgeofs.x,atbridgeofs.y,atbridgeofs.z,0,WARPF_ABSOLUTEOFFSET|WARPF_USECALLERANGLE|WARPF_COPYINTERPOLATION) )
deadtimer = min(deadtimer,0);
}
else deadtimer = min(deadtimer,0);
}
if ( atline ) // attempt to follow the movement of the line
{
if ( atpart == 1 )
@ -376,6 +361,105 @@ Class BioGel : Actor
hittype = HIT_CEILING;
else hittype = HIT_FLOOR;
}
else if ( tracer && tracer.bACTLIKEBRIDGE )
{
atbridge = tracer;
onbridge = true;
if ( (pos.x+radius) <= (atbridge.pos.x-atbridge.radius) )
{
// west side
normal = (-1,0,0);
SetOrigin((atbridge.pos.x-atbridge.radius,pos.y,pos.z),false);
atbridgeofs = pos-atbridge.pos;
angle = 180;
pitch = 0;
roll = 180; // otherwise it slides upwards (UT changes roll like this too)
if ( waterlevel > 0 ) hittype = HIT_FLOOR;
else hittype = HIT_WALL;
}
else if ( (pos.x-radius) >= (atbridge.pos.x+atbridge.radius) )
{
// east side
normal = (1,0,0);
SetOrigin((atbridge.pos.x+atbridge.radius,pos.y,pos.z),false);
atbridgeofs = pos-atbridge.pos;
angle = 0;
pitch = 0;
roll = 180; // otherwise it slides upwards (UT changes roll like this too)
if ( waterlevel > 0 ) hittype = HIT_FLOOR;
else hittype = HIT_WALL;
}
else if ( (pos.y+radius) <= (atbridge.pos.y-atbridge.radius) )
{
// north side
normal = (0,-1,0);
SetOrigin((pos.x,atbridge.pos.y-atbridge.radius,pos.z),false);
atbridgeofs = pos-atbridge.pos;
angle = 270;
pitch = 0;
roll = 180; // otherwise it slides upwards (UT changes roll like this too)
if ( waterlevel > 0 ) hittype = HIT_FLOOR;
else hittype = HIT_WALL;
}
else if ( (pos.y-radius) >= (atbridge.pos.y+atbridge.radius) )
{
// south side
normal = (0,1,0);
SetOrigin((pos.x,atbridge.pos.y+atbridge.radius,pos.z),false);
atbridgeofs = pos-atbridge.pos;
angle = 90;
pitch = 0;
roll = 180; // otherwise it slides upwards (UT changes roll like this too)
if ( waterlevel > 0 ) hittype = HIT_FLOOR;
else hittype = HIT_WALL;
}
else if ( pos.z >= (atbridge.pos.z+atbridge.height) )
{
// top of actor
normal = (0,0,1);
SetOrigin((pos.x,pos.y,atbridge.pos.z+atbridge.height),false);
atbridgeofs = pos-atbridge.pos;
pitch = -90;
angle = 0;
roll = FRandom[GES](0,360);
hittype = HIT_FLOOR;
}
else if ( (pos.z+height) <= atbridge.pos.z )
{
// bottom of actor
normal = (0,0,-1);
SetOrigin((pos.x,pos.y,atbridge.pos.z),false);
pitch = 90;
angle = 0;
roll = FRandom[GES](0,360);
if ( waterlevel > 0 ) hittype = HIT_FLOOR;
else hittype = HIT_CEILING;
}
else
{
// inside of actor, just shove to the top or bottom based on our Z velocity
if ( vel.z <= 0 )
{
normal = (0,0,1);
SetOrigin((pos.x,pos.y,atbridge.pos.z+atbridge.height),false);
atbridgeofs = pos-atbridge.pos;
pitch = -90;
angle = 0;
roll = FRandom[GES](0,360);
hittype = HIT_FLOOR;
}
else
{
normal = (0,0,-1);
SetOrigin((pos.x,pos.y,atbridge.pos.z),false);
pitch = 90;
angle = 0;
roll = FRandom[GES](0,360);
if ( waterlevel > 0 ) hittype = HIT_FLOOR;
else hittype = HIT_CEILING;
}
}
}
else
{
SetStateLabel("XDeath");
@ -453,6 +537,7 @@ Class BioGel : Actor
+FORCEXYBILLBOARD;
+MOVEWITHSECTOR;
+NODAMAGETHRUST;
+HITTRACER;
}
States
{

View file

@ -1,12 +1,3 @@
Class Tier1Weapon : RandomSpawner2 replaces Chainsaw
{
Default
{
DropItem "UTChainsaw", 255, 1;
DropItem "Enforcer", 255, 1;
}
}
Class SawImpact : Actor
{
Default

View file

@ -1,4 +1,4 @@
Class EClip : MiniAmmo replaces Clip
Class EClip : MiniAmmo
{
Default
{
@ -155,7 +155,7 @@ Class UTCasing : Actor
}
}
Class Enforcer : UTWeapon replaces Pistol
Class Enforcer : UTWeapon
{
int ClipCount, SlaveClipCount;
bool SlaveActive, SlaveDown, SlaveReload, SlaveAltFire;

View file

@ -1,29 +1,3 @@
Class Tier5Ammo : RandomSpawner2 replaces RocketAmmo
{
Default
{
DropItem "FlakAmmo2", 255, 1;
DropItem "UTRocketAmmo2", 255, 1;
}
}
Class Tier5Ammo2 : RandomSpawner2 replaces RocketBox
{
Default
{
DropItem "FlakAmmo", 255, 1;
DropItem "UTRocketAmmo", 255, 1;
}
}
Class Tier5Weapon : RandomSpawner2 replaces RocketLauncher
{
Default
{
DropItem "FlakCannon", 255, 1;
DropItem "UTRocketLauncher", 255, 1;
}
}
Class FlakAmmo : Ammo
{
Default

View file

@ -1,4 +1,4 @@
Class UTHealthPack : Health replaces Soulsphere
Class UTHealthPack : Health
{
Default
{
@ -21,7 +21,7 @@ Class UTHealthPack : Health replaces Soulsphere
}
}
Class UTHealthBox : Health replaces Medikit
Class UTHealthBox : Health
{
Default
{
@ -38,7 +38,7 @@ Class UTHealthBox : Health replaces Medikit
}
}
Class UTMedBox : Health replaces Stimpack
Class UTMedBox : Health
{
Default
{
@ -56,7 +56,7 @@ Class UTMedBox : Health replaces Stimpack
}
}
Class UTHealthBonus : Health replaces HealthBonus
Class UTHealthBonus : Health
{
Default
{

View file

@ -39,7 +39,7 @@ Class HammerImpact : Actor
}
}
Class ImpactHammer : UTWeapon replaces Fist
Class ImpactHammer : UTWeapon
{
double chargesize, count;

View file

@ -1,30 +1,3 @@
Class Tier6Ammo : RandomSpawner2 replaces Cell
{
Default
{
DropItem "EClip", 255, 1;
DropItem "RifleAmmo2", 255, 1;
}
}
Class Tier6Ammo2 : RandomSpawner2 replaces CellPack
{
Default
{
DropItem "MiniAmmo", 255, 6;
DropItem "RifleAmmo", 255, 6;
DropItem "WarheadAmmo", 255, 1;
}
}
Class Tier6Weapon : RandomSpawner2 replaces PlasmaRifle
{
Default
{
DropItem "Minigun", 255, 1;
DropItem "SniperRifle", 255, 1;
}
}
Class MiniAmmo : Ammo
{
Default

View file

@ -1,4 +1,4 @@
Class UDamage : PowerupGiver replaces Berserk
Class UDamage : PowerupGiver
{
Default
{
@ -100,7 +100,7 @@ Class DamageAmplifier : Powerup
}
// Backpack that only gives ammo for valid weapons
Class UTBackpack : BackpackItem replaces Backpack
Class UTBackpack : BackpackItem
{
override Inventory CreateCopy( Actor other )
{
@ -219,7 +219,7 @@ Class PowerUTInvisibility : PowerInvisibility
}
}
Class UTInvisibility : PowerupGiver replaces BlurSphere
Class UTInvisibility : PowerupGiver
{
Default
{
@ -280,7 +280,7 @@ Class UTInvisibilityX : Actor
}
}
Class UTMapRevealer : MapRevealer replaces Allmap
Class UTMapRevealer : MapRevealer
{
Default
{
@ -299,7 +299,7 @@ Class UTMapRevealer : MapRevealer replaces Allmap
}
}
Class UTJumpBoots : Inventory replaces RadSuit
Class UTJumpBoots : Inventory
{
Default
{
@ -383,7 +383,7 @@ Class PowerJumpBoots_IronFeet : PowerIronFeet
}
}
Class Searchlight : Inventory replaces Infrared
Class Searchlight : Inventory
{
Actor lt[3];
int ticcnt;

View file

@ -1,21 +1,3 @@
Class Tier4Ammo : RandomSpawner2 replaces ClipBox
{
Default
{
DropItem "PulseAmmo", 255, 1;
DropItem "RipperAmmo", 255, 1;
}
}
Class Tier4Weapon : RandomSpawner2 replaces Chaingun
{
Default
{
DropItem "PulseGun", 255, 1;
DropItem "Ripper2", 255, 1;
}
}
Class PulseAmmo : Ammo
{
Default

View file

@ -1162,7 +1162,7 @@ Class ViewSuperShockSpark : ViewShockSpark
}
}
Class EnhancedShockRifle : UTWeapon replaces InvulnerabilitySphere
Class EnhancedShockRifle : UTWeapon
{
override void PostBeginPlay()
{

View file

@ -15,8 +15,9 @@ Class UTPlayer : DoomPlayer
const walkfactor = 0.3;
const utaircontrol = 0.35;
const groundspeed_doomish = 600.;
const fluidfriction = 1.2;
const terminalvelocity = 2500.;
const dodgez = 210.;
const utjumpz = 325.;
Default
{
@ -278,7 +279,7 @@ Class UTPlayer : DoomPlayer
{
if ( doomspeed.GetBool() ) vel += dodge.unit()*(groundspeed_doomish*1.5)/TICRATE;
else vel += dodge.unit()*(groundspeed*1.5)/TICRATE;
vel.z += jumpz*0.5;
vel.z += dodgez/TICRATE;
bOnMobj = false;
if ( !(player.cheats&CF_PREDICTING) )
A_PlaySound("*jump",CHAN_BODY);
@ -333,20 +334,22 @@ Class UTPlayer : DoomPlayer
acceleration = acceleration.unit()*maxaccel;
Vector2 dir = (0,0);
if ( vel.xy.length() > double.epsilon ) dir = vel.xy.unit();
if ( acceleration.length() <= double.epsilon )
{
Vector2 oldvel = vel.xy;
vel.xy = vel.xy - (2 * dir) * vel.xy.length() * fluidfriction/TICRATE;
if ( oldvel dot vel.xy < 0.0 ) vel.xy *= 0;
}
else
if ( acceleration.length() > double.epsilon )
{
Vector2 acceldir = acceleration.unit();
acceleration = acceldir * Min(acceleration.length(), accelrate/TICRATE);
vel.xy = vel.xy - (dir - acceldir) * vel.xy.length() * fluidfriction/TICRATE;
}
acceleration *= doomaircontrol.GetBool()?level.aircontrol:utaircontrol;
vel.xy = vel.xy + acceleration/TICRATE;
double maxvel;
if ( doomspeed.GetBool() ) maxvel = (groundspeed_doomish*fs)/TICRATE;
else maxvel = (groundspeed*fs)/TICRATE;
// if new velocity is higher than ground speed, steer but don't increase it
if ( (vel.xy+acceleration/TICRATE).length() > maxvel )
{
double vsiz = vel.xy.length();
vel.xy = (vel.xy+acceleration/TICRATE).unit()*vsiz;
}
else vel.xy = vel.xy+acceleration/TICRATE;
if ( vel.length() > terminalvelocity/TICRATE ) vel = vel.unit()*(terminalvelocity/TICRATE);
player.vel *= 0;
}
@ -395,6 +398,7 @@ Class UTPlayer : DoomPlayer
override void CheckJump()
{
if ( !utmovement ) utmovement = CVar.GetCVar('flak_utmovement');
if ( !doomspeed ) doomspeed = CVar.GetCVar('flak_doomspeed');
if ( !utmovement.GetBool() )
{
Super.CheckJump();
@ -407,7 +411,9 @@ Class UTPlayer : DoomPlayer
else if ( bNoGravity ) Vel.z = 3.;
else if ( level.IsJumpingAllowed() && player.onground && (player.jumpTics == 0) && (last_jump_held < gametic-1) )
{
double jumpvelz = JumpZ;
double jumpvelz;
if ( doomspeed.GetBool() ) jumpvelz = jumpz;
else jumpvelz = utjumpz/TICRATE;
double jumpfac = 0;
for ( let p = Inv; p != null; p = p.Inv )
{
@ -627,7 +633,7 @@ Class UTItemLight : DynamicLight
}
}
Class UTTeleportFog : Actor replaces TeleportFog
Class UTTeleportFog : Actor
{
Default
{
@ -651,7 +657,7 @@ Class UTTeleportFog : Actor replaces TeleportFog
}
}
Class UTItemFog : Actor replaces ItemFog
Class UTItemFog : Actor
{
Default
{
@ -1000,7 +1006,7 @@ Class UTStaticViewSmoke : UTViewSmoke
}
}
Class UTRedSkull : RedSkull replaces RedSkull
Class UTRedSkull : RedSkull
{
Default
{
@ -1016,7 +1022,7 @@ Class UTRedSkull : RedSkull replaces RedSkull
}
}
Class UTGoldSkull : YellowSkull replaces YellowSkull
Class UTGoldSkull : YellowSkull
{
Default
{
@ -1032,7 +1038,7 @@ Class UTGoldSkull : YellowSkull replaces YellowSkull
}
}
Class UTBlueSkull : BlueSkull replaces BlueSkull
Class UTBlueSkull : BlueSkull
{
Default
{
@ -1048,7 +1054,7 @@ Class UTBlueSkull : BlueSkull replaces BlueSkull
}
}
Class UTRedKey : RedCard replaces RedCard
Class UTRedKey : RedCard
{
Default
{
@ -1064,7 +1070,7 @@ Class UTRedKey : RedCard replaces RedCard
}
}
Class UTGoldKey : YellowCard replaces YellowCard
Class UTGoldKey : YellowCard
{
Default
{
@ -1080,7 +1086,7 @@ Class UTGoldKey : YellowCard replaces YellowCard
}
}
Class UTBlueKey : BlueCard replaces BlueCard
Class UTBlueKey : BlueCard
{
Default
{
@ -1137,6 +1143,98 @@ Class UTMainHandler : StaticEventHandler
Array<QueuedFlash> flashes;
transient CVar nobosstelefrag;
override void CheckReplacement( ReplaceEvent e )
{
if ( e.Replacee == 'Chainsaw' )
{
if ( Random[Replacements](0,1) ) e.Replacement = 'UTChainsaw';
else e.Replacement = 'Enforcer';
}
else if ( e.Replacee == 'Fist' ) e.Replacement = 'ImpactHammer';
else if ( e.Replacee == 'Pistol' ) e.Replacement = 'Enforcer';
else if ( (e.Replacee == 'Shotgun') || (e.Replacee == 'SuperShotgun') )
{
if ( Random[Replacements](0,1) ) e.Replacement = 'BioRifle';
else e.Replacement = 'ShockRifle';
}
else if ( e.Replacee == 'Chaingun' )
{
if ( Random[Replacements](0,1) ) e.Replacement = 'PulseGun';
else e.Replacement = 'Ripper2';
}
else if ( e.Replacee == 'RocketLauncher' )
{
if ( Random[Replacements](0,1) ) e.Replacement = 'FlakCannon';
else e.Replacement = 'UTRocketLauncher';
}
else if ( e.Replacee == 'PlasmaRifle' )
{
if ( Random[Replacements](0,1) ) e.Replacement = 'Minigun';
else e.Replacement = 'SniperRifle';
}
else if ( e.Replacee == 'BFG9000' ) e.Replacement = 'WarheadLauncher';
else if ( e.Replacee == 'Clip' ) e.Replacement = 'EClip';
else if ( e.Replacee == 'ClipBox' )
{
if ( Random[Replacements](0,1) ) e.Replacement = 'PulseAmmo';
else e.Replacement = 'RipperAmmo';
}
else if ( e.Replacee == 'Shell' )
{
if ( Random[Replacements](0,1) ) e.Replacement = 'BioAmmo2';
else e.Replacement = 'ShockAmmo2';
}
else if ( e.Replacee == 'ShellBox' )
{
if ( Random[Replacements](0,1) ) e.Replacement = 'BioAmmo';
else e.Replacement = 'ShockAmmo';
}
else if ( e.Replacee == 'RocketAmmo' )
{
if ( Random[Replacements](0,1) ) e.Replacement = 'FlakAmmo2';
else e.Replacement = 'UTRocketAmmo2';
}
else if ( e.Replacee == 'RocketBox' )
{
if ( Random[Replacements](0,1) ) e.Replacement = 'FlakAmmo';
else e.Replacement = 'UTRocketAmmo';
}
else if ( e.Replacee == 'Cell' )
{
if ( Random[Replacements](0,1) ) e.Replacement = 'EClip';
else e.Replacement = 'RifleAmmo2';
}
else if ( e.Replacee == 'CellPack' )
{
if ( !Random[Replacements](0,5) ) e.Replacement = 'WarheadAmmo';
else if ( Random[Replacements](0,1) ) e.Replacement = 'MiniAmmo';
else e.Replacement = 'RifleAmmo';
}
else if ( e.Replacee == 'InvulnerabilitySphere' ) e.Replacement = 'EnhancedShockRifle';
else if ( e.Replacee == 'Berserk' ) e.Replacement = 'UDamage';
else if ( e.Replacee == 'Soulsphere' ) e.Replacement = 'UTHealthPack';
else if ( e.Replacee == 'Megasphere' ) e.Replacement = 'UTShieldBelt';
else if ( e.Replacee == 'Allmap' ) e.Replacement = 'UTMapRevealer';
else if ( e.Replacee == 'BlurSphere' ) e.Replacement = 'UTInvisibility';
else if ( e.Replacee == 'Infrared' ) e.Replacement = 'Searchlight';
else if ( e.Replacee == 'RadSuit' ) e.Replacement = 'UTJumpBoots';
else if ( e.Replacee == 'Backpack' ) e.Replacement = 'UTBackpack';
else if ( e.Replacee == 'ArmorBonus' ) e.Replacement = 'UTArmorBonus';
else if ( e.Replacee == 'HealthBonus' ) e.Replacement = 'UTHealthBonus';
else if ( e.Replacee == 'GreenArmor' ) e.Replacement = 'UTThighPads';
else if ( e.Replacee == 'BlueArmor' ) e.Replacement = 'UTBodyArmor';
else if ( e.Replacee == 'Stimpack' ) e.Replacement = 'UTMedBox';
else if ( e.Replacee == 'Medikit' ) e.Replacement = 'UTHealthBox';
else if ( e.Replacee == 'RedCard' ) e.Replacement = 'UTRedKey';
else if ( e.Replacee == 'BlueCard' ) e.Replacement = 'UTBlueKey';
else if ( e.Replacee == 'YellowCard' ) e.Replacement = 'UTGoldKey';
else if ( e.Replacee == 'RedSkull' ) e.Replacement = 'UTRedSkull';
else if ( e.Replacee == 'BlueSkull' ) e.Replacement = 'UTBlueSkull';
else if ( e.Replacee == 'YellowSkull' ) e.Replacement = 'UTGoldSkull';
else if ( e.Replacee == 'TeleportFog' ) e.Replacement = 'UTTeleportFog';
else if ( e.Replacee == 'ItemFog' ) e.Replacement = 'UTItemFog';
}
private Actor AddLight( Vector3 pos, Color col, int radius )
{
Actor l = Actor.Spawn("PointLightAttenuated",pos);

View file

@ -609,7 +609,7 @@ Class RedeemerHUDHandler : EventHandler
}
}
Class WarheadLauncher : UTWeapon replaces BFG9000
Class WarheadLauncher : UTWeapon
{
transient CVar noswitchdeemer;
Actor guided;