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

This commit is contained in:
terminx 2009-01-21 22:43:44 +00:00
parent f3e66dddcb
commit c7d54527ca
7 changed files with 46 additions and 22 deletions

View file

@ -3,8 +3,8 @@
ENGINELIB=libengine.a
EDITORLIB=libbuild.a
# SDLCONFIG = /usr/local/bin/sdl-config
SDLCONFIG = sdl-config
SDLCONFIG = /usr/local/bin/sdl-config
# SDLCONFIG = sdl-config
ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG))
SDLROOT = /usr/local

View file

@ -18,7 +18,7 @@ extern palette_t hictinting[MAXPALOOKUPS];
extern hicreplctyp *hicreplc[MAXTILES];
extern char hicfirstinit;
typedef struct
typedef struct texcachehead_t
{
char magic[4]; // 'PMST', was 'Polymost'
int xdim, ydim; // of image, unpadded
@ -26,7 +26,7 @@ typedef struct
int quality; // r_downsize at the time the cache was written
} texcacheheader;
typedef struct
typedef struct texcachepic_t
{
int size;
int format;

View file

@ -192,18 +192,23 @@ int32_t r_fullbrights = 1;
// is medium quality a good default?
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
#define fogcalc(shade, vis, pal) \
{ \
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))); \
fogresult = min(max(fogresult, 0.01f),10.f); \
fogcol[0] = (float)palookupfog[pal].r / 63.f; \
fogcol[1] = (float)palookupfog[pal].g / 63.f; \
fogcol[2] = (float)palookupfog[pal].b / 63.f; \
fogcol[3] = 0; \
static inline void fogcalc(const int32_t shade, const int32_t vis, const int32_t pal)
{
float f;
if (shade < 0)
f = ((-shade*shade)*0.125f);
else f = ((shade*shade)*0.125f);
if (vis > 239)
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
@ -881,6 +886,14 @@ void polymost_glinit()
bglEnableClientState(GL_VERTEX_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)
{
Bclose(cachefilehandle);
@ -938,7 +951,7 @@ void polymost_glinit()
curcacheindex = &firstcacheindex;
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)
@ -978,7 +991,7 @@ void invalidatecache(void)
unlink(ptempbuf);
Bstrcat(ptempbuf,".cache");
unlink(ptempbuf);
cacheindexptr = Bfopen(ptempbuf, "wt");
cacheindexptr = Bfopen(ptempbuf, "at");
if (!cacheindexptr)
{
glusetexcache = 0;
@ -1435,7 +1448,7 @@ int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, texcache
// *(cp++) = '/';
cp = cachefn;
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);
// 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);
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->ydim = B_LITTLE32(head->ydim);
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);
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;
@ -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);
if (cacheindexptr)
{
fseek(cacheindexptr, 0, BSEEK_END);
Bfprintf(cacheindexptr, "%s %d %d\n", t->name, t->offset, t->len);
}
}
else
{
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));
if (cacheindexptr)
{
fseek(cacheindexptr, 0, BSEEK_END);
Bfprintf(cacheindexptr, "%s %d %d\n", curcacheindex->name, curcacheindex->offset, curcacheindex->len);
}
hash_add(&cacheH, Bstrdup(cachefn), numcacheentries);
cacheptrs[numcacheentries++] = curcacheindex;

View file

@ -68,7 +68,6 @@ static void Gv_Clear(void)
for (;i>=0;i--)
{
aGameVars[i].val.lValue=0;
if (aGameVars[i].szLabel)
Bfree(aGameVars[i].szLabel);
aGameVars[i].szLabel=NULL;
@ -79,6 +78,7 @@ static void Gv_Clear(void)
Bfree(aGameVars[i].val.plValues);
aGameVars[i].val.plValues=NULL;
}
aGameVars[i].val.lValue=0;
aGameVars[i].dwFlags |= GAMEVAR_RESET;
if (i >= MAXGAMEARRAYS)
continue;

View file

@ -3743,6 +3743,8 @@ void P_ProcessInput(int32_t snum)
if (TEST_SYNC_KEY(sb_snum, SK_FIRE))
// 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;
X_OnEvent(EVENT_PRESSEDFIRE, pi, snum, -1);
if (aGameVars[g_iReturnVarID].val.lValue != 0)

View file

@ -378,15 +378,17 @@ static void G_DoLoadScreen(char *statustext, int32_t percent)
{
int32_t ii = scale(288,percent,100);
int32_t x = 32;
/*
j = usehightile;
usehightile = 0;
*/
do
{
rotatesprite(x<<16,140<<16,49152,0,NOTCHON,0,2,2+8+16,0,0,xdim-1,ydim-1);
x++;
}
while (x < ii);
usehightile = j;
/* usehightile = j;*/
}
X_OnEvent(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, -1);
nextpage();

View file

@ -2824,6 +2824,7 @@ CHECKINV1:
k = -1;
Gv_SetVar(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum],p->i,snum);
Gv_SetVar(g_iWeaponVarID,j, p->i, snum);
aGameVars[g_iReturnVarID].val.lValue = 0;
X_OnEvent(EVENT_SELECTWEAPON,p->i,snum, -1);