Score limit has been capped to 9 digits.

Turns out anything higher is not actually reachable in practice.
This commit is contained in:
Mari the Deer 2022-04-17 02:23:29 +02:00
commit 404ad8c722
18 changed files with 62 additions and 152 deletions

BIN
graphics/HUD/ScoreBox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

View file

@ -3239,7 +3239,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"

View file

@ -2993,7 +2993,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"

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.2.10 r2 \cu(Sun 17 Apr 19:51:29 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.2.10 r2 \cu(2022-04-17 19:51:29)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.2.10 r3 \cu(Sun 17 Apr 19:51:50 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.2.10 r3 \cu(2022-04-17 19:51:50)\c-";

View file

@ -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-

View file

@ -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-

View file

@ -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" )
{

View file

@ -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<s.ownedcollectibles.Size(); i++ )
{

View file

@ -102,7 +102,7 @@ extend Class SWWMHandler
{
if ( !playeringame[i] || (players[i].playerstate != PST_DEAD) ) continue;
let c = SWWMCredits.Find(players[i]);
if ( c ) c.credits = c.hcredits = 0;
if ( c ) c.credits = 0;
}
// end of episode resets and enforced pistol starts
LevelInfo nextlv = LevelInfo.FindLevelInfo(e.NextMap);

View file

@ -30,7 +30,7 @@ Class MsgLine
Class SWWMStatusBar : BaseStatusBar
{
TextureID StatusTex, WeaponTex, ScoreTex[3], InventoryTex, ChatTex[6],
TextureID StatusTex, WeaponTex, ScoreTex, InventoryTex, ChatTex[6],
HealthTex[6], FuelTex[2], DashTex, EnemyBTex, EnemyHTex[6],
GenericAmmoTex[3], MiniBox, AutoPage, bgtex;
@ -75,7 +75,7 @@ Class SWWMStatusBar : BaseStatusBar
// projection data cache
SWWMProjectionData projdata;
DynamicValueInterpolator HealthInter, ScoreInter, ScoreInter2, FuelInter, DashInter;
DynamicValueInterpolator HealthInter, ScoreInter, FuelInter, DashInter;
Inventory lastsel;
Weapon lastwep;
@ -939,10 +939,7 @@ Class SWWMStatusBar : BaseStatusBar
{
HealthInter.Update(CPlayer.health);
if ( !hnd ) hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
int s1, s2;
[s1, s2] = SWWMCredits.Get(CPlayer);
ScoreInter.Update(s1);
if ( ScoreInter.GetValue() >= 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<digits; i++ )
{
Screen.DrawTexture(ScoreTex[1],false,ss.x-(margin+xx),margin,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
xx -= 6;
}
Screen.DrawTexture(ScoreTex[2],false,ss.x-(margin+xx),margin,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawText(mSmallFont,Font.CR_FIRE,ss.x-(margin+4+6*digits),margin+2,sstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawText(mSmallFont,Font.CR_FIRE,ss.x-(margin+xx),margin+2,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 ( !automapactive && swwm_mm_enable )

View file

@ -42,7 +42,7 @@ Class DemolitionistMenu : GenericMenu
String tmsg;
int tmsgtic;
// money owned, for store
int muns1, muns2;
int muns;
// other text
String clockstr, munstr;
// menu keybind
@ -327,10 +327,8 @@ Class DemolitionistMenu : GenericMenu
// update time string
clockstr = CrimeTime();
// update money
[muns1, muns2] = SWWMCredits.Get(players[consoleplayer]);
munstr = "\cg¥\c-";
if ( muns2 > 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();
}

View file

@ -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:

View file

@ -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();

View file

@ -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;
@ -292,44 +292,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;
}
@ -337,31 +322,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 )
@ -377,57 +350,6 @@ Class SWWMCredits : Thinker
}
}
// Trading history between players
Class SWWMTrade
{
int timestamp, type, amt;
String other;
Class<Inventory> what;
}
Class SWWMTradeHistory : Thinker
{
PlayerInfo myplayer;
Array<SWWMTrade> ent;
static void RegisterSend( PlayerInfo p, PlayerInfo other, Class<Inventory> 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<Inventory> 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
{

View file

@ -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 )
{