The HUD is complete (actually, I forgot to add key display, will do that later).

All weapon pickup models have been added in. Modeldef has been subdivided to make things easier for me.
This commit is contained in:
Marisa the Magician 2018-05-23 01:48:29 +02:00
commit 7e38cfddd8
81 changed files with 3060 additions and 2302 deletions

View file

@ -1,4 +1,4 @@
Class Tier3Ammo : RandomSpawner replaces Shell
Class Tier3Ammo : RandomSpawner2 replaces Shell
{
Default
{
@ -7,7 +7,7 @@ Class Tier3Ammo : RandomSpawner replaces Shell
}
}
Class Tier3Ammo2 : Tier3Ammo replaces ShellBox {}
Class Tier3Weapon : RandomSpawner replaces Shotgun
Class Tier3Weapon : RandomSpawner2 replaces Shotgun
{
Default
{
@ -26,7 +26,7 @@ Class BioAmmo : UTAmmo
Inventory.Amount 25;
Inventory.MaxAmount 100;
Ammo.BackpackAmount 50;
Ammo.BackpackMaxAmount 200;
Ammo.BackpackMaxAmount 100;
Ammo.DropAmount 25;
UTAmmo.UsedInSlot AMMO_SLOT3;
}
@ -437,6 +437,7 @@ Class BioRifle : UTWeapon
Inventory.PickupMessage "You got the GES BioRifle.";
Weapon.UpSound "ges/select";
Weapon.SlotNumber 3;
Weapon.SelectionOrder 7;
Weapon.AmmoType "BioAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "BioAmmo";

View file

@ -1,11 +1,20 @@
Class UTChainsaw : Weapon replaces Chainsaw
Class UTChainsaw : UTWeapon replaces Chainsaw
{
Default
{
Tag "Chainsaw";
Inventory.PickupMessage "It's been twenty five years since I've seen one of these."; // was five years in UT99
Weapon.UpSound "";
Weapon.UpSound "chainsaw/select";
Weapon.SlotNumber 1;
Weapon.SelectionOrder 9;
+WEAPON.MELEEWEAPON;
}
States
{
Spawn:
CSWP A -1;
Stop;
CSWP B -1;
Stop;
}
}

View file

@ -7,7 +7,7 @@ Class UTRocketAmmo : UTAmmo
Inventory.Amount 12;
Inventory.MaxAmount 48;
Ammo.BackpackAmount 12;
Ammo.BackpackMaxAmount 96;
Ammo.BackpackMaxAmount 48;
Ammo.DropAmount 12;
UTAmmo.UsedInSlot AMMO_SLOT9;
}
@ -45,10 +45,19 @@ Class UTRocketLauncher : UTWeapon
Inventory.PickupMessage "You got the Rocket Launcher.";
Weapon.UpSound "";
Weapon.SlotNumber 9;
Weapon.SelectionOrder 1;
Weapon.AmmoType "UTRocketAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "UTRocketAmmo";
Weapon.AmmoUse2 1;
Weapon.AmmoGive 6;
}
States
{
Spawn:
EBLP A -1;
Stop;
EBLP B -1;
Stop;
}
}

View file

@ -52,10 +52,19 @@ Class Enforcer : UTWeapon replaces Pistol
Inventory.PickupMessage "You picked up an Enforcer.";
Weapon.UpSound "";
Weapon.SlotNumber 2;
Weapon.SelectionOrder 8;
Weapon.AmmoType "MiniAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "MiniAmmo";
Weapon.AmmoUse2 1;
Weapon.AmmoGive 30;
}
States
{
Spawn:
ENFP A -1;
Stop;
ENFP B -1;
Stop;
}
}

View file

@ -1,4 +1,4 @@
Class Tier5Ammo : RandomSpawner replaces RocketAmmo
Class Tier5Ammo : RandomSpawner2 replaces RocketAmmo
{
Default
{
@ -6,7 +6,7 @@ Class Tier5Ammo : RandomSpawner replaces RocketAmmo
DropItem "UTRocketAmmo2", 255, 1;
}
}
Class Tier5Ammo2 : RandomSpawner replaces RocketBox
Class Tier5Ammo2 : RandomSpawner2 replaces RocketBox
{
Default
{
@ -15,7 +15,7 @@ Class Tier5Ammo2 : RandomSpawner replaces RocketBox
}
}
Class Tier5Weapon : RandomSpawner replaces RocketLauncher
Class Tier5Weapon : RandomSpawner2 replaces RocketLauncher
{
Default
{
@ -33,7 +33,7 @@ Class FlakAmmo : UTAmmo
Inventory.Amount 10;
Inventory.MaxAmount 50;
Ammo.BackpackAmount 20;
Ammo.BackpackMaxAmount 100;
Ammo.BackpackMaxAmount 50;
Ammo.DropAmount 10;
UTAmmo.UsedInSlot AMMO_SLOT8;
}
@ -456,7 +456,7 @@ Class FlakCannon : UTWeapon
action void A_Loading( bool first = false )
{
if ( first ) A_PlaySound("flak/load",CHAN_WEAPON);
else A_PlaySound("flak/reload",CHAN_WEAPON);
else A_PlaySound("flak/reload",CHAN_5);
}
action void A_FireChunks()
{
@ -531,6 +531,7 @@ Class FlakCannon : UTWeapon
Inventory.PickupMessage "You got the Flak Cannon.";
Weapon.UpSound "flak/select";
Weapon.SlotNumber 8;
Weapon.SelectionOrder 2;
Weapon.AmmoType "FlakAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "FlakAmmo";
@ -564,12 +565,12 @@ Class FlakCannon : UTWeapon
Fire:
FLKF A 1 A_FireChunks();
FLKF BCDEFGHIJ 1;
FLKF JJ 4;
FLKF J 4;
Goto Loading;
AltFire:
FLKA A 1 A_FireSlug();
FLKA BCDEFGHIJK 2;
FLKA KKK 4;
FLKA K 4;
Goto Loading;
Select:
FLKS A 1 A_Raise(int.max);

View file

@ -6,7 +6,16 @@ Class ImpactHammer : UTWeapon replaces Fist
Inventory.PickupMessage "You got the Impact Hammer.";
Weapon.UpSound "";
Weapon.SlotNumber 1;
Weapon.SelectionOrder 9;
+WEAPON.MELEEWEAPON;
+INVENTORY.UNTOSSABLE;
}
States
{
Spawn:
IMPP A -1;
Stop;
IMPP B -1;
Stop;
}
}

