Finishing touches for hexen compatibility (1.1 update):

- 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.
This commit is contained in:
Marisa the Magician 2019-12-15 14:28:20 +01:00
commit da8f6fc4b2
27 changed files with 314 additions and 70 deletions

View file

@ -287,13 +287,13 @@ Class UTHexenAmmoBox : Inventory
default
{
UTHexenAmmoBox.AmmoFactor -1;
+INVENTORY.ALWAYSPICKUP;
Inventory.PickupSound = "misc/i_pkup";
+FLOATBOB;
Inventory.PickupSound "misc/i_pkup";
}
override bool TryPickup( in out Actor toucher )
{
bool hasgiven = (AmmoFactor <= 0); // always true
bool hasgiven = (AmmoFactor < 0); // always true
for ( int i=0; i<AllActorClasses.Size(); i++ )
{
let type = (class<Ammo>)(AllActorClasses[i]);
@ -315,23 +315,27 @@ Class UTHexenAmmoBox : Inventory
}
}
// sneaky fix for chainsaw ammo
if ( (type is 'ChainsawAmmo') && flak_sawammo ) isvalid = true;
if ( (type is 'ChainsawAmmo') && flak_sawammo && (GetReplacement(type) == type) ) isvalid = true;
if ( !isvalid ) continue;
let ammoitem = Ammo(toucher.FindInventory(type));
int amount;
if ( AmmoFactor < 0 ) amount = GetDefaultByType(type).MaxAmount;
int amount = GetDefaultByType(type).BackpackAmount;
if ( AmmoFactor < 0 )
{
if ( ammoitem ) amount = ammoitem.MaxAmount;
else amount = GetDefaultByType(type).MaxAmount;
}
else
{
amount = (GetDefaultByType(type).Amount*100)/AmmoFactor;
amount = (amount*AmmoFactor)/100;
// extra ammo in baby mode and nightmare mode
if ( !bIgnoreSkill ) amount = int(amount*G_SkillPropertyFloat(SKILLP_AmmoFactor));
}
if ( amount < 0 ) amount = 0;
if ( amount <= 0 ) continue;
if ( !ammoitem )
{
// The player did not have the ammoitem. Add it.
ammoitem = Ammo(Spawn(type));
ammoitem.Amount = bDepleted?0:amount;
ammoitem.Amount = amount;
if ( ammoitem.Amount > ammoitem.MaxAmount )
ammoitem.Amount = ammoitem.MaxAmount;
ammoitem.AttachToOwner(toucher);
@ -340,7 +344,7 @@ Class UTHexenAmmoBox : Inventory
else
{
// The player had the ammoitem. Give some more.
if ( !bDepleted && (ammoitem.Amount < ammoitem.MaxAmount) )
if ( ammoitem.Amount < ammoitem.MaxAmount )
{
ammoitem.Amount += amount;
if ( ammoitem.Amount > ammoitem.MaxAmount )
@ -375,12 +379,12 @@ Class UTMediumAmmoBox : UTHexenAmmoBox
{
Tag "$T_AMMOBOXMED";
Inventory.PickupMessage "$I_AMMOBOXMED";
UTHexenAmmoBox.AmmoFactor 120;
UTHexenAmmoBox.AmmoFactor 90;
}
States
{
Spawn:
ABOX B -1;
ABOX A -1;
Stop;
}
}
@ -390,12 +394,12 @@ Class UTMajorAmmoBox : UTHexenAmmoBox
{
Tag "$T_AMMOBOXHIGH";
Inventory.PickupMessage "$I_AMMOBOXHIGH";
UTHexenAmmoBox.AmmoFactor 180;
UTHexenAmmoBox.AmmoFactor 120;
}
States
{
Spawn:
ABOX C -1;
ABOX A -1;
Stop;
}
}
@ -407,6 +411,7 @@ Class ActUTFullAmmoBox : UTActivatable
Inventory.Icon "ItemABox";
Inventory.PickupMessage "$I_AMMOBOXFULL";
+COUNTITEM;
+FLOATBOB;
+INVENTORY.BIGPOWERUP;
UTActivatable.GiveItem "UTHexenAmmoBox";
Inventory.RespawnTics 4200;
@ -414,7 +419,7 @@ Class ActUTFullAmmoBox : UTActivatable
States
{
Spawn:
ABOX D -1;
ABOX A -1;
Stop;
}
}

