Minor things such as un-breaking setvarvar :)

git-svn-id: https://svn.eduke32.com/eduke32@431 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-12-19 20:31:40 +00:00
parent 31775358e6
commit 2705563578
4 changed files with 71 additions and 86 deletions

View file

@ -81,7 +81,7 @@ static double dxb1[MAXWALLSB], dxb2[MAXWALLSB];
#define USEZBUFFER 1 //1:use zbuffer (slow, nice sprite rendering), 0:no zbuffer (fast, bad sprite rendering) #define USEZBUFFER 1 //1:use zbuffer (slow, nice sprite rendering), 0:no zbuffer (fast, bad sprite rendering)
#define LINTERPSIZ 4 //log2 of interpolation size. 4:pretty fast&acceptable quality, 0:best quality/slow! #define LINTERPSIZ 4 //log2 of interpolation size. 4:pretty fast&acceptable quality, 0:best quality/slow!
#define DEPTHDEBUG 0 //1:render distance instead of texture, for debugging only!, 0:default #define DEPTHDEBUG 0 //1:render distance instead of texture, for debugging only!, 0:default
#define FOGSCALE 0.0000680 #define FOGSCALE 0.0000640
#define PI 3.14159265358979323 #define PI 3.14159265358979323
float shadescale = 1.050; float shadescale = 1.050;

View file

