diff --git a/graphics/HUD/ScoreBox.png b/graphics/HUD/ScoreBox.png new file mode 100644 index 000000000..3b9c89d1a Binary files /dev/null and b/graphics/HUD/ScoreBox.png differ diff --git a/graphics/HUD/ScoreBoxL.png b/graphics/HUD/ScoreBoxL.png deleted file mode 100644 index 00839aed6..000000000 Binary files a/graphics/HUD/ScoreBoxL.png and /dev/null differ diff --git a/graphics/HUD/ScoreBoxM.png b/graphics/HUD/ScoreBoxM.png deleted file mode 100644 index 3b3f66d29..000000000 Binary files a/graphics/HUD/ScoreBoxM.png and /dev/null differ diff --git a/graphics/HUD/ScoreBoxR.png b/graphics/HUD/ScoreBoxR.png deleted file mode 100644 index a8aa673a4..000000000 Binary files a/graphics/HUD/ScoreBoxR.png and /dev/null differ diff --git a/language.def_lore b/language.def_lore index 07d1f6aae..99dd05772 100644 --- a/language.def_lore +++ b/language.def_lore @@ -3401,7 +3401,7 @@ SWWM_LORETXT_SCORESYSTEM = "\n" "Carried items may also be refunded for additional points, allowing you to exchange them for anything else you'd prefer instead. This process is automated when obtaining weapons you already possess, or reach the carry limit for certain items.\n" "\n" -"Please do note that there is an imposed limit of 999,999,999,999,999,999 points, which, in practice, shouldn't even be remotely reachable.\n" +"Please do note that there is an imposed limit of 999999999 points, which, in practice, should take a very, very long time to reach.\n" "\n" "\cxSaya's Notes:\c-\n" "\cfAlright, I'll be honest here: This is more videogamey stuff from nerdboy. But I think it's good, in a way. There's something about the rush of seeing the numbers go up, you know, and you can get something nice out of it too. I can't exactly hide this from you but it's something we both agreed on, for your sake.\c-\n" diff --git a/language.es_lore b/language.es_lore index d8ac75ab1..b880c67a4 100644 --- a/language.es_lore +++ b/language.es_lore @@ -3152,7 +3152,7 @@ SWWM_LORETXT_SCORESYSTEM = "\n" "Los ítems obtenidos pueden también reembolsarse por puntos adicionales, permitiendo intercambiarlos por cualquier otra cosa que prefieras en su lugar. El proceso es automatizado al obtener armas que ya tengas, o alcances el límite de carga de ciertos ítems.\n" "\n" -"Por favor ten en cuenta que hay un límite impuesto de 999.999.999.999.999.999 puntos, el cual, en la práctica, no debería ser posible alcanzar.\n" +"Por favor ten en cuenta que hay un límite impuesto de 999999999 puntos, el cual, en la práctica, tomaría mucho, mucho tiempo alcanzar.\n" "\n" "\cxNotas de Saya:\c-\n" "\cfVale, voy a ser sincera: Esto es otra cosa de videojuego del friki ese. Pero creo que es algo bueno, en cierto modo. Hay algo en esa sensación tan estimulante de ver los números crecer, sabes, y además puedes pillarte cosas bonitas con eso. A ver es que no puedo ocultártelo pero esto es algo en lo que coincidimos los dos, por tu bien.\c-\n" diff --git a/language.version b/language.version index eb240ec5e..a83f7a83f 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r33 \cu(Sat 16 Apr 02:04:48 CEST 2022)\c-"; -SWWM_SHORTVER="\cw1.3pre r33 \cu(2022-04-16 02:04:48)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r34 \cu(Sun 17 Apr 02:23:29 CEST 2022)\c-"; +SWWM_SHORTVER="\cw1.3pre r34 \cu(2022-04-17 02:23:29)\c-"; diff --git a/lore/default/scoresystem.txt b/lore/default/scoresystem.txt index c6095ec5d..20fb40038 100644 --- a/lore/default/scoresystem.txt +++ b/lore/default/scoresystem.txt @@ -18,7 +18,7 @@ Points are earned through the suppression of hostiles (relative to their threat Carried items may also be refunded for additional points, allowing you to exchange them for anything else you'd prefer instead. This process is automated when obtaining weapons you already possess, or reach the carry limit for certain items. -Please do note that there is an imposed limit of 999,999,999,999,999,999 points, which, in practice, shouldn't even be remotely reachable. +Please do note that there is an imposed limit of 999999999 points, which, in practice, should take a very, very long time to reach. \cxSaya's Notes:\c- \cfAlright, I'll be honest here: This is more videogamey stuff from nerdboy. But I think it's good, in a way. There's something about the rush of seeing the numbers go up, you know, and you can get something nice out of it too. I can't exactly hide this from you but it's something we both agreed on, for your sake.\c- diff --git a/lore/es/scoresystem.txt b/lore/es/scoresystem.txt index 57df586a0..4123d6439 100644 --- a/lore/es/scoresystem.txt +++ b/lore/es/scoresystem.txt @@ -14,7 +14,7 @@ Los puntos se consiguen por medio de la supresión de hostiles (relativos a su n Los ítems obtenidos pueden también reembolsarse por puntos adicionales, permitiendo intercambiarlos por cualquier otra cosa que prefieras en su lugar. El proceso es automatizado al obtener armas que ya tengas, o alcances el límite de carga de ciertos ítems. -Por favor ten en cuenta que hay un límite impuesto de 999.999.999.999.999.999 puntos, el cual, en la práctica, no debería ser posible alcanzar. +Por favor ten en cuenta que hay un límite impuesto de 999999999 puntos, el cual, en la práctica, tomaría mucho, mucho tiempo alcanzar. \cxNotas de Saya:\c- \cfVale, voy a ser sincera: Esto es otra cosa de videojuego del friki ese. Pero creo que es algo bueno, en cierto modo. Hay algo en esa sensación tan estimulante de ver los números crecer, sabes, y además puedes pillarte cosas bonitas con eso. A ver es que no puedo ocultártelo pero esto es algo en lo que coincidimos los dos, por tu bien.\c- diff --git a/zscript/handler/swwm_handler_cheats.zsc b/zscript/handler/swwm_handler_cheats.zsc index 1b885a069..556729054 100644 --- a/zscript/handler/swwm_handler_cheats.zsc +++ b/zscript/handler/swwm_handler_cheats.zsc @@ -28,8 +28,8 @@ extend Class SWWMHandler S_StartSound("menu/buyinv",CHAN_ITEM,CHANF_UI); S_StartSound("misc/emone",CHAN_VOICE,CHANF_UI); } - SWWMCredits.Give(players[e.Args[0]],0,1,true); - SWWMScoreObj.Spawn(1000000000,players[e.Args[0]].mo.Vec3Offset(0,0,players[e.Args[0]].mo.Height/2)); + SWWMCredits.Give(players[e.Args[0]],999999999); + SWWMScoreObj.Spawn(999999999,players[e.Args[0]].mo.Vec3Offset(0,0,players[e.Args[0]].mo.Height/2)); } else if ( e.Name ~== "swwmlorecheat" ) { diff --git a/zscript/handler/swwm_handler_playerevents.zsc b/zscript/handler/swwm_handler_playerevents.zsc index f6c1b59d3..9d658beae 100644 --- a/zscript/handler/swwm_handler_playerevents.zsc +++ b/zscript/handler/swwm_handler_playerevents.zsc @@ -41,13 +41,6 @@ extend Class SWWMHandler } } // create some static thinkers for this player if needed - SWWMTradeHistory th = SWWMTradeHistory.Find(p); - if ( !th ) - { - th = new("SWWMTradeHistory"); - th.ChangeStatNum(Thinker.STAT_STATIC); - th.myplayer = p; - } SWWMCredits c = SWWMCredits.Find(p); if ( !c ) { @@ -138,7 +131,7 @@ extend Class SWWMHandler SWWMCombatTracker.Spawn(players[e.playernumber].mo); // reset score (optional) if inventory should be cleared if ( swwm_resetscore && level.info.flags2&LEVEL2_RESETINVENTORY && !e.IsReturn ) - c.credits = c.hcredits = 0; + c.credits = 0; // re-add any missing collectibles after a death exit (yes, this happens) for ( int i=0; i= ScoreInter.mCurrentValue ) ScoreInter2.Update(s2); + ScoreInter.Update(SWWMCredits.Get(CPlayer)); } override void Tick() @@ -1215,9 +1212,7 @@ Class SWWMStatusBar : BaseStatusBar HealthTex[3] = TexMan.CheckForTexture("graphics/HUD/HealthBar3.png",TexMan.Type_Any); HealthTex[4] = TexMan.CheckForTexture("graphics/HUD/HealthBarS.png",TexMan.Type_Any); HealthTex[5] = TexMan.CheckForTexture("graphics/HUD/HealthBarD.png",TexMan.Type_Any); - ScoreTex[0] = TexMan.CheckForTexture("graphics/HUD/ScoreBoxL.png",TexMan.Type_Any); - ScoreTex[1] = TexMan.CheckForTexture("graphics/HUD/ScoreBoxM.png",TexMan.Type_Any); - ScoreTex[2] = TexMan.CheckForTexture("graphics/HUD/ScoreBoxR.png",TexMan.Type_Any); + ScoreTex = TexMan.CheckForTexture("graphics/HUD/ScoreBox.png",TexMan.Type_Any); WeaponTex = TexMan.CheckForTexture("graphics/HUD/WeaponBox.png",TexMan.Type_Any); ChatTex[0] = TexMan.CheckForTexture("graphics/HUD/ChatBoxTop.png",TexMan.Type_Any); ChatTex[1] = TexMan.CheckForTexture("graphics/HUD/ChatBoxLine.png",TexMan.Type_Any); @@ -1245,7 +1240,6 @@ Class SWWMStatusBar : BaseStatusBar minimapzoom = oldminimapzoom = 1.; HealthInter = DynamicValueInterpolator.Create(100,.1,1,100); ScoreInter = DynamicValueInterpolator.Create(0,.1,1,999999999); - ScoreInter2 = DynamicValueInterpolator.Create(0,.1,1,999999999); FuelInter = DynamicValueInterpolator.Create(120,.5,1,100); DashInter = DynamicValueInterpolator.Create(120,.5,1,40); hnd = SWWMHandler(EventHandler.Find("SWWMHandler")); @@ -2201,20 +2195,11 @@ Class SWWMStatusBar : BaseStatusBar private void DrawScore() { - String sstr; - if ( ScoreInter2.GetValue() > 0 ) sstr = String.Format("%d%09d",ScoreInter2.GetValue(),ScoreInter.GetValue()); - else sstr = String.Format("%09d",ScoreInter.GetValue()); - int digits = sstr.Length(); - int xx = 19+6*digits; - Screen.DrawTexture(ScoreTex[0],false,ss.x-(margin+xx),margin,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + String sstr = String.Format("%09d",ScoreInter.GetValue()); + int xx = 73; + Screen.DrawTexture(ScoreTex,false,ss.x-(margin+xx),margin,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); xx -= 15; - for ( int i=0; i 0 ) munstr.AppendFormat("%d",muns2); - munstr.AppendFormat("%09d",muns1); + muns = SWWMCredits.Get(players[consoleplayer]); + munstr = String.Format("\cg¥\c-%09d",muns); if ( (tabs.Size() <= 0) || (curtab == -1) || !tabs[curtab] ) return; tabs[curtab].Ticker(); } diff --git a/zscript/kbase/swwm_kbasetab_stats.zsc b/zscript/kbase/swwm_kbasetab_stats.zsc index 740ab2401..76fa32dcd 100644 --- a/zscript/kbase/swwm_kbasetab_stats.zsc +++ b/zscript/kbase/swwm_kbasetab_stats.zsc @@ -308,8 +308,7 @@ Class DemolitionistStatsTab : DemolitionistMenuTab str = str..def.GetTag(); } lists[0].items[29].label = str; - if ( stats.hhiscore > 0 ) str = String.Format("\cx%s\cu¥\c-%d%09d",StringTable.Localize("$SWWM_STATHISCORE"),stats.hhiscore,stats.hiscore); - else str = String.Format("\cx%s\cu¥\c-%09d",StringTable.Localize("$SWWM_STATHISCORE"),stats.hiscore); + str = String.Format("\cx%s\cu¥\c-%09d",StringTable.Localize("$SWWM_STATHISCORE"),stats.hiscore); lists[0].items[30].label = str; break; case 1: diff --git a/zscript/kbase/swwm_kbasetab_store.zsc b/zscript/kbase/swwm_kbasetab_store.zsc index 9b19bb3eb..e8c343a5e 100644 --- a/zscript/kbase/swwm_kbasetab_store.zsc +++ b/zscript/kbase/swwm_kbasetab_store.zsc @@ -548,15 +548,14 @@ Class DemolitionistMenuStoreItem : DemolitionistMenuListItem let def = GetDefaultByType(inv); if ( bSell ) { - pricelabel = String.Format("\cd¥%d\c-",price); + pricelabel = String.Format("\cd¥\c-",price); int cur = (inv is 'CandyGun')?(players[consoleplayer].mo.CountInv("CandyGunSpares")+1):players[consoleplayer].mo.CountInv(inv); if ( (cur > 1) || (inv is 'Ammo') ) label = String.Format("%s (%d/%d)",def.GetTag(),amt,cur); else label = def.GetTag(); } else { - if ( (price > master.muns1) && (master.muns2 <= 0) ) - pricelabel = String.Format("\cm¥%d\c-",price); + if ( price > master.muns ) pricelabel = String.Format("\cm¥%d\c-",price); else pricelabel = String.Format("\cx¥%d\cx",price); if ( (amt > 1) || (inv is 'Ammo') ) label = String.Format("%dx %s",amt,def.GetTag()); else label = def.GetTag(); diff --git a/zscript/swwm_thinkers_player.zsc b/zscript/swwm_thinkers_player.zsc index 65bcc20ed..a61876155 100644 --- a/zscript/swwm_thinkers_player.zsc +++ b/zscript/swwm_thinkers_player.zsc @@ -112,7 +112,7 @@ Class SWWMStats : Thinker PlayerInfo myplayer; int lastspawn, dashcount, boostcount, stompcount, airtime, kills, deaths, damagedealt, hdamagedealt, damagetaken, hdamagetaken, - mkill, hiscore, hhiscore, topdealt, toptaken, skill, wponch, + mkill, hiscore, topdealt, toptaken, skill, wponch, busts, buttslams, secrets, items, parries, pparries, pats, befriend, smooch; double grounddist, airdist, swimdist, fuelusage, topspeed, teledist; @@ -293,44 +293,29 @@ Class SWWMStats : Thinker Class SWWMCredits : Thinker { PlayerInfo myplayer; - int credits, hcredits; + int credits; - static void Give( PlayerInfo p, int amount, int hamount = 0, bool cheat = false ) + static void Give( PlayerInfo p, int amount ) { let c = Find(p); if ( !c ) return; - if ( c.credits+amount < c.credits ) c.credits = int.max; - else c.credits += amount; - while ( c.credits > 999999999 ) - { - c.credits -= 1000000000; - c.hcredits++; - } - if ( (c.hcredits+hamount < c.hcredits) || (c.hcredits+hamount > 999999999) ) c.hcredits = 999999999; - else c.hcredits += hamount; + // safeguard + if ( amount < 0 ) ThrowAbortException("SWWMCredits.Give() called with negative amount"); + if ( c.credits+amount < c.credits ) c.credits = 999999999; + else c.credits = min(999999999,c.credits+amount); let s = SWWMStats.Find(p); - if ( s && ((c.hcredits > s.hhiscore) || ((c.credits > s.hiscore) && (c.hcredits >= s.hhiscore))) ) - { - s.hiscore = c.credits; - s.hhiscore = c.hcredits; - } + if ( s && (c.credits > s.hiscore) ) s.hiscore = c.credits; SWWMLoreLibrary.Add(p,"ScoreSystem"); } - static clearscope bool CanTake( PlayerInfo p, int amount, int hamount = 0 ) + static clearscope bool CanTake( PlayerInfo p, int amount ) { let c = Find(p); if ( !c ) return false; - int req = amount, hreq = hamount; - while ( req > 999999999 ) - { - req -= 1000000000; - hreq++; - } - // waaaaay too much - if ( (c.hcredits-hreq < 0) || (c.hcredits-hreq > c.hcredits) ) return false; + // safeguard + if ( amount < 0 ) ThrowAbortException("SWWMCredits.CanTake() called with negative amount"); // too much! - if ( ((c.credits-amount < 0) || (c.credits-amount > c.credits)) && (c.hcredits-hreq <= 0) ) return false; + if ( (amount > 999999999) || (c.credits-amount < 0) || (c.credits-amount > c.credits) ) return false; return true; } @@ -338,31 +323,19 @@ Class SWWMCredits : Thinker { let c = Find(p); if ( !c ) return false; - int req = amount, hreq = hamount; - while ( req > 999999999 ) - { - req -= 1000000000; - hreq++; - } - // waaaaay too much - if ( (c.hcredits-hreq < 0) || (c.hcredits-hreq > c.hcredits) ) return false; + // safeguard + if ( amount < 0 ) ThrowAbortException("SWWMCredits.Take() called with negative amount"); // too much! - if ( ((c.credits-amount < 0) || (c.credits-amount > c.credits)) && (c.hcredits-hreq <= 0) ) return false; - c.hcredits -= hreq; - c.credits -= req; - while ( c.credits < 0 ) - { - c.credits += 1000000000; - c.hcredits--; - } + if ( (amount > 999999999) || (c.credits-amount < 0) || (c.credits-amount > c.credits) ) return false; + c.credits -= amount; return true; } - static clearscope int, int Get( PlayerInfo p ) + static clearscope int Get( PlayerInfo p ) { let c = Find(p); if ( !c ) return 0; - return c.credits, c.hcredits; + return c.credits; } static clearscope SWWMCredits Find( PlayerInfo p ) @@ -378,57 +351,6 @@ Class SWWMCredits : Thinker } } -// Trading history between players -Class SWWMTrade -{ - int timestamp, type, amt; - String other; - Class what; -} - -Class SWWMTradeHistory : Thinker -{ - PlayerInfo myplayer; - Array ent; - - static void RegisterSend( PlayerInfo p, PlayerInfo other, Class what, int amt ) - { - let th = Find(p); - if ( !th ) return; - SWWMTrade t = new("SWWMTrade"); - t.timestamp = level.totaltime; - t.type = 0; - t.other = other.GetUserName(); - t.what = what; - t.amt = amt; - th.ent.Push(t); - } - static void RegisterReceive( PlayerInfo p, PlayerInfo other, Class what, int amt ) - { - let th = Find(p); - if ( !th ) return; - SWWMTrade t = new("SWWMTrade"); - t.timestamp = level.totaltime; - t.type = 1; - t.other = other.GetUserName(); - t.what = what; - t.amt = amt; - th.ent.Push(t); - } - - static clearscope SWWMTradeHistory Find( PlayerInfo p ) - { - let ti = ThinkerIterator.Create("SWWMTradeHistory",STAT_STATIC); - SWWMTradeHistory th; - while ( th = SWWMTradeHistory(ti.Next()) ) - { - if ( th.myplayer != p ) continue; - return th; - } - return Null; - } -} - // Lore holder enum ELoreTab { diff --git a/zscript/utility/swwm_utility.zsc b/zscript/utility/swwm_utility.zsc index b61e142e5..4030b04e2 100644 --- a/zscript/utility/swwm_utility.zsc +++ b/zscript/utility/swwm_utility.zsc @@ -241,7 +241,7 @@ Class SWWMUtility } // not sure if I should use this, looks a bit ugly - static clearscope void ThousandsStr( out String s ) + static clearscope void ThousandsStr( out String s, int col = -1 ) { String nstr = s; s.Truncate(0); @@ -255,13 +255,27 @@ Class SWWMUtility s.AppendCharacter(ch); t = (t-1)%3; if ( (pos < len) && !t ) - s.AppendCharacter(0x2C); // comma + { + if ( col != -1 ) + { + s.AppendCharacter(0x1C); + s.AppendCharacter(0x61+col); + } + s.AppendCharacter(0x2C); + if ( col != -1 ) + { + s.AppendCharacter(0x1C); + s.AppendCharacter(0x2D); + } + } } } - static clearscope String ThousandsNum( int n ) + static clearscope String ThousandsNum( int n, int col = -1, int digits = 0 ) { - String nstr = String.Format("%d",n); - ThousandsStr(nstr); + String nstr; + if ( digits > 0 ) nstr = String.Format("%0*d",digits,n); + else nstr = String.Format("%d",n); + ThousandsStr(nstr,col); return nstr; } @@ -1889,7 +1903,7 @@ Class SWWMUtility PlayerInfo p = mo.player; if ( !p || !p.mo ) return; SWWMCredits c = SWWMCredits.Find(p); - if ( resetscore && c ) c.hcredits = c.credits = 0; + if ( resetscore && c ) c.credits = 0; Actor last = p.mo; while ( last.inv ) {