mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
maint 1: refactor 3 redundant instances of the same code into G_ResetInterpolations()
git-svn-id: https://svn.eduke32.com/eduke32@1949 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
e9b15edd25
commit
864cc11463
3 changed files with 59 additions and 132 deletions
|
@ -5066,7 +5066,7 @@ void G_RestoreMapState(mapstate_t *save)
|
|||
{
|
||||
if (save != NULL)
|
||||
{
|
||||
int32_t i, k, x;
|
||||
int32_t i, x;
|
||||
intptr_t j;
|
||||
char phealth[MAXPLAYERS];
|
||||
|
||||
|
@ -5181,48 +5181,7 @@ void G_RestoreMapState(mapstate_t *save)
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: sync with TROR special interpolations? (e.g. upper floor of subway)
|
||||
g_numInterpolations = 0;
|
||||
startofdynamicinterpolations = 0;
|
||||
|
||||
k = headspritestat[STAT_EFFECTOR];
|
||||
while (k >= 0)
|
||||
{
|
||||
switch (sprite[k].lotag)
|
||||
{
|
||||
case 31:
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].floorz);
|
||||
break;
|
||||
case 32:
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].ceilingz);
|
||||
break;
|
||||
case 25:
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].floorz);
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].ceilingz);
|
||||
break;
|
||||
case 17:
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].floorz);
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].ceilingz);
|
||||
break;
|
||||
case 0:
|
||||
case 5:
|
||||
case 6:
|
||||
case 11:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
case 26:
|
||||
case 30:
|
||||
Sect_SetInterpolation(sprite[k].sectnum);
|
||||
break;
|
||||
}
|
||||
|
||||
k = nextspritestat[k];
|
||||
}
|
||||
|
||||
for (i=g_numInterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];
|
||||
for (i = g_animateCount-1; i>=0; i--)
|
||||
G_SetInterpolation(animateptr[i]);
|
||||
G_ResetInterpolations();
|
||||
|
||||
Net_ResetPrediction();
|
||||
|
||||
|
|
|
@ -47,5 +47,6 @@ void P_ResetStatus(int32_t snum);
|
|||
void P_ResetWeapons(int32_t snum);
|
||||
void G_ClearFIFO(void);
|
||||
void G_SetupCamTile(int32_t i,int32_t wn);
|
||||
void G_ResetInterpolations(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,54 @@ extern char *bitptr;
|
|||
|
||||
#define BITPTR_POINTER 1
|
||||
|
||||
// TODO: sync with TROR special interpolations? (e.g. upper floor of subway)
|
||||
void G_ResetInterpolations(void)
|
||||
{
|
||||
int32_t k, i;
|
||||
|
||||
g_numInterpolations = 0;
|
||||
startofdynamicinterpolations = 0;
|
||||
|
||||
k = headspritestat[STAT_EFFECTOR];
|
||||
while (k >= 0)
|
||||
{
|
||||
switch (sprite[k].lotag)
|
||||
{
|
||||
case 31:
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].floorz);
|
||||
break;
|
||||
case 32:
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].ceilingz);
|
||||
break;
|
||||
case 25:
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].floorz);
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].ceilingz);
|
||||
break;
|
||||
case 17:
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].floorz);
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].ceilingz);
|
||||
break;
|
||||
case 0:
|
||||
case 5:
|
||||
case 6:
|
||||
case 11:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
case 26:
|
||||
case 30:
|
||||
Sect_SetInterpolation(sprite[k].sectnum);
|
||||
break;
|
||||
}
|
||||
|
||||
k = nextspritestat[k];
|
||||
}
|
||||
|
||||
for (i=g_numInterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];
|
||||
for (i = g_animateCount-1; i>=0; i--)
|
||||
G_SetInterpolation(animateptr[i]);
|
||||
}
|
||||
|
||||
void ReadSaveGameHeaders(void)
|
||||
{
|
||||
int32_t dummy,j;
|
||||
|
@ -128,7 +176,6 @@ corrupt:
|
|||
|
||||
int32_t G_LoadPlayer(int32_t spot)
|
||||
{
|
||||
int32_t k;
|
||||
char fn[13];
|
||||
char mpfn[13];
|
||||
char *fnptr, *scriptptrs;
|
||||
|
@ -304,7 +351,7 @@ int32_t G_LoadPlayer(int32_t spot)
|
|||
|
||||
if (kdfread(&g_scriptSize,sizeof(g_scriptSize),1,fil) != 1) goto corrupt;
|
||||
if (!g_scriptSize) goto corrupt;
|
||||
// scriptptrs = Bcalloc(1,g_scriptSize * sizeof(scriptptrs));
|
||||
|
||||
Bfree(bitptr);
|
||||
bitptr = Bcalloc(1,(((g_scriptSize+7)>>3)+1) * sizeof(uint8_t));
|
||||
if (kdfread(&bitptr[0],sizeof(uint8_t),(g_scriptSize+7)>>3,fil) != ((g_scriptSize+7)>>3)) goto corrupt;
|
||||
|
@ -554,47 +601,7 @@ int32_t G_LoadPlayer(int32_t spot)
|
|||
}
|
||||
}
|
||||
|
||||
g_numInterpolations = 0;
|
||||
startofdynamicinterpolations = 0;
|
||||
|
||||
k = headspritestat[STAT_EFFECTOR];
|
||||
while (k >= 0)
|
||||
{
|
||||
switch (sprite[k].lotag)
|
||||
{
|
||||
case 31:
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].floorz);
|
||||
break;
|
||||
case 32:
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].ceilingz);
|
||||
break;
|
||||
case 25:
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].floorz);
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].ceilingz);
|
||||
break;
|
||||
case 17:
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].floorz);
|
||||
G_SetInterpolation(§or[sprite[k].sectnum].ceilingz);
|
||||
break;
|
||||
case 0:
|
||||
case 5:
|
||||
case 6:
|
||||
case 11:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
case 26:
|
||||
case 30:
|
||||
Sect_SetInterpolation(sprite[k].sectnum);
|
||||
break;
|
||||
}
|
||||
|
||||
k = nextspritestat[k];
|
||||
}
|
||||
|
||||
for (i=g_numInterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];
|
||||
for (i = g_animateCount-1; i>=0; i--)
|
||||
G_SetInterpolation(animateptr[i]);
|
||||
G_ResetInterpolations();
|
||||
|
||||
g_showShareware = 0;
|
||||
everyothertime = 0;
|
||||
|
@ -2258,47 +2265,7 @@ static void postloadplayer1()
|
|||
#endif
|
||||
|
||||
//5
|
||||
g_numInterpolations = 0;
|
||||
startofdynamicinterpolations = 0;
|
||||
|
||||
i = headspritestat[STAT_EFFECTOR];
|
||||
while (i >= 0)
|
||||
{
|
||||
switch (sprite[i].lotag)
|
||||
{
|
||||
case 31:
|
||||
G_SetInterpolation(§or[sprite[i].sectnum].floorz);
|
||||
break;
|
||||
case 32:
|
||||
G_SetInterpolation(§or[sprite[i].sectnum].ceilingz);
|
||||
break;
|
||||
case 25:
|
||||
G_SetInterpolation(§or[sprite[i].sectnum].floorz);
|
||||
G_SetInterpolation(§or[sprite[i].sectnum].ceilingz);
|
||||
break;
|
||||
case 17:
|
||||
G_SetInterpolation(§or[sprite[i].sectnum].floorz);
|
||||
G_SetInterpolation(§or[sprite[i].sectnum].ceilingz);
|
||||
break;
|
||||
case 0:
|
||||
case 5:
|
||||
case 6:
|
||||
case 11:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
case 26:
|
||||
case 30:
|
||||
Sect_SetInterpolation(sprite[i].sectnum);
|
||||
break;
|
||||
}
|
||||
|
||||
i = nextspritestat[i];
|
||||
}
|
||||
|
||||
for (i=g_numInterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];
|
||||
for (i = g_animateCount-1; i>=0; i--)
|
||||
G_SetInterpolation(animateptr[i]);
|
||||
G_ResetInterpolations();
|
||||
|
||||
//6
|
||||
g_showShareware = 0;
|
||||
|
|
Loading…
Reference in a new issue