Major cleanup of CVar usage. Switches a whole lot of clientside-only CVars to the "nosave" type.

Auto-merge overlapping Embiggeners into bulk items.
Increase backpack amounts of many ammo types.
Allow trading of Embiggeners in multiplayer.
Fix trading dual-wield weapons.
Fix trading Candygun spares.
This commit is contained in:
Mari the Deer 2021-02-21 17:43:11 +01:00
commit 4ee1df5d8f
28 changed files with 473 additions and 432 deletions

View file

@ -14,7 +14,7 @@ Class SMW05Ammo : Ammo
Inventory.Icon "graphics/HUD/Icons/A_SMW05Ammo.png";
Inventory.Amount 1;
Inventory.MaxAmount 60;
Ammo.BackpackAmount 3;
Ammo.BackpackAmount 12;
Ammo.BackpackMaxAmount 150;
Ammo.DropAmount 3;
+FLOATBOB;
@ -91,7 +91,7 @@ Class SheenAmmo : Ammo
Inventory.Icon "graphics/HUD/Icons/A_SheenAmmo.png";
Inventory.Amount 1;
Inventory.MaxAmount 600;
Ammo.BackpackAmount 50;
Ammo.BackpackAmount 100;
Ammo.BackpackMaxAmount 1200;
Ammo.DropAmount 20;
+FLOATBOB;

View file

@ -396,7 +396,7 @@ Class RedShell : Ammo
Inventory.Icon "graphics/HUD/Icons/A_ShellsNormal.png";
Inventory.Amount 1;
Inventory.MaxAmount 30;
Ammo.BackpackAmount 2;
Ammo.BackpackAmount 5;
Ammo.BackpackMaxAmount 100;
Ammo.DropAmount 2;
+FLOATBOB;
@ -442,7 +442,7 @@ Class GreenShell : Ammo
Inventory.Icon "graphics/HUD/Icons/A_ShellsSlug.png";
Inventory.Amount 1;
Inventory.MaxAmount 25;
Ammo.BackpackAmount 2;
Ammo.BackpackAmount 4;
Ammo.BackpackMaxAmount 80;
Ammo.DropAmount 2;
+FLOATBOB;
@ -533,7 +533,7 @@ Class BlueShell : Ammo
Inventory.Icon "graphics/HUD/Icons/A_ShellsKinylum.png";
Inventory.Amount 1;
Inventory.MaxAmount 15;
Ammo.BackpackAmount 1;
Ammo.BackpackAmount 2;
Ammo.BackpackMaxAmount 40;
Ammo.DropAmount 2;
+FLOATBOB;
@ -625,7 +625,7 @@ Class PurpleShell : Ammo
Inventory.Icon "graphics/HUD/Icons/A_ShellsBall.png";
Inventory.Amount 1;
Inventory.MaxAmount 20;
Ammo.BackpackAmount 1;
Ammo.BackpackAmount 3;
Ammo.BackpackMaxAmount 60;
Ammo.DropAmount 1;
+FLOATBOB;
@ -762,7 +762,7 @@ Class EvisceratorShell : Ammo
Inventory.Icon "graphics/HUD/Icons/A_Eviscerator.png";
Inventory.Amount 1;
Inventory.MaxAmount 20;
Ammo.BackpackAmount 2;
Ammo.BackpackAmount 5;
Ammo.BackpackMaxAmount 90;
Ammo.DropAmount 1;
+FLOATBOB;
@ -835,7 +835,7 @@ Class HellblazerMissiles : Ammo
Inventory.Icon "graphics/HUD/Icons/A_HellblazerMissile.png";
Inventory.Amount 1;
Inventory.MaxAmount 20;
Ammo.BackpackAmount 1;
Ammo.BackpackAmount 3;
Ammo.BackpackMaxAmount 60;
Ammo.DropAmount 1;
+FLOATBOB;
@ -902,7 +902,7 @@ Class HellblazerCrackshots : Ammo
Inventory.Icon "graphics/HUD/Icons/A_HellblazerCrackshot.png";
Inventory.Amount 1;
Inventory.MaxAmount 15;
Ammo.BackpackAmount 1;
Ammo.BackpackAmount 2;
Ammo.BackpackMaxAmount 30;
Ammo.DropAmount 1;
+FLOATBOB;
@ -948,7 +948,7 @@ Class HellblazerRavagers : Ammo
Inventory.Icon "graphics/HUD/Icons/A_HellblazerRavager.png";
Inventory.Amount 1;
Inventory.MaxAmount 9;
Ammo.BackpackAmount 0;
Ammo.BackpackAmount 1;
Ammo.BackpackMaxAmount 18;
Ammo.DropAmount 1;
+FLOATBOB;
@ -1675,19 +1675,10 @@ Class HammerspaceEmbiggener : Inventory
Mixin SWWMOverlapPickupSound;
Mixin SWWMUseToPickup;
bool cheatedin;
override void SetGiveAmount( Actor receiver, int amount, bool givecheat )
{
Super.SetGiveAmount(receiver,amount,givecheat);
// hackeroo
cheatedin = givecheat;
}
override Inventory CreateCopy( Actor other )
{
if ( !cheatedin ) other.A_StartSound("powerup/embiggener",CHAN_ITEMEXTRA);
cheatedin = false;
bool traded = (GetClass()=='TradedHammerspaceEmbiggener');
if ( !traded ) other.A_StartSound("powerup/embiggener",CHAN_ITEMEXTRA);
// Find every unique type of ammoitem. Give it to the player if
// he doesn't have it already, and increase its maximum capacity.
for ( int i=0; i<AllActorClasses.Size(); i++ )
@ -1719,9 +1710,8 @@ Class HammerspaceEmbiggener : Inventory
}
if ( !isvalid ) continue;
let ammoitem = Ammo(other.FindInventory(type));
int amount = GetDefaultByType(type).BackpackAmount;
// extra ammo in baby mode and nightmare mode
if ( !bIgnoreSkill ) amount = int(amount*G_SkillPropertyFloat(SKILLP_AmmoFactor));
int amount = GetDefaultByType(type).BackpackAmount*self.Amount;
if ( traded ) amount = 0;
if ( amount < 0 ) amount = 0;
if ( !ammoitem )
{
@ -1731,7 +1721,7 @@ Class HammerspaceEmbiggener : Inventory
if ( ammoitem.BackpackMaxAmount > 0 )
{
double factor = (ammoitem.BackpackMaxAmount-ammoitem.default.MaxAmount)/double(MaxAmount);
ammoitem.MaxAmount = int(ammoitem.default.MaxAmount+self.Amount*factor);
ammoitem.MaxAmount = int(ammoitem.default.MaxAmount+min(self.Amount,MaxAmount)*factor);
}
if ( (ammoitem.Amount > ammoitem.MaxAmount) && !sv_unlimited_pickup )
ammoitem.Amount = ammoitem.MaxAmount;
@ -1743,25 +1733,48 @@ Class HammerspaceEmbiggener : Inventory
if ( ammoitem.BackpackMaxAmount > 0 )
{
double factor = (ammoitem.BackpackMaxAmount-ammoitem.default.MaxAmount)/double(MaxAmount);
ammoitem.MaxAmount = int(ammoitem.default.MaxAmount+self.Amount*factor);
ammoitem.MaxAmount = int(ammoitem.default.MaxAmount+min(self.Amount,MaxAmount)*factor);
}
if ( ammoitem.Amount < ammoitem.MaxAmount )
{
ammoitem.Amount += amount;
if ( (ammoitem.Amount > 0) && (ammoitem.Amount+amount < 0) )
ammoitem.Amount = int.max;
else ammoitem.Amount += amount;
if ( (ammoitem.Amount > ammoitem.MaxAmount) && !sv_unlimited_pickup )
ammoitem.Amount = ammoitem.MaxAmount;
}
}
}
return Inventory.CreateCopy(other);
self.Amount = min(self.Amount,MaxAmount);
if ( GetParentClass() == 'HammerspaceEmbiggener' )
{
if ( !GoAway() ) Destroy();
let copy = Inventory(Spawn('HammerspaceEmbiggener'));
copy.Amount = self.Amount;
copy.MaxAmount = self.MaxAmount;
return copy;
}
if ( GoAway() )
{
let copy = Inventory(Spawn(GetClass()));
copy.Amount = self.Amount;
copy.MaxAmount = self.MaxAmount;
return copy;
}
return self;
}
override bool HandlePickup( Inventory item )
{
bool res = Super.HandlePickup(item);
if ( item.GetClass() == GetClass() )
if ( (item.GetClass() == GetClass()) || (item.GetParentClass() == 'HammerspaceEmbiggener') )
{
if ( !HammerspaceEmbiggener(item).cheatedin ) Owner.A_StartSound("powerup/embiggener",CHAN_ITEMEXTRA);
bool traded = (item.GetClass()=='TradedHammerspaceEmbiggener');
if ( !traded ) Owner.A_StartSound("powerup/embiggener",CHAN_ITEMEXTRA);
if ( (Amount > 0) && (Amount+item.Amount < 0) )
Amount = int.max;
else Amount += item.Amount;
if ( Amount > MaxAmount ) Amount = MaxAmount;
item.bPickupGood = true;
// readjust ammo values to new capacity
for ( Inventory i=Owner.Inv; i; i=i.Inv )
{
@ -1771,12 +1784,15 @@ Class HammerspaceEmbiggener : Inventory
double factor = (Ammo(i).BackpackMaxAmount-i.default.MaxAmount)/double(MaxAmount);
i.MaxAmount = int(i.default.MaxAmount+Amount*factor);
}
int amount = Ammo(i).BackpackAmount;
if ( !bIgnoreSkill ) amount = int(amount*G_SkillPropertyFloat(SKILLP_AmmoFactor));
i.Amount += amount;
int amount = Ammo(i).BackpackAmount*item.Amount;
if ( traded ) i.Amount = 0;
if ( (i.Amount > 0) && (i.Amount+amount < 0) )
i.Amount = int.max;
else i.Amount += amount;
if ( (i.Amount > i.MaxAmount) && !sv_unlimited_pickup )
i.Amount = i.MaxAmount;
}
return true;
}
// new ammo suddenly added? upgrade it (this shouldn't happen unless fucky scripting has been involved)
if ( (item is 'Ammo') && !Owner.FindInventory(Ammo(item).GetParentAmmo()) )
@ -1787,7 +1803,7 @@ Class HammerspaceEmbiggener : Inventory
item.MaxAmount = int(item.default.MaxAmount+Amount*factor);
}
}
return res;
return false;
}
override void DepleteOrDestroy()
@ -1802,6 +1818,49 @@ Class HammerspaceEmbiggener : Inventory
Super.DepleteOrDestroy();
}
// merges overlapping embiggeners into a bulk upgrade
void A_MergeEmbiggeners()
{
let bt = BlockThingsIterator.Create(self,16);
int tamount = Amount;
while ( bt.Next() )
{
let t = bt.Thing;
if ( !t || (t == self) || !(t is 'HammerspaceEmbiggener') || !(t.spawnpoint ~== spawnpoint) ) continue;
tamount += HammerspaceEmbiggener(t).Amount;
t.Destroy();
}
if ( tamount <= 1 ) return;
tamount -= tamount%2; // always even numbered
if ( GetClass() == 'BulkHammerspaceEmbiggener' )
{
Amount = min(tamount,MaxAmount);
return;
}
let n = Spawn("BulkHammerspaceEmbiggener",pos);
Inventory(n).Amount = min(tamount,MaxAmount);
n.spawnpoint = spawnpoint;
n.spawnangle = spawnangle;
n.angle = angle;
n.pitch = pitch;
n.roll = roll;
n.special = special;
for ( int i=0; i<5; i++ ) n.args[i] = args[i];
n.special1 = special1;
n.special2 = special2;
n.spawnflags = spawnflags&~MTF_SECRET;
n.HandleSpawnFlags();
n.spawnflags = spawnflags;
n.bCountSecret = spawnflags&MTF_SECRET;
n.ChangeTid(tid);
n.vel = vel;
n.master = master;
n.tracer = tracer;
n.target = target;
if ( !bDROPPED ) n.bDROPPED = false;
Destroy();
}
Default
{
Tag "$T_EMBIGGENER";
@ -1822,7 +1881,37 @@ Class HammerspaceEmbiggener : Inventory
States
{
Spawn:
XZW1 A -1;
XZW1 A -1 NoDelay A_MergeEmbiggeners();
Stop;
}
}
// used when cheating or trading, this version does not give ammo and is meant
// only for GiveInventory, so it shouldn't be spawned in the world
Class TradedHammerspaceEmbiggener : HammerspaceEmbiggener {}
// used to denote "merged" embiggeners, changes color based on amount
// green (2+)
// blue (4+)
// purple (6+)
// black (8+)
Class BulkHammerspaceEmbiggener : HammerspaceEmbiggener
{
override string PickupMessage()
{
return String.Format("%dx %s",Amount,StringTable.Localize("$T_BULKEMBIGGENER"));
}
States
{
Spawn:
XZW1 A -1 NoDelay
{
A_MergeEmbiggeners();
if ( bDestroyed ) return ResolveState(null);
if ( Amount > 1 ) return SpawnState+min(4,Amount/2);
return ResolveState(null);
}
XZW1 BCDE -1;
Stop;
}
}

View file

