This branch is a staging area for changes that will make it to devel once they are fully implemented.

Everything in here is highly unstable and may not work.
Current commit contains various new features for the HUD, some cleanup, and additional changes for compatibility with Doomreal as it is developed.
The diff is kinda fucky on the font restructure due to flaky rename detection.
This commit is contained in:
Marisa the Magician 2019-08-31 03:09:40 +02:00
commit a3449b5c5b
1411 changed files with 416 additions and 214 deletions

View file

@ -142,7 +142,7 @@ Class UTShieldBelt : UTArmor
}
int oldamt = amount;
Super.AbsorbDamage(damage,damageType,newdamage);
if ( (oldamt > 0) && (amount <= 0) ) PrintPickupMessage(true,StringTable.Localize("$D_SHIELDBELT"));
if ( (oldamt > 0) && (amount <= 0) && Owner.CheckLocalView() ) Console.Printf(StringTable.Localize("$D_SHIELDBELT"));
}
override bool HandlePickup( Inventory item )
{

View file

@ -144,28 +144,13 @@ Class BioLight : DynamicLight
}
}
Class BioXLight : DynamicLight
Class BioXLight : PaletteLight
{
double lifetime;
Default
{
DynamicLight.Type "Point";
Args 64,255,48,30;
}
override void PostBeginPlay()
{
Super.PostBeginPlay();
lifetime = 1.0;
}
override void Tick()
{
Super.Tick();
if ( isFrozen() ) return;
args[LIGHT_RED] = int(64*lifetime);
args[LIGHT_GREEN] = int(255*lifetime);
args[LIGHT_BLUE] = int(48*lifetime);
lifetime -= 0.05;
if ( lifetime <= 0 ) Destroy();
Tag "ExplGreen";
Args 0,0,0,30;
ReactionTime 20;
}
}

View file

@ -104,6 +104,7 @@ Class ActShieldBelt : UTActivatable
Inventory.PickupMessage "$I_SHIELDBELT";
+COUNTITEM;
+INVENTORY.BIGPOWERUP;
+INVENTORY.ISARMOR;
UTActivatable.GiveItem "UTShieldBelt";
Inventory.RespawnTics 2100;
}

View file

@ -94,11 +94,12 @@ Class UTRocketTrail : Actor
}
}
Class RocketExplLight : SlugLight
Class RocketExplLight : PaletteLight
{
Default
{
Args 255,224,128,120;
Args 0,0,0,120;
ReactionTime 20;
}
}

View file

@ -31,7 +31,13 @@ Class EnforcerLight : DynamicLight
Destroy();
return;
}
if ( target.player ) SetOrigin(target.Vec2OffsetZ(0,0,target.player.viewz),true);
if ( target.player )
{
Vector3 x, y, z, origin;
[x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll);
origin = level.Vec3Offset(target.Vec2OffsetZ(0,0,target.player.viewz),x*12);
SetOrigin(origin,true);
}
else SetOrigin(target.pos,true);
if ( cnt++ > 2 ) Destroy();
}
@ -173,6 +179,7 @@ Class Enforcer : UTWeapon
bool SlaveActive, SlaveDown, SlaveReload, SlaveAltFire;
int SlaveRefire;
transient ui Font usmf;
double AltAccuracy;
property ClipCount : ClipCount;
property SlaveClipCount : SlaveClipCount;
@ -213,6 +220,7 @@ Class Enforcer : UTWeapon
{
Weapon weap = Weapon(invoker);
if ( !weap || !player ) return;
if ( invoker.altaccuracy < 0.2 ) invoker.altaccuracy += 0.05;
if ( slave )
{
if ( flak_enforcerreload && (invoker.slaveclipcount < 5) ) A_PlaySound("enforcer/click",CHAN_6);
@ -323,8 +331,7 @@ Class Enforcer : UTWeapon
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;
double a = FRandom[Enforcer](0,360), s = FRandom[Enforcer](0,alt?invoker.altaccuracy:0.004);
[x2, y2, z2] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll);
Vector3 dir = (x2+y2*cos(a)*s+z2*sin(a)*s).unit();
FLineTraceData d;
@ -499,7 +506,11 @@ Class Enforcer : UTWeapon
2NFI A 0;
Goto LeftIdle;
AltFire:
ENFA A 0 A_Overlay(-9999,null);
ENFA A 0
{
invoker.altaccuracy = 0.08;
A_Overlay(-9999,null);
}
ENFA ABCDEF 1;
AltHold:
ENFA G 0 A_EnforcerFire(true);

View file

@ -395,28 +395,12 @@ Class SlugSmoke : Actor
}
}
Class SlugLight : DynamicLight
Class SlugLight : PaletteLight
{
double lifetime;
Default
{
DynamicLight.Type "Point";
Args 255,224,128,80;
}
override void PostBeginPlay()
{
Super.PostBeginPlay();
lifetime = 1.0;
}
override void Tick()
{
Super.Tick();
if ( isFrozen() ) return;
args[LIGHT_RED] = int(255*lifetime);
args[LIGHT_GREEN] = int(224*lifetime);
args[LIGHT_BLUE] = int(128*lifetime);
lifetime -= 0.05;
if ( lifetime <= 0 ) Destroy();
Args 0,0,0,80;
ReactionTime 20;
}
}