View file

@ -1,4 +1,4 @@
Class Tier6Ammo : RandomSpawner replaces Cell
Class Tier6Ammo : RandomSpawner2 replaces Cell
{
Default
{
@ -6,7 +6,7 @@ Class Tier6Ammo : RandomSpawner replaces Cell
DropItem "RifleAmmo2", 255, 1;
}
}
Class Tier6Ammo2 : RandomSpawner replaces CellPack
Class Tier6Ammo2 : RandomSpawner2 replaces CellPack
{
Default
{
@ -15,7 +15,7 @@ Class Tier6Ammo2 : RandomSpawner replaces CellPack
}
}
Class Tier6Weapon : RandomSpawner replaces PlasmaRifle
Class Tier6Weapon : RandomSpawner2 replaces PlasmaRifle
{
Default
{
@ -31,9 +31,9 @@ Class MiniAmmo : UTAmmo
Tag "Large Bullets";
Inventory.PickupMessage "You picked up 50 bullets.";
Inventory.Amount 50;
Inventory.MaxAmount 200;
Inventory.MaxAmount 199;
Ammo.BackpackAmount 100;
Ammo.BackpackMaxAmount 400;
Ammo.BackpackMaxAmount 199;
Ammo.DropAmount 50;
UTAmmo.UsedInSlot AMMO_SLOT2|AMMO_SLOT7;
}
@ -53,10 +53,19 @@ Class Minigun : UTWeapon
Inventory.PickupMessage "You got the Minigun.";
Weapon.UpSound "";
Weapon.SlotNumber 7;
Weapon.SelectionOrder 3;
Weapon.AmmoType "MiniAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "MiniAmmo";
Weapon.AmmoUse2 1;
Weapon.AmmoGive 50;
}
States
{
Spawn:
MGNP A -1;
Stop;
MGNP B -1;
Stop;
}
}

View file

@ -1,4 +1,4 @@
Class Tier4Ammo : RandomSpawner replaces ClipBox
Class Tier4Ammo : RandomSpawner2 replaces ClipBox
{
Default
{
@ -7,7 +7,7 @@ Class Tier4Ammo : RandomSpawner replaces ClipBox
}
}
Class Tier4Weapon : RandomSpawner replaces Chaingun
Class Tier4Weapon : RandomSpawner2 replaces Chaingun
{
Default
{
@ -23,9 +23,9 @@ Class PulseAmmo : UTAmmo
Tag "Pulse Cell";
Inventory.PickupMessage "You picked up a Pulse Cell.";
Inventory.Amount 25;
Inventory.MaxAmount 200;
Inventory.MaxAmount 199;
Ammo.BackpackAmount 50;
Ammo.BackpackMaxAmount 400;
Ammo.BackpackMaxAmount 199;
Ammo.DropAmount 25;
UTAmmo.UsedInSlot AMMO_SLOT5;
}
@ -422,6 +422,7 @@ Class PulseGun : UTWeapon
Inventory.PickupMessage "You got a Pulse Gun";
Weapon.UpSound "pulse/select";
Weapon.SlotNumber 5;
Weapon.SelectionOrder 5;
Weapon.AmmoType "PulseAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "PulseAmmo";

View file

@ -7,7 +7,7 @@ Class RipperAmmo : UTAmmo
Inventory.Amount 25;
Inventory.MaxAmount 75;
Ammo.BackpackAmount 50;
Ammo.BackpackMaxAmount 150;
Ammo.BackpackMaxAmount 75;
Ammo.DropAmount 25;
UTAmmo.UsedInSlot AMMO_SLOT6;
}
@ -27,10 +27,19 @@ Class Ripper2 : UTWeapon
Inventory.PickupMessage "You got the Ripper.";
Weapon.UpSound "";
Weapon.SlotNumber 6;
Weapon.SelectionOrder 4;
Weapon.AmmoType "RipperAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "RipperAmmo";
Weapon.AmmoUse2 1;
Weapon.AmmoGive 15;
}
States
{
Spawn:
RZRP A -1;
Stop;
RZRP B -1;
Stop;
}
}

