diff --git a/animdefs.misc b/animdefs.misc index 5d1cbd7ac..2afb1beb3 100644 --- a/animdefs.misc +++ b/animdefs.misc @@ -10,4 +10,4 @@ canvastexture MORTLED1 256 128 canvastexture MORTLED2 64 16 // minimap -canvastexture MMCANVAS 80 80 +canvastexture MMCANVAS 100 100 diff --git a/cvarinfo.base b/cvarinfo.base index a2795f373..d311bb211 100644 --- a/cvarinfo.base +++ b/cvarinfo.base @@ -2,7 +2,7 @@ user string swwm_voicetype = "default"; // voice for your demolitionist user int swwm_tagcolor = 0; // customize glowing tag color nosave float swwm_flashstrength = 1.0; // strength of screen flashes -nosave int swwm_hudmargin = 10; // margin around fullscreen hud elements +nosave int swwm_hudmargin = 5; // margin around fullscreen hud elements nosave int swwm_mutevoice = 0; // mute demolitionist voice // 0 - none // 1 - combat comments diff --git a/graphics/HUD/ChatBoxBottomSmol.png b/graphics/HUD/ChatBoxBottomSmol.png new file mode 100644 index 000000000..595349631 Binary files /dev/null and b/graphics/HUD/ChatBoxBottomSmol.png differ diff --git a/graphics/HUD/ChatBoxBottom_Smol.png b/graphics/HUD/ChatBoxBottom_Smol.png deleted file mode 100644 index bf0104731..000000000 Binary files a/graphics/HUD/ChatBoxBottom_Smol.png and /dev/null differ diff --git a/graphics/HUD/ChatBoxLineSmol.png b/graphics/HUD/ChatBoxLineSmol.png new file mode 100644 index 000000000..1c338a9f0 Binary files /dev/null and b/graphics/HUD/ChatBoxLineSmol.png differ diff --git a/graphics/HUD/ChatBoxLine_Smol.png b/graphics/HUD/ChatBoxLine_Smol.png deleted file mode 100644 index 0c4857118..000000000 Binary files a/graphics/HUD/ChatBoxLine_Smol.png and /dev/null differ diff --git a/graphics/HUD/ChatBoxTopSmol.png b/graphics/HUD/ChatBoxTopSmol.png new file mode 100644 index 000000000..0a7eef8ca Binary files /dev/null and b/graphics/HUD/ChatBoxTopSmol.png differ diff --git a/graphics/HUD/ChatBoxTop_Smol.png b/graphics/HUD/ChatBoxTop_Smol.png deleted file mode 100644 index 1a46e29ea..000000000 Binary files a/graphics/HUD/ChatBoxTop_Smol.png and /dev/null differ diff --git a/graphics/HUD/MinimapBox.png b/graphics/HUD/MinimapBox.png index 9c5ca7abd..e87fbff80 100644 Binary files a/graphics/HUD/MinimapBox.png and b/graphics/HUD/MinimapBox.png differ diff --git a/graphics/HUD/MinimapBoxSmol.png b/graphics/HUD/MinimapBoxSmol.png new file mode 100644 index 000000000..9c5ca7abd Binary files /dev/null and b/graphics/HUD/MinimapBoxSmol.png differ diff --git a/language.version b/language.version index 6ee2a1bff..8e0dbeeca 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1000 \cu(Mon 6 Nov 23:50:09 CET 2023)\c-"; -SWWM_SHORTVER="\cw1.3pre r1000 \cu(2023-11-06 23:50:09)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1001 \cu(Tue 7 Nov 14:24:53 CET 2023)\c-"; +SWWM_SHORTVER="\cw1.3pre r1001 \cu(2023-11-07 14:24:53)\c-"; diff --git a/menudef.txt b/menudef.txt index 22e84228e..b3eb40b86 100644 --- a/menudef.txt +++ b/menudef.txt @@ -134,7 +134,7 @@ OptionMenu "SWWMOptionMenu" Option "$SWWM_FORCESTATS", "swwm_forcestats", "SWWMForceStats" Option "$SWWM_PERCENTSTATS", "swwm_percentstats", "YesNo" Option "$SWWM_UNIQSTATS", "swwm_uniqstats", "YesNo" - Slider "$SWWM_HUDMARGIN", "swwm_hudmargin", 0, 20, 1, 0 + Slider "$SWWM_HUDMARGIN", "swwm_hudmargin", 0, 10, 1, 0 SWWMScaleField "$SWWM_HUDSCALE", "swwm_hudscale", "$SWWM_HS_AUTO" SWWMScaleField "$SWWM_HUDSCALE0", "swwm_hudscale0", "$SWWM_HS_AUTO" SWWMScaleField "$SWWM_HUDSCALE1", "swwm_hudscale1", "$SWWM_HS_AUTO" diff --git a/zscript/hud/swwm_hud.zsc b/zscript/hud/swwm_hud.zsc index 955c2df5c..e1d1fa33d 100644 --- a/zscript/hud/swwm_hud.zsc +++ b/zscript/hud/swwm_hud.zsc @@ -24,7 +24,7 @@ Class MsgLine if ( rep > 1 ) nstr.AppendFormat(" (x%d)",rep); let fnt = Font.GetFont('TewiFont'); l = fnt.BreakLines(nstr,(type==PRINT_LOW)?sz:361); - if ( type != PRINT_LOW ) ls = fnt.BreakLines(nstr,211); + if ( type != PRINT_LOW ) ls = fnt.BreakLines(nstr,281); } } @@ -88,7 +88,7 @@ Class SWWMStatusBar : BaseStatusBar { TextureID StatusTex, WeaponTex, ScoreTex, InventoryTex, ChatTex[6], HealthTex[9], FuelTex[2], DashTex, EnemyBTex, EnemyHTex[7], - GenericAmmoTex[3], AmmoTex[3], MiniBox, bgtex, FaceTex[19]; + GenericAmmoTex[3], AmmoTex[3], MiniBox[2], bgtex, FaceTex[19]; Font mSmallFont, mSmallFontOutline, mTinyFont, mTinyFontOutline, MiniHUDFont, MiniHUDFontOutline; int mhudfontcol[NUM_MINIHUD_COLOR]; @@ -149,7 +149,8 @@ Class SWWMStatusBar : BaseStatusBar // minimap constants const CLIPDIST = 800; // clip distance for minimap view, with rotation accounted const MAPVIEWDIST = 1132; // maximum distance for something to be considered visible (rounded up CLIPDIST*sqrt(2)) - const HALFMAPSIZE = 40; // half the size of the minimap draw region (unscaled) + const HALFMAPSIZE = 50; // half the size of the minimap draw region (unscaled) + const HALFMAPSIZE_SMALL = 40; // half of size when using small minimap // minimap colors (thats a lot of 'em) Color mm_backcolor, mm_cdwallcolor, mm_efwallcolor, mm_fdwallcolor, mm_interlevelcolor, mm_intralevelcolor, mm_lockedcolor, mm_notseencolor, mm_portalcolor, mm_secretsectorcolor, mm_secretwallcolor, mm_specialwallcolor, mm_thingcolor, mm_thingcolor_citem, mm_thingcolor_friend, mm_thingcolor_item, mm_thingcolor_monster, mm_thingcolor_ncmonster, mm_thingcolor_shootable, mm_thingcolor_vipitem, mm_thingcolor_missile, mm_tswallcolor, mm_unexploredsecretcolor, mm_wallcolor, mm_yourcolor; @@ -273,9 +274,9 @@ Class SWWMStatusBar : BaseStatusBar ChatTex[0] = TexMan.CheckForTexture("graphics/HUD/ChatBoxTop.png"); ChatTex[1] = TexMan.CheckForTexture("graphics/HUD/ChatBoxLine.png"); ChatTex[2] = TexMan.CheckForTexture("graphics/HUD/ChatBoxBottom.png"); - ChatTex[3] = TexMan.CheckForTexture("graphics/HUD/ChatBoxTop_Smol.png"); - ChatTex[4] = TexMan.CheckForTexture("graphics/HUD/ChatBoxLine_Smol.png"); - ChatTex[5] = TexMan.CheckForTexture("graphics/HUD/ChatBoxBottom_Smol.png"); + ChatTex[3] = TexMan.CheckForTexture("graphics/HUD/ChatBoxTopSmol.png"); + ChatTex[4] = TexMan.CheckForTexture("graphics/HUD/ChatBoxLineSmol.png"); + ChatTex[5] = TexMan.CheckForTexture("graphics/HUD/ChatBoxBottomSmol.png"); InventoryTex = TexMan.CheckForTexture("graphics/HUD/InventoryBox.png"); EnemyBTex = TexMan.CheckForTexture("graphics/HUD/EnemyBox.png"); EnemyHTex[0] = TexMan.CheckForTexture("graphics/HUD/EnemyBar.png"); @@ -291,7 +292,8 @@ Class SWWMStatusBar : BaseStatusBar AmmoTex[0] = TexMan.CheckForTexture("graphics/HUD/AmmoBoxT.png"); AmmoTex[1] = TexMan.CheckForTexture("graphics/HUD/AmmoBoxM.png"); AmmoTex[2] = TexMan.CheckForTexture("graphics/HUD/AmmoBoxB.png"); - MiniBox = TexMan.CheckForTexture("graphics/HUD/MinimapBox.png"); + MiniBox[0] = TexMan.CheckForTexture("graphics/HUD/MinimapBox.png"); + MiniBox[1] = TexMan.CheckForTexture("graphics/HUD/MinimapBoxSmol.png"); bgtex = TexMan.CheckForTexture("graphics/tempbg.png"); FaceTex[0] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Head.png"); FaceTex[1] = TexMan.CheckForTexture("graphics/HUD/DemoFace_Flash.png"); @@ -629,7 +631,7 @@ Class SWWMStatusBar : BaseStatusBar if ( !hnd ) hnd = SWWMHandler(EventHandler.Find("SWWMHandler")); hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.); ss = (Screen.GetWidth()/hs,Screen.GetHeight()/hs); - margin = clamp(swwm_hudmargin,0,20); + margin = clamp(swwm_hudmargin,0,10); hs0 = hs; hs1 = max(hs-1.,1.); hs2 = max(hs-2.,1.); diff --git a/zscript/hud/swwm_hud_topstuff.zsc b/zscript/hud/swwm_hud_topstuff.zsc index 72aff1b2c..5792d5528 100644 --- a/zscript/hud/swwm_hud_topstuff.zsc +++ b/zscript/hud/swwm_hud_topstuff.zsc @@ -333,10 +333,11 @@ extend Class SWWMStatusBar return false; } - private void DrawMapLines( Vector2 basepos, bool bUseCanvas = false ) + private void DrawMapLines( Vector2 basepos, bool smol, bool bUseCanvas = false ) { double zoomlevel = SWWMUtility.Lerp(oldminimapzoom,minimapzoom,FracTic); double zoomview = MAPVIEWDIST*zoomlevel, zoomclip = CLIPDIST*zoomlevel; + int hsz = smol?HALFMAPSIZE_SMALL:HALFMAPSIZE; Vector2 cpos = SWWMUtility.LerpVector2(players[consoleplayer].Camera.prev.xy,players[consoleplayer].Camera.pos.xy,FracTic); Sector csec = players[consoleplayer].Camera.CurSector; int thisgroup = csec.portalgroup; @@ -379,8 +380,8 @@ extend Class SWWMStatusBar [visible, rv1, rv2] = SWWMUtility.LiangBarsky((-1,-1)*zoomclip,(1,1)*zoomclip,rv1,rv2); if ( !visible ) continue; // scale to minimap frame - rv1 *= HALFMAPSIZE/zoomclip; - rv2 *= HALFMAPSIZE/zoomclip; + rv1 *= hsz/zoomclip; + rv2 *= hsz/zoomclip; if ( !bUseCanvas ) { rv1 *= hs; @@ -474,10 +475,11 @@ extend Class SWWMStatusBar } } } - private void DrawMapMarkers( Vector2 basepos, bool bUseCanvas = false ) + private void DrawMapMarkers( Vector2 basepos, bool smol, bool bUseCanvas = false ) { double zoomlevel = SWWMUtility.Lerp(oldminimapzoom,minimapzoom,FracTic); double zoomview = MAPVIEWDIST*zoomlevel, zoomclip = CLIPDIST*zoomlevel; + int hsz = smol?HALFMAPSIZE_SMALL:HALFMAPSIZE; Vector2 cpos = SWWMUtility.LerpVector2(players[consoleplayer].Camera.prev.xy,players[consoleplayer].Camera.pos.xy,FracTic); Sector csec = players[consoleplayer].Camera.CurSector; if ( !mi ) mi = ThinkerIterator.Create("MapMarker",Thinker.STAT_MAPMARKER); @@ -521,7 +523,7 @@ extend Class SWWMStatusBar // rotate by view rv = Actor.RotateVector(rv,ViewRot.x-90); // scale to minimap frame - rv *= HALFMAPSIZE/zoomclip; + rv *= hsz/zoomclip; if ( !bUseCanvas ) rv *= hs; // offset to minimap center rv += basepos; @@ -548,7 +550,7 @@ extend Class SWWMStatusBar // rotate by view rv = Actor.RotateVector(rv,ViewRot.x-90); // scale to minimap frame - rv *= HALFMAPSIZE/zoomclip; + rv *= hsz/zoomclip; if ( !bUseCanvas ) rv *= hs; // offset to minimap center rv += basepos; @@ -557,10 +559,11 @@ extend Class SWWMStatusBar else Screen.DrawTexture(tx,false,rv.x,rv.y,DTA_ColorOverlay,isportal?Color(128,mm_portalcolor.r,mm_portalcolor.g,mm_portalcolor.b):Color(0,0,0,0),DTA_ScaleX,hs*scl.x,DTA_ScaleY,hs*scl.y,DTA_LegacyRenderStyle,m.GetRenderStyle(),DTA_Alpha,m.Alpha,DTA_FillColor,m.FillColor,DTA_TranslationIndex,m.Translation); } } - private void DrawMapThings( Vector2 basepos, bool bUseCanvas = false ) + private void DrawMapThings( Vector2 basepos, bool smol, bool bUseCanvas = false ) { double zoomlevel = SWWMUtility.Lerp(oldminimapzoom,minimapzoom,FracTic); double zoomview = MAPVIEWDIST*zoomlevel, zoomclip = CLIPDIST*zoomlevel; + int hsz = smol?HALFMAPSIZE_SMALL:HALFMAPSIZE; Vector2 cpos = SWWMUtility.LerpVector2(players[consoleplayer].Camera.prev.xy,players[consoleplayer].Camera.pos.xy,FracTic); Sector csec = players[consoleplayer].Camera.CurSector; bool drawmissiles = swwm_mm_missiles; @@ -684,8 +687,8 @@ extend Class SWWMStatusBar if ( visible ) { // scale to minimap frame - x0 *= HALFMAPSIZE/zoomclip; - x1 *= HALFMAPSIZE/zoomclip; + x0 *= hsz/zoomclip; + x1 *= hsz/zoomclip; if ( !bUseCanvas ) { x0 *= hs; @@ -720,38 +723,43 @@ extend Class SWWMStatusBar return StringTable.Localize("$SWWM_PLACE"..val); } - private void DrawMinimap( int xx, int yy ) + private void DrawMinimap( int xx, int yy, bool smol ) { - // experiment: use canvas + int hsz = smol?HALFMAPSIZE_SMALL:HALFMAPSIZE; + // draws at fixed resolution if ( swwm_mm_usecanvas ) { if ( !mm_canvas ) mm_canvas = TexMan.GetCanvas("MMCANVAS"); if ( !mm_canvastex ) mm_canvastex = TexMan.CheckForTexture("MMCANVAS"); - mm_canvas.Clear(0,0,HALFMAPSIZE*2,HALFMAPSIZE*2,mm_backcolor); - Vector2 basemappos = (HALFMAPSIZE,HALFMAPSIZE); + mm_canvas.Clear(0,0,hsz*2,hsz*2,mm_backcolor); + Vector2 basemappos = (hsz,hsz); // draw dat stuff - DrawMapLines(basemappos,true); - DrawMapThings(basemappos,true); - DrawMapMarkers(basemappos,true); + DrawMapLines(basemappos,smol,true); + DrawMapThings(basemappos,smol,true); + DrawMapMarkers(basemappos,smol,true); // finally, draw the player arrow Vector2 tv[] = {(0,-4),(-3,2),(3,2)}; - for ( int i=0; i<3; i++ ) mm_canvas.DrawLine(int(tv[i].x+HALFMAPSIZE),int(tv[i].y+HALFMAPSIZE),int(tv[(i+1)%3].x+HALFMAPSIZE),int(tv[(i+1)%3].y+HALFMAPSIZE),mm_yourcolor); + for ( int i=0; i<3; i++ ) mm_canvas.DrawLine(int(tv[i].x+hsz),int(tv[i].y+hsz),int(tv[(i+1)%3].x+hsz),int(tv[(i+1)%3].y+hsz),mm_yourcolor); // HACK: don't draw before the first refresh of the canvas // there is a one-frame delay for its contents to get updated when drawing in the HUD if ( (level.maptime > 1) && mm_cvfirstdraw ) - Screen.DrawTexture(mm_canvastex,false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - else Screen.Dim(mm_backcolor,1.,int((xx+2)*hs),int((yy+2)*hs),int(HALFMAPSIZE*2*hs),int(HALFMAPSIZE*2*hs)); + { + // make sure we don't draw the whole thing if we're using the smaller scale + Screen.DrawTexture(mm_canvastex,false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true, + DTA_SrcWidth,hsz*2,DTA_SrcHeight,hsz*2,DTA_DestWidth,hsz*2,DTA_DestHeight,hsz*2); + } + else Screen.Dim(mm_backcolor,1.,int((xx+2)*hs),int((yy+2)*hs),int(hsz*2*hs),int(hsz*2*hs)); mm_cvfirstdraw = true; return; } mm_cvfirstdraw = false; - Vector2 basemappos = (xx+HALFMAPSIZE+2,yy+HALFMAPSIZE+2); - Screen.Dim(mm_backcolor,1.,int((basemappos.x-HALFMAPSIZE)*hs),int((basemappos.y-HALFMAPSIZE)*hs),int(HALFMAPSIZE*2*hs),int(HALFMAPSIZE*2*hs)); - Screen.SetClipRect(int((basemappos.x-HALFMAPSIZE)*hs),int((basemappos.y-HALFMAPSIZE)*hs),int(HALFMAPSIZE*2*hs),int(HALFMAPSIZE*2*hs)); + Vector2 basemappos = (xx+hsz+2,yy+hsz+2); + Screen.Dim(mm_backcolor,1.,int((basemappos.x-hsz)*hs),int((basemappos.y-hsz)*hs),int(hsz*2*hs),int(hsz*2*hs)); + Screen.SetClipRect(int((basemappos.x-hsz)*hs),int((basemappos.y-hsz)*hs),int(hsz*2*hs),int(hsz*2*hs)); // draw dat stuff - DrawMapLines(basemappos*hs); - DrawMapThings(basemappos*hs); - DrawMapMarkers(basemappos*hs); + DrawMapLines(basemappos*hs,smol); + DrawMapThings(basemappos*hs,smol); + DrawMapMarkers(basemappos*hs,smol); // finally, draw the player arrow Vector2 tv[] = {(0,-4),(-3,2),(3,2)}; for ( int i=0; i<3; i++ ) tv[i] = (tv[i]+basemappos)*hs; @@ -765,10 +773,12 @@ extend Class SWWMStatusBar // obviously, don't draw the minimap if the automap is open if ( !automapactive && swwm_mm_enable ) { - xx = int(ss.x-(margin+(HALFMAPSIZE+2)*2)); - Screen.DrawTexture(MiniBox,false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - DrawMinimap(xx,yy); - yy += ((HALFMAPSIZE+2)*2)+5; + bool smol = (ss.x<480); + int hsz = smol?HALFMAPSIZE_SMALL:HALFMAPSIZE; + xx = int(ss.x-(margin+(hsz+2)*2)); + Screen.DrawTexture(MiniBox[smol],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + DrawMinimap(xx,yy,smol); + yy += ((hsz+2)*2)+5; } // draw stats and timer when automap is open int fstats = swwm_forcestats;