- Try to get rid of all implicit casts from string to name, color or class. - Use FindClass where needed. - Used a map in a case where a dictionary was unneeded. - Use new bounce flags where needed. - Replace Legacy of Rust weapons/ammo.
53 lines
1.6 KiB
Text
53 lines
1.6 KiB
Text
// screen flashes
|
|
|
|
extend Class SWWMHandler
|
|
{
|
|
// interface event has to read from these
|
|
transient Actor flash_camera;
|
|
transient Color flash_color;
|
|
transient int flash_duration;
|
|
// heal/armor flashes need to be handled here so they don't stack
|
|
transient int hflash[MAXPLAYERS], aflash[MAXPLAYERS];
|
|
|
|
static void HealthFlash( int p )
|
|
{
|
|
let hnd = SWWMHandler(EventHandler.Find('SWWMHandler'));
|
|
if ( !hnd || (p == -1) ) return;
|
|
hnd.hflash[p] = gametic+5;
|
|
}
|
|
|
|
static void ArmorFlash( int p )
|
|
{
|
|
let hnd = SWWMHandler(EventHandler.Find('SWWMHandler'));
|
|
if ( !hnd || (p == -1) ) return;
|
|
hnd.aflash[p] = gametic+5;
|
|
}
|
|
|
|
static void DoFlash( Actor camera, Color c, int duration )
|
|
{
|
|
// don't flash when paused
|
|
if ( menuactive && (menuactive != Menu.OnNoPause) ) return;
|
|
let hnd = SWWMHandler(EventHandler.Find('SWWMHandler'));
|
|
if ( !hnd ) return;
|
|
hnd.flash_camera = camera;
|
|
hnd.flash_color = c;
|
|
hnd.flash_duration = duration;
|
|
EventHandler.SendInterfaceEvent(consoleplayer,"swwmdoflash");
|
|
}
|
|
|
|
private ui void FlashRender( RenderEvent e )
|
|
{
|
|
int camplayer = players[consoleplayer].Camera.PlayerNumber();
|
|
if ( camplayer == -1 ) return;
|
|
if ( gametic < hflash[camplayer] )
|
|
{
|
|
double fstr = (hflash[camplayer]-(gametic+e.FracTic))/5.;
|
|
Screen.Dim(Color(64,128,255),.1875*fstr*pickup_fade_scalar,0,0,Screen.GetWidth(),Screen.GetHeight(),STYLE_Add);
|
|
}
|
|
if ( gametic < aflash[camplayer] )
|
|
{
|
|
double fstr = (aflash[camplayer]-(gametic+e.FracTic))/5.;
|
|
Screen.Dim(Color(96,255,64),.1875*fstr*pickup_fade_scalar,0,0,Screen.GetWidth(),Screen.GetHeight(),STYLE_Add);
|
|
}
|
|
}
|
|
}
|