diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index 95e2505c9..81aa64436 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -334,7 +334,8 @@ extern char forcegl; #define gametextpal(x,y,t,s,p) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536) #define gametextpalbits(x,y,t,s,p,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,dabits,0, 0, xdim-1, ydim-1, 65536) #define A_CheckSpriteFlags(iActor, iType) (((SpriteFlags[sprite[iActor].picnum]^actor[iActor].flags) & iType) != 0) -#define A_CheckSpriteTileFlags(iPicnum, iType) ((SpriteFlags[iPicnum] & iType) != 0) +// (unsigned)iPicnum check: AMC TC Rusty Nails, bayonet MG alt. fire, iPicnum == -1 (via aplWeaponShoots) +#define A_CheckSpriteTileFlags(iPicnum, iType) (((unsigned)iPicnum < MAXTILES) && (SpriteFlags[iPicnum] & iType) != 0) #define G_EnterText(x, y, t, dalen, c) _EnterText(0,x,y,t,dalen,c) #define Net_EnterText(x, y, t, dalen, c) _EnterText(1,x,y,t,dalen,c) #define S_StopSound(num) S_StopEnvSound(num, -1) diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 2accf45a1..55298f29f 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -932,6 +932,8 @@ void Gv_ResetSystemDefaults(void) aplWeaponFlags[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); Bsprintf(aszBuf,"WEAPON%d_SHOOTS",i); aplWeaponShoots[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); + if ((unsigned)aplWeaponShoots[i][j] >= MAXTILES) + aplWeaponShoots[i][j] = 0; Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",i); aplWeaponSpawnTime[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); Bsprintf(aszBuf,"WEAPON%d_SPAWN",i); diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 7c206694b..8df47203c 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -346,26 +346,27 @@ int32_t A_Shoot(int32_t i,int32_t atwith) } #ifdef POLYMER - switch (DynamicTileMap[atwith]) - { - case FIRELASER__STATIC: - case SHOTGUN__STATIC: - case SHOTSPARK1__STATIC: - case CHAINGUN__STATIC: - case RPG__STATIC: - case MORTER__STATIC: - { - int32_t x = ((sintable[(s->ang+512)&2047])>>7), y = ((sintable[(s->ang)&2047])>>7); - s-> x += x; - s-> y += y; - G_AddGameLight(0, i, PHEIGHT, 8192, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); - actor[i].lightcount = 2; - s-> x -= x; - s-> y -= y; - } + if (atwith >= 0) + switch (DynamicTileMap[atwith]) + { + case FIRELASER__STATIC: + case SHOTGUN__STATIC: + case SHOTSPARK1__STATIC: + case CHAINGUN__STATIC: + case RPG__STATIC: + case MORTER__STATIC: + { + int32_t x = ((sintable[(s->ang+512)&2047])>>7), y = ((sintable[(s->ang)&2047])>>7); + s-> x += x; + s-> y += y; + G_AddGameLight(0, i, PHEIGHT, 8192, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); + actor[i].lightcount = 2; + s-> x -= x; + s-> y -= y; + } - break; - } + break; + } #endif // POLYMER } @@ -1044,7 +1045,7 @@ DOSKIPBULLETHOLE: } } - else + else if (atwith >= 0) { switch (DynamicTileMap[atwith]) {