Added activatable items for Heretic, along with a full inventory bar.

Support new versions of Kinsie's test map.
Switch to new GetAxes implementation across the board.
Minor fixes here and there.
This commit is contained in:
Marisa the Magician 2019-05-01 22:26:46 +02:00
commit 76df49e62b
42 changed files with 663 additions and 111 deletions

View file

@ -138,6 +138,7 @@ Class BioLight : DynamicLight
Destroy();
return;
}
SetOrigin(target.pos,true);
args[LIGHT_INTENSITY] = int(8*target.Scale.x);
}
}
@ -657,7 +658,7 @@ Class BioRifle : UTWeapon
else A_QuakeEx(1,1,1,5,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.05);
Vector3 x, y, z;
double a, s;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+8.0*y-5.0*z;
Actor p;
if ( alt )
@ -686,6 +687,7 @@ Class BioRifle : UTWeapon
s.A_SetRenderStyle(0.5,STYLE_AddShaded);
UTViewSmoke(s).vvel += (FRandom[GES](0.8,1.6),FRandom[GES](-0.5,0.5),FRandom[GES](-0.5,0.5));
}
invoker.charge = 0;
}
action void A_BeginCharge()
{
@ -736,6 +738,7 @@ Class BioRifle : UTWeapon
Idle:
BIOI A 1
{
invoker.charge = 0;
invoker.bCharging = false;
A_CheckReload();
A_WeaponReady();

View file

@ -53,7 +53,7 @@ Class UTChainsaw : UTWeapon
invoker.FireEffect();
A_AlertMonsters();
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x-4.0*z;
FLineTraceData d;
LineTrace(angle,90,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
@ -91,7 +91,7 @@ Class UTChainsaw : UTWeapon
if ( initial ) invoker.FireEffect();
A_AlertMonsters();
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x-2.0*z;
FLineTraceData d;
double ang = (angle-60)+120*invoker.sawcnt;
@ -141,7 +141,7 @@ Class UTChainsaw : UTWeapon
UTMainHandler.DoSwing(self,(FRandom[Chainsaw](-1,1),FRandom[Chainsaw](-1,1)),0.25,-0.1,2,SWING_Spring);
if ( bAlt || Random[Chainsaw](0,2) ) return;
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+5.0*x+1.0*y-3.0*z;
for ( int i=0; i<5; i++ )
{

View file

@ -47,12 +47,135 @@ Class UTHereticBlueKey : KeyBlue
}
}
// TODO Base class for items that can be activated from the inventory bar
// 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 ActShieldBelt : UTActivatable
{
Default
{
Tag "$T_SHIELDBELT";
Inventory.Icon "ItemBelt";
Inventory.PickupMessage "$I_SHIELDBELT";
+COUNTITEM;
+INVENTORY.BIGPOWERUP;
UTActivatable.GiveItem "UTShieldBelt";
Inventory.RespawnTics 2100;
}
States
{
Spawn:
BELT A -1;
Stop;
}
}
Class ActInvisibility : 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 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;
}
}
Class ActSearchlight : UTActivatable
{
Default
{
Tag "$T_SEARCHLIGHT";
Inventory.Icon "ItemLite";
Inventory.PickupMessage "$I_SEARCHLIGHT";
+COUNTITEM;
UTActivatable.GiveItem "Searchlight";
Inventory.RespawnTics 1050;
}
States
{
Spawn:
SLIT A -1;
Stop;
}
}
@ -61,6 +184,71 @@ 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;
}
}

View file

@ -69,4 +69,68 @@ Class dt_CoordUtil
}
else return ((screenpos.x+1)*Screen.getWidth(),(-screenpos.y+1)*Screen.getHeight())*0.5, (screenpos.z<=1.0);
}
// In Tim Sweeney's own words: "transform by a pitch-yaw-roll rotation"
static Vector3, Vector3, Vector3 GetUnAxes( double pitch, double yaw, double roll )
{
Vector3 x = (1,0,0), y = (0,-1,0), z = (0,0,1); // y inverted for left-handed result
Vector3 a, b, c;
// pitch and roll in gzdoom work in reverse compared to UE
pitch = -pitch;
roll = -roll;
// yaw
a = (cos(yaw),sin(yaw),0);
b = (-sin(yaw),cos(yaw),0);
c = (0,0,1);
x = (x dot a, x dot b, x dot c);
y = (y dot a, y dot b, y dot c);
z = (z dot a, z dot b, z dot c);
// pitch
a = (cos(pitch),0,sin(pitch));
b = (0,1,0);
c = (-sin(pitch),0,cos(pitch));
x = (x dot a, x dot b, x dot c);
y = (y dot a, y dot b, y dot c);
z = (z dot a, z dot b, z dot c);
// roll
a = (1,0,0);
b = (0,cos(roll),-sin(roll));
c = (0,sin(roll),cos(roll));
x = (x dot a, x dot b, x dot c);
y = (y dot a, y dot b, y dot c);
z = (z dot a, z dot b, z dot c);
return x, y, z;
}
// In Tim Sweeney's own words: "detransform by a pitch-yaw-roll rotation"
static Vector3, Vector3, Vector3 GetAxes( double pitch, double yaw, double roll )
{
Vector3 x = (1,0,0), y = (0,-1,0), z = (0,0,1); // y inverted for left-handed result
Vector3 a, b, c;
// pitch and roll in gzdoom work in reverse compared to UE
pitch = -pitch;
roll = -roll;
// inverse roll
a = (1,0,0);
b = (0,cos(roll),sin(roll));
c = (0,-sin(roll),cos(roll));
x = (x dot a, x dot b, x dot c);
y = (y dot a, y dot b, y dot c);
z = (z dot a, z dot b, z dot c);
// inverse pitch
a = (cos(pitch),0,-sin(pitch));
b = (0,1,0);
c = (sin(pitch),0,cos(pitch));
x = (x dot a, x dot b, x dot c);
y = (y dot a, y dot b, y dot c);
z = (z dot a, z dot b, z dot c);
// inverse yaw
a = (cos(yaw),-sin(yaw),0);
b = (sin(yaw),cos(yaw),0);
c = (0,0,1);
x = (x dot a, x dot b, x dot c);
y = (y dot a, y dot b, y dot c);
z = (z dot a, z dot b, z dot c);
return x, y, z;
}
}

