mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 09:21:36 +00:00
git-svn-id: https://svn.eduke32.com/eduke32@1218 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
f3e66dddcb
commit
c7d54527ca
7 changed files with 46 additions and 22 deletions
|
@ -3,8 +3,8 @@
|
||||||
ENGINELIB=libengine.a
|
ENGINELIB=libengine.a
|
||||||
EDITORLIB=libbuild.a
|
EDITORLIB=libbuild.a
|
||||||
|
|
||||||
# SDLCONFIG = /usr/local/bin/sdl-config
|
SDLCONFIG = /usr/local/bin/sdl-config
|
||||||
SDLCONFIG = sdl-config
|
# SDLCONFIG = sdl-config
|
||||||
|
|
||||||
ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG))
|
ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG))
|
||||||
SDLROOT = /usr/local
|
SDLROOT = /usr/local
|
||||||
|
|
|
@ -18,7 +18,7 @@ extern palette_t hictinting[MAXPALOOKUPS];
|
||||||
extern hicreplctyp *hicreplc[MAXTILES];
|
extern hicreplctyp *hicreplc[MAXTILES];
|
||||||
extern char hicfirstinit;
|
extern char hicfirstinit;
|
||||||
|
|
||||||
typedef struct
|
typedef struct texcachehead_t
|
||||||
{
|
{
|
||||||
char magic[4]; // 'PMST', was 'Polymost'
|
char magic[4]; // 'PMST', was 'Polymost'
|
||||||
int xdim, ydim; // of image, unpadded
|
int xdim, ydim; // of image, unpadded
|
||||||
|
@ -26,7 +26,7 @@ typedef struct
|
||||||
int quality; // r_downsize at the time the cache was written
|
int quality; // r_downsize at the time the cache was written
|
||||||
} texcacheheader;
|
} texcacheheader;
|
||||||
|
|
||||||
typedef struct
|
typedef struct texcachepic_t
|
||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
int format;
|
int format;
|
||||||
|
|
|
@ -192,18 +192,23 @@ int32_t r_fullbrights = 1;
|
||||||
// is medium quality a good default?
|
// is medium quality a good default?
|
||||||
int32_t r_downsize = 1;
|
int32_t r_downsize = 1;
|
||||||
|
|
||||||
static float fogresult, fogcol[4];
|
static float fogresult, fogcol[4], fogtable[4*MAXPALOOKUPS];
|
||||||
|
|
||||||
// making this a macro should speed things up at the expense of code size
|
static inline void fogcalc(const int32_t shade, const int32_t vis, const int32_t pal)
|
||||||
#define fogcalc(shade, vis, pal) \
|
{
|
||||||
{ \
|
float f;
|
||||||
fogresult = (float)gvisibility*(vis+16+(shade<0?(-shade*shade)*0.125f:(shade*shade)*0.125f)); \
|
|
||||||
if (vis > 239) fogresult = (float)gvisibility*((vis-240+(shade<0?(-shade*shade)*0.125f:(shade*shade)*0.125f))/(klabs(vis-256))); \
|
if (shade < 0)
|
||||||
fogresult = min(max(fogresult, 0.01f),10.f); \
|
f = ((-shade*shade)*0.125f);
|
||||||
fogcol[0] = (float)palookupfog[pal].r / 63.f; \
|
else f = ((shade*shade)*0.125f);
|
||||||
fogcol[1] = (float)palookupfog[pal].g / 63.f; \
|
|
||||||
fogcol[2] = (float)palookupfog[pal].b / 63.f; \
|
if (vis > 239)
|
||||||
fogcol[3] = 0; \
|
f = gvisibility*((vis-240+f)/(klabs(vis-256)));
|
||||||
|
else f = gvisibility*(vis+16+f);
|
||||||
|
|
||||||
|
fogresult = clamp(f, 0.01f, 10.f);
|
||||||
|
|
||||||
|
Bmemcpy(fogcol,&fogtable[pal<<2],sizeof(float)*4);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -881,6 +886,14 @@ void polymost_glinit()
|
||||||
bglEnableClientState(GL_VERTEX_ARRAY);
|
bglEnableClientState(GL_VERTEX_ARRAY);
|
||||||
bglEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
bglEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
|
||||||
|
for(i=MAXPALOOKUPS-1;i>=0;i--)
|
||||||
|
{
|
||||||
|
fogtable[i<<2] = palookupfog[i].r / 63.f;
|
||||||
|
fogcol[(i<<2)+1] = palookupfog[i].g / 63.f;
|
||||||
|
fogcol[(i<<2)+2] = palookupfog[i].b / 63.f;
|
||||||
|
fogcol[(i<<2)+3] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (cachefilehandle > -1)
|
if (cachefilehandle > -1)
|
||||||
{
|
{
|
||||||
Bclose(cachefilehandle);
|
Bclose(cachefilehandle);
|
||||||
|
@ -938,7 +951,7 @@ void polymost_glinit()
|
||||||
|
|
||||||
curcacheindex = &firstcacheindex;
|
curcacheindex = &firstcacheindex;
|
||||||
initprintf("Cache contains %d bytes of garbage data\n",Blseek(cachefilehandle, 0, BSEEK_END)-i);
|
initprintf("Cache contains %d bytes of garbage data\n",Blseek(cachefilehandle, 0, BSEEK_END)-i);
|
||||||
Blseek(cachefilehandle, 0, BSEEK_SET);
|
// Blseek(cachefilehandle, 0, BSEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
void invalidatecache(void)
|
void invalidatecache(void)
|
||||||
|
@ -978,7 +991,7 @@ void invalidatecache(void)
|
||||||
unlink(ptempbuf);
|
unlink(ptempbuf);
|
||||||
Bstrcat(ptempbuf,".cache");
|
Bstrcat(ptempbuf,".cache");
|
||||||
unlink(ptempbuf);
|
unlink(ptempbuf);
|
||||||
cacheindexptr = Bfopen(ptempbuf, "wt");
|
cacheindexptr = Bfopen(ptempbuf, "at");
|
||||||
if (!cacheindexptr)
|
if (!cacheindexptr)
|
||||||
{
|
{
|
||||||
glusetexcache = 0;
|
glusetexcache = 0;
|
||||||
|
@ -1435,7 +1448,7 @@ int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, texcache
|
||||||
// *(cp++) = '/';
|
// *(cp++) = '/';
|
||||||
cp = cachefn;
|
cp = cachefn;
|
||||||
for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2);
|
for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2);
|
||||||
sprintf(cp, "-%x-%x%x", len, dameth, effect);
|
Bsprintf(cp, "-%x-%x%x", len, dameth, effect);
|
||||||
|
|
||||||
// fil = kopen4load(cachefn, 0);
|
// fil = kopen4load(cachefn, 0);
|
||||||
// if (fil < 0) return -1;
|
// if (fil < 0) return -1;
|
||||||
|
@ -1466,7 +1479,7 @@ int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, texcache
|
||||||
// initprintf("Loading cached tex: %s\n", cachefn);
|
// initprintf("Loading cached tex: %s\n", cachefn);
|
||||||
|
|
||||||
if (Bread(cachefilehandle, head, sizeof(texcacheheader)) < (int32_t)sizeof(texcacheheader)) goto failure;
|
if (Bread(cachefilehandle, head, sizeof(texcacheheader)) < (int32_t)sizeof(texcacheheader)) goto failure;
|
||||||
if (memcmp(head->magic, "PMST", 4)) goto failure;
|
if (Bmemcmp(head->magic, "PMST", 4)) goto failure;
|
||||||
head->xdim = B_LITTLE32(head->xdim);
|
head->xdim = B_LITTLE32(head->xdim);
|
||||||
head->ydim = B_LITTLE32(head->ydim);
|
head->ydim = B_LITTLE32(head->ydim);
|
||||||
head->flags = B_LITTLE32(head->flags);
|
head->flags = B_LITTLE32(head->flags);
|
||||||
|
@ -1559,7 +1572,7 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea
|
||||||
offset = Blseek(cachefilehandle, 0, BSEEK_CUR);
|
offset = Blseek(cachefilehandle, 0, BSEEK_CUR);
|
||||||
OSD_Printf("Writing cached tex %s, offset 0x%x\n", cachefn, offset);
|
OSD_Printf("Writing cached tex %s, offset 0x%x\n", cachefn, offset);
|
||||||
|
|
||||||
memcpy(head->magic, "PMST", 4); // sizes are set by caller
|
Bmemcpy(head->magic, "PMST", 4); // sizes are set by caller
|
||||||
|
|
||||||
if (glusetexcachecompression) head->flags |= 4;
|
if (glusetexcachecompression) head->flags |= 4;
|
||||||
|
|
||||||
|
@ -1626,8 +1639,11 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea
|
||||||
// initprintf("got a match for %s offset %d\n",cachefn,offset);
|
// initprintf("got a match for %s offset %d\n",cachefn,offset);
|
||||||
|
|
||||||
if (cacheindexptr)
|
if (cacheindexptr)
|
||||||
|
{
|
||||||
|
fseek(cacheindexptr, 0, BSEEK_END);
|
||||||
Bfprintf(cacheindexptr, "%s %d %d\n", t->name, t->offset, t->len);
|
Bfprintf(cacheindexptr, "%s %d %d\n", t->name, t->offset, t->len);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Bstrcpy(curcacheindex->name, cachefn);
|
Bstrcpy(curcacheindex->name, cachefn);
|
||||||
|
@ -1636,7 +1652,10 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea
|
||||||
curcacheindex->next = (texcacheindex *)Bcalloc(1, sizeof(texcacheindex));
|
curcacheindex->next = (texcacheindex *)Bcalloc(1, sizeof(texcacheindex));
|
||||||
|
|
||||||
if (cacheindexptr)
|
if (cacheindexptr)
|
||||||
|
{
|
||||||
|
fseek(cacheindexptr, 0, BSEEK_END);
|
||||||
Bfprintf(cacheindexptr, "%s %d %d\n", curcacheindex->name, curcacheindex->offset, curcacheindex->len);
|
Bfprintf(cacheindexptr, "%s %d %d\n", curcacheindex->name, curcacheindex->offset, curcacheindex->len);
|
||||||
|
}
|
||||||
|
|
||||||
hash_add(&cacheH, Bstrdup(cachefn), numcacheentries);
|
hash_add(&cacheH, Bstrdup(cachefn), numcacheentries);
|
||||||
cacheptrs[numcacheentries++] = curcacheindex;
|
cacheptrs[numcacheentries++] = curcacheindex;
|
||||||
|
|
|
@ -68,7 +68,6 @@ static void Gv_Clear(void)
|
||||||
|
|
||||||
for (;i>=0;i--)
|
for (;i>=0;i--)
|
||||||
{
|
{
|
||||||
aGameVars[i].val.lValue=0;
|
|
||||||
if (aGameVars[i].szLabel)
|
if (aGameVars[i].szLabel)
|
||||||
Bfree(aGameVars[i].szLabel);
|
Bfree(aGameVars[i].szLabel);
|
||||||
aGameVars[i].szLabel=NULL;
|
aGameVars[i].szLabel=NULL;
|
||||||
|
@ -79,6 +78,7 @@ static void Gv_Clear(void)
|
||||||
Bfree(aGameVars[i].val.plValues);
|
Bfree(aGameVars[i].val.plValues);
|
||||||
aGameVars[i].val.plValues=NULL;
|
aGameVars[i].val.plValues=NULL;
|
||||||
}
|
}
|
||||||
|
aGameVars[i].val.lValue=0;
|
||||||
aGameVars[i].dwFlags |= GAMEVAR_RESET;
|
aGameVars[i].dwFlags |= GAMEVAR_RESET;
|
||||||
if (i >= MAXGAMEARRAYS)
|
if (i >= MAXGAMEARRAYS)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -3743,6 +3743,8 @@ void P_ProcessInput(int32_t snum)
|
||||||
if (TEST_SYNC_KEY(sb_snum, SK_FIRE))
|
if (TEST_SYNC_KEY(sb_snum, SK_FIRE))
|
||||||
// if ((sb_snum&(1<<2)))
|
// if ((sb_snum&(1<<2)))
|
||||||
{
|
{
|
||||||
|
Gv_SetVar(g_iWeaponVarID,p->curr_weapon,pi,snum);
|
||||||
|
Gv_SetVar(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum],pi,snum);
|
||||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||||
X_OnEvent(EVENT_PRESSEDFIRE, pi, snum, -1);
|
X_OnEvent(EVENT_PRESSEDFIRE, pi, snum, -1);
|
||||||
if (aGameVars[g_iReturnVarID].val.lValue != 0)
|
if (aGameVars[g_iReturnVarID].val.lValue != 0)
|
||||||
|
|
|
@ -378,15 +378,17 @@ static void G_DoLoadScreen(char *statustext, int32_t percent)
|
||||||
{
|
{
|
||||||
int32_t ii = scale(288,percent,100);
|
int32_t ii = scale(288,percent,100);
|
||||||
int32_t x = 32;
|
int32_t x = 32;
|
||||||
|
/*
|
||||||
j = usehightile;
|
j = usehightile;
|
||||||
usehightile = 0;
|
usehightile = 0;
|
||||||
|
*/
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
rotatesprite(x<<16,140<<16,49152,0,NOTCHON,0,2,2+8+16,0,0,xdim-1,ydim-1);
|
rotatesprite(x<<16,140<<16,49152,0,NOTCHON,0,2,2+8+16,0,0,xdim-1,ydim-1);
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
while (x < ii);
|
while (x < ii);
|
||||||
usehightile = j;
|
/* usehightile = j;*/
|
||||||
}
|
}
|
||||||
X_OnEvent(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, -1);
|
X_OnEvent(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, -1);
|
||||||
nextpage();
|
nextpage();
|
||||||
|
|
|
@ -2824,6 +2824,7 @@ CHECKINV1:
|
||||||
|
|
||||||
k = -1;
|
k = -1;
|
||||||
|
|
||||||
|
Gv_SetVar(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum],p->i,snum);
|
||||||
Gv_SetVar(g_iWeaponVarID,j, p->i, snum);
|
Gv_SetVar(g_iWeaponVarID,j, p->i, snum);
|
||||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||||
X_OnEvent(EVENT_SELECTWEAPON,p->i,snum, -1);
|
X_OnEvent(EVENT_SELECTWEAPON,p->i,snum, -1);
|
||||||
|
|
Loading…
Reference in a new issue