View file

@ -66,7 +66,7 @@ Class ImpactHammer : UTWeapon
if ( invoker.count > .2 )
{
invoker.count = 0;
A_AlertMonsters();
A_AlertMonsters(gameinfo.gametype&GAME_Strife?100:0);
}
A_QuakeEx(clamp(int(invoker.chargesize),0,2),clamp(int(invoker.chargesize),0,2),clamp(int(invoker.chargesize),0,2),2,0,96,"",QF_RELATIVE,rollIntensity:clamp(invoker.chargesize*0.3,0,0.3));
UTMainHandler.DoSwing(self,(FRandom[Impact](-1,1),FRandom[Impact](-1,1)),invoker.chargesize*0.1,0,1,SWING_Spring);
@ -90,7 +90,7 @@ Class ImpactHammer : UTWeapon
A_PlaySound("impact/release",CHAN_WEAPON);
invoker.FireEffect();
UTMainHandler.DoSwing(self,(FRandom[Impact](-0.3,-1.5),FRandom[Impact](-1.2,-0.4)),3,-0.8,3,SWING_Spring,3,2);
A_AlertMonsters();
A_AlertMonsters(gameinfo.gametype&GAME_Strife?100:0);
Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-4*z);
@ -102,6 +102,7 @@ Class ImpactHammer : UTWeapon
int dmg = int(60*realcharge);
dmg = d.HitActor.DamageMobj(invoker,self,dmg,'impact',DMG_THRUSTLESS);
d.HitActor.vel = x*(8000/d.HitActor.mass)*realcharge;
if ( gameinfo.gametype&GAME_Strife ) d.HitActor.DaggerAlert(self);
if ( d.HitActor.bNOBLOOD )
{
let p = Spawn("HammerImpact",d.HitLocation-d.HitDir*4);
@ -154,7 +155,7 @@ Class ImpactHammer : UTWeapon
A_PlaySound("impact/fire",CHAN_WEAPON);
invoker.FireEffect();
UTMainHandler.DoSwing(self,(FRandom[Impact](-0.3,-1.5),FRandom[Impact](-1.2,-0.4)),2,-0.6,2,SWING_Spring,1,2);
A_AlertMonsters();
A_AlertMonsters(gameinfo.gametype&GAME_Strife?100:0);
A_QuakeEx(2,2,2,6,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1);
Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
@ -167,6 +168,7 @@ Class ImpactHammer : UTWeapon
int dmg = int(20*dscale);
dmg = d.HitActor.DamageMobj(invoker,self,dmg,'impact',DMG_THRUSTLESS);
d.HitActor.vel = x*(4000/d.HitActor.mass)*dscale;
if ( gameinfo.gametype&GAME_Strife ) d.HitActor.DaggerAlert(self);
}
else if ( d.HitType != TRACE_HitNone )
{

View file

@ -234,7 +234,7 @@ Class UTBackpack : BackpackItem
}
}
// sneaky fix for chainsaw ammo
if ( (type is 'ChainsawAmmo') && flak_sawammo ) isvalid = true;
if ( (type is 'ChainsawAmmo') && flak_sawammo && (GetReplacement(type) == type) ) isvalid = true;
if ( !isvalid ) continue;
let ammoitem = Ammo(other.FindInventory(type));
int amount = GetDefaultByType(type).BackpackAmount;

View file