View file

@ -106,7 +106,8 @@ Class dt_Matrix4
return r;
}
// UE-like axes from rotation
// [deprecated] UE-like axes from rotation
// proper implementation moved to CoordUtil
static Vector3, Vector3, Vector3 getaxes( double pitch, double yaw, double roll )
{
Vector3 x = (1,0,0), y = (0,-1,0), z = (0,0,1); // y inverted for left-handed result

View file

@ -337,6 +337,7 @@ Class UTRocketLauncher : UTWeapon
invoker.LockedOn = false;
}
if ( checktarget && !weap.bAltFire ) A_CheckTarget();
invoker.special1++;
}
// refire that is ignored if there's no ammo
@ -353,6 +354,7 @@ Class UTRocketLauncher : UTWeapon
{
Weapon weap = Weapon(invoker);
if ( !weap ) return;
invoker.special1 = 0;
if ( weap.bAltFire ) A_PlaySound("utrl/altfire",CHAN_WEAPON);
else A_PlaySound("utrl/fire",CHAN_WEAPON);
invoker.FireEffect();
@ -363,9 +365,9 @@ Class UTRocketLauncher : UTWeapon
UTMainHandler.DoSwing(self,(FRandom[Eightball](0.4,-0.8),FRandom[Eightball](-0.5,0.5)),1,-0.2,Random[Eightball](3,4),SWING_Spring,Random[Eightball](2,5),Random[Eightball](2,4));
Vector3 x, y, z, x2, y2, z2;
double a, s;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+3.0*y-3.0*z;
[x2, y2, z2] = dt_Matrix4.GetAxes(BulletSlope(),angle,roll);
[x2, y2, z2] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll);
Actor p;
if ( weap.bAltFire )
{
@ -490,6 +492,7 @@ Class UTRocketLauncher : UTWeapon
EBLI A 1
{
invoker.locktics = 0;
invoker.special1 = 0;
A_CheckReload();
A_WeaponReady(WRF_ALLOWRELOAD);
}

View file

@ -175,14 +175,6 @@ Class Enforcer : UTWeapon
property ClipCount : ClipCount;
property SlaveClipCount : SlaveClipCount;
override void PostRender( double lbottom )
{
if ( !flak_enforcerreload ) return;
if ( !usmf ) usmf = Font.GetFont('USMALLFONT');
if ( Amount > 1 ) Screen.DrawText(usmf,Font.FindFontColor('UGreen'),Screen.GetWidth()*0.01,lbottom-Screen.GetHeight()*0.01-usmf.GetHeight()*2,String.Format("%s: %2d / 20\n%s: %2d / 20",StringTable.Localize("$M_LCLIP"),slaveclipcount,StringTable.Localize("$M_RCLIP"),clipcount));
else Screen.DrawText(usmf,Font.FindFontColor('UGreen'),Screen.GetWidth()*0.01,lbottom-Screen.GetHeight()*0.01-usmf.GetHeight(),String.Format("%s: %2d / 20",StringTable.Localize("$M_CLIP"),clipcount));
}
override bool HandlePickup( Inventory item )
{
if ( item.GetClass() == GetClass() )
@ -324,14 +316,14 @@ Class Enforcer : UTWeapon
UTMainHandler.DoSwing(self,(FRandom[Enforcer](-0.2,-0.5),FRandom[Enforcer](-0.3,0.2)),2,0,1,SWING_Spring,0,2);
}
Vector3 x, y, z, x2, y2, z2;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = pos+(0,0,player.viewheight)+10.0*x;
int ydir = slave?-1:1;
if ( alt ) origin = origin-z*3.0+ydir*y*1.0;
else origin = origin-z*1.0+ydir*y*4.0;
double a = FRandom[Enforcer](0,360), s = FRandom[Enforcer](0,alt?0.08:0.004);
if ( invoker.SlaveActive ) s *= 3;
[x2, y2, z2] = dt_Matrix4.GetAxes(BulletSlope(),angle,roll);
[x2, y2, z2] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll);
Vector3 dir = (x2+y2*cos(a)*s+z2*sin(a)*s).unit();
FLineTraceData d;
LineTrace(atan2(dir.y,dir.x),10000,asin(-dir.z),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);

View file

@ -55,6 +55,7 @@ Class ChunkLight : DynamicLight
Destroy();
return;
}
SetOrigin(target.pos,true);
if ( isFrozen() ) return;
args[LIGHT_RED] = int(255*(10-target.frame)*0.1);
args[LIGHT_GREEN] = int(224*(10-target.frame)*0.1);
@ -460,7 +461,7 @@ Class FlakSlug : Actor
Spawn("SlugLight",pos);
Vector3 x, y, z;
double a, s;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Actor p;
Vector3 spawnofs;
if ( BlockingMobj ) spawnofs = level.Vec3Diff(pos,BlockingMobj.Vec3Offset(0,0,BlockingMobj.height/2)).unit()*8;
@ -564,12 +565,12 @@ Class FlakCannon : UTWeapon
A_QuakeEx(1,1,1,3,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.05);
Vector3 x, y, z;
double a, s;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+4.0*y-3.0*z;
A_Overlay(-2,"MuzzleFlash");
A_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true);
A_OverlayRenderstyle(-2,STYLE_Add);
[x, y, z] = dt_Matrix4.GetAxes(BulletSlope(),angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll);
Vector3 offsets[8]; // vanilla adds these to each chunk
offsets[0] = (0,0,0);
offsets[1] = -z;
@ -623,7 +624,7 @@ Class FlakCannon : UTWeapon
A_QuakeEx(2,2,2,6,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1);
Vector3 x, y, z;
double a, s;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-3.0*z;
A_Overlay(-2,"MuzzleFlash");
A_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true);

