git-svn-id: https://svn.eduke32.com/eduke32@1325 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2009-04-14 22:55:32 +00:00
parent 5b3524d621
commit 80e2ec8edf
13 changed files with 128 additions and 91 deletions

View file

@ -40,15 +40,17 @@ extern "C" {
#define MAXSPRITESONSCREEN 4096
#define MAXUNIQHUDID 256 //Extra slots so HUD models can store animation state without messing game sprites
#define RESERVEDPALS 8 // don't forget to increment this when adding reserved pals
#define RESERVEDPALS 2 // don't forget to increment this when adding reserved pals
#define DETAILPAL (MAXPALOOKUPS - 1)
#define GLOWPAL (MAXPALOOKUPS - 2)
/*
#define REDPAL (MAXPALOOKUPS - 3)
#define BLUEPAL (MAXPALOOKUPS - 4)
#define BROWNPAL (MAXPALOOKUPS - 5)
#define GREYPAL (MAXPALOOKUPS - 6)
#define GREENPAL (MAXPALOOKUPS - 7)
#define SPECPAL (MAXPALOOKUPS - 8)
*/
#define TSPR_TEMP 99
#define TSPR_MIRROR 100

View file

@ -21,7 +21,7 @@ enum
T_DEFINETEXTURE,
T_DEFINESKYBOX,
T_DEFINETINT,
T_DEFINECONV,
/*T_DEFINECONV,*/
T_DEFINEMODEL,
T_DEFINEMODELFRAME,
T_DEFINEMODELANIM,
@ -74,7 +74,7 @@ enum
T_CACHESIZE,
T_IMPORTTILE,
T_MUSIC,T_ID,T_SOUND,
T_REDPAL,T_BLUEPAL,T_BROWNPAL,T_GREYPAL,T_GREENPAL,T_SPECPAL,
/* T_REDPAL,T_BLUEPAL,T_BROWNPAL,T_GREYPAL,T_GREENPAL,T_SPECPAL,*/
T_TILEFROMTEXTURE, T_XOFFSET, T_YOFFSET
};
@ -90,7 +90,7 @@ static tokenlist basetokens[] =
{ "definetexture", T_DEFINETEXTURE },
{ "defineskybox", T_DEFINESKYBOX },
{ "definetint", T_DEFINETINT },
{ "defineconv", T_DEFINECONV },
/* { "defineconv", T_DEFINECONV },*/
{ "definemodel", T_DEFINEMODEL },
{ "definemodelframe",T_DEFINEMODELFRAME },
{ "definemodelanim", T_DEFINEMODELANIM },
@ -142,12 +142,14 @@ static tokenlist modeltokens[] =
{ "skin", T_SKIN },
{ "glow", T_GLOW },
{ "detail", T_DETAIL },
/*
{ "redmap", T_REDPAL },
{ "bluepal", T_BLUEPAL },
{ "brownpal",T_BROWNPAL},
{ "greypal", T_GREYPAL },
{ "greenpal",T_GREENPAL},
{ "specpal", T_SPECPAL },
*/
{ "hud", T_HUD },
{ "flags", T_FLAGS },
};
@ -233,12 +235,14 @@ static tokenlist texturetokens[] =
{ "pal", T_PAL },
{ "detail", T_DETAIL },
{ "glow", T_GLOW },
/*
{ "redmap", T_REDPAL },
{ "bluepal", T_BLUEPAL },
{ "brownpal",T_BROWNPAL},
{ "greypal", T_GREYPAL },
{ "greenpal",T_GREENPAL},
{ "specpal", T_SPECPAL },
*/
};
static tokenlist texturetokens_pal[] =
@ -436,6 +440,7 @@ static int32_t defsparser(scriptfile *script)
hicsetpalettetint(pal,r,g,b,f);
}
break;
/*
case T_DEFINECONV:
{
int32_t pal, pal1, pal2;
@ -448,6 +453,7 @@ static int32_t defsparser(scriptfile *script)
#endif
}
break;
*/
case T_ALPHAHACK:
{
int32_t tile;
@ -1206,7 +1212,9 @@ static int32_t defsparser(scriptfile *script)
}
break;
case T_SKIN: case T_DETAIL: case T_GLOW:
/*
case T_REDPAL: case T_BLUEPAL: case T_BROWNPAL: case T_GREYPAL: case T_GREENPAL: case T_SPECPAL:
*/
{
char *skintokptr = script->ltextptr;
char *skinend, *skinfn = 0;
@ -1244,12 +1252,14 @@ static int32_t defsparser(scriptfile *script)
switch (token)
{
/*
case T_REDPAL: palnum = REDPAL; break;
case T_BLUEPAL: palnum = BLUEPAL; break;
case T_BROWNPAL:palnum = BROWNPAL; break;
case T_GREYPAL: palnum = GREYPAL; break;
case T_GREENPAL:palnum = GREENPAL; break;
case T_SPECPAL: palnum = SPECPAL; break;
*/
case T_DETAIL:
palnum = DETAILPAL;
@ -1608,7 +1618,7 @@ static int32_t defsparser(scriptfile *script)
}
break;
case T_DETAIL: case T_GLOW:
case T_REDPAL: case T_BLUEPAL: case T_BROWNPAL: case T_GREYPAL: case T_GREENPAL: case T_SPECPAL:
/* case T_REDPAL: case T_BLUEPAL: case T_BROWNPAL: case T_GREYPAL: case T_GREENPAL: case T_SPECPAL:*/
{
char *detailtokptr = script->ltextptr, *detailend;
int32_t pal = 0, i;
@ -1664,12 +1674,14 @@ static int32_t defsparser(scriptfile *script)
switch (token)
{
/*
case T_REDPAL: pal = REDPAL; palmapbits|=32; break;
case T_BLUEPAL: pal = BLUEPAL; palmapbits|=16; break;
case T_BROWNPAL:pal = BROWNPAL; palmapbits|= 8; break;
case T_GREYPAL: pal = GREYPAL; palmapbits|= 4; break;
case T_GREENPAL:pal = GREENPAL; palmapbits|= 2; break;
case T_SPECPAL: pal = SPECPAL; palmapbits|= 1; break;
*/
case T_DETAIL:
pal = DETAILPAL;

View file

@ -62,9 +62,11 @@ void hicinit(void)
int32_t i,j;
hicreplctyp *hr, *next;
/*
#if defined(USE_OPENGL)
clearconv();
#endif
*/
for (i=0; i<MAXPALOOKUPS; i++) // all tints should be 100%
{
hictinting[i].r = hictinting[i].g = hictinting[i].b = 0xff;

View file

@ -357,7 +357,7 @@ int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32
sk->fn = (char *)malloc(strlen(skinfn)+1);
if (!sk->fn) return(-4);
strcpy(sk->fn, skinfn);
sk->palmap=0;
/* sk->palmap=0;*/
return 0;
}
@ -410,6 +410,7 @@ int32_t md_undefinemodel(int32_t modelid)
md2model_t *modelhead;
mdskinmap_t *skhead;
/*
typedef struct
{
int32_t pal,pal1,pal2;
@ -506,8 +507,9 @@ static void applypalmapSkin(char *pic, int32_t sizx, int32_t sizy, md2model_t *m
applypalmap(pic,sk->palmap,sk->size,pal2);
}
}
*/
static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t *sizx, int32_t *sizy, int32_t *osizx, int32_t *osizy, char *hasalpha, int32_t pal, char effect, md2model_t *m, int32_t number, int32_t surf)
static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t *sizx, int32_t *sizy, int32_t *osizx, int32_t *osizy, char *hasalpha, int32_t pal, char effect)
{
int32_t picfillen, j,y,x;
char *picfil,*cptr,al=255;
@ -544,7 +546,7 @@ static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t
{ free(picfil); free(pic); return -1; }
free(picfil);
applypalmapSkin((char *)pic,tsizx,tsizy,m,number,pal,surf);
/*applypalmapSkin((char *)pic,tsizx,tsizy,m,number,pal,surf);*/
cptr = &britable[gammabrightness ? 0 : curbrightness][0];
r=(glinfo.bgra)?hictinting[pal].b:hictinting[pal].r;
g=hictinting[pal].g;
@ -850,7 +852,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
cachefil = -1; // the compressed version will be saved to disk
if ((filh = kopen4load(fn, 0)) < 0) return -1;
if (daskinloader(filh,&fptr,&bpl,&xsiz,&ysiz,&osizx,&osizy,&hasalpha,pal,(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK),m,number,surf))
if (daskinloader(filh,&fptr,&bpl,&xsiz,&ysiz,&osizx,&osizy,&hasalpha,pal,(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)))
{
kclose(filh);
OSD_Printf("Failed loading skin file \"%s\"\n", fn);
@ -859,6 +861,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
}
else kclose(filh);
if (pal < (MAXPALOOKUPS - RESERVEDPALS))m->usesalpha = hasalpha;
/*
if (pal>=SPECPAL&&pal<=REDPAL)
{
//_initprintf("%cLoaded palmap %d(%dx%d)",sk->palmap?'+':'-',pal,xsiz,ysiz);
@ -871,6 +874,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
cachefil=0;
//_initprintf("#%d\n",sk->palmap);
}
*/
if ((doalloc&3)==1) bglGenTextures(1,(GLuint*)texidx);
bglBindTexture(GL_TEXTURE_2D,*texidx);
@ -1300,11 +1304,13 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
if (m->numskins > 0)
{
sk->fn = (char *)malloc(strlen(m->basepath)+strlen(m->skinfn)+1);
/*
if (sk->palmap)
{
//_initprintf("Delete %s",m->skinfn);
sk->palmap=0; sk->size=0;
}
*/
strcpy(sk->fn, m->basepath);
strcat(sk->fn, m->skinfn);
}
@ -2198,11 +2204,13 @@ static void md3free(md3model_t *m)
{
nsk = sk->next;
free(sk->fn);
/*
if (sk->palmap)
{
//_initprintf("Kill %d\n",sk->palette);
free(sk->palmap); sk->palmap=0;
}
*/
free(sk);
}

View file

@ -680,11 +680,13 @@ void polymost_glreset()
free(pth->ofb);
}
bglDeleteTextures(1,&pth->glpic);
/*
if (pth->palmap)
{
//_initprintf("Kill #%d\n",pth->palmap);
free(pth->palmap); pth->palmap=0;
}
*/
free(pth);
pth = next;
}
@ -1476,8 +1478,7 @@ int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, texcache
offset = t->offset;
// initprintf("got a match for %s offset %d\n",cachefn,offset);
}
if (i < 0) return -1; // didn't find it
else return -1; // didn't find it
if (Blseek(cachefilehandle, offset, BSEEK_SET) == -1)
{
@ -1521,7 +1522,7 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea
GLint gi;
int32_t offset = 0;
if (!glinfo.texcompr || !glusetexcompr || !glusetexcache || !cacheindexptr || cachefilehandle < 0) return;
if (!glinfo.texcompr || !glusetexcompr || !glusetexcache) return;
if (!bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB)
{
// lacking the necessary extensions to do this
@ -1529,40 +1530,19 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea
glusetexcache = 0;
return;
}
/*
if (!cacheindexptr || cachefilehandle < 0)
{
struct stat st;
if (stat(TEXCACHEFILE, &st) < 0)
{
if (errno == ENOENT) // path doesn't exist
{
// try to create the cache directory
if (Bmkdir(TEXCACHEFILE, S_IRWXU) < 0)
{
OSD_Printf("Failed to create texture cache directory %s\n", TEXCACHEFILE);
glusetexcache = 0;
OSD_Printf("Warning: no active cache!\n");
return;
}
else OSD_Printf("Created texture cache directory %s\n", TEXCACHEFILE);
}
else
{
// another type of failure
glusetexcache = 0;
return;
}
}
else if ((st.st_mode & S_IFDIR) != S_IFDIR)
{
// cache directory isn't a directory
glusetexcache = 0;
return;
}
}
*/
gi = GL_FALSE;
bglGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, (GLint *)&gi);
if (gi != GL_TRUE) return;
if (gi != GL_TRUE)
{
OSD_Printf("Error: glGetTexLevelParameteriv returned GL_FALSE!\n");
return;
}
md4once((uint8_t *)fn, strlen(fn), mdsum);
@ -1573,7 +1553,7 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea
Blseek(cachefilehandle, 0, BSEEK_END);
offset = Blseek(cachefilehandle, 0, BSEEK_CUR);
OSD_Printf("Writing cached tex %s, offset 0x%x\n", cachefn, offset);
OSD_Printf("Caching %s, offset 0x%x\n", cachefn, offset);
Bmemcpy(head->magic, "PMST", 4); // sizes are set by caller
@ -1646,6 +1626,7 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea
fseek(cacheindexptr, 0, BSEEK_END);
Bfprintf(cacheindexptr, "%s %d %d\n", t->name, t->offset, t->len);
}
else OSD_Printf("wtf?\n");
}
else
{
@ -1659,6 +1640,7 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea
fseek(cacheindexptr, 0, BSEEK_END);
Bfprintf(cacheindexptr, "%s %d %d\n", curcacheindex->name, curcacheindex->offset, curcacheindex->len);
}
else OSD_Printf("wtf?\n");
hash_add(&cacheH, Bstrdup(cachefn), numcacheentries);
cacheptrs[numcacheentries++] = curcacheindex;
@ -1669,7 +1651,7 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea
goto success;
failure:
initprintf("failure!\n");
initprintf("ERROR: cache failure!\n");
curcacheindex->offset = 0;
Bmemset(curcacheindex->name,0,sizeof(curcacheindex->name));
@ -1759,6 +1741,7 @@ failure:
return -1;
}
// --------------------------------------------------- JONOF'S COMPRESSED TEXTURE CACHE STUFF
/*
static void applypalmapsT(char *pic, int32_t sizx, int32_t sizy, int32_t dapic,int32_t dapalnum, int32_t dameth)
{
//_initprintf("%d\n",pal);
@ -1782,6 +1765,7 @@ static void applypalmapsT(char *pic, int32_t sizx, int32_t sizy, int32_t dapic,i
applypalmap(pic,pth->palmap,pth->size,pal2);
}
}
*/
int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp *hicr, int32_t dameth, pthtyp *pth, int32_t doalloc, char effect)
{
@ -1860,7 +1844,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
pic = (coltype *)calloc(xsiz,ysiz*sizeof(coltype)); if (!pic) { free(picfil); return 1; }
if (kprender(picfil,picfillen,(intptr_t)pic,xsiz*sizeof(coltype),xsiz,ysiz,0,0)) { free(picfil); free(pic); return -2; }
applypalmapsT((char *)pic,tsizx,tsizy,dapic,dapalnum,dameth);
/* applypalmapsT((char *)pic,tsizx,tsizy,dapic,dapalnum,dameth);*/
r=(glinfo.bgra)?hictinting[dapalnum].r:hictinting[dapalnum].b;
g=hictinting[dapalnum].g;
@ -1933,6 +1917,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
if ((doalloc&3)==1) bglGenTextures(1,(GLuint*)&pth->glpic); //# of textures (make OpenGL allocate structure)
bglBindTexture(GL_TEXTURE_2D,pth->glpic);
/*
if (dapalnum>=SPECPAL&&dapalnum<=REDPAL)
{
//_initprintf("%cLoaded palamp %d(%dx%d)",pth->palmap?'+':'-',dapalnum,xsiz,ysiz);
@ -1944,6 +1929,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
}
cachefil=0;
}
*/
fixtransparency(pic,tsizx,tsizy,xsiz,ysiz,dameth);
uploadtexture(doalloc,xsiz,ysiz,intexfmt,texfmt,pic,-1,tsizy,dameth|8192|(hicr->flags & 16?4096:0));
}

