Game: fix sprite jittering for SE31. Editor: copy relevant commandline switches to testplay_addparam on startup.

git-svn-id: https://svn.eduke32.com/eduke32@1081 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2008-09-28 21:48:31 +00:00
parent ca8f8d21ae
commit 0f0572ee69
2 changed files with 63 additions and 5 deletions

View file

@ -7231,6 +7231,10 @@ static void moveeffectors(void) //STATNUM 3
t[0] = 0; t[0] = 0;
t[3] = s->hitag; t[3] = s->hitag;
callsound(s->sectnum,i); callsound(s->sectnum,i);
for (j=headspritesect[s->sectnum]; j>=0; j=nextspritesect[j])
if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4)
hittype[j].bposz = sprite[j].z;
} }
else else
{ {
@ -7245,7 +7249,8 @@ static void moveeffectors(void) //STATNUM 3
g_player[sprite[j].yvel].ps->posz += l; g_player[sprite[j].yvel].ps->posz += l;
if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4)
{ {
hittype[j].bposz = sprite[j].z += l; hittype[j].bposz = sprite[j].z;
sprite[j].z += l;
hittype[j].floorz = sc->floorz; hittype[j].floorz = sc->floorz;
} }
j = nextspritesect[j]; j = nextspritesect[j];
@ -7261,6 +7266,11 @@ static void moveeffectors(void) //STATNUM 3
t[2] = 0; t[2] = 0;
t[0] = 0; t[0] = 0;
t[3] = s->hitag; t[3] = s->hitag;
for (j=headspritesect[s->sectnum]; j>=0; j=nextspritesect[j])
if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4)
hittype[j].bposz = sprite[j].z;
} }
else else
{ {
@ -7275,7 +7285,8 @@ static void moveeffectors(void) //STATNUM 3
g_player[sprite[j].yvel].ps->posz += l; g_player[sprite[j].yvel].ps->posz += l;
if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4)
{ {
hittype[j].bposz = sprite[j].z += l; hittype[j].bposz = sprite[j].z;
sprite[j].z += l;
hittype[j].floorz = sc->floorz; hittype[j].floorz = sc->floorz;
} }
j = nextspritesect[j]; j = nextspritesect[j];
@ -7293,6 +7304,11 @@ static void moveeffectors(void) //STATNUM 3
t[0] = 0; t[0] = 0;
t[2] = 1; t[2] = 1;
t[3] = s->hitag; t[3] = s->hitag;
for (j=headspritesect[s->sectnum]; j>=0; j=nextspritesect[j])
if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4)
hittype[j].bposz = sprite[j].z;
} }
else else
{ {
@ -7307,7 +7323,8 @@ static void moveeffectors(void) //STATNUM 3
g_player[sprite[j].yvel].ps->posz += l; g_player[sprite[j].yvel].ps->posz += l;
if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4)
{ {
hittype[j].bposz = sprite[j].z += l; hittype[j].bposz = sprite[j].z;
sprite[j].z += l;
hittype[j].floorz = sc->floorz; hittype[j].floorz = sc->floorz;
} }
j = nextspritesect[j]; j = nextspritesect[j];
@ -7322,6 +7339,10 @@ static void moveeffectors(void) //STATNUM 3
callsound(s->sectnum,i); callsound(s->sectnum,i);
t[2] = 1; t[2] = 1;
t[3] = s->hitag; t[3] = s->hitag;
for (j=headspritesect[s->sectnum]; j>=0; j=nextspritesect[j])
if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4)
hittype[j].bposz = sprite[j].z;
} }
else else
{ {
@ -7336,7 +7357,8 @@ static void moveeffectors(void) //STATNUM 3
g_player[sprite[j].yvel].ps->posz -= l; g_player[sprite[j].yvel].ps->posz -= l;
if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4)
{ {
hittype[j].bposz = sprite[j].z -= l; hittype[j].bposz = sprite[j].z;
sprite[j].z -= l;
hittype[j].floorz = sc->floorz; hittype[j].floorz = sc->floorz;
} }
j = nextspritesect[j]; j = nextspritesect[j];

View file

@ -7320,13 +7320,24 @@ static void addgroup(const char *buffer)
CommandGrps = s; CommandGrps = s;
} }
#define COPYARG(i) \
Bmemcpy(&testplay_addparam[j], argv[i], lengths[i]); \
j += lengths[i]; \
testplay_addparam[j++] = ' ';
static void checkcommandline(int argc, const char **argv) static void checkcommandline(int argc, const char **argv)
{ {
int i = 1; int i = 1, j, maxlen=0, *lengths;
char *c, *k; char *c, *k;
if (argc > 1) if (argc > 1)
{ {
lengths = Bmalloc(argc*sizeof(int));
for (j=1; j<argc; j++) maxlen += (lengths[j] = Bstrlen(argv[j]));
testplay_addparam = Bmalloc(maxlen+argc);
testplay_addparam[0] = 0;
j = 0;
while (i < argc) while (i < argc)
{ {
c = (char *)argv[i]; c = (char *)argv[i];
@ -7343,6 +7354,8 @@ static void checkcommandline(int argc, const char **argv)
if (argc > i+1) if (argc > i+1)
{ {
addgroup(argv[i+1]); addgroup(argv[i+1]);
COPYARG(i);
COPYARG(i+1);
i++; i++;
} }
i++; i++;
@ -7354,6 +7367,8 @@ static void checkcommandline(int argc, const char **argv)
if (argc > i+1) if (argc > i+1)
{ {
addgamepath(argv[i+1]); addgamepath(argv[i+1]);
COPYARG(i);
COPYARG(i+1);
i++; i++;
} }
i++; i++;
@ -7374,6 +7389,8 @@ static void checkcommandline(int argc, const char **argv)
if (argc > i+1) if (argc > i+1)
{ {
Bstrcpy(defaultduke3dgrp,argv[i+1]); Bstrcpy(defaultduke3dgrp,argv[i+1]);
COPYARG(i);
COPYARG(i+1);
i++; i++;
} }
i++; i++;
@ -7382,12 +7399,14 @@ static void checkcommandline(int argc, const char **argv)
if (!Bstrcasecmp(c+1,"nam")) if (!Bstrcasecmp(c+1,"nam"))
{ {
strcpy(duke3dgrp, "nam.grp"); strcpy(duke3dgrp, "nam.grp");
COPYARG(i);
i++; i++;
continue; continue;
} }
if (!Bstrcasecmp(c+1,"ww2gi")) if (!Bstrcasecmp(c+1,"ww2gi"))
{ {
strcpy(duke3dgrp, "ww2gi.grp"); strcpy(duke3dgrp, "ww2gi.grp");
COPYARG(i);
i++; i++;
continue; continue;
} }
@ -7402,6 +7421,7 @@ static void checkcommandline(int argc, const char **argv)
{ {
initprintf("Autoload disabled\n"); initprintf("Autoload disabled\n");
NoAutoLoad = 1; NoAutoLoad = 1;
COPYARG(i);
i++; i++;
continue; continue;
} }
@ -7409,6 +7429,7 @@ static void checkcommandline(int argc, const char **argv)
if (!Bstrcasecmp(c+1,"usecwd")) if (!Bstrcasecmp(c+1,"usecwd"))
{ {
usecwd = 1; usecwd = 1;
COPYARG(i);
i++; i++;
continue; continue;
} }
@ -7426,6 +7447,7 @@ static void checkcommandline(int argc, const char **argv)
if (*c) if (*c)
{ {
defsfilename = c; defsfilename = c;
COPYARG(i);
initprintf("Using DEF file: %s.\n",defsfilename); initprintf("Using DEF file: %s.\n",defsfilename);
} }
break; break;
@ -7434,12 +7456,14 @@ static void checkcommandline(int argc, const char **argv)
c++; c++;
if (!*c) break; if (!*c) break;
addgamepath(c); addgamepath(c);
COPYARG(i);
break; break;
case 'g': case 'g':
case 'G': case 'G':
c++; c++;
if (!*c) break; if (!*c) break;
addgroup(c); addgroup(c);
COPYARG(i);
break; break;
} }
} }
@ -7451,11 +7475,13 @@ static void checkcommandline(int argc, const char **argv)
if (!Bstrcasecmp(k,".grp") || !Bstrcasecmp(k,".zip")) if (!Bstrcasecmp(k,".grp") || !Bstrcasecmp(k,".zip"))
{ {
addgroup(argv[i++]); addgroup(argv[i++]);
COPYARG(i);
continue; continue;
} }
if (!Bstrcasecmp(k,".def")) if (!Bstrcasecmp(k,".def"))
{ {
defsfilename = (char *)argv[i++]; defsfilename = (char *)argv[i++];
COPYARG(i);
initprintf("Using DEF file: %s.\n",defsfilename); initprintf("Using DEF file: %s.\n",defsfilename);
continue; continue;
} }
@ -7463,8 +7489,18 @@ static void checkcommandline(int argc, const char **argv)
} }
i++; i++;
} }
Bfree(lengths);
if (j > 0)
{
testplay_addparam[j-1] = 0;
Brealloc(testplay_addparam, j*sizeof(char));
}
else
Bfree(testplay_addparam);
} }
} }
#undef COPYARG
int ExtPreInit(int argc,const char **argv) int ExtPreInit(int argc,const char **argv)
{ {