// facial animation and cosmetics extend Class Demolitionist { private int GetRandom() { return (rss = (rss<<1)*35447+(rss/87)); } private void UpdateTags() { static const String colname[] = { "", "Blue", "Cyan", "Dragonfly", "Gold", "Magenta", "Orange", "Peach", "Pink", "Purple", "Red", "Violet", "White", "Yellow", "Black", "Rust" }; int idx = CVar.GetCVar('swwm_tagcolor',player).GetInt(); if ( (idx < 0) || (idx >= colname.Size()) ) idx = 0; if ( idx != oldtagcolor ) A_ChangeModel("",0,"","",0,"models","DemoTags"..colname[idx]..".png",CMDL_USESURFACESKIN,-1); oldtagcolor = idx; for ( Inventory i=inv; i; i=i.inv ) { if ( !(i is 'SWWMWeapon') ) continue; SWWMWeapon(i).UpdateTags(idx,colname[idx]); } } private void UpdateFace() { // damage handling if ( facedamage ) { if ( lastdamage > 70 ) { facestate = FS_OUCH; facetimer = (lastdamagetimer-gametic)+10; } else if ( facestate < FS_OUCH ) { facestate = FS_PAIN; facetimer = (lastdamagetimer-gametic)+10; paindir = 0; // paraphrased from vanilla, with some tweaks if ( player.attacker && (player.attacker != self) ) { double atkang = AngleTo(player.attacker); double angdiff = deltaangle(angle,atkang); if ( abs(angdiff) < 135 ) { if ( angdiff > 45 ) paindir = -1; else if ( angdiff < -45 ) paindir = 1; } } } } facedamage = false; if ( facegrin && (facestate < FS_SAD) ) { facestate = FS_GRIN; facetimer = 50; } facegrin = false; if ( facewink && (facestate < FS_SAD) ) { facestate = FS_WINK; facetimer = 20; } facewink = false; if ( faceblink && (facestate < FS_PAIN) ) { facestate = FS_BLINK; facetimer = 30; } faceblink = false; if ( facesad && (facestate <= FS_SAD) ) { facestate = FS_SAD; facetimer = 50; } facesad = false; if ( FindInventory('RagekitPower') && (facestate < FS_PAIN) ) { facestate = FS_EVIL; facetimer = 10; } if ( facetimer > 0 ) { facetimer--; if ( facetimer <= 0 ) { facestate = FS_DEFAULT; blinktime = 30; } } if ( !(gametic&1) ) { if ( blinktime <= 0 ) { blinktime--; if ( blinktime < -3 ) { rss = MSTime(); blinktime = (abs(GetRandom())%10)?(40+abs(GetRandom())%40):6; } } else blinktime--; } // update our face texture if different static const String facetex[] = { "Blank", "Blink", "Booty", "Dead", "Default", "Dizzy", "Evil", "Grin", "Hurt", "HurtLeft", "HurtRight", "Off", "Ouch", "Sad", "Smug", "Unamused", "Wink" }; int faceidx = GetFaceTex(); if ( !oldfaceidx || (faceidx != oldfaceidx) ) A_ChangeModel("",0,"","",1,"models","DemoFace_"..facetex[faceidx]..".png",CMDL_USESURFACESKIN,-1); oldfaceidx = faceidx; } private int GetFaceTex() { if ( player.Health <= 0 ) return 3; if ( (bInvulnerable || (player.cheats&(CF_GODMODE|CF_GODMODE2)) || FindInventory('InvinciballPower')) && (facestate >= FS_PAIN) ) return 14; if ( facestate == FS_OUCH ) return 12; if ( facestate == FS_PAIN ) return (paindir==1)?10:(paindir==-1)?9:8; if ( facestate == FS_GRIN ) return 7; if ( facestate == FS_EVIL ) return 6; if ( facestate == FS_SAD ) return 13; if ( facestate == FS_WINK ) return 16; if ( facestate == FS_BLINK ) return ((facetimer>28)||(facetimer<2))?15:1; switch ( blinktime ) { case -1: case -3: return 15; break; case -2: return 1; break; } return (player.Health<=25)?13:4; } }