View file

@ -70,7 +70,7 @@ Class ImpactHammer : UTWeapon
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();
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+3.0*y-4.0*z;
double realcharge = min(1.5,invoker.chargesize);
FLineTraceData d;
@ -122,6 +122,8 @@ Class ImpactHammer : UTWeapon
s.vel = pvel;
s.scale *= 0.4;
}
invoker.chargesize = 0;
invoker.count = 0;
}
action void A_FireAltBlast()
{
@ -133,7 +135,7 @@ Class ImpactHammer : UTWeapon
A_AlertMonsters();
A_QuakeEx(2,2,2,6,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1);
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+3.0*y-4.0*z;
FLineTraceData d;
LineTrace(angle,120,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
@ -188,7 +190,7 @@ Class ImpactHammer : UTWeapon
{
FLineTraceData d;
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+3.0*y-4.0*z;
LineTrace(angle,40,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
if ( (invoker.chargesize > 1) && (d.HitType == TRACE_HitActor) )
@ -227,7 +229,12 @@ Class ImpactHammer : UTWeapon
Ready:
IMPS ABCDEFGHIJKLMNOPQ 1 A_WeaponReady(WRF_NOFIRE);
Idle:
IMPI A 1 A_WeaponReady();
IMPI A 1
{
invoker.chargesize = 0;
invoker.count = 0;
A_WeaponReady();
}
Wait;
Fire:
IMPL A 0

View file

@ -101,10 +101,10 @@ Class Minigun : UTWeapon
l.target = self;
if ( !alt ) MinigunLight(l).cnt--;
Vector3 x, y, z, x2, y2, z2;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = pos+(0,0,player.viewheight)+10.0*x+y*2.0-z*2.0;
double a = FRandom[Minigun](0,360), s = FRandom[Minigun](0,alt?0.05:0.02);
[x2, y2, z2] = dt_Matrix4.GetAxes(BulletSlope(),angle,roll);
[x2, y2, z2] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll);
Vector3 dir = (x2+y2*cos(a)*s+z2*sin(a)*s).unit();
FLineTraceData d;
LineTrace(atan2(dir.y,dir.x),10000,asin(-dir.z),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);

View file

@ -404,6 +404,8 @@ Class Searchlight : Inventory
Inventory.MaxAmount 200;
Inventory.InterHubAmount 0;
Inventory.PickupMessage "$I_SEARCHLIGHT";
Inventory.PickupSound "lite/pickup";
Inventory.RespawnTics 1050;
}
override bool Use( bool pickup )

View file

@ -87,7 +87,7 @@ Class ViewPulseSpark : PulseSpark
return;
}
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(target.pitch,target.angle,target.roll);
[x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll);
Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz);
SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true);
bInvisible = (players[consoleplayer].camera != target);
@ -517,7 +517,7 @@ Class StarterBolt : PulseBolt
bRELATIVETOFLOOR = (target.pos.z <= target.floorz); // hack, but kinda works
if ( target.player )
{
[x, y, z] = dt_Matrix4.GetAxes(target.pitch,target.angle,target.roll);
[x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll);
origin = target.Vec2OffsetZ(0,0,target.player.viewz)+8.0*x+4.1*y-2.7*z;
}
else origin = target.Vec3Offset(0,0,target.missileheight);
@ -539,13 +539,6 @@ Class PulseGun : UTWeapon
Property ClipCount : clipcount;
override void PostRender( double lbottom )
{
if ( !flak_pulsereload ) return;
if ( !usmf ) usmf = Font.GetFont('USMALLFONT');
Screen.DrawText(usmf,Font.FindFontColor('UGreen'),Screen.GetWidth()*0.01,lbottom-Screen.GetHeight()*0.01-usmf.GetHeight(),String.Format("%s: %2d / 50",StringTable.Localize("$M_CLIP"),clipcount));
}
action void A_Reloading()
{
Weapon weap = Weapon(invoker);
@ -566,7 +559,7 @@ Class PulseGun : UTWeapon
UTMainHandler.DoSwing(self,(FRandom[Pulse](-1,-1),FRandom[Pulse](-1,1)),0.1,-0.02,3,SWING_Spring,0,2);
A_AlertMonsters();
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = Vec2OffsetZ(0,0,player.viewz)+10.0*x+4.1*y-2.7*z;
for ( int i=0; i<4; i++ )
{
@ -632,7 +625,7 @@ Class PulseGun : UTWeapon
A_OverlayRenderstyle(-2,STYLE_Add);
Vector3 x, y, z;
double a;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = Vec2OffsetZ(0,0,player.viewz)+10.0*x+3.0*y-1.8*z;
origin += y*cos(invoker.sangle)*2.0+z*sin(invoker.sangle)*2.0;
invoker.sangle += 100;
@ -664,7 +657,7 @@ Class PulseGun : UTWeapon
{
A_PlaySound("pulse/bolt",CHAN_WEAPON,1.0,true);
Vector3 x, y, z, origin;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
origin = Vec2OffsetZ(0,0,player.viewz)+10.0*x+4.1*y-2.7*z;
invoker.beam = Spawn("StarterBolt",origin);
invoker.beam.angle = angle;

View file

@ -282,7 +282,7 @@ Class Ripper2 : UTWeapon
UTMainHandler.DoSwing(self,(FRandom[Ripper](-0.3,-0.6),FRandom[Ripper](0.2,0.6)),1,-0.3,2,SWING_Spring,2,2);
}
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+6.0*y-4.0*z;
Actor p;
if ( alt ) p = Spawn("Razor2Alt",origin);

View file

@ -981,7 +981,7 @@ Class ViewShockSpark : ShockSpark
return;
}
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(target.pitch,target.angle,target.roll);
[x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll);
Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz);
SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true);
bInvisible = (players[consoleplayer].camera != target);
@ -1015,7 +1015,7 @@ Class ShockRifle : UTWeapon
A_AlertMonsters();
A_QuakeEx(2,2,2,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1);
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-1.5*z;
Actor p = Spawn("ShockBeam",origin);
p.angle = angle;
@ -1053,7 +1053,7 @@ Class ShockRifle : UTWeapon
A_AlertMonsters();
A_QuakeEx(2,2,2,8,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1);
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-1.5*z;
Actor p = Spawn("ShockBall",origin);
p.angle = angle;
@ -1198,7 +1198,7 @@ Class EnhancedShockRifle : UTWeapon
A_AlertMonsters();
A_QuakeEx(3,3,3,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.15);
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-1.5*z;
Actor p = Spawn("SuperShockBeam",origin);
p.angle = angle;
@ -1236,7 +1236,7 @@ Class EnhancedShockRifle : UTWeapon
A_AlertMonsters();
A_QuakeEx(3,3,3,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.15);
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-1.5*z;
Actor p = Spawn("SuperShockBall",origin);
p.angle = angle;