View file

@ -7,7 +7,7 @@ Class ShockAmmo : UTAmmo
Inventory.Amount 10;
Inventory.MaxAmount 50;
Ammo.BackpackAmount 20;
Ammo.BackpackMaxAmount 100;
Ammo.BackpackMaxAmount 50;
Ammo.DropAmount 10;
UTAmmo.UsedInSlot AMMO_SLOT4;
}
@ -838,6 +838,7 @@ Class ShockRifle : UTWeapon
Inventory.PickupMessage "You got the ASMD Shock Rifle.";
Weapon.UpSound "shock/select";
Weapon.SlotNumber 4;
Weapon.SelectionOrder 6;
Weapon.AmmoType "ShockAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "ShockAmmo";
@ -944,6 +945,7 @@ Class EnhancedShockRifle : UTWeapon replaces InvulnerabilitySphere
Inventory.PickupMessage "You got an Enhanced Shock Rifle!";
Weapon.UpSound "shock/select";
Weapon.SlotNumber 4;
Weapon.SelectionOrder 6;
+INVENTORY.ALWAYSPICKUP;
Weapon.AmmoType "EnhancedShockAmmo";
Weapon.AmmoUse 1;

View file

@ -7,7 +7,7 @@ Class RifleAmmo : UTAmmo
Inventory.Amount 10;
Inventory.MaxAmount 50;
Ammo.BackpackAmount 20;
Ammo.BackpackMaxAmount 100;
Ammo.BackpackMaxAmount 50;
Ammo.DropAmount 10;
UTAmmo.UsedInSlot AMMO_SLOT10;
}
@ -44,10 +44,19 @@ Class SniperRifle : UTWeapon
Inventory.PickupMessage "You got the Sniper Rifle.";
Weapon.UpSound "";
Weapon.SlotNumber 0;
Weapon.SelectionOrder 5;
Weapon.AmmoType "RifleAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "RifleAmmo";
Weapon.AmmoUse2 1;
Weapon.AmmoGive 8;
}
States
{
Spawn:
SRFP A -1;
Stop;
SRFP B -1;
Stop;
}
}

View file

@ -5,6 +5,16 @@ Class Translocator : UTWeapon
Tag "Translocator";
Inventory.PickupMessage "You got the Translocator Source Module.";
Weapon.SlotNumber 1;
Weapon.SelectionOrder 10;
+INVENTORY.UNTOSSABLE;
+WEAPON.NO_AUTO_SWITCH;
}
States
{
Spawn:
TLCP A -1;
Stop;
TLCP B -1;
Stop;
}
}

View file

@ -184,21 +184,43 @@ Class UTAmmo : Ammo
}
}
// Random Spawner that passes through dropped status to items
Class RandomSpawner2 : RandomSpawner
{
override void PostSpawn( Actor spawned )
{
if ( !bDROPPED ) return;
if ( spawned is 'Inventory' ) Inventory(spawned).bTOSSED = bDROPPED;
if ( spawned is 'UTWeapon' )
{
spawned.SetState(spawned.ResolveState("Spawn")+1);
Inventory(spawned).bALWAYSPICKUP = true;
}
}
}
Class UTWeapon : Weapon
{
virtual ui void PreRender() {}
virtual ui void PostRender() {}
override Inventory CreateTossable( int amt )
{
if ( Ammo1 && (Ammo1.Amount <= 0) ) return null;
Inventory d = Super.CreateTossable(amt);
if ( d && (d.GetClass() == GetClass()) )
{
d.SetState(d.ResolveState("Spawn")+1);
d.bALWAYSPICKUP = true;
}
return d;
}
override bool SpecialDropAction( Actor dropper )
{
SetState(ResolveState("Spawn")+1);
return true;
bALWAYSPICKUP = true;
return false;
}
override void Tick()
@ -401,12 +423,14 @@ Class UTBlueKey : BlueCard replaces BlueCard
}
}
Class UTMenuHandler : StaticEventHandler
Class UTMainHandler : StaticEventHandler
{
ui TextureID tex;
transient int lastfrag;
override void WorldLoaded( WorldEvent e )
{
lastfrag = int.min;
if ( gamestate != GS_LEVEL || e.IsSaveGame ) return;
if ( level.levelname ~== "Modder Test Map" )
{
@ -439,6 +463,8 @@ Class UTMenuHandler : StaticEventHandler
override void PostUiTick()
{
if ( gametic <= 0 ) StartMenu();
if ( !(StatusBar is 'UTHUD') ) return;
UTHUD(StatusBar).lastfrag = lastfrag;
}
override void RenderOverlay( RenderEvent e )
@ -448,4 +474,10 @@ Class UTMenuHandler : StaticEventHandler
Screen.Dim("Black",1.0,0,0,Screen.GetWidth(),Screen.GetHeight());
Screen.DrawTexture(tex,true,0,0,DTA_VirtualWidth,1024,DTA_VirtualHeight,768);
}
}
override void WorldThingDamaged( WorldEvent e )
{
if ( (e.Thing.Health <= 0) && e.DamageSource && (e.DamageSource != e.Thing) && e.DamageSource.player && (e.DamageSource.player == players[consoleplayer]) )
lastfrag = gametic;
}
}

