diff --git a/LOCALIZATION.md b/LOCALIZATION.md index d8c33c48f..4e2358d2b 100644 --- a/LOCALIZATION.md +++ b/LOCALIZATION.md @@ -16,6 +16,10 @@ In regards to what should and should not be localized, this will be noted in com Each entry must have only one of each TAG, TAB and REL section, and at least one TXT section. When localizing, DO NOT copy the TAB and REL sections, as these are for internal use and mustn't be translated, instead handle only the TAG and TXT sections. +## Font support + +Both fonts in use fully support Latin, Greek and Cyrillic scripts. + ## Language codes For a list of these, consult the ZDoom wiki article for [LANGUAGE](https://zdoom.org/wiki/LANGUAGE#Language_codes). \ No newline at end of file diff --git a/fonts.wad b/fonts.wad index 8ed1a28f5..1d416d676 100644 Binary files a/fonts.wad and b/fonts.wad differ diff --git a/graphics/HUD/ChatBoxTop.png b/graphics/HUD/ChatBoxTop.png index 963ba861c..dc6cbc3e2 100644 Binary files a/graphics/HUD/ChatBoxTop.png and b/graphics/HUD/ChatBoxTop.png differ diff --git a/graphics/HUD/ChatBoxTop_Smol.png b/graphics/HUD/ChatBoxTop_Smol.png index 1c1e32453..08ec5867f 100644 Binary files a/graphics/HUD/ChatBoxTop_Smol.png and b/graphics/HUD/ChatBoxTop_Smol.png differ diff --git a/language.version b/language.version index 1732ba4ac..3b7172838 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\chSWWM \czGZ\c- \cw1.2pre r83 \cu(Fri 17 Dec 00:24:38 CET 2021)\c-"; -SWWM_SHORTVER="\cw1.2pre r83 \cu(2021-12-17 00:24:38)\c-"; +SWWM_MODVER="\chSWWM \czGZ\c- \cw1.2pre r84 \cu(Fri 17 Dec 19:57:23 CET 2021)\c-"; +SWWM_SHORTVER="\cw1.2pre r84 \cu(2021-12-17 19:57:23)\c-"; diff --git a/menudef.txt b/menudef.txt index 053bdb703..d9ae97b87 100644 --- a/menudef.txt +++ b/menudef.txt @@ -89,7 +89,10 @@ OptionMenu "SWWMOptionMenu" Option "$SWWM_MUTELEVEL", "swwm_mutevoice", "SWWMVoice" Slider "$SWWM_VOICEAMP", "swwm_voiceamp", 1, 4, 1, 0 Option "$SWWM_BEEPBOOP", "swwm_beepboop", "YesNo" - Option "$SWWM_6DOF", "swwm_fly6dof", "YesNo" + IfGame(Hexen) + { + Option "$SWWM_6DOF", "swwm_fly6dof", "YesNo" + } Option "$SWWM_REVIVE", "swwm_revive", "YesNo" ScaleSliderFix "$SWWM_REVIVECOOLDOWN", "swwm_revivecooldown", -1, 300, 30, "$SWWM_UNLIMITED", "$SWWM_ONERETRY" Option "$SWWM_MENUPAUSE", "swwm_menupause", "YesNo" @@ -120,7 +123,10 @@ OptionMenu "SWWMOptionMenu" Option "$SWWM_ACCDAMAGE", "swwm_accdamage", "YesNo" Option "$SWWM_SCORENUMS", "swwm_scorenums", "YesNo" Option "$SWWM_SCOREBONUS", "swwm_scorebonus", "YesNo" - Option "$SWWM_POIS", "swwm_pois", "YesNo" + IfGame(Doom, Heretic) + { + Option "$SWWM_POIS", "swwm_pois", "YesNo" + } Option "$SWWM_NOMAPMSG", "swwm_nomapmsg", "NoYes" ScaleSlider "$SWWM_MAXTARGETDIST", "swwm_maxtargetdist", 0, 6000, 100, "$SWWM_UNLIMITED" ScaleSlider "$SWWM_MAXTARGETS", "swwm_maxtargets", 0, 1000, 1, "$SWWM_UNLIMITED" @@ -130,18 +136,27 @@ OptionMenu "SWWMOptionMenu" ScaleSlider "$SWWM_BARSCALE", "swwm_barscale", 0, 8, 1, "$SWWM_GZSCALE" ScaleSlider "$SWWM_NUMSCALE", "swwm_numscale", 0, 8, 1, "$SWWM_GZSCALE" ScaleSlider "$SWWM_SCRSCALE", "swwm_scrscale", 0, 8, 1, "$SWWM_GZSCALE" - ScaleSlider "$SWWM_POISCALE", "swwm_poiscale", 0, 8, 1, "$SWWM_GZSCALE" + IfGame(Doom, Heretic) + { + ScaleSlider "$SWWM_POISCALE", "swwm_poiscale", 0, 8, 1, "$SWWM_GZSCALE" + } ScaleSlider "$SWWM_DETSCALE", "swwm_detscale", 0, 8, 1, "$SWWM_GZSCALE" Option "$SWWM_NUMCOLOR_SCR", "swwm_numcolor_scr", "TextColors" Option "$SWWM_NUMCOLOR_BONUS", "swwm_numcolor_bonus", "TextColors" Option "$SWWM_NUMCOLOR_DMG", "swwm_numcolor_dmg", "TextColors" Option "$SWWM_NUMCOLOR_HP", "swwm_numcolor_hp", "TextColors" Option "$SWWM_NUMCOLOR_AP", "swwm_numcolor_ap", "TextColors" - Option "$SWWM_INTERART", "swwm_interart", "YesNo" - Option "$SWWM_NOINTERTIPS", "swwm_nointertips", "YesNo" - Option "$SWWM_INTERMUSIC", "swwm_intermusic", "YesNo" + IfGame(Doom, Heretic) + { + Option "$SWWM_INTERART", "swwm_interart", "YesNo" + Option "$SWWM_NOINTERTIPS", "swwm_nointertips", "YesNo" + Option "$SWWM_INTERMUSIC", "swwm_intermusic", "YesNo" + } Option "$SWWM_FUZZ", "swwm_fuzz", "YesNo" - Option "$SWWM_SILENCEMAP", "swwm_silencemap", "YesNo" + IfGame(Doom, Heretic) + { + Option "$SWWM_SILENCEMAP", "swwm_silencemap", "YesNo" + } Option "$SWWM_FILTERACHIEVEMENTS", "swwm_filterachievements", "SWWMFilterAchievements" StaticText " " StaticText "$SWWM_ETITLE", "Blue" @@ -177,7 +192,10 @@ OptionMenu "SWWMOptionMenu" Option "$SWWM_RESETSCORE", "swwm_resetscore", "YesNo" Option "$SWWM_EXTRAALERT", "swwm_extraalert", "YesNo" Option "$SWWM_BOSSENHANCE", "swwm_upgradebosses", "YesNo" - Option "$SWWM_DOOMFALL", "swwm_doomfall", "YesNo" + IfGame(Doom, Heretic) + { + Option "$SWWM_DOOMFALL", "swwm_doomfall", "YesNo" + } Option "$SWWM_BALLUSE", "swwm_balluse", "YesNo" Option "$SWWM_CBTALL", "swwm_cbtall", "YesNo" Option "$SWWM_UNCAPALERT", "swwm_uncapalert", "YesNo" @@ -194,7 +212,10 @@ OptionMenu "SWWMOptionMenu" Option "$SWWM_MELEEPICKUP", "swwm_meleepickup", "YesNo" Option "$SWWM_ARMORUSE", "swwm_autousearmor", "YesNo" Option "$SWWM_HEALTHUSE", "swwm_autousehealth", "YesNo" - Option "$SWWM_BARRIERUSE", "swwm_autousebarrier", "YesNo" + IfGame(Doom) + { + Option "$SWWM_BARRIERUSE", "swwm_autousebarrier", "YesNo" + } Option "$SWWM_SINGLEFIRST", "swwm_singlefirst", "YesNo" Option "$SWWM_EARBUSTER", "swwm_earbuster", "YesNo" Option "$SWWM_BUSTERPAUSE", "swwm_cbtpause", "YesNo" @@ -207,7 +228,10 @@ OptionMenu "SWWMOptionMenu" Option "$SWWM_SKEYS", "swwm_sharekeys", "YesNo" Option "$SWWM_SVARMORUSE", "swwm_enforceautousearmor", "SWWMEnforce" Option "$SWWM_SVHEALTHUSE", "swwm_enforceautousehealth", "SWWMEnforce" - Option "$SWWM_SVBARRIERUSE", "swwm_enforceautousebarrier", "SWWMEnforce" + IfGame(Doom) + { + Option "$SWWM_SVBARRIERUSE", "swwm_enforceautousebarrier", "SWWMEnforce" + } Option "$SWWM_OTHERVOICE", "swwm_othervoice", "YesNo" StaticText " " StaticText "$SWWM_MCTITLE", "Blue" @@ -216,8 +240,6 @@ OptionMenu "SWWMOptionMenu" { Option "$SWWM_DRLASKILL", "swwm_drlaskill", "SWWMDRLASkill" } - StaticText " " - StaticText " " } OptionValue "SWWMMinimapColorset" diff --git a/tools/.gitignore b/tools/.gitignore index 1d7591001..4b91e2d7c 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -1,4 +1,3 @@ -mkfontblock -mkfontsingle +mkfont mkstartup mklang diff --git a/tools/build.sh b/tools/build.sh index 8e8bcb424..f1bd2dde8 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -1,5 +1,4 @@ #!/bin/sh -gcc -std=c11 -march=native -Os -Wall -Wextra -Werror -pedantic $(pkg-config --libs --cflags freetype2 libpng) -o mkfontblock mkfontblock.c -gcc -std=c11 -march=native -Os -Wall -Wextra -Werror -pedantic $(pkg-config --libs --cflags freetype2 libpng) -o mkfontsingle mkfontsingle.c +gcc -std=c11 -march=native -Os -Wall -Wextra -Werror -pedantic $(pkg-config --libs --cflags freetype2 libpng) -o mkfont mkfont.c gcc -std=c11 -march=native -Os -Wall -Wextra -Werror -pedantic -o mkstartup mkstartup.c gcc -std=c11 -march=native -Os -Wall -Wextra -Werror -pedantic -o mklang mklang.c diff --git a/tools/mkfont.bugs b/tools/mkfont.bugs new file mode 100644 index 000000000..02cf6f621 --- /dev/null +++ b/tools/mkfont.bugs @@ -0,0 +1,10 @@ +- There is currently no handline of proportional fonts whatsoever, this expects + monospaced fonts where all glyphs have the same size. Dunno if I'd ever + bother with that in the future. +- This is meant only for bitmap fonts, other font types will break things HARD. +- Doesn't handle unicode blocks beyond the basic multilingual plane, might + actually be an issue with freetype itself, or the fonts I use, though I CAN + see that the glyphs are there if I use a character map program. Not that this + even matters considering GZDoom only supports the 0000-FFFF range anyway. +- It might be possible to calculate the cell size instead of having to input it + manually, but I'm too lazy to even bother. diff --git a/tools/mkfontsingle.c b/tools/mkfont.c similarity index 64% rename from tools/mkfontsingle.c rename to tools/mkfont.c index 868543d2c..94cf749ca 100644 --- a/tools/mkfontsingle.c +++ b/tools/mkfont.c @@ -31,6 +31,9 @@ #include #include FT_FREETYPE_H +uint8_t pal[768]; +int palsize = 0; + int writepng( const char *filename, uint8_t *fdata, int w, int h, int p ) { if ( !filename ) return 0; @@ -58,7 +61,7 @@ int writepng( const char *filename, uint8_t *fdata, int w, int h, int p ) return 0; } png_init_io(pngp,pf); - png_set_IHDR(pngp,infp,w,h,8,PNG_COLOR_TYPE_GA, + png_set_IHDR(pngp,infp,w,h,8,palsize?PNG_COLOR_TYPE_RGBA:PNG_COLOR_TYPE_GA, PNG_INTERLACE_NONE,PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); png_write_info(pngp,infp); @@ -79,9 +82,8 @@ uint8_t *idata; int gradient = 0; int upshift = 0; -void putpixel( uint8_t v, uint8_t a, int x, int y ) +void putpixel_grayscale( uint8_t v, uint8_t a, int x, int y ) { - if ( (x < 0) || (x >= iw) || (y < 0) || (y >= ih) ) return; uint32_t tpos = (x+y*iw)*2; // add alpha int alph = idata[tpos+1]; @@ -95,8 +97,36 @@ void putpixel( uint8_t v, uint8_t a, int x, int y ) idata[tpos] = col; } +void putpixel_color( uint8_t v, uint8_t a, int x, int y ) +{ + uint32_t tpos = (x+y*iw)*4; + // add alpha + int alph = idata[tpos+3]; + alph += a; + if ( alph > 255 ) alph = 255; + idata[tpos+3] = alph; + // blend color (RGB) + for ( int i=0; i<3; i++ ) + { + int col = idata[tpos+i]*(a-255); + int palent = (v*palsize)/256; + col += pal[palent*3+i]*a; + col /= 255; + idata[tpos+i] = col; + } +} + +void putpixel( uint8_t v, uint8_t a, int x, int y ) +{ + if ( (x < 0) || (x >= iw) || (y < 0) || (y >= ih) ) return; + if ( palsize == 0 ) putpixel_grayscale(v,a,x,y); + else putpixel_color(v,a,x,y); +} + uint8_t lerpg( float a ) { + if ( a >= 1. ) return 255; + if ( a <= 0. ) return 64; return (uint8_t)(a*191+64); } @@ -110,9 +140,10 @@ int draw_glyph( FT_Bitmap *bmp, uint8_t v, uint32_t px, uint32_t py, uint8_t ox, // apply gradient, if any if ( v == 255 ) { - float a = (j+oy-upshift)/(float)h; + float a = (j+oy+(upshift+1))/(float)h; if ( (gradient&3) == 1 ) rv = lerpg(1.-a); else if ( (gradient&3) == 2 ) rv = lerpg(a); + else if ( (gradient&3) == 3 ) rv = lerpg((a>.5)?((1.-a)*2.):(a*2.)); } for ( i=0; iwidth; i++ ) { @@ -136,30 +167,119 @@ int draw_glyph( FT_Bitmap *bmp, uint8_t v, uint32_t px, uint32_t py, uint8_t ox, return drawn; } +int palinv = 0; + +void loadpalette( const char *path ) +{ + FILE *f = fopen(path,"rb"); + if ( !f ) + { + fprintf(stderr,"warning: could not open palette file '%s', falling back to grayscale\n",path); + return; + } + fseek(f,0,SEEK_END); + long sz = ftell(f); + fseek(f,0,SEEK_SET); + if ( sz <= 0 ) + { + fprintf(stderr,"warning: palette is empty, falling back to grayscale\n"); + goto palend; + } + if ( !(sz%3) ) + { + // RGB8 palette + if ( sz > 768 ) + { + fprintf(stderr,"warning: palette has more than 256 entries, extra colors will be ignored\n"); + palsize = 256; + } + else palsize = sz/3; + for ( int i=0; i 1024 ) + { + fprintf(stderr,"warning: palette has more than 256 entries, extra colors will be ignored\n"); + palsize = 256; + } + else palsize = sz/4; + for ( int i=0; i " - " [gradient type] [upshift]\n"); + " [gradient type] [upshift] [color palette] [-palinv]\n"); return 1; } if ( FT_Init_FreeType(&ftlib) ) + { + fprintf(stderr,"error: failed to init freetype library\n"); return 2; + } uint32_t range[2] = {0x0000,0x00FF}; sscanf(argv[2],"%d",&pxsiz); sscanf(argv[3],"%dx%d",&w,&h); sscanf(argv[4],"%x-%x",&range[0],&range[1]); if ( argc > 5 ) sscanf(argv[5],"%d",&gradient); - if ( argc > 6 ) sscanf(argv[6],"%d",&upshift); + if ( argc > 8 ) palinv = !strcmp(argv[8],"-palinv"); + if ( argc > 7 ) loadpalette(argv[7]); if ( FT_New_Face(ftlib,argv[1],0,&fnt) ) + { + fprintf(stderr,"error: failed to open font '%s'\n",argv[1]); return 4; + } if ( FT_Set_Pixel_Sizes(fnt,0,pxsiz) ) + { + fprintf(stderr,"error: font pixel size of '%d' not available\n",pxsiz); return 8; + } FT_Select_Charmap(fnt,FT_ENCODING_UNICODE); - iw = w; - ih = h; - idata = calloc(iw*ih,2); + // compute baseline upshift + for ( uint32_t i=range[0]; i<=range[1]; i++ ) + { + FT_UInt glyph = FT_Get_Char_Index(fnt,i); + if ( !FT_Load_Glyph(fnt,glyph,FT_LOAD_DEFAULT) && glyph ) + { + int gshift = (fnt->glyph->metrics.horiBearingY-fnt->glyph->metrics.height)>>6; + if ( gshift < upshift ) upshift = gshift; + } + } + if ( argc > 6 ) + { + int xupshift = 0; + sscanf(argv[6],"%d",&xupshift); + upshift -= xupshift; + } + iw = w+1; + ih = h+1; + if ( gradient&4 ) + { + iw++; + ih++; + } + idata = calloc(iw*ih,palsize?4:2); for ( uint32_t i=range[0]; i<=range[1]; i++ ) { FT_UInt glyph = FT_Get_Char_Index(fnt,i); @@ -167,7 +287,7 @@ int main( int argc, char **argv ) { FT_Render_Glyph(fnt->glyph,FT_RENDER_MODE_NORMAL); int xx = 0; - int yy = -upshift; + int yy = upshift+1; int valid; if ( gradient&4 ) { @@ -192,9 +312,9 @@ int main( int argc, char **argv ) { char fname[256]; snprintf(fname,256,"%04X.png",i); - writepng(fname,idata,iw,ih,iw*2); + writepng(fname,idata,iw,ih,palsize?(iw*4):(iw*2)); } - memset(idata,0,iw*ih*2); + memset(idata,0,palsize?(iw*ih*4):(iw*ih*2)); } } free(idata); diff --git a/tools/mkfontblock.bugs b/tools/mkfontblock.bugs deleted file mode 100644 index 1093d68e0..000000000 --- a/tools/mkfontblock.bugs +++ /dev/null @@ -1,10 +0,0 @@ -- Damn thing breaks HARD with non-bitmap fonts, something wonky af with the - glyph offsets, will have to investigate further. -- Obviously this doesn't work well with proportional fonts, those would need a - different format where each glyph is a separate graphic with its own offsets - and stuff. -- Doesn't handle unicode blocks beyond the basic multilingual plane, might - actually be an issue with freetype itself, or the fonts I use, though I CAN - see that the glyphs are there if I use a character map program. -- Vertical shift has to be specified manually for some fonts that have some - sort of built-in offset, I have yet to figure a way to automate this. diff --git a/tools/mkfontblock.c b/tools/mkfontblock.c deleted file mode 100644 index 19f482eb1..000000000 --- a/tools/mkfontblock.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - mkfontblock.c : Make font pngs for gzdoom, in an ugly cheap way. - This code is a mess but I keep it here so people know how much I had - to suffer to get this done. - - Copyright (c) 2020-2021 Marisa Kirisame, UnSX Team - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -#include -#include -#include -#include -#include -#include FT_FREETYPE_H - -int writepng( const char *filename, uint8_t *fdata, int w, int h, int p ) -{ - if ( !filename ) return 0; - png_structp pngp; - png_infop infp; - FILE *pf; - if ( !(pf = fopen(filename,"wb")) ) return 0; - pngp = png_create_write_struct(PNG_LIBPNG_VER_STRING,0,0,0); - if ( !pngp ) - { - fclose(pf); - return 0; - } - infp = png_create_info_struct(pngp); - if ( !infp ) - { - fclose(pf); - png_destroy_write_struct(&pngp,0); - return 0; - } - if ( setjmp(png_jmpbuf(pngp)) ) - { - png_destroy_write_struct(&pngp,&infp); - fclose(pf); - return 0; - } - png_init_io(pngp,pf); - png_set_IHDR(pngp,infp,w,h,8,PNG_COLOR_TYPE_GA, - PNG_INTERLACE_NONE,PNG_COMPRESSION_TYPE_DEFAULT, - PNG_FILTER_TYPE_DEFAULT); - png_write_info(pngp,infp); - for ( int i=0; i= iw) || (y < 0) || (y >= ih) ) return; - uint32_t tpos = (x+y*iw)*2; - // add alpha - int alph = idata[tpos+1]; - alph += a; - if ( alph > 255 ) alph = 255; - idata[tpos+1] = alph; - // blend color - int col = idata[tpos]*(a-255); - col += v*a; - col /= 255; - idata[tpos] = col; -} - -uint8_t lerpg( float a ) -{ - return (uint8_t)(a*191+64); -} - -int draw_glyph( FT_Bitmap *bmp, uint8_t v, uint32_t px, uint32_t py, uint8_t ox, uint8_t oy ) -{ - int drawn = 0; - unsigned i, j; - for ( j=0; jrows; j++ ) - { - uint8_t rv = v; - // apply gradient, if any - if ( v == 255 ) - { - float a = (j+oy-upshift)/(float)h; - if ( (gradient&3) == 1 ) rv = lerpg(1.-a); - else if ( (gradient&3) == 2 ) rv = lerpg(a); - } - for ( i=0; iwidth; i++ ) - { - if ( bmp->pixel_mode == FT_PIXEL_MODE_GRAY ) - { - uint8_t a = bmp->buffer[i+j*bmp->pitch]; - if ( !drawn ) drawn = (a > 0); - putpixel(rv,a,px+ox+i,py+oy+j); - } - else if ( bmp->pixel_mode == FT_PIXEL_MODE_MONO ) - { - // thanks to https://stackoverflow.com/a/14905971 - unsigned p = bmp->pitch; - uint8_t *row = &bmp->buffer[p*j]; - uint8_t a = ((row[i>>3])&(128>>(i&7)))?255:0; - if ( !drawn ) drawn = (a > 0); - putpixel(rv,a,px+ox+i,py+oy+j); - } - } - } - return drawn; -} - -int main( int argc, char **argv ) -{ - if ( argc < 4 ) - { - fprintf(stderr,"usage: mkfontblock " - " [gradient type] [upshift]\n"); - return 1; - } - if ( FT_Init_FreeType(&ftlib) ) - return 2; - uint32_t block = 0; - sscanf(argv[2],"%d",&pxsiz); - sscanf(argv[3],"%dx%d",&w,&h); - sscanf(argv[4],"%x",&block); - if ( argc > 5 ) sscanf(argv[5],"%d",&gradient); - if ( argc > 6 ) sscanf(argv[6],"%d",&upshift); - if ( FT_New_Face(ftlib,argv[1],0,&fnt) ) - return 4; - if ( FT_Set_Pixel_Sizes(fnt,0,pxsiz) ) - return 8; - FT_Select_Charmap(fnt,FT_ENCODING_UNICODE); - iw = w*32; - ih = h*8; - idata = calloc(iw*ih,2); - int x = 0, y = 0; - int lastvalid = 0; - int validrow = 0; - for ( int i=0; i<256; i++ ) - { - FT_UInt glyph = FT_Get_Char_Index(fnt,block+i); - if ( !FT_Load_Glyph(fnt,glyph,FT_LOAD_DEFAULT) && glyph ) - { - FT_Render_Glyph(fnt->glyph,FT_RENDER_MODE_NORMAL); - int xx = x*w; - int yy = y*h-upshift; - int valid; - if ( gradient&4 ) - { - // draw outline first - draw_glyph(&fnt->glyph->bitmap,0,xx,yy,fnt->glyph->bitmap_left,pxsiz-fnt->glyph->bitmap_top); - draw_glyph(&fnt->glyph->bitmap,0,xx+1,yy,fnt->glyph->bitmap_left,pxsiz-fnt->glyph->bitmap_top); - draw_glyph(&fnt->glyph->bitmap,0,xx+2,yy,fnt->glyph->bitmap_left,pxsiz-fnt->glyph->bitmap_top); - draw_glyph(&fnt->glyph->bitmap,0,xx,yy+1,fnt->glyph->bitmap_left,pxsiz-fnt->glyph->bitmap_top); - draw_glyph(&fnt->glyph->bitmap,0,xx+2,yy+1,fnt->glyph->bitmap_left,pxsiz-fnt->glyph->bitmap_top); - draw_glyph(&fnt->glyph->bitmap,0,xx,yy+2,fnt->glyph->bitmap_left,pxsiz-fnt->glyph->bitmap_top); - draw_glyph(&fnt->glyph->bitmap,0,xx+1,yy+2,fnt->glyph->bitmap_left,pxsiz-fnt->glyph->bitmap_top); - draw_glyph(&fnt->glyph->bitmap,0,xx+2,yy+2,fnt->glyph->bitmap_left,pxsiz-fnt->glyph->bitmap_top); - valid = draw_glyph(&fnt->glyph->bitmap,255,xx+1,yy+1,fnt->glyph->bitmap_left,pxsiz-fnt->glyph->bitmap_top); - } - else - { - // draw drop shadow first - draw_glyph(&fnt->glyph->bitmap,0,xx+1,yy+1,fnt->glyph->bitmap_left,pxsiz-fnt->glyph->bitmap_top); - valid = draw_glyph(&fnt->glyph->bitmap,255,xx,yy,fnt->glyph->bitmap_left,pxsiz-fnt->glyph->bitmap_top); - } - if ( !validrow ) validrow = valid; - } - x++; - if ( x >= 32 ) - { - if ( validrow ) lastvalid = y+1; - validrow = 0; - x = 0; - y++; - } - } - // trim excess height - ih = h*lastvalid; - if ( ih > 0 ) - { - char fname[256]; - snprintf(fname,256,"%04X.png",block); - writepng(fname,idata,iw,ih,iw*2); - } - free(idata); - FT_Done_Face(fnt); - FT_Done_FreeType(ftlib); - return 0; -} diff --git a/tools/oldblockfonts.tar.xz b/tools/oldblockfonts.tar.xz deleted file mode 100644 index 1ba989bc7..000000000 Binary files a/tools/oldblockfonts.tar.xz and /dev/null differ diff --git a/zscript/hud/swwm_hud.zsc b/zscript/hud/swwm_hud.zsc index 953160d94..f6c7587ec 100644 --- a/zscript/hud/swwm_hud.zsc +++ b/zscript/hud/swwm_hud.zsc @@ -1266,7 +1266,11 @@ Class SWWMStatusBar : BaseStatusBar if ( StringTable.Localize("$SWWM_LEGPREFIX") == "R" ) tag = tag..StringTable.Localize("$SWWM_LEG"); else tag = StringTable.Localize("$SWWM_LEG")..tag; } - if ( targ.bBOSS ) tag = "\cx★\c- "..tag.." \cx★\c-"; + if ( targ.bBOSS ) + { + if ( swwm_bigtags ) tag = "\cx★\c- "..tag.." \cx★\c-"; + else tag = "\cx*\c- "..tag.." \cx*\c-"; // miniwi has no stars + } if ( targ.bFRIENDLY ) tag = "\cg♥\c- "..tag.." \cg♥\c-"; } int mtime = 35; @@ -2024,7 +2028,7 @@ Class SWWMStatusBar : BaseStatusBar xx -= 6; } Screen.DrawTexture(ScoreTex[2],false,ss.x-(margin+xx),margin,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - Screen.DrawText(smallfont,Font.CR_FIRE,ss.x-(margin+4+6*digits),margin+1,sstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,ss.x-(margin+4+6*digits),margin+2,sstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); int yy = margin+19; // obviously, don't draw the minimap if the automap is open if ( !automapactive && swwm_mm_enable ) @@ -2199,7 +2203,7 @@ Class SWWMStatusBar : BaseStatusBar Screen.DrawTexture(i.Icon,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,Powerup(i).IsBlinking()?alpha*.5:alpha,DTA_TopOffset,0,DTA_LeftOffset,0); String nstr = String.Format("%ds",Powerup(i).EffectTics/GameTicRate); int len = smallfont.StringWidth(nstr); - Screen.DrawText(smallfont,Font.CR_FIRE,(xx+30)-len,(yy+30)-11,nstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,Powerup(i).IsBlinking()?alpha*.5:alpha); + Screen.DrawText(smallfont,Font.CR_FIRE,(xx+30)-len,(yy+30)-10,nstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,Powerup(i).IsBlinking()?alpha*.5:alpha); return true; } if ( (i is 'SWWMLamp') && aspowerup ) @@ -2207,7 +2211,7 @@ Class SWWMStatusBar : BaseStatusBar Screen.DrawTexture(i.Icon,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,SWWMLamp(i).isBlinking()?alpha*.5:alpha,DTA_TopOffset,0,DTA_LeftOffset,0); String nstr = String.Format("%d%%",SWWMLamp(i).Charge); int len = smallfont.StringWidth(nstr); - Screen.DrawText(smallfont,Font.CR_FIRE,(xx+30)-len,(yy+30)-11,nstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,SWWMLamp(i).isBlinking()?alpha*.5:alpha); + Screen.DrawText(smallfont,Font.CR_FIRE,(xx+30)-len,(yy+30)-10,nstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,SWWMLamp(i).isBlinking()?alpha*.5:alpha); return true; } if ( (i is 'DivineSpriteEffect') && aspowerup ) @@ -2215,7 +2219,7 @@ Class SWWMStatusBar : BaseStatusBar Screen.DrawTexture(i.Icon,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,DivineSpriteEffect(i).isBlinking()?alpha*.5:alpha,DTA_TopOffset,0,DTA_LeftOffset,0); String nstr = String.Format("%ds",DivineSpriteEffect(i).healtim/GameTicRate); int len = smallfont.StringWidth(nstr); - Screen.DrawText(smallfont,Font.CR_FIRE,(xx+30)-len,(yy+30)-11,nstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,DivineSpriteEffect(i).isBlinking()?alpha*.5:alpha); + Screen.DrawText(smallfont,Font.CR_FIRE,(xx+30)-len,(yy+30)-10,nstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,DivineSpriteEffect(i).isBlinking()?alpha*.5:alpha); return true; } Screen.DrawTexture(i.Icon,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_TopOffset,0,DTA_LeftOffset,0); @@ -2225,7 +2229,7 @@ Class SWWMStatusBar : BaseStatusBar if ( (i.Amount > 99999) && !forceamt ) nstr = "99999"; else nstr = String.Format("%d",i.Amount); int len = smallfont.StringWidth(nstr); - Screen.DrawText(smallfont,Font.CR_FIRE,(xx+30)-len,(yy+30)-11,nstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha); + Screen.DrawText(smallfont,Font.CR_FIRE,(xx+30)-len,(yy+30)-10,nstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alpha); } return true; } @@ -2324,7 +2328,7 @@ Class SWWMStatusBar : BaseStatusBar Screen.DrawTexture(GenericAmmoTex[1],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } Screen.DrawTexture(GenericAmmoTex[0],false,xx-3,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - Screen.DrawText(smallfont,Font.CR_FIRE,xx,yy,astr2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,xx,yy+1,astr2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); yy += 14; } xx = ss.x-(margin+13); @@ -2337,11 +2341,11 @@ Class SWWMStatusBar : BaseStatusBar Screen.DrawTexture(GenericAmmoTex[1],false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } Screen.DrawTexture(GenericAmmoTex[0],false,xx-3,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - Screen.DrawText(smallfont,Font.CR_FIRE,xx,yy,astr1,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,xx,yy+1,astr1,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } } Screen.DrawTexture(WeaponTex,false,ss.x-(margin+60),ss.y-(margin+28),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - double xx = ss.x-(margin+57), yy = ss.y-(margin+28); + double xx = ss.x-(margin+57), yy = ss.y-(margin+27); for ( int i=1; i<=10; i++ ) { int ncolor = Font.CR_WHITE; @@ -2437,11 +2441,11 @@ Class SWWMStatusBar : BaseStatusBar tst = "AAA"; SWWMUtility.ObscureText(tst,(gametic-trl)/3); trl--; - Screen.DrawText(smallfont,Font.CR_WHITE,margin+108,ss.y-(margin+15),tst,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,falph*alph,DTA_LegacyRenderStyle,STYLE_Add); + Screen.DrawText(smallfont,Font.CR_WHITE,margin+108,ss.y-(margin+14),tst,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,falph*alph,DTA_LegacyRenderStyle,STYLE_Add); } - Screen.DrawText(smallfont,hcolor,margin+108,ss.y-(margin+15),String.Format("%3d",clamp(ht,0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,1.-falph); + Screen.DrawText(smallfont,hcolor,margin+108,ss.y-(margin+14),String.Format("%3d",clamp(ht,0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,1.-falph); } - else Screen.DrawText(smallfont,hcolor,margin+108,ss.y-(margin+15),String.Format("%3d",clamp(ht,0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + else Screen.DrawText(smallfont,hcolor,margin+108,ss.y-(margin+14),String.Format("%3d",clamp(ht,0,999)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } private void DrawPickups() @@ -2530,7 +2534,7 @@ Class SWWMStatusBar : BaseStatusBar yy = margin; bool smol = (ss.x<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++; + yy += 2; for ( int i=mstart; i= master.ws.y-17 ) continue; + if ( yy >= master.ws.y-19 ) continue; Screen.DrawText(smallfont,Font.CR_WHITE,master.origin.x+xx,master.origin.y+yy,l.StringAt(i),DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,dark?Color(96,0,0,0):Color(0,0,0,0),DTA_ClipTop,miny,DTA_ClipBottom,maxy); } if ( !scrollbar ) return; xx = x+(w-8); master.DrawVSeparator(xx,14,master.ws.y-28); xx += 2; - yy = floor(smofs*((master.ws.y-39)/maxofs))+13; + 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); } } diff --git a/zscript/kbase/swwm_kbasetab_stats.zsc b/zscript/kbase/swwm_kbasetab_stats.zsc index 55ab33c48..620324bab 100644 --- a/zscript/kbase/swwm_kbasetab_stats.zsc +++ b/zscript/kbase/swwm_kbasetab_stats.zsc @@ -449,7 +449,7 @@ Class DemolitionistStatsTab : DemolitionistMenuTab xx = master.ws.x-8; master.DrawVSeparator(xx,14,master.ws.y-28); xx += 2; - yy = floor(smofs[section]*((master.ws.y-39)/maxofs[section]))+13; + yy = floor(smofs[section]*((master.ws.y-39)/maxofs[section]))+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); } } diff --git a/zscript/menu/swwm_menus.zsc b/zscript/menu/swwm_menus.zsc index 98da5f063..336ad0402 100644 --- a/zscript/menu/swwm_menus.zsc +++ b/zscript/menu/swwm_menus.zsc @@ -725,9 +725,8 @@ class ListMenuItemSWWMTextItemM : ListMenuItemSelectable if ( w == ListMenuDescriptor.CleanScale ) x = (320-font.StringWidth(text))/2; else x = (w-font.StringWidth(text))/2; double y = mYpos; - // slight baseline offset - if ( generic_ui ) y += 4.; - else y -= 4.5; + // offset text so it's centered + y += (mHeight-font.GetHeight())/2; if ( selected ) { double xx = x; diff --git a/zscript/utility/swwm_utility.zsc b/zscript/utility/swwm_utility.zsc index 4d395aae9..c8e744b01 100644 --- a/zscript/utility/swwm_utility.zsc +++ b/zscript/utility/swwm_utility.zsc @@ -195,6 +195,10 @@ Class SWWMUtility { x = (x-160)*CleanXFac_1+(Screen.GetWidth()*.5); } + static clearscope void AdjustClean_1y( out double y ) + { + y = (y-100)*CleanYFac_1+(Screen.GetHeight()*.5); + } // thanks zscript static clearscope double fract( double a ) diff --git a/zscript/weapons/swwm_blazeit.zsc b/zscript/weapons/swwm_blazeit.zsc index bf23dcfcc..8abcbca40 100644 --- a/zscript/weapons/swwm_blazeit.zsc +++ b/zscript/weapons/swwm_blazeit.zsc @@ -167,7 +167,7 @@ Class Hellblazer : SWWMWeapon break; } xx += 2; - yy += 1; + yy += 2; for ( int i=0; i<4; i++ ) { int amt = Owner.CountInv(types[i]); diff --git a/zscript/weapons/swwm_cbt.zsc b/zscript/weapons/swwm_cbt.zsc index 498019e96..bbda2dd1a 100644 --- a/zscript/weapons/swwm_cbt.zsc +++ b/zscript/weapons/swwm_cbt.zsc @@ -87,7 +87,7 @@ Class Wallbuster : SWWMWeapon { Screen.DrawTexture(AmmoIcon[i],false,bx-ox,by-oy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); String astr = String.Format("%3d",Owner.CountInv(types[i])); - Screen.DrawText(smallfont,Font.CR_FIRE,bx-ox-(smallfont.StringWidth(astr)+1),by-oy-2,astr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-ox-(smallfont.StringWidth(astr)+1),by-oy-1,astr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); oy += 10; if ( i == 1 ) { diff --git a/zscript/weapons/swwm_cbt_ui.zsc b/zscript/weapons/swwm_cbt_ui.zsc index 1d9503138..15ea83801 100644 --- a/zscript/weapons/swwm_cbt_ui.zsc +++ b/zscript/weapons/swwm_cbt_ui.zsc @@ -288,11 +288,11 @@ Class WallbusterReloadMenu : GenericMenu { Screen.DrawTexture(AmmoIcon[i],false,origin.x+ox,origin.y+oy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,(i==sel0)?Color(0,0,0,0):Color(128,0,0,0)); String astr = String.Format("%3d",players[consoleplayer].mo.CountInv(types[i])-AmmoSets[i]); - Screen.DrawText(smallfont,Font.CR_FIRE,origin.x+ox-(smallfont.StringWidth(astr)+1),origin.y+oy-2,astr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,(i==sel0)?Color(0,0,0,0):Color(128,0,0,0)); + Screen.DrawText(smallfont,Font.CR_FIRE,origin.x+ox-(smallfont.StringWidth(astr)+1),origin.y+oy-1,astr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,(i==sel0)?Color(0,0,0,0):Color(128,0,0,0)); ox += 33; } // pointer (▸) - Screen.DrawChar(smallfont,Font.CR_GREEN,origin.x+2+33*sel0,origin.y,0x25B8,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawChar(smallfont,Font.CR_GREEN,origin.x+2+33*sel0,origin.y+1,0x25B8,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); int siz = queue.Size()-1; ox = 2+siz*5+(siz/5); oy = 15; diff --git a/zscript/weapons/swwm_danmaku.zsc b/zscript/weapons/swwm_danmaku.zsc index 088fd976d..408779993 100644 --- a/zscript/weapons/swwm_danmaku.zsc +++ b/zscript/weapons/swwm_danmaku.zsc @@ -23,9 +23,9 @@ Class Eviscerator : SWWMWeapon if ( !AmmoIcon ) AmmoIcon = TexMan.CheckForTexture("graphics/HUD/EvisceratorShell.png",TexMan.Type_Any); Screen.DrawTexture(WeaponBox,false,bx-46,by-16,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); String astr = String.Format("%d",Ammo1.Amount); - Screen.DrawText(smallfont,Font.CR_FIRE,bx-14-(smallfont.StringWidth(astr)+1),by-15,astr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-14-(smallfont.StringWidth(astr)+1),by-14,astr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); Screen.DrawTexture(AmmoIcon,false,bx-14,by-14,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,chambered?Color(0,0,0,0):Color(128,0,0,0)); - Screen.DrawText(smallfont,Font.CR_WHITE,bx-44,by-15,extended?"►":"",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_WHITE,bx-44,by-14,extended?"►":"",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } override bool ReportHUDAmmo() diff --git a/zscript/weapons/swwm_deathlydeathcannon.zsc b/zscript/weapons/swwm_deathlydeathcannon.zsc index 493838455..51e07a5bb 100644 --- a/zscript/weapons/swwm_deathlydeathcannon.zsc +++ b/zscript/weapons/swwm_deathlydeathcannon.zsc @@ -37,7 +37,7 @@ Class Ynykron : SWWMWeapon Screen.DrawTexture(WeaponBox,false,bx-33,by-44,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); int chg = clamp(ChargeInter?ChargeInter.GetValue():int(chargelevel*10),0,400); int ct = int(((by-2)-chg/10.)*hs.y); - Screen.DrawText(smallfont,Font.CR_FIRE,bx-30,by-16,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-30,by-15,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); Screen.DrawTexture(BoxSide[inverted],false,bx-23,by-31,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,clipcount?Color(0,0,0,0):Color(128,0,0,0)); Screen.DrawTexture(ChargeBar[inverted],false,bx-6,by-42,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,(chargestate==CS_READY)?Color(int(clamp(sin((level.maptime+TicFrac)*8)*40+24,0.,64.)),255,255,255):Color(0,0,0,0),DTA_ClipTop,ct); } diff --git a/zscript/weapons/swwm_deepdarkimpact.zsc b/zscript/weapons/swwm_deepdarkimpact.zsc index 7a2255fa8..2e2289170 100644 --- a/zscript/weapons/swwm_deepdarkimpact.zsc +++ b/zscript/weapons/swwm_deepdarkimpact.zsc @@ -57,7 +57,7 @@ Class DeepImpact : SWWMWeapon int chg = clamp(ChargeInter?ChargeInter.GetValue():clipcount,0,100); int ct = int(((by-2)-(chg*50./100.))*hs.y); Screen.DrawTexture(AmmoBar,false,bx-7,by-52,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ClipTop,ct); - Screen.DrawText(smallfont,Font.CR_FIRE,bx-35,by-13,String.Format("%3d%%",chg),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-35,by-12,String.Format("%3d%%",chg),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } override void HudTick() diff --git a/zscript/weapons/swwm_shot.zsc b/zscript/weapons/swwm_shot.zsc index 770e23ef3..5ff9351bb 100644 --- a/zscript/weapons/swwm_shot.zsc +++ b/zscript/weapons/swwm_shot.zsc @@ -184,7 +184,7 @@ Class Spreadgun : SWWMWeapon { Screen.DrawTexture(AmmoIcon[i],false,bx-ox,by-oy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,(types[i]==nextammo)?Color(0,0,0,0):Color(128,0,0,0)); String astr = String.Format("%3d",Owner.CountInv(types[i])); - Screen.DrawText(smallfont,Font.CR_FIRE,bx-ox-(smallfont.StringWidth(astr)+1),by-oy-2,astr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,(types[i]==nextammo)?Color(0,0,0,0):Color(128,0,0,0)); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-ox-(smallfont.StringWidth(astr)+1),by-oy-1,astr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,(types[i]==nextammo)?Color(0,0,0,0):Color(128,0,0,0)); oy += 10; if ( i == 3 ) { diff --git a/zscript/weapons/swwm_sparkyboi.zsc b/zscript/weapons/swwm_sparkyboi.zsc index d12a399b9..dcb8396e1 100644 --- a/zscript/weapons/swwm_sparkyboi.zsc +++ b/zscript/weapons/swwm_sparkyboi.zsc @@ -26,7 +26,7 @@ Class Sparkster : SWWMWeapon AmmoBar[5] = TexMan.CheckForTexture("graphics/HUD/BiosparkBarSlimGray.png",TexMan.Type_Any); } Screen.DrawTexture(WeaponBox,false,bx-28,by-28,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - Screen.DrawText(smallfont,Font.CR_FIRE,bx-26,by-26,String.Format("%2d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-26,by-25,String.Format("%2d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); if ( nomag ) return; bool blinking = (failtime>gametic)&&((failtime-gametic)%16>=8); if ( doublestacc ) diff --git a/zscript/weapons/swwm_splode.zsc b/zscript/weapons/swwm_splode.zsc index ee5817c16..43f48216b 100644 --- a/zscript/weapons/swwm_splode.zsc +++ b/zscript/weapons/swwm_splode.zsc @@ -17,8 +17,8 @@ Class ExplodiumGun : SWWMWeapon { if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/ExplodiumDisplay.png",TexMan.Type_Any); Screen.DrawTexture(WeaponBox,false,bx-24,by-22,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - if ( chambered ) Screen.DrawText(smallfont,Font.CR_FIRE,bx-22,by-21,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); - Screen.DrawText(smallfont,Font.CR_FIRE,bx-19,by-14,String.Format("%d",max(clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + if ( chambered ) Screen.DrawText(smallfont,Font.CR_FIRE,bx-22,by-20,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-19,by-13,String.Format("%d",max(clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } override void HudTick() @@ -589,10 +589,10 @@ Class DualExplodiumGun : SWWMWeapon { if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/DualExplodiumDisplay.png",TexMan.Type_Any); Screen.DrawTexture(WeaponBox,false,bx-48,by-22,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - if ( ExplodiumGun(SisterWeapon).chambered ) Screen.DrawText(smallfont,Font.CR_FIRE,bx-22,by-21,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); - Screen.DrawText(smallfont,Font.CR_FIRE,bx-19,by-14,String.Format("%d",max(ExplodiumGun(SisterWeapon).clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - if ( chambered ) Screen.DrawText(smallfont,Font.CR_FIRE,bx-46,by-21,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); - Screen.DrawText(smallfont,Font.CR_FIRE,bx-43,by-14,String.Format("%d",max(clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + if ( ExplodiumGun(SisterWeapon).chambered ) Screen.DrawText(smallfont,Font.CR_FIRE,bx-22,by-20,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-19,by-13,String.Format("%d",max(ExplodiumGun(SisterWeapon).clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + if ( chambered ) Screen.DrawText(smallfont,Font.CR_FIRE,bx-46,by-20,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-43,by-13,String.Format("%d",max(clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } override void RenderUnderlay( RenderEvent e ) diff --git a/zscript/weapons/swwm_tastytreat.zsc b/zscript/weapons/swwm_tastytreat.zsc index ce35bffe5..17a842999 100644 --- a/zscript/weapons/swwm_tastytreat.zsc +++ b/zscript/weapons/swwm_tastytreat.zsc @@ -87,18 +87,18 @@ Class CandyGun : SWWMWeapon if ( Amount <= 0 ) return; if ( !WeaponBox ) WeaponBox = TexMan.CheckForTexture("graphics/HUD/CandygunDisplay.png",TexMan.Type_Any); Screen.DrawTexture(WeaponBox,false,bx-51,by-44,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - if ( chambered ) Screen.DrawText(smallfont,Font.CR_FIRE,bx-22,by-21,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); - Screen.DrawText(smallfont,Font.CR_FIRE,bx-19,by-14,String.Format("%d",max(clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + if ( chambered ) Screen.DrawText(smallfont,Font.CR_FIRE,bx-22,by-20,"⁺¹",DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-19,by-13,String.Format("%d",max(clipcount,0)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); int cx = (Ammo1.Amount>9)?48:45; int sb = Owner.CountInv("CandyGunBullets"); if ( sb > 0 ) { int cbx = (sb>9)?50:47; - Screen.DrawText(smallfont,Font.CR_FIRE,bx-cbx,by-21,String.Format("⁺%s",SWWMUtility.SuperscriptNum(sb)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); - Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-14,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-cbx,by-20,String.Format("⁺%s",SWWMUtility.SuperscriptNum(sb)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-13,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } - else Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-18,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); - Screen.DrawText(smallfont,Font.CR_FIRE,bx-37,by-40,String.Format("%d",Ammo2.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + else Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-17,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-37,by-39,String.Format("%d",Ammo2.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); } override Vector3 GetTraceOffset() diff --git a/zscript/weapons/swwm_thiccboolet.zsc b/zscript/weapons/swwm_thiccboolet.zsc index 749fcc48e..d812b1bef 100644 --- a/zscript/weapons/swwm_thiccboolet.zsc +++ b/zscript/weapons/swwm_thiccboolet.zsc @@ -270,19 +270,19 @@ Class SilverBullet : SWWMWeapon if ( sb > 0 ) { int cbx = (sb>9)?34:30; - Screen.DrawText(smallfont,Font.CR_FIRE,bx-cbx,by-21,String.Format("⁺%s",SWWMUtility.SuperscriptNum(sb)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1,DTA_ColorOverlay,fcbselected?Color(128,0,0,0):Color(0,0,0,0)); - Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-14,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(128,0,0,0):Color(0,0,0,0)); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-cbx,by-20,String.Format("⁺%s",SWWMUtility.SuperscriptNum(sb)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1,DTA_ColorOverlay,fcbselected?Color(128,0,0,0):Color(0,0,0,0)); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-13,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(128,0,0,0):Color(0,0,0,0)); } - else Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-18,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(128,0,0,0):Color(0,0,0,0)); + else Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-15,String.Format("%d",Ammo1.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(128,0,0,0):Color(0,0,0,0)); cx = (Ammo2.Amount>9)?32:29; sb = Owner.CountInv("SilverBullets2"); if ( sb > 0 ) { int cbx = (sb>9)?34:30; - Screen.DrawText(smallfont,Font.CR_FIRE,bx-cbx,by-43,String.Format("⁺%s",SWWMUtility.SuperscriptNum(sb)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1,DTA_ColorOverlay,fcbselected?Color(0,0,0,0):Color(128,0,0,0)); - Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-36,String.Format("%d",Ammo2.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(0,0,0,0):Color(128,0,0,0)); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-cbx,by-42,String.Format("⁺%s",SWWMUtility.SuperscriptNum(sb)),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Spacing,-1,DTA_ColorOverlay,fcbselected?Color(0,0,0,0):Color(128,0,0,0)); + Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-35,String.Format("%d",Ammo2.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(0,0,0,0):Color(128,0,0,0)); } - else Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-40,String.Format("%d",Ammo2.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(0,0,0,0):Color(128,0,0,0)); + else Screen.DrawText(smallfont,Font.CR_FIRE,bx-cx,by-39,String.Format("%d",Ammo2.Amount),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,fcbselected?Color(0,0,0,0):Color(128,0,0,0)); } override void HudTick() {