From 28fedd72e8c7ad4c65a35ffe97ebcd35c18d500c Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 19 Aug 2008 11:05:21 +0000 Subject: [PATCH] Ignore r_downsize for textures with nocompress and some other minor crap git-svn-id: https://svn.eduke32.com/eduke32@990 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/polymost.c | 16 +++++++------- polymer/eduke32/source/astub.c | 2 +- polymer/eduke32/source/config.c | 8 ++++--- polymer/eduke32/source/duke3d.h | 1 + polymer/eduke32/source/game.c | 5 ++--- polymer/eduke32/source/gamedef.c | 1 + polymer/eduke32/source/gamedef.h | 4 ++-- polymer/eduke32/source/gameexec.c | 29 +++++++++++++++++--------- polymer/eduke32/source/osdcmds.c | 2 +- polymer/eduke32/source/savegame.c | 2 +- polymer/eduke32/source/startwin.game.c | 6 +++--- 11 files changed, 45 insertions(+), 31 deletions(-) diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index b42fb2b25..1ef4ea5aa 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -971,9 +971,10 @@ static void uploadtexture(int doalloc, int xsiz, int ysiz, int intexfmt, int tex { coltype *wpptr, *rpptr; int x2, y2, j, js=0, x3, y3, y, x, r, g, b, a, k; - int hi = (dameth&8192); + int hi = (dameth&8192)?1:0; + int nocompress = (dameth&4096)?1:0; - dameth &= ~8192; + dameth &= ~(8192|4096); if (gltexmaxsize <= 0) { @@ -991,7 +992,7 @@ static void uploadtexture(int doalloc, int xsiz, int ysiz, int intexfmt, int tex gltexmiplevel = js; while ((xsiz>>js) > (1<>js) > (1<flags & 4) && !glusetexcachecompression) goto failure; if (!(head->flags & 4) && glusetexcachecompression) goto failure; - if (head->quality != r_downsize) goto failure; + if (!(head->flags & 8) && head->quality != r_downsize) goto failure; // handle nocompress if (gltexmaxsize && (head->xdim > (1<ydim > (1<flags & 1)) goto failure; @@ -1658,7 +1659,7 @@ int gloadtile_hi(int dapic,int dapalnum, int facen, hicreplctyp *hicr, int damet cachefil=0; } fixtransparency(pic,tsizx,tsizy,xsiz,ysiz,dameth); - uploadtexture(doalloc,xsiz,ysiz,intexfmt,texfmt,pic,-1,tsizy,dameth|8192); + uploadtexture(doalloc,xsiz,ysiz,intexfmt,texfmt,pic,-1,tsizy,dameth|8192|(hicr->flags & 1?4096:0)); } // precalculate scaling parameters for replacement @@ -1707,7 +1708,8 @@ int gloadtile_hi(int dapic,int dapalnum, int facen, hicreplctyp *hicr, int damet if (cachefil < 0) { // save off the compressed version - cachead.quality = r_downsize; + if (hicr->flags & 1) cachead.quality = 0; + else cachead.quality = r_downsize; cachead.xdim = tsizx>>cachead.quality; cachead.ydim = tsizy>>cachead.quality; x = 0; @@ -1716,7 +1718,7 @@ int gloadtile_hi(int dapic,int dapalnum, int facen, hicreplctyp *hicr, int damet if (xsiz == pow2long[j]) { x |= 1; } if (ysiz == pow2long[j]) { x |= 2; } } - cachead.flags = (x!=3) | (hasalpha != 255 ? 2 : 0); + cachead.flags = (x!=3) | (hasalpha != 255 ? 2 : 0) | (hicr->flags & 1?8:0); // handle nocompress OSD_Printf("No cached tex for tile %d pal %d.\n",dapic,dapalnum); writexcache(fn, picfillen+(dapalnum<<8), dameth, effect, &cachead); } diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 2e5ff2014..9b539dab4 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -5405,7 +5405,7 @@ static void Keys3d(void) brightness++; if (brightness >= 16) brightness = 0; } - + vid_gamma = 1.0 + ((float)brightness / 10.0); setbrightness(brightness,palette,0); message("Brightness: %d/16",brightness+1); diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index d99d51d39..822f3b24b 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -255,6 +255,7 @@ void CONFIG_SetDefaults(void) ud.config.UseJoystick = 0; ud.config.UseMouse = 1; ud.config.VoiceToggle = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM + ud.display_bonus_screen = 1; Bstrcpy(ud.rtsname, "DUKE.RTS"); Bstrcpy(myname, "Duke"); @@ -613,8 +614,8 @@ int32 CONFIG_ReadSetup(void) else if (SafeFileExists("duke3d.cfg") && ud.config.scripthandle < 0) { Bsprintf(tempbuf,"The configuration file \"%s\" was not found. " - "Would you like to import configuration data " - "from \"duke3d.cfg\"?",setupfilename); + "Would you like to import configuration data " + "from \"duke3d.cfg\"?",setupfilename); i=wm_ynbox("Import Configuration Settings",tempbuf); if (i) ud.config.scripthandle = SCRIPT_Load("duke3d.cfg"); @@ -650,7 +651,8 @@ int32 CONFIG_ReadSetup(void) SCRIPT_GetString(ud.config.scripthandle, "Misc","SelectedGRP",&duke3dgrp[0]); } - SCRIPT_GetString(ud.config.scripthandle, "Misc","ModDir",&mod_dir[0]); + if (mod_dir[0] == '/') + SCRIPT_GetString(ud.config.scripthandle, "Misc","ModDir",&mod_dir[0]); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Shadows",&ud.shadows); diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 7e16609e7..5c8255df7 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -426,6 +426,7 @@ typedef struct { char ridecule[10][40]; char savegame[10][22]; char pwlockout[128],rtsname[128]; + char display_bonus_screen; config_t config; } user_defs; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 3265ae8e8..16ad2aae1 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -84,7 +84,6 @@ static struct strllist char boardfilename[BMAX_PATH] = {0}; char waterpal[768], slimepal[768], titlepal[768], drealms[768], endingpal[768], animpal[768]; static char firstdemofile[80] = { '\0' }; -int display_bonus_screen = 1; static int userconfiles = 0; static int netparamcount = 0; @@ -11073,7 +11072,7 @@ MAIN_LOOP_RESTART: ready2send = 0; - if (display_bonus_screen == 1) + if (ud.display_bonus_screen == 1) { i = ud.screen_size; ud.screen_size = 0; @@ -11102,7 +11101,7 @@ MAIN_LOOP_RESTART: } } } - display_bonus_screen = 1; + ud.display_bonus_screen = 1; ready2send = 0; if (numplayers > 1) g_player[myconnectindex].ps->gm = MODE_GAME; if (enterlevel(g_player[myconnectindex].ps->gm)) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 726025dcf..28c1fb54e 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -888,6 +888,7 @@ const memberlabel_t userdefslabels[]= { "levelstats", USERDEFS_LEVELSTATS, 0, 0 }, { "crosshairscale", USERDEFS_CROSSHAIRSCALE, 0, 0 }, { "althud", USERDEFS_ALTHUD, 0, 0 }, + { "display_bonus_screen", USERDEFS_DISPLAY_BONUS_SCREEN, 0, 0 }, { "", -1, 0, 0 } // END OF LIST }; diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index aabf8bc0a..5ddd3418d 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -50,7 +50,6 @@ extern int g_weapon_xoffset; extern int g_gs; extern int g_kb; extern int g_looking_angSR1; -extern int display_bonus_screen; extern int lastvisinc; extern char cheatstrings[][MAXCHEATLEN]; extern char compilefile[BMAX_PATH]; @@ -343,7 +342,8 @@ enum userdefslabels USERDEFS_OBITUARIES, USERDEFS_LEVELSTATS, USERDEFS_CROSSHAIRSCALE, - USERDEFS_ALTHUD + USERDEFS_ALTHUD, + USERDEFS_DISPLAY_BONUS_SCREEN }; enum sectorlabels diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 2db1c1ee0..48137b5dc 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -886,6 +886,15 @@ static void DoUserDef(int iSet, int lLabelID, int lVar2) SetGameVarID(lVar2, ud.althud, g_i, g_p); return; + case USERDEFS_DISPLAY_BONUS_SCREEN: + if (iSet) + { + ud.display_bonus_screen = lValue; + return; + } + SetGameVarID(lVar2, ud.display_bonus_screen, g_i, g_p); + return; + default: return; } @@ -5478,7 +5487,7 @@ static int parse(void) else { g_player[myconnectindex].ps->gm |= MODE_EOL; - display_bonus_screen = 0; + ud.display_bonus_screen = 0; } // MODE_RESTART; break; @@ -7538,16 +7547,16 @@ static int parse(void) case CON_SETGAMEPALETTE: insptr++; j=GetGameVarID(*(insptr++), g_i, g_p); - switch(j) + switch (j) { - default: - case 0:setgamepalette(g_player[g_p].ps,palette ,0);break; - case 1:setgamepalette(g_player[g_p].ps,waterpal ,0);break; - case 2:setgamepalette(g_player[g_p].ps,slimepal ,0);break; - case 3:setgamepalette(g_player[g_p].ps,drealms ,0);break; - case 4:setgamepalette(g_player[g_p].ps,titlepal ,0);break; - case 5:setgamepalette(g_player[g_p].ps,endingpal,0);break; - case 6:setgamepalette(g_player[g_p].ps,animpal ,0);break; + default: + case 0:setgamepalette(g_player[g_p].ps,palette ,0);break; + case 1:setgamepalette(g_player[g_p].ps,waterpal ,0);break; + case 2:setgamepalette(g_player[g_p].ps,slimepal ,0);break; + case 3:setgamepalette(g_player[g_p].ps,drealms ,0);break; + case 4:setgamepalette(g_player[g_p].ps,titlepal ,0);break; + case 5:setgamepalette(g_player[g_p].ps,endingpal,0);break; + case 6:setgamepalette(g_player[g_p].ps,animpal ,0);break; } break; diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 23b042ef2..683cd3dd2 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -867,7 +867,7 @@ static int osdcmd_give(const osdfuncparm_t *parm) int i; if (numplayers != 1 || (g_player[myconnectindex].ps->gm & MODE_GAME) == 0 || - g_player[myconnectindex].ps->dead_flag != 0) + g_player[myconnectindex].ps->dead_flag != 0) { OSD_Printf("give: Cannot give while dead or not in a single-player game.\n"); return OSDCMD_OK; diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index aa959d5d4..f45691b60 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -644,7 +644,7 @@ int saveplayer(int spot) for (i=0;i= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_ScriptSize])) + // if ((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_ScriptSize])) { scriptptrs[i] = 1; j = (intptr_t)script[i] - (intptr_t)&script[0]; diff --git a/polymer/eduke32/source/startwin.game.c b/polymer/eduke32/source/startwin.game.c index 39308a2dd..a33a81aac 100644 --- a/polymer/eduke32/source/startwin.game.c +++ b/polymer/eduke32/source/startwin.game.c @@ -186,10 +186,10 @@ static void PopulateForm(int pgs) (void)ComboBox_SetCurSel(hwnd, j); for (dirs=finddirs,i=1; dirs != NULL; dirs=dirs->next,i++) { - if (Bstrcmp(TEXCACHEDIR,dirs->name) == 0) continue; + if (Bstrcasecmp(TEXCACHEDIR,dirs->name) == 0) continue; j = ComboBox_AddString(hwnd, dirs->name); (void)ComboBox_SetItemData(hwnd, j, i); - if (Bstrcmp(dirs->name,settings.gamedir) == 0) + if (Bstrcasecmp(dirs->name,settings.gamedir) == 0) (void)ComboBox_SetCurSel(hwnd, j); } } @@ -692,7 +692,7 @@ int startwin_run(void) ud.config.UseJoystick = settings.usejoy; duke3dgrp = settings.selectedgrp; g_GameType = settings.game; - + if (settings.gamedir != NULL) { addsearchpath(settings.gamedir);