Updates for GZDoom 4.12, part 1 (new functions, variables, flags, etc.).

This commit is contained in:
Mari the Deer 2024-04-22 14:34:22 +02:00
commit f38db38751
79 changed files with 349 additions and 183 deletions

View file

@ -3,7 +3,7 @@
Class SWWMUtility
{
// gets the names of all mod cvars
static void GetCVars( out Array<String> cvarlist )
static void GetCVars( Array<String> &cvarlist )
{
cvarlist.Clear();
let lmp = Wads.CheckNumForFullname("cvarinfo.base");

View file

@ -78,9 +78,8 @@ extend Class SWWMUtility
{
Vector2 disp = level.GetDisplacement(thisgroup,i);
bt = BlockThingsIterator.CreateFromPos(Source.pos.x+disp.x,Source.pos.y+disp.y,Source.pos.z,ExplosionRadius,ExplosionRadius,false);
while ( bt.Next() )
foreach ( a,p,f:bt )
{
let a = bt.Thing;
if ( !a ) continue; // this can happen, yes
// early checks for self and ignored actor (usually the instigator)
if ( (a == ignoreme) || (a == Source) )

View file

@ -145,8 +145,7 @@ extend Class SWWMUtility
static play void SpawnVanillaBossBrain( int tid )
{
let ai = Level.CreateActorIterator(tid);
Actor a;
while ( a = ai.Next() )
foreach ( a:ai )
{
let bb = a.Spawn("BossBrain",a.pos,NO_REPLACE);
bb.angle = a.angle;

View file

@ -10,7 +10,7 @@ enum EExitType
extend Class SWWMUtility
{
// Thanks to ZZYZX and Nash
static play void SetToSlopeSpecific( Actor a, double dang, SecPlane plane, bool flipnorm )
static play void SetToSlopeSpecific( Actor a, double dang, readonly<SecPlane> plane, bool flipnorm )
{
Vector3 fnormal;
if ( flipnorm ) fnormal = -plane.Normal;
@ -275,6 +275,7 @@ extend Class SWWMUtility
}
// the stupidest thing ever, it's called BlockingLine but it's not always blocking us
// note: MovementBlockingLine as an alternative seems prone to issues at the moment, needs further investigation
static bool BlockingLineIsBlocking( Actor a, int blockflags = Line.ML_BLOCKEVERYTHING, Line testline = null )
{
Line l = testline?testline:a.BlockingLine;
@ -408,6 +409,7 @@ extend Class SWWMUtility
}
if ( floorfound ) return (al+ah+bl+bh)*.25;
// check for midtex
// TODO: see if GetMidTexturePosition() is useful here to simplify code
if ( !l.sidedef[0].GetTexture(1).IsNull() )
{
double ofs = l.sidedef[0].GetTextureYOffset(1);
@ -624,7 +626,7 @@ extend Class SWWMUtility
}
// iterate through polyobjects and see if this line is part of one (returning which, if any)
static bool IsPolyLine( Line l, out swwm_PolyobjectHandle o )
static bool IsPolyLine( Line l, swwm_PolyobjectHandle &o )
{
let pi = swwm_PolyobjectIterator.Create();
swwm_PolyobjectHandle p;

View file

@ -9,7 +9,7 @@ Struct SWWMProjectionData
extend Class SWWMUtility
{
// gutamatics caching
static void PrepareProjData( out SWWMProjectionData d, Vector3 viewpos, double angle, double pitch, double roll, double fov )
static void PrepareProjData( SWWMProjectionData &d, Vector3 viewpos, double angle, double pitch, double roll, double fov )
{
double aspect = Screen.GetAspectRatio();
// vertical fov
@ -50,16 +50,16 @@ extend Class SWWMUtility
}
// less code duplication
static void AdjustClean_1( out double x, out double y )
static void AdjustClean_1( double &x, double &y )
{
x = (x-160)*CleanXFac_1+(Screen.GetWidth()*.5);
y = (y-100)*CleanYFac_1+(Screen.GetHeight()*.5);
}
static void AdjustClean_1x( out double x )
static void AdjustClean_1x( double &x )
{
x = (x-160)*CleanXFac_1+(Screen.GetWidth()*.5);
}
static void AdjustClean_1y( out double y )
static void AdjustClean_1y( double &y )
{
y = (y-100)*CleanYFac_1+(Screen.GetHeight()*.5);
}

View file

@ -2,7 +2,7 @@
extend Class SWWMUtility
{
// bit ugly, but it works
static void ThousandsStr( out String s, int col = Font.CR_UNDEFINED, String colstr = "" )
static void ThousandsStr( String &s, int col = Font.CR_UNDEFINED, String colstr = "" )
{
if ( (col < Font.CR_UNDEFINED) || (col >= Font.NUM_TEXT_COLORS) )
ThrowAbortException("col parameter out of range, use colstr for non-standard font colors.");
@ -34,7 +34,7 @@ extend Class SWWMUtility
return nstr;
}
static void StripColor( out String str )
static void StripColor( String &str )
{
int len = str.CodePointCount();
for ( int i=0, pos=0; i<len; i++ )
@ -83,7 +83,7 @@ extend Class SWWMUtility
return str;
}
static void ObscureText( out String str, int seed, bool alnum = false, bool minihud = false )
static void ObscureText( String &str, int seed, bool alnum = false, bool minihud = false )
{
int len = str.CodePointCount();
String newstr = "";
@ -114,7 +114,7 @@ extend Class SWWMUtility
str = newstr;
}
static void BeautifyClassName( out String str )
static void BeautifyClassName( String &str )
{
String workstr = str;
str.Truncate(0);