Adapt to new CL changes.

This commit is contained in:
Marisa the Magician 2023-12-13 20:43:46 +01:00
parent 063bc2c8c7
commit 05d13d9f0e
48 changed files with 447 additions and 333 deletions

View File

@ -81,3 +81,15 @@ Material Texture "graphics/M_SAYA.png"
Texture "Layer5" "graphics/M_SAYA_Layer5.png"
Define "NO_BILINEAR"
}
Material Texture "graphics/HUD/HealthBarInvul.png"
{
Shader "shaders/glsl/Fuzz.fp"
Texture "noisetex" "textures/graynoise.png"
Define "GRAY_COLORS"
Define "BASE_RES" = "vec2(100.,5.)"
}
Material Texture "graphics/HUD/SayaFace_Barrier.png"
{
Shader "shaders/glsl/BarrierFace.fp"
Texture "bartex" "models/barrierbar.png"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 B

BIN
graphics/HUD/AmmoBox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B

BIN
graphics/HUD/FlashBar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

BIN
graphics/HUD/HealthBar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 144 B

BIN
graphics/HUD/LagBar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

BIN
graphics/HUD/ManaBar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 B

BIN
graphics/HUD/SayaFace.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

BIN
graphics/HUD/StatusBox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

BIN
graphics/HUD/WeaponBox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

View File

@ -1,3 +1,3 @@
[default]
SAYA_MODVER="\cgRED-EYED RAMPAGE\c- \cw0.1a r135 \cu(Mon 11 Dec 11:01:56 CET 2023)\c-";
SAYA_SHORTVER="\cw0.1a r135 \cu(2023-12-11 11:01:56)\c-";
SAYA_MODVER="\cgRED-EYED RAMPAGE\c- \cw0.1a r136 \cu(Wed 13 Dec 20:43:46 CET 2023)\c-";
SAYA_SHORTVER="\cw0.1a r136 \cu(2023-12-13 20:43:46)\c-";

View File

@ -2,53 +2,46 @@
Class SayaStatusBar : SWWMStatusBar
{
TextureID StatusTex[3], StatusIcon[6], InvTex, WeaponTex, MeleeTex, AmmoBar[3], GenTex, SpellTex, SpellIcon[3], SpellBar[3];
int AmmoFlash[7]; // flash when new ammo is received
int AmmoOldAmounts[7]; // to detect when to flash
int StatusFlash[3]; // flash when healing or gaining armor
int LastStatus[3]; // to detect when to flash
int StatusCol[3]; // text colors for each status box, simplifies things
Class<SWWMAmmo> AmmoSlots[7]; // ammo type on each slot + mana
int LagMana[10]; // for the delayed bar
TextureID StatusTex, AmmoTex, WeaponTex, HealthTex[5], GenTex[3], ManaTex, LagTex, FaceTex[3];
int AmmoFlash[5]; // flash when new ammo is received
int AmmoOldAmounts[5]; // to detect when to flash
int AmmoMaxFlash[5]; // flash when ammo max amount changes
int AmmoOldMaxAmounts[5]; // to detect when to flash
Class<SWWMAmmo> AmmoSlots[5]; // ammo type on each slot
String AmmoNames[5]; // ammo 4-letter names
int HealthFlash, ManaFlash; // flash when healing or recovering mana
int LastHealth, LastMana; // to detect when to flash
int LagHealth[10], LagMana[10]; // for the delayed bar
SmoothDynamicValueInterpolator StatusInter[3], AmmoInter[8];
SmoothLinearValueInterpolator LagInter;
SmoothDynamicValueInterpolator HealthInter, ManaInter;
SmoothLinearValueInterpolator LagHealthInter, LagManaInter;
override void Flush()
{
FlushStatus();
FlushWeapons();
}
override void Init()
{
Super.Init();
StatusTex[0] = TexMan.CheckForTexture("graphics/HUD/HealthBox.png");
StatusTex[1] = TexMan.CheckForTexture("graphics/HUD/HelmBox.png");
StatusTex[2] = TexMan.CheckForTexture("graphics/HUD/ArmorBox.png");
StatusIcon[0] = TexMan.CheckForTexture("graphics/HUD/HealthFlash.png");
StatusIcon[1] = TexMan.CheckForTexture("graphics/HUD/HelmFlash.png");
StatusIcon[2] = TexMan.CheckForTexture("graphics/HUD/ArmorFlash.png");
StatusIcon[3] = TexMan.CheckForTexture("graphics/HUD/HealthPulse.png");
StatusIcon[4] = TexMan.CheckForTexture("graphics/HUD/HealthEx.png");
StatusIcon[5] = TexMan.CheckForTexture("graphics/HUD/HealthInvul.png");
StatusCol[0] = MCR_RED;
StatusCol[1] = MCR_SILVER;
StatusCol[2] = MCR_FIRE;
InvTex = TexMan.CheckForTexture("graphics/HUD/GrenadeBox.png");
WeaponTex = TexMan.CheckForTexture("graphics/HUD/WeaponBar.png");
MeleeTex = TexMan.CheckForTexture("graphics/HUD/MeleeSlot.png");
AmmoBar[0] = TexMan.CheckForTexture("graphics/HUD/AmmoBar.png");
AmmoBar[1] = TexMan.CheckForTexture("graphics/HUD/AmmoBar_Sel.png");
AmmoBar[2] = TexMan.CheckForTexture("graphics/HUD/AmmoBar_Flash.png");
GenTex = TexMan.CheckForTexture("graphics/HUD/GenericAmmoBox.png");
SpellTex = TexMan.CheckForTexture("graphics/HUD/SpellcardBox.png");
SpellIcon[0] = TexMan.CheckForTexture("graphics/HUD/SpellcardSel1.png");
SpellIcon[1] = TexMan.CheckForTexture("graphics/HUD/SpellcardSel2.png");
SpellIcon[2] = TexMan.CheckForTexture("graphics/HUD/SpellcardSel3.png");
SpellBar[0] = TexMan.CheckForTexture("graphics/HUD/SpellcardBar.png");
SpellBar[1] = TexMan.CheckForTexture("graphics/HUD/SpellcardBarFlash.png");
SpellBar[2] = TexMan.CheckForTexture("graphics/HUD/SpellcardBarLag.png");
StatusTex = TexMan.CheckForTexture("graphics/HUD/StatusBox.png");
AmmoTex = TexMan.CheckForTexture("graphics/HUD/AmmoBox.png");
WeaponTex = TexMan.CheckForTexture("graphics/HUD/WeaponBox.png");
HealthTex[0] = TexMan.CheckForTexture("graphics/HUD/HealthBar.png");
HealthTex[1] = TexMan.CheckForTexture("graphics/HUD/HealthBarEx.png");
HealthTex[2] = TexMan.CheckForTexture("graphics/HUD/HealthBarInvul.png");
HealthTex[3] = TexMan.CheckForTexture("graphics/HUD/HealthBarPulse.png");
HealthTex[4] = TexMan.CheckForTexture("graphics/HUD/FlashBar.png");
ManaTex = TexMan.CheckForTexture("graphics/HUD/ManaBar.png");
GenTex[0] = TexMan.CheckForTexture("graphics/HUD/GenericAmmoBoxL.png");
GenTex[1] = TexMan.CheckForTexture("graphics/HUD/GenericAmmoBoxM.png");
GenTex[2] = TexMan.CheckForTexture("graphics/HUD/GenericAmmoBoxR.png");
LagTex = TexMan.CheckForTexture("graphics/HUD/LagBar.png");
FaceTex[0] = TexMan.CheckForTexture("graphics/HUD/SayaFace.png");
FaceTex[1] = TexMan.CheckForTexture("graphics/HUD/SayaFace_Flash.png");
FaceTex[2] = TexMan.CheckForTexture("graphics/HUD/SayaFace_Barrier.png");
mugw = 32;
mugh = 27;
tclabel = mhudfontcol[MCR_RED];
tcvalue = mhudfontcol[MCR_WHITE];
tcextra = mhudfontcol[MCR_IBUKIHUD];
@ -56,52 +49,33 @@ Class SayaStatusBar : SWWMStatusBar
tcsucks = mhudfontcol[MCR_RED];
tclabel_s = "[MiniRed]";
tcextra_s = "[MiniIbukiHUD]";
bAlwaysAboveInv = true;
LastStatus[0] = CPlayer?CPlayer.health:100;
LastStatus[1] = (CPlayer&&CPlayer.mo)?CPlayer.mo.CountInv("SayaLightArmor"):0;
LastStatus[2] = (CPlayer&&CPlayer.mo)?CPlayer.mo.CountInv("SayaHeavyArmor"):0;
for ( int i=0; i<3; i++ ) StatusInter[i] = SmoothDynamicValueInterpolator.Create(LastStatus[i],.5);
AmmoSlots[0] = "SayaMana";
AmmoSlots[1] = "SayaPistolAmmo";
AmmoSlots[2] = "SayaRifleAmmo";
AmmoSlots[3] = "SayaGaussAmmo";
AmmoSlots[4] = "SayaGLAmmo";
AmmoSlots[5] = "SayaPlasmaAmmo";
AmmoSlots[6] = "SayaKiraMana";
for ( int i=0; i<7; i++ )
LastHealth = CPlayer?CPlayer.health:100;
LastMana = (CPlayer&&CPlayer.mo)?CPlayer.mo.CountInv("SayaMana"):0;
HealthInter = SmoothDynamicValueInterpolator.Create(LastHealth,.5);
ManaInter = SmoothDynamicValueInterpolator.Create(LastMana,.5,10.);
LagHealthInter = SmoothLinearValueInterpolator.Create(LastHealth,2);
LagManaInter = SmoothLinearValueInterpolator.Create(LastMana,20);
for ( int i=0; i<10; i++ )
{
LagHealth[i] = LastHealth;
LagMana[i] = LastMana;
}
AmmoSlots[0] = "SayaRifleAmmo";
AmmoSlots[1] = "SayaGaussAmmo";
AmmoSlots[2] = "SayaGLAmmo";
AmmoSlots[3] = "SayaPlasmaAmmo";
AmmoSlots[4] = "SayaBombAmmo";
AmmoNames[0] = "RIFL";
AmmoNames[1] = "BOLT";
AmmoNames[2] = "GREN";
AmmoNames[3] = "PLAS";
AmmoNames[4] = "BOMB";
for ( int i=0; i<5; i++ )
{
AmmoFlash[i] = 0;
AmmoOldAmounts[i] = int.min;
if ( !CPlayer || !CPlayer.mo )
{
AmmoInter[i] = SmoothDynamicValueInterpolator.Create(0,.5);
if ( i == 0 )
{
LagInter = SmoothLinearValueInterpolator.Create(0,2);
for ( int j=0; j<10; j++ ) LagMana[j] = 0;
}
continue;
}
let a = SWWMAmmo((CPlayer&&CPlayer.mo)?CPlayer.mo.FindInventory(AmmoSlots[i]):null);
int amt = 0;
if ( a )
{
amt = a.Amount;
if ( a.MagAmmoType )
{
let m = MagAmmo(CPlayer.mo.FindInventory(a.MagAmmoType));
if ( m )
{
amt *= m.ClipSize;
amt += m.Amount;
}
}
if ( i == 0 )
{
LagInter = SmoothLinearValueInterpolator.Create(amt,2);
for ( int j=0; j<10; j++ ) LagMana[j] = amt;
}
}
AmmoInter[i] = SmoothDynamicValueInterpolator.Create(amt,.5);
AmmoMaxFlash[i] = 0;
AmmoOldMaxAmounts[i] = int.min;
}
}

View File

@ -3,92 +3,158 @@ extend Class SayaStatusBar
{
private void FlushStatus()
{
StatusInter[0].Reset(CPlayer.Health);
StatusInter[1].Reset(CPlayer.mo.CountInv("SayaLightArmor"));
StatusInter[2].Reset(CPlayer.mo.CountInv("SayaHeavyArmor"));
int hp = CPlayer.Health;
int mana = CPlayer.mo.CountInv("SayaMana");
HealthInter.Reset(hp);
ManaInter.Reset(mana);
for ( int i=9; i>0; i-- )
LagHealth[i] = hp;
for ( int i=9; i>0; i-- )
LagMana[i] = mana;
LagHealthInter.Reset(hp);
LagManaInter.Reset(mana);
}
override void TickStatus()
{
Super.TickStatus();
int cur[3];
cur[0] = CPlayer.Health;
cur[1] = CPlayer.mo.CountInv("SayaLightArmor");
cur[2] = CPlayer.mo.CountInv("SayaHeavyArmor");
for ( int i=0; i<3; i++ )
int hp = CPlayer.Health;
int mana = CPlayer.mo.CountInv("SayaMana");
HealthInter.Update(hp);
ManaInter.Update(mana);
// flash 'em
if ( hp > LastHealth ) HealthFlash = gametic+25;
if ( mana > LastMana ) ManaFlash = gametic+25;
// lag
if ( hp > LastHealth )
{
StatusInter[i].Update(cur[i]);
if ( cur[i] > LastStatus[i] ) StatusFlash[i] = gametic+25;
LastStatus[i] = cur[i];
for ( int i=9; i>0; i-- )
LagHealth[i] = hp;
}
if ( mana > LastMana )
{
for ( int i=9; i>0; i-- )
LagMana[i] = mana;
}
LagHealth[0] = LastHealth = hp;
LagHealthInter.Update(LagHealth[9]);
for ( int i=9; i>0; i-- )
LagHealth[i] = LagHealth[i-1];
LagMana[0] = LastMana = mana;
LagManaInter.Update(LagMana[9]);
for ( int i=9; i>0; i-- )
LagMana[i] = LagMana[i-1];
}
override int GetFaceTex( SWWMPlayer demo )
{
let facestate = demo.facestate;
let paindir = demo.paindir;
let facetimer = demo.facetimer;
let blinktime = demo.blinktime;
if ( CPlayer.Health <= 0 ) return 14;
if ( isInvulnerable() && (facestate >= FS_LOPAIN) ) return 4;
if ( facestate == FS_OUCH ) return (paindir==-1)?12:(paindir==1)?13:11;
if ( facestate == FS_HIPAIN ) return (paindir==-1)?9:(paindir==1)?10:8;
if ( facestate == FS_LOPAIN ) return (paindir==-1)?6:(paindir==1)?7:5;
if ( facestate == FS_GRIN ) return 4;
if ( facestate == FS_SAD ) return 5;
if ( blinktime < 0 ) return 3;
return demo.lookdir;
}
override int DrawMugshot()
{
int xx = xmargin+(36-mugw)/2;
int yy = ymargin+31;
let demo = SWWMPlayer(CPlayer.mo);
if ( !demo ) return 64;
double paintime = clamp((demo.lastdamagetimer-(gametic+Fractic))/double(GameTicRate),0.,1.);
double noiz = min(demo.lastdamage*.5*paintime,3.);
rss = MSTime()*128;
Vector2 shake = (RandomShiver(),RandomShiver())*noiz;
int idx = GetFaceTex(demo);
Screen.DrawTexture(FaceTex[0],false,xx+shake.x,ss.y-yy+shake.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_SrcWidth,mugw,DTA_SrcHeight,mugh,DTA_DestWidth,mugw,DTA_DestHeight,mugh,DTA_SrcX,mugw*(idx%4),DTA_SrcY,mugh*(idx/4));
Screen.DrawTexture(FaceTex[1],false,xx+shake.x,ss.y-yy+shake.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Color,Color(255,255,0,0),DTA_Alpha,min(1.,noiz),DTA_SrcWidth,mugw,DTA_SrcHeight,mugh,DTA_DestWidth,mugw,DTA_DestHeight,mugh,DTA_SrcX,mugw*(idx%4),DTA_SrcY,mugh*(idx/4));
if ( (CPlayer.Health > 0) && isInvulnerable() )
Screen.DrawTexture(FaceTex[1],false,xx+shake.x,ss.y-yy+shake.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,.8+.1*sin(gametic+fractic),DTA_SrcWidth,mugw,DTA_SrcHeight,mugh,DTA_DestWidth,mugw,DTA_DestHeight,mugh,DTA_SrcX,mugw*(idx%4),DTA_SrcY,mugh*(idx/4));
if ( CPlayer.mo.FindInventory("BarrierPower") ) Screen.DrawTexture(FaceTex[2],false,xx+shake.x,ss.y-yy+shake.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,.5,DTA_LegacyRenderStyle,STYLE_Add);
return 63;
}
override int DrawStatus()
{
double xx = xmargin;
double yy = ss.y-(ymargin+10);
int ofs = 26;
for ( int i=1; i<3; i++ )
double xx = xmargin+36;
double yy = ss.y-(ymargin+29);
Screen.DrawTexture(StatusTex,false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
double ht = clamp(HealthInter.GetValue(fractic),0,999);
String str = String.Format("%3d",round(ht));
double hw = min(ht,100);
Screen.DrawTexture(HealthTex[0],false,xx+3,yy+3,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw,DTA_ColorOverlay,0xFF000000);
if ( isInvulnerable() )
{
double st = StatusInter[i].GetValue(fractic);
if ( st > 0 ) yy -= 10;
Screen.DrawTexture(HealthTex[2],false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw);
int dcnt = 2-int(Log10(clamp(round(ht),1,999)));
for ( int j=0; j<dcnt; j++ ) Screen.DrawChar(MiniHUDFont,mhudfontcol[MCR_WHITE],xx+107+j*4,yy+2,0x30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_WHITE],xx+107,yy+2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
for ( int i=2; i>=0; i-- )
else
{
double st = StatusInter[i].GetValue(fractic);
if ( (i > 0) && (st <= 0) ) continue;
Screen.DrawTexture(StatusTex[i],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
int ncolor = StatusCol[i];
if ( (i == 0) && isInvulnerable() )
Screen.DrawTexture(HealthTex[0],false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw);
int dcnt = 2-int(Log10(clamp(round(ht),1,999)));
for ( int j=0; j<dcnt; j++ ) Screen.DrawChar(MiniHUDFont,mhudfontcol[MCR_RED],xx+107+j*4,yy+2,0x30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_RED],xx+107,yy+2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( ht > 100 )
{
ncolor = MCR_WHITE;
Screen.DrawTexture(StatusIcon[5],false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
double alph = max((ht-100)/900.,0.)**.5;
Screen.DrawTexture(HealthTex[1],false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_BLUE],xx+107,yy+2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
}
int dcnt = 2-int(Log10(clamp(round(st),1,999)));
for ( int j=0; j<dcnt; j++ ) Screen.DrawChar(MiniHUDFont,mhudfontcol[ncolor],xx+12+j*4,yy+2,0x30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
Screen.DrawText(MiniHUDFont,mhudfontcol[ncolor],xx+12,yy+2,String.Format("%3d",clamp(round(st),0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( (i == 0) && (ncolor != MCR_WHITE) )
if ( (CPlayer.health > 0) && (CPlayer.health <= 25) && (PulsePhase <= 15) )
{
if ( st > 100 )
{
double alph = max((st-100)/900.,0.)**.5;
Screen.DrawTexture(StatusIcon[4],false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_BLUE],xx+12,yy+2,String.Format("%3d",clamp(round(st),0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
}
if ( (CPlayer.Health > 0) && (CPlayer.Health <= 25) && (PulsePhase <= 15) )
{
double alph = clamp(sin((PulsePhase-FracTic)*12.),0.,1.);
Screen.DrawTexture(StatusIcon[3],false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_REDFLASH],xx+12,yy+2,String.Format("%3d",clamp(round(st),0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
}
double alph = clamp(sin((PulsePhase-FracTic)*12.),0.,1.);
Screen.DrawTexture(HealthTex[3],false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw,DTA_Alpha,alph);
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_REDFLASH],xx+107,yy+2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
}
int f = StatusFlash[i];
if ( f && (gametic < f) )
{
double alph = max((f-(gametic+FracTic))/25.,0.)**1.5;
Screen.DrawTexture(StatusIcon[i],false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_FLASH],xx+12,yy+2,String.Format("%3d",clamp(round(st),0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
}
yy += 10;
ofs += 10;
}
// grenade display
let gren = CPlayer.mo.FindInventory("SayaBombAmmo");
if ( gren && gren.Amount )
int f = HealthFlash;
if ( f && (gametic < f) )
{
AboveInvOffset = 24;
bool sel = (CPlayer.PendingWeapon is 'SayaBomb')||(CPlayer.ReadyWeapon is 'SayaBomb');
if ( !CPlayer.mo.InvSel || isInventoryBarVisible() )
{
yy = ss.y-(ymargin+ofs-2);
ofs += 20;
}
else yy = ss.y-(ymargin+ofs+26);
Screen.DrawTexture(InvTex,false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawTexture(gren.Icon,false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawText(MiniHUDFontOutline,mhudfontcol[sel?MCR_BRASS:MCR_WHITE],xx+10,yy+12,String.Format("%2d",clamp(gren.Amount,0,99)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
double alph = max((f-(gametic+FracTic))/25.,0.)**1.5;
Screen.DrawTexture(HealthTex[4],false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,hw,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alph);
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_FLASH],xx+107,yy+2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alph);
}
else AboveInvOffset = 0;
return ofs;
ht = clamp(LagHealthInter.GetValue(fractic),0,1000);
double hwl = min(ht,100);
if ( hwl > hw )
{
Screen.DrawTexture(LagTex,false,xx+3,yy+3,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowLeftF,hw,DTA_WindowRightF,hwl,DTA_ColorOverlay,0xFF000000);
Screen.DrawTexture(LagTex,false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowLeftF,hw,DTA_WindowRightF,hwl);
}
yy += 12;
Screen.DrawTexture(StatusTex,false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
double mt = clamp(ManaInter.GetValue(fractic),0,999);
str = String.Format("%3d",round(mt));
double mw = min(mt,100);
Screen.DrawTexture(ManaTex,false,xx+3,yy+3,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,mw,DTA_ColorOverlay,0xFF000000);
Screen.DrawTexture(ManaTex,false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,mw);
int dcnt = 2-int(Log10(clamp(round(mt),1,999)));
for ( int i=0; i<dcnt; i++ ) Screen.DrawChar(MiniHUDFont,mhudfontcol[MCR_MANA],xx+107+i*4,yy+2,0x30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_MANA],xx+107,yy+2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
f = ManaFlash;
if ( f && (gametic < f) )
{
double alph = max((f-(gametic+FracTic))/25.,0.)**1.5;
Screen.DrawTexture(HealthTex[4],false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,mw,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alph);
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_FLASH],xx+107,yy+2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,alph);
}
mt = clamp(LagManaInter.GetValue(fractic),0,999);
double lmw = min(mt,100);
if ( lmw > mw )
{
Screen.DrawTexture(LagTex,false,xx+3,yy+3,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowLeftF,mw,DTA_WindowRightF,lmw,DTA_ColorOverlay,0xFF000000);
Screen.DrawTexture(LagTex,false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowLeftF,mw,DTA_WindowRightF,lmw);
}
return 63;
}
}

View File

@ -11,42 +11,19 @@ extend Class SayaStatusBar
EventHandler.SendNetworkEvent("sayaweaponreceive",slot);
}
private void FlushWeapons()
{
for ( int i=0; i<7; i++ )
{
let a = SWWMAmmo(CPlayer.mo.FindInventory(AmmoSlots[i]));
int amt = 0;
if ( a )
{
amt = a.Amount;
if ( a.MagAmmoType )
{
let m = MagAmmo(CPlayer.mo.FindInventory(a.MagAmmoType));
if ( m )
{
amt *= m.ClipSize;
amt += m.Amount;
}
}
}
AmmoInter[i].Reset(amt);
}
LagInter.Reset(CPlayer.mo.CountInv("SayaMana"));
for ( int i=9; i>0; i-- )
LagMana[i] = CPlayer.mo.CountInv("SayaMana");
}
override void TickWeapons()
{
Super.TickWeapons();
for ( int i=0; i<7; i++ )
// ammo updates
for ( int i=0; i<5; i++ )
{
let a = SWWMAmmo(CPlayer.mo.FindInventory(AmmoSlots[i]));
int amt = 0;
int maxamt = 0;
if ( a )
{
amt = a.Amount;
maxamt = a.MaxAmount;
if ( a.MagAmmoType )
{
let m = MagAmmo(CPlayer.mo.FindInventory(a.MagAmmoType));
@ -54,101 +31,102 @@ extend Class SayaStatusBar
{
amt *= m.ClipSize;
amt += m.Amount;
maxamt *= m.ClipSize;
}
}
}
AmmoInter[i].Update(amt);
if ( (amt > AmmoOldAmounts[i]) && (AmmoOldAmounts[i] != int.min) ) AmmoFlash[i] = gametic+25;
if ( i == 0 )
else
{
if ( amt > AmmoOldAmounts[0] )
let a = GetDefaultByType(AmmoSlots[i]);
maxamt = a.MaxAmount;
if ( a.MagAmmoType )
{
for ( int i=9; i>0; i-- )
LagMana[i] = amt;
let m = GetDefaultByType(a.MagAmmoType);
maxamt *= m.ClipSize;
}
LagMana[0] = amt;
LagInter.Update(LagMana[9]);
for ( int i=9; i>0; i-- )
LagMana[i] = LagMana[i-1];
}
if ( (amt > AmmoOldAmounts[i]) && (AmmoOldAmounts[i] != int.min) ) AmmoFlash[i] = gametic+25;
AmmoOldAmounts[i] = amt;
if ( (maxamt > AmmoOldMaxAmounts[i]) && (AmmoOldMaxAmounts[i] != int.min) ) AmmoMaxFlash[i] = gametic+25;
AmmoOldMaxAmounts[i] = maxamt;
}
}
override void DrawWeapons()
{
bool smol = (min(ss.x,ss.y/.5625)<640);
double xx = ss.x/2-(smol?200:208);
double yy = ss.y-(ymargin+10);
// special: slot 1 is always there even if you don't "own" the weapon (because it's auto-given if you don't)
if ( CPlayer.ReadyWeapon is 'SWWMWeapon' ) SWWMWeapon(CPlayer.ReadyWeapon).DrawWeapon(FracTic,ss.x-(xmargin+56),ss.y-(ymargin+12),hs,ss);
else if ( CPlayer.ReadyWeapon )
{
Screen.DrawTexture(MeleeTex,false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
bool selected = false;
bool dummy;
int tslot;
if ( CPlayer.PendingWeapon && (CPlayer.PendingWeapon != WP_NOCHANGE) )
// generic display
double xx = ss.x-(xmargin+58), yy = ss.y-(ymargin+22);
String str;
int dlen, dcnt;
if ( CPlayer.ReadyWeapon.Ammo2 && (CPlayer.ReadyWeapon.Ammo2 != CPlayer.ReadyWeapon.Ammo1) )
{
[dummy, tslot] = CPlayer.weapons.LocateWeapon(CPlayer.PendingWeapon.GetClass());
if ( tslot == 1 ) selected = true;
dlen = 1+int(Log10(max(1,CPlayer.ReadyWeapon.Ammo2.MaxAmount)));
str = String.Format("%*d",dlen,CPlayer.ReadyWeapon.Ammo2.Amount);
yy -= 10;
Screen.DrawTexture(GenTex[2],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
for ( int i=0; i<dlen; i++ )
{
xx -= 4;
Screen.DrawTexture(GenTex[1],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
Screen.DrawTexture(GenTex[0],false,xx-2,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
dcnt = (dlen-1)-int(Log10(max(1,CPlayer.ReadyWeapon.Ammo2.Amount)));
for ( int i=0; i<dcnt; i++ ) Screen.DrawChar(MiniHUDFont,mhudfontcol[(CPlayer.ReadyWeapon.Ammo2.Amount<=0)?MCR_RED:MCR_BRASS],xx+i*4,yy+2,0x30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
Screen.DrawText(MiniHUDFont,mhudfontcol[(CPlayer.ReadyWeapon.Ammo2.Amount<=0)?MCR_RED:MCR_BRASS],xx,yy+2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
yy += 10;
}
else if ( (!CPlayer.PendingWeapon || (CPlayer.PendingWeapon == WP_NOCHANGE)) && CPlayer.ReadyWeapon )
xx = ss.x-(xmargin+58);
if ( CPlayer.ReadyWeapon.Ammo1 )
{
[dummy, tslot] = CPlayer.weapons.LocateWeapon(CPlayer.ReadyWeapon.GetClass());
if ( tslot == 1 ) selected = true;
dlen = 1+int(Log10(max(1,CPlayer.ReadyWeapon.Ammo1.MaxAmount)));
str = String.Format("%*d",dlen,CPlayer.ReadyWeapon.Ammo1.Amount);
Screen.DrawTexture(GenTex[2],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
for ( int i=0; i<dlen; i++ )
{
xx -= 4;
Screen.DrawTexture(GenTex[1],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
Screen.DrawTexture(GenTex[0],false,xx-2,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
dcnt = (dlen-1)-int(Log10(max(1,CPlayer.ReadyWeapon.Ammo1.Amount)));
for ( int i=0; i<dcnt; i++ ) Screen.DrawChar(MiniHUDFont,mhudfontcol[(CPlayer.ReadyWeapon.Ammo1.Amount<=0)?MCR_RED:MCR_BRASS],xx+i*4,yy+2,0x30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
Screen.DrawText(MiniHUDFont,mhudfontcol[(CPlayer.ReadyWeapon.Ammo1.Amount<=0)?MCR_RED:MCR_BRASS],xx,yy+2,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
Screen.DrawText(MiniHUDFont,mhudfontcol[selected?MCR_BRASS:MCR_WHITE],xx+2,yy+2,"1",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
int f = hnd.WeaponFlash[1];
if ( f && (gametic < f) )
{
double alph = max((f-(gametic+FracTic))/25.,0.)**1.5;
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_FLASH],xx+2,yy+2,"1",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
}
xx += smol?10:12;
}
for ( int i=1; i<7; i++, xx+=(smol?66:68) )
Screen.DrawTexture(WeaponTex,false,ss.x-(xmargin+84),ss.y-(ymargin+10),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
double xx = ss.x-(xmargin+82), yy = ss.y-(ymargin+8);
for ( int i=1; i<=7; i++,xx+=8 )
{
int slot = (i+1)%10;
bool inslot = CPlayer.HasWeaponsInSlot(slot);
Screen.DrawTexture(WeaponTex,false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( !inslot && ((AmmoInter[i].GetValue() <= 0) || (i==1) || (i==6)) )
if ( (i>1) && !CPlayer.HasWeaponsInSlot(i%10) )
{
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_WHITE],xx+2,yy+2,String.Format("%d",slot),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_WHITE],xx+50,yy+2,"000",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_WHITE],xx,yy,String.Format("%d",(i%10)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
continue;
}
int ncolor = mhudfontcol[MCR_WHITE];
int acolor = ncolor;
bool selected = false, hasammo = false;
bool selected = false;
bool dummy;
int tslot;
Weapon w = null;
int slot;
if ( CPlayer.PendingWeapon && (CPlayer.PendingWeapon != WP_NOCHANGE) )
{
[dummy, tslot] = CPlayer.weapons.LocateWeapon(CPlayer.PendingWeapon.GetClass());
if ( tslot == slot )
{
w = CPlayer.PendingWeapon;
selected = true;
}
[dummy, slot] = CPlayer.weapons.LocateWeapon(CPlayer.PendingWeapon.GetClass());
if ( slot == (i%10) ) selected = true;
}
else if ( (!CPlayer.PendingWeapon || (CPlayer.PendingWeapon == WP_NOCHANGE)) && CPlayer.ReadyWeapon )
{
[dummy, tslot] = CPlayer.weapons.LocateWeapon(CPlayer.ReadyWeapon.GetClass());
if ( tslot == slot )
{
w = CPlayer.ReadyWeapon;
selected = true;
}
[dummy, slot] = CPlayer.weapons.LocateWeapon(CPlayer.ReadyWeapon.GetClass());
if ( slot == (i%10) ) selected = true;
}
if ( selected ) acolor = ncolor = mhudfontcol[MCR_BRASS];
if ( selected ) ncolor = mhudfontcol[MCR_BRASS];
else
{
bool hasammo = false;
bool hasammo = (i==1);
for ( Inventory inv=CPlayer.mo.Inv; inv; inv=inv.Inv )
{
if ( inv is 'Weapon' ) [dummy, tslot] = CPlayer.weapons.LocateWeapon(Weapon(inv).GetClass());
if ( inv is 'Weapon' ) [dummy, slot] = CPlayer.weapons.LocateWeapon(Weapon(inv).GetClass());
else continue;
if ( tslot != slot ) continue;
if ( slot != (i%10) ) continue;
// CheckAmmo can't be called from ui, so we have to improvise
// for SWWM weapons I made a function for this at least
if ( (inv is 'SWWMWeapon') && SWWMWeapon(inv).ReportHUDAmmo() )
@ -156,109 +134,99 @@ extend Class SayaStatusBar
else if ( !(inv is 'SWWMWeapon') && ((!Weapon(inv).Ammo1 || (Weapon(inv).Ammo1.Amount > 0) || Weapon(inv).bAMMO_OPTIONAL) || (Weapon(inv).Ammo2 && ((Weapon(inv).Ammo2.Amount > 0) || Weapon(inv).bALT_AMMO_OPTIONAL))) )
hasammo = true;
}
if ( inslot && !hasammo ) acolor = ncolor = mhudfontcol[MCR_RED];
if ( !hasammo ) ncolor = mhudfontcol[MCR_RED];
}
if ( inslot ) Screen.DrawText(MiniHUDFont,ncolor,xx+2,yy+2,String.Format("%d",slot),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
else Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_WHITE],xx+2,yy+2,String.Format("%d",slot),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
double amt = AmmoInter[i].GetValue(fractic), maxamt = 0;
let a = SWWMAmmo(CPlayer.mo.FindInventory(AmmoSlots[i]));
// special: don't show these ammo types if we down own their weapon
if ( ((i==1) && !CPlayer.mo.FindInventory('SayaPistol')) || ((i==6) && !CPlayer.mo.FindInventory('SayaHammer')) )
Screen.DrawText(MiniHUDFont,ncolor,xx,yy,String.Format("%d",(i%10)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
int f = hnd.WeaponFlash[i%10];
if ( f && (gametic < f) )
{
double alph = max((f-(gametic+FracTic))/25.,0.)**1.5;
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_FLASH],xx,yy,String.Format("%d",(i%10)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
}
}
xx += 4;
int selslot = -1;
if ( SayaPlayer(CPlayer.mo) ) selslot = SayaPlayer(CPlayer.mo).SpellSel;
for ( int i=8; i<=10; i++,xx+=8 )
{
int ncolor = mhudfontcol[(i==(selslot+8))?MCR_CYANBLU:MCR_SILVER];
Screen.DrawText(MiniHUDFont,ncolor,xx,yy,String.Format("%d",(i%10)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
xx = ss.x-(xmargin+54);
yy = ss.y-(ymargin+46);
Screen.DrawTexture(AmmoTex,false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
xx += 2;
yy += 2;
for ( int i=0; i<5; i++, yy+=6 )
{
int amt, amax;
let a = AmmoSlots[i];
let cur = SWWMAmmo(CPlayer.mo.FindInventory(a));
if ( !cur )
{
amt = 0;
a = null;
}
if ( a )
{
maxamt = a.MaxAmount;
if ( a.MagAmmoType )
amax = GetDefaultByType(a).MaxAmount;
let def = GetDefaultByType(a);
if ( def.MagAmmoType )
{
let m = MagAmmo(CPlayer.mo.FindInventory(a.MagAmmoType));
if ( m )
let mag = MagAmmo(CPlayer.mo.FindInventory(def.MagAmmoType));
if ( mag ) // theoretically can't happen, but still check for it
{
maxamt *= m.ClipSize;
maxamt += m.MaxAmount;
amt = mag.Amount;
amax = amax*mag.ClipSize+mag.MaxAmount;
}
else
{
let defmag = GetDefaultByType(def.MagAmmoType);
amax = amax*defmag.ClipSize+defmag.MaxAmount;
}
}
}
double aw = maxamt?((amt*35.)/maxamt):0;
if ( aw )
{
Screen.DrawTexture(AmmoBar[selected],false,xx+11,yy+3,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,aw,DTA_ColorOverlay,0xFF000000);
Screen.DrawTexture(AmmoBar[selected],false,xx+10,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,aw);
}
if ( a )
{
int dcnt = 2-int(Log10(clamp(round(amt),1,999)));
for ( int j=0; j<dcnt; j++ ) Screen.DrawChar(MiniHUDFont,acolor,xx+50+j*4,yy+2,0x30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
Screen.DrawText(MiniHUDFont,acolor,xx+50,yy+2,String.Format("%3d",round(amt)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
else Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_WHITE],xx+50,yy+2,"000",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
int f = hnd.WeaponFlash[slot];
if ( f && (gametic < f) )
{
double alph = max((f-(gametic+FracTic))/25.,0.)**1.5;
if ( inslot ) Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_FLASH],xx+2,yy+2,String.Format("%d",slot),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
}
f = AmmoFlash[i];
if ( f && (gametic < f) )
{
double alph = max((f-(gametic+FracTic))/25.,0.)**1.5;
if ( aw ) Screen.DrawTexture(AmmoBar[2],false,xx+10,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_WindowRightF,aw,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
if ( a ) Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_FLASH],xx+50,yy+2,String.Format("%3d",round(amt)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
}
// draw weapon-specific display
if ( !w ) continue;
if ( w is 'SWWMWeapon' ) SWWMWeapon(w).DrawWeapon(FracTic,xx+8,yy-2,hs,ss);
else
{
double gxx = xx+8;
// generic display
String str;
int dcnt;
if ( w.Ammo2 && (w.Ammo2 != w.Ammo1) )
amt = cur.Amount;
amax = cur.MaxAmount;
if ( cur.MagAmmoType )
{
str = String.Format("%3d",clamp(w.Ammo2.Amount,0,999));
Screen.DrawTexture(GenTex,false,gxx,yy-12,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
dcnt = 2-int(Log10(clamp(w.Ammo2.Amount,1,999)));
for ( int j=0; j<dcnt; j++ ) Screen.DrawChar(MiniHUDFont,mhudfontcol[(w.Ammo2.Amount<=0)?MCR_RED:MCR_BRASS],gxx+2+j*4,yy-10,0x30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
Screen.DrawText(MiniHUDFont,mhudfontcol[(w.Ammo2.Amount<=0)?MCR_RED:MCR_BRASS],gxx+2,yy-10,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
gxx += 16;
}
if ( w.Ammo1 )
{
str = String.Format("%3d",clamp(w.Ammo1.Amount,0,999));
Screen.DrawTexture(GenTex,false,gxx,yy-12,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
dcnt = 2-int(Log10(clamp(w.Ammo1.Amount,1,999)));
for ( int j=0; j<dcnt; j++ ) Screen.DrawChar(MiniHUDFont,mhudfontcol[(w.Ammo1.Amount<=0)?MCR_RED:MCR_BRASS],gxx+2+j*4,yy-10,0x30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
Screen.DrawText(MiniHUDFont,mhudfontcol[(w.Ammo1.Amount<=0)?MCR_RED:MCR_BRASS],gxx+2,yy-10,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
let mag = MagAmmo(CPlayer.mo.FindInventory(cur.MagAmmoType));
// theoretically this should never be null, but nevertheless...
if ( mag )
{
amt = amt*mag.ClipSize+mag.Amount;
amax = amax*mag.ClipSize+mag.MaxAmount;
}
else
{
let def = GetDefaultByType(cur.MagAmmoType);
amt = amt*def.ClipSize;
amax = amax*def.ClipSize+def.MaxAmount;
}
}
}
}
// and the spell stuff
xx = ss.x-(xmargin+24);
yy = ss.y-(ymargin+55);
Screen.DrawTexture(SpellTex,false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
double mh = clamp(AmmoInter[0].GetValue(fractic),0,100)/2.;
int selslot = -1;
if ( SayaPlayer(CPlayer.mo) ) selslot = SayaPlayer(CPlayer.mo).SpellSel;
double lmh = clamp(LagInter.GetValue(fractic),0,100)/2.;
if ( lmh > mh )
{
Screen.DrawTexture(SpellBar[2],false,xx+17,yy+53-lmh,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_DestHeightF,lmh-mh,DTA_ColorOverlay,0xFF000000);
Screen.DrawTexture(SpellBar[2],false,xx+16,yy+52-lmh,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_DestHeightF,lmh-mh);
}
if ( mh )
{
Screen.DrawTexture(SpellBar[0],false,xx+17,yy+53-mh,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_DestHeightF,mh,DTA_ColorOverlay,0xFF000000);
Screen.DrawTexture(SpellBar[0],false,xx+16,yy+52-mh,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_DestHeightF,mh);
int f = AmmoFlash[0];
bool selected = false;
if ( CPlayer.ReadyWeapon && (CPlayer.ReadyWeapon is 'SWWMWeapon') )
selected = SWWMWeapon(CPlayer.ReadyWeapon).UsesAmmo(a);
int scol = mhudfontcol[selected?MCR_BRASS:MCR_WHITE];
int ncolor = (amt>0)?scol:mhudfontcol[MCR_RED];
int dcnt1 = 2-int(Log10(clamp(amt,1,999)));
int dcnt2 = 2-int(Log10(clamp(amax,1,999)));
for ( int j=0; j<dcnt1; j++ ) Screen.DrawChar(MiniHUDFont,ncolor,xx+20+j*4,yy,0x30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
for ( int j=0; j<dcnt2; j++ ) Screen.DrawChar(MiniHUDFont,scol,xx+38+j*4,yy,0x30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,0xA0000000);
String str = AmmoNames[i];
Screen.DrawText(MiniHUDFont,scol,xx,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
str = "/";
Screen.DrawText(MiniHUDFont,scol,xx+32,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,Color(80,0,0,0));
str = String.Format("%3d",clamp(amt,0,999));
Screen.DrawText(MiniHUDFont,ncolor,xx+20,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
str = String.Format("%3d",clamp(amax,0,999));
Screen.DrawText(MiniHUDFont,scol,xx+38,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
let f = AmmoFlash[i];
if ( f && (gametic < f) )
{
double alph = max((f-(gametic+FracTic))/25.,0.)**1.5;
Screen.DrawTexture(SpellBar[1],false,xx+16,yy+53-mh,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_DestHeightF,mh,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
str = String.Format("%3d",clamp(amt,0,999));
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_FLASH],xx+20,yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_LegacyRenderStyle,STYLE_Add);
}
}
if ( selslot != -1 ) Screen.DrawTexture(SpellIcon[selslot],false,xx+2,(yy+43)-14*selslot,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
}

View File

@ -42,6 +42,7 @@ Class SayaLightArmor : SWWMArmor
{
Default
{
Inventory.Icon "graphics/HUD/Icons/I_SayaLightArmor.png";
Inventory.Amount 1;
Inventory.MaxAmount 100;
Inventory.InterHubAmount 100;
@ -58,6 +59,7 @@ Class SayaHeavyArmor : SWWMArmor
{
Default
{
Inventory.Icon "graphics/HUD/Icons/I_SayaHeavyArmor.png";
Inventory.Amount 1;
Inventory.MaxAmount 500;
Inventory.InterHubAmount 500;

View File

@ -9,15 +9,15 @@ Class SayaStatScreen : SWWMStatScreen
override void Start( wbstartstruct wbstartstruct )
{
Super.Start(wbstartstruct);
lnamecolor = Font.CR_WHITE;
lauthcolor = Font.CR_DARKGRAY;
lsubcolor = Font.CR_RED;
statbasecolor = Font.CR_RED;
statcolor0 = Font.CR_WHITE;
statcolor1 = Font.CR_GOLD;
statcolor2 = Font.CR_DARKRED;
tipcolor0 = Font.CR_BRICK;
tipcolor1 = Font.CR_WHITE;
lnamecolor = Font.FindFontColor('MiniWhite');
lauthcolor = Font.FindFontColor('MiniIbukiHUD');
lsubcolor = Font.FindFontColor('MiniRed');
statbasecolor = Font.FindFontColor('MiniTomato');
statcolor0 = Font.FindFontColor('MiniWhite');
statcolor1 = Font.FindFontColor('MiniBrass');
statcolor2 = Font.FindFontColor('MiniRed');
tipcolor0 = Font.FindFontColor('MiniTomato');
tipcolor1 = Font.FindFontColor('MiniWhite');
}
override void StartMusic()
@ -28,7 +28,7 @@ Class SayaStatScreen : SWWMStatScreen
override String StatCnt( int a, int b )
{
if ( b <= 0 ) return "N/A";
return String.Format("%s \cu/\c- %s \cu(\c-%3d%%\cu)",SWWMUtility.ThousandsNum(max(a,0)),SWWMUtility.ThousandsNum(b),GetPct(a,b));
return String.Format("%s \c[MiniIbukiHUD]/\c- %s \c[MiniIbukuHUD](\c-%3d%%\c[MiniIbukiHUD])",SWWMUtility.ThousandsNum(max(a,0)),SWWMUtility.ThousandsNum(b),GetPct(a,b));
}
override String TimeStr( int secs )
@ -37,8 +37,8 @@ Class SayaStatScreen : SWWMStatScreen
int h = secs/3600;
int m = (secs/60)%60;
int s = secs%60;
if ( h ) return String.Format("%d\cu:\c-%02d\cu:\c-%02d",h,m,s);
if ( m ) return String.Format("%d\cu:\c-%02d",m,s);
if ( h ) return String.Format("%d\c[MiniIbukiHUD]:\c-%02d\c[MiniIbukiHUD]:\c-%02d",h,m,s);
if ( m ) return String.Format("%d\c[MiniIbukiHUD]:\c-%02d",m,s);
return String.Format("%d",s);
}

View File

@ -1,5 +1,16 @@
// Stinky nerd gremlin Saya Miyamoto
Enum ESayaFaceState
{
FS_DEFAULT,
FS_GRIN,
FS_SAD,
FS_LOPAIN,
FS_HIPAIN,
FS_OUCH,
FS_DEAD // UNUSED
};
Class SayaPlayer : SWWMPlayer
{
int SpellSel;
@ -39,11 +50,92 @@ Class SayaPlayer : SWWMPlayer
+SWWMPLAYER.CANCROUCHDODGE;
}
// stuck in here for now, to do the mugshot
override void UpdateFace()
{
// damage handling
if ( facedamage )
{
if ( lastdamage > 50 )
{
facestate = FS_OUCH;
facetimer = (lastdamagetimer-gametic)+10;
}
else if ( facestate < FS_OUCH )
{
facestate = (lastdamage>10)?FS_HIPAIN:FS_LOPAIN;
facetimer = (lastdamagetimer-gametic)+10;
}
paindir = 0;
// paraphrased from vanilla, with some tweaks
if ( player.attacker && (player.attacker != self) )
{
double atkang = AngleTo(player.attacker);
double angdiff = deltaangle(angle,atkang);
if ( abs(angdiff) < 135 )
{
if ( angdiff > 45 ) paindir = -1;
else if ( angdiff < -45 ) paindir = 1;
}
}
}
facedamage = false;
if ( facegrin && (facestate < FS_SAD) )
{
facestate = FS_GRIN;
facetimer = 50;
}
facegrin = false;
if ( facesad && (facestate <= FS_SAD) )
{
facestate = FS_SAD;
facetimer = 50;
}
facesad = false;
if ( facetimer > 0 )
{
facetimer--;
if ( facetimer <= 0 )
{
facestate = FS_DEFAULT;
blinktime = 30;
}
}
if ( !(gametic&1) )
{
if ( blinktime <= 0 )
{
blinktime--;
if ( blinktime < -2 )
{
rss = MSTime();
blinktime = (abs(GetRandom())%10)?(40+abs(GetRandom())%40):6;
looktime = 0;
}
}
else
{
blinktime--;
looktime++;
if ( looktime >= 8 )
{
looktime = 0;
rss = MSTime();
lookdir = abs(GetRandom())%3;
}
}
}
// TODO: update the actual texture on the model
}
override void AddInventory( Inventory item )
{
Super.AddInventory(item);
if ( (item is 'Weapon') && level.maptime )
{
A_StartSound("*weaponlaugh",CHAN_VOICE);
facegrin = true;
}
}
override Weapon PickWeapon( int slot, bool checkammo )