More fixes

git-svn-id: https://svn.eduke32.com/eduke32@960 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-08-10 10:53:55 +00:00
parent cf4e3930d5
commit a71949ed8f
2 changed files with 55 additions and 60 deletions

View file

@ -5334,10 +5334,11 @@ static int parse(void)
st = GetGameVarID(*insptr++, g_i, g_p); st = GetGameVarID(*insptr++, g_i, g_p);
ln = GetGameVarID(*insptr++, g_i, g_p); ln = GetGameVarID(*insptr++, g_i, g_p);
if (q1<0 || q1>=MAXQUOTES) OSD_Printf(CON_ERROR "CON_QSUBSTR: invalid quote ID %d\n",line_num,q1);else if (q1<0 || q1>=MAXQUOTES) OSD_Printf(CON_ERROR "CON_QSUBSTR: invalid quote ID %d\n",line_num,q1);
if (fta_quotes[q1] != NULL) OSD_Printf(CON_ERROR "CON_QSUBSTR: null quote %d\n",line_num,q1);else else if (fta_quotes[q1] == NULL) OSD_Printf(CON_ERROR "CON_QSUBSTR: null quote %d\n",line_num,q1);
if (q2<0 || q2>=MAXQUOTES) OSD_Printf(CON_ERROR "CON_QSUBSTR: invalid quote ID %d\n",line_num,q2);else else if (q2<0 || q2>=MAXQUOTES) OSD_Printf(CON_ERROR "CON_QSUBSTR: invalid quote ID %d\n",line_num,q2);
if (fta_quotes[q2] != NULL) OSD_Printf(CON_ERROR "CON_QSUBSTR: null quote %d\n",line_num,q2);else else if (fta_quotes[q2] == NULL) OSD_Printf(CON_ERROR "CON_QSUBSTR: null quote %d\n",line_num,q2);
else
{ {
s1=fta_quotes[q1]; s1=fta_quotes[q1];
s2=fta_quotes[q2]; s2=fta_quotes[q2];
@ -5367,16 +5368,21 @@ static int parse(void)
switch (tw) switch (tw)
{ {
case CON_GETPNAME: case CON_GETPNAME:
if (fta_quotes[i] != NULL) if (fta_quotes[i] == NULL)
{ {
OSD_Printf(CON_ERROR "CON_GETPNAME: null quote %d\n",line_num,i);
break;
}
if (g_player[j].user_name[0]) if (g_player[j].user_name[0])
Bstrcpy(fta_quotes[i],g_player[j].user_name); Bstrcpy(fta_quotes[i],g_player[j].user_name);
else Bsprintf(fta_quotes[i],"%d",j); else Bsprintf(fta_quotes[i],"%d",j);
}
else OSD_Printf(CON_ERROR "CON_GETPNAME: null quote %d\n",line_num,i);
break; break;
case CON_QGETSYSSTR: case CON_QGETSYSSTR:
if (fta_quotes[i] != NULL) if (fta_quotes[i] == NULL)
{
OSD_Printf(CON_ERROR "CON_QGETSYSSTR: null quote %d %d\n",line_num,i,j);
break;
}
switch (j) switch (j)
{ {
case STR_MAPNAME: case STR_MAPNAME:
@ -5397,17 +5403,22 @@ static int parse(void)
default: default:
OSD_Printf(CON_ERROR "CON_QGETSYSSTR: unknown str ID %d %d\n",line_num,i,j); OSD_Printf(CON_ERROR "CON_QGETSYSSTR: unknown str ID %d %d\n",line_num,i,j);
} }
else OSD_Printf(CON_ERROR "CON_QGETSYSSTR: null quote %d %d\n",line_num,i,j);
break; break;
case CON_QSTRCAT: case CON_QSTRCAT:
if (fta_quotes[i] != NULL && fta_quotes[j] != NULL) if (fta_quotes[i] == NULL || fta_quotes[j] == NULL)
{
OSD_Printf(CON_ERROR "CON_QSTRCAT: null quote %d\n",line_num,fta_quotes[i] ? j : i);
break;
}
Bstrncat(fta_quotes[i],fta_quotes[j],(MAXQUOTELEN-1)-Bstrlen(fta_quotes[i])); Bstrncat(fta_quotes[i],fta_quotes[j],(MAXQUOTELEN-1)-Bstrlen(fta_quotes[i]));
else OSD_Printf(CON_ERROR "CON_QSTRCAT: null quote %d %d\n",line_num,i,j);
break; break;
case CON_QSTRCPY: case CON_QSTRCPY:
if (fta_quotes[i] != NULL && fta_quotes[j] != NULL) if (fta_quotes[i] == NULL || fta_quotes[j] == NULL)
{
OSD_Printf(CON_ERROR "CON_QSTRCAT: null quote %d\n",line_num,fta_quotes[i] ? j : i);
break;
}
Bstrcpy(fta_quotes[i],fta_quotes[j]); Bstrcpy(fta_quotes[i],fta_quotes[j]);
else OSD_Printf(CON_ERROR "CON_QSTRCPY: null quote %d %d\n",line_num,i,j);
break; break;
case CON_CHANGESPRITESTAT: case CON_CHANGESPRITESTAT:
if (i<0 || i>=MAXSPRITES) {OSD_Printf(CON_ERROR "CON_CHANGESPRITESTAT: Invalid sprite %d\n",line_num,i);break;} if (i<0 || i>=MAXSPRITES) {OSD_Printf(CON_ERROR "CON_CHANGESPRITESTAT: Invalid sprite %d\n",line_num,i);break;}
@ -6090,28 +6101,6 @@ static int parse(void)
break; break;
} }
case CON_GETTIMEDATE:
insptr++;
{
int v1=*insptr++,v2=*insptr++,v3=*insptr++,v4=*insptr++,v5=*insptr++,v6=*insptr++,v7=*insptr++,v8=*insptr++;
time_t rawtime;
struct tm * ti;
time(&rawtime);
ti=localtime(&rawtime);
// initprintf("Time&date: %s\n",asctime (ti));
SetGameVarID(v1, ti->tm_sec, g_i, g_p);
SetGameVarID(v2, ti->tm_min, g_i, g_p);
SetGameVarID(v3, ti->tm_hour, g_i, g_p);
SetGameVarID(v4, ti->tm_mday, g_i, g_p);
SetGameVarID(v5, ti->tm_mon, g_i, g_p);
SetGameVarID(v6, ti->tm_year+1900, g_i, g_p);
SetGameVarID(v7, ti->tm_wday, g_i, g_p);
SetGameVarID(v8, ti->tm_yday, g_i, g_p);
break;
}
case CON_MOVESPRITE: case CON_MOVESPRITE:
case CON_SETSPRITE: case CON_SETSPRITE:
insptr++; insptr++;
@ -6695,7 +6684,7 @@ static int parse(void)
int dq = *insptr++, sq = *insptr++; int dq = *insptr++, sq = *insptr++;
if (fta_quotes[sq] == NULL || fta_quotes[dq] == NULL) if (fta_quotes[sq] == NULL || fta_quotes[dq] == NULL)
{ {
OSD_Printf(CON_ERROR "CON_QSPRINTF: null quote %d\n",line_num,sq ? dq : sq); OSD_Printf(CON_ERROR "CON_QSPRINTF: null quote %d\n",line_num,fta_quotes[sq] ? dq : sq);
insptr += 4; insptr += 4;
break; break;
} }

View file

@ -908,6 +908,8 @@ DOSKIPBULLETHOLE:
sa = getangle(g_player[j].ps->oposx-sx,g_player[j].ps->oposy-sy); sa = getangle(g_player[j].ps->oposx-sx,g_player[j].ps->oposy-sy);
l = ldist(&sprite[g_player[j].ps->i],s); l = ldist(&sprite[g_player[j].ps->i],s);
if (l == 0)
l++;
zvel = ((g_player[j].ps->oposz-sz)*vel) / l; zvel = ((g_player[j].ps->oposz-sz)*vel) / l;
if (badguy(s) && (s->hitag&face_player_smart)) if (badguy(s) && (s->hitag&face_player_smart))
@ -1555,6 +1557,8 @@ SKIPBULLETHOLE:
} }
l = ldist(&sprite[g_player[j].ps->i],s); l = ldist(&sprite[g_player[j].ps->i],s);
if (l == 0)
l++;
zvel = ((g_player[j].ps->oposz-sz)*vel) / l; zvel = ((g_player[j].ps->oposz-sz)*vel) / l;
if (badguy(s) && (s->hitag&face_player_smart)) if (badguy(s) && (s->hitag&face_player_smart))
@ -1844,6 +1848,8 @@ SKIPBULLETHOLE:
{ {
j = findplayer(s,&x); j = findplayer(s,&x);
l = ldist(&sprite[g_player[j].ps->i],s); l = ldist(&sprite[g_player[j].ps->i],s);
if (l == 0)
l++;
zvel = ((g_player[j].ps->oposz-sz)*512) / l ; zvel = ((g_player[j].ps->oposz-sz)*512) / l ;
} }
else zvel = 0; else zvel = 0;