View file

@ -600,7 +600,7 @@ static void G_MoveZombieActors(void)
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 4096, 255+(80<<8),0);
break;
case ATOMICHEALTH__STATIC:
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(128<<8)+(255<<16),0);
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(128<<8)+(255<<16),1);
break;
case FIRE__STATIC:
@ -621,15 +621,15 @@ static void G_MoveZombieActors(void)
break;
case EXPLOSION2__STATIC:
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 4096, 255+(80<<8),0);
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 4096, 255+(80<<8),1);
break;
case FORCERIPPLE__STATIC:
// case TRANSPORTERSTAR__STATIC:
case TRANSPORTERBEAM__STATIC:
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 80+(80<<8)+(255<<16),0);
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 80+(80<<8)+(255<<16),2);
break;
case SHRINKEREXPLOSION__STATIC:
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(255<<8)+(128<<16),0);
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(255<<8)+(128<<16),1);
break;
}
@ -2280,7 +2280,7 @@ static void G_MoveWeapons(void)
// A_PlaySound(WIERDSHOT_FLY,i);
if (ActorExtra[i].projectile.flashcolor)
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, ActorExtra[i].projectile.flashcolor,0);
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, ActorExtra[i].projectile.flashcolor,2);
if (ActorExtra[i].projectile.workslike & PROJECTILE_BOUNCESOFFWALLS)
{
@ -2727,20 +2727,20 @@ static void G_MoveWeapons(void)
switch (DynamicTileMap[s->picnum])
{
case FREEZEBLAST__STATIC:
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(128<<8)+(255<<16),0);
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(128<<8)+(255<<16),1);
break;
case COOLEXPLOSION1__STATIC:
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 3072, 128+(0<<8)+(255<<16),0);
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 3072, 128+(0<<8)+(255<<16),1);
break;
case SHRINKSPARK__STATIC:
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(255<<8)+(128<<16),0);
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(255<<8)+(128<<16),1);
break;
case RPG__STATIC:
case FIRELASER__STATIC:
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 32 * s->yrepeat, 255+(80<<8),0);
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 32 * s->yrepeat, 255+(80<<8),2);
if (DynamicTileMap[s->picnum] == RPG__STATIC && ActorExtra[i].picnum != BOSS2 &&
s->xrepeat >= 10 && sector[s->sectnum].lotag != 2)
@ -3386,7 +3386,7 @@ static void G_MoveActors(void)
switch (DynamicTileMap[switchpicnum])
{
case ATOMICHEALTH__STATIC:
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(128<<8)+(255<<16),0);
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(128<<8)+(255<<16),1);
break;
case FIRE__STATIC:
@ -5152,15 +5152,15 @@ static void G_MoveMisc(void) // STATNUM 5
break;
case EXPLOSION2__STATIC:
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), (512 * s->yrepeat) / (ActorExtra[i].temp_data[2]+1), 255+(80<<8),0);
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), (512 * s->yrepeat) / (ActorExtra[i].temp_data[2]+1), 255+(80<<8),1);
break;
case FORCERIPPLE__STATIC:
// case TRANSPORTERSTAR__STATIC:
case TRANSPORTERBEAM__STATIC:
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 80+(80<<8)+(255<<16),0);
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 80+(80<<8)+(255<<16),2);
break;
case SHRINKEREXPLOSION__STATIC:
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(255<<8)+(128<<16),0);
G_AddGameLight(0, s->sectnum, s->x, s->y, s->z-((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(255<<8)+(128<<16),1);
break;
}
if (!actorscrptr[sprite[i].picnum])

View file

@ -196,6 +196,7 @@ void CONFIG_SetDefaults(void)
#endif
ud.config.useprecache = 1;
ud.config.ForceSetup = 1;
ud.config.NoAutoLoad = 0;
ud.config.AmbienceToggle = 1;
ud.config.AutoAim = 1;
ud.config.FXDevice = 0;
@ -667,6 +668,7 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Setup","ConfigVersion",&ud.configversion);
SCRIPT_GetNumber(ud.config.scripthandle, "Setup","ForceSetup",&ud.config.ForceSetup);
SCRIPT_GetNumber(ud.config.scripthandle, "Setup","NoAutoLoad",&ud.config.NoAutoLoad);
#ifdef _WIN32
if (g_noSetup == 0 && mod_dir[0] == '/')
@ -784,9 +786,9 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyPanning", &r_parallaxskypanning);
/*SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLPeelsCount", &r_peelscount);*/
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLProjectionFix", &glprojectionhacks);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLRenderMode", &glrendmode);
if (glrendmode > 4) glrendmode = 4;
if (glrendmode < 3) glrendmode = 3;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Polymer", &dummy);
if (dummy > 0) glrendmode = 4;
else glrendmode = 3;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLTextureMode", &gltexfiltermode);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLTextureQuality", &r_downsize);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLUseCompressedTextureCache", &glusetexcache);
@ -1070,6 +1072,7 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Setup","ConfigVersion",BYTEVERSION_JF,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup",ud.config.ForceSetup,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "NoAutoLoad",ud.config.NoAutoLoad,false,false);
{
Bsprintf(tempbuf,"%.2f",r_ambientlight);
@ -1089,7 +1092,7 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyPanning",r_parallaxskypanning,false,false);
/*SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLPeelsCount",r_peelscount,false,false);*/
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLProjectionFix",glprojectionhacks,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLRenderMode",glrendmode,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Polymer",glrendmode == 4,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLTextureMode",gltexfiltermode,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLTextureQuality", r_downsize,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLUseCompressedTextureCache", glusetexcache,false,false);

