Fix VM abort in Omnisight due to cvar name change.

More minimap tweakery.
Visual cheat input.
Add cheat to de-aggro monsters.
This commit is contained in:
Mari the Deer 2021-02-23 19:10:08 +01:00
commit 9460e3a13c
5 changed files with 87 additions and 19 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r304 \cu(Tue 23 Feb 02:41:02 CET 2021)\c-";
SWWM_SHORTVER="\cw0.9.11b-pre r304 \cu(2021-02-23 02:41:02)\c-";
SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r305 \cu(Tue 23 Feb 19:10:08 CET 2021)\c-";
SWWM_SHORTVER="\cw0.9.11b-pre r305 \cu(2021-02-23 19:10:08)\c-";

View file

@ -266,8 +266,9 @@ Class SWWMHandler : EventHandler
int lastorder;
bool lastloop;
// for custom cheats
transient ui int kcode;
transient ui String kstr;
transient ui int kcode, klinger;
transient ui String kstr, klingerstr;
transient ui bool kfail;
// heal/armor flashes need to be handled here so they don't stack
transient int hflash[MAXPLAYERS], aflash[MAXPLAYERS];
@ -1481,9 +1482,6 @@ Class SWWMHandler : EventHandler
while ( trk )
{
SWWMSimpleTracker next = trk.next;
// reduce sight counter
if ( trk.lastupdate < level.maptime )
trk.sightcount = max(0,trk.sightcount-1);
// minimize lifespan of destroyed targets
if ( !trk.target ) trk.lastupdate = min(trk.lastupdate,level.maptime);
else if ( !trk.expired )
@ -2513,7 +2511,7 @@ Class SWWMHandler : EventHandler
// cheat code handling
String cht[] =
{
"swwmlodsofemone", "swwmdeeplore", "swwmfroggygang",
"swwmlodsofemone", "swwmdeeplore", "swwmfroggygang", "swwmforgetaboutit",
// SWWM Platinum cheats
"swwmimstuck", "swwmarmojumbo", "swwmdangimhealthy",
"swwmwarriorofzaemonath", "swwmpowerparp", "swwmcannotseemyhands",
@ -2525,7 +2523,7 @@ Class SWWMHandler : EventHandler
};
String cmd[] =
{
"swwmmoneycheat", "swwmlorecheat", "swwmfroggycheat",
"swwmmoneycheat", "swwmlorecheat", "swwmfroggycheat", "swwmamnesiacheat",
// SWWM Platinum cheats
"swwmsafecheat", "swwmweaponcheat", "swwmhealcheat",
"swwmynykroncheat", "swwmgravcheat", "swwminvischeat",
@ -2545,14 +2543,27 @@ Class SWWMHandler : EventHandler
matchany = true;
if ( kstr != cht[i] ) continue;
SendNetworkEvent(cmd[i],consoleplayer);
kfail = false;
klinger = gametic+60;
klingerstr = kstr;
kcode = 0;
kstr = "";
return true;
}
if ( !matchany )
{
bool eatit = false;
if ( kcode >= 4 )
{
kfail = true;
klinger = gametic+40;
klingerstr = kstr;
S_StartSound("bruh",CHAN_VOICE,CHANF_UI);
eatit = true;
}
kcode = 0;
kstr = "";
if ( eatit ) return true;
}
else
{
@ -3369,6 +3380,7 @@ Class SWWMHandler : EventHandler
Console.Printf("Sparkster: %d",Random2[Sparkster]());
Console.Printf("Spread: %d",Random2[Spread]());
Console.Printf("Spreadgun: %d",Random2[Spreadgun]());
Console.Printf("TextShake: %d",Random2[TextShake]());
Console.Printf("TUID: %d",Random2[TUID]());
Console.Printf("Wallbuster: %d",Random2[Wallbuster]());
Console.Printf("WallbusterMenu: %d",Random2[WallbusterMenu]());
@ -4007,6 +4019,24 @@ Class SWWMHandler : EventHandler
f.Spawn("SWWMItemFog",f.pos);
f.A_StartSound("bestsound",CHAN_ITEMEXTRA);
}
else if ( e.Name ~== "swwmamnesiacheat" )
{
if ( SWWMUtility.CheatsDisabled(e.Args[0]) )
return;
if ( consoleplayer == e.Args[0] )
{
Console.Printf("\cyAmnesiacs administered\c-");
S_StartSound("misc/buyinv",CHAN_ITEM,CHANF_UI);
S_StartSound("bestsound",CHAN_VOICE,CHANF_UI);
}
let ti = ThinkerIterator.Create("Actor");
Actor a;
while ( a = Actor(ti.Next()) )
{
if ( !a.bIsMonster || a.player ) continue;
a.A_ClearTarget();
}
}
}
// stuff for hud
@ -4077,6 +4107,30 @@ Class SWWMHandler : EventHandler
// various shaders
override void RenderOverlay( RenderEvent e )
{
// cheat input
if ( (kcode > 4) || ((klinger > gametic) && (klingerstr != "")) )
{
double hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/266.)),1.);
Vector2 ss = (Screen.GetWidth(),Screen.GetHeight())/hs;
String chstr = (kcode>4)?kstr.Mid(4):klingerstr.Mid(4);
double alph = clamp((klinger-(gametic+e.fractic))/20.,0.,1.);
double shine = clamp((klinger-(gametic+e.fractic+40))/20.,0.,1.);
int col = (kcode>4)?0:(kfail)?2:1;
int tlen = chstr.CodePointCount();
let fnt = newsmallfont;
int width = fnt.StringWidth(chstr)+(tlen-1);
int xx = int((ss.x-width)/2.);
int yy = int((ss.y-newsmallfont.GetHeight())/2.);
for ( int i=0, pos=0; i<tlen; i++ )
{
int ch;
[ch, pos] = chstr.GetNextCodePoint(pos);
if ( col == 0 ) Screen.DrawChar(fnt,Font.CR_DARKGRAY,xx+FRandom[TextShake](-1,1),yy+FRandom[TextShake](-1,1),ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
else if ( col == 1 ) Screen.DrawChar(fnt,Font.CR_SAPPHIRE,xx,yy,ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ColorOverlay,Color(int(shine*255),255,255,255));
else if ( col == 2 ) Screen.DrawChar(fnt,Font.CR_RED,xx,yy+abs(cos(i*74.3)*8.)*(1.-alph),ch,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
xx += newsmallfont.GetCharWidth(ch)+1;
}
}
PlayerInfo p = players[consoleplayer];
let mo = p.mo;
if ( !mo ) return;

View file

@ -35,6 +35,8 @@ Class SWWMStatusBar : BaseStatusBar
Vector2 ssd, hsd;
int margin;
double FracTic;
double FrameTime;
int PrevFrame;
int chatopen;
bool camhidden;
@ -645,6 +647,7 @@ Class SWWMStatusBar : BaseStatusBar
sw_proj = new("swwmLe__SWScreen");
PrepareProjection();
hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
PrevFrame = MSTime();
}
static private string FormatDist( double dist )
@ -1368,9 +1371,6 @@ Class SWWMStatusBar : BaseStatusBar
}
int mtime = 35;
if ( thesight && !t.expired && t.target ) mtime += 105;
double alph = clamp(((t.lastupdate+mtime)-level.maptime)/35.,0.,1.);
alph *= min(1.,t.sightcount/10.);
if ( alph <= 0. ) continue;
Vector2 rv = pos-cpos;
if ( min(abs(rv.x)-radius,abs(rv.y)-radius) > zoomview )
continue;
@ -1405,7 +1405,7 @@ Class SWWMStatusBar : BaseStatusBar
for ( int j=0; j<nidx; j++ ) tv[j].y *= -1;
// rotate by view
if ( swwm_mm_rotate ) for ( int j=0; j<nidx; j++ ) tv[j] = Actor.RotateVector(tv[j],ViewRot.x-90);
bool visible;
bool visible, drawn;
Vector2 x0, x1;
// clip to frame
for ( int j=0; j<nidx; j++ )
@ -1420,9 +1420,17 @@ Class SWWMStatusBar : BaseStatusBar
x0 += basepos;
x1 += basepos;
// draw the line
Screen.DrawThickLine(int(x0.x),int(x0.y),int(x1.x),int(x1.y),max(1.,hs.x*.5),col,int(alph*255));
Screen.DrawThickLine(int(x0.x),int(x0.y),int(x1.x),int(x1.y),max(1.,hs.x*.5),col,int(t.smoothalpha*255));
drawn = true;
}
}
if ( drawn )
{
double alph = clamp(((t.lastupdate+mtime)-level.maptime)/35.,0.,1.);
double theta = clamp(5.*FrameTime,0.,1.);
t.smoothalpha = t.smoothalpha*(1.-theta)+alph*theta;
}
else t.smoothalpha = 0.;
}
}
@ -2005,7 +2013,13 @@ Class SWWMStatusBar : BaseStatusBar
override void Draw( int state, double TicFrac )
{
Super.Draw(state,TicFrac);
if ( (state != HUD_StatusBar) && (state != HUD_Fullscreen) ) return;
int CurFrame = MSTime();
FrameTime = (CurFrame-PrevFrame)/1000.;
if ( (state != HUD_StatusBar) && (state != HUD_Fullscreen) )
{
PrevFrame = CurFrame;
return;
}
if ( !hnd ) hnd = SWWMHandler(EventHandler.Find("SWWMHandler"));
if ( !swwm_camhud && !(players[consoleplayer].Camera is 'PlayerPawn') )
camhidden = true;
@ -2056,5 +2070,6 @@ Class SWWMStatusBar : BaseStatusBar
double malph = DrawDeath();
DrawMessages(malph);
}
PrevFrame = CurFrame;
}
}