View file

@ -1,23 +1,465 @@
// An almost 1:1 recreation of the UT HUD, uses player color for tinting
// An almost 1:1 recreation of the UT HUD
// Because this requires some flexibility, it barely makes use of the Statusbar
// functions and instead uses the raw Screen API.
Class ViewTracer : LineTracer
{
Actor ignore;
override ETraceStatus TraceCallback()
{
if ( Results.HitType == TRACE_HitActor )
{
if ( (Results.HitActor == ignore) || !Results.HitActor.player || !Results.HitActor.bSHOOTABLE || Results.HitActor.bINVISIBLE ) return TRACE_Skip;
return TRACE_Stop;
}
else if ( (Results.HitType == TRACE_HitWall) && (Results.Tier == TIER_Middle) )
{
if ( !Results.HitLine.sidedef[1] ) return TRACE_Stop;
return TRACE_Skip;
}
return TRACE_Stop;
}
}
Class UTHud : BaseStatusBar
{
TextureID AmmoBar, Boxes[4], Keys[4], BigNum[12], Flash, Slots[10], Icons[14], Uses[14], Man[5], Woman[5], WeaponBox;
Class<Weapon> IconClasses[14];
double HScale;
Color tintcolor, bgcolor;
double opacity;
int lastfrag, lastpickup, lastslot;
ViewTracer vtracer;
Actor lastseen;
int lastseentic;
// For easier UT Canvas drawing
Color DrawColor, WhiteColor, GoldColor;
double CurX, CurY;
double FracTic;
override void Init()
{
Super.Init();
SetSize(0,1280,960);
SetSize(0,320,200);
vtracer = new("ViewTracer");
// Set defaults
DrawColor = WhiteColor = "White";
GoldColor = "Gold";
// Load textures
AmmoBar = TexMan.CheckForTexture("AmoBar",TexMan.Type_Any);
Boxes[0] = TexMan.CheckForTexture("AmoBox",TexMan.Type_Any);
Boxes[1] = TexMan.CheckForTexture("ArmoBox",TexMan.Type_Any);
Boxes[2] = TexMan.CheckForTexture("HPBox",TexMan.Type_Any);
Boxes[3] = TexMan.CheckForTexture("FragBox",TexMan.Type_Any);
Keys[0] = TexMan.CheckForTexture("RKey",TexMan.Type_Any);
Keys[1] = TexMan.CheckForTexture("BKey",TexMan.Type_Any);
Keys[2] = TexMan.CheckForTexture("GKey",TexMan.Type_Any);
Keys[3] = TexMan.CheckForTexture("Skul",TexMan.Type_Any);
BigNum[0] = TexMan.CheckForTexture("Big0",TexMan.Type_Any);
BigNum[1] = TexMan.CheckForTexture("Big1",TexMan.Type_Any);
BigNum[2] = TexMan.CheckForTexture("Big2",TexMan.Type_Any);
BigNum[3] = TexMan.CheckForTexture("Big3",TexMan.Type_Any);
BigNum[4] = TexMan.CheckForTexture("Big4",TexMan.Type_Any);
BigNum[5] = TexMan.CheckForTexture("Big5",TexMan.Type_Any);
BigNum[6] = TexMan.CheckForTexture("Big6",TexMan.Type_Any);
BigNum[7] = TexMan.CheckForTexture("Big7",TexMan.Type_Any);
BigNum[8] = TexMan.CheckForTexture("Big8",TexMan.Type_Any);
BigNum[9] = TexMan.CheckForTexture("Big9",TexMan.Type_Any);
BigNum[10] = TexMan.CheckForTexture("BigColon",TexMan.Type_Any);
BigNum[11] = TexMan.CheckForTexture("BigMinus",TexMan.Type_Any);
Flash = TexMan.CheckForTexture("HFlash",TexMan.Type_Any);
Slots[0] = TexMan.CheckForTexture("SlotImp",TexMan.Type_Any);
Slots[1] = TexMan.CheckForTexture("SlotAuto",TexMan.Type_Any);
Slots[2] = TexMan.CheckForTexture("SlotBio",TexMan.Type_Any);
Slots[3] = TexMan.CheckForTexture("SlotASMD",TexMan.Type_Any);
Slots[4] = TexMan.CheckForTexture("SlotPuls",TexMan.Type_Any);
Slots[5] = TexMan.CheckForTexture("SlotRip",TexMan.Type_Any);
Slots[6] = TexMan.CheckForTexture("SlotMini",TexMan.Type_Any);
Slots[7] = TexMan.CheckForTexture("SlotFlak",TexMan.Type_Any);
Slots[8] = TexMan.CheckForTexture("Slot8bal",TexMan.Type_Any);
Slots[9] = TexMan.CheckForTexture("SlotRifl",TexMan.Type_Any);
Icons[0] = TexMan.CheckForTexture("IconImp",TexMan.Type_Any);
Icons[1] = TexMan.CheckForTexture("IconAuto",TexMan.Type_Any);
Icons[2] = TexMan.CheckForTexture("IconBio",TexMan.Type_Any);
Icons[3] = TexMan.CheckForTexture("IconASMD",TexMan.Type_Any);
Icons[4] = TexMan.CheckForTexture("IconPuls",TexMan.Type_Any);
Icons[5] = TexMan.CheckForTexture("IconRip",TexMan.Type_Any);
Icons[6] = TexMan.CheckForTexture("IconMini",TexMan.Type_Any);
Icons[7] = TexMan.CheckForTexture("IconFlak",TexMan.Type_Any);
Icons[8] = TexMan.CheckForTexture("Icon8bal",TexMan.Type_Any);
Icons[9] = TexMan.CheckForTexture("IconRifl",TexMan.Type_Any);
Icons[10] = TexMan.CheckForTexture("IconSaw",TexMan.Type_Any);
Icons[11] = TexMan.CheckForTexture("IconTrns",TexMan.Type_Any);
Icons[12] = TexMan.CheckForTexture("IconWarH",TexMan.Type_Any);
Icons[13] = TexMan.CheckForTexture("IconASMD",TexMan.Type_Any);
Uses[0] = TexMan.CheckForTexture("UseImp",TexMan.Type_Any);
Uses[1] = TexMan.CheckForTexture("UseAuto",TexMan.Type_Any);
Uses[2] = TexMan.CheckForTexture("UseBio",TexMan.Type_Any);
Uses[3] = TexMan.CheckForTexture("UseASMD",TexMan.Type_Any);
Uses[4] = TexMan.CheckForTexture("UsePuls",TexMan.Type_Any);
Uses[5] = TexMan.CheckForTexture("UseRip",TexMan.Type_Any);
Uses[6] = TexMan.CheckForTexture("UseMini",TexMan.Type_Any);
Uses[7] = TexMan.CheckForTexture("UseFlak",TexMan.Type_Any);
Uses[8] = TexMan.CheckForTexture("Use8bal",TexMan.Type_Any);
Uses[9] = TexMan.CheckForTexture("UseRifl",TexMan.Type_Any);
Uses[10] = TexMan.CheckForTexture("UseSaw",TexMan.Type_Any);
Uses[11] = TexMan.CheckForTexture("UseTrns",TexMan.Type_Any);
Uses[12] = TexMan.CheckForTexture("UseWarH",TexMan.Type_Any);
Uses[13] = TexMan.CheckForTexture("UseASMD",TexMan.Type_Any);
IconClasses[0] = "ImpactHammer";
IconClasses[1] = "Enforcer";
IconClasses[2] = "BioRifle";
IconClasses[3] = "ShockRifle";
IconClasses[4] = "PulseGun";
IconClasses[5] = "Ripper2";
IconClasses[6] = "Minigun";
IconClasses[7] = "FlakCannon";
IconClasses[8] = "UTRocketLauncher";
IconClasses[9] = "SniperRifle";
IconClasses[10] = "UTChainsaw";
IconClasses[11] = "Translocator";
IconClasses[12] = "WarheadLauncher";
IconClasses[13] = "EnhancedShockRifle";
Man[0] = TexMan.CheckForTexture("Man",TexMan.Type_Any);
Man[1] = TexMan.CheckForTexture("ManArmo",TexMan.Type_Any);
Man[2] = TexMan.CheckForTexture("ManPad",TexMan.Type_Any);
Man[3] = TexMan.CheckForTexture("ManBoot",TexMan.Type_Any);
Man[4] = TexMan.CheckForTexture("ManBelt",TexMan.Type_Any);
Woman[0] = TexMan.CheckForTexture("Woman",TexMan.Type_Any);
Woman[1] = TexMan.CheckForTexture("WomanArm",TexMan.Type_Any);
Woman[2] = TexMan.CheckForTexture("WomanPad",TexMan.Type_Any);
Woman[3] = TexMan.CheckForTexture("WomanBot",TexMan.Type_Any);
Woman[4] = TexMan.CheckForTexture("WomanBlt",TexMan.Type_Any);
WeaponBox = TexMan.CheckForTexture("WpSel",TexMan.Type_Any);
}
override void Draw( int state, double TicFrac )
{
Super.Draw(state,TicFrac);
if ( (CPlayer.ReadyWeapon is 'UTWeapon') )
UTWeapon(CPlayer.ReadyWeapon).PreRender();
if ( (state == HUD_StatusBar) || (state == HUD_Fullscreen) )
{
BeginHUD();
DrawUTHUD(TicFrac);
FracTic = TicFrac;
DrawUTHUD();
}
if ( (CPlayer.ReadyWeapon is 'UTWeapon') )
UTWeapon(CPlayer.ReadyWeapon).PostRender();
}
private Color LerpColor( Color a, Color b, double x )
{
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, Color tint = Color("Black") )
{
double ss = (HScale*sx);
double dw = (Screen.GetWidth()/ss), dh = (Screen.GetHeight()/ss);
double dx = CurX/ss, dy = CurY/ss;
Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,opacity,DTA_FillColor,bgcolor);
Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_AlphaChannel,true,DTA_FillColor,(tint!="Black")?tint:tintcolor);
}
private void UTDrawColorTex( TextureID tx, double sx = 1.0, double alpha = 1.0 )
{
double ss = (HScale*sx);
double dw = (Screen.GetWidth()/ss), dh = (Screen.GetHeight()/ss);
double dx = CurX/ss, dy = CurY/ss;
Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_AlphaChannel,true,DTA_Alpha,alpha,DTA_FillColor,DrawColor);
}
private void UTDrawPlainTex( TextureID tx, double sx = 1.0, double alpha = 1.0 )
{
double ss = (HScale*sx);
double dw = (Screen.GetWidth()/ss), dh = (Screen.GetHeight()/ss);
double dx = CurX/ss, dy = CurY/ss;
Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha);
}
private bool UTDrawWeaponIcon( Weapon w, bool use, bool pending, double sx = 1.0 )
{
for ( int i=0; i<14; i++ )
{
if ( !(w is IconClasses[i]) ) continue;
if ( use ) UTDrawTintedTex(Uses[i],sx);
else if ( pending ) UTDrawTintedTex(Icons[i],sx);
else UTDrawTintedTex(Icons[i],sx,tintcolor/2);
return true;
}
return false;
}
// UT's implementation doesn't seem to translate well to this, so I improvised a bit and made something not so ugly
private void UTDrawBigNum( int value, double sx = 1.0 )
{
double step = 25*HScale*sx;
double ss = (HScale*sx);
double dw = (Screen.GetWidth()/ss), dh = (Screen.GetHeight()/ss);
String digits = String.Format("%d",min(abs(value),9999));
double flen = 3*step;
double len = digits.length()*step;
CurX += (flen-len)*0.5;
if ( digits.CharAt(0) == "1" ) CurX -= 0.5*step;
if ( value < 0 )
{
Screen.DrawTexture(BigNum[11],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_AlphaChannel,true,DTA_FillColor,DrawColor);
CurX += step;
}
for ( int i=0; i<digits.length(); i++ )
{
Screen.DrawTexture(BigNum[digits.CharCodeAt(i)-0x30],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_AlphaChannel,true,DTA_FillColor,DrawColor);
CurX += step;
}
}
private void DrawUTHUD( double TicFrac )
private void DrawAmmo()
{
Inventory ammotype1, ammotype2;
[ammotype1, ammotype2] = GetCurrentAmmo();
CurX = Screen.GetWidth()-128*HScale;
CurY = Screen.GetHeight()-64*HScale;
UTDrawTintedTex(Boxes[0]);
CurX += 8*HScale;
CurY += 14*HScale;
DrawColor = WhiteColor;
if ( ammotype1 ) UTDrawBigNum(ammotype1.Amount);
if ( ammotype2 && (ammotype2 != ammotype1) )
{
CurX = Screen.GetWidth()-128*HScale;
CurY = Screen.GetHeight()-128*HScale;
UTDrawTintedTex(Boxes[0]);
CurX += 8*HScale;
CurY += 14*HScale;
UTDrawBigNum(ammotype2.Amount);
}
}
private void DrawStatus()
{
CurX = Screen.GetWidth()-128*HScale;
CurY = 0;
Color dollcolor = tintcolor;
DamageAmplifier d;
UTArmor b, a, t, s;
//UTJumpBoots j;
d = DamageAmplifier(CPlayer.mo.FindInventory("DamageAmplifier"));
b = UTArmor(CPlayer.mo.FindInventory("UTArmorBonus"));
a = UTArmor(CPlayer.mo.FindInventory("UTBodyArmor"));
t = UTArmor(CPlayer.mo.FindInventory("UTThighPads"));
//b = CPlayer.mo.FindInventory("UTJumpBoots"));
s = UTArmor(CPlayer.mo.FindInventory("UTShieldBelt"));
if ( d && !d.isBlinking() ) dollcolor = d.BlendColor;
if ( CPlayer.GetGender() == 1 )
{
UTDrawTintedTex(Woman[0],1.0,dollcolor);
DrawColor = dollcolor;
if ( a ) UTDrawColorTex(Woman[1],1.0,a.Amount/double(a.MaxAmount));
if ( t ) UTDrawColorTex(Woman[2],1.0,t.Amount/double(t.MaxAmount));
//if ( j ) UTDrawColorTex(Woman[3],1.0,b.Amount/double(b.MaxAmount));
DrawColor = GoldColor;
if ( s ) UTDrawColorTex(Woman[4],1.0,s.Amount/double(s.MaxAmount));
}
else
{
UTDrawTintedTex(Man[0],1.0,dollcolor);
DrawColor = dollcolor;
if ( a ) UTDrawColorTex(Man[1],1.0,a.Amount/double(a.MaxAmount));
if ( t ) UTDrawColorTex(Man[2],1.0,t.Amount/double(t.MaxAmount));
//if ( j ) UTDrawColorTex(Man[3],1.0,b.Amount/double(b.MaxAmount));
DrawColor = GoldColor;
if ( s ) UTDrawColorTex(Man[4],1.0,s.Amount/double(s.MaxAmount));
}
DrawColor = WhiteColor;
CurX = Screen.GetWidth()-268*HScale;
UTDrawTintedTex(Boxes[1]);
int allarmor = 0;
if ( b ) allarmor += b.amount;
if ( a ) allarmor += a.amount;
if ( t ) allarmor += t.amount;
if ( s ) allarmor += s.amount;
CurX += 8*HScale;
CurY += 14*HScale;
UTDrawBigNum(Min(199,allarmor));
CurX = Screen.GetWidth()-268*HScale;
CurY = 64*HScale;
if ( CPlayer.mo.Health < CPlayer.mo.SpawnHealth()/2 )
{
Color blinkcolor;
double blinky = ((gametic+fractic)/Thinker.TICRATE)*1.5;
blinky = blinky-floor(blinky);
blinkcolor = LerpColor(tintcolor,WhiteColor,blinky);
UTDrawTintedTex(Boxes[2],1.0,blinkcolor);
DrawColor = LerpColor(WhiteColor,blinkcolor,blinky);
CurX += 8*HScale;
CurY += 14*HScale;
UTDrawBigNum(max(0,CPlayer.mo.Health));
}
else
{
UTDrawTintedTex(Boxes[2]);
CurX += 8*HScale;
CurY += 14*HScale;
UTDrawBigNum(Clamp(CPlayer.mo.Health,0,199));
}
}
private void DrawWeapons()
{
double BaseX = 128*HScale;
double WeapScale = 0.8*HScale;
double BaseY = Screen.GetHeight()-64*WeapScale;
double WeaponOffset = 128*WeapScale;
let cw = CPlayer.ReadyWeapon;
let pw = CPlayer.PendingWeapon;
if ( cw )
{
int slot = cw.SlotNumber?(cw.SlotNumber-1):9;
CurX = BaseX+slot*WeaponOffset;
CurY = BaseY;
UTDrawWeaponIcon(cw,true,false,0.8);
CurX = BaseX+slot*WeaponOffset;
CurY = BaseY;
UTDrawPlainTex(WeaponBox,0.8);
}
if ( pw && (pw != WP_NOCHANGE) )
{
int slot = pw.SlotNumber?(pw.SlotNumber-1):9;
CurX = BaseX+slot*WeaponOffset-64*WeapScale;
CurY = BaseY-32*WeapScale;
DrawColor = GoldColor;
UTDrawColorTex(Flash,0.8);
}
Weapon wslots[10];
for ( Inventory i = CPlayer.mo.Inv; i; i=i.Inv )
{
if ( !(i is 'Weapon') ) continue;
let w = Weapon(i);
int slot = w.SlotNumber?(w.SlotNumber-1):9;
if ( !wslots[slot] ) wslots[slot] = w;
else if ( (wslots[slot] != cw) && ((wslots[slot] != pw)
|| (wslots[slot].SelectionOrder > w.SelectionOrder)) )
wslots[slot] = w;
}
for ( int i=0; i<10; i++ )
{
CurX = BaseX+i*WeaponOffset;
CurY = BaseY;
if ( !wslots[i] )
{
UTDrawTintedTex(Slots[i],1.6,tintcolor/2);
}
else if ( wslots[i] != cw )
{
if ( !UTDrawWeaponIcon(wslots[i],false,wslots[i]==pw,0.8) )
UTDrawTintedTex(Slots[i],1.6,tintcolor/2);
}
}
for ( int i=0; i<10; i++ )
{
if ( !wslots[i] ) continue;
CurX = BaseX+i*WeaponOffset+4*WeapScale;
CurY = BaseY+4*WeapScale;
DrawColor = GoldColor;
UTDrawColorTex(BigNum[(i==9)?0:(i+1)],0.6);
if ( !wslots[i].Ammo1 ) return;
CurY = BaseY+52*WeapScale;
Vector2 ss = (0.6875,0.5)*WeapScale;
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*(wslots[i].Ammo1.Amount/double(wslots[i].Ammo1.MaxAmount));
int cx, cy, cw, ch;
[cx,cy,cw,ch] = Screen.GetClipRect();
Screen.SetClipRect(CurX,CurY,ddw*ss.x,bs.y*ss.y);
Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true);
Screen.SetClipRect(cx,cy,cw,ch);
}
}
private void DrawFragCount()
{
CurX = 0;
CurY = Screen.GetHeight()-64*HScale;
DrawColor = tintcolor;
double whiten = ((gametic+fractic)-lastfrag)/Thinker.TICRATE;
if ( whiten < 3.0 )
{
if ( tintcolor == GoldColor )
DrawColor = WhiteColor;
else DrawColor = GoldColor;
CurX -= 64*HScale;
CurY -= 32*HScale;
UTDrawColorTex(Flash);
CurX += 64*HScale;
CurY += 32*HScale;
whiten = 4*whiten-int(4*whiten);
DrawColor = lerpcolor(tintcolor,DrawColor,whiten);
}
UTDrawTintedTex(Boxes[3],1.0,DrawColor);
CurX += 44*HScale;
CurY += 14*HScale;
DrawColor = WhiteColor;
UTDrawBigNum((deathmatch||teamplay)?CPlayer.fragcount:CPlayer.killcount);
}
private void DrawIdentifyInfo()
{
double lalpha = 2.0-((gametic+fractic)-lastseentic)/Thinker.TICRATE;
if ( !lastseen || (lalpha <= 0) ) return;
String cl1 = "Teal", cl2 = "Cyan";
if ( deathmatch && (lastseen.player.GetTeam() < teams.size()) )
{
cl2 = teams[lastseen.player.GetTeam()].mName;
cl1 = String.Format("Dark%s",cl2);
}
String tname = String.Format("\c[%s]Name:\c[%s] %s",cl1,cl2,lastseen.player.GetUserName());
CurX = (Screen.GetWidth()-confont.StringWidth(tname)*CleanXFac)*0.5;
CurY = Screen.GetHeight()*0.75;
Screen.DrawText(confont,Font.CR_UNTRANSLATED,CurX,CurY,tname,DTA_CleanNoMove,true,DTA_Alpha,lalpha/2.);
if ( !deathmatch || (lastseen.IsTeammate(CPlayer.mo)) )
{
CurY += 1.2*confont.GetHeight()*CleanYFac;
tname = String.Format("\c[%s]Health:\c[%s] %d",cl1,cl2,lastseen.Health);
Screen.DrawText(confont,Font.CR_UNTRANSLATED,CurX,CurY,tname,DTA_CleanNoMove,true,DTA_Alpha,lalpha/2.);
}
}
override void Tick()
{
Super.Tick();
vtracer.ignore = CPlayer.mo;
vtracer.trace(CPlayer.mo.Vec2OffsetZ(0,0,CPlayer.viewz),CPlayer.mo.CurSector,(cos(CPlayer.mo.angle)*cos(CPlayer.mo.pitch),sin(CPlayer.mo.angle)*cos(CPlayer.mo.pitch),-sin(CPlayer.mo.pitch)),1000,0);
if ( vtracer.Results.HitType != TRACE_HitActor ) return;
lastseen = vtracer.Results.HitActor;
lastseentic = gametic;
}
private void DrawUTHUD()
{
if ( players[consoleplayer].camera is 'GuidedWarShell' ) return;
HScale = Screen.GetWidth()/1280.;
switch ( CVar.GetCVar('flak_colorprefs',CPlayer).GetInt() )
{
case 0:
if ( CPlayer.GetTeam() >= Teams.Size() )
tintcolor = Color("White");
else tintcolor = Color(Teams[CPlayer.GetTeam()].mName);
break;
case 1:
tintcolor = CPlayer.GetColor();
break;
case 2:
tintcolor = Color(CVar.GetCVar('flak_colorcustom',CPlayer).GetString());
break;
}
opacity = CVar.GetCVar('flak_opacity',CPlayer).GetFloat();
bgcolor = Color(CVar.GetCVar('flak_bgcolor',CPlayer).GetString());
// Display Weapons
DrawWeapons();
// Display Frag count
DrawFragCount();
// Draw Ammo
DrawAmmo();
// Draw Health/Armor status
DrawStatus();
// Display Identification Info
if ( CPlayer == players[consoleplayer] ) DrawIdentifyInfo();
}
}

