Various changes related to items:

- All items now have vanilla hitbox sizes for compatibility.
 - Removed extended hitboxes (no longer needed).
 - Blob shadows are now exclusive to players (and eventually monsters).
 - Glows and sparkles are no longer toggleable.
 - Glows and sparkles have fixed size/radius.
 - Item sparkles are now handled by the glows, rather than the player.
This commit is contained in:
Mari the Deer 2022-10-28 16:49:14 +02:00
commit c770276bd7
36 changed files with 56 additions and 479 deletions

View file

@ -175,119 +175,6 @@ extend Class SWWMHandler
}
}
}
else if ( e.Name ~== "swwmupdateshadows" )
{
if ( multiplayer && (e.player != Net_Arbitrator) )
{
if ( e.player == consoleplayer )
Console.Printf("Only the net arbitrator can call this event.");
return;
}
if ( !swwm_shadows )
{
let ti = ThinkerIterator.Create("SWWMShadow");
SWWMShadow s;
int n = 0;
while ( s = SWWMShadow(ti.Next()) )
{
n++;
s.Destroy();
}
Console.Printf("%d shadows removed.",n);
return;
}
// build list of actors that already have shadows
Array<Actor> shaded;
let ti = ThinkerIterator.Create("Actor");
Actor a;
while ( a = Actor(ti.Next()) )
{
if ( !(a is 'SWWMShadow') ) continue;
shaded.Push(a.target);
}
int n = 0;
ti.Reinit();
while ( a = Actor(ti.Next()) )
{
if ( (a is 'LampMoth') || !(a.bSHOOTABLE || a.bISMONSTER || (a is 'Inventory') || (a is 'CompanionLamp')) || !((a is 'Demolitionist') || (a.SpawnState.sprite == a.GetSpriteIndex('XZW1'))) )
continue;
if ( shaded.Find(a) < shaded.Size() ) continue;
if ( !SWWMShadow.Track(a) ) continue;
n++;
}
Console.Printf("%d shadows added.",n);
return;
}
else if ( e.Name ~== "swwmupdateglows" )
{
if ( multiplayer && (e.player != Net_Arbitrator) )
{
if ( e.player == consoleplayer )
Console.Printf("Only the net arbitrator can call this event.");
return;
}
if ( !swwm_itemglows )
{
let ti = ThinkerIterator.Create("SWWMPickupFlash");
SWWMPickupFlash f;
int n = 0;
while ( f = SWWMPickupFlash(ti.Next()) )
{
if ( f.CurState != f.FindState('Pickup') ) continue;
n++;
f.Destroy();
}
Console.Printf("%d glows removed.",n);
return;
}
// build list of items that already have glows
Array<Actor> glowed;
let ti = ThinkerIterator.Create("Actor");
Actor a;
while ( a = Actor(ti.Next()) )
{
if ( !(a is 'SWWMPickupFlash') || (a.CurState != a.FindState('Pickup')) ) continue;
glowed.Push(a.target);
}
int n = 0;
ti.Reinit();
while ( a = Actor(ti.Next()) )
{
if ( !(a is 'Inventory') || Inventory(a).Owner || !(Inventory(a).PickupFlash is 'SWWMPickupFlash') )
continue;
if ( glowed.Find(a) < glowed.Size() ) continue;
let p = Actor.Spawn(Inventory(a).PickupFlash,a.Vec3Offset(0,0,16));
p.target = a;
p.SetStateLabel("Pickup");
n++;
}
Console.Printf("%d glows added.",n);
return;
}
else if ( e.Name ~== "swwmupdatehitboxes" )
{
if ( multiplayer && (e.player != Net_Arbitrator) )
{
if ( e.player == consoleplayer )
Console.Printf("Only the net arbitrator can call this event.");
return;
}
if ( !swwm_extendedpickup )
{
let ti = ThinkerIterator.Create("SWWMExtendedItemHitbox");
SWWMExtendedItemHitbox h;
int n = 0;
while ( h = SWWMExtendedItemHitbox(ti.Next()) )
{
n++;
h.Destroy();
}
Console.Printf("%d hitboxes removed.",n);
return;
}
Console.Printf("Extended hitboxes can't be re-enabled at runtime. Please restart the map.");
return;
}
else if ( e.Name ~== "swwmtrimsuckables" )
{
if ( multiplayer && (e.player != Net_Arbitrator) )