View file

@ -39,7 +39,7 @@ Class DamageAmpLight : DynamicLight
if ( target.player )
SetOrigin(target.Vec2OffsetZ(0,0,target.player.viewz),true);
else SetOrigin(target.Vec3Offset(0,0,target.height/2),true);
args[LIGHT_INTENSITY] = Random[ASMD](10,12)*8;
args[LIGHT_INTENSITY] = Random[UDamage](10,12)*8;
bDORMANT = Powerup(master).isBlinking();
}
}
@ -78,7 +78,7 @@ Class DamageAmplifier : Powerup
override void EndEffect()
{
Super.EndEffect();
if ( EffectTics <= 0 ) PrintPickupMessage(true,StringTable.Localize("$D_UDAMAGE"));
if ( (EffectTics <= 0) && Owner && Owner.CheckLocalView() ) Console.Printf(StringTable.Localize("$D_UDAMAGE"));
}
override bool isBlinking()
@ -219,7 +219,7 @@ Class PowerUTInvisibility : PowerInvisibility
override void EndEffect()
{
Super.EndEffect();
if ( EffectTics <= 0 ) PrintPickupMessage(true,StringTable.Localize("$D_INVISIBILITY"));
if ( (EffectTics <= 0) && Owner && Owner.CheckLocalView() ) Console.Printf(StringTable.Localize("$D_INVISIBILITY"));
}
}
@ -339,7 +339,7 @@ Class UTJumpBoots : Inventory
}
else if ( (Amount <= 0) && owner.player.onground )
{
PrintPickupMessage(true,StringTable.Localize("$D_JUMPBOOTS"));
if ( Owner.CheckLocalView() ) Console.Printf(StringTable.Localize("$D_JUMPBOOTS"));
DepleteOrDestroy();
}
}
@ -438,7 +438,7 @@ Class Searchlight : Inventory
ticcnt = 0;
if ( --Amount <= 0 )
{
PrintPickupMessage(true,StringTable.Localize("$D_SEARCHLIGHT"));
if ( Owner.CheckLocalView() ) Console.Printf(StringTable.Localize("$D_SEARCHLIGHT"));
DepleteOrDestroy();
}
}

View file

@ -132,28 +132,13 @@ Class PulseBallLight : DynamicLight
}
}
Class PulseExplLight : DynamicLight
Class PulseExplLight : PaletteLight
{
double lifetime;
Default
{
DynamicLight.Type "Point";
Tag "ExplGreen";
ReactionTime 20;
Args 64,255,0,30;
}
override void PostBeginPlay()
{
Super.PostBeginPlay();
lifetime = 1.0;
}
override void Tick()
{
Super.Tick();
if ( isFrozen() ) return;
args[LIGHT_RED] = int(64*lifetime);
args[LIGHT_GREEN] = int(255*lifetime);
lifetime -= 1./ReactionTime;
if ( lifetime <= 0 ) Destroy();
Args 0,0,0,30;
}
}

View file

@ -148,28 +148,12 @@ Class Razor2 : Actor
}
}
Class Razor2AltLight : DynamicLight
Class Razor2AltLight : PaletteLight
{
double lifetime;
Default
{
DynamicLight.Type "Point";
Args 255,240,224,90;
}
override void PostBeginPlay()
{
Super.PostBeginPlay();
lifetime = 1.0;
}
override void Tick()
{
Super.Tick();
if ( isFrozen() ) return;
args[LIGHT_RED] = int(255*lifetime);
args[LIGHT_GREEN] = int(240*lifetime);
args[LIGHT_BLUE] = int(224*lifetime);
lifetime -= 0.05;
if ( lifetime <= 0 ) Destroy();
Args 0,0,0,90;
ReactionTime 20;
}
}

View file