@ -9,15 +9,13 @@ Class WallbusterReloadMenu : GenericMenu
Array<int> queue;
int AmmoSets[4];
bool isrclick, ismclick;
transient CVar pauseme, lang;
// if playing in Japanese, returns an alternate font of the same height
// Tewi -> MPlus
// Miniwi -> k6x8
Font LangFont( Font req )
{
if ( !lang ) lang = CVar.GetCVar('language',players[consoleplayer]);
if ( lang.GetString() ~== "jp" )
if ( language ~== "jp" )
{
if ( req == MiniwiFont ) return k6x8Font;
return MPlusFont;
@ -45,14 +43,13 @@ Class WallbusterReloadMenu : GenericMenu
AmmoIcon[3] = TexMan.CheckForTexture("graphics/HUD/PurpleShell.png",TexMan.Type_Any);
MenuSound("menu/demotab");
queue.Clear();
sel0 = CVar.GetCVar('swwm_cbtlast',players[consoleplayer]).GetInt();;
sel0 = swwm_cbtlast;
}
override void Ticker()
{
Super.Ticker();
if ( !pauseme ) pauseme = CVar.GetCVar('swwm_cbtpause',players[consoleplayer]);
if ( pauseme.GetBool() ) menuactive = Menu.On;
if ( swwm_cbtpause ) menuactive = Menu.On;
else menuactive = Menu.OnNoPause;
if ( (players[consoleplayer].Health > 0) && (players[consoleplayer].ReadyWeapon is 'Wallbuster') && (gamestate == GS_LEVEL) ) return;
MenuEvent(MKEY_BACK,false);
@ -85,7 +82,7 @@ Class WallbusterReloadMenu : GenericMenu
if ( (players[consoleplayer].mo.CountInv(types[idx])-AmmoSets[idx]) > 0 )
{
sel0 = idx;
CVar.GetCVar('swwm_cbtlast',players[consoleplayer]).SetInt(sel0);
CVar.FindCVar('swwm_cbtlast').SetInt(sel0);
return PushAmmo(true);
}
}
@ -113,7 +110,7 @@ Class WallbusterReloadMenu : GenericMenu
}
if ( candidates.Size() <= 0 ) return;
sel0 = candidates[Random[WallbusterMenu](0,candidates.Size()-1)];
CVar.GetCVar('swwm_cbtlast',players[consoleplayer]).SetInt(sel0);
CVar.FindCVar('swwm_cbtlast').SetInt(sel0);
AmmoSets[sel0]++;
queue.Push(sel0);
}
@ -174,13 +171,13 @@ Class WallbusterReloadMenu : GenericMenu
MenuSound("menu/demotab");
sel0++;
if ( sel0 > 3 ) sel0 = 0;
CVar.GetCVar('swwm_cbtlast',players[consoleplayer]).SetInt(sel0);
CVar.FindCVar('swwm_cbtlast').SetInt(sel0);
return true;
case MKEY_LEFT:
MenuSound("menu/demotab");
sel0--;
if ( sel0 < 0 ) sel0 = 3;
CVar.GetCVar('swwm_cbtlast',players[consoleplayer]).SetInt(sel0);
CVar.FindCVar('swwm_cbtlast').SetInt(sel0);
return true;
case MKEY_PAGEUP:
if ( queue.Size() <= 0 )
@ -818,7 +815,7 @@ Class BusterWall : Thinker
}
// damnums
Vector3 bcenter = (bust.boundsmin+bust.boundsmax)*.5;
if ( CVar.GetCVar('swwm_accdamage',players[consoleplayer]).GetBool() )
if ( swwm_accdamage )
SWWMScoreObj.Spawn(-bust.accdamage,level.Vec3Offset(bcenter,(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8))),ST_Damage);
else for ( int i=0; i<bust.acchits.Size(); i++ )
SWWMScoreObj.Spawn(-bust.acchits[i],level.Vec3Offset(bcenter,(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8))),ST_Damage);
@ -835,7 +832,6 @@ Class Wallbuster : SWWMWeapon
Array<Class<Ammo> > reloadqueue;
transient bool waitreload;
int whichspin;
transient CVar cbtmuffler;
int rnum;
transient bool cancelreload;
transient bool clearout;
@ -965,11 +961,9 @@ Class Wallbuster : SWWMWeapon
{
// draw custom crosshair
if ( automapactive || !(players[consoleplayer].Camera is 'PlayerPawn') ) return;
if ( !phair || !phair.GetBool() ) return;
if ( !ch_on ) ch_on = CVar.GetCVar('crosshairon',players[consoleplayer]);
if ( !ch_on.GetBool() ) return;
if ( !ch_force ) ch_force = CVar.GetCVar('crosshairforce',players[consoleplayer]);
if ( ch_force.GetBool() ) return;
if ( !swwm_precisecrosshair ) return;
if ( !crosshairon ) return;
if ( crosshairforce ) return;
let sb = SWWMStatusBar(StatusBar);
if ( !sb ) return;
sb.viewport.FromHud();
@ -977,20 +971,17 @@ Class Wallbuster : SWWMWeapon
sb.proj.CacheFov(players[consoleplayer].fov);
sb.proj.OrientForRenderUnderlay(e);
sb.proj.BeginProjection();
if ( !ch_img ) ch_img = CVar.GetCVar('crosshair',players[consoleplayer]);
int cnum = abs(ch_img.GetInt());
int cnum = abs(CVar.FindCVar('crosshair').GetInt());
if ( !cnum ) return;
String tn = String.Format("XHAIR%s%d",(Screen.GetWidth()<640)?"S":"B",cnum);
TextureID ctex = TexMan.CheckForTexture(tn,TexMan.Type_MiscPatch);
if ( !ctex.IsValid() ) ctex = TexMan.CheckForTexture(String.Format("XHAIR%s1",(Screen.GetWidth()<640)?"S":"B"),TexMan.Type_MiscPatch);
if ( !ctex.IsValid() ) ctex = TexMan.CheckForTexture("XHAIRS1",TexMan.Type_MiscPatch);
Vector2 ts = TexMan.GetScaledSize(ctex);
if ( !ch_siz ) ch_siz = CVar.GetCVar('crosshairscale',players[consoleplayer]);
double cs = ch_siz.GetFloat();
double cs = crosshairscale;
double sz = 1.;
if ( cs > 0. ) sz = Screen.GetHeight()*cs/200.;
if ( !ch_grow ) ch_grow = CVar.GetCVar('crosshairgrow',players[consoleplayer]);
if ( ch_grow.GetBool() ) sz *= sb.CrosshairSize;
if ( crosshairgrow ) sz *= sb.CrosshairSize;
Vector3 tdir = level.Vec3Diff(e.ViewPos,cpos);
// project
sb.proj.ProjectWorldPos(e.ViewPos+tdir);
@ -1027,17 +1018,16 @@ Class Wallbuster : SWWMWeapon
ofs = GetTraceOffset25(i);
Vector3 origin = level.Vec3Offset(Owner.Vec2OffsetZ(0,0,Owner.player.viewz),ofs.x*x+ofs.y*y+ofs.z*z);
ctr.Trace(origin,level.PointInSector(origin.xy),x,10000.,0);
if ( !ch_col ) ch_col = CVar.GetCVar('crosshaircolor',players[consoleplayer]);
Color col = ch_col.GetInt();
if ( !ch_hp ) ch_hp = CVar.GetCVar('crosshairhealth',players[consoleplayer]);
if ( ch_hp.GetInt() >= 2 )
Color col = crosshaircolor;
int chp = crosshairhealth;
if ( chp >= 2 )
{
int hp = Clamp(Owner.Health,0,200);
double sat = (hp<150)?1.:(1.-(hp-150)/100.);
Vector3 rgb = SWWMUtility.HSVtoRGB((hp/300.,sat,1.));
col = Color(int(rgb.x*255),int(rgb.y*255),int(rgb.z*255));
}
else if ( ch_hp.GetInt() == 1 )
else if ( chp == 1 )
{
double hp = Clamp(Owner.Health,0,100)/100.;
if ( hp <= 0 ) col = Color(255,0,0);
@ -1251,7 +1241,6 @@ Class Wallbuster : SWWMWeapon
double a, s;
[x, y, z] = swwm_CoordUtil.GetAxes(pitch,angle,roll);
[x2, y2, z2] = swwm_CoordUtil.GetAxes(BulletSlope(),angle,roll);
if ( !invoker.cbtmuffler ) invoker.cbtmuffler = CVar.GetCVar('swwm_earbuster',players[consoleplayer]);
int alertness = 0;
// second pass, play the fire effects
for ( int i=0; i<num; i++ )
@ -1275,7 +1264,7 @@ Class Wallbuster : SWWMWeapon
which = j;
break;
}
double rfact = invoker.cbtmuffler.GetBool()?.85:.6;
double rfact = swwm_earbuster?.85:.6;
A_StartSound(sounds[which],CHAN_WEAPON,CHANF_OVERLAP,1./(howmany**rfact),.6-howmany*.004,1.-howmany*.015);
if ( which == 0 ) redflashstr = max(120,redflashstr+10);
else if ( which == 1 ) redflashstr = max(90,redflashstr+8);

View file

@ -108,7 +108,6 @@ Class SWWMCreditsMenu : GenericMenu
String stitle, stitle2;
String sdev, sassets, smusic, sfanart, slocal, spatrons, sthanks;
Array<SWWMCreditsEntry> cdev, cassets, cmusic, cfanart, clocal, cpatrons, cthanks;
transient CVar fuzz, lang;
String oldlang;
transient Font bfnt, sfnt;
Vector2 ss;
@ -129,8 +128,7 @@ Class SWWMCreditsMenu : GenericMenu
void UpdateFonts()
{
if ( !bfnt ) bfnt = Font.GetFont('SWWMBigFont');
if ( !lang ) lang = CVar.GetCVar('language',players[consoleplayer]);
String curlang = lang.GetString();
String curlang = language;
if ( !sfnt || (curlang != oldlang) ) sfnt = (curlang ~== "jp")?Font.GetFont('MPlusShaded'):Font.GetFont('TewiShaded');
oldlang = curlang;
}
@ -282,8 +280,7 @@ Class SWWMCreditsMenu : GenericMenu
override void Drawer()
{
Super.Drawer();
if ( !fuzz ) fuzz = CVar.GetCvar('swwm_fuzz',players[consoleplayer]);
if ( fuzz.GetBool() )
if ( swwm_fuzz )
{
Vector2 tsize = TexMan.GetScaledSize(bgtex);
double zoom = max(ceil(Screen.GetWidth()/tsize.x),ceil(Screen.GetHeight()/tsize.y));

View file

@ -250,14 +250,9 @@ Class SWWMHandler : EventHandler
// for menu events
transient Array<MenuTransaction> checklist;
transient CVar mutevoice, accdamage;
transient ui CVar useshaders, altrage;
transient CVar lang;
transient String curlang;
transient CVar funtags;
transient bool curfuntags;
transient int slotstrictwarn;
transient CVar numcolor_scr, numcolor_bonus, numcolor_dmg, numcolor_hp, numcolor_ap;
// optimization
OnFire fires;
@ -296,7 +291,6 @@ Class SWWMHandler : EventHandler
ui int thealth, hmax;
ui int oldhealth[30];
ui int cummdamage, lastcummtic; // please do not misread
transient ui CVar dodrawbossbar;
bool nugflip; // h/a nugget flip-flop spawn counter
@ -309,7 +303,6 @@ Class SWWMHandler : EventHandler
// for minimap
Array<int> ffsectors;
transient CVar showmini;
enum EVanillaMap
{
@ -552,7 +545,7 @@ Class SWWMHandler : EventHandler
return 0;
let hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
if ( !hnd ) return 0;
String voicetype = CVar.GetCVar('swwm_voicetype',players[consoleplayer]).GetString();
String voicetype = CVar.FindCVar('swwm_voicetype').GetString();
// suppress non-rage comments when ragekit is active, only screaming allowed
if ( players[consoleplayer].mo.FindInventory("RagekitPower") && (type != "ragekit") ) return 0;
int whichline;
@ -904,7 +897,6 @@ Class SWWMHandler : EventHandler
level.ReplaceTextures("-noflat-","kinstile",0);
S_ChangeMusic("music/CARDISH1.XM");
}
if ( !mutevoice ) mutevoice = CVar.GetCVar('swwm_mutevoice',players[consoleplayer]);
if ( !e.IsSaveGame && !e.IsReopen && (gamestate != GS_TITLELEVEL) )
AddOneliner("mapstart",3);
if ( !e.IsSaveGame && !e.IsReopen )
@ -1204,9 +1196,7 @@ Class SWWMHandler : EventHandler
private void LangRefresh()
{
if ( !lang ) lang = CVar.GetCVar('language',players[consoleplayer]);
if ( !funtags ) funtags = CVar.GetCVar('swwm_funtags',players[consoleplayer]);
if ( (lang.GetString() != curlang) || (funtags.GetBool() != curfuntags) )
if ( (language != curlang) || (swwm_funtags != curfuntags) )
{
// manually refresh some tags if language has changed
for ( SWWMCombatTracker t=trackers; t; t=t.next )
@ -1223,8 +1213,8 @@ Class SWWMHandler : EventHandler
s.UpdateTag();
}
}
curlang = lang.GetString();
curfuntags = funtags.GetBool();
curlang = language;
curfuntags = swwm_funtags;
}
private void QueueMaintenance()
@ -1414,8 +1404,7 @@ Class SWWMHandler : EventHandler
// "simple" tracking (used by the minimap)
private void SimpleTracking()
{
if ( !showmini ) showmini = CVar.GetCVar('swwm_showminimap',players[consoleplayer]);
if ( !showmini.GetBool() )
if ( !swwm_showminimap )
{
while ( strackers )
{
@ -1517,12 +1506,11 @@ Class SWWMHandler : EventHandler
Console.Printf(StringTable.Localize("$SWWM_NEWMISSION"));
}
}
if ( !mutevoice ) mutevoice = CVar.GetCVar('swwm_mutevoice',players[consoleplayer]);
if ( onelinertic && (onelinertic < gametic) )
{
if ( players[consoleplayer].health > 0 )
{
if ( onelinerlevel > mutevoice.GetInt() )
if ( onelinerlevel > swwm_mutevoice )
players[consoleplayer].mo.A_StartSound(onelinersnd,CHAN_DEMOVOICE,CHANF_DEFAULT,1.,ATTN_NONE);
SendNetworkEvent("swwmremoteliner."..onelinersnd,consoleplayer,onelinerlevel);
}
@ -1698,9 +1686,8 @@ Class SWWMHandler : EventHandler
// damage numbers, combat tracking, etc.
private void DoDamageHandling( WorldEvent e )
{
if ( !accdamage ) accdamage = CVar.GetCVar('swwm_accdamage',players[consoleplayer]);
bool spawnme = true;
if ( accdamage.GetBool() )
if ( swwm_accdamage )
{
// find existing damage number
for ( SWWMScoreObj d=damnums; d; d=d.next )
@ -2428,10 +2415,7 @@ Class SWWMHandler : EventHandler
{
if ( (gametic == onelinertic) && (oneliner != "") && (players[consoleplayer].health > 0) )
{
int mute;
if ( mutevoice ) mute = mutevoice.GetInt();
else mute = CVar.GetCVar('swwm_mutevoice',players[consoleplayer]).GetInt(); // we can't assign the variable here since it's play scope
if ( onelinerlevel > mute )
if ( onelinerlevel > swwm_mutevoice )
{
let l = SWWMOneLiner.Make(oneliner,onelinerspan);
StatusBar.AttachMessage(l,-3473);
@ -3466,9 +3450,51 @@ Class SWWMHandler : EventHandler
}
else if ( amt > def.MaxAmount ) amt = def.MaxAmount;
bool rslt = false;
if ( (amt > 0) && players[e.Args[1]].mo.GiveInventory(item,amt,true) )
Class<Inventory> giveitem = item;
if ( item is 'HammerspaceEmbiggener' ) giveitem = 'TradedHammerspaceEmbiggener';
if ( (amt > 0) && players[e.Args[1]].mo.GiveInventory(giveitem,amt,true) )
{
players[e.Args[0]].mo.TakeInventory(item,amt);
// if player currently has the dual wield weapon selected, switch over
if ( item is 'SWWMWeapon' )
{
let c = Weapon(players[e.Args[0]].mo.FindInventory(item));
if ( c.SisterWeapon && (players[e.Args[0]].ReadyWeapon == c.SisterWeapon) )
{
players[e.Args[0]].ReadyWeapon = c;
players[e.Args[0]].SetPSprite(PSP_WEAPON,c.FindState("Ready"));
players[e.Args[0]].SetPSprite(PSP_WEAPON+1,null); // delete left weapon psprite
}
}
// if we're trading an embiggener, we need to readjust ammo
if ( item is 'HammerspaceEmbiggener' )
{
let ritm = players[e.Args[0]].mo.FindInventory(item);
for ( Inventory i=players[e.Args[0]].mo.Inv; i; i=i.Inv )
{
if ( !(i is 'Ammo') ) continue;
if ( Ammo(i).BackpackMaxAmount > 0 )
{
double factor = (Ammo(i).BackpackMaxAmount-i.default.MaxAmount)/double(ritm.MaxAmount);
i.MaxAmount = int(i.default.MaxAmount+(ritm.Amount-amt)*factor);
}
// drop excess ammo
int excess = i.Amount-i.MaxAmount;
if ( excess > 0 ) i.CreateTossable(excess);
}
}
if ( item is 'CandyGun' )
{
// see if we can take a fully loaded spare from us instead
int n = players[e.Args[0]].mo.CountInv('CandyGunSpares');
int na = players[e.Args[0]].mo.CountInv('CandyGunAmmo');
if ( (n >= amt) && (na >= amt) )
{
players[e.Args[0]].mo.TakeInventory('CandyGunSpares',amt);
players[e.Args[0]].mo.TakeInventory('CandyGunAmmo',amt);
}
else players[e.Args[0]].mo.TakeInventory('CandyGun',amt);
}
else players[e.Args[0]].mo.TakeInventory(item,amt);
// add to history
SWWMTradeHistory.RegisterSend(players[e.Args[0]],players[e.Args[1]],item,amt);
SWWMTradeHistory.RegisterReceive(players[e.Args[1]],players[e.Args[0]],item,amt);
@ -3577,15 +3603,15 @@ Class SWWMHandler : EventHandler
else if ( e.Name.Left(16) ~== "swwmremoteliner." )
{
if ( consoleplayer == e.Args[0] ) return;
if ( !CVar.GetCVar('swwm_othervoice',players[consoleplayer]).GetBool() ) return;
if ( CVar.GetCVar('swwm_mutevoice',players[consoleplayer]).GetInt() >= e.Args[1] ) return;
if ( !swwm_othervoice ) return;
if ( swwm_mutevoice >= e.Args[1] ) return;
players[e.Args[0]].mo.A_StartSound(e.Name.Mid(16),CHAN_DEMOVOICE,attenuation:.5);
}
else if ( e.Name.Left(19) ~== "swwmremotelinertxt." )
{
if ( consoleplayer == e.Args[0] ) return;
if ( !CVar.GetCVar('swwm_othervoice',players[consoleplayer]).GetBool() ) return;
if ( CVar.GetCVar('swwm_mutevoice',players[consoleplayer]).GetInt() >= e.Args[1] ) return;
if ( !swwm_othervoice ) return;
if ( swwm_mutevoice >= e.Args[1] ) return;
double dist = players[consoleplayer].Camera.Distance3D(players[e.Args[0]].mo);
if ( dist < 2000 )
Console.Printf("\cx%s\cx: %s\c-",players[e.Args[0]].GetUserName(),StringTable.Localize(e.Name.Mid(19)));
@ -3979,8 +4005,7 @@ Class SWWMHandler : EventHandler
ui void DrawBossBar( SWWMStatusBar bar )
{
if ( !ui_initialized || (bossalpha <= 0.) ) return;
if ( !dodrawbossbar ) dodrawbossbar = CVar.GetCVar('swwm_bosshealthbars',players[consoleplayer]);
if ( !dodrawbossbar.GetBool() ) return;
if ( !swwm_bosshealthbars ) return;
if ( !bbar_f ) bbar_f = TexMan.CheckForTexture("graphics/HUD/BossHealthBarBox.png",TexMan.Type_Any);
if ( !bbar_r ) bbar_r = TexMan.CheckForTexture("graphics/HUD/BossHealthBar.png",TexMan.Type_Any);
if ( !bbar_d ) bbar_d = TexMan.CheckForTexture("graphics/HUD/BossHealthBarDecay.png",TexMan.Type_Any);
@ -3998,22 +4023,20 @@ Class SWWMHandler : EventHandler
string dnum = String.Format("%d",cummdamage);
Screen.DrawText(dmgfnt,Font.CR_RED,vpos.x+300-dmgfnt.StringWidth(dnum),vpos.y-(dmgfnt.GetHeight()+2),dnum,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha*calph);
}
Screen.DrawText(barfnt,Font.CR_WHITE,vpos.x,vpos.y-(barfnt.GetHeight()+2),StringTable.Localize((funtags&&funtags.GetBool())?(bosstag.."_FUN"):bosstag),DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha);
Screen.DrawText(barfnt,Font.CR_WHITE,vpos.x,vpos.y-(barfnt.GetHeight()+2),StringTable.Localize(swwm_funtags?(bosstag.."_FUN"):bosstag),DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha);
}
// various shaders
override void RenderOverlay( RenderEvent e )
{
PlayerInfo p = players[consoleplayer];
if ( !useshaders ) useshaders = CVar.GetCVar('swwm_shaders',p);
let mo = p.mo;
if ( !mo ) return;
bool pc = (p.camera == mo);
let rage = RagekitPower(mo.FindInventory("RagekitPower"));
if ( pc && rage && useshaders.GetBool() )
if ( pc && rage && swwm_shaders )
{
if ( !altrage ) altrage = CVar.GetCVar('swwm_rageshader',p);
if ( altrage.GetBool() )
if ( swwm_rageshader )
{
Shader.SetEnabled(p,"RagekitShader",false);
Shader.SetEnabled(p,"RagekitAltShader",true);
@ -4036,10 +4059,10 @@ Class SWWMHandler : EventHandler
Shader.SetEnabled(p,"RagekitAltShader",false);
}
let ghost = GhostPower(mo.FindInventory("GhostPower"));
if ( pc && ghost && useshaders.GetBool() ) Shader.SetEnabled(p,"GhostShader",true);
if ( pc && ghost && swwm_shaders ) Shader.SetEnabled(p,"GhostShader",true);
else Shader.SetEnabled(p,"GhostShader",false);
let sunny = InvinciballPower(mo.FindInventory("InvinciballPower"));
if ( pc && sunny && useshaders.GetBool() )
if ( pc && sunny && swwm_shaders )
{
Shader.SetEnabled(p,"InvinciShader",true);
double str = max(0,sunny.lastpulse-(gametic+e.Fractic))/35.;
@ -4047,13 +4070,13 @@ Class SWWMHandler : EventHandler
}
else Shader.SetEnabled(p,"InvinciShader",false);
let coat = BarrierPower(mo.FindInventory("BarrierPower"));
if ( pc && coat && useshaders.GetBool() )
if ( pc && coat && swwm_shaders )
{
Shader.SetEnabled(p,"BarrierShader",true);
Shader.SetUniform1f(p,"BarrierShader","timer",(gametic+e.FracTic)/GameTicRate);
}
else Shader.SetEnabled(p,"BarrierShader",false);
if ( pc && (mo is 'Demolitionist') && useshaders.GetBool() )
if ( pc && (mo is 'Demolitionist') && swwm_shaders )
{
let demo = Demolitionist(mo);
if ( demo.lastunder == Demolitionist.UNDER_WATER )

View file

@ -6,7 +6,6 @@ Class SWWMHelpMenu : GenericMenu
int fadetic;
TextureID bgtex;
transient Font TewiFont, MPlusFont;
transient CVar lang, fuzz;
bool isrclick;
int pagedir;
@ -26,8 +25,7 @@ Class SWWMHelpMenu : GenericMenu
// returns MPlus if we're playing in Japanese, otherwise returns the requested font
Font LangFont( Font req )
{
if ( !lang ) lang = CVar.GetCVar('language',players[consoleplayer]);
if ( lang.GetString() ~== "jp" ) return MPlusFont;
if ( language ~== "jp" ) return MPlusFont;
return req;
}
@ -199,8 +197,7 @@ Class SWWMHelpMenu : GenericMenu
{
if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded');
if ( !MPlusFont ) MPlusFont = Font.GetFont('MPlusShaded');
if ( !fuzz ) fuzz = CVar.GetCvar('swwm_fuzz',players[consoleplayer]);
if ( fuzz.GetBool() )
if ( swwm_fuzz )
{
Vector2 tsize = TexMan.GetScaledSize(bgtex);
double zoom = max(ceil(Screen.GetWidth()/tsize.x),ceil(Screen.GetHeight()/tsize.y));

View file

@ -26,9 +26,6 @@ Class SWWMStatusBar : BaseStatusBar
// the event handler, holding all sorts of stuff
SWWMHandler hnd;
// client cvars
transient CVar safezone, maxchat[2], maxpick, chatduration, msgduration, pickduration, chatcol, teamcol, obitcol, critcol, pickcol, targetter, healthnums, scorenums, scorebonus, pois, targettag, lang, maxtarg, maxscore, maxdamns, hscale, bscale, nscale, sscale, iscale, dscale, midcol, midbcol, midduration, bigtags, showitems, showmaplabel, showmonsters, showsecrets, showtime, showtotaltime, legspoil, camhud, forcestats, showmini;
// shared stuff
Vector2 ss, hs;
Vector2 ssb, hsb;
@ -50,13 +47,11 @@ Class SWWMStatusBar : BaseStatusBar
swwmLe__SWScreen sw_proj;
swwmLe__Viewport viewport;
bool can_project;
transient CVar cvar_renderer;
DynamicValueInterpolator HealthInter, ScoreInter, ScoreInter2, FuelInter, DashInter;
Inventory lastsel;
Weapon lastwep;
transient CVar ntags;
String ntagstr;
int ntagtic, ntagcol;
@ -75,8 +70,7 @@ Class SWWMStatusBar : BaseStatusBar
// Miniwi -> k6x8
Font LangFont( HUDFont req )
{
if ( !lang ) lang = CVar.GetCVar('language',players[consoleplayer]);
if ( lang.GetString() ~== "jp" )
if ( language ~== "jp" )
{
if ( req == mMiniwiFont ) return mk6x8Font.mFont;
return mMPlusFont.mFont;
@ -222,13 +216,7 @@ Class SWWMStatusBar : BaseStatusBar
void PrepareProjection()
{
if ( !cvar_renderer ) cvar_renderer = CVar.GetCVar("vid_rendermode",players[consoleplayer]);
if ( !cvar_renderer )
{
can_project = proj = gl_proj;
return;
}
switch ( cvar_renderer.GetInt() )
switch ( vid_rendermode )
{
case 0:
case 1:
@ -389,30 +377,20 @@ Class SWWMStatusBar : BaseStatusBar
{
Super.Tick();
PrepareProjection();
if ( !chatduration ) chatduration = CVar.GetCVar('swwm_chatduration',players[consoleplayer]);
if ( !msgduration ) msgduration = CVar.GetCVar('swwm_msgduration',players[consoleplayer]);
if ( !pickduration ) pickduration = CVar.GetCVar('swwm_pickduration',players[consoleplayer]);
if ( !targetter ) targetter = CVar.GetCVar('swwm_targeter',players[consoleplayer]);
if ( !healthnums ) healthnums = CVar.GetCVar('swwm_healthnums',players[consoleplayer]);
if ( !scorenums ) scorenums = CVar.GetCVar('swwm_scorenums',players[consoleplayer]);
if ( !pois ) pois = CVar.GetCVar('swwm_pois',players[consoleplayer]);
if ( !maxtarg ) maxtarg = CVar.GetCVar('swwm_maxtargets',players[consoleplayer]);
if ( !maxscore ) maxscore = CVar.GetCVar('swwm_maxscorenums',players[consoleplayer]);
if ( !maxdamns ) maxdamns = CVar.GetCVar('swwm_maxdamnums',players[consoleplayer]);
int maxtargetnum = max(0,maxtarg.GetInt());
int maxscorenum = max(0,maxscore.GetInt());
int maxdamnum = max(0,maxdamns.GetInt());
int maxtargetnum = max(0,swwm_maxtargets);
int maxscorenum = max(0,swwm_maxscorenums);
int maxdamnum = max(0,swwm_maxdamnums);
// prune old messages
for ( int i=0; i<PickupQueue.Size(); i++ )
{
if ( level.totaltime < (PickupQueue[i].tic+35*pickduration.GetInt()) ) continue;
if ( level.totaltime < (PickupQueue[i].tic+35*swwm_pickduration) ) continue;
PickupQueue.Delete(i);
i--;
}
for ( int i=0; i<MainQueue.Size(); i++ )
{
if ( (MainQueue[i].type <= PRINT_HIGH) && (level.totaltime < (MainQueue[i].tic+35*msgduration.GetInt())) ) continue;
else if ( (MainQueue[i].type > PRINT_HIGH) && (level.totaltime < (MainQueue[i].tic+35*chatduration.GetInt())) ) continue;
if ( (MainQueue[i].type <= PRINT_HIGH) && (level.totaltime < (MainQueue[i].tic+35*swwm_msgduration)) ) continue;
else if ( (MainQueue[i].type > PRINT_HIGH) && (level.totaltime < (MainQueue[i].tic+35*swwm_chatduration)) ) continue;
MainQueue.Delete(i);
i--;
}
@ -441,7 +419,7 @@ Class SWWMStatusBar : BaseStatusBar
let cam = players[consoleplayer].camera;
Vector3 viewvec = (cos(viewrot.x)*cos(viewrot.y),sin(viewrot.x)*cos(viewrot.y),sin(-viewrot.y));
int sz;
if ( thesight && pois.GetBool() )
if ( thesight && swwm_pois )
{
// update omnisight stuff
if ( intpoints.Size() != hnd.intpoints_cnt )
@ -463,7 +441,7 @@ Class SWWMStatusBar : BaseStatusBar
// sort by distance
qsort_intpoints(intpoints,0,intpoints.Size()-1);
}
if ( targetter.GetBool() )
if ( swwm_targeter )
{
// update target stuff
if ( trackers.Size() != hnd.trackers_cnt )
@ -506,12 +484,12 @@ Class SWWMStatusBar : BaseStatusBar
else trackers.Clear();
// update floating scores, adding the scorenums first, then the damnums
int total_sz = 0;
if ( scorenums.GetBool() ) total_sz += maxscorenum?min(maxscorenum,hnd.scorenums_cnt):hnd.scorenums_cnt;
if ( healthnums.GetBool() ) total_sz += maxdamnum?min(maxdamnum,hnd.damnums_cnt):hnd.damnums_cnt;
if ( swwm_scorenums ) total_sz += maxscorenum?min(maxscorenum,hnd.scorenums_cnt):hnd.scorenums_cnt;
if ( swwm_healthnums ) total_sz += maxdamnum?min(maxdamnum,hnd.damnums_cnt):hnd.damnums_cnt;
if ( scoreobjs.Size() != total_sz )
scoreobjs.Resize(total_sz);
int i = 0;
if ( scorenums.GetBool() )
if ( swwm_scorenums )
{
for ( SWWMScoreObj scr=hnd.scorenums; scr && (i<total_sz); scr=scr.next )
{
@ -524,7 +502,7 @@ Class SWWMStatusBar : BaseStatusBar
scoreobjs[i++] = scr;
}
}
if ( healthnums.GetBool() )
if ( swwm_healthnums )
{
for ( SWWMScoreObj scr=hnd.damnums; scr && (i<total_sz); scr=scr.next )
{
@ -567,24 +545,23 @@ Class SWWMStatusBar : BaseStatusBar
qsort_itemsense(senseitems,0,senseitems.Size()-1);
}
// part of gross hackery to override nametag display
if ( !ntags ) ntags = CVar.GetCVar('displaynametags',players[consoleplayer]);
if ( CPlayer.inventorytics > 0 )
{
if ( CPlayer.mo.InvSel && (CPlayer.mo.InvSel != lastsel) && (ntags.GetInt()&1) && (CPlayer == players[consoleplayer]) )
if ( CPlayer.mo.InvSel && (CPlayer.mo.InvSel != lastsel) && (displaynametags&1) && (CPlayer == players[consoleplayer]) )
{
ntagstr = CPlayer.mo.InvSel.GetTag();
ntagtic = level.totaltime;
ntagcol = CVar.GetCVar('nametagcolor',players[consoleplayer]).GetInt();
ntagcol = nametagcolor;
}
lastsel = CPlayer.mo.InvSel;
}
if ( CPlayer.PendingWeapon && (CPlayer.PendingWeapon != WP_NOCHANGE) && (CPlayer.PendingWeapon != lastwep) )
{
if ( (ntags.GetInt()&2) && (CPlayer == players[consoleplayer]) && !(CPlayer.PendingWeapon is 'SWWMGesture') && !(CPlayer.PendingWeapon is 'SWWMItemGesture') )
if ( (displaynametags&2) && (CPlayer == players[consoleplayer]) && !(CPlayer.PendingWeapon is 'SWWMGesture') && !(CPlayer.PendingWeapon is 'SWWMItemGesture') )
{
ntagstr = CPlayer.PendingWeapon.GetTag();
ntagtic = level.totaltime;
ntagcol = CVar.GetCVar('nametagcolor',players[consoleplayer]).GetInt();
ntagcol = nametagcolor;
}
}
lastwep = CPlayer.PendingWeapon;
@ -665,7 +642,6 @@ Class SWWMStatusBar : BaseStatusBar
{
// don't draw when dead or with automap open
if ( (CPlayer.health <= 0) || automapactive ) return;
if ( !targettag ) targettag = CVar.GetCVar('swwm_targettags',players[consoleplayer]);
viewport.FromHud();
proj.CacheResolution();
proj.CacheFov(players[consoleplayer].fov);
@ -737,10 +713,9 @@ Class SWWMStatusBar : BaseStatusBar
if ( !proj.IsInFront() ) continue;
Vector2 vpos = viewport.SceneToWindow(npos);
tag = targ.mytag;
if ( !legspoil ) legspoil = CVar.GetCVar('swwm_ldspoil',players[consoleplayer]);
if ( tag != "" )
{
if ( targ.legged && (targ.mutated || legspoil.GetBool()) )
if ( targ.legged && (targ.mutated || swwm_ldspoil) )
{
if ( StringTable.Localize("$SWWM_LEGPREFIX") == "R" ) tag = tag..StringTable.Localize("$SWWM_LEG");
else tag = StringTable.Localize("$SWWM_LEG")..tag;
@ -756,9 +731,8 @@ Class SWWMStatusBar : BaseStatusBar
barsiz.y *= hsb.y;
Vector2 barpos = vpos-(barsiz/2.);
barpos.y -= 16.;
if ( !bigtags ) bigtags = CVar.GetCVar('swwm_bigtags',players[consoleplayer]);
Font fnt = LangFont(bigtags.GetBool()?mTewiFont:mMiniwiFont);
if ( targettag.GetBool() || targ.myplayer && (tag != "") )
Font fnt = LangFont(swwm_bigtags?mTewiFont:mMiniwiFont);
if ( swwm_targettags || targ.myplayer && (tag != "") )
Screen.DrawText(fnt,Font.CR_WHITE,(barpos.x+barsiz.x/2.-(fnt.StringWidth(tag)*hsb.x)/2.)/hsb.x,(barpos.y-fnt.GetHeight()*hsb.y)/hsb.y,tag,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph);
Screen.DrawTexture(EnemyBTex,false,barpos.x/hsb.x,barpos.y/hsb.y,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph);
double ht = clamp(targ.intp.GetValue(),0,targ.maxhealth*10);
@ -785,7 +759,6 @@ Class SWWMStatusBar : BaseStatusBar
Screen.DrawTexture(EnemyHTex[3],false,(barpos.x+2*hsb.x)/hsb.x,(barpos.y+2*hsb.y)/hsb.y,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_WindowRightF,hw);
}
}
if ( !scorebonus ) scorebonus = CVar.GetCVar('swwm_scorebonus',players[consoleplayer]);
// floating kill scores and others
for ( int i=0; i<scoreobjs.Size(); i++ )
{
@ -830,7 +803,7 @@ Class SWWMStatusBar : BaseStatusBar
Vector2 ss0 = isscore?sss:ssn;
Screen.DrawText(fnt,snum.tcolor,(vpos.x-hs0.x*(fo.x+fnt.StringWidth(tag)/2.))/hs0.x,(vpos.y-hs0.y*(fo.y+(fnt.GetHeight()/2.)))/hs0.y,tag,DTA_VirtualWidthF,ss0.x,DTA_VirtualHeightF,ss0.y,DTA_KeepRatio,true,DTA_Alpha,alph);
// extra strings (if available)
if ( !scorebonus.GetBool() ) continue;
if ( !swwm_scorebonus ) continue;
fo.y += fnt.GetHeight();
fnt = LangFont(mMiniwiFont);
for ( int i=0; i<snum.xcnt; i++ )
@ -1106,8 +1079,7 @@ Class SWWMStatusBar : BaseStatusBar
Screen.DrawText(mTewiFont.mFont,Font.CR_FIRE,ss.x-(margin+4+6*digits),margin+1,sstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
int yy = margin+19;
// obviously, don't draw the minimap if the automap is open
if ( !showmini ) showmini = CVar.GetCVar('swwm_showminimap',players[consoleplayer]);
if ( !automapactive && showmini.GetBool() )
if ( !automapactive && swwm_showminimap )
{
xx = int(ss.x-(margin+84));
Screen.DrawTexture(MiniBox,false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
@ -1127,22 +1099,15 @@ Class SWWMStatusBar : BaseStatusBar
yy += 87;
}
// draw stats and timer when automap is open
if ( !forcestats ) forcestats = CVar.GetCVar('swwm_forcestats',players[consoleplayer]);
int fstats = forcestats.GetInt();
int fstats = swwm_forcestats;
if ( automapactive || (fstats > 0) )
{
if ( !showitems ) showitems = CVar.GetCVar('am_showitems',players[consoleplayer]);
if ( !showmaplabel ) showmaplabel = CVar.GetCVar('am_showmaplabel',players[consoleplayer]);
if ( !showmonsters ) showmonsters = CVar.GetCVar('am_showmonsters',players[consoleplayer]);
if ( !showsecrets ) showsecrets = CVar.GetCVar('am_showsecrets',players[consoleplayer]);
if ( !showtime ) showtime = CVar.GetCVar('am_showtime',players[consoleplayer]);
if ( !showtotaltime ) showtotaltime = CVar.GetCVar('am_showtotaltime',players[consoleplayer]);
xx = int(ss.x-(margin+2));
String str;
Font fnt;
if ( automapactive || (fstats > 1) )
{
int label = showmaplabel.GetInt();
int label = am_showmaplabel;
String ln = level.levelname;
int iof = ln.IndexOf(" - by: ");
if ( iof != -1 ) ln.Truncate(iof);
@ -1153,33 +1118,33 @@ Class SWWMStatusBar : BaseStatusBar
yy += fnt.GetHeight();
}
fnt = LangFont(mMiniwiFont);
if ( (level.total_monsters > 0) && showmonsters.GetBool() )
if ( (level.total_monsters > 0) && am_showmonsters )
{
str = String.Format("\cxK \c-%d\cu/\c-%d",level.killed_monsters,level.total_monsters);
Screen.DrawText(fnt,(level.killed_monsters>=level.total_monsters)?Font.CR_GOLD:Font.CR_WHITE,xx-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
yy += fnt.GetHeight();
}
if ( (level.total_items > 0) && showitems.GetBool() )
if ( (level.total_items > 0) && am_showitems )
{
str = String.Format("\cxI \c-%d\cu/\c-%d",level.found_items,level.total_items);
Screen.DrawText(fnt,(level.found_items>=level.total_items)?Font.CR_GOLD:Font.CR_WHITE,xx-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
yy += fnt.GetHeight();
}
if ( (level.total_secrets > 0) && showsecrets.GetBool() )
if ( (level.total_secrets > 0) && am_showsecrets )
{
str = String.Format("\cxS \c-%d\cu/\c-%d",level.found_secrets,level.total_secrets);
Screen.DrawText(fnt,(level.found_secrets>=level.total_secrets)?Font.CR_GOLD:Font.CR_WHITE,xx-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
yy += fnt.GetHeight();
}
int sec;
if ( showtime.GetBool() )
if ( am_showtime )
{
sec = Thinker.Tics2Seconds(level.maptime);
str = String.Format("\cxT \c-%02d\cu:\c-%02d\cu:\c-%02d",sec/3600,(sec%3600)/60,sec%60);
Screen.DrawText(fnt,((level.sucktime>0)&&(sec>=(level.sucktime*3600)))?Font.CR_RED:(sec<=level.partime)?Font.CR_GOLD:Font.CR_WHITE,xx-fnt.StringWidth(str),yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
yy += fnt.GetHeight();
}
if ( showtotaltime.GetBool() )
if ( am_showtotaltime )
{
sec = Thinker.Tics2Seconds(level.totaltime);
str = String.Format("\cxTT \c-%02d\cu:\c-%02d\cu:\c-%02d",sec/3600,(sec%3600)/60,sec%60);
@ -1458,8 +1423,6 @@ Class SWWMStatusBar : BaseStatusBar
private void DrawPickups()
{
if ( !pickduration ) pickduration = CVar.GetCVar('swwm_pickduration',players[consoleplayer]);
if ( !pickcol ) pickcol = CVar.GetCVar('msg0color',players[consoleplayer]);
Font fnt = LangFont(mTewiFont);
int h = fnt.GetHeight();
// draw nametags below them
@ -1479,7 +1442,7 @@ Class SWWMStatusBar : BaseStatusBar
}
if ( PickupQueue.Size() <= 0 ) return;
// reverse order since they're drawn bottom to top
int mend = max(0,PickupQueue.Size()-(maxpick.GetInt()));
int mend = max(0,PickupQueue.Size()-swwm_maxpickup);
yy = ss.y-(margin+50);
// shift up if boss healthbar is present
if ( hnd && (hnd.bossalpha > 0.) ) yy -= int(25*clamp(hnd.bossalpha*2.,0.,1.));
@ -1489,7 +1452,7 @@ Class SWWMStatusBar : BaseStatusBar
{
String cstr = PickupQueue[i].str;
if ( PickupQueue[i].rep > 1 ) cstr.AppendFormat(" (x%d)",PickupQueue[i].rep);
int curtime = (PickupQueue[i].tic+35*pickduration.GetInt())-level.totaltime;
int curtime = (PickupQueue[i].tic+35*swwm_pickduration)-level.totaltime;
double alph = clamp(curtime/20.,0.,1.);
BrokenLines l = fnt.BreakLines(cstr,int(ss.x*.75));
int maxlen = 0;
@ -1504,7 +1467,7 @@ Class SWWMStatusBar : BaseStatusBar
{
int len = fnt.StringWidth(l.StringAt(j));
xx = int((ss.x-len)/2.);
Screen.DrawText(fnt,pickcol.GetInt(),xx,yy+2,l.StringAt(j),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
Screen.DrawText(fnt,msg0color,xx,yy+2,l.StringAt(j),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
yy -= h;
}
yy -= 6;
@ -1513,23 +1476,14 @@ Class SWWMStatusBar : BaseStatusBar
private void DrawMessages( double boxalph = 1. )
{
if ( !chatduration ) chatduration = CVar.GetCVar('swwm_chatduration',players[consoleplayer]);
if ( !msgduration ) msgduration = CVar.GetCVar('swwm_msgduration',players[consoleplayer]);
if ( !midduration ) midduration = CVar.GetCVar('con_midtime',players[consoleplayer]);
if ( !obitcol ) obitcol = CVar.GetCVar('msg1color',players[consoleplayer]);
if ( !critcol ) critcol = CVar.GetCVar('msg2color',players[consoleplayer]);
if ( !chatcol ) chatcol = CVar.GetCVar('msg3color',players[consoleplayer]);
if ( !teamcol ) teamcol = CVar.GetCVar('msg4color',players[consoleplayer]);
if ( !midcol ) midcol = CVar.GetCVar('msgmidcolor',players[consoleplayer]);
if ( !midbcol ) midbcol = CVar.GetCVar('msgmidcolor2',players[consoleplayer]);
Font fnt = LangFont(mTewiFont);
double xx, yy;
if ( midstr != "" )
{
double ssp = (midtype&1)?.5:1.;
double hsp = (midtype&1)?2.:1.;
int col = (midtype&2)?midbcol.GetInt():midcol.GetInt();
int curtime = (midtic+int(35*midduration.GetFloat()))-level.totaltime;
int col = (midtype&2)?msgmidcolor2:msgmidcolor;
int curtime = (midtic+int(35*con_midtime))-level.totaltime;
double alph = clamp(curtime/20.,0.,1.);
BrokenLines l = fnt.BreakLines(midstr,int(ss.x*ssp));
int h = fnt.GetHeight();
@ -1548,7 +1502,7 @@ Class SWWMStatusBar : BaseStatusBar
}
}
if ( MainQueue.Size() <= 0 ) return;
int mstart = max(0,MainQueue.Size()-(maxchat[chatopen>=gametic].GetInt()));
int mstart = max(0,MainQueue.Size()-((chatopen>=gametic)?swwm_maxshownbig:swwm_maxshown));
xx = margin;
yy = margin;
bool smol = (ss.x<640);
@ -1556,15 +1510,15 @@ Class SWWMStatusBar : BaseStatusBar
yy++;
for ( int i=mstart; i<MainQueue.Size(); i++ )
{
int col = critcol.GetInt();
if ( MainQueue[i].type == PRINT_MEDIUM ) col = obitcol.GetInt();
else if ( MainQueue[i].type == PRINT_CHAT ) col = chatcol.GetInt();
else if ( MainQueue[i].type == PRINT_TEAMCHAT ) col = teamcol.GetInt();
int col = msg2color;
if ( MainQueue[i].type == PRINT_MEDIUM ) col = msg1color;
else if ( MainQueue[i].type == PRINT_CHAT ) col = msg3color;
else if ( MainQueue[i].type == PRINT_TEAMCHAT ) col = msg4color;
String cstr = MainQueue[i].str;
if ( MainQueue[i].rep > 1 ) cstr.AppendFormat(" (x%d)",MainQueue[i].rep);
int curtime = MainQueue[i].tic-level.totaltime;
if ( MainQueue[i].type < PRINT_CHAT ) curtime += 35*msgduration.GetInt();
else curtime += 35*chatduration.GetInt();
if ( MainQueue[i].type < PRINT_CHAT ) curtime += 35*swwm_msgduration;
else curtime += 35*swwm_chatduration;
double alph = clamp(curtime/20.,0.,1.);
BrokenLines l = fnt.BreakLines(cstr,smol?211:361);
for ( int j=0; j<l.Count(); j++ )
@ -1684,44 +1638,33 @@ Class SWWMStatusBar : BaseStatusBar
Super.Draw(state,TicFrac);
if ( (state != HUD_StatusBar) && (state != HUD_Fullscreen) ) return;
if ( !hnd ) hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
if ( !safezone ) safezone = CVar.GetCVar('swwm_hudmargin',players[consoleplayer]);
if ( !maxchat[0] ) maxchat[0] = CVar.GetCVar('swwm_maxshown',players[consoleplayer]);
if ( !maxchat[1] ) maxchat[1] = CVar.GetCVar('swwm_maxshownbig',players[consoleplayer]);
if ( !maxpick ) maxpick = CVar.GetCVar('swwm_maxpickup',players[consoleplayer]);
if ( !hscale ) hscale = CVar.GetCVar('swwm_hudscale',players[consoleplayer]);
if ( !bscale ) bscale = CVar.GetCVar('swwm_barscale',players[consoleplayer]);
if ( !nscale ) nscale = CVar.GetCVar('swwm_numscale',players[consoleplayer]);
if ( !sscale ) sscale = CVar.GetCVar('swwm_scrscale',players[consoleplayer]);
if ( !iscale ) iscale = CVar.GetCVar('swwm_poiscale',players[consoleplayer]);
if ( !dscale ) dscale = CVar.GetCVar('swwm_detscale',players[consoleplayer]);
if ( !camhud ) camhud = CVar.GetCVar('swwm_camhud',players[consoleplayer]);
if ( !camhud.GetBool() && !(players[consoleplayer].Camera is 'PlayerPawn') )
if ( !swwm_camhud && !(players[consoleplayer].Camera is 'PlayerPawn') )
camhidden = true;
else camhidden = false;
BeginHUD();
if ( hscale.GetInt() <= 0 ) hs = GetHUDScale();
else hs.x = hscale.GetInt();
if ( swwm_hudscale <= 0 ) hs = GetHUDScale();
else hs.x = swwm_hudscale;
hs.y = hs.x;
ss = (Screen.GetWidth()/hs.x,Screen.GetHeight()/hs.y);
margin = clamp(safezone.GetInt(),0,40);
if ( bscale.GetInt() <= 0 ) hsb = GetHUDScale();
else hsb.x = bscale.GetInt();
margin = clamp(swwm_hudmargin,0,40);
if ( swwm_barscale <= 0 ) hsb = GetHUDScale();
else hsb.x = swwm_barscale;
hsb.y = hsb.x;
ssb = (Screen.GetWidth()/hsb.x,Screen.GetHeight()/hsb.y);
if ( nscale.GetInt() <= 0 ) hsn = GetHUDScale();
else hsn.x = nscale.GetInt();
if ( swwm_numscale <= 0 ) hsn = GetHUDScale();
else hsn.x = swwm_numscale;
hsn.y = hsn.x;
ssn = (Screen.GetWidth()/hsn.x,Screen.GetHeight()/hsn.y);
if ( sscale.GetInt() <= 0 ) hss = GetHUDScale();
else hss.x = sscale.GetInt();
if ( swwm_scrscale <= 0 ) hss = GetHUDScale();
else hss.x = swwm_scrscale;
hss.y = hss.x;
sss = (Screen.GetWidth()/hss.x,Screen.GetHeight()/hss.y);
if ( iscale.GetInt() <= 0 ) hsi = GetHUDScale();
else hsi.x = iscale.GetInt();
if ( swwm_poiscale <= 0 ) hsi = GetHUDScale();
else hsi.x = swwm_poiscale;
hsi.y = hsi.x;
ssi = (Screen.GetWidth()/hsi.x,Screen.GetHeight()/hsi.y);
if ( dscale.GetInt() <= 0 ) hsd = GetHUDScale();
else hsd.x = dscale.GetInt();
if ( swwm_detscale <= 0 ) hsd = GetHUDScale();
else hsd.x = swwm_detscale;
hsd.y = hsd.x;
ssd = (Screen.GetWidth()/hsd.x,Screen.GetHeight()/hsd.y);
FracTic = TicFrac;

View file

@ -60,7 +60,6 @@ Class SWWMOneLiner : HUDMessageBase
String whichline;
int lifespan, curtime;
transient Font TewiFont, MPlusFont;
transient CVar safezone, lang, hscale;
static SWWMOneLiner Make( String whichline, int lifespan )
{
@ -79,22 +78,19 @@ Class SWWMOneLiner : HUDMessageBase
override void Draw( int bottom, int visibility )
{
if ( !safezone ) safezone = CVar.GetCVar('swwm_hudmargin',players[consoleplayer]);
if ( !lang ) lang = CVar.GetCVar('language',players[consoleplayer]);
if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded');
if ( !MPlusFont ) MPlusFont = Font.GetFont('MPlusShaded');
if ( !hscale ) hscale = CVar.GetCVar('swwm_hudscale',players[consoleplayer]);
int margin = safezone.GetInt();
int margin = swwm_hudmargin;
Vector2 hs;
if ( hscale.GetInt() <= 0 ) hs = StatusBar.GetHUDScale();
else hs.x = hscale.GetInt();
if ( swwm_hudscale <= 0 ) hs = StatusBar.GetHUDScale();
else hs.x = swwm_hudscale;
hs.y = hs.x;
Vector2 ss = (Screen.GetWidth()/hs.x,Screen.GetHeight()/hs.y);
String loc = StringTable.Localize(whichline);
if ( loc.Length() <= 0 ) return; // don't draw empty strings
String locs = StringTable.Localize("$SWWM_LQUOTE")..loc..StringTable.Localize("$SWWM_RQUOTE");
Font fnt = TewiFont;
if ( lang.GetString() ~== "jp" ) fnt = MPlusFont;
if ( language ~== "jp" ) fnt = MPlusFont;
// split so it can fit
BrokenLines l = fnt.BreakLines(locs,int(ss.x*.5));
int maxlen = 0;
@ -131,7 +127,7 @@ Class GenericFlash : HUDMessageBase
int duration;
double alpha;
Actor cam;
transient CVar str;
GenericFlash Setup( Actor camera, Color c, int d )
{
alpha = 1.0;
@ -149,8 +145,7 @@ Class GenericFlash : HUDMessageBase
{
if ( automapactive || (visibility != BaseStatusBar.HUDMSGLayer_UnderHUD) ) return;
if ( cam && (players[consoleplayer].camera != cam) ) return;
if ( !str ) str = CVar.GetCVar('swwm_flashstrength',players[consoleplayer]);
Screen.Dim(col,(col.a/255.)*alpha*str.GetFloat(),0,0,Screen.GetWidth(),Screen.GetHeight());
Screen.Dim(col,(col.a/255.)*alpha*swwm_flashstrength,0,0,Screen.GetWidth(),Screen.GetHeight());
}
}

View file

@ -10,7 +10,6 @@ Class SWWMStatScreen : StatusScreen abstract
transient TextureID bgtex, arttex;
transient Font TewiFont, MPlusFont;
int whichart, whichtip;
transient CVar interart, lang, origmus;
double hs, hs2;
Vector2 ss, ss2, origin, origin2;
double bgfade;
@ -18,8 +17,7 @@ Class SWWMStatScreen : StatusScreen abstract
// returns MPlus if we're playing in Japanese, otherwise returns the requested font
Font LangFont( Font req )
{
if ( !lang ) lang = CVar.GetCVar('language',players[consoleplayer]);
if ( lang.GetString() ~== "jp" ) return MPlusFont;
if ( language ~== "jp" ) return MPlusFont;
return req;
}
override void Start( wbstartstruct wbstartstruct )
@ -41,20 +39,18 @@ Class SWWMStatScreen : StatusScreen abstract
}
override void StartMusic()
{
if ( !origmus ) origmus = CVar.GetCVar('swwm_intermusic',players[consoleplayer]);
if ( origmus.GetBool() ) Level.SetInterMusic(wbs.next);
if ( swwm_intermusic ) Level.SetInterMusic(wbs.next);
else S_ChangeMusic("music/DRAGONY.XM");
}
private void drawSWWMBg()
{
if ( !interart ) interart = CVar.GetCVar('swwm_interart',players[consoleplayer]);
let pdata = SWWMStatScreenData(ThinkerIterator.Create("SWWMStatScreenData",Thinker.STAT_STATIC).Next());
if ( !pdata )
{
pdata = new("SWWMStatScreenData");
pdata.ChangeStatNum(Thinker.STAT_STATIC);
}
if ( !whichart && interart.GetBool() )
if ( !whichart && swwm_interart )
{
int no = StringTable.Localize("$SWWM_NFANART").ToInt();
Array<Int> ents;

View file

@ -208,10 +208,9 @@ Class SWWMArmor : Armor abstract
{
if ( GetDefaultByType(parent).UseSound ) Owner.A_StartSound(GetDefaultByType(parent).UseSound,CHAN_ITEMEXTRA,CHANF_DEFAULT,.6);
int tgive = 0;
bool acc = CVar.GetCVar('swwm_accdamage',players[consoleplayer]).GetBool();
while ( (amount <= (MaxAmount-default.Amount)) && (Owner.CountInv(parent) > 0) )
{
if ( acc ) tgive += default.Amount;
if ( swwm_accdamage ) tgive += default.Amount;
else SWWMScoreObj.Spawn(default.Amount,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2),ST_Armor);
Amount += default.Amount;
Owner.TakeInventory(parent,1);
@ -225,7 +224,7 @@ Class SWWMArmor : Armor abstract
amount -= saved;
damage = newdamage;
}
if ( acc ) SWWMScoreObj.Spawn(tgive,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2),ST_Armor);
if ( swwm_accdamage ) SWWMScoreObj.Spawn(tgive,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2),ST_Armor);
}
else if ( amount <= 0 )
{
@ -403,11 +402,10 @@ Class SWWMHealth : Inventory abstract
}
if ( ((Owner.player == players[consoleplayer]) || bBigPowerup) ) Owner.A_StartSound(UseSound,CHAN_ITEMEXTRA);
int tgive = 0;
bool acc = CVar.GetCVar('swwm_accdamage',players[consoleplayer]).GetBool();
bool morethanonce = false;
while ( (Amount > 0) && (newdamage > 0) )
{
if ( acc ) tgive += GetDefaultByType(giveme).Amount;
if ( swwm_accdamage ) tgive += GetDefaultByType(giveme).Amount;
else SWWMScoreObj.Spawn(GetDefaultByType(giveme).Amount,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2),ST_Health);
newdamage = newdamage-GetDefaultByType(giveme).Amount;
if ( newdamage < 0 ) Owner.GiveBody(-newdamage,GetDefaultByType(giveme).MaxAmount);
@ -416,7 +414,7 @@ Class SWWMHealth : Inventory abstract
morethanonce = true;
Amount--;
}
if ( acc ) SWWMScoreObj.Spawn(tgive,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2),ST_Health);
if ( swwm_accdamage ) SWWMScoreObj.Spawn(tgive,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2),ST_Health);
}
else newdamage = damage;
}
@ -1053,8 +1051,6 @@ Class SWWMWeapon : Weapon abstract
FlagDef HideInMenu : SWeaponFlags, 1; // don't show in inventory menu (usually for sister weapons)
FlagDef NoSwapWeapon : SWeaponFlags, 2; // weapon is not affected by slot swapping
transient CVar phair; // use custom precise crosshair
transient ui CVar ch_img, ch_siz, ch_grow, ch_col, ch_hp, ch_on, ch_force;
ui SWWMCrosshairTracer ctr;
ui Vector3 cpos;
ui Color ccol;
@ -1156,9 +1152,8 @@ Class SWWMWeapon : Weapon abstract
override void DoEffect()
{
Super.DoEffect();
if ( !phair ) phair = CVar.GetCVar('swwm_precisecrosshair',players[consoleplayer]);
// force custom crosshair
if ( phair.GetBool() ) crosshair = 99;
if ( swwm_precisecrosshair ) crosshair = 99;
else crosshair = 0;
}
// subtracts given ammo from price, drops excess
@ -1303,11 +1298,9 @@ Class SWWMWeapon : Weapon abstract
{
// draw custom crosshair
if ( automapactive || !(players[consoleplayer].Camera is 'PlayerPawn') ) return;
if ( !phair || !phair.GetBool() ) return;
if ( !ch_on ) ch_on = CVar.GetCVar('crosshairon',players[consoleplayer]);
if ( !ch_on.GetBool() ) return;
if ( !ch_force ) ch_force = CVar.GetCVar('crosshairforce',players[consoleplayer]);
if ( ch_force.GetBool() ) return;
if ( !swwm_precisecrosshair ) return;
if ( !crosshairon ) return;
if ( crosshairforce ) return;
let sb = SWWMStatusBar(StatusBar);
if ( !sb ) return;
sb.viewport.FromHud();
@ -1327,20 +1320,17 @@ Class SWWMWeapon : Weapon abstract
if ( !prevms || (lagvpos == (0,0)) ) lagvpos = vpos;
else lagvpos = lagvpos*(1.-theta)+vpos*theta;
prevms = MSTime();
if ( !ch_img ) ch_img = CVar.GetCVar('crosshair',players[consoleplayer]);
int cnum = abs(ch_img.GetInt());
int cnum = abs(CVar.FindCVar('crosshair').GetInt());
if ( !cnum ) return;
String tn = String.Format("XHAIR%s%d",(Screen.GetWidth()<640)?"S":"B",cnum);
TextureID ctex = TexMan.CheckForTexture(tn,TexMan.Type_MiscPatch);
if ( !ctex.IsValid() ) ctex = TexMan.CheckForTexture(String.Format("XHAIR%s1",(Screen.GetWidth()<640)?"S":"B"),TexMan.Type_MiscPatch);
if ( !ctex.IsValid() ) ctex = TexMan.CheckForTexture("XHAIRS1",TexMan.Type_MiscPatch);
Vector2 ts = TexMan.GetScaledSize(ctex);
if ( !ch_siz ) ch_siz = CVar.GetCVar('crosshairscale',players[consoleplayer]);
double cs = ch_siz.GetFloat();
double cs = crosshairscale;
double sz = 1.;
if ( cs > 0. ) sz = Screen.GetHeight()*cs/200.;
if ( !ch_grow ) ch_grow = CVar.GetCVar('crosshairgrow',players[consoleplayer]);
if ( ch_grow.GetBool() ) sz *= sb.CrosshairSize;
if ( crosshairgrow ) sz *= sb.CrosshairSize;
Screen.DrawTexture(ctex,false,int(lagvpos.x),int(lagvpos.y),DTA_DestWidthF,ts.x*sz,DTA_DestHeightF,ts.y*sz,DTA_AlphaChannel,true,DTA_FillColor,ccol);
}
ui Vector3, Color TraceForCrosshair()
@ -1353,17 +1343,16 @@ Class SWWMWeapon : Weapon abstract
ofs = GetTraceOffset();
Vector3 origin = level.Vec3Offset(Owner.Vec2OffsetZ(0,0,Owner.player.viewz),ofs.x*x+ofs.y*y+ofs.z*z);
ctr.Trace(origin,level.PointInSector(origin.xy),x,10000.,0);
if ( !ch_col ) ch_col = CVar.GetCVar('crosshaircolor',players[consoleplayer]);
Color col = ch_col.GetInt();
if ( !ch_hp ) ch_hp = CVar.GetCVar('crosshairhealth',players[consoleplayer]);
if ( ch_hp.GetInt() >= 2 )
Color col = crosshaircolor;
int chp = crosshairhealth;
if ( chp >= 2 )
{
int hp = Clamp(Owner.Health,0,200);
double sat = (hp<150)?1.:(1.-(hp-150)/100.);
Vector3 rgb = SWWMUtility.HSVtoRGB((hp/300.,sat,1.));
col = Color(int(rgb.x*255),int(rgb.y*255),int(rgb.z*255));
}
else if ( ch_hp.GetInt() == 1 )
else if ( chp == 1 )
{
double hp = Clamp(Owner.Health,0,100)/100.;
if ( hp <= 0 ) col = Color(255,0,0);

View file

@ -40,7 +40,6 @@ Class DemolitionistMenu : GenericMenu
TextureID MainWindow, TabSeparator, WindowSeparator, WindowSeparatorH,
FancyBg, Drawing[3], LoreSeparator, LoreSeparatorW;
transient CVar lang, fuzz, pauseme;
transient Font TewiFont, MPlusFont, MiniwiFont, k6x8Font;
Array<int> tabs;
int curtab, oldtab;
@ -76,8 +75,6 @@ Class DemolitionistMenu : GenericMenu
// menu keybind
int ikey[2];
String mkey[2];
// color for chat
CVar ccol, tcol;
// for checks (duh)
Array<MenuTransaction> checklist;
int lasttuid;
@ -96,8 +93,7 @@ Class DemolitionistMenu : GenericMenu
// returns MPlus if we're playing in Japanese, otherwise returns the requested font
Font LangFont( Font req )
{
if ( !lang ) lang = CVar.GetCVar('language',players[consoleplayer]);
if ( lang.GetString() ~== "jp" ) return (req==MiniwiFont)?k6x8Font:MPlusFont;
if ( language ~== "jp" ) return (req==MiniwiFont)?k6x8Font:MPlusFont;
return req;
}
@ -135,8 +131,6 @@ Class DemolitionistMenu : GenericMenu
[ikey[0], ikey[1]] = Bindings.GetKeysForCommand("event swwmdemomenu");
mkey[0] = Bindings.NameKeys(ikey[0],0);
mkey[1] = Bindings.NameKeys(ikey[1],0);
ccol = CVar.GetCVar("msg3color",players[consoleplayer]);
tcol = CVar.GetCVar("msg4color",players[consoleplayer]);
lorelib = SWWMLoreLibrary.Find(players[consoleplayer]);
oldloresiz = lorelib.ent.Size();
tradelib = SWWMTradeHistory.Find(players[consoleplayer]);
@ -333,15 +327,15 @@ Class DemolitionistMenu : GenericMenu
let bar = SWWMStatusBar(StatusBar);
if ( bar && (bar.FullHistory.Size() > 0) )
tabs.Push(TAB_CHAT);
int lasttab = CVar.GetCVar('swwm_lasttab',players[consoleplayer]).GetInt();
int lasttab = swwm_lasttab;
for ( int i=0; i<tabs.Size(); i++ )
{
if ( tabs[i] != lasttab ) continue;
curtab = i;
break;
}
if ( tabs[curtab] == TAB_LIBRARY ) sel1 = CVar.GetCVar('swwm_lastloretab',players[consoleplayer]).GetInt();
else if ( tabs[curtab] == TAB_STATS ) sel1 = CVar.GetCVar('swwm_laststattab',players[consoleplayer]).GetInt();
if ( tabs[curtab] == TAB_LIBRARY ) sel1 = swwm_lastloretab;
else if ( tabs[curtab] == TAB_STATS ) sel1 = swwm_laststattab;
}
// please don't look at this
@ -483,7 +477,7 @@ Class DemolitionistMenu : GenericMenu
if ( tabs[curtab] >= TAB_SECRET ) tabs.Delete(curtab); // hide this tab
if ( curtab <= 0 ) curtab = (tabs.Size()-1);
else curtab--;
CVar.GetCVar('swwm_lasttab',players[consoleplayer]).SetInt(tabs[curtab]);
CVar.FindCVar('swwm_lasttab').SetInt(tabs[curtab]);
sel0 = sel1 = sel2 = 0;
ofs0 = ofs1 = ofs2 = 0;
sub = false;
@ -498,7 +492,7 @@ Class DemolitionistMenu : GenericMenu
if ( tabs[curtab] >= TAB_SECRET ) tabs.Delete(curtab); // hide this tab
if ( curtab < (tabs.Size()-1) ) curtab++;
else curtab = 0;
CVar.GetCVar('swwm_lasttab',players[consoleplayer]).SetInt(tabs[curtab]);
CVar.FindCVar('swwm_lasttab').SetInt(tabs[curtab]);
sel0 = sel1 = sel2 = 0;
ofs0 = ofs1 = ofs2 = 0;
sub = false;
@ -553,7 +547,7 @@ Class DemolitionistMenu : GenericMenu
if ( sub )
{
String str = StringTable.Localize(lorelist[sel0].text);
int ofs = (lang.GetString()~=="jp")?212:132;
int ofs = (language~=="jp")?212:132;
if ( lorelist.Size() > 26 ) ofs += 8;
BrokenLines l = fnt.BreakLines(str,635-ofs);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,626-ofs);
@ -726,7 +720,7 @@ Class DemolitionistMenu : GenericMenu
sub = false;
ofs1 = ++sel1;
if ( sel1 > LORE_LORE ) ofs1 = sel1 = LORE_ITEM;
CVar.GetCVar('swwm_lastloretab',players[consoleplayer]).SetInt(sel1);
CVar.FindCVar('swwm_lastloretab').SetInt(sel1);
}
else if ( (tabs[curtab] == TAB_TRADING) && !sub && (playerlist.Size() > 21) ) // lol is this ever going to happen
{
@ -741,7 +735,7 @@ Class DemolitionistMenu : GenericMenu
ofs0 = sel0 = 0;
ofs1 = ++sel1;
if ( ofs1 > STAT_ACHIEVEMENT ) ofs1 = sel1 = STAT_MAIN;
CVar.GetCVar('swwm_laststattab',players[consoleplayer]).SetInt(sel1);
CVar.FindCVar('swwm_laststattab').SetInt(sel1);
}
return true;
case MKEY_LEFT:
@ -771,7 +765,7 @@ Class DemolitionistMenu : GenericMenu
sub = false;
ofs1 = --sel1;
if ( sel1 < LORE_ITEM ) ofs1 = sel1 = LORE_LORE;
CVar.GetCVar('swwm_lastloretab',players[consoleplayer]).SetInt(sel1);
CVar.FindCVar('swwm_lastloretab').SetInt(sel1);
}
else if ( (tabs[curtab] == TAB_TRADING) && !sub && (playerlist.Size() > 21) && (sel0-22 >= 0) ) // lol is this ever going to happen
{
@ -784,7 +778,7 @@ Class DemolitionistMenu : GenericMenu
ofs0 = sel0 = 0;
ofs1 = --sel1;
if ( ofs1 < STAT_MAIN ) ofs1 = sel1 = STAT_ACHIEVEMENT;
CVar.GetCVar('swwm_laststattab',players[consoleplayer]).SetInt(sel1);
CVar.FindCVar('swwm_laststattab').SetInt(sel1);
}
return true;
case MKEY_ENTER:
@ -903,7 +897,8 @@ Class DemolitionistMenu : GenericMenu
else if ( sub && (sel0 != -1) && (invlist.Size() > 0) )
{
// cannot trade these
if ( invlist[sel1].bUNDROPPABLE || invlist[sel1].bUNTOSSABLE )
if ( ((invlist[sel1].bUNDROPPABLE || invlist[sel1].bUNTOSSABLE) && !(invlist[sel1] is 'HammerspaceEmbiggener'))
|| ((invlist[sel1] is 'CandyGunSpares') && !players[playerlist[sel0]].mo.FindInventory('CandyGun')) )
{
MenuSound("menu/noinvuse");
tmsg = StringTable.Localize("$SWWM_TRADEFAIL");
@ -1005,7 +1000,7 @@ Class DemolitionistMenu : GenericMenu
if ( curtab < i ) i--; // account for shortening
}
curtab = i;
CVar.GetCVar('swwm_lasttab',players[consoleplayer]).SetInt(tabs[curtab]);
CVar.FindCVar('swwm_lasttab').SetInt(tabs[curtab]);
sel0 = sel1 = sel2 = 0;
ofs0 = ofs1 = ofs2 = 0;
sub = false;
@ -1361,7 +1356,7 @@ Class DemolitionistMenu : GenericMenu
}
else if ( (tabs[curtab] == TAB_LIBRARY) && !isrclick )
{
double midp = (lang.GetString()~=="jp")?206:126;
double midp = (language~=="jp")?206:126;
if ( mpos.x < midp )
{
if ( mpos.y < 28 )
@ -1411,7 +1406,7 @@ Class DemolitionistMenu : GenericMenu
{
// check that scrollbar is present
str = StringTable.Localize(lorelist[sel0].text);
int ofs = (lang.GetString()~=="jp")?212:132;
int ofs = (language~=="jp")?212:132;
if ( lorelist.Size() > 26 ) ofs += 8;
BrokenLines l = fnt.BreakLines(str,635-ofs);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,626-ofs);
@ -1551,7 +1546,7 @@ Class DemolitionistMenu : GenericMenu
}
else if ( (tabs[curtab] == TAB_STATS) && !isrclick )
{
double midp = (lang.GetString()~=="jp")?206:126;
double midp = (language~=="jp")?206:126;
if ( mpos.x < midp )
{
// check what item we clicked
@ -1567,7 +1562,7 @@ Class DemolitionistMenu : GenericMenu
MenuSound("menu/demoscroll");
ofs0 = sel0 = 0;
sel1 = i;
CVar.GetCVar('swwm_laststattab',players[consoleplayer]).SetInt(sel1);
CVar.FindCVar('swwm_laststattab').SetInt(sel1);
}
return res;
}
@ -1706,7 +1701,7 @@ Class DemolitionistMenu : GenericMenu
{
// check that scrollbar is present
str = StringTable.Localize(lorelist[sel0].text);
int ofs = (lang.GetString()~=="jp")?212:132;
int ofs = (language~=="jp")?212:132;
if ( lorelist.Size() > 26 ) ofs += 8;
BrokenLines l = fnt.BreakLines(str,635-ofs);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,626-ofs);
@ -2172,8 +2167,7 @@ Class DemolitionistMenu : GenericMenu
Close();
return;
}
if ( !pauseme ) pauseme = CVar.GetCVar('swwm_menupause',players[consoleplayer]);
if ( pauseme.GetBool() ) menuactive = Menu.On;
if ( swwm_menupause ) menuactive = Menu.On;
else menuactive = Menu.OnNoPause;
// forcibly tick hud (mainly so interpolators can still update in the background)
if ( !multiplayer && (menuactive == Menu.On) )
@ -2694,7 +2688,7 @@ Class DemolitionistMenu : GenericMenu
Vector2 ss = (Screen.GetWidth(),Screen.GetHeight())/hs;
Vector2 origin = (ss.x-640,ss.y-400)/2.;
Vector2 mpos = (curmouse/hs)-origin;
double midp = (lang.GetString()~=="jp")?206:126;
double midp = (language~=="jp")?206:126;
if ( ((lorelist.Size() > 27) && (mpos.x < midp+8)) || (mpos.x < midp) )
{
MenuSound("menu/democlose");
@ -2711,7 +2705,7 @@ Class DemolitionistMenu : GenericMenu
Vector2 ss = (Screen.GetWidth(),Screen.GetHeight())/hs;
Vector2 origin = (ss.x-640,ss.y-400)/2.;
Vector2 mpos = (curmouse/hs)-origin;
double midp = (lang.GetString()~=="jp")?206:126;
double midp = (language~=="jp")?206:126;
if ( ((lorelist.Size() > 27) && (mpos.x < midp+8)) || (mpos.x < midp) )
{
MenuSound("menu/democlose");
@ -2765,8 +2759,7 @@ Class DemolitionistMenu : GenericMenu
else hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/400.)),1.);
Vector2 ss = (Screen.GetWidth(),Screen.GetHeight())/hs;
Vector2 origin = (ss.x-640,ss.y-400)/2.;
if ( !fuzz ) fuzz = CVar.GetCvar('swwm_fuzz',players[consoleplayer]);
if ( fuzz.GetBool() )
if ( swwm_fuzz )
Screen.DrawTexture(FancyBg,false,origin.x,origin.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_LegacyRenderStyle,STYLE_Add,DTA_Alpha,.5);
Screen.DrawTexture(MainWindow,false,origin.x,origin.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
// draw tabs
@ -2853,7 +2846,7 @@ Class DemolitionistMenu : GenericMenu
// categories
xx = 9;
yy = 23;
int twidth = (lang.GetString()~=="jp")?194:114;
int twidth = (language~=="jp")?194:114;
for ( int i=0; i<=STAT_ACHIEVEMENT; i++ )
{
str = StringTable.Localize(stabnames[i]);
@ -3121,7 +3114,7 @@ Class DemolitionistMenu : GenericMenu
xx = 3;
yy = 14;
// draw the category
int twidth = (lang.GetString()~=="jp")?200:120;
int twidth = (language~=="jp")?200:120;
str = StringTable.Localize(ltabnames[sel1]);
Screen.DrawText(TewiFont,Font.CR_WHITE,origin.x+xx,origin.y+yy,"<",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawText(TewiFont,Font.CR_WHITE,origin.x+xx+twidth-6,origin.y+yy,">",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
@ -3139,7 +3132,7 @@ Class DemolitionistMenu : GenericMenu
}
if ( lunread ) Screen.DrawText(TewiFont,Font.CR_GOLD,origin.x+xx+6,origin.y+yy,"‼",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( runread ) Screen.DrawText(TewiFont,Font.CR_GOLD,origin.x+xx+twidth-12,origin.y+yy,"‼",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawTexture((lang.GetString()~=="jp")?LoreSeparatorW:LoreSeparator,false,origin.x,origin.y+27,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawTexture((language~=="jp")?LoreSeparatorW:LoreSeparator,false,origin.x,origin.y+27,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
yy += 18;
// draw the current entries
int ofs = max(0,ofs0-26);
@ -3399,7 +3392,7 @@ Class DemolitionistMenu : GenericMenu
yy = 379;
for ( int i=ofs; i>=0; i-- )
{
int col = (bar.FullHistory[i].type==PRINT_TEAMCHAT)?tcol.GetInt():ccol.GetInt();
int col = (bar.FullHistory[i].type==PRINT_TEAMCHAT)?msg4color:msg3color;
int thour = (bar.FullHistory[i].tic/(3600*GameTicRate));
int tmin = (bar.FullHistory[i].tic/(60*GameTicRate))%60;
int tsec = (bar.FullHistory[i].tic/GameTicRate)%60;

View file

@ -116,7 +116,6 @@ Class OptionMenuItemSWWMVoiceOption : OptionMenuItemOptionBase
Class SWWMOptionMenu : OptionMenu
{
private String ttip;
transient CVar lang;
transient Font TewiFont, MPlusFont;
override void Init( Menu parent, OptionMenuDescriptor desc )
@ -178,9 +177,8 @@ Class SWWMOptionMenu : OptionMenu
}
if ( !TewiFont ) TewiFont = Font.GetFont('Tewi');
if ( !MPlusFont ) MPlusFont = Font.GetFont('MPlus');
if ( !lang ) lang = CVar.GetCVar('language',players[consoleplayer]);
Font fnt = TewiFont;
if ( lang.GetString() ~== "jp" ) fnt = MPlusFont;
if ( language ~== "jp" ) fnt = MPlusFont;
let lines = fnt.BreakLines(ttip,CleanWidth_1-8);
int height = (4+fnt.GetHeight()*lines.Count())*CleanYFac_1;
// draw at the bottom unless the selected option could be covered by the tooltip
@ -534,7 +532,6 @@ Class ListMenuItemSWWMPatchItemM : ListMenuItemSelectable
Class SWWMMenuDelegate : DoomMenuDelegate
{
transient CVar lang;
transient Font TewiFont, MPlusFont, SWWMBigFont;
override int DrawCaption( String title, Font fnt, int y, bool drawit )
@ -550,13 +547,12 @@ Class SWWMMenuDelegate : DoomMenuDelegate
// this doesn't seem to always work?
override Font PickFont( Font fnt )
{
if ( !lang ) lang = CVar.GetCVar('language',players[consoleplayer]);
if ( !TewiFont ) TewiFont = Font.GetFont('TewiShaded');
if ( !MPlusFont ) MPlusFont = Font.GetFont('MPlusShaded');
if ( !SWWMBigFont ) SWWMBigFont = Font.GetFont('SWWMBigFont');
if ( (fnt == SmallFont) || (fnt == SmallFont2) || (fnt == AlternativeSmallFont) || (fnt == NewSmallFont) || !fnt )
{
if ( lang.GetString() ~== "jp" ) return MPlusFont;
if ( language ~== "jp" ) return MPlusFont;
return TewiFont;
}
if ( (fnt == BigFont) || (fnt == AlternativeBigFont) || (fnt == OriginalBigFont) || (fnt == IntermissionFont) ) return SWWMBigFont;

View file

@ -16,7 +16,7 @@ Class Demolitionist : PlayerPawn
double lastvelz, prevvelz;
double ssup;
transient CVar myvoice, mute, fly6dof, clrun;
transient CVar myvoice;
SWWMStats mystats;
int cairtime;
@ -114,10 +114,8 @@ Class Demolitionist : PlayerPawn
}
if ( giveall || (name ~== "backpack") )
{
// Select the correct type of backpack based on the game
let type = (class<Inventory>)(gameinfo.backpacktype);
let def = GetDefaultByType(type);
if ( type ) GiveInventory(type,def.MaxAmount,true);
let def = GetDefaultByType('HammerspaceEmbiggener');
GiveInventory('TradedHammerspaceEmbiggener',def.MaxAmount,true);
if ( !giveall ) return;
}
if ( giveall || (name ~== "ammo") )
@ -626,8 +624,7 @@ Class Demolitionist : PlayerPawn
diffy = abs(diffy)**.5*sgn;
}
// don't do inertial sway when in 6dof mode, causes issues
if ( !fly6dof ) fly6dof = CVar.GetCVar('swwm_fly6dof',player);
if ( !fly6dof.GetBool() || !((waterlevel < 2) && bFly && !bFlyCheat && !(player.cheats&CF_NOCLIP2)) )
if ( !swwm_fly6dof || !((waterlevel < 2) && bFly && !bFlyCheat && !(player.cheats&CF_NOCLIP2)) )
{
cur.x += diffang;
cur.y -= diffpitch;
@ -765,7 +762,6 @@ Class Demolitionist : PlayerPawn
if ( player.cmd.buttons&BT_USER3 ) SenseItems();
if ( vel.length() > mystats.topspeed ) mystats.topspeed = vel.length();
if ( !myvoice ) myvoice = CVar.GetCVar('swwm_voicetype',player);
if ( !mute ) mute = CVar.GetCVar('swwm_mutevoice',player);
if ( player.onground && !bNoGravity && !lastground && (waterlevel < 2) )
{
// bump down weapon
@ -789,7 +785,7 @@ Class Demolitionist : PlayerPawn
}
if ( lastvelz < -10 )
A_StartSound("demolitionist/runstop",CHAN_FOOTSTEP,CHANF_OVERLAP);
if ( (player == players[consoleplayer]) && (lastvelz < -gruntspeed) && (mute.GetInt() < 4) && (health > 0) )
if ( (lastvelz < -gruntspeed) && (swwm_mutevoice < 4) && (health > 0) )
A_StartSound(String.Format("voice/%s/grunt",myvoice.GetString()),CHAN_DEMOVOICE,CHANF_OVERLAP);
if ( lastvelz < -1 )
A_Footstep(0,true,clamp(-lastvelz*0.05,0.0,1.0));
@ -1282,10 +1278,9 @@ Class Demolitionist : PlayerPawn
}
else guideangle += .2*player.cmd.yaw*(360./65536.);
guidepitch -= .2*player.cmd.pitch*(360./65536.);
if ( !fly6dof ) fly6dof = CVar.GetCVar('swwm_fly6dof',player);
if ( player.centering ) guidepitch = clamp(deltaangle(pitch,0),-3.,3.);
if ( player.centering || !fly6dof.GetBool() ) guideroll = clamp(deltaangle(roll,0),-3.,3.);
if ( fly6dof.GetBool() )
if ( player.centering || !swwm_fly6dof ) guideroll = clamp(deltaangle(roll,0),-3.,3.);
if ( swwm_fly6dof )
{
swwm_Quat orient = swwm_Quat.create_euler(pitch,angle,roll);
swwm_Quat angles = swwm_Quat.create_euler(guidepitch,guideangle,guideroll);
@ -1941,26 +1936,25 @@ Class Demolitionist : PlayerPawn
if ( IsActorPlayingSound(CHAN_JETPACK,"demolitionist/jet") )
A_StartSound("demolitionist/jetstop",CHAN_JETPACK);
if ( !myvoice ) myvoice = CVar.GetCVar('swwm_voicetype',player);
if ( !mute ) mute = CVar.GetCVar('swwm_mutevoice',player);
if ( lastdamage > 90 )
{
A_StartSound("demolitionist/hipain",CHAN_VOICE);
if ( !player || (player.mo != self) ) return; // voodoo dolls have no voice
if ( (player == players[consoleplayer]) && mute && myvoice && (mute.GetInt() < 4) )
if ( swwm_mutevoice < 4 )
A_StartSound(String.Format("voice/%s/hipain",myvoice.GetString()),CHAN_DEMOVOICE,CHANF_OVERLAP);
}
else if ( lastdamage > 30 )
{
A_StartSound("demolitionist/pain",CHAN_VOICE);
if ( !player || (player.mo != self) ) return; // voodoo dolls have no voice
if ( (player == players[consoleplayer]) && mute && myvoice && (mute.GetInt() < 4) )
if ( swwm_mutevoice < 4 )
A_StartSound(String.Format("voice/%s/pain",myvoice.GetString()),CHAN_DEMOVOICE,CHANF_OVERLAP);
}
else if ( lastdamage > 0 )
{
A_StartSound("demolitionist/lopain",CHAN_VOICE);
if ( !player || (player.mo != self) || (lastdamage < 5) ) return; // voodoo dolls have no voice
if ( (player == players[consoleplayer]) && mute && myvoice && (mute.GetInt() < 4) )
if ( swwm_mutevoice < 4 )
A_StartSound(String.Format("voice/%s/lopain",myvoice.GetString()),CHAN_DEMOVOICE,CHANF_OVERLAP);
}
lastdamage = 0;
@ -1971,7 +1965,6 @@ Class Demolitionist : PlayerPawn
A_StartSound("demolitionist/jetstop",CHAN_JETPACK);
A_StopSound(CHAN_DEMOVOICE);
if ( !myvoice ) myvoice = CVar.GetCVar('swwm_voicetype',player);
if ( !mute ) mute = CVar.GetCVar('swwm_mutevoice',player);
Sound snd = "demolitionist/death";
if ( special1 < 10 )
snd = "demolitionist/wdeath";
@ -1979,7 +1972,7 @@ Class Demolitionist : PlayerPawn
snd = "demolitionist/xdeath";
A_StartSound(snd,CHAN_VOICE);
if ( !player || (player.mo != self) ) return; // voodoo dolls have no voice
if ( (player == players[consoleplayer]) && mute && myvoice && (mute.GetInt() < 4) )
if ( swwm_mutevoice < 4 )
A_StartSound(String.Format("voice/%s/death",myvoice.GetString()),CHAN_DEMOVOICE,CHANF_OVERLAP);
}
override bool OnGiveSecret( bool printmsg, bool playsound )
@ -3832,13 +3825,13 @@ Class SWWMGesture : SWWMWeapon
action void A_Smooch()
{
if ( (player == players[consoleplayer]) && (CVar.GetCVar('swwm_mutevoice',player).GetInt() < 4) )
if ( swwm_mutevoice < 4 )
A_StartSound("demolitionist/smooch",CHAN_DEMOVOICE,CHANF_OVERLAP,.4);
}
action void A_BlowKiss()
{
if ( (player == players[consoleplayer]) && (CVar.GetCVar('swwm_mutevoice',player).GetInt() < 4) )
if ( swwm_mutevoice < 4 )
A_StartSound("demolitionist/blowkiss",CHAN_DEMOVOICE,CHANF_OVERLAP,.4);
let weap = Weapon(invoker);
if ( !weap ) return;

View file

@ -39,7 +39,7 @@ Class GrilledCheeseSandwich : Inventory
Owner.A_QuakeEx(9,9,9,3,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:1.);
Owner.GiveBody(1000,1000);
SWWMScoreObj.Spawn(1000,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2),ST_Health);
if ( CVar.GetCVar('swwm_accdamage',players[consoleplayer]).GetBool() )
if ( swwm_accdamage )
SWWMScoreObj.Spawn(600,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2),ST_Armor);
else
{
@ -918,7 +918,7 @@ Class RagekitPower : Powerup
if ( Owner.GiveBody(1,100) )
SWWMScoreObj.Spawn(1,Owner.Vec3Offset(FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8),FRandom[ScoreBits](-8,8)+Owner.Height/2),ST_Health);
Owner.A_AlertMonsters(swwm_uncapalert?0:2000);
if ( (Owner.player == players[consoleplayer]) && (gametic > lastrage) && (CVar.GetCVar('swwm_mutevoice',players[consoleplayer]).GetInt() < 2) )
if ( (Owner.player == players[consoleplayer]) && (gametic > lastrage) && (swwm_mutevoice < 2) )
lastrage = SWWMHandler.AddOneliner("ragekit",2,5)+40;
Owner.A_QuakeEx(2,2,2,Random[Rage](1,2),0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:.5);
lastpulse = max(lastpulse,gametic+10);
@ -967,7 +967,7 @@ Class RagekitPower : Powerup
Owner.A_AlertMonsters(swwm_uncapalert?0:5000);
SWWMHandler.DoFlash(Owner,Color(64,255,0,0),10);
Owner.A_QuakeEx(8,8,8,Random[Rage](3,8),0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:1.);
if ( (Owner.player == players[consoleplayer]) && (gametic > lastrage) )
if ( (Owner.player == players[consoleplayer]) && (gametic > lastrage) && (swwm_mutevoice < 2) )
lastrage = SWWMHandler.AddOneliner("ragekit",2,5)+40;
Owner.A_StartSound("powerup/ragekithit",CHAN_POWERUP);
lasteffect = level.maptime;
@ -1093,6 +1093,15 @@ Class Omnisight : Inventory
// not used up, must be kept for the targetting features to work
return false;
}
override bool HandlePickup( Inventory item )
{
if ( item.GetClass() == GetClass() )
{
item.bPickupGood = true;
return true;
}
return false;
}
Default
{
Tag "$T_OMNISIGHT";

View file

@ -657,7 +657,6 @@ Class SilverBullet : SWWMWeapon
bool zoomed;
double zoomlevel;
ui TextureID reticle, scope;
transient ui CVar useshaders;
int rezoom;
bool proneme;
@ -780,12 +779,11 @@ Class SilverBullet : SWWMWeapon
}
override void RenderUnderlay( RenderEvent e )
{
if ( !useshaders ) useshaders = CVar.GetCVar('swwm_shaders',players[consoleplayer]);
if ( zoomed && (Owner.player == players[consoleplayer]) )
{
Vector2 ss = (Screen.GetWidth(),Screen.GetHeight());
ss *= (512./ss.y);
if ( useshaders.GetBool() ) Shader.SetEnabled(players[consoleplayer],"SilverScope",true);
if ( swwm_shaders ) Shader.SetEnabled(players[consoleplayer],"SilverScope",true);
else
{
Shader.SetEnabled(players[consoleplayer],"SilverScope",false);

View file

@ -604,25 +604,20 @@ Class SWWMScoreObj : Thinker
o.score = score;
o.pos = pos;
o.lifespan = o.initialspan = 60;
if ( !hnd.numcolor_scr ) hnd.numcolor_scr = CVar.GetCVar('swwm_numcolor_scr',players[consoleplayer]);
if ( !hnd.numcolor_bonus ) hnd.numcolor_bonus = CVar.GetCVar('swwm_numcolor_bonus',players[consoleplayer]);
if ( !hnd.numcolor_dmg ) hnd.numcolor_dmg = CVar.GetCVar('swwm_numcolor_dmg',players[consoleplayer]);
if ( !hnd.numcolor_hp ) hnd.numcolor_hp = CVar.GetCVar('swwm_numcolor_hp',players[consoleplayer]);
if ( !hnd.numcolor_ap ) hnd.numcolor_ap = CVar.GetCVar('swwm_numcolor_ap',players[consoleplayer]);
if ( tcolor != -1 ) o.tcolor = tcolor;
else switch ( type )
{
case ST_Score:
o.tcolor = hnd.numcolor_scr.GetInt();
o.tcolor = swwm_numcolor_scr;
break;
case ST_Damage:
o.tcolor = hnd.numcolor_dmg.GetInt();
o.tcolor = swwm_numcolor_dmg;
break;
case ST_Health:
o.tcolor = hnd.numcolor_hp.GetInt();
o.tcolor = swwm_numcolor_hp;
break;
case ST_Armor:
o.tcolor = hnd.numcolor_ap.GetInt();
o.tcolor = swwm_numcolor_ap;
break;
}
o.starttic = level.maptime;
@ -630,7 +625,7 @@ Class SWWMScoreObj : Thinker
o.seed2 = Random[ScoreBits]();
o.damnum = (type > ST_Score);
o.xcnt = 0;
for ( int i=0; i<6; i++ ) o.xtcolor[i] = hnd.numcolor_bonus.GetInt();
for ( int i=0; i<6; i++ ) o.xtcolor[i] = swwm_numcolor_bonus;
o.acc = acc;
if ( o.damnum )
{
@ -849,24 +844,15 @@ Class SWWMCombatTracker : Thinker
bool legged, mutated;
int tcnt;
double height;
transient CVar funtags, maxdist, damagebars;
bool funtag;
int mxdist, dbar;
bool bBOSS, bFRIENDLY;
bool firsthit;
void UpdateTag()
{
// only the first tracker accesses the CVar, saves on perf
if ( !prev )
{
if ( !funtags ) funtags = CVar.GetCVar('swwm_funtags',players[consoleplayer]);
funtag = funtags.GetBool();
}
if ( next ) next.funtag = funtag;
if ( mytarget && (mytarget.player || mytarget.bISMONSTER || (mytarget is 'BossBrain') || (mytarget is 'SWWMHangingKeen') || (mytarget is 'Demolitionist')) )
{
String realtag = funtag?SWWMUtility.GetFunTag(mytarget,FallbackTag):mytarget.GetTag(FallbackTag);
String realtag = swwm_funtags?SWWMUtility.GetFunTag(mytarget,FallbackTag):mytarget.GetTag(FallbackTag);
if ( realtag == FallbackTag )
{
realtag = mytarget.GetClassName();
@ -945,10 +931,8 @@ Class SWWMCombatTracker : Thinker
// only the first tracker accesses the CVars, saves on perf
if ( !prev )
{
if ( !damagebars ) damagebars = CVar.GetCVar('swwm_damagetarget',players[consoleplayer]);
if ( !maxdist ) maxdist = CVar.GetCVar('swwm_maxtargetdist',players[consoleplayer]);
dbar = damagebars.GetInt();
mxdist = maxdist.GetInt();
dbar = swwm_damagetarget;
mxdist = swwm_maxtargetdist;
}
if ( next )
{

View file

@ -4,7 +4,6 @@ Class SWWMTitleStuff : EventHandler
{
transient ui TextureID tex[3];
transient ui Font TewiFont, MPlusFont;
transient ui CVar lang, fuzz;
transient ui Array<String> scrolls;
transient ui int sline;
transient ui double sbase;
@ -13,8 +12,7 @@ Class SWWMTitleStuff : EventHandler
// returns MPlus if we're playing in Japanese, otherwise returns the requested font
private ui Font LangFont( Font req )
{
if ( !lang ) lang = CVar.GetCVar('language',players[consoleplayer]);
if ( lang.GetString() ~== "jp" ) return MPlusFont;
if ( language ~== "jp" ) return MPlusFont;
return req;
}
@ -33,8 +31,7 @@ Class SWWMTitleStuff : EventHandler
if ( !MPlusFont ) MPlusFont = Font.GetFont('MPlusShadedInverse');
Font fnt = LangFont(TewiFont);
Vector2 tsize, vsize;
if ( !fuzz ) fuzz = CVar.GetCvar('swwm_fuzz',players[consoleplayer]);
if ( fuzz.GetBool() )
if ( swwm_fuzz )
{
tsize = TexMan.GetScaledSize(tex[2]);
double zoom = max(ceil(Screen.GetWidth()/tsize.x),ceil(Screen.GetHeight()/tsize.y));
@ -71,7 +68,7 @@ Class SWWMTitleStuff : EventHandler
Screen.DrawTexture(tex[1],false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_Alpha,alf);
if ( (level.maptime/GameTicRate) < 30 ) return;
// scrolls
if ( (scrolls.Size() <= 0 ) || (lastlang != lang.GetString()) )
if ( (scrolls.Size() <= 0 ) || (lastlang != language) )
{
scrolls.Clear();
String sstr = StringTable.Localize("$SWWM_TITLESCROLL");
@ -79,7 +76,7 @@ Class SWWMTitleStuff : EventHandler
sbase = (level.maptime+e.FracTic)/GameTicRate;
if ( sline >= scrolls.Size() ) sline = 0;
}
lastlang = lang.GetString();
lastlang = language;
// estimate scrool length
double llen = fnt.StringWidth(scrolls[sline]);
double soffset = 40*((level.maptime+e.FracTic)/GameTicRate-sbase);