View file

@ -79,7 +79,7 @@ extern int32_t g_scriptVersion, g_Shareware, g_gameType;
#define BYTEVERSION_14 116
#define BYTEVERSION_15 117
#define BYTEVERSION_JF 192 // increase by 3, because atomic GRP adds 1, and Shareware adds 2
#define BYTEVERSION_JF 195 // increase by 3, because atomic GRP adds 1, and Shareware adds 2
#define BYTEVERSION (BYTEVERSION_JF+(PLUTOPAK?1:(VOLUMEONE<<1))) // JBF 20040116: different data files give different versions
@ -359,6 +359,7 @@ typedef struct {
int32_t ScreenBPP;
int32_t ForceSetup;
int32_t NoAutoLoad;
int32_t scripthandle;
int32_t setupread;

View file

@ -9261,7 +9261,7 @@ static int32_t parsedefinitions_game(scriptfile *script, const int32_t preload)
else
{
initprintf("Using group file '%s'.\n",fn);
if (!g_noAutoLoad)
if (!g_noAutoLoad && !ud.config.NoAutoLoad)
G_DoAutoload(fn);
}
@ -11230,7 +11230,7 @@ CLEAN_DIRECTORY:
else
initprintf("Using group file '%s' as main group file.\n", duke3dgrp);
if (!g_noAutoLoad)
if (!g_noAutoLoad && !ud.config.NoAutoLoad)
{
int32_t ii;
@ -11283,7 +11283,7 @@ CLEAN_DIRECTORY:
{
g_groupFileHandle = j;
initprintf("Using group file '%s'.\n",CommandGrps->str);
if (!g_noAutoLoad)
if (!g_noAutoLoad && !ud.config.NoAutoLoad)
G_DoAutoload(CommandGrps->str);
}

View file

@ -24,7 +24,8 @@ FONT 8, "MS Shell Dlg"
BEGIN
CONTROL "&Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8
CONTROL "", IDCVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 6, 80, 56
CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 49, 10
CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 46, 10
CONTROL "&Polymer", IDCPOLYMER, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 197, 8, 40, 10
CONTROL "Input devices:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 22, 50, 8
CONTROL "Mo&use", IDCINPUTMOUSE, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 60, 22, 49, 8
@ -35,14 +36,14 @@ BEGIN
CONTROL "Custom game content &directory:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 90, 160, 8
CONTROL "", IDCGAMEDIR, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 10, 99, 226, 156
CONTROL "&Enable ""autoload"" folder", IDCAUTOLOAD, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 116, 100, 8
CONTROL "&Always show this window at startup", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8
END
#define FILEVER 1,4,9,9
#define PRODUCTVER 1,4,9,9
#define STRFILEVER "1.5.0devel\0"
#define STRPRODUCTVER "1.5.0devel\0"
#define FILEVER 1,9,9,9
#define PRODUCTVER 1,9,9,9
#define STRFILEVER "2.0.0devel\0"
#define STRPRODUCTVER "2.0.0devel\0"
VS_VERSION_INFO VERSIONINFO
FILEVERSION FILEVER

View file

@ -354,7 +354,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
case RPG__STATIC:
case MORTER__STATIC:
G_AddGameLight(0, s->sectnum, s->x+((sintable[(s->ang+512)&2047])>>7),
s->y+((sintable[(s->ang)&2047])>>7), s->z-PHEIGHT, 4096, 255+(80<<8),0);
s->y+((sintable[(s->ang)&2047])>>7), s->z-PHEIGHT, 4096, 255+(80<<8),1);
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].sector = s->sectnum;
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].x = s->x+((sintable[(s->ang+512)&2047])>>4);
@ -387,7 +387,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
if (ProjectileData[atwith].flashcolor)
{
G_AddGameLight(0, s->sectnum, s->x+((sintable[(s->ang+512)&2047])>>7),
s->y+((sintable[(s->ang)&2047])>>7), s->z-PHEIGHT, 4096, ProjectileData[atwith].flashcolor,0);
s->y+((sintable[(s->ang)&2047])>>7), s->z-PHEIGHT, 4096, ProjectileData[atwith].flashcolor,1);
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].sector = s->sectnum;
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].x = s->x+((sintable[(s->ang+512)&2047])>>4);
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].y = s->y+((sintable[(s->ang)&2047])>>4);
@ -2177,7 +2177,7 @@ void P_FireWeapon(DukePlayer_t *p)
p->visibility = 0;
G_AddGameLight(0, s->sectnum, s->x+((sintable[(p->ang+512)&2047])>>7), s->y+((sintable[(p->ang)&2047])>>7),
s->z-PHEIGHT, 4096, aplWeaponFlashColor[p->curr_weapon][snum],0);
s->z-PHEIGHT, 4096, aplWeaponFlashColor[p->curr_weapon][snum],1);
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].sector = s->sectnum;
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].x = s->x+((sintable[(p->ang+512)&2047])>>4);

