Cleaning up various debug prints.

This commit is contained in:
Mari the Deer 2023-12-26 11:41:49 +01:00
commit 1a0b5b6d07
7 changed files with 62 additions and 57 deletions

View file

@ -258,7 +258,7 @@ Class SWWMHandler : EventHandler
bprofiletics,(bprofiletics>1)?"s":"");
for ( int i=0; i<8; i++ )
str.AppendFormat(" %s | %6d | %11.6f | %11.6f\n",prof_name[i],prof_calls[i],prof_ms[i],prof_avg[i]);
Console.Printf(str);
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,str);
}
override void PostUiTick()

View file

@ -76,7 +76,7 @@ Class SWWMStaticHandler : StaticEventHandler
while ( t = sti.Next() ) stinkers.Push(t);
if ( stinkers.Size() > 0 )
{
foreach ( s:stinkers ) Console.Printf("%s is not STAT_STATIC!",s.GetClassName());
foreach ( s:stinkers ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"%s is not STAT_STATIC!",s.GetClassName());
ThrowAbortException("Panic! %d static thinker%s been tampered with!",stinkers.Size(),(stinkers.Size()==1)?" has":"s have");
}
}
@ -181,7 +181,7 @@ Class SWWMStaticHandler : StaticEventHandler
}
// warning for unsupported
if ( Wads.FindLumpFullName("swwmgamesupported",0,true) != -1 ) return;
Console.Printf(
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,
"\cx┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\c-\n"
"\cx┃ \cr[\cgWARNING\cr] \cx┃\c-\n"
"\cx┃ \chSWWM \czGZ \cjis \cfNOT\cj compatible with the loaded IWAD. \cx┃\c-\n"
@ -257,7 +257,7 @@ Class SWWMStaticHandler : StaticEventHandler
foreach ( cv:cvarlist )
{
let rcv = CVar.FindCVar(cv);
Console.Printf(cv.." = "..rcv.GetString());
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,cv.." = "..rcv.GetString());
}
}
else if ( e.Name ~== "swwmgetplaytime" )
@ -284,8 +284,8 @@ Class SWWMStaticHandler : StaticEventHandler
if ( str != "" ) str = str..", ";
str.AppendFormat("%d seconds",sec);
}
if ( str == "" ) Console.Printf("No Data");
else Console.Printf(str);
if ( str == "" ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"No Data");
else Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,str);
}
else if ( e.Name ~== "swwmresetachievements" )
{
@ -298,23 +298,23 @@ Class SWWMStaticHandler : StaticEventHandler
}
else if ( e.Name ~== "swwmdumpachievements" )
{
Console.Printf("---STATE---");
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"---STATE---");
let di = DictionaryIterator.Create(achievementstate);
while ( di.Next() )
Console.Printf("%s = %s",di.Key(),di.Value());
Console.Printf("---PROGRESS---");
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"%s = %s",di.Key(),di.Value());
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"---PROGRESS---");
di = DictionaryIterator.Create(achievementprogress);
while ( di.Next() )
Console.Printf("%s = %s",di.Key(),di.Value());
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"%s = %s",di.Key(),di.Value());
}
else if ( e.Name ~== "swwmgetversion" )
{
let ti = ThinkerIterator.Create("SWWMSaveVerData",Thinker.STAT_STATIC);
let svd = SWWMSaveVerData(ti.Next());
if ( svd ) Console.Printf("\cj%s\c-",svd.ver);
else Console.Printf("\cg(no version data)\c-");
if ( tainted ) Console.Printf("\cgversion mismatched\c-");
else Console.Printf("\cdversion not mismatched\c-");
if ( svd ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cj%s\c-",svd.ver);
else Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cg(no version data)\c-");
if ( tainted ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cgversion mismatched\c-");
else Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cdversion not mismatched\c-");
}
else if ( e.Name ~== "swwmdumpthinkers" )
{
@ -353,7 +353,7 @@ Class SWWMStaticHandler : StaticEventHandler
ti.Destroy();
}
for ( int i=0; i<sdefs.Size(); i++ )
Console.Printf("%s%s%s\c-",stink[i]?"\cj":"\cu",sdefs[i].GetClassName(),(stink[i]>1)?String.Format(" [%d]",stink[i]):"");
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"%s%s%s\c-",stink[i]?"\cj":"\cu",sdefs[i].GetClassName(),(stink[i]>1)?String.Format(" [%d]",stink[i]):"");
}
else if ( e.Name ~== "swwmdumphandlers" )
{
@ -362,7 +362,7 @@ Class SWWMStaticHandler : StaticEventHandler
if ( !(cls is 'StaticEventHandler') || (cls == 'StaticEventHandler') || (cls == 'EventHandler') )
continue;
bool reg = (cls is 'EventHandler')?EventHandler.Find((Class<EventHandler>)(cls)):StaticEventHandler.Find((Class<StaticEventHandler>)(cls));
Console.Printf("%s%s\c-",reg?"\cj":"\cu",cls.GetClassName());
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"%s%s\c-",reg?"\cj":"\cu",cls.GetClassName());
}
}
else if ( e.Name ~== "swwmtestdlgsize" )
@ -374,7 +374,7 @@ Class SWWMStaticHandler : StaticEventHandler
String dat = Wads.ReadLump(lmp);
dat.Split(lst,"\n",0);
bool skipme = true;
Console.Printf("[default]");
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"[default]");
bool fail = false;
foreach ( l:lst )
{
@ -391,18 +391,18 @@ Class SWWMStaticHandler : StaticEventHandler
BrokenLines bl = f.BreakLines(line,220);
if ( bl.Count() > 4 )
{
Console.Printf("\cg%s [%d]\c-",l.Left(st-4),bl.Count());
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cg%s [%d]\c-",l.Left(st-4),bl.Count());
fail = true;
}
bl.Destroy();
}
if ( !fail ) Console.Printf("ALL OK");
if ( !fail ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"ALL OK");
lmp = Wads.FindLumpFullName("language.es_dlg");
lst.Clear();
dat = Wads.ReadLump(lmp);
dat.Split(lst,"\n",0);
skipme = true;
Console.Printf("[es]");
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"[es]");
foreach ( l:lst )
{
if ( l.Left(7) == "// E1M8" ) skipme = false;
@ -418,19 +418,19 @@ Class SWWMStaticHandler : StaticEventHandler
BrokenLines bl = f.BreakLines(line,220);
if ( bl.Count() > 4 )
{
Console.Printf("\cg%s [%d]\c-",l.Left(st-4),bl.Count());
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cg%s [%d]\c-",l.Left(st-4),bl.Count());
fail = true;
}
bl.Destroy();
}
if ( !fail ) Console.Printf("ALL OK");
if ( !fail ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"ALL OK");
}
else if ( e.Name ~== "swwmvalidatedlgfiles" )
{
for ( int lmp = Wads.FindLumpFullName("swwmdialogue",0,true); lmp != -1; lmp = Wads.FindLumpFullName("swwmdialogue",lmp+1,true) )
{
Console.Printf("\ce-- PARSING FILE \cf'%s'\ce...\c-",Wads.GetLumpFullName(lmp));
Console.Printf("");
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\ce-- PARSING FILE \cf'%s'\ce...\c-",Wads.GetLumpFullName(lmp));
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"");
String dat = Wads.ReadLump(lmp);
dat.Replace("\r",""); // just in case
Array<String> lines;
@ -465,7 +465,7 @@ Class SWWMStaticHandler : StaticEventHandler
if ( !indlg ) ThrowAbortException("line %d, 'ENDDLG' found without start of dialogue.",cur+1);
if ( inseq ) ThrowAbortException("dialogue '%s', line %d, premature end of sequence %d.",sdlg,cur+1,nseq);
if ( !gotseq ) ThrowAbortException("dialogue '%s', line %d, dialogue is empty.",sdlg,cur+1);
Console.Printf("");
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"");
indlg = false;
cur++;
continue;
@ -475,7 +475,7 @@ Class SWWMStaticHandler : StaticEventHandler
if ( lines[cur].Left(4) == "DLG " )
{
sdlg = lines[cur].Mid(4);
Console.Printf("\cqdialogue \cd'%s'\cq:\c-",sdlg);
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cqdialogue \cd'%s'\cq:\c-",sdlg);
indlg = true;
nseq = 1;
cur++;
@ -492,15 +492,15 @@ Class SWWMStaticHandler : StaticEventHandler
// put out the sequence
if ( sname == "" ) ThrowAbortException("dialogue '%s', line %d, sequence %d has no name.",sdlg,cur+1,nseq);
if ( scnt <= 0 ) ThrowAbortException("dialogue '%s', line %d, sequence %d has invalid count.",sdlg,cur+1,nseq);
Console.Printf(" \cqsequence \cd%d\cq with character \cd'%s'\cq, name \cd'%s'\cq:\c-",nseq,schr,sname);
if ( sdelay > 0 ) Console.Printf(" \cqdelay: \cd%d\c-",sdelay);
if ( sstartdelay > 0 ) Console.Printf(" \cqstartdelay: \cd%d\c-",sstartdelay);
if ( senddelay > 0 ) Console.Printf(" \cqenddelay: \cd%d\c-",senddelay);
if ( schardelay > 0 ) Console.Printf(" \cqchardelay: \cd%d\c-",schardelay);
if ( spausedelay > 0 ) Console.Printf(" \cqpausedelay: \cd%d\c-",spausedelay);
if ( sznvspecial ) Console.Printf(" \cq+\cdznvspecial\c-");
if ( sindirect ) Console.Printf(" \cq+\cdindirect\c-");
Console.Printf(" \cqcount: \cd%d\c-\n\cd---\c-",scnt);
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY," \cqsequence \cd%d\cq with character \cd'%s'\cq, name \cd'%s'\cq:\c-",nseq,schr,sname);
if ( sdelay > 0 ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY," \cqdelay: \cd%d\c-",sdelay);
if ( sstartdelay > 0 ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY," \cqstartdelay: \cd%d\c-",sstartdelay);
if ( senddelay > 0 ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY," \cqenddelay: \cd%d\c-",senddelay);
if ( schardelay > 0 ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY," \cqchardelay: \cd%d\c-",schardelay);
if ( spausedelay > 0 ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY," \cqpausedelay: \cd%d\c-",spausedelay);
if ( sznvspecial ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY," \cq+\cdznvspecial\c-");
if ( sindirect ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY," \cq+\cdindirect\c-");
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY," \cqcount: \cd%d\c-\n\cd---\c-",scnt);
for ( int i=0; i<scnt; i++ )
{
String ln = StringTable.Localize("$SWWM_"..sname..(i+1));
@ -509,7 +509,7 @@ Class SWWMStaticHandler : StaticEventHandler
int nyears = SystemTime.Format("%Y",SystemTime.Now()).ToInt()-2010;
ln = String.Format(ln,nyears);
}
Console.Printf("%s\n\cd---\c-",ln);
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"%s\n\cd---\c-",ln);
}
gotseq = true;
inseq = false;
@ -587,8 +587,8 @@ Class SWWMStaticHandler : StaticEventHandler
}
if ( indlg ) ThrowAbortException("line %d, premature end of file reached for dialogue '%s'",cur+1,sdlg);
if ( inseq ) ThrowAbortException("dialogue '%s', line %d, premature end of file reached for sequence %d",sdlg,cur+1,nseq);
Console.Printf("\ce-- END OF FILE \cf'%s'\ce...\c-",Wads.GetLumpFullName(lmp));
Console.Printf("");
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\ce-- END OF FILE \cf'%s'\ce...\c-",Wads.GetLumpFullName(lmp));
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"");
}
}
else if ( e.Name ~== "swwmdumpmonsters" )
@ -606,10 +606,10 @@ Class SWWMStaticHandler : StaticEventHandler
if ( !bLastVanilla ) continue;
let def = GetDefaultByType(cls);
if ( !def.bISMONSTER && !def.bCOUNTKILL ) continue;
Console.Printf("%s [%s]",def.GetClassName(),def.GetTag("NO TAG"));
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"%s [%s]",def.GetClassName(),def.GetTag("NO TAG"));
i++;
}
Console.Printf("\n%d estimated monsters defined.",i);
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\n%d estimated monsters defined.",i);
}
}
@ -685,7 +685,7 @@ Class SWWMStaticHandler : StaticEventHandler
msgpick = Random[UIStuff](1,8);
String str = StringTable.Localize("$CRASHMSG"..msgpick.."A");
if ( isvkdoom ) str.Replace("GZDoom","VKDoom");
Console.Printf("\cf%s\c-",str);
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cf%s\c-",str);
let hnd = SWWMBrutalHandler(StaticEventHandler.Find("SWWMBrutalHandler"));
if ( hnd && hnd.detected )
{
@ -698,15 +698,15 @@ Class SWWMStaticHandler : StaticEventHandler
{
String str = StringTable.Localize("$CRASHMSG"..msgpick.."B");
if ( isvkdoom ) str.Replace("GZDoom","VKDoom");
Console.Printf("\cf%s\c-",str);
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cf%s\c-",str);
S_StartSound("crash/curb",CHAN_YABLEWIT,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1,ATTN_NONE);
}
else if ( timer == 140 )
{
if ( isbd ) Console.Printf("\cfYou shouldn't have tried running this with "..bdname..".\c-");
else Console.Printf("\cfYou should probably screenshot this error and show it to Marisa.\c-");
Console.Printf("\cfLoaded Version:\n \cj%s\c-",StringTable.Localize("$SWWM_SHORTVER"));
if ( tainted ) Console.Printf("\cfSavegame Version:\n \cj%s\c-",taintver);
if ( isbd ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cfYou shouldn't have tried running this with "..bdname..".\c-");
else Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cfYou should probably screenshot this error and show it to Marisa.\c-");
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cfLoaded Version:\n \cj%s\c-",StringTable.Localize("$SWWM_SHORTVER"));
if ( tainted ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cfSavegame Version:\n \cj%s\c-",taintver);
}
timer++;
}