@ -1,5 +1,6 @@
Class UTPlayer : DoomPlayer
{
bool doprintnoammo;
bool lastground;
int lastwaterlevel;
int lastgroundtic;
@ -198,9 +199,14 @@ Class UTPlayer : DoomPlayer
let type = (class<Inventory>)(AllActorClasses[i]);
if ( !type ) continue;
let def = GetDefaultByType(type);
if ( !(gameinfo.gametype&GAME_Raven)
&& ((type is "UTActivatable") || (type is "UTActivatableHealth")) )
continue; // don't give these outside of Heretic/Hexen
if ( (!(gameinfo.gametype&GAME_Raven)
&& ((type is "UTActivatable") || (type is "UTActivatableHealth")))
|| ((gameinfo.gametype&GAME_HERETIC) && (type is 'ActUTFullAmmoBox')) )
{
// don't give activatables outside of Heretic/Hexen
// don't give full ammo cubes outside of Hexen
continue;
}
if ( def.Icon.isValid() && (def.MaxAmount > 1) &&
!(type is "PuzzleItem") && !(type is "Powerup") && !(type is "Ammo") && !(type is "Armor"))
{
@ -235,9 +241,28 @@ Class UTPlayer : DoomPlayer
else GiveInventory(type,amount,true);
}
// modified so it displays the "has no ammo" message
override Weapon PickWeapon( int slot, bool checkammo )
{
doprintnoammo = true;
let rslt = Super.PickWeapon(slot,checkammo);
doprintnoammo = false;
return rslt;
}
override void Tick()
{
Super.Tick();
if ( !flak_utmovement || !player || (player.mo != self) || (player.cheats&(CF_FROZEN|CF_TOTALLYFROZEN)) )
{
bNOFRICTION = false;
bNOFRICTIONBOUNCE = false;
}
else
{
bNOFRICTION = true;
bNOFRICTIONBOUNCE = true;
}
if ( InStateSequence(CurState,FindState("See",true)) )
SetStateLabel("See2");
if ( (waterlevel >= 2) && (lastwaterlevel < 2) )
@ -252,17 +277,6 @@ Class UTPlayer : DoomPlayer
else if ( (waterlevel < 3) && underwatersnd )
underwatersnd.Destroy();
lastwaterlevel = waterlevel;
if ( !flak_utmovement || !player || (player.mo != self) || (player.cheats&(CF_FROZEN|CF_TOTALLYFROZEN)) )
{
bNOFRICTION = false;
bNOFRICTIONBOUNCE = false;
return;
}
else
{
bNOFRICTION = true;
bNOFRICTIONBOUNCE = true;
}
if ( !footsteps ) footsteps = CVar.GetCVar('flak_footsteps',players[consoleplayer]);
if ( !footsteps.GetBool() || (Health <= 0) ) return;
double ang = level.time/(20*TICRATE/35.)*360.;
@ -1895,11 +1909,9 @@ Class UTWeapon : Weapon
override bool CheckAmmo( int fireMode, bool autoSwitch, bool requireAmmo, int ammocount )
{
bool rslt = Super.CheckAmmo(fireMode,autoSwitch,requireAmmo,ammocount);
if ( (gametic > lastnoammotic) && !rslt && !autoSwitch && !requireAmmo && Owner.CheckLocalView() )
{
lastnoammotic = gametic;
Console.Printf(StringTable.Localize((Amount>1)?"$M_NOAMMO2":"$M_NOAMMO"),GetTag());
}
if ( (gametic <= lastnoammotic) || rslt || !Owner.CheckLocalView() || !(Owner is 'UTPlayer') || !UTPlayer(Owner).doprintnoammo ) return rslt;
lastnoammotic = gametic;
Console.Printf(StringTable.Localize((Amount>1)?"$M_NOAMMO2":"$M_NOAMMO"),GetTag());
return rslt;
}
@ -3133,6 +3145,10 @@ Class UTMainHandler : EventHandler
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';
else if ( e.Replacee == 'Mana1' ) e.Replacement = 'UTMinorAmmoBox';
else if ( e.Replacee == 'Mana2' ) e.Replacement = 'UTMediumAmmoBox';
else if ( e.Replacee == 'Mana3' ) e.Replacement = 'UTMajorAmmoBox';
else if ( e.Replacee == 'ArtiBoostMana' ) e.Replacement = 'ActUTFullAmmoBox';
// TODO Strife replacements
}
@ -3199,19 +3215,23 @@ Class UTMainHandler : EventHandler
level.sectors[i].SetTexture(1,skyflatnum);
if ( level.sectors[i].GetTexture(0) == deftex )
{
if ( gameinfo.gametype == GAME_DOOM )
if ( gameinfo.gametype&GAME_DOOM )
level.sectors[i].SetTexture(0,((i==47)||((i>=256)&&(i<=260)))?baseceil:baseflor);
else if ( gameinfo.gametype == GAME_HERETIC )
else if ( gameinfo.gametype&GAME_HERETIC )
level.sectors[i].SetTexture(0,((i==47)||((i>=144)&&(i<=148)))?baseceil:baseflor);
else if ( gameinfo.gametype&GAME_HEXEN )
level.sectors[i].SetTexture(0,((i==47)||((i>=152)&&(i<=155)))?baseceil:baseflor);
level.sectors[i].SetXScale(0,2.);
level.sectors[i].SetYScale(0,2.);
}
if ( level.sectors[i].GetTexture(1) == deftex )
{
if ( gameinfo.gametype == GAME_DOOM )
if ( gameinfo.gametype&GAME_DOOM )
level.sectors[i].SetTexture(1,((i==47)||((i>=256)&&(i<=260)))?baseflor:baseceil);
else if ( gameinfo.gametype == GAME_HERETIC )
else if ( gameinfo.gametype&GAME_HERETIC )
level.sectors[i].SetTexture(1,((i==47)||((i>=144)&&(i<=148)))?baseflor:baseceil);
else if ( gameinfo.gametype&GAME_HEXEN )
level.sectors[i].SetTexture(1,((i==47)||((i>=152)&&(i<=155)))?baseflor:baseceil);
level.sectors[i].SetXScale(1,2.);
level.sectors[i].SetYScale(1,2.);
}
@ -3223,8 +3243,8 @@ Class UTMainHandler : EventHandler
for ( int j=0; j<3; j++ )
{
if ( level.sides[i].GetTexture(j) != deftex ) continue;
if ( ((gameinfo.gametype == GAME_DOOM) && ((i==529) || (i==530) || (i==533) || (i==534)))
|| ((gameinfo.gametype == GAME_HERETIC) && ((i==295) || (i==296) || (i==309) || (i==310))) )
if ( ((gameinfo.gametype&GAME_DOOM) && ((i==529) || (i==530) || (i==533) || (i==534)))
|| ((gameinfo.gametype&GAME_RAVEN) && ((i==295) || (i==296) || (i==309) || (i==310))) )
{
level.sides[i].SetTexture(j,xbasewall);
level.sides[i].SetTextureYOffset(j,-2304);
@ -3236,7 +3256,7 @@ Class UTMainHandler : EventHandler
}
// fixup
level.sectors[53].SetFade("00 00 20");
if ( gameinfo.gametype == GAME_DOOM )
if ( gameinfo.gametype&GAME_DOOM )
{
for ( int i=215; i<246; i++ )
{
@ -3248,7 +3268,7 @@ Class UTMainHandler : EventHandler
level.sides[1844].SetTexture(1,glasstex);
level.lines[945].alpha = 0.5;
}
else if ( gameinfo.gametype == GAME_HERETIC )
else if ( gameinfo.gametype&GAME_HERETIC )
{
for ( int i=104; i<134; i++ )
{
@ -3260,6 +3280,18 @@ Class UTMainHandler : EventHandler
level.sides[216].SetTexture(1,glasstex);
level.lines[125].alpha = 0.5;
}
else if ( gameinfo.gametype&GAME_HEXEN )
{
for ( int i=111; i<141; i++ )
{
if ( (i==114) || (i==117) || (i==123)
|| (i==126) || (i==128) || (i==134)
|| (i==139) ) continue;
level.sectors[i].SetSpecialColor(0,"00 00 00");
}
level.sides[216].SetTexture(1,glasstex);
level.lines[125].alpha = 0.5;
}
AddLight((0,-288,128),"E0 E0 FF",256);
AddLight((-2560,1024,1280),"E0 E0 FF",1024);
AddLight((0,1024,1280),"E0 E0 FF",1024);
@ -3271,7 +3303,7 @@ Class UTMainHandler : EventHandler
AddLight((2904,1344,128),"80 80 FF",256);
AddLight((3408,1344,128),"80 80 FF",256);
AddLight((1568,1760,64),"20 20 80",128);
if ( gameinfo.gametype == GAME_DOOM )
if ( gameinfo.gametype&GAME_DOOM )
{
AddLight((1824,1760,64),"80 20 20",128);
AddLight((2080,1760,64),"FF 80 20",128);
@ -3281,8 +3313,14 @@ Class UTMainHandler : EventHandler
AddLight((2944,960,64),"20 FF 20",128);
AddLight((2944,736,64),"20 FF 20",128);
AddLight((3264,960,64),"FF 20 20",128);
AddLight((3264,736,64),"A0 A0 30",128);
AddLight((3264,512,64),"80 80 20",128);
AddLight((3584,960,64),"80 80 20",128);
AddLight((3584,736,64),"20 FF 20",128);
AddLight((3584,512,64),"FF 80 20",128);
AddLight((3584,288,64),"FF 80 FF",128);
}
else if ( gameinfo.gametype == GAME_HERETIC )
else if ( gameinfo.gametype&GAME_HERETIC )
{
AddLight((1824,1760,64),"A0 A0 30",128);
AddLight((2080,1760,64),"80 80 20",128);
@ -3291,18 +3329,6 @@ Class UTMainHandler : EventHandler
AddLight((2944,960,64),"A0 A0 30",128);
AddLight((2944,736,64),"A0 A0 30",128);
AddLight((3264,960,64),"A0 A0 30",128);
}
AddLight((3264,736,64),"A0 A0 30",128);
if ( gameinfo.gametype == GAME_DOOM )
{
AddLight((3264,512,64),"80 80 20",128);
AddLight((3584,960,64),"80 80 20",128);
AddLight((3584,736,64),"20 FF 20",128);
AddLight((3584,512,64),"FF 80 20",128);
AddLight((3584,288,64),"FF 80 FF",128);
}
else if ( gameinfo.gametype == GAME_HERETIC )
{
AddLight((3264,736,64),"A0 A0 30",128);
AddLight((3264,512,64),"A0 A0 30",128);
AddLight((3264,288,64),"FF 80 20",128);
@ -3311,6 +3337,23 @@ Class UTMainHandler : EventHandler
AddLight((3584,512,64),"FF 80 20",128);
AddLight((3584,288,64),"A0 A0 30",128);
}
else if ( gameinfo.gametype&GAME_HEXEN )
{
AddLight((1824,1760,64),"40 80 20",128);
AddLight((2080,1760,64),"FF 80 20",128);
AddLight((2336,1760,64),"20 20 80",128);
AddLight((2592,1760,64),"20 20 80",128);
AddLight((2944,960,64),"40 80 20",128);
AddLight((2944,736,64),"40 80 20",128);
AddLight((3264,960,64),"40 80 20",128);
AddLight((3264,736,64),"40 80 20",128);
AddLight((3264,512,64),"40 80 20",128);
AddLight((3264,288,64),"FF 80 20",128);
AddLight((3584,960,64),"40 80 20",128);
AddLight((3584,736,64),"FF 80 20",128);
AddLight((3584,512,64),"FF 80 20",128);
AddLight((3584,288,64),"FF 80 20",128);
}
AddAmbient((0,-288,192),"testamb/wind1",0.5,1.6);
AddAmbient((-2560,1024,768),"testamb/wind1",0.4,0.8);
AddAmbient((0,1024,768),"testamb/wind1",0.4,0.8);
@ -3318,7 +3361,7 @@ Class UTMainHandler : EventHandler
AddAmbient((768,1600,1280),"testamb/wind2",0.8,1.6);
AddAmbient((3174,1344,128),"testamb/water",0.4,1.6);
AddAmbient((1568,1760,64),"testamb/water",0.4,2.4);
if ( gameinfo.gametype == GAME_DOOM )
if ( gameinfo.gametype&GAME_DOOM )
{
AddAmbient((2080,1760,64),"testamb/lava",0.8,2.4);
AddAmbient((2336,1760,64),"testamb/slime",0.4,2.4);
@ -3326,12 +3369,19 @@ Class UTMainHandler : EventHandler
AddAmbient((2944,736,64),"testamb/slime",0.4,2.4);
AddAmbient((3584,736,64),"testamb/slime",0.4,2.4);
}
else if ( gameinfo.gametype == GAME_HERETIC )
else if ( gameinfo.gametype&GAME_HERETIC )
{
AddAmbient((2336,1760,64),"testamb/water",0.4,2.4);
AddAmbient((2592,1760,64),"testamb/lava",0.8,2.4);
AddAmbient((3264,288,64),"testamb/lava",0.8,2.4);
}
else if ( gameinfo.gametype&GAME_HEXEN )
{
AddAmbient((2080,1760,64),"testamb/lava",0.8,2.4);
AddAmbient((3264,288,64),"testamb/lava",0.8,2.4);
AddAmbient((3584,736,64),"testamb/lava",0.4,2.4);
AddAmbient((3584,288,64),"testamb/lava",0.4,2.4);
}
AddAmbient((3584,512,64),"testamb/lava",0.8,2.4);
}

View file

@ -681,7 +681,41 @@ Class UTHud : BaseStatusBar
private void DrawKeys()
{
if ( deathmatch ) return; // no need to draw in DM
if ( gameinfo.gametype&(GAME_Hexen|GAME_Strife) ) return; // no key display for these ATM (will do eventually)
if ( gameinfo.gametype&(GAME_Hexen|GAME_Strife) )
{
if ( !automapactive ) return;
int kw = (gameinfo.gametype&GAME_Strife)?20:30,
kh = (gameinfo.gametype&GAME_Strife)?20:40;
double ks = (gameinfo.gametype&GAME_Strife)?2.:1.5;
int nkeys = 0;
Array<int> rows;
Array<Inventory> keys;
keys.Clear();
rows.Clear();
rows.Push(0);
for ( Inventory i=CPlayer.mo.inv; i; i=i.inv )
{
if ( !(i is 'Key') ) continue;
keys.Push(i);
if ( rows[rows.Size()-1] >= 6 ) rows.Push(1);
else rows[rows.Size()-1]++;
}
int j = 0;
CurX = (Screen.GetWidth()-kw*hudsize*HScale*ks);
for ( int i=0; i<rows.Size(); i++ )
{
CurY = (Screen.GetHeight()-rows[i]*kh*hudsize*HScale*ks)*0.5;
CurY += 64*hudsize*HScale;
for ( int k=0; k<rows[i]; k++ )
{
UTDrawPlainTex(keys[j].Icon,hudsize*ks,min(opacity,15));
j++;
CurY += kh*hudsize*HScale*ks;
}
CurX -= kw*hudsize*HScale*ks;
}
return;
}
bool locks[6];
for ( int i=0; i<6; i++ ) locks[i] = CPlayer.mo.CheckKeys(i+1,false,true);
int nrows = 0, nrowss = 0;