View file

@ -97,7 +97,7 @@ Class SniperRifle : UTWeapon
let l = Spawn("SniperLight",pos);
l.target = self;
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = Vec2OffsetZ(0,0,player.viewz)+10.0*x;
if ( !zoomed ) origin = origin+y*4.0-z*2.0;
FLineTraceData d;

View file

@ -330,7 +330,7 @@ Class Translocator : UTWeapon
UTMainHandler.DoSwing(self,(FRandom[Translocator](-0.2,0.4),FRandom[Translocator](-0.2,0.7)),2,-0.3,3,SWING_Spring,2,3);
A_AlertMonsters();
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x-8.0*y-12.0*z;
let p = Spawn("TranslocatorModule",origin);
p.target = self;

View file

@ -34,6 +34,7 @@ Class UTPlayer : DoomPlayer
const groundfriction = 8.;
const fluidfriction = 1.2;
const terminalvelocity = 2500.;
const slantnormal = 0.7; // slope sliding will have to be handled eventually, but currently due to how much is hardcoded this is impossible
Default
{
@ -395,7 +396,7 @@ Class UTPlayer : DoomPlayer
Vector3 dir = (0,0,0);
if ( vel.length() > double.epsilon ) dir = vel.unit();
Vector3 x, y;
[x, y] = dt_Matrix4.GetAxes(pitch,angle,0);
[x, y] = dt_CoordUtil.GetAxes(pitch,angle,0);
acceleration3 = x*player.cmd.forwardmove+y*player.cmd.sidemove;
if ( player.cmd.buttons&BT_JUMP ) acceleration3.z = 0x500;
else if ( player.cmd.buttons&BT_CROUCH ) acceleration3.z = -0x500;
@ -424,7 +425,7 @@ Class UTPlayer : DoomPlayer
if ( vel.length() > double.epsilon ) dir = vel.unit();
double doomfriction = clamp(GetFriction()/ORIG_FRICTION,0.0,1.0);
Vector3 x, y;
[x, y] = dt_Matrix4.GetAxes(pitch,angle,0);
[x, y] = dt_CoordUtil.GetAxes(pitch,angle,0);
acceleration3 = x*player.cmd.forwardmove+y*player.cmd.sidemove;
if ( player.cmd.buttons&BT_JUMP ) acceleration3.z = 0x500;
else if ( player.cmd.buttons&BT_CROUCH ) acceleration3.z = -0x500;
@ -785,7 +786,7 @@ Class UTWeapon : Weapon
Vector2 hofs = RotateVector((dropper.radius,0),dropper.angle);
SetOrigin(dropper.Vec3Offset(hofs.x,hofs.y,dropper.height*0.5),false);
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(dropper.pitch,dropper.angle,dropper.roll);
[x, y, z] = dt_CoordUtil.GetAxes(dropper.pitch,dropper.angle,dropper.roll);
vel = x*12.0;
vel.z += 4.0;
angle = dropper.angle;
@ -956,7 +957,7 @@ Class UTViewSpark : UTSpark
return;
}
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(target.pitch,target.angle,target.roll);
[x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll);
Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz);
SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true);
bInvisible = (players[consoleplayer].camera != target);
@ -1201,7 +1202,7 @@ Class UTViewSmoke : UTSmoke
return;
}
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(target.pitch,target.angle,target.roll);
[x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll);
Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz);
SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true);
bInvisible = (players[consoleplayer].camera != target);
@ -1609,13 +1610,19 @@ Class UTMainHandler : EventHandler
else e.Replacement = 'RifleAmmo';
}
else if ( e.Replacee == 'InvulnerabilitySphere' ) e.Replacement = (!deathmatch||flak_dmsshock)?'EnhancedShockRifle':'UDamage';
else if ( (e.Replacee == 'Berserk') || (e.Replacee == 'ArtiTomeOfPower') || (e.Replacee == 'ArtiEgg') ) e.Replacement = 'UDamage';
else if ( (e.Replacee == 'Soulsphere') || (e.Replacee == 'ArtiSuperHealth') ) e.Replacement = 'UTHealthPack';
else if ( (e.Replacee == 'Megasphere') || (e.Replacee == 'ArtiInvulnerability') ) e.Replacement = 'UTShieldBelt';
else if ( e.Replacee == 'Berserk' ) e.Replacement = 'UDamage';
else if ( (e.Replacee == 'ArtiTomeOfPower') || (e.Replacee == 'ArtiEgg') ) 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 = 'ActShieldBelt';
else if ( (e.Replacee == 'Allmap') || (e.Replacee == 'SuperMap') ) e.Replacement = 'UTMapRevealer';
else if ( (e.Replacee == 'BlurSphere') || (e.Replacee == 'ArtiInvisibility') ) e.Replacement = 'UTInvisibility';
else if ( (e.Replacee == 'Infrared') || (e.Replacee == 'ArtiTorch') ) e.Replacement = 'Searchlight';
else if ( (e.Replacee == 'RadSuit') || (e.Replacee == 'ArtiFly') ) e.Replacement = 'UTJumpBoots';
else if ( e.Replacee == 'BlurSphere' ) e.Replacement = 'UTInvisibility';
else if ( e.Replacee == 'ArtiInvisibility' ) e.Replacement = 'ActInvisibility';
else if ( e.Replacee == 'Infrared' ) e.Replacement = 'Searchlight';
else if ( e.Replacee == 'ArtiTorch' ) e.Replacement = 'ActSearchlight';
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 == 'HealthBonus') || (e.Replacee == 'CrystalVial') ) e.Replacement = 'UTHealthBonus';
@ -1625,16 +1632,16 @@ Class UTMainHandler : EventHandler
else if ( e.Replacee == 'Medikit' ) e.Replacement = 'UTHealthBox';
else if ( e.Replacee == 'ArtiHealth' )
{
if ( !Random[Replacements](0,3) ) e.Replacement = 'UTHealthBox';
else e.Replacement = 'UTMedBox';
if ( !Random[Replacements](0,3) ) e.Replacement = 'ActHealthBox';
else e.Replacement = 'ActMedBox';
}
else if ( e.Replacee == 'ArtiTeleport' )
{
// I have no idea what to replace this with, so just have some random stuff
if ( Random[Replacements](0,1) ) e.Replacement = 'UTBackpack';
else if ( Random[Replacements](0,1) ) e.Replacement = 'UTShieldBelt';
else if ( Random[Replacements](0,1) ) e.Replacement = 'UTHealthPack';
else e.Replacement = 'UDamage';
else if ( Random[Replacements](0,1) ) e.Replacement = 'ActShieldBelt';
else if ( Random[Replacements](0,1) ) e.Replacement = 'ActHealthPack';
else e.Replacement = 'ActUDamage';
}
else if ( e.Replacee == 'RedCard' ) e.Replacement = 'UTRedKey';
else if ( e.Replacee == 'BlueCard' ) e.Replacement = 'UTBlueKey';
@ -1674,7 +1681,7 @@ Class UTMainHandler : EventHandler
// just replace the -noflat- with a better scaled version and change the sky
if ( !flak_doomtest )
{
if ( (level.GetChecksum() ~== "FBC3B6622A8B74AE06DE01E70007AC33") || (level.GetChecksum() ~== "D8206A3414DA967F2159473B5791139E") )
if ( (level.GetChecksum() ~== "959A613006CC3AA912C4A22908B7566A") || (level.GetChecksum() ~== "75319AE5D2DBA214C5D394BF69DF32F4") )
{
Level.ReplaceTextures("-noflat-","DefTex",0);
TextureID skytx = TexMan.CheckForTexture("BlueSky",TexMan.Type_Any);
@ -1683,7 +1690,7 @@ Class UTMainHandler : EventHandler
return;
}
// prettify Kinsie's test map for a more Unreal feel
if ( level.GetChecksum() ~== "FBC3B6622A8B74AE06DE01E70007AC33" )
if ( level.GetChecksum() ~== "959A613006CC3AA912C4A22908B7566A" )
{
TextureID deftex = TexMan.CheckForTexture("-noflat-",TexMan.Type_Any);
TextureID skytx = TexMan.CheckForTexture("KGDaySky",TexMan.Type_Any);
@ -1703,13 +1710,13 @@ Class UTMainHandler : EventHandler
level.sectors[i].SetTexture(1,skyflatnum);
if ( level.sectors[i].GetTexture(0) == deftex )
{
level.sectors[i].SetTexture(0,(i==47)?baseceil:baseflor);
level.sectors[i].SetTexture(0,((i==47)||((i>=256)&&(i<=260)))?baseceil:baseflor);
level.sectors[i].SetXScale(0,2.);
level.sectors[i].SetYScale(0,2.);
}
if ( level.sectors[i].GetTexture(1) == deftex )
{
level.sectors[i].SetTexture(1,(i==47)?baseflor:baseceil);
level.sectors[i].SetTexture(1,((i==47)||((i>=256)&&(i<=260)))?baseflor:baseceil);
level.sectors[i].SetXScale(1,2.);
level.sectors[i].SetYScale(1,2.);
}
@ -1780,7 +1787,7 @@ Class UTMainHandler : EventHandler
AddAmbient((3584,736,64),"testamb/slime",0.4,2.4);
AddAmbient((3584,512,64),"testamb/lava",0.8,2.4);
}
else if ( level.GetChecksum() ~== "D8206A3414DA967F2159473B5791139E" )
else if ( level.GetChecksum() ~== "75319AE5D2DBA214C5D394BF69DF32F4" )
{
TextureID deftex = TexMan.CheckForTexture("-noflat-",TexMan.Type_Any);
TextureID skytx = TexMan.CheckForTexture("KGDaySky",TexMan.Type_Any);
@ -1800,13 +1807,13 @@ Class UTMainHandler : EventHandler
level.sectors[i].SetTexture(1,skyflatnum);
if ( level.sectors[i].GetTexture(0) == deftex )
{
level.sectors[i].SetTexture(0,(i==47)?baseceil:baseflor);
level.sectors[i].SetTexture(0,((i==47)||((i>=144)&&(i<=148)))?baseceil:baseflor);
level.sectors[i].SetXScale(0,2.);
level.sectors[i].SetYScale(0,2.);
}
if ( level.sectors[i].GetTexture(1) == deftex )
{
level.sectors[i].SetTexture(1,(i==47)?baseflor:baseceil);
level.sectors[i].SetTexture(1,((i==47)||((i>=144)&&(i<=148)))?baseflor:baseceil);
level.sectors[i].SetXScale(1,2.);
level.sectors[i].SetYScale(1,2.);
}

View file

@ -23,12 +23,12 @@ Class ViewTracer : LineTracer
Class UTHud : BaseStatusBar
{
TextureID AmmoBar, Boxes[4], Keys[5], BigNum[12], Flash, Slots[10], Icons[14], Uses[14], Man[5], Woman[5], Boss[5], WeaponBox, IconTloc2, UseTloc2;
TextureID AmmoBar, Boxes[4], Keys[5], BigNum[12], Flash, Slots[10], Icons[14], Uses[14], Man[5], Woman[5], Boss[5], WeaponBox, IconTloc2, UseTloc2, ItemBox, ItemSel, ItemFlash, ItemArrow[2], LastItem;
Class<Weapon> IconClasses[14];
double HScale;
Color tintcolor, bgcolor;
int opacity;
int lastfrag, lastfragcnt, lastpickup, lastslot;
int lastfrag, lastfragcnt, lastpickup, lastslot, lastamount;
ViewTracer vtracer;
Actor lastseen;
int lastseentic;
@ -145,6 +145,11 @@ Class UTHud : BaseStatusBar
Boss[3] = TexMan.CheckForTexture("BossBot",TexMan.Type_Any);
Boss[4] = TexMan.CheckForTexture("BossBlt",TexMan.Type_Any);
WeaponBox = TexMan.CheckForTexture("WpSel",TexMan.Type_Any);
ItemBox = TexMan.CheckForTexture("ItemBox",TexMan.Type_Any);
ItemSel = TexMan.CheckForTexture("ItmSel",TexMan.Type_Any);
ItemFlash = TexMan.CheckForTexture("IFlash",TexMan.Type_Any);
ItemArrow[0] = TexMan.CheckForTexture("ItmArrw1",TexMan.Type_Any);
ItemArrow[1] = TexMan.CheckForTexture("ItmArrw2",TexMan.Type_Any);
}
override void Draw( int state, double TicFrac )
@ -189,7 +194,7 @@ Class UTHud : BaseStatusBar
{
BeginHUD();
FracTic = TicFrac;
DrawUTHUD();
DrawUTHUD(lbottom);
}
if ( (CPlayer.ReadyWeapon is 'UTWeapon') )
UTWeapon(CPlayer.ReadyWeapon).PostRender(lbottom);
@ -200,25 +205,25 @@ Class UTHud : BaseStatusBar
return Color(a.a,int(a.r*(1.-x)+b.r*x),int(a.g*(1.-x)+b.g*x),int(a.b*(1.-x)+b.b*x));
}
private void UTDrawTintedTex( TextureID tx, double sx = 1.0, int opacity = -1, Color tint = Color("Black") )
private void UTDrawTintedTex( TextureID tx, double sx = 1.0, int opacity = -1, Color tint = Color("Black"), bool flip = false )
{
double ss = (HScale*sx);
double dw = (Screen.GetWidth()/ss), dh = (Screen.GetHeight()/ss);
double dx = CurX/ss, dy = CurY/ss;
if ( opacity == -1 ) opacity = self.opacity;
if ( opacity >= 16 ) Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor);
if ( opacity >= 16 ) Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor,DTA_TopOffset,0,DTA_LeftOffset,0);
double alpha = clamp(opacity/15.,0.0,1.0);
Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_LegacyRenderStyle,STYLE_AddShaded,DTA_FillColor,(tint!="Black")?tint:tintcolor);
Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_LegacyRenderStyle,STYLE_AddShaded,DTA_FillColor,(tint!="Black")?tint:tintcolor,DTA_TopOffset,0,DTA_LeftOffset,0,DTA_FlipX,flip);
}
private void UTDrawPlainTex( TextureID tx, double sx = 1.0, int opacity = -1 )
private void UTDrawPlainTex( TextureID tx, double sx = 1.0, int opacity = -1, bool flip = false )
{
double ss = (HScale*sx);
double dw = (Screen.GetWidth()/ss), dh = (Screen.GetHeight()/ss);
double dx = CurX/ss, dy = CurY/ss;
if ( opacity == -1 ) opacity = self.opacity;
if ( opacity >= 16 ) Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor);
if ( opacity >= 16 ) Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor,DTA_TopOffset,0,DTA_LeftOffset,0,DTA_FlipX,flip);
double alpha = clamp(opacity/15.,0.0,1.0);
Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha);
Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_TopOffset,0,DTA_LeftOffset,0,DTA_FlipX,flip);
}
private bool UTDrawWeaponIcon( Weapon w, bool use, double sx = 1.0 )
@ -255,9 +260,9 @@ Class UTHud : BaseStatusBar
double flen = 3*step;
double len = digits.length()*step;
double alpha = clamp((opacity+7)/15.,0.0,1.0);
for ( int i=0; i<digits.length(); i++ ) if ( digits.CharAt(i) == "1" ) len -= 0.5*step;
for ( int i=0; i<digits.length(); i++ ) if ( digits.ByteAt(i) == 0x31 ) len -= 0.5*step;
CurX += (flen-len)*0.5;
if ( digits.CharAt(0) == "1" ) CurX -= 0.5*step;
if ( digits.ByteAt(0) == 0x31 ) CurX -= 0.5*step;
if ( value < 0 )
{
if ( opacity+7 > 15 ) Screen.DrawTexture(BigNum[11],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor);
@ -266,9 +271,9 @@ Class UTHud : BaseStatusBar
}
for ( int i=0; i<digits.length(); i++ )
{
if ( opacity+7 > 15 ) Screen.DrawTexture(BigNum[digits.CharCodeAt(i)-0x30],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor);
Screen.DrawTexture(BigNum[digits.CharCodeAt(i)-0x30],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_LegacyRenderStyle,STYLE_AddShaded,DTA_FillColor,DrawColor);
CurX += ((i<digits.length()-1)&&(digits.CharAt(i+1)=="1"))?step*0.5:step;
if ( opacity+7 > 15 ) Screen.DrawTexture(BigNum[digits.ByteAt(i)-0x30],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor);
Screen.DrawTexture(BigNum[digits.ByteAt(i)-0x30],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_LegacyRenderStyle,STYLE_AddShaded,DTA_FillColor,DrawColor);
CurX += ((i<digits.length()-1)&&(digits.ByteAt(i+1)==0x31))?step*0.5:step;
}
}
@ -285,26 +290,8 @@ Class UTHud : BaseStatusBar
CurX += 8*hudsize*HScale;
CurY += 14*hudsize*HScale;
DrawColor = WhiteColor;
if ( ammotype1 )
{
UTDrawBigNum(ammotype1.Amount,hudsize);
let cw = CPlayer.ReadyWeapon;
if ( flak_transloc2k4 && (cw is 'Translocator') )
{
// draw ammo charge bar
double ch = Translocator(cw).ammocharge;
CurX = BaseX+6*hudsize*HScale;
CurY = BaseY+53*hudsize*HScale;
Vector2 ss = (0.54,0.3)*hudsize*HScale;
double dw = (Screen.GetWidth()/ss.x), dh = (Screen.GetHeight()/ss.y);
double dx = CurX/ss.x, dy = CurY/ss.y;
Vector2 bs = TexMan.GetScaledSize(AmmoBar);
double ddw = bs.x*ch;
double alpha = clamp((opacity+7)/15.,0.0,1.0);
Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha);
}
// TODO try also drawing enforcer and pulsegun clips as bars
}
let cw = CPlayer.ReadyWeapon;
if ( ammotype1 ) UTDrawBigNum(ammotype1.Amount,hudsize);
if ( ammotype2 && (ammotype2 != ammotype1) )
{
CurX = showweapons?(Screen.GetWidth()-128*hudsize*HScale):((Screen.GetWidth()+256*hudsize*HScale)*0.5);
@ -315,6 +302,101 @@ Class UTHud : BaseStatusBar
CurY += 14*hudsize**HScale;
UTDrawBigNum(ammotype2.Amount,hudsize);
}
// extra bars
if ( flak_transloc2k4 && (cw is 'Translocator') )
{
// draw ammo charge bar
double ch = Translocator(cw).ammocharge;
CurX = BaseX+6*hudsize*HScale;
CurY = BaseY+54*hudsize*HScale;
Vector2 ss = (0.54,0.25)*hudsize*HScale;
double dw = (Screen.GetWidth()/ss.x), dh = (Screen.GetHeight()/ss.y);
double dx = CurX/ss.x, dy = CurY/ss.y;
Vector2 bs = TexMan.GetScaledSize(AmmoBar);
double ddw = bs.x*ch;
double alpha = clamp((opacity+7)/15.,0.0,1.0);
Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha);
}
else if ( flak_enforcerreload && (cw is 'Enforcer') )
{
// draw clip(s)
double ch = Enforcer(cw).ClipCount/20.;
CurX = BaseX+6*hudsize*HScale;
CurY = BaseY+53*hudsize*HScale;
Vector2 ss;
ss = (0.54,(cw.Amount>1)?0.125:0.3)*hudsize*HScale;
double dw = (Screen.GetWidth()/ss.x), dh = (Screen.GetHeight()/ss.y);
double dx = CurX/ss.x, dy = CurY/ss.y;
Vector2 bs = TexMan.GetScaledSize(AmmoBar);
double ddw = bs.x*ch;
double alpha = clamp((opacity+7)/15.,0.0,1.0);
Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha);
if ( cw.Amount > 1 )
{
ch = Enforcer(cw).SlaveClipCount/20.;
CurY += 3*hudsize*HScale;
ss = (0.54,0.125)*hudsize*HScale;
dw = (Screen.GetWidth()/ss.x);
dh = (Screen.GetHeight()/ss.y);
dx = CurX/ss.x;
dy = CurY/ss.y;
ddw = bs.x*ch;
Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha);
}
}
else if ( flak_pulsereload && (cw is 'Pulsegun') )
{
// draw clip
double ch = Pulsegun(cw).ClipCount/50.;
CurX = BaseX+6*hudsize*HScale;
CurY = BaseY+53*hudsize*HScale;
Vector2 ss = (0.54,0.3)*hudsize*HScale;
double dw = (Screen.GetWidth()/ss.x), dh = (Screen.GetHeight()/ss.y);
double dx = CurX/ss.x, dy = CurY/ss.y;
Vector2 bs = TexMan.GetScaledSize(AmmoBar);
double ddw = bs.x*ch;
double alpha = clamp((opacity+7)/15.,0.0,1.0);
Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha);
}
else if ( cw is 'ImpactHammer' )
{
double ch = min(ImpactHammer(cw).chargesize,1.5)/1.5;
CurX = BaseX+6*hudsize*HScale;
CurY = BaseY+53*hudsize*HScale;
Vector2 ss = (0.54,0.3)*hudsize*HScale;
double dw = (Screen.GetWidth()/ss.x), dh = (Screen.GetHeight()/ss.y);
double dx = CurX/ss.x, dy = CurY/ss.y;
Vector2 bs = TexMan.GetScaledSize(AmmoBar);
double ddw = bs.x*ch;
double alpha = clamp((opacity+7)/15.,0.0,1.0);
Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha);
}
else if ( cw is 'BioRifle' )
{
double ch = min(BioRifle(cw).charge,5.1)/5.1;
CurX = BaseX+6*hudsize*HScale;
CurY = BaseY+53*hudsize*HScale;
Vector2 ss = (0.54,0.3)*hudsize*HScale;
double dw = (Screen.GetWidth()/ss.x), dh = (Screen.GetHeight()/ss.y);
double dx = CurX/ss.x, dy = CurY/ss.y;
Vector2 bs = TexMan.GetScaledSize(AmmoBar);
double ddw = bs.x*ch;
double alpha = clamp((opacity+7)/15.,0.0,1.0);
Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha);
}
else if ( cw is 'UTRocketLauncher' )
{
double ch = cw.special1/6.;
CurX = BaseX+6*hudsize*HScale;
CurY = BaseY+53*hudsize*HScale;
Vector2 ss = (0.54,0.3)*hudsize*HScale;
double dw = (Screen.GetWidth()/ss.x), dh = (Screen.GetHeight()/ss.y);
double dx = CurX/ss.x, dy = CurY/ss.y;
Vector2 bs = TexMan.GetScaledSize(AmmoBar);
double ddw = bs.x*ch;
double alpha = clamp((opacity+7)/15.,0.0,1.0);
Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha);
}
}
private void DrawStatus()
{
@ -609,9 +691,108 @@ Class UTHud : BaseStatusBar
}
}
private void DrawInventory( double lbottom )
{
if ( isInventoryBarVisible() )
{
CPlayer.mo.InvFirst = ValidateInvFirst(5);
if ( !CPlayer.mo.InvFirst ) return;
// draw the boxes
double BaseX, BaseY;
BaseX = CurX = (Screen.GetWidth()-64*5*hudsize*HScale)/2.;
BaseY = CurY = Screen.GetHeight()-224*hudsize*HScale;
for ( int i=0; i<5; i++ )
{
UTDrawTintedTex(ItemBox,hudsize);
CurX += 64*hudsize*HScale;
}
int i = 0;
Inventory itm;
for ( itm=CPlayer.mo.InvFirst; (itm && (i < 5)); itm=itm.NextInv() )
{
CurX = BaseX+2*hudsize*HScale;
CurY = BaseY+2*hudsize*HScale;
// if item doesn't fit 60x60, scale
Vector2 scl = TexMan.GetScaledSize(itm.Icon);
double mscl = max(scl.x,scl.y)/60.;
UTDrawTintedTex(itm.Icon,hudsize*mscl);
// amount if >1
if ( itm.Amount > 1 )
{
CurX = BaseX+32*hudsize*HScale;
CurY = BaseY+40*hudsize*HScale;
DrawColor = WhiteColor;
UTDrawBigNum(itm.Amount,hudsize*0.5);
}
// selection box if current item
if ( itm == CPlayer.mo.InvSel )
{
CurX = BaseX;
CurY = BaseY;
UTDrawPlainTex(ItemSel,hudsize,opacity+7);
}
BaseX += 64*hudsize*HScale;
i++;
}
// draw arrows
CurY = Screen.GetHeight()-204*hudsize*HScale;
CurX = (Screen.GetWidth()-(64*5+40)*hudsize*HScale)/2.;
UTDrawTintedTex(ItemArrow[CPlayer.mo.InvFirst!=CPlayer.mo.FirstInv()],hudsize,flip:true);
CurX = (Screen.GetWidth()+(64*5+8)*hudsize*HScale)/2.;
UTDrawTintedTex(ItemArrow[!!itm],hudsize);
}
else if ( CPlayer.mo.InvSel || artiflashtick )
{
// flashie
if ( artiflashtick )
{
DrawColor = GoldColor;
CurX = -32*hudsize*HScale;
CurY = lbottom-96*hudsize*HScale;
UTDrawTintedTex(ItemFlash,hudsize,min(opacity,15),DrawColor);
}
// position 64x64 box
CurX = 0;
CurY = lbottom-64*hudsize*HScale;
UTDrawTintedTex(ItemBox,hudsize);
if ( artiflashtick )
{
Vector2 scl = TexMan.GetScaledSize(LastItem);
double mscl = max(scl.x,scl.y)/60.;
CurX += 2*hudsize*HScale;
CurY += 2*hudsize*HScale;
UTDrawTintedTex(LastItem,hudsize*mscl);
if ( LastAmount <= 1 ) return;
CurX = 32*hudsize*HScale;
CurY = lbottom-24*hudsize*HScale;
DrawColor = WhiteColor;
UTDrawBigNum(LastAmount,hudsize*0.5);
return;
}
if ( !CPlayer.mo.InvSel ) return;
// if item doesn't fit 60x60, scale
Vector2 scl = TexMan.GetScaledSize(CPlayer.mo.InvSel.Icon);
double mscl = max(scl.x,scl.y)/60.;
CurX += 2*hudsize*HScale;
CurY += 2*hudsize*HScale;
UTDrawTintedTex(CPlayer.mo.InvSel.Icon,hudsize*mscl);
// amount if >1
if ( CPlayer.mo.InvSel.Amount <= 1 ) return;
CurX = 32*hudsize*HScale;
CurY = lbottom-24*hudsize*HScale;
DrawColor = WhiteColor;
UTDrawBigNum(CPlayer.mo.InvSel.Amount,hudsize*0.5);
}
}
override void Tick()
{
Super.Tick();
if ( CPlayer.mo.InvSel && !artiflashtick )
{
LastItem = CPlayer.mo.InvSel.Icon;
LastAmount = CPlayer.mo.InvSel.Amount-1;
}
if ( deathmatch||teamplay )
{
if ( CPlayer.fragcount != lastfragcnt ) lastfrag = level.time;
@ -629,7 +810,7 @@ Class UTHud : BaseStatusBar
lastseentic = level.time;
}
private void DrawUTHUD()
private void DrawUTHUD( double lbottom )
{
// Display Weapons
if ( showweapons ) DrawWeapons();
@ -641,6 +822,8 @@ Class UTHud : BaseStatusBar
DrawStatus();
// Display Keys
DrawKeys();
// Inventory Bar
DrawInventory(lbottom);
// Display Identification Info
if ( CPlayer == players[consoleplayer] && showinfo ) DrawIdentifyInfo();
}

View file

@ -660,7 +660,7 @@ Class WarheadLauncher : UTWeapon
A_AlertMonsters();
A_QuakeEx(6,6,6,20,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.2);
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
vel -= x*10;
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-2.0*z;
Actor p = Spawn("WarShell",origin);
@ -674,7 +674,7 @@ Class WarheadLauncher : UTWeapon
Weapon weap = Weapon(invoker);
if ( !weap ) return;
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
vel -= x*0.2;
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-2.0*z;
int numpt = Random[Warhead](10,20);
@ -698,7 +698,7 @@ Class WarheadLauncher : UTWeapon
A_AlertMonsters();
A_QuakeEx(6,6,6,20,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.2);
Vector3 x, y, z;
[x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll);
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
vel -= x*10;
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-2.0*z;
Actor p = Spawn("GuidedWarShell",origin);