View file

@ -584,6 +584,7 @@ Class WarheadLauncher : UTWeapon replaces BFG9000
Inventory.PickupMessage "You got the Redeemer.";
Weapon.UpSound "warhead/select";
Weapon.SlotNumber 0;
Weapon.SelectionOrder 0;
Weapon.AmmoType "WarheadAmmo";
Weapon.AmmoUse 1;
Weapon.AmmoType2 "WarheadAmmo";
@ -591,6 +592,7 @@ Class WarheadLauncher : UTWeapon replaces BFG9000
Weapon.AmmoGive 1;
Inventory.RespawnTics 2100;
+INVENTORY.ALWAYSPICKUP;
+WEAPON.NOAUTOFIRE;
}
States
{
@ -609,15 +611,13 @@ Class WarheadLauncher : UTWeapon replaces BFG9000
}
Wait;
Fire:
WARI A 3;
WARF A 3 A_WarheadFire();
WARF BCDEFG 3 A_WarheadSmoke();
WARF A 4 A_WarheadFire();
WARF BCDEFG 4 A_WarheadSmoke();
WARI A 5;
Goto Idle;
AltFire:
WARI A 3;
WARF A 3 A_WarheadAlt();
WARF BCDEFG 3 A_WarheadSmoke();
WARF A 4 A_WarheadAlt();
WARF BCDEFG 4 A_WarheadSmoke();
WARI A 1 A_JumpIf(!invoker.Guided,1);
Wait;
WARI A 30;