diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 8c0ca0d70..b02cf2527 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -1095,7 +1095,7 @@ ACTOR_STATIC void G_MovePlayers(void) otherx = 0; } - if (g_tile[sprite[i].picnum].execPtr) + if (G_HaveActor(sprite[i].picnum)) A_Execute(i,s->yvel,otherx); if (g_netServer || ud.multimode > 1) @@ -2386,7 +2386,7 @@ CLEAR_THE_BOLT: case STEAM__STATIC: case CEILINGSTEAM__STATIC: case WATERBUBBLEMAKER__STATIC: - if (!g_tile[sprite[i].picnum].execPtr) + if (!G_HaveActor(sprite[i].picnum)) goto BOLT; { int32_t p = A_FindPlayer(s, &x); @@ -2772,7 +2772,7 @@ ACTOR_STATIC void G_MoveWeapons(void) if (proj->workslike & PROJECTILE_HITSCAN) { - if (!g_tile[sprite[i].picnum].execPtr) + if (!G_HaveActor(sprite[i].picnum)) goto BOLT; { int32_t p = A_FindPlayer(s,&x); @@ -3092,7 +3092,7 @@ COOLEXPLOSION: goto BOLT; case SHOTSPARK1__STATIC: - if (!g_tile[sprite[i].picnum].execPtr) + if (!G_HaveActor(sprite[i].picnum)) goto BOLT; { int32_t p = A_FindPlayer(s,&x); @@ -4844,7 +4844,7 @@ DETONATEB: } } - if (!g_tile[sprite[i].picnum].execPtr) + if (!G_HaveActor(sprite[i].picnum)) goto BOLT; { int32_t p = A_FindPlayer(s,&x); @@ -5285,7 +5285,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 case TRANSPORTERSTAR__STATIC: case TRANSPORTERBEAM__STATIC: { - if (!g_tile[sprite[i].picnum].execPtr) + if (!G_HaveActor(sprite[i].picnum)) goto BOLT; { int32_t p = A_FindPlayer(s,&x); diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index c81662135..29b6d1f8e 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -145,6 +145,24 @@ static inline int32_t G_HaveEvent(int32_t iEventID) apScriptGameEvent[iEventID]!=NULL; } +static inline int32_t G_HaveActor(int32_t actortile) +{ + return +#ifdef LUNATIC + El_HaveActor(actortile) || +#endif + g_tile[actortile].execPtr!=NULL; +} + +static inline int32_t G_InitialActorStrength(int32_t actortile) +{ +#ifdef LUNATIC_ONLY + return g_elActors[actortile].strength; +#else + return g_tile[actortile].execPtr[0]; +#endif +} + #ifdef EXTERNC } #endif diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 953471d13..4162b7632 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -4218,7 +4218,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) else switch (DYNAMICTILEMAP(sp->picnum)) { default: - if (g_tile[sp->picnum].execPtr) + if (G_HaveActor(sp->picnum)) { if (j == -1 && sp->lotag > ud.player_skill) { @@ -6744,7 +6744,7 @@ PALONLY: break; } - if (g_tile[s->picnum].execPtr) + if (G_HaveActor(s->picnum)) { /* if (ud.angleinterpolation) diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 222ceb5dc..c993fedac 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -882,7 +882,7 @@ static void VM_Fall(void) #endif if ((vm.g_sp->hitag & jumptoplayer) || - (g_tile[vm.g_sp->picnum].execPtr && + (G_HaveActor(vm.g_sp->picnum) && #ifndef LUNATIC (unsigned)moveScriptOfs < (unsigned)g_scriptSize-1 && script[moveScriptOfs + 1] #else diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index e6ee53b61..d2558c3ce 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -1288,7 +1288,7 @@ DOSKIPBULLETHOLE: if (p >= 0) { k = A_InsertSprite(hit.sect,hit.pos.x,hit.pos.y,hit.pos.z,SHOTSPARK1,-15,10,10,sa,0,0,i,4); - sprite[k].extra = *g_tile[atwith].execPtr; + sprite[k].extra = G_InitialActorStrength(atwith); sprite[k].extra += (krand()%6); sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1 A_SetHitData(k, &hit); @@ -1408,7 +1408,7 @@ SKIPBULLETHOLE: else { k = A_InsertSprite(hit.sect,hit.pos.x,hit.pos.y,hit.pos.z,SHOTSPARK1,-15,24,24,sa,0,0,i,4); - sprite[k].extra = *g_tile[atwith].execPtr; + sprite[k].extra = G_InitialActorStrength(atwith); sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1 A_SetHitData(k, &hit); @@ -3756,9 +3756,9 @@ void P_FragPlayer(int32_t snum) void P_ProcessWeapon(int32_t snum) { - DukePlayer_t *p = g_player[snum].ps; - uint8_t *kb = &p->kickback_pic; - int32_t shrunk = (sprite[p->i].yrepeat < 32); + DukePlayer_t *const p = g_player[snum].ps; + uint8_t *const kb = &p->kickback_pic; + const int32_t shrunk = (sprite[p->i].yrepeat < 32); uint32_t sb_snum = g_player[snum].sync->bits; int32_t i, j, k; @@ -4390,7 +4390,7 @@ void P_ProcessInput(int32_t snum) int32_t j, i, k, doubvel = TICSPERFRAME, shrunk; int32_t fz, cz, hz, lz, truefdist, x, y, psectlotag; - uint8_t *kb = &p->kickback_pic; + const uint8_t *const kb = &p->kickback_pic; int16_t tempsect; if (g_player[snum].playerquitflag == 0) diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index 00177d227..7c162bf79 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -2092,7 +2092,7 @@ void A_DamageObject(int32_t i,int32_t sn) case FUELPOD__STATIC: case SOLARPANNEL__STATIC: case ANTENNA__STATIC: - if (sprite[sn].extra != *g_tile[SHOTSPARK1].execPtr) + if (sprite[sn].extra != G_InitialActorStrength(SHOTSPARK1)) { for (j=15; j>0; j--) A_InsertSprite(SECT,SX,SY,sector[SECT].floorz-(12<<8)-(j<<9),SCRAP1+(krand()&15),-8,64,64,