View file

@ -30,7 +30,7 @@ static struct audioenumdrv *wavedevs = NULL;
static struct
{
int32_t fullscreen;
int32_t flags; // bitfield
int32_t xdim, ydim, bpp;
int32_t forcesetup;
int32_t usemouse, usejoy;
@ -91,8 +91,8 @@ static void PopulateForm(int32_t pgs)
hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE);
mode = checkvideomode(&settings.xdim, &settings.ydim, settings.bpp, settings.fullscreen, 1);
if (mode < 0)
mode = checkvideomode(&settings.xdim, &settings.ydim, settings.bpp, settings.flags&1, 1);
if (mode < 0 || (settings.bpp < 15 && (settings.flags & 2)))
{
int32_t cd[] = { 32, 24, 16, 15, 8, 0 };
for (i=0; cd[i];)
@ -102,18 +102,20 @@ static void PopulateForm(int32_t pgs)
}
for (; cd[i]; i++)
{
mode = checkvideomode(&settings.xdim, &settings.ydim, cd[i], settings.fullscreen, 1);
mode = checkvideomode(&settings.xdim, &settings.ydim, cd[i], settings.flags&1, 1);
if (mode < 0) continue;
settings.bpp = cd[i];
break;
}
}
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), (settings.fullscreen ? BST_CHECKED : BST_UNCHECKED));
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), ((settings.flags&1) ? BST_CHECKED : BST_UNCHECKED));
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCPOLYMER), ((settings.flags&2) ? BST_CHECKED : BST_UNCHECKED));
(void)ComboBox_ResetContent(hwnd);
for (i=0; i<validmodecnt; i++)
{
if (validmode[i].fs != settings.fullscreen) continue;
if (validmode[i].fs != (settings.flags & 1)) continue;
if ((validmode[i].bpp < 15) && (settings.flags & 2)) continue;
// all modes get added to the 3D mode list
Bsprintf(buf, "%d x %d %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
@ -155,7 +157,7 @@ static void PopulateForm(int32_t pgs)
}
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED));
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCAUTOLOAD), (!(settings.flags & 4) ? BST_CHECKED : BST_UNCHECKED));
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCINPUTMOUSE), (settings.usemouse ? BST_CHECKED : BST_UNCHECKED));
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCINPUTJOY), (settings.usejoy ? BST_CHECKED : BST_UNCHECKED));
}
@ -211,7 +213,14 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
switch (LOWORD(wParam))
{
case IDCFULLSCREEN:
settings.fullscreen = !settings.fullscreen;
if (settings.flags & 1) settings.flags &= ~1;
else settings.flags |= 1;
PopulateForm(POPULATE_VIDEO);
return TRUE;
case IDCPOLYMER:
if (settings.flags & 2) settings.flags &= ~2;
else settings.flags |= 2;
if (settings.bpp == 8) settings.bpp = 32;
PopulateForm(POPULATE_VIDEO);
return TRUE;
case IDCVMODE:
@ -231,6 +240,11 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
case IDCALWAYSSHOW:
settings.forcesetup = IsDlgButtonChecked(hwndDlg, IDCALWAYSSHOW) == BST_CHECKED;
return TRUE;
case IDCAUTOLOAD:
if (IsDlgButtonChecked(hwndDlg, IDCALWAYSSHOW) == BST_CHECKED)
settings.flags &= ~4;
else settings.flags |= 4;
return TRUE;
case IDCINPUTMOUSE:
settings.usemouse = IsDlgButtonChecked(hwndDlg, IDCINPUTMOUSE) == BST_CHECKED;
return TRUE;
@ -304,6 +318,7 @@ static void EnableConfig(int32_t n)
//EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n);
EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_START), n);
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), n);
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCPOLYMER), n);
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCVMODE), n);
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCINPUTMOUSE), n);
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCINPUTJOY), n);
@ -625,11 +640,13 @@ int32_t startwin_run(void)
SetPage(TAB_CONFIG);
EnableConfig(1);
settings.fullscreen = ud.config.ScreenMode;
if (ud.config.ScreenMode) settings.flags = 1;
if (glrendmode == 4) settings.flags |= 2;
settings.xdim = ud.config.ScreenWidth;
settings.ydim = ud.config.ScreenHeight;
settings.bpp = ud.config.ScreenBPP;
settings.forcesetup = ud.config.ForceSetup;
if (ud.config.NoAutoLoad) settings.flags |= 4;
settings.usemouse = ud.config.UseMouse;
settings.usejoy = ud.config.UseJoystick;
settings.game = g_gameType;
@ -661,11 +678,14 @@ int32_t startwin_run(void)
{
int32_t i;
ud.config.ScreenMode = settings.fullscreen;
ud.config.ScreenMode = (settings.flags&1);
if (settings.flags & 2) glrendmode = 4;
else glrendmode = 3;
ud.config.ScreenWidth = settings.xdim;
ud.config.ScreenHeight = settings.ydim;
ud.config.ScreenBPP = settings.bpp;
ud.config.ForceSetup = settings.forcesetup;
ud.config.NoAutoLoad = (settings.flags & 4);
ud.config.UseMouse = settings.usemouse;
ud.config.UseJoystick = settings.usejoy;
duke3dgrp = settings.selectedgrp;

View file

@ -22,4 +22,6 @@
#define IDCALWAYSSHOW 107
#define IDCDATA 108
#define IDCGAMEDIR 109
#define IDCPOLYMER 110
#define IDCAUTOLOAD 111