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

This commit is contained in:
terminx 2009-04-23 21:08:48 +00:00
parent 4d240d1bea
commit 9462a17ae7
3 changed files with 68 additions and 15 deletions

View file

@ -677,9 +677,17 @@ void polymost_glreset()
cacheindexptr = NULL;
}
for (i = 0; i < numcacheentries; i++)
for (i = numcacheentries-1; i >= 0; i--)
if (cacheptrs[i])
{
int32_t ii;
for (ii = numcacheentries-1; ii >= 0; ii--)
if (i != ii && cacheptrs[ii] == cacheptrs[i])
{
/*OSD_Printf("removing duplicate cacheptr %d\n",ii);*/
cacheptrs[ii] = NULL;
}
Bfree(cacheptrs[i]);
cacheptrs[i] = NULL;
}
@ -752,14 +760,22 @@ void polymost_glinit()
cacheindexptr = NULL;
}
for (i = 0; i < numcacheentries; i++)
for (i = numcacheentries-1; i >= 0; i--)
if (cacheptrs[i])
{
int32_t ii;
for (ii = numcacheentries-1; ii >= 0; ii--)
if (i != ii && cacheptrs[ii] == cacheptrs[i])
{
/*OSD_Printf("removing duplicate cacheptr %d\n",ii);*/
cacheptrs[ii] = NULL;
}
Bfree(cacheptrs[i]);
cacheptrs[i] = NULL;
}
curcacheindex = firstcacheindex = Bcalloc(1, sizeof(texcacheindex));
curcacheindex = firstcacheindex = (texcacheindex *)Bcalloc(1, sizeof(texcacheindex));
numcacheentries = 0;
// Bmemset(&firstcacheindex, 0, sizeof(texcacheindex));
@ -826,14 +842,22 @@ void invalidatecache(void)
cacheindexptr = NULL;
}
for (i = 0; i < numcacheentries; i++)
for (i = numcacheentries-1; i >= 0; i--)
if (cacheptrs[i])
{
int32_t ii;
for (ii = numcacheentries-1; ii >= 0; ii--)
if (i != ii && cacheptrs[ii] == cacheptrs[i])
{
/*OSD_Printf("removing duplicate cacheptr %d\n",ii);*/
cacheptrs[ii] = NULL;
}
Bfree(cacheptrs[i]);
cacheptrs[i] = NULL;
}
curcacheindex = firstcacheindex = Bcalloc(1, sizeof(texcacheindex));
curcacheindex = firstcacheindex = (texcacheindex *)Bcalloc(1, sizeof(texcacheindex));
numcacheentries = 0;
// Bmemset(&firstcacheindex, 0, sizeof(texcacheindex));
@ -1256,14 +1280,14 @@ static int32_t LoadCacheOffsets(void)
texcacheindex *t = cacheptrs[i];
t->offset = foffset;
t->len = fsize;
// initprintf("got a match for %s offset %d\n",cachefn,offset);
/*initprintf("%s %d got a match for %s offset %d\n",__FILE__, __LINE__, fname,foffset);*/
}
else
{
Bstrncpy(curcacheindex->name, fname, BMAX_PATH);
curcacheindex->offset = foffset;
curcacheindex->len = fsize;
curcacheindex->next = Bcalloc(1, sizeof(texcacheindex));
curcacheindex->next = (texcacheindex *)Bcalloc(1, sizeof(texcacheindex));
hash_replace(&cacheH, Bstrdup(fname), numcacheentries);
cacheptrs[numcacheentries++] = curcacheindex;
curcacheindex = curcacheindex->next;
@ -1316,7 +1340,7 @@ int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, texcache
texcacheindex *t = cacheptrs[i];
len = t->len;
offset = t->offset;
// initprintf("got a match for %s offset %d\n",cachefn,offset);
/*initprintf("%s %d got a match for %s offset %d\n",__FILE__, __LINE__, cachefn,offset);*/
}
else return -1; // didn't find it
@ -1459,7 +1483,7 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea
texcacheindex *t = cacheptrs[i];
t->offset = offset;
t->len = Blseek(cachefilehandle, 0, BSEEK_CUR) - t->offset;
// initprintf("got a match for %s offset %d\n",cachefn,offset);
/*initprintf("%s %d got a match for %s offset %d\n",__FILE__, __LINE__, cachefn,offset);*/
if (cacheindexptr)
{

View file

@ -4457,7 +4457,11 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio)
if (ud.viewbob)
ud.cameraz += p->opyoff+mulscale16((int32_t)(p->pyoff-p->opyoff),smoothratio);
}
else G_DoThirdPerson(p,(vec3_t *)&ud,&ud.camerasect,ud.cameraang,ud.camerahoriz);
else
{
ud.cameraz -= 3072;
G_DoThirdPerson(p,(vec3_t *)&ud,&ud.camerasect,ud.cameraang,ud.camerahoriz);
}
cz = ActorExtra[p->i].ceilingz;
fz = ActorExtra[p->i].floorz;
@ -7018,7 +7022,6 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
if (g_player[p].ps->over_shoulder_on > 0 && g_player[p].ps->newowner < 0)
{
t->cstat |= 2;
if (screenpeek == myconnectindex && numplayers >= 2)
{
t->x = omy.x+mulscale16((int32_t)(my.x-omy.x),smoothratio);
@ -7027,6 +7030,32 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
t->ang = omyang+mulscale16((int32_t)(((myang+1024-omyang)&2047)-1024),smoothratio);
t->sectnum = mycursectnum;
}
else t->ang = g_player[p].ps->ang+mulscale16((int32_t)(((g_player[p].ps->ang+1024- g_player[p].ps->oang)&2047)-1024),smoothratio);
if (bpp == 8)
t->cstat |= 2;
else if (usemodels && md_tilehasmodel(t->picnum, t->pal) >= 0)
{
static int32_t targetang = 0;
if (g_player[p].sync->extbits&(1<<1))
{
if (g_player[p].sync->extbits&(1<<2))targetang += 16;
else if (g_player[p].sync->extbits&(1<<3)) targetang -= 16;
else if (targetang > 0) targetang -= targetang>>2;
else if (targetang < 0) targetang += (-targetang)>>2;
}
else
{
if (g_player[p].sync->extbits&(1<<2))targetang -= 16;
else if (g_player[p].sync->extbits&(1<<3)) targetang += 16;
else if (targetang > 0) targetang -= targetang>>2;
else if (targetang < 0) targetang += (-targetang)>>2;
}
targetang = clamp(targetang, -128, 128);
t->ang += targetang;
}
}
if (ud.multimode > 1 && (display_mirror || screenpeek != p || s->owner == -1))

View file

@ -3258,13 +3258,13 @@ void getinput(int32_t snum)
if (horiz > MAXHORIZ) horiz = MAXHORIZ;
loc.extbits = 0;
if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_MOVEFORWARD])
// if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_MOVEFORWARD])
loc.extbits |= BUTTON(gamefunc_Move_Forward) || (vel > 0);
if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_MOVEBACKWARD])
// if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_MOVEBACKWARD])
loc.extbits |= (BUTTON(gamefunc_Move_Backward) || (vel < 0))<<1;
if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_STRAFELEFT])
// if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_STRAFELEFT])
loc.extbits |= (BUTTON(gamefunc_Strafe_Left) || (svel > 0))<<2;
if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_STRAFERIGHT])
// if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_STRAFERIGHT])
loc.extbits |= (BUTTON(gamefunc_Strafe_Right) || (svel < 0))<<3;
if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_TURNLEFT])
loc.extbits |= BUTTON(gamefunc_Turn_Left)<<4;