@ -696,116 +696,89 @@ Class SuperShockBallLight : ShockBallLight
{
Default
{
DynamicLight.Type "Point";
Args 255,160,128,120;
}
}
Class ShockBeamLight : ShockExplLight
Class ShockBeamLight : PaletteLight
{
Default
{
+DYNAMICLIGHT.ATTENUATE;
Tag "ExplShock";
ReactionTime 15;
Args 0,0,0,80;
+DYNAMICLIGHT.ATTENUATE;
}
}
Class SuperShockBeamLight : SuperShockExplLight
Class SuperShockBeamLight : PaletteLight
{
Default
{
+DYNAMICLIGHT.ATTENUATE;
Tag "ExplSShock";
ReactionTime 15;
Args 0,0,0,100;
+DYNAMICLIGHT.ATTENUATE;
}
}
Class ShockBeamHitLight : ShockExplLight
Class ShockBeamHitLight : PaletteLight
{
Default
{
Tag "ExplShock";
ReactionTime 24;
Args 0,0,0,120;
}
}
Class SuperShockBeamHitLight : SuperShockExplLight
Class SuperShockBeamHitLight : PaletteLight
{
Default
{
Tag "ExplSShock";
ReactionTime 24;
Args 0,0,0,150;
}
}
Class ShockBlastLight : ShockExplLight
Class ShockBlastLight : PaletteLight
{
Default
{
ReactionTime 50;
Tag "ExplShock";
ReactionTime 60;
Args 0,0,0,300;
}
}
Class SuperShockBlastLight : SuperShockExplLight
Class SuperShockBlastLight : PaletteLight
{
Default
{
ReactionTime 50;
Tag "ExplSShock";
ReactionTime 60;
Args 0,0,0,400;
}
}
Class ShockExplLight : DynamicLight
Class ShockExplLight : PaletteLight
{
double lifetime;
Default
{
DynamicLight.Type "Point";
Tag "ExplShock";
ReactionTime 30;
Args 160,128,255,150;
}
override void PostBeginPlay()
{
Super.PostBeginPlay();
lifetime = 1.0;
}
override void Tick()
{
Super.Tick();
if ( isFrozen() ) return;
args[LIGHT_RED] = int(160*lifetime);
args[LIGHT_GREEN] = int(128*lifetime);
args[LIGHT_BLUE] = int(255*lifetime);
lifetime -= 1./ReactionTime;
if ( lifetime <= 0 ) Destroy();
Args 0,0,0,150;
}
}
Class SuperShockExplLight : DynamicLight
Class SuperShockExplLight : PaletteLight
{
double lifetime;
Default
{
DynamicLight.Type "Point";
Tag "ExplSShock";
ReactionTime 30;
Args 255,160,128,200;
}
override void PostBeginPlay()
{
Super.PostBeginPlay();
lifetime = 1.0;
}
override void Tick()
{
Super.Tick();
if ( isFrozen() ) return;
args[LIGHT_RED] = int(255*lifetime);
args[LIGHT_GREEN] = int(160*lifetime);
args[LIGHT_BLUE] = int(128*lifetime);
lifetime -= 1./ReactionTime;
if ( lifetime <= 0 ) Destroy();
Args 0,0,0,200;
}
}
@ -823,16 +796,16 @@ Class ShockHitbox : Actor
override void Tick()
{
Super.Tick();
if ( !target || target.InStateSequence(target.CurState,target.ResolveState("Death")) )
if ( !target || !target.InStateSequence(target.CurState,target.FindState("Spawn")) )
{
Destroy();
return;
}
SetOrigin(target.pos-(0,0,height*0.5),true);
SetOrigin(target.Vec3Offset(0,0,-height*0.5),true);
}
override bool CanCollideWith( Actor other, bool passive )
{
return ((other is 'ShockBeam') || (other is 'SuperShockBeam'));
return false;
}
}

View file

