// messages (notifications, chat, pickups, midprint...) extend Class SWWMStatusBar { override void FlushNotify() { if ( level.maptime <= 1 ) { // flush ALL messages MainQueue.Clear(); PickupQueue.Clear(); midstr = ""; midtic = 0; if ( midl ) midl.Destroy(); ntagstr = ""; ntagtic = 0; return; } // flush non-chat messages and nametag for ( int i=0; i= PRINT_CHAT ) continue; MainQueue.Delete(i); i--; } ntagstr = ""; ntagtic = 0; } override bool ProcessMidPrint( Font fnt, String msg, bool bold ) { // check for Korax lines, add them to chat (and reply to some of them) bool koraxline = false; if ( msg == StringTable.Localize("$TXT_ACS_MAP02_9_GREET") ) koraxline = true; else if ( msg == StringTable.Localize("$TXT_ACS_MAP02_11_AREYO") ) { EventHandler.SendNetworkEvent("swwmkoraxline",0,consoleplayer); koraxline = true; SWWMDialogues.StartSeq("GREET"); } else if ( msg == StringTable.Localize("$TXT_ACS_MAP13_11_MYSER") ) { EventHandler.SendNetworkEvent("swwmkoraxline",1,consoleplayer); koraxline = true; SWWMDialogues.StartSeq("BLOOD"); } else if ( msg == StringTable.Localize("$TXT_ACS_MAP22_27_YOUHA") ) koraxline = true; else if ( msg == StringTable.Localize("$TXT_ACS_MAP22_29_ITHIN") ) { EventHandler.SendNetworkEvent("swwmkoraxline",2,consoleplayer); koraxline = true; SWWMDialogues.StartSeq("GAME"); } else if ( msg == StringTable.Localize("$TXT_ACS_MAP27_8_WORSH") ) koraxline = true; else if ( msg == StringTable.Localize("$TXT_ACS_MAP27_10_THENA") ) { EventHandler.SendNetworkEvent("swwmkoraxline",3,consoleplayer); koraxline = true; SWWMDialogues.StartSeq("WORSHIP"); } else if ( msg == StringTable.Localize("$TXT_ACS_MAP35_12_AREYO") ) koraxline = true; else if ( msg == StringTable.Localize("$TXT_ACS_MAP35_14_TOFAC") ) { EventHandler.SendNetworkEvent("swwmkoraxline",4,consoleplayer); koraxline = true; SWWMDialogues.StartSeq("MASTERS"); } if ( koraxline ) { Console.PrintfEx(PRINT_CHAT,"\cuKorax\c*: "..msg.."\c*"); return true; } bool ispuzzle = false; let s = SWWMStats.Find(players[consoleplayer]); if ( s ) { puzzlecnt = s.puzzlecnt; realpuzzlecnt = s.realpuzzlecnt; } // check for puzzle solving lines (oh god why), and increment the achievement if ( ((level.mapname ~== "MAP04") || (level.mapname ~== "MAP05")) && ((msg == StringTable.Localize("$TXT_ACS_MAP04_9_ONEHA")) || (msg == StringTable.Localize("$TXT_ACS_MAP04_11_ONETH")) || (msg == StringTable.Localize("$TXT_ACS_MAP05_6_ONETH"))) ) { if ( puzzlecnt >= 4 ) puzzlecnt = 0; puzzlecnt++; realpuzzlecnt++; ispuzzle = true; } else if ( ((level.mapname ~== "MAP08") || (level.mapname ~== "MAP09") || (level.mapname ~== "MAP10")) && ((msg == StringTable.Localize("$TXT_ACS_MAP08_6_ONESI")) || (msg == StringTable.Localize("$TXT_ACS_MAP09_6_ONESI")) || (msg == StringTable.Localize("$TXT_ACS_MAP10_6_ONESI"))) ) { if ( (puzzlecnt < 4) || (puzzlecnt >= 10) ) puzzlecnt = 4; puzzlecnt++; realpuzzlecnt++; ispuzzle = true; } else if ( ((level.mapname ~== "MAP28") || (level.mapname ~== "MAP30") || (level.mapname ~== "MAP34")) && ((msg == StringTable.Localize("$TXT_ACS_MAP28_6_ONENI")) || (msg == StringTable.Localize("$TXT_ACS_MAP30_6_ONENI")) || (msg == StringTable.Localize("$TXT_ACS_MAP34_1_ONENI"))) ) { if ( (puzzlecnt < 10) || (puzzlecnt >= 19) ) puzzlecnt = 10; puzzlecnt++; realpuzzlecnt++; ispuzzle = true; } // deathkings else if ( ((level.mapname ~== "MAP44") || (level.mapname ~== "MAP46")) && ((msg == StringTable.Localize("$TXT_ACS_MAP44_1_THREE")) || (msg == StringTable.Localize("$TXT_ACS_MAP44_2_TWOMO")) || (msg == StringTable.Localize("$TXT_ACS_MAP44_3_ONEMO")) || (msg == StringTable.Localize("$TXT_ACS_MAP44_4_THEPU")) || (msg == StringTable.Localize("$TXT_ACS_MAP44_10_ONETH")) || (msg == StringTable.Localize("$TXT_ACS_MAP44_11_TWOTH")) || (msg == StringTable.Localize("$TXT_ACS_MAP46_8_ONEFO"))) ) { if ( (puzzlecnt < 19) || (puzzlecnt >= 30) ) puzzlecnt = 19; puzzlecnt++; realpuzzlecnt++; ispuzzle = true; } else if ( (level.mapname ~== "MAP51") && ((msg == StringTable.Localize("$TXT_ACS_MAP51_8_ONETH")) || (msg == StringTable.Localize("$TXT_ACS_MAP51_9_TWOTH")) || (msg == StringTable.Localize("$TXT_ACS_MAP51_10_THECR"))) ) { if ( (puzzlecnt < 30) || (puzzlecnt >= 34) ) puzzlecnt = 30; puzzlecnt++; realpuzzlecnt++; ispuzzle = true; } if ( ispuzzle ) { EventHandler.SendNetworkEvent("swwmstorepuzzlecnt",consoleplayer,puzzlecnt,realpuzzlecnt); int tpuz = SWWMUtility.IsDeathkings()?15:19; if ( realpuzzlecnt >= tpuz ) SWWMUtility.MarkAchievement("puzzle",players[consoleplayer]); if ( !swwm_nomapmsg ) { switch ( puzzlecnt ) { case 1: SWWMDialogues.StartSeq("PUZZLE1"); break; case 2: SWWMDialogues.StartSeq("PUZZLE2"); break; case 3: SWWMDialogues.StartSeq("PUZZLE3"); break; case 5: SWWMDialogues.StartSeq("PUZZLE4"); break; case 8: SWWMDialogues.StartSeq("PUZZLE5"); break; case 11: SWWMDialogues.StartSeq("PUZZLE6"); break; case 20: SWWMDialogues.StartSeq("PUZZLE7"); break; case 30: SWWMDialogues.StartSeq("PUZZLE8"); break; case 31: SWWMDialogues.StartSeq("PUZZLE9"); break; } } } // rampancy fun stuff bool mainframeline = false; if ( (msg == StringTable.Localize("$AISPAWN_TEXT1")) || (msg == StringTable.Localize("$AISPAWN_TEXT2")) || (msg == StringTable.Localize("$AISEE_TEXT")) || (msg == StringTable.Localize("$AIACTIVE_TEXT1")) || (msg == StringTable.Localize("$AIACTIVE_TEXT2")) || (msg == StringTable.Localize("$AIPAIN_TEXT1")) || (msg == StringTable.Localize("$AIPAIN_TEXT2")) || (msg == StringTable.Localize("$AIPAIN_TEXT3")) || (msg == StringTable.Localize("$AIPAIN_TEXT4")) || (msg == StringTable.Localize("$AIPAIN_TEXT5")) || (msg == StringTable.Localize("$AIPAIN_TEXT6")) || (msg == StringTable.Localize("$AIPAIN_TEXT7")) ) mainframeline = true; if ( mainframeline ) { Console.PrintfEx(PRINT_CHAT,"\cuAI Mainframe\c*: "..msg.."\c*"); return true; } String lastmidstr = midstr; if ( !fnt || (fnt == smallfont) ) { midstr = msg; midtic = level.totaltime; midtype = bold?2:0; if ( midl ) midl.Destroy(); // don't forget to log to console, like gzdoom itself does // (also, account for potential unterminated color escapes) // PS: avoid duplicate message spam, too if ( (msg == lastmidstr) || (msg == "") ) return true; Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY, "----------------------------------------\n" .."%s\c-\n" .."----------------------------------------",msg); return true; } if ( (fnt == bigfont) || (fnt == originalbigfont) ) { midstr = msg; midtic = level.totaltime; midtype = bold?3:1; if ( midl ) midl.Destroy(); // don't forget to log to console, like gzdoom itself does // (also, account for potential unterminated color escapes) // PS: avoid duplicate message spam, too if ( (msg == lastmidstr) || (msg == "") ) return true; Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY, "----------------------------------------\n" .."%s\c-\n" .."----------------------------------------",msg); return true; } return false; } override bool ProcessNotify( EPrintLevel printlevel, String outline ) { // ignore outside of levels if ( gamestate != GS_LEVEL ) return false; // discard if the console is active // (helps when using debug commands that print a lot of text) if ( consolestate != c_up ) return true; int rprintlevel = printlevel&PRINT_TYPES; // treat any unrecognized levels as critical messages // note that checking for PRINT_LOG isn't needed as those are skipped early in the C++ side if ( (rprintlevel < PRINT_LOW) || (rprintlevel > PRINT_TEAMCHAT) ) rprintlevel = PRINT_HIGH; // strip trailing newline (all Printf type messages have this) outline.DeleteLastCharacter(); let m = new('MsgLine'); m.str = outline; m.type = rprintlevel; m.tic = level.totaltime; m.rep = 1; if ( rprintlevel == PRINT_LOW ) { // check if repeated for ( int i=0; i PRINT_HIGH) && (level.totaltime < (MainQueue[i].tic+GameTicRate*CHATDURATION)) ) continue; MainQueue.Delete(i); i--; } if ( (midstr != "") && ((midtic+int(GameTicRate*con_midtime)) < level.totaltime) ) { midstr = ""; midtic = 0; if ( midl ) midl.Destroy(); } if ( (ntagstr != "") && ((ntagtic+70) < level.totaltime) ) { ntagstr = ""; ntagtic = 0; } } private void DrawPickups() { int h = mSmallFont.GetHeight(); // draw nametags below them double yy; double nalph = 0.; double tagtime = (ntagtic+70)-(level.totaltime+fractic); if ( (ntagstr != "") && (tagtime > 0) ) { nalph = clamp(tagtime/20.,0.,1.); yy = ss0.y-(ymargin0+50); int len = mSmallFont.StringWidth(ntagstr); double xx = (ss0.x-len)/2.; Screen.Dim(0xFF000000,.8*nalph,int((xx-6)*hs0),int(yy*hs0),int((len+12)*hs0),int((h+4)*hs0)); Screen.DrawText(mSmallFont,ntagcol,int(xx),yy+2,ntagstr,DTA_VirtualWidthF,ss0.x,DTA_VirtualHeightF,ss0.y,DTA_KeepRatio,true,DTA_Alpha,nalph); } if ( PickupQueue.Size() <= 0 ) return; // reverse order since they're drawn bottom to top int mend = max(0,PickupQueue.Size()-MAXPICKUP); yy = ss0.y-(ymargin0+50); // shift up if nametag is present if ( nalph > 0. ) yy -= int((mSmallFont.GetHeight()+6)*clamp(nalph*2.,0.,1.)); for ( int i=PickupQueue.Size()-1; i>=mend; i-- ) { PickupQueue[i].UpdateText(int(min(ss0.x,ss0.y/.5625)*.75)); double curtime = (PickupQueue[i].tic+GameTicRate*PICKDURATION)-(level.totaltime+fractic); double alph = clamp(curtime/20.,0.,1.); let l = PickupQueue[i].l; int maxlen = 0; for ( int j=0; j maxlen ) maxlen = len; } double xx = (ss0.x-maxlen)/2.; Screen.Dim(0xFF000000,.8*alph,int((xx-6)*hs0),int((yy-h*(l.Count()-1))*hs0),int((maxlen+12)*hs0),int((h*l.Count()+4)*hs0)); for ( int j=l.Count()-1; j>=0; j-- ) { int len = mSmallFont.StringWidth(l.StringAt(j)); xx = int((ss0.x-len)/2.); Screen.DrawText(mSmallFont,msg0color,xx,yy+2,l.StringAt(j),DTA_VirtualWidthF,ss0.x,DTA_VirtualHeightF,ss0.y,DTA_KeepRatio,true,DTA_Alpha,alph); yy -= h; } yy -= 6; } } private void DrawMessages( double boxalph = 1. ) { double xx, yy; if ( midstr != "" ) { double ssp = (midtype&1)?.5:1.; double hsp = (midtype&1)?2.:1.; int col = (midtype&2)?msgmidcolor2:msgmidcolor; double curtime = (midtic+int(GameTicRate*con_midtime))-(level.totaltime+fractic); double alph = clamp(curtime/20.,0.,1.); if ( !midl || (midsz != int(min(ss0.x,ss0.y/.5625)*ssp)) ) { if ( midl ) midl.Destroy(); midsz = int(min(ss0.x,ss0.y/.5625)*ssp); midl = mSmallFont.BreakLines(midstr,midsz); } int h = mSmallFont.GetHeight(); int maxlen = 0; for ( int i=0; i=gametic)?MAXSHOWNBIG:MAXSHOWN)); xx = xmargin; yy = ymargin; bool smol = (min(ss.x,ss.y/.5625)<640); Screen.DrawTexture(ChatTex[smol?3:0],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,boxalph); yy += 2; for ( int i=mstart; i