// WorldTick functions extend Class SWWMHandler { transient Array combatactors; transient Array combattics; transient int highesttic, lastcombat; int lastitemcount[MAXPLAYERS]; transient String curlang; transient bool curfuntags; SWWMSimpleTracker strackers; int strackers_cnt; bool mnotify; bool allkills, allitems, allsecrets; bool mapclear; int mapclearagain, restartmus; String lastmus; int lastorder; bool lastloop; private void LangRefresh() { if ( (language != curlang) || (swwm_funtags != curfuntags) ) { // manually refresh some tags if language has changed for ( SWWMCombatTracker t=trackers; t; t=t.next ) t.UpdateTag(); for ( SWWMInterest p=intpoints; p; p=p.next ) { if ( (p.type != INT_Key) || !p.trackedkey ) continue; p.keytag = p.trackedkey.GetTag(); } for ( int i=0; i lastitemcount[i] ) { int score = 10*(players[i].itemcount-lastitemcount[i]); if ( (level.total_items == level.found_items) && !allitems ) { allitems = true; Console.Printf(StringTable.Localize("$SWWM_LASTITEM"),players[i].GetUserName(),500); score += 490; } SWWMCredits.Give(players[i],score); SWWMScoreObj.Spawn(score,players[i].mo.Vec3Offset(0,0,players[i].mo.Height/2)); lastitemcount[i] = players[i].itemcount; let s = SWWMStats.Find(players[i]); s.items++; } } } // combat tracking private void CombatTrack() { // prune old entries for ( int i=0; i highesttic ) highesttic = combattics[i]; if ( combatactors[i] && (combatactors[i].Health > 0) && !combatactors[i].bKILLED && !combatactors[i].bCORPSE && (combatactors[i].target == players[consoleplayer].mo) && (combattics[i]+2000 > gametic) ) continue; combatactors.Delete(i); combattics.Delete(i); i--; } bool enteredcombat = false; // add new entries let ti = ThinkerIterator.Create("Actor"); Actor a; while ( a = Actor(ti.Next()) ) { if ( !a.player && !a.bISMONSTER ) continue; // ignore the dead if ( (a.Health <= 0) || a.bKILLED || a.bCORPSE ) continue; // ignore friends if ( a.IsFriend(players[consoleplayer].mo) ) continue; // [Strife] ignore if not in combat if ( (gameinfo.gametype&GAME_Strife) && !a.bINCOMBAT && !a.bJUSTATTACKED ) continue; // [Strife] ignore certain classes if ( (a is 'RatBuddy') || (a is 'Peasant') || (a is 'Beggar') ) continue; // [Strife] ignore Oracle's spectre while it's inactive if ( (a is 'AlienSpectre3') && a.InStateSequence(a.CurState,a.FindState("Spawn")) ) continue; // ignore if not targetted or player can't see it if ( (a.target != players[consoleplayer].mo) || !SWWMUtility.InPlayerFOV(players[consoleplayer],a) ) continue; // [HDoom] ignore cute girls if ( SWWMHDoomHandler.IsCuteGirl(a.target) ) continue; // is it already in? bool addme = true; for ( int i=0; i highesttic+700)) ) lastcombat = AddOneliner("fightstart",1,10); } private void OneHundredPercentCheck() { if ( !mapclear && (restartmus > 0) ) { restartmus--; if ( restartmus == 0 ) S_ChangeMusic(lastmus,lastorder,lastloop,true); return; } // ignore levels that have NOTHING if ( (level.total_secrets <= 0) && (level.total_items <= 0) && (level.total_monsters <= 0) ) return; if ( mapclear ) { if ( (swwm_silencemap == 1) && (musplaying.name != "") ) { lastmus = musplaying.name; lastorder = musplaying.baseorder; lastloop = musplaying.loop; S_ChangeMusic("",force:true); } else if ( (swwm_silencemap > 1) && (musplaying.name != "music/olg.ogg") ) { lastmus = musplaying.name; lastorder = musplaying.baseorder; lastloop = musplaying.loop; S_ChangeMusic("music/olg.ogg",force:true); } if ( (level.found_secrets < level.total_secrets) || (level.found_items < level.total_items) || (level.killed_monsters < level.total_monsters) ) { if ( swwm_silencemap > 0 ) { restartmus = 25; S_ChangeMusic("",force:true); } S_StartSound("recordscratch",CHAN_VOICE,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1,ATTN_NONE); mapclear = false; if ( mapclearagain > 1 ) Console.Printf(StringTable.Localize("$SWWM_NOTCLEARAGAIN")); else Console.Printf(StringTable.Localize("$SWWM_NOTCLEAR")); } return; } if ( (level.found_secrets < level.total_secrets) || (level.found_items < level.total_items) || (level.killed_monsters < level.total_monsters) ) return; restartmus = 0; mapclear = true; if ( mapclearagain ) Console.Printf(StringTable.Localize("$SWWM_ALLCLEARAGAIN"),500); else Console.Printf(StringTable.Localize("$SWWM_ALLCLEAR"),5000); S_StartSound("misc/wow",CHAN_VOICE,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1,ATTN_NONE); lastmus = musplaying.name; lastorder = musplaying.baseorder; lastloop = musplaying.loop; if ( swwm_silencemap == 1 ) S_ChangeMusic("",force:true); else if ( swwm_silencemap > 1 ) S_ChangeMusic("music/olg.ogg",force:true); for ( int i=0; i viewdist ) continue; if ( a == players[consoleplayer].Camera ) continue; if ( !a.player && !a.bSOLID && !a.bSHOOTABLE && !a.bISMONSTER && !a.bFRIENDLY && !(a is 'Inventory') && !(a is 'Chancebox') ) continue; if ( !thesight && !a.IsFriend(players[consoleplayer].mo) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue; if ( a.bKILLED || (a.Health <= 0) ) continue; if ( (a is 'Inventory') && (!a.bSPECIAL || Inventory(a).Owner) ) continue; if ( (a is 'Chancebox') && (a.CurState != a.SpawnState) ) continue; SWWMSimpleTracker.Track(a); } if ( swwm_mm_portaloverlay && (psectors.Size() > 1) ) { // oh boy here we go int thisgroup = players[consoleplayer].Camera.CurSector.portalgroup; for ( int i=0; i viewdist ) continue; if ( a == players[consoleplayer].Camera ) continue; if ( !a.player && !a.bSOLID && !a.bSHOOTABLE && !a.bISMONSTER && !a.bFRIENDLY && !(a is 'Inventory') && !(a is 'Chancebox') ) continue; if ( !thesight && !a.IsFriend(players[consoleplayer].mo) && !players[consoleplayer].Camera.CheckSight(a,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue; if ( a.bKILLED || (a.Health <= 0) ) continue; if ( (a is 'Inventory') && (!a.bSPECIAL || Inventory(a).Owner) ) continue; if ( (a is 'Chancebox') && (a.CurState != a.SpawnState) ) continue; SWWMSimpleTracker.Track(a); } } } SWWMSimpleTracker trk = strackers; while ( trk ) { SWWMSimpleTracker next = trk.next; // minimize lifespan of destroyed targets if ( !trk.target ) trk.lastupdate = min(trk.lastupdate,level.maptime); else if ( !trk.expired ) { // "last breath" update if ( (trk.target.bKILLED || (trk.target.Health <= 0)) || ((trk.target is 'Inventory') && (!trk.target.bSPECIAL || Inventory(trk.target).Owner)) || ((trk.target is 'Chancebox') && (trk.target.CurState != trk.target.SpawnState)) ) trk.Update(); } // prune expired trackers if ( trk.lastupdate+140 < level.maptime ) { if ( !trk.prev ) strackers = trk.next; else trk.prev.next = trk.next; if ( trk.next ) trk.next.prev = trk.prev; trk.Destroy(); strackers_cnt--; } trk = next; } } }