@ -2586,12 +2586,9 @@ static void moveweapons(void)
if (thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFSPRITES) if (thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFSPRITES)
{ {
if (wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR)
s->yvel--; s->yvel--;
k = getangle( k = getangle(sprite[j].x-s->x,sprite[j].y-s->y)+(sprite[j].cstat&16?0:512);
wall[wall[j].point2].x-wall[j].x,
wall[wall[j].point2].y-wall[j].y);
s->ang = ((k<<1) - s->ang)&2047; s->ang = ((k<<1) - s->ang)&2047;
if (thisprojectile[i].bsound > -1) if (thisprojectile[i].bsound > -1)

View file

@ -3612,6 +3612,8 @@ static void parseifelse(long condition)
// long *it = 0x00589a04; // long *it = 0x00589a04;
long instruction = 0;
static int parse(void) static int parse(void)
{ {
long j, l, s, tw; long j, l, s, tw;
@ -3624,6 +3626,8 @@ static int parse(void)
tw = *insptr; tw = *insptr;
instruction = tw;
switch (tw) switch (tw)
{ {
case CON_REDEFINEQUOTE: case CON_REDEFINEQUOTE:
@ -3975,16 +3979,12 @@ static int parse(void)
g_sp->yoffset = 0; g_sp->yoffset = 0;
// if(!gotz) // if(!gotz)
{ {
long c; j = gc;
if (floorspace(g_sp->sectnum))
c = 0;
else
{
if (ceilingspace(g_sp->sectnum) || sector[g_sp->sectnum].lotag == 2) if (ceilingspace(g_sp->sectnum) || sector[g_sp->sectnum].lotag == 2)
c = gc/6; j = gc/6;
else c = gc; else if (floorspace(g_sp->sectnum))
} j = 0;
if (hittype[g_i].cgg <= 0 || (sector[g_sp->sectnum].floorstat&2)) if (hittype[g_i].cgg <= 0 || (sector[g_sp->sectnum].floorstat&2))
{ {
@ -3995,7 +3995,7 @@ static int parse(void)
if (g_sp->z < (hittype[g_i].floorz-FOURSLEIGHT)) if (g_sp->z < (hittype[g_i].floorz-FOURSLEIGHT))
{ {
g_sp->zvel += c; g_sp->zvel += j;
g_sp->z+=g_sp->zvel; g_sp->z+=g_sp->zvel;
if (g_sp->zvel > 6144) g_sp->zvel = 6144; if (g_sp->zvel > 6144) g_sp->zvel = 6144;
@ -4006,19 +4006,17 @@ static int parse(void)
if (badguy(g_sp) || (g_sp->picnum == APLAYER && g_sp->owner >= 0)) if (badguy(g_sp) || (g_sp->picnum == APLAYER && g_sp->owner >= 0))
{ {
if (g_sp->zvel > 3084 && g_sp->extra <= 1) if (g_sp->zvel > 3084 && g_sp->extra <= 1)
{ {
if (g_sp->pal != 1 && g_sp->picnum != DRONE) if (g_sp->pal != 1 && g_sp->picnum != DRONE)
{ {
if (g_sp->picnum == APLAYER && g_sp->extra > 0) if (!(g_sp->picnum == APLAYER && g_sp->extra > 0))
goto SKIPJIBS; {
guts(g_sp,JIBS6,15,g_p); guts(g_sp,JIBS6,15,g_p);
spritesound(SQUISHED,g_i); spritesound(SQUISHED,g_i);
spawn(g_i,BLOODPOOL); spawn(g_i,BLOODPOOL);
} }
}
SKIPJIBS:
hittype[g_i].picnum = SHOTSPARK1; hittype[g_i].picnum = SHOTSPARK1;
hittype[g_i].extra = 1; hittype[g_i].extra = 1;
@ -4026,7 +4024,6 @@ SKIPJIBS:
} }
else if (g_sp->zvel > 2048 && sector[g_sp->sectnum].lotag != 1) else if (g_sp->zvel > 2048 && sector[g_sp->sectnum].lotag != 1)
{ {
j = g_sp->sectnum; j = g_sp->sectnum;
pushmove(&g_sp->x,&g_sp->y,&g_sp->z,(short*)&j,128L,(4L<<8),(4L<<8),CLIPMASK0); pushmove(&g_sp->x,&g_sp->y,&g_sp->z,(short*)&j,128L,(4L<<8),(4L<<8),CLIPMASK0);
if (j != g_sp->sectnum && j >= 0 && j < MAXSECTORS) if (j != g_sp->sectnum && j >= 0 && j < MAXSECTORS)
@ -4583,43 +4580,39 @@ SKIPJIBS:
case CON_INITTIMER: case CON_INITTIMER:
insptr++; insptr++;
{ j = GetGameVarID(*insptr++, g_i, g_p);
int i = GetGameVarID(*insptr++, g_i, g_p); if (timer != j)
if (timer != i)
{ {
uninittimer(); uninittimer();
inittimer(i); inittimer(j);
timer = i; timer = j;
} }
break; break;
}
case CON_TIME: case CON_TIME:
{
insptr += 2; insptr += 2;
break; break;
}
case CON_ESPAWNVAR: case CON_ESPAWNVAR:
case CON_EQSPAWNVAR: case CON_EQSPAWNVAR:
case CON_QSPAWNVAR: case CON_QSPAWNVAR:
insptr++; insptr++;
{ {
int lIn=GetGameVarID(*insptr++, g_i, g_p), lReturn=-1; int lIn=GetGameVarID(*insptr++, g_i, g_p);
j = -1;
if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS)
lReturn = spawn(g_i, lIn); j = spawn(g_i, lIn);
switch (tw) switch (tw)
{ {
case CON_EQSPAWNVAR: case CON_EQSPAWNVAR:
if (lReturn != -1) if (j != -1)
insertspriteq(lReturn); insertspriteq(j);
case CON_ESPAWNVAR: case CON_ESPAWNVAR:
SetGameVarID(g_iReturnVarID, lReturn, g_i, g_p); SetGameVarID(g_iReturnVarID, j, g_i, g_p);
break; break;
case CON_QSPAWNVAR: case CON_QSPAWNVAR:
if (lReturn != -1) if (j != -1)
insertspriteq(lReturn); insertspriteq(j);
break; break;
} }
break; break;
@ -4628,34 +4621,32 @@ SKIPJIBS:
case CON_ESPAWN: case CON_ESPAWN:
case CON_EQSPAWN: case CON_EQSPAWN:
case CON_QSPAWN: case CON_QSPAWN:
{
long lReturn=-1;
insptr++; insptr++;
j=-1;
if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS)
lReturn = spawn(g_i,*insptr++); j = spawn(g_i,*insptr++);
else insptr++; else insptr++;
switch (tw) switch (tw)
{ {
case CON_EQSPAWN: case CON_EQSPAWN:
if (lReturn != -1) if (j != -1)
insertspriteq(lReturn); insertspriteq(j);
case CON_ESPAWN: case CON_ESPAWN:
SetGameVarID(g_iReturnVarID, lReturn, g_i, g_p); SetGameVarID(g_iReturnVarID, j, g_i, g_p);
break; break;
case CON_QSPAWN: case CON_QSPAWN:
if (lReturn != -1) if (j != -1)
insertspriteq(lReturn); insertspriteq(j);
break; break;
} }
break; break;
}
case CON_ESHOOT: case CON_ESHOOT:
case CON_EZSHOOT: case CON_EZSHOOT:
case CON_ZSHOOT: case CON_ZSHOOT:
{
insptr++; insptr++;
if (tw == CON_ZSHOOT || tw == CON_EZSHOOT) if (tw == CON_ZSHOOT || tw == CON_EZSHOOT)
@ -4674,7 +4665,6 @@ SKIPJIBS:
hittype[g_i].temp_data[9]=0; hittype[g_i].temp_data[9]=0;
break; break;
}
case CON_SHOOTVAR: case CON_SHOOTVAR:
case CON_ESHOOTVAR: case CON_ESHOOTVAR:
@ -4707,28 +4697,26 @@ SKIPJIBS:
case CON_SOUNDONCEVAR: case CON_SOUNDONCEVAR:
case CON_GLOBALSOUNDVAR: case CON_GLOBALSOUNDVAR:
insptr++; insptr++;
{ j=GetGameVarID(*insptr++, g_i, g_p);
int sound=GetGameVarID(*insptr++, g_i, g_p);
switch (tw) switch (tw)
{ {
case CON_SOUNDONCEVAR: case CON_SOUNDONCEVAR:
if (!isspritemakingsound(g_i,sound)) if (!isspritemakingsound(g_i,j))
spritesound((short)sound,g_i); spritesound((short)j,g_i);
break; break;
case CON_GLOBALSOUNDVAR: case CON_GLOBALSOUNDVAR:
spritesound((short)sound,ps[screenpeek].i); spritesound((short)j,ps[screenpeek].i);
break; break;
case CON_STOPSOUNDVAR: case CON_STOPSOUNDVAR:
if (isspritemakingsound(g_i,sound)) if (isspritemakingsound(g_i,j))
stopspritesound((short)sound,g_i); stopspritesound((short)j,g_i);
break; break;
case CON_SOUNDVAR: case CON_SOUNDVAR:
spritesound((short)sound,g_i); spritesound((short)j,g_i);
break; break;
} }
break; break;
}
case CON_GUNIQHUDID: case CON_GUNIQHUDID:
insptr++; insptr++;
@ -5037,23 +5025,22 @@ SKIPJIBS:
break; break;
case CON_SAVE: case CON_SAVE:
insptr++;
{ {
int i;
time_t curtime; time_t curtime;
insptr++; lastsavedpos = *insptr++;
i = *insptr++;
if (movesperpacket == 4 && connecthead != myconnectindex) if ((movesperpacket == 4 && connecthead != myconnectindex) || lastsavedpos > 9)
break; break;
lastsavedpos = i;
curtime = time(NULL); curtime = time(NULL);
Bstrcpy(tempbuf,asctime(localtime(&curtime))); Bstrcpy(tempbuf,asctime(localtime(&curtime)));
clearbuf(ud.savegame[lastsavedpos],sizeof(ud.savegame[lastsavedpos]),0); clearbuf(ud.savegame[lastsavedpos],sizeof(ud.savegame[lastsavedpos]),0);
Bsprintf(ud.savegame[lastsavedpos],"Auto"); Bsprintf(ud.savegame[lastsavedpos],"Auto");
for (i=0;i<13;i++) for (j=0;j<13;j++)
Bmemcpy(&ud.savegame[lastsavedpos][i+4],&tempbuf[i+3],sizeof(tempbuf[i+3])); Bmemcpy(&ud.savegame[lastsavedpos][j+4],&tempbuf[j+3],sizeof(tempbuf[j+3]));
ud.savegame[lastsavedpos][i+4] = '\0'; ud.savegame[lastsavedpos][j+4] = '\0';
OSD_Printf("Saving to slot %d\n",lastsavedpos); OSD_Printf("Saving to slot %d\n",lastsavedpos);
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
@ -5463,15 +5450,16 @@ SKIPJIBS:
{ {
m = -1; m = -1;
lVarID ^= (MAXGAMEVARS<<1); lVarID ^= (MAXGAMEVARS<<1);
goto good;
} }
else
{
// invalid varID // invalid varID
insptr++; insptr++;
Bsprintf(g_szBuf,"CONLOGVAR: L=%ld INVALID VARIABLE",l); Bsprintf(g_szBuf,"CONLOGVAR: L=%ld INVALID VARIABLE",l);
AddLog(g_szBuf); AddLog(g_szBuf);
break; // out of switch break; // out of switch
} }
good: }
Bsprintf(szBuf,"CONLOGVAR: L=%ld %s ",l, aGameVars[lVarID].szLabel); Bsprintf(szBuf,"CONLOGVAR: L=%ld %s ",l, aGameVars[lVarID].szLabel);
strcpy(g_szBuf,szBuf); strcpy(g_szBuf,szBuf);
@ -5900,12 +5888,6 @@ good:
insptr += 2; insptr += 2;
break; break;
case CON_SETVARVAR:
insptr++;
SetGameVarID(*insptr, GetGameVarID(*(insptr+1), g_i, g_p), g_i, g_p);
insptr += 2;
break;
case CON_RANDVAR: case CON_RANDVAR:
insptr++; insptr++;
SetGameVarID(*insptr, mulscale(krand(), *(insptr+1)+1, 16), g_i, g_p); SetGameVarID(*insptr, mulscale(krand(), *(insptr+1)+1, 16), g_i, g_p);
@ -5958,6 +5940,12 @@ good:
insptr += 2; insptr += 2;
break; break;
case CON_SETVARVAR:
insptr++;
j=*insptr++;
SetGameVarID(j, GetGameVarID(*insptr++, g_i, g_p), g_i, g_p);
break;
case CON_RANDVARVAR: case CON_RANDVARVAR:
insptr++; insptr++;
j=*insptr++; j=*insptr++;

View file

@ -423,7 +423,7 @@ long GetGameVarID(int id, short sActor, short sPlayer)
if (id==MAXGAMEVARS) if (id==MAXGAMEVARS)
return(*insptr++); return(*insptr++);
if (!id&(MAXGAMEVARS<<1)) if (!(id&(MAXGAMEVARS<<1)))
{ {
AddLog("GetGameVarID: Invalid Game ID"); AddLog("GetGameVarID: Invalid Game ID");
return -1; return -1;