View file

@ -1091,7 +1091,7 @@ Class Omnisight : Inventory
{
Owner.A_StartSound("powerup/omnisight",CHAN_ITEMEXTRA);
// automatically zoom out so the player can know how far this goes
CVar.FindCVar('swwm_minimapzoom').SetFloat(2.);
CVar.FindCVar('swwm_mm_zoom').SetFloat(2.);
}
level.allmap = true;
}
@ -1107,7 +1107,7 @@ Class Omnisight : Inventory
Console.Printf(StringTable.Localize("$D_OMNISHARE"),Owner.player.GetUserName());
players[i].mo.A_StartSound("powerup/omnisight",CHAN_ITEMEXTRA);
// automatically zoom out so the player can know how far this goes
CVar.FindCVar('swwm_minimapzoom').SetFloat(2.);
CVar.FindCVar('swwm_mm_zoom').SetFloat(2.);
}
}
// not used up, must be kept for the targetting features to work

View file

@ -1360,13 +1360,12 @@ Class SWWMSimpleTracker : Thinker
bool vipitem;
bool expired;
int lastupdate;
int sightcount;
ui double smoothalpha; // smoothened alpha, for ui
SWWMSimpleTracker prev, next;
void Update()
{
if ( !target ) return;
sightcount = min(20,sightcount+1);
radius = target.radius;
angle = target.angle;
pos = target.pos;