diff --git a/language.def_menu b/language.def_menu index c2bbc86e9..47522c3f4 100644 --- a/language.def_menu +++ b/language.def_menu @@ -521,8 +521,8 @@ SWWM_STOREFULL = "You can't hold more of that."; SWWM_STOREMUNS = "You don't have enough money."; SWWM_NOSTORE = "(no items left to buy)"; SWWM_NOSTORESELL = "(no items to be sold)"; -SWWM_CHATTAB = "Chat Log"; -SWWM_NOCHAT = "(chat history is empty)"; +SWWM_CHATTAB = "Messages"; +SWWM_NOCHAT = "(message history is empty)"; SWWM_SECRETTAB = "Secret"; SWWM_TODEMO = "\cx\"Fight for justice, Demo-chan! You can do it!\"\c- \cg♥\c- Ibuki & Saya"; SWWM_CUTIECLUB = "\cx\"Never lose hope, Demo-chan! We're all with you!\"\c- \cg♥\c- Cutie Club"; @@ -615,7 +615,7 @@ SWWM_HELPTXT = "\cfEnter/Left Click:\c- Sell\n" "\cfBackspace/Right Click:\c- Switch to buying\n" "\n" -"\cxChat Log Tab - Controls\c-\n" +"\cxMessages Tab - Controls\c-\n" "\cx———————————————————————\c-\n" "\n" "\cfUp/Down:\c- Scroll"; diff --git a/language.es_menu b/language.es_menu index 66d521c05..3ba59dd1f 100644 --- a/language.es_menu +++ b/language.es_menu @@ -500,8 +500,8 @@ SWWM_STOREFULL = "No puedes llevar más de eso."; SWWM_STOREMUNS = "No tienes suficiente dinero."; SWWM_NOSTORE = "(no queda nada que comprar)"; SWWM_NOSTORESELL = "(no tienes ítems que vender)"; -SWWM_CHATTAB = "Hist. de Chat"; -SWWM_NOCHAT = "(historial de chat vacío)"; +SWWM_CHATTAB = "Mensajes"; +SWWM_NOCHAT = "(historial de mensajes vacío)"; SWWM_SECRETTAB = "Secreto"; SWWM_TODEMO = "\cx\"¡Lucha por la justicia, Demo-chan! ¡Tú puedes!\"\c- \cg♥\c- Ibuki y Saya"; SWWM_CUTIECLUB = "\cx\"¡Jamás pierdas la esperanza, Demo-chan! ¡Estamos todas contigo!\"\c- \cg♥\c- Club Cuqui"; @@ -594,8 +594,8 @@ SWWM_HELPTXT = "\cfEnter/Click Izdo.:\c- Vender\n" "\cfRetroceso/Click Dcho.:\c- Cambiar a compra\n" "\n" -"\cxPestaña de Historial de Chat - Controles\c-\n" -"\cx————————————————————————————————————————\c-\n" +"\cxPestaña de Mensajes - Controles\c-\n" +"\cx———————————————————————————————\c-\n" "\n" "\cfArriba/Abajo:\c- Scroll"; // Wallbuster menu diff --git a/language.version b/language.version index 8ccdbc3d3..25cbe44c2 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.2pre r195 \cu(Thu 24 Mar 16:28:58 CET 2022)\c-"; -SWWM_SHORTVER="\cw1.2pre r195 \cu(2022-03-24 16:28:58)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.2pre r195 \cu(Thu 24 Mar 18:08:38 CET 2022)\c-"; +SWWM_SHORTVER="\cw1.2pre r195 \cu(2022-03-24 18:08:38)\c-"; diff --git a/zscript/kbase/swwm_kbase_list.zsc b/zscript/kbase/swwm_kbase_list.zsc index 6430eb894..90b891ba1 100644 --- a/zscript/kbase/swwm_kbase_list.zsc +++ b/zscript/kbase/swwm_kbase_list.zsc @@ -113,296 +113,3 @@ Class DemolitionistMenuListItem ui Screen.DrawText(smallfont,selected?Font.CR_FIRE:Font.CR_WHITE,master.origin.x+pos.x,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); } } - -// monster kill stat item -Class DemolitionistMenuKillItem : DemolitionistMenuListItem -{ - MonsterKill s; - int width; - - DemolitionistMenuKillItem Init( DemolitionistMenu master, MonsterKill s, int width = 0 ) - { - Super.Init(master,""); - self.s = s; - self.width = width; - let m = GetDefaultByType(s.m); - self.label = m.GetTag(FallbackTag); - if ( self.label == FallbackTag ) - { - self.label = m.GetClassName(); - SWWMUtility.BeautifyClassName(self.label); - } - return self; - } - - override int GetWidth() - { - return width; - } - - override void Drawer( Vector2 pos, bool selected, int cliptop, int clipbottom, int clipleft, int clipright ) - { - // skip draw when out of bounds - if ( (master.origin.y+pos.y > clipbottom) || (master.origin.y+pos.y+smallfont.GetHeight() < cliptop) ) - return; - Screen.DrawText(smallfont,Font.CR_FIRE,master.origin.x+pos.x,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - String str = String.Format("%d",s.kills); - Screen.DrawText(smallfont,Font.CR_WHITE,master.origin.x+pos.x+width-smallfont.StringWidth(str),master.origin.y+pos.y,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - } -} - -// map stat item -Class DemolitionistMenuMapStatItem : DemolitionistMenuListItem -{ - LevelStat s; - int width; - int maxlen[4]; - - DemolitionistMenuMapStatItem Init( DemolitionistMenu master, LevelStat s, int width = 0 ) - { - Super.Init(master,""); - self.s = s; - self.width = width; - self.label = s.hub?s.levelname:String.Format("%s - %s",s.mapname.MakeUpper(),s.levelname); - return self; - } - - override int GetWidth() - { - return width; - } - - override void Drawer( Vector2 pos, bool selected, int cliptop, int clipbottom, int clipleft, int clipright ) - { - String str = label; - if ( selected ) str = "\cd▸\c- "..str; - bool smallname = smallfont.StringWidth(str)>(width-(maxlen[3]+maxlen[2]+maxlen[1]+maxlen[0]+24)); - Screen.DrawText(smallname?smallfont2:smallfont,Font.CR_FIRE,master.origin.x+pos.x,master.origin.y+pos.y+smallname*2,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - double xx = pos.x+width; - double yy = pos.y+2; - int sec = Thinker.Tics2Seconds(s.time); - str = String.Format("%02d\cu:\c-%02d\cu:\c-%02d",sec/3600,(sec%3600)/60,sec%60); - Screen.DrawText(smallfont2,((s.suck>0)&&(sec>=(s.suck*3600)))?Font.CR_RED:(sec<=s.par)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-smallfont2.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - Screen.DrawText(smallfont2,Font.CR_FIRE,master.origin.x+xx-maxlen[0],master.origin.y+yy,"T",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - if ( maxlen[0] > 0 ) xx -= maxlen[0]+8; - if ( s.stotal > 0 ) - { - str = String.Format("%d\cu/\c-%d",s.scount,s.stotal); - Screen.DrawText(smallfont2,(s.scount>=s.stotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-smallfont2.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - Screen.DrawText(smallfont2,Font.CR_FIRE,master.origin.x+xx-maxlen[1],master.origin.y+yy,"S",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - } - if ( maxlen[1] > 0 ) xx -= maxlen[1]+8; - if ( s.itotal > 0 ) - { - str = String.Format("%d\cu/\c-%d",s.icount,s.itotal); - Screen.DrawText(smallfont2,(s.icount>=s.itotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-smallfont2.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - Screen.DrawText(smallfont2,Font.CR_FIRE,master.origin.x+xx-maxlen[2],master.origin.y+yy,"I",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - } - if ( maxlen[2] > 0 ) xx -= maxlen[2]+8; - if ( s.ktotal > 0 ) - { - str = String.Format("%d\cu/\c-%d",s.kcount,s.ktotal); - Screen.DrawText(smallfont2,(s.kcount>=s.ktotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-smallfont2.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - Screen.DrawText(smallfont2,Font.CR_FIRE,master.origin.x+xx-maxlen[3],master.origin.y+yy,"K",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); - } - } -} - -// achievement item -Class DemolitionistMenuAchievementItem : DemolitionistMenuListItem -{ - SWWMAchievementInfo a; - TextureID AchievementUnknown, BaseBox, BarTex[3]; - bool ShouldObscure; - bool bHidden; - int width; - BrokenLines l; - String oldstr; - - DemolitionistMenuAchievementItem Init( DemolitionistMenu master, SWWMAchievementInfo a, int width = 0 ) - { - Super.Init(master,""); - self.a = a; - self.width = width; - AchievementUnknown = TexMan.CheckForTexture("graphics/Achievements/HiddenAchievement.png",TexMan.Type_Any); - BaseBox = TexMan.CheckForTexture("graphics/Achievements/NoAchievement.png",TexMan.Type_Any); - BarTex[0] = TexMan.CheckForTexture("graphics/Achievements/BarAchievementBase.png",TexMan.Type_Any); - BarTex[1] = TexMan.CheckForTexture("graphics/Achievements/BarAchievementProgress.png",TexMan.Type_Any); - BarTex[2] = TexMan.CheckForTexture("graphics/Achievements/BarAchievementDone.png",TexMan.Type_Any); - ShouldObscure = (swwm_filterachievements==1); - Update(); - return self; - } - - // cache state/progress to not call it every frame - void Update() - { - a.state = master.shnd.achievementstate.At(a.basename).ToInt(); - if ( !a.maxval ) return; - a.val = master.shnd.achievementprogress.At(a.basename).ToInt(); - if ( !a.bitfield ) return; - int val = 0; - for ( int i=0; i inv; - int col; - bool bSell; - int width; // set in post after list init, used for positioning the price tag - - DemolitionistMenuStoreItem Init( DemolitionistMenu master, Class i, bool bSell = false ) - { - Super.Init(master,""); - inv = i; - col = Font.CR_WHITE; - let def = GetDefaultByType(i); - if ( i is 'Weapon' ) col = SWWMUtility.IsVIPItemClass(i)?Font.FindFontColor('VIPGold'):Font.CR_GOLD; - else if ( i is 'MagAmmo' ) col = SWWMUtility.IsVIPItemClass(i)?Font.FindFontColor('VIPTan'):Font.CR_TAN; - else if ( (i is 'BackpackItem') || (i is 'HammerspaceEmbiggener') ) col = Font.CR_DARKBROWN; - else if ( i is 'Ammo' ) col = SWWMUtility.IsVIPItemClass(i)?Font.FindFontColor('VIPBrown'):Font.CR_BROWN; - else if ( (i is 'PowerupGiver') || (i is 'AmmoFabricator') || def.bBIGPOWERUP ) col = SWWMUtility.IsVIPItemClass(i)?Font.FindFontColor('VIPPurple'):Font.CR_PURPLE; - else if ( (i is 'Health') || (i is 'HealthPickup') || (i is 'SWWMHealth') ) col = Font.CR_RED; - else if ( (i is 'Armor') || (i is 'SWWMSpareArmor') ) col = Font.CR_GREEN; - self.bSell = bSell; - return self; - } - - int GetPrice() - { - return 0; - } - - int GetUnits() - { - return 0; - } -} - -// chat message item -Class DemolitionistMenuChatItem : DemolitionistMenuListItem -{ - -} diff --git a/zscript/kbase/swwm_kbasetab_chat.zsc b/zscript/kbase/swwm_kbasetab_chat.zsc index b593718f6..bf66419c9 100644 --- a/zscript/kbase/swwm_kbasetab_chat.zsc +++ b/zscript/kbase/swwm_kbasetab_chat.zsc @@ -2,10 +2,222 @@ Class DemolitionistChatTab : DemolitionistMenuTab { + DemolitionistMenuList msglist; + int ofs, maxofs; + double smofs; + bool drag; + SWWMFullHistory hist; + override DemolitionistMenuTab Init( DemolitionistMenu master ) { title = StringTable.Localize("$SWWM_CHATTAB"); - bHidden = !SWWMFullHistory.Get(); + hist = SWWMFullHistory.Get(); return Super.Init(master); } + + override void OnDestroy() + { + Super.OnDestroy(); + if ( msglist ) msglist.Destroy(); + } + + override void OnSelect() + { + smofs = ofs; + } + override void OnDeselect() + { + smofs = ofs; + } + + override void Ticker() + { + if ( !hist ) return; + int ypos = 0; + bool recenter = true; + if ( !msglist ) + { + msglist = new("DemolitionistMenuList"); + msglist.master = master; + msglist.selected = -1; + msglist.items.Resize(hist.msg.Size()); + for ( int i=0; i (master.ws.x-8) ) + { + SetOffset(pos.y); + master.MenuSound("menu/demoscroll"); + drag = true; + break; + } + case MB_WHEELUP: + if ( Scroll(-8) ) master.MenuSound("menu/demoscroll"); + break; + case MB_WHEELDOWN: + if ( Scroll(8) ) master.MenuSound("menu/demoscroll"); + break; + case MB_DRAG: + if ( drag ) SetOffset(pos.y); + break; + case MB_RELEASE: + drag = false; + break; + } + } + override void Drawer() + { + if ( !hist || (msglist.items.Size() <= 0) ) + { + String str = StringTable.Localize("$SWWM_NOCHAT"); + double xx = int(master.ws.x-smallfont.StringWidth(str))/2; + double yy = int(master.ws.y-smallfont.GetHeight())/2; + Screen.DrawText(smallfont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); + return; + } + double xx = 3; + double yy = 23; + int cliptop = int((master.origin.y+23)*master.hs); + int clipbottom = int((master.origin.y+master.ws.y-23)*master.hs); + int clipleft = int((master.origin.x+3)*master.hs); + int clipright = int((master.origin.x+master.ws.x-9)*master.hs); + msglist.Drawer((xx,yy-smofs),cliptop,clipbottom,clipleft,clipright); + if ( maxofs <= 0 ) return; + xx = master.ws.x-8; + master.DrawVSeparator(xx,14,master.ws.y-28); + xx += 2; + yy = floor(smofs*((master.ws.y-39)/maxofs))+14; + Screen.DrawText(smallfont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,"▮",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); + } +} + +// chat message item +Class DemolitionistMenuChatItem : DemolitionistMenuListItem +{ + BrokenLines l; + int margin; + String tstamp; + + DemolitionistMenuChatItem Init( DemolitionistMenu master, MsgLine m ) + { + Super.Init(master,""); + if ( m.type == -1 ) + { + // map change marker + label = String.Format("\cx[\c-%s\cx]\c-",m.str); + return self; + } + // actually use crimetime for the timestamps, for immersion + int rtime = (m.tic/GameTicRate)+(master.c_minute*60)+(master.c_hour*3600); + int thour = (rtime/3600)%24; + int tmin = (rtime/60)%60; + int tsec = rtime%60; + tstamp = String.Format("\cm[\c-%02d\cm:\c-%02d\cm:\c-%02d\cm]\c- ",thour,tmin,tsec); + margin = smallfont.StringWidth(tstamp); + l = smallfont.BreakLines(m.str,int(master.ws.x-14)-margin); + return self; + } + + override void OnDestroy() + { + Super.OnDestroy(); + if ( l ) l.Destroy(); + } + + override int GetWidth() + { + return int(master.ws.x-14); + } + + override int GetHeight() + { + if ( l ) return l.Count()*14; + return 14; + } + + override void Drawer( Vector2 pos, bool selected, int cliptop, int clipbottom, int clipleft, int clipright ) + { + if ( !l ) + { + // we'll assume this is a level change label + double xx = int((master.ws.x-14)-smallfont.StringWidth(label))/2; + Screen.DrawText(smallfont,Font.CR_GOLD,master.origin.x+pos.x+xx,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + return; + } + Screen.DrawText(smallfont,Font.CR_DARKGRAY,master.origin.x+pos.x,master.origin.y+pos.y,tstamp,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + for ( int i=0; i(width-(maxlen[3]+maxlen[2]+maxlen[1]+maxlen[0]+24)); + Screen.DrawText(smallname?smallfont2:smallfont,Font.CR_FIRE,master.origin.x+pos.x,master.origin.y+pos.y+smallname*2,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + double xx = pos.x+width; + double yy = pos.y+2; + int sec = Thinker.Tics2Seconds(s.time); + str = String.Format("%02d\cu:\c-%02d\cu:\c-%02d",sec/3600,(sec%3600)/60,sec%60); + Screen.DrawText(smallfont2,((s.suck>0)&&(sec>=(s.suck*3600)))?Font.CR_RED:(sec<=s.par)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-smallfont2.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,Font.CR_FIRE,master.origin.x+xx-maxlen[0],master.origin.y+yy,"T",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + if ( maxlen[0] > 0 ) xx -= maxlen[0]+8; + if ( s.stotal > 0 ) + { + str = String.Format("%d\cu/\c-%d",s.scount,s.stotal); + Screen.DrawText(smallfont2,(s.scount>=s.stotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-smallfont2.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,Font.CR_FIRE,master.origin.x+xx-maxlen[1],master.origin.y+yy,"S",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + } + if ( maxlen[1] > 0 ) xx -= maxlen[1]+8; + if ( s.itotal > 0 ) + { + str = String.Format("%d\cu/\c-%d",s.icount,s.itotal); + Screen.DrawText(smallfont2,(s.icount>=s.itotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-smallfont2.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,Font.CR_FIRE,master.origin.x+xx-maxlen[2],master.origin.y+yy,"I",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + } + if ( maxlen[2] > 0 ) xx -= maxlen[2]+8; + if ( s.ktotal > 0 ) + { + str = String.Format("%d\cu/\c-%d",s.kcount,s.ktotal); + Screen.DrawText(smallfont2,(s.kcount>=s.ktotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-smallfont2.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + Screen.DrawText(smallfont2,Font.CR_FIRE,master.origin.x+xx-maxlen[3],master.origin.y+yy,"K",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright); + } + } +} + +// achievement item +Class DemolitionistMenuAchievementItem : DemolitionistMenuListItem +{ + SWWMAchievementInfo a; + TextureID AchievementUnknown, BaseBox, BarTex[3]; + bool ShouldObscure; + bool bHidden; + int width; + BrokenLines l; + String oldstr; + + DemolitionistMenuAchievementItem Init( DemolitionistMenu master, SWWMAchievementInfo a, int width = 0 ) + { + Super.Init(master,""); + self.a = a; + self.width = width; + AchievementUnknown = TexMan.CheckForTexture("graphics/Achievements/HiddenAchievement.png",TexMan.Type_Any); + BaseBox = TexMan.CheckForTexture("graphics/Achievements/NoAchievement.png",TexMan.Type_Any); + BarTex[0] = TexMan.CheckForTexture("graphics/Achievements/BarAchievementBase.png",TexMan.Type_Any); + BarTex[1] = TexMan.CheckForTexture("graphics/Achievements/BarAchievementProgress.png",TexMan.Type_Any); + BarTex[2] = TexMan.CheckForTexture("graphics/Achievements/BarAchievementDone.png",TexMan.Type_Any); + ShouldObscure = (swwm_filterachievements==1); + Update(); + return self; + } + + // cache state/progress to not call it every frame + void Update() + { + a.state = master.shnd.achievementstate.At(a.basename).ToInt(); + if ( !a.maxval ) return; + a.val = master.shnd.achievementprogress.At(a.basename).ToInt(); + if ( !a.bitfield ) return; + int val = 0; + for ( int i=0; i inv; + int col; + bool bSell; + int width; // set in post after list init, used for positioning the price tag + + DemolitionistMenuStoreItem Init( DemolitionistMenu master, Class i, bool bSell = false ) + { + Super.Init(master,""); + inv = i; + col = Font.CR_WHITE; + let def = GetDefaultByType(i); + if ( i is 'Weapon' ) col = SWWMUtility.IsVIPItemClass(i)?Font.FindFontColor('VIPGold'):Font.CR_GOLD; + else if ( i is 'MagAmmo' ) col = SWWMUtility.IsVIPItemClass(i)?Font.FindFontColor('VIPTan'):Font.CR_TAN; + else if ( (i is 'BackpackItem') || (i is 'HammerspaceEmbiggener') ) col = Font.CR_DARKBROWN; + else if ( i is 'Ammo' ) col = SWWMUtility.IsVIPItemClass(i)?Font.FindFontColor('VIPBrown'):Font.CR_BROWN; + else if ( (i is 'PowerupGiver') || (i is 'AmmoFabricator') || def.bBIGPOWERUP ) col = SWWMUtility.IsVIPItemClass(i)?Font.FindFontColor('VIPPurple'):Font.CR_PURPLE; + else if ( (i is 'Health') || (i is 'HealthPickup') || (i is 'SWWMHealth') ) col = Font.CR_RED; + else if ( (i is 'Armor') || (i is 'SWWMSpareArmor') ) col = Font.CR_GREEN; + self.bSell = bSell; + return self; + } + + int GetPrice() + { + return 0; + } + + int GetUnits() + { + return 0; + } +} diff --git a/zscript/swwm_thinkers_player.zsc b/zscript/swwm_thinkers_player.zsc index 0b3e4be35..15001efd4 100644 --- a/zscript/swwm_thinkers_player.zsc +++ b/zscript/swwm_thinkers_player.zsc @@ -4,6 +4,7 @@ // this can be accessed from a section of the knowledge base Class SWWMFullHistory : Thinker { + String lastmap; Array msg; static clearscope SWWMFullHistory Get() @@ -20,7 +21,17 @@ Class SWWMFullHistory : Thinker fh = new("SWWMFullHistory"); fh.ChangeStatNum(STAT_STATIC); } - MsgLine m = new("MsgLine"); + MsgLine m; + if ( level.mapname != fh.lastmap ) + { + // push a map change label + m = new("MsgLine"); + m.str = level.levelname; + m.type = -1; + fh.lastmap = level.mapname; + fh.msg.Push(m); + } + m = new("MsgLine"); m.str = str; m.tic = tic; m.type = type;