@ -1321,7 +1321,7 @@ Class UTWeapon : Weapon
Owner.player.WeaponState |= WF_WEAPONBOBBING; // UT weapons always bob
}
void FireEffect()
virtual void FireEffect()
{
let amp = DamageAmplifier(Owner.FindInventory("DamageAmplifier",true));
if ( amp ) amp.FireEffect();
@ -2021,6 +2021,47 @@ Class ShredCorpseHitbox : Actor
}
}
// imitates UE1 light type LT_TexturePaletteOnce
Class PaletteLight : DynamicLight
{
Color pal[256];
Default
{
Tag "Explosion";
DynamicLight.Type "Point";
Args 0,0,0,80;
ReactionTime 15;
}
private void UpdateLight()
{
int index = 255-((255*ReactionTime)/default.ReactionTime);
args[LIGHT_RED] = pal[index].r;
args[LIGHT_GREEN] = pal[index].g;
args[LIGHT_BLUE] = pal[index].b;
}
override void PostBeginPlay()
{
Super.PostBeginPlay();
int lump = Wads.CheckNumForFullname(String.Format("palettes/%s.pal",GetTag()));
String paldat = Wads.ReadLump(lump);
for ( int i=0; i<256; i++ )
{
pal[i].r = paldat.ByteAt(i*3);
pal[i].g = paldat.ByteAt(i*3+1);
pal[i].b = paldat.ByteAt(i*3+2);
}
UpdateLight();
}
override void Tick()
{
Super.Tick();
if ( isFrozen() ) return;
A_CountDown();
UpdateLight();
}
}
Enum ESwingMode
{
SWING_Straight, // constant increment
@ -2343,6 +2384,7 @@ Class UTMainHandler : EventHandler
// prettify Kinsie's test map for a more Unreal feel
if ( level.GetChecksum() ~== "959A613006CC3AA912C4A22908B7566A" )
{
S_ChangeMusic("Course");
TextureID deftex = TexMan.CheckForTexture("-noflat-",TexMan.Type_Any);
TextureID skytx = TexMan.CheckForTexture("KGDaySky",TexMan.Type_Any);
TextureID baseflor = TexMan.CheckForTexture("rClfFlr0",TexMan.Type_Any);
@ -2353,9 +2395,9 @@ Class UTMainHandler : EventHandler
level.ChangeSky(skytx,skytx);
for ( int i=0; i<level.sectors.size(); i++ )
{
level.sectors[i].lightlevel = min(level.sectors[i].lightlevel,64);
level.sectors[i].SetPlaneLight(0,0);
level.sectors[i].SetPlaneLight(1,0);
level.sectors[i].lightlevel = min(level.sectors[i].lightlevel,96);
if ( level.sectors[i].GetPlaneLight(0) ) level.sectors[i].SetPlaneLight(0,96);
if ( level.sectors[i].GetPlaneLight(1) ) level.sectors[i].SetPlaneLight(1,96);
// open some ceilings
if ( level.sectors[i].ceilingplane.ZAtPoint(level.sectors[i].centerspot) == 1280 )
level.sectors[i].SetTexture(1,skyflatnum);
@ -2375,6 +2417,7 @@ Class UTMainHandler : EventHandler
for ( int i=0; i<level.sides.size(); i++ )
{
level.sides[i].light = 0;
level.sides[i].flags &= ~Side.WALLF_ABSLIGHTING;
for ( int j=0; j<3; j++ )
{
if ( level.sides[i].GetTexture(j) != deftex ) continue;
@ -2440,6 +2483,7 @@ Class UTMainHandler : EventHandler
}
else if ( level.GetChecksum() ~== "0EADB2F82732A968B8513E4DC6138439" )
{
S_ChangeMusic("Course");
TextureID deftex = TexMan.CheckForTexture("-noflat-",TexMan.Type_Any);
TextureID skytx = TexMan.CheckForTexture("KGDaySky",TexMan.Type_Any);
TextureID baseflor = TexMan.CheckForTexture("rClfFlr0",TexMan.Type_Any);
@ -2450,9 +2494,9 @@ Class UTMainHandler : EventHandler
level.ChangeSky(skytx,skytx);
for ( int i=0; i<level.sectors.size(); i++ )
{
level.sectors[i].lightlevel = 0;
level.sectors[i].SetPlaneLight(0,0);
level.sectors[i].SetPlaneLight(1,0);
level.sectors[i].lightlevel = min(level.sectors[i].lightlevel,96);
if ( level.sectors[i].GetPlaneLight(0) ) level.sectors[i].SetPlaneLight(0,96);
if ( level.sectors[i].GetPlaneLight(1) ) level.sectors[i].SetPlaneLight(1,96);
// open some ceilings
if ( level.sectors[i].ceilingplane.ZAtPoint(level.sectors[i].centerspot) == 1280 )
level.sectors[i].SetTexture(1,skyflatnum);
@ -2472,6 +2516,7 @@ Class UTMainHandler : EventHandler
for ( int i=0; i<level.sides.size(); i++ )
{
level.sides[i].light = 0;
level.sides[i].flags &= ~Side.WALLF_ABSLIGHTING;
for ( int j=0; j<3; j++ )
{
if ( level.sides[i].GetTexture(j) != deftex ) continue;

View file

@ -23,7 +23,7 @@ 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, IconSaw2, UseSaw2, ItemBox, ItemSel, ItemFlash, ItemArrow[2], LastItem;
TextureID AmmoBar, Boxes[4], Keys[5], BigNum[12], Flash, Slots[10], Icons[14], Uses[14], Man[5], Woman[5], Boss[5], WeaponBox, IconTloc2, UseTloc2, IconSaw2, UseSaw2, ItemBox, ItemSel, ItemFlash, ItemArrow[2], LastItem, FacePanel[3];
Class<Weapon> IconClasses[14];
double HScale;
Color tintcolor, bgcolor;
@ -35,7 +35,19 @@ Class UTHud : BaseStatusBar
bool showweapons, showfrags, showammo, showstatus, showinfo;
double hudsize, weaponsize, statussize;
HUDFont mUTFont12;
HUDFont mUTFont12, mUTFont40;
String PickupMsg;
int PickupMsgTic;
String ShortMsg[4];
int ShortMsgTic[4];
int ShortMsgCol[4];
int LastMsgTic;
TextureID LastTalkFace; // guessed from voice type
int LastTalkTic, faceout;
String MidPrintStr;
int MidPrintTic;
double MidPrintScale;
// For easier UT Canvas drawing
Color DrawColor, WhiteColor, GoldColor;
@ -45,11 +57,12 @@ Class UTHud : BaseStatusBar
override void Init()
{
Super.Init();
SetSize(0,320,200);
SetSize(0,640,480); // this exists here merely to scale the automap text
lastfrag = int.min;
lastfragcnt = 0;
vtracer = new("ViewTracer");
mUTFont12 = HUDFont.Create("UTFONT12");
mUTFont40 = HUDFont.Create("UTFONT40");
// Set defaults
DrawColor = WhiteColor = "White";
GoldColor = "Gold";
@ -154,6 +167,9 @@ Class UTHud : BaseStatusBar
UseTloc2 = TexMan.CheckForTexture("UseTrn2",TexMan.Type_Any);
IconSaw2 = TexMan.CheckForTexture("IconSaw2",TexMan.Type_Any);
UseSaw2 = TexMan.CheckForTexture("UseSaw2",TexMan.Type_Any);
FacePanel[0] = TexMan.CheckForTexture("FacePnl",TexMan.Type_Any);
FacePanel[1] = TexMan.CheckForTexture("FacePnlA",TexMan.Type_Any);
FacePanel[2] = TexMan.CheckForTexture("Static1",TexMan.Type_Any);
}
override void Draw( int state, double TicFrac )
@ -207,25 +223,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"), bool flip = false )
private void UTDrawTintedTex( TextureID tx, double sx = 1.0, int opacity = -1, Color tint = Color("Black"), bool flip = false, bool animated = 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,DTA_TopOffset,0,DTA_LeftOffset,0);
if ( opacity >= 16 ) Screen.DrawTexture(tx,animated,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,DTA_TopOffset,0,DTA_LeftOffset,0,DTA_FlipX,flip);
Screen.DrawTexture(tx,animated,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, bool flip = false )
private void UTDrawPlainTex( TextureID tx, double sx = 1.0, int opacity = -1, bool flip = false, bool animated = 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,DTA_TopOffset,0,DTA_LeftOffset,0,DTA_FlipX,flip);
if ( opacity >= 16 ) Screen.DrawTexture(tx,animated,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,DTA_TopOffset,0,DTA_LeftOffset,0,DTA_FlipX,flip);
Screen.DrawTexture(tx,animated,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 )
@ -637,14 +653,16 @@ Class UTHud : BaseStatusBar
cl1 = String.Format("Dark%s",cl2);
}
String tname = String.Format("\c[%s]%s:\c[%s] %s",cl1,StringTable.Localize("$M_NAME"),cl2,lastseen.player.GetUserName());
CurX = (640-mUTFont12.mFont.StringWidth(tname))*0.5;
double scl = HScale/5.;
CurX = (640-mUTFont40.mFont.StringWidth(tname)*scl)*0.5;
CurY = 480*0.75;
Screen.DrawText(mUTFont12.mFont,Font.CR_UNTRANSLATED,CurX,CurY,tname,DTA_VirtualWidth,640,DTA_VirtualHeight,480,DTA_Alpha,lalpha/2.);
Screen.DrawText(mUTFont40.mFont,Font.CR_UNTRANSLATED,CurX/scl,CurY/scl,tname,DTA_VirtualWidthF,640/scl,DTA_VirtualHeightF,480/scl,DTA_Alpha,lalpha/2.,DTA_LegacyRenderStyle,STYLE_Add);
if ( !deathmatch || (lastseen.IsTeammate(CPlayer.mo)) )
{
CurY += 1.2*mUTFont12.mFont.GetHeight();
tname = String.Format("\c[%s]%s:\c[%s] %d",cl1,StringTable.Localize("$M_HEALTH"),cl2,lastseen.Health);
Screen.DrawText(mUTFont12.mFont,Font.CR_UNTRANSLATED,CurX,CurY,tname,DTA_VirtualWidth,640,DTA_VirtualHeight,480,DTA_Alpha,lalpha/2.);
CurY += mUTFont40.mFont.GetHeight()*scl;
CurX = (640-mUTFont40.mFont.StringWidth(tname)*scl)*0.5;
Screen.DrawText(mUTFont40.mFont,Font.CR_UNTRANSLATED,CurX/scl,CurY/scl,tname,DTA_VirtualWidthF,640/scl,DTA_VirtualHeightF,480/scl,DTA_Alpha,lalpha/2.,DTA_LegacyRenderStyle,STYLE_Add);
}
}
@ -792,6 +810,224 @@ Class UTHud : BaseStatusBar
}
}
private bool IsAutoTaunt( String str )
{
// checks if this critical message is pretending to be a chat msg
if ( str.IndexOf("\c*") == 0 ) return true;
return false;
}
private void SetChatFace( String str, bool isauto = false )
{
Array<String> splitme;
str.Split(splitme,":");
if ( splitme.Size() < 2 ) return;
String pname = splitme[0];
// autotaunts have a leading chat color escape
if ( isauto && (pname.IndexOf("\c*") == 0) ) pname.Remove(0,2);
if ( pname.RightIndexOf("\c*") == pname.Length()-2 ) pname.Remove(pname.Length()-2,2);
// guess the player
int p = -1;
for ( int i=0; i<MAXPLAYERS; i++ )
{
if ( !playeringame[i] ) continue;
if ( players[i].GetUserName() != pname ) continue;
p = i;
break;
}
if ( (p == -1) || !(players[p].mo is 'UTPlayer') ) return;
switch ( UTPlayer(players[p].mo).VoiceType )
{
case UTPlayer.VOICE_FemaleOne:
LastTalkFace = TexMan.CheckForTexture("Ivana",TexMan.Type_Any);
break;
case UTPlayer.VOICE_FemaleTwo:
LastTalkFace = TexMan.CheckForTexture("Lauren",TexMan.Type_Any);
break;
case UTPlayer.VOICE_MaleOne:
LastTalkFace = TexMan.CheckForTexture("Blake",TexMan.Type_Any);
break;
case UTPlayer.VOICE_MaleTwo:
LastTalkFace = TexMan.CheckForTexture("Brock",TexMan.Type_Any);
break;
case UTPlayer.VOICE_Boss:
LastTalkFace = TexMan.CheckForTexture("Xan",TexMan.Type_Any);
break;
}
LastTalkTic = gametic+90;
}
override bool ProcessNotify( EPrintLevel printlevel, String outline )
{
if ( gamestate != GS_LEVEL ) return false; // not during intermissions
if ( printlevel == PRINT_LOW ) // pickups
{
PickupMsg = outline;
PickupMsgTic = gametic+50;
return true;
}
else if ( printlevel == PRINT_MEDIUM ) // obituaries
{
AppendMessage(outline,Font.CR_RED);
return true;
}
else if ( (printlevel == PRINT_CHAT) || (printlevel == PRINT_TEAMCHAT) ) // chat
{
AppendMessage(outline,Font.CR_GREEN);
SetChatFace(outline);
return true;
}
else if ( IsAutoTaunt(outline) ) // autotaunts
{
AppendMessage(outline,Font.CR_GREEN);
SetChatFace(outline,true);
return true;
}
else // other messages
{
AppendMessage(outline,Font.CR_WHITE);
return true;
}
return false;
}
override bool ProcessMidPrint( Font fnt, String msg, bool bold )
{
if ( !fnt || (fnt == SmallFont) || (fnt == OriginalSmallFont) || (fnt == NewSmallFont) )
{
MidPrintStr = msg;
MidPrintScale = 2.5;
MidPrintTic = gametic+70;
return true;
}
else if ( fnt == BigFont )
{
MidPrintStr = msg;
MidPrintScale = 1.2;
MidPrintTic = gametic+70;
return true;
}
return false;
}
private void AppendMessage( String msg, int col )
{
BrokenLines lines = mUTFont40.mFont.BreakLines(msg,2450);
for ( int i=0; i<lines.Count(); i++ )
{
// push back old lines
for ( int j=3; j>0; j-- )
{
ShortMsg[j] = ShortMsg[j-1];
ShortMsgTic[j] = ShortMsgTic[j-1];
ShortMsgCol[j] = ShortMsgCol[j-1];
}
// jam it in
ShortMsg[0] = lines.StringAt(i);
LastMsgTic = ShortMsgTic[0] = gametic+170;
ShortMsgCol[0] = col;
}
}
override void FlushNotify()
{
for ( int i=0; i<4; i++ )
{
ShortMsg[i] = "";
ShortMsgTic[i] = int.min;
ShortMsgCol[i] = Font.CR_UNTRANSLATED;
}
LastTalkTic = LastMsgTic = PickupMsgTic = int.min;
LastTalkFace.SetNull();
PickupMsg = "";
PickupMsgTic = int.min;
MidPrintStr = "";
MidPrintTic = int.min;
}
override bool DrawChat( String txt )
{
if ( gamestate != GS_LEVEL ) return false; // not during intermissions
CurX = 0;
CurY = 68*HScale;
if ( LastTalkTic > gametic ) CurX += (68+faceout)*HScale;
int areatime = max(LastTalkTic,LastMsgTic)+30;
if ( areatime > gametic ) UTDrawTintedTex(FacePanel[1],opacity:clamp(int((areatime-gametic+fractic)*0.75),0,15));
CurX += 6*HScale;
CurY += HScale;
double scl = HScale/3.;
String fullstr = String.Format("(> Say %s%s",txt,mUTFont40.mFont.GetCursor());
// cut out until it fits
while ( (mUTFont40.mFont.StringWidth(fullstr) > 2450) && (fullstr.Length() > 7) )
fullstr.Remove(7,1);
Screen.DrawText(mUTFont40.mFont,Font.CR_GREEN,CurX/scl,CurY/scl,fullstr,DTA_VirtualWidthF,Screen.GetWidth()/scl,DTA_VirtualHeightF,Screen.GetHeight()/scl,DTA_KeepRatio,true);
return true;
}
private void DrawTalkFace()
{
// this doesn't even get close to how it's supposed to look but whatever
double ss = (HScale*0.265625);
double dw = (Screen.GetWidth()/ss), dh = (Screen.GetHeight()/ss);
double dx = CurX/ss, dy = CurY/ss;
Screen.DrawTexture(FacePanel[2],false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,Color("Black"));
Screen.DrawTexture(FacePanel[2],true,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_LegacyRenderStyle,STYLE_AddShaded,DTA_FillColor,tintcolor);
ss = HScale;
dw = (Screen.GetWidth()/ss);
dh = (Screen.GetHeight()/ss);
dx = (CurX+2*HScale)/ss;
dy = (CurY+2*HScale)/ss;
Screen.DrawTexture(LastTalkFace,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,0.8);
Screen.DrawTexture(LastTalkFace,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_LegacyRenderStyle,STYLE_Add);
}
private void DrawMessages()
{
// midprint
if ( (MidPrintStr.Length() > 0) && (MidPrintTic > gametic) )
{
double scl = HScale/MidPrintScale;
CurX = (Screen.GetWidth()-mUTFont40.mFont.StringWidth(MidPrintStr)*scl)/2;
CurY = 256*HScale;
Screen.DrawText(mUTFont40.mFont,Font.FindFontColor('UTHudText'),CurX/scl,CurY/scl,MidPrintStr,DTA_VirtualWidthF,Screen.GetWidth()/scl,DTA_VirtualHeightF,Screen.GetHeight()/scl,DTA_KeepRatio,true,DTA_Alpha,clamp((MidPrintTic-gametic+fractic)*0.1,0,1),DTA_LegacyRenderStyle,STYLE_Add);
}
// pickup message
if ( PickupMsgTic > gametic )
{
double scl = HScale/2.2;
CurX = (Screen.GetWidth()-mUTFont40.mFont.StringWidth(PickupMsg)*scl)/2;
CurY = Screen.GetHeight()-112*HScale;
Screen.DrawText(mUTFont40.mFont,Font.CR_WHITE,CurX/scl,CurY/scl,PickupMsg,DTA_VirtualWidthF,Screen.GetWidth()/scl,DTA_VirtualHeightF,Screen.GetHeight()/scl,DTA_KeepRatio,true,DTA_Alpha,clamp((PickupMsgTic-gametic+fractic)*0.1,0,1),DTA_LegacyRenderStyle,STYLE_Add);
}
// talk face
CurX = 0;
CurY = 0;
if ( LastTalkTic > gametic )
{
if ( (LastTalkTic-gametic) < 30 ) faceout = max(-68,faceout-8);
else faceout = 0;
CurX = faceout*HScale;
DrawTalkFace();
CurX += 68*HScale;
}
// message frame
int areatime = max(LastTalkTic,LastMsgTic)+30;
if ( areatime > gametic )
UTDrawTintedTex(FacePanel[0],opacity:clamp(int((areatime-gametic+fractic)*0.75),0,15));
// messages themselves
if ( LastMsgTic < gametic ) return;
CurX = 8*HScale;
if ( LastTalkTic > gametic ) CurX += (68+faceout)*HScale;
CurY = HScale;
double scl = HScale/3.;
for ( int i=3; i>=0; i-- )
{
if ( ShortMsgTic[i] < gametic ) continue;
Screen.DrawText(mUTFont40.mFont,ShortMsgCol[i],CurX/scl,CurY/scl,ShortMsg[i],DTA_VirtualWidthF,Screen.GetWidth()/scl,DTA_VirtualHeightF,Screen.GetHeight()/scl,DTA_KeepRatio,true);
CurY += 16*HScale;
}
}
override void Tick()
{
Super.Tick();
@ -833,6 +1069,8 @@ Class UTHud : BaseStatusBar
DrawInventory(lbottom);
// Display Identification Info
if ( CPlayer == players[consoleplayer] && showinfo ) DrawIdentifyInfo();
// Display messages
DrawMessages();
}
override void DrawAutomapHUD( double ticFrac )

View file

@ -26,6 +26,7 @@ Class OptionMenuItemUTHudPreview : OptionMenuItem
{
int xpos = indent + CursorSpace();
int ypos = y+OptionMenuSettings.mLinespacing*CleanYfac_1;
Screen.DrawFrame(xpos,ypos,64*CleanXFac_1,64*CleanYFac_1);
Screen.DrawTexture(tex[0],false,xpos,ypos,DTA_CleanNoMove_1,true);
Color tintcolor = Color("White");
switch ( mColorP.GetInt() )
@ -48,4 +49,38 @@ Class OptionMenuItemUTHudPreview : OptionMenuItem
Screen.DrawTexture(tex[1],false,xpos,ypos,DTA_CleanNoMove_1,true,DTA_FillColor,tintcolor,DTA_Alpha,alpha,DTA_LegacyRenderStyle,STYLE_AddShaded);
return -1;
}
}
}
// changes to Tahoma
Class UTMessageBox : MessageBoxMenu
{
override void Init( Menu parent, String message, int messagemode, bool playsound, Name cmd, voidptr native_handler )
{
Super.Init(parent,message,messagemode,playsound,cmd,native_handler);
Font NFont = Font.GetFont('Tahoma10');
if ( !generic_ui )
{
if ( NFont && NFont.CanPrint(message) && NFont.CanPrint("$TXT_YES") && NFont.CanPrint("$TXT_NO") ) textFont = NFont;
else if ( OriginalSmallFont && OriginalSmallFont.CanPrint(message) && OriginalSmallFont.CanPrint("$TXT_YES") && OriginalSmallFont.CanPrint("$TXT_NO") ) textFont = OriginalSmallFont;
}
if ( !textFont )
{
arrowFont = textFont = NewSmallFont;
int factor = (CleanXfac+1)/2;
destWidth = screen.GetWidth()/factor;
destHeight = screen.GetHeight()/factor;
selector = "▶";
}
else
{
arrowFont = ConFont;
destWidth = CleanWidth;
destHeight = CleanHeight;
selector = "\xd";
}
int mr1 = destWidth/2+10+textFont.StringWidth(Stringtable.Localize("$TXT_YES"));
int mr2 = destWidth/2+10+textFont.StringWidth(Stringtable.Localize("$TXT_NO"));
mMouseRight = MAX(mr1,mr2);
mMessage = textFont.BreakLines(Stringtable.Localize(message),generic_ui?600:300);
}
}

View file

@ -150,29 +150,12 @@ Class WarheadHitbox : Actor
}
}
Class WarheadExplodLight : DynamicLight
Class WarheadExplodLight : PaletteLight
{
double lifetime;
Default
{
DynamicLight.Type "Point";
ReactionTime 50;
Args 255,192,128,300;
}
override void PostBeginPlay()
{
Super.PostBeginPlay();
lifetime = 1.0;
}
override void Tick()
{
Super.Tick();
if ( isFrozen() ) return;
args[LIGHT_RED] = int(255*lifetime);
args[LIGHT_GREEN] = int(192*lifetime);
args[LIGHT_BLUE] = int(128*lifetime);
lifetime -= 1./ReactionTime;
if ( lifetime <= 0 ) Destroy();
Args 0,0,0,300;
}
}