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
This commit is contained in:
terminx 2008-08-19 11:05:21 +00:00
parent 1a39458bb5
commit 28fedd72e8
11 changed files with 45 additions and 31 deletions

View file

@ -971,9 +971,10 @@ static void uploadtexture(int doalloc, int xsiz, int ysiz, int intexfmt, int tex
{ {
coltype *wpptr, *rpptr; coltype *wpptr, *rpptr;
int x2, y2, j, js=0, x3, y3, y, x, r, g, b, a, k; 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) if (gltexmaxsize <= 0)
{ {
@ -991,7 +992,7 @@ static void uploadtexture(int doalloc, int xsiz, int ysiz, int intexfmt, int tex
gltexmiplevel = js; gltexmiplevel = js;
while ((xsiz>>js) > (1<<gltexmaxsize) || (ysiz>>js) > (1<<gltexmaxsize)) js++; while ((xsiz>>js) > (1<<gltexmaxsize) || (ysiz>>js) > (1<<gltexmaxsize)) js++;
if (hi) js = r_downsize; if (hi && !nocompress) js = r_downsize;
/* /*
OSD_Printf("Uploading %dx%d %s as %s\n", xsiz,ysiz, OSD_Printf("Uploading %dx%d %s as %s\n", xsiz,ysiz,
@ -1250,7 +1251,7 @@ int trytexcache(char *fn, int len, int dameth, char effect, texcacheheader *head
if ((head->flags & 4) && !glusetexcachecompression) goto failure; if ((head->flags & 4) && !glusetexcachecompression) goto failure;
if (!(head->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<<gltexmaxsize) || head->ydim > (1<<gltexmaxsize))) goto failure; if (gltexmaxsize && (head->xdim > (1<<gltexmaxsize) || head->ydim > (1<<gltexmaxsize))) goto failure;
if (!glinfo.texnpot && (head->flags & 1)) goto failure; if (!glinfo.texnpot && (head->flags & 1)) goto failure;
@ -1658,7 +1659,7 @@ int gloadtile_hi(int dapic,int dapalnum, int facen, hicreplctyp *hicr, int damet
cachefil=0; cachefil=0;
} }
fixtransparency(pic,tsizx,tsizy,xsiz,ysiz,dameth); 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 // 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) if (cachefil < 0)
{ {
// save off the compressed version // 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.xdim = tsizx>>cachead.quality;
cachead.ydim = tsizy>>cachead.quality; cachead.ydim = tsizy>>cachead.quality;
x = 0; 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 (xsiz == pow2long[j]) { x |= 1; }
if (ysiz == pow2long[j]) { x |= 2; } 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); OSD_Printf("No cached tex for tile %d pal %d.\n",dapic,dapalnum);
writexcache(fn, picfillen+(dapalnum<<8), dameth, effect, &cachead); writexcache(fn, picfillen+(dapalnum<<8), dameth, effect, &cachead);
} }

View file

@ -255,6 +255,7 @@ void CONFIG_SetDefaults(void)
ud.config.UseJoystick = 0; ud.config.UseJoystick = 0;
ud.config.UseMouse = 1; ud.config.UseMouse = 1;
ud.config.VoiceToggle = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM 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(ud.rtsname, "DUKE.RTS");
Bstrcpy(myname, "Duke"); Bstrcpy(myname, "Duke");
@ -613,8 +614,8 @@ int32 CONFIG_ReadSetup(void)
else if (SafeFileExists("duke3d.cfg") && ud.config.scripthandle < 0) else if (SafeFileExists("duke3d.cfg") && ud.config.scripthandle < 0)
{ {
Bsprintf(tempbuf,"The configuration file \"%s\" was not found. " Bsprintf(tempbuf,"The configuration file \"%s\" was not found. "
"Would you like to import configuration data " "Would you like to import configuration data "
"from \"duke3d.cfg\"?",setupfilename); "from \"duke3d.cfg\"?",setupfilename);
i=wm_ynbox("Import Configuration Settings",tempbuf); i=wm_ynbox("Import Configuration Settings",tempbuf);
if (i) ud.config.scripthandle = SCRIPT_Load("duke3d.cfg"); 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","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); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Shadows",&ud.shadows);

View file

@ -426,6 +426,7 @@ typedef struct {
char ridecule[10][40]; char ridecule[10][40];
char savegame[10][22]; char savegame[10][22];
char pwlockout[128],rtsname[128]; char pwlockout[128],rtsname[128];
char display_bonus_screen;
config_t config; config_t config;
} user_defs; } user_defs;

View file

@ -84,7 +84,6 @@ static struct strllist
char boardfilename[BMAX_PATH] = {0}; char boardfilename[BMAX_PATH] = {0};
char waterpal[768], slimepal[768], titlepal[768], drealms[768], endingpal[768], animpal[768]; char waterpal[768], slimepal[768], titlepal[768], drealms[768], endingpal[768], animpal[768];
static char firstdemofile[80] = { '\0' }; static char firstdemofile[80] = { '\0' };
int display_bonus_screen = 1;
static int userconfiles = 0; static int userconfiles = 0;
static int netparamcount = 0; static int netparamcount = 0;
@ -11073,7 +11072,7 @@ MAIN_LOOP_RESTART:
ready2send = 0; ready2send = 0;
if (display_bonus_screen == 1) if (ud.display_bonus_screen == 1)
{ {
i = ud.screen_size; i = ud.screen_size;
ud.screen_size = 0; ud.screen_size = 0;
@ -11102,7 +11101,7 @@ MAIN_LOOP_RESTART:
} }
} }
} }
display_bonus_screen = 1; ud.display_bonus_screen = 1;
ready2send = 0; ready2send = 0;
if (numplayers > 1) g_player[myconnectindex].ps->gm = MODE_GAME; if (numplayers > 1) g_player[myconnectindex].ps->gm = MODE_GAME;
if (enterlevel(g_player[myconnectindex].ps->gm)) if (enterlevel(g_player[myconnectindex].ps->gm))

View file

@ -888,6 +888,7 @@ const memberlabel_t userdefslabels[]=
{ "levelstats", USERDEFS_LEVELSTATS, 0, 0 }, { "levelstats", USERDEFS_LEVELSTATS, 0, 0 },
{ "crosshairscale", USERDEFS_CROSSHAIRSCALE, 0, 0 }, { "crosshairscale", USERDEFS_CROSSHAIRSCALE, 0, 0 },
{ "althud", USERDEFS_ALTHUD, 0, 0 }, { "althud", USERDEFS_ALTHUD, 0, 0 },
{ "display_bonus_screen", USERDEFS_DISPLAY_BONUS_SCREEN, 0, 0 },
{ "", -1, 0, 0 } // END OF LIST { "", -1, 0, 0 } // END OF LIST
}; };

View file

@ -50,7 +50,6 @@ extern int g_weapon_xoffset;
extern int g_gs; extern int g_gs;
extern int g_kb; extern int g_kb;
extern int g_looking_angSR1; extern int g_looking_angSR1;
extern int display_bonus_screen;
extern int lastvisinc; extern int lastvisinc;
extern char cheatstrings[][MAXCHEATLEN]; extern char cheatstrings[][MAXCHEATLEN];
extern char compilefile[BMAX_PATH]; extern char compilefile[BMAX_PATH];
@ -343,7 +342,8 @@ enum userdefslabels
USERDEFS_OBITUARIES, USERDEFS_OBITUARIES,
USERDEFS_LEVELSTATS, USERDEFS_LEVELSTATS,
USERDEFS_CROSSHAIRSCALE, USERDEFS_CROSSHAIRSCALE,
USERDEFS_ALTHUD USERDEFS_ALTHUD,
USERDEFS_DISPLAY_BONUS_SCREEN
}; };
enum sectorlabels enum sectorlabels

View file

@ -886,6 +886,15 @@ static void DoUserDef(int iSet, int lLabelID, int lVar2)
SetGameVarID(lVar2, ud.althud, g_i, g_p); SetGameVarID(lVar2, ud.althud, g_i, g_p);
return; 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: default:
return; return;
} }
@ -5478,7 +5487,7 @@ static int parse(void)
else else
{ {
g_player[myconnectindex].ps->gm |= MODE_EOL; g_player[myconnectindex].ps->gm |= MODE_EOL;
display_bonus_screen = 0; ud.display_bonus_screen = 0;
} // MODE_RESTART; } // MODE_RESTART;
break; break;
@ -7538,16 +7547,16 @@ static int parse(void)
case CON_SETGAMEPALETTE: case CON_SETGAMEPALETTE:
insptr++; insptr++;
j=GetGameVarID(*(insptr++), g_i, g_p); j=GetGameVarID(*(insptr++), g_i, g_p);
switch(j) switch (j)
{ {
default: default:
case 0:setgamepalette(g_player[g_p].ps,palette ,0);break; case 0:setgamepalette(g_player[g_p].ps,palette ,0);break;
case 1:setgamepalette(g_player[g_p].ps,waterpal ,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 2:setgamepalette(g_player[g_p].ps,slimepal ,0);break;
case 3:setgamepalette(g_player[g_p].ps,drealms ,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 4:setgamepalette(g_player[g_p].ps,titlepal ,0);break;
case 5:setgamepalette(g_player[g_p].ps,endingpal,0);break; case 5:setgamepalette(g_player[g_p].ps,endingpal,0);break;
case 6:setgamepalette(g_player[g_p].ps,animpal ,0);break; case 6:setgamepalette(g_player[g_p].ps,animpal ,0);break;
} }
break; break;

View file

@ -867,7 +867,7 @@ static int osdcmd_give(const osdfuncparm_t *parm)
int i; int i;
if (numplayers != 1 || (g_player[myconnectindex].ps->gm & MODE_GAME) == 0 || 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"); OSD_Printf("give: Cannot give while dead or not in a single-player game.\n");
return OSDCMD_OK; return OSDCMD_OK;

View file

@ -644,7 +644,7 @@ int saveplayer(int spot)
for (i=0;i<g_ScriptSize;i++) for (i=0;i<g_ScriptSize;i++)
{ {
if (bitptr[i] == BITPTR_POINTER) if (bitptr[i] == BITPTR_POINTER)
// if ((intptr_t)script[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; scriptptrs[i] = 1;
j = (intptr_t)script[i] - (intptr_t)&script[0]; j = (intptr_t)script[i] - (intptr_t)&script[0];

View file

@ -186,10 +186,10 @@ static void PopulateForm(int pgs)
(void)ComboBox_SetCurSel(hwnd, j); (void)ComboBox_SetCurSel(hwnd, j);
for (dirs=finddirs,i=1; dirs != NULL; dirs=dirs->next,i++) 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); j = ComboBox_AddString(hwnd, dirs->name);
(void)ComboBox_SetItemData(hwnd, j, i); (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); (void)ComboBox_SetCurSel(hwnd, j);
} }
} }