- replaced a bit more.

This commit is contained in:
Christoph Oelckers 2020-10-23 22:06:02 +02:00
parent 2c573a720b
commit 3ea6887c43
2 changed files with 49 additions and 45 deletions

View file

@ -1064,7 +1064,8 @@ int haskey(int sect, int snum)
void shootbloodsplat(int i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST) void shootbloodsplat(int i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST)
{ {
spritetype* const s = &sprite[i]; auto actor = &hittype[i];
spritetype* const s = &actor->s;
int sect = s->sectnum; int sect = s->sectnum;
int zvel; int zvel;
short hitsect, hitspr, hitwall, k; short hitsect, hitspr, hitwall, k;
@ -1109,17 +1110,17 @@ void shootbloodsplat(int i, int p, int sx, int sy, int sz, int sa, int atwith, i
if (wall[hitwall].hitag == 0) if (wall[hitwall].hitag == 0)
{ {
k = fi.spawn(i, atwith); auto spawned = spawn(actor, atwith);
sprite[k].xvel = -12; spawned->s.xvel = -12;
sprite[k].ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) + 512; spawned->s.ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) + 512;
sprite[k].x = hitx; spawned->s.x = hitx;
sprite[k].y = hity; spawned->s.y = hity;
sprite[k].z = hitz; spawned->s.z = hitz;
sprite[k].cstat |= (krand() & 4); spawned->s.cstat |= (krand() & 4);
ssp(k, CLIPMASK0); ssp(k, CLIPMASK0);
setsprite(k, sprite[k].x, sprite[k].y, sprite[k].z); setsprite(spawned, spawned->s.pos);
if (s->picnum == OOZFILTER || s->picnum == NEWBEAST) if (s->picnum == OOZFILTER || s->picnum == NEWBEAST)
sprite[k].pal = 6; spawned->s.pal = 6;
} }
} }
} }

View file

@ -296,13 +296,13 @@ static void shootknee(int i, int p, int sx, int sy, int sz, int sa)
} }
else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1)
{ {
j = fi.spawn(ps[p].i, WATERSPLASH2); auto splash = spawn(ps[p].GetActor(), WATERSPLASH2);
sprite[j].x = hitx; splash->s.x = hitx;
sprite[j].y = hity; splash->s.y = hity;
sprite[j].ang = ps[p].angle.ang.asbuild(); // Total tweek splash->s.ang = ps[p].angle.ang.asbuild(); // Total tweek
sprite[j].xvel = 32; splash->s.xvel = 32;
ssp(i, CLIPMASK0); ssp(i, CLIPMASK0);
sprite[j].xvel = 0; splash->s.xvel = 0;
} }
} }
@ -407,16 +407,19 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
zvel << 6, &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1); zvel << 6, &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
s->cstat |= 257; s->cstat |= 257;
if (hitsect < 0) return; if (hitsect < 0) return;
auto hitact = &hittype[hitspr];
if ((krand() & 15) == 0 && sector[hitsect].lotag == 2) if ((krand() & 15) == 0 && sector[hitsect].lotag == 2)
tracers(hitx, hity, hitz, sx, sy, sz, 8 - (ud.multimode >> 1)); tracers(hitx, hity, hitz, sx, sy, sz, 8 - (ud.multimode >> 1));
if (p >= 0) if (p >= 0)
{ {
k = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 10, 10, sa, 0, 0, i, 4); const char* k;
sprite[k].extra = ScriptCode[actorinfo[atwith].scriptaddress]; auto spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 10, 10, sa, 0, 0, &hittype[i], 4);
sprite[k].extra += (krand() % 6); spark->s.extra = ScriptCode[actorinfo[atwith].scriptaddress];
spark->s.extra += (krand() % 6);
if (hitwall == -1 && hitspr == -1) if (hitwall == -1 && hitspr == -1)
{ {
@ -424,39 +427,39 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
{ {
if (sector[hitsect].ceilingstat & 1) if (sector[hitsect].ceilingstat & 1)
{ {
sprite[k].xrepeat = 0; spark->s.xrepeat = 0;
sprite[k].yrepeat = 0; spark->s.yrepeat = 0;
return; return;
} }
else else
fi.checkhitceiling(hitsect); fi.checkhitceiling(hitsect);
} }
fi.spawn(k, SMALLSMOKE); spawn(spark, SMALLSMOKE);
} }
if (hitspr >= 0) if (hitspr >= 0)
{ {
fi.checkhitsprite(hitspr, k); fi.checkhitsprite(hitspr, spark->GetIndex());
if (sprite[hitspr].picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1)) if (sprite[hitspr].picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1))
{ {
l = fi.spawn(k, JIBS6); auto jib = spawn(spark, JIBS6);
sprite[k].xrepeat = sprite[k].yrepeat = 0; spark->s.xrepeat = spark->s.yrepeat = 0;
sprite[l].z += (4 << 8); jib->s.z += (4 << 8);
sprite[l].xvel = 16; jib->s.xvel = 16;
sprite[l].xrepeat = sprite[l].yrepeat = 24; jib->s.xrepeat = jib->s.yrepeat = 24;
sprite[l].ang += 64 - (krand() & 127); jib->s.ang += 64 - (krand() & 127);
} }
else fi.spawn(k, SMALLSMOKE); else spawn(spark, SMALLSMOKE);
if (p >= 0 && ( if (p >= 0 && (
sprite[hitspr].picnum == DIPSWITCH || hitact->s.picnum == DIPSWITCH ||
sprite[hitspr].picnum == DIPSWITCH + 1 || hitact->s.picnum == DIPSWITCH + 1 ||
sprite[hitspr].picnum == DIPSWITCH2 || hitact->s.picnum == DIPSWITCH2 ||
sprite[hitspr].picnum == DIPSWITCH2 + 1 || hitact->s.picnum == DIPSWITCH2 + 1 ||
sprite[hitspr].picnum == DIPSWITCH3 || hitact->s.picnum == DIPSWITCH3 ||
sprite[hitspr].picnum == DIPSWITCH3 + 1 || hitact->s.picnum == DIPSWITCH3 + 1 ||
sprite[hitspr].picnum == HANDSWITCH || hitact->s.picnum == HANDSWITCH ||
sprite[hitspr].picnum == HANDSWITCH + 1)) hitact->s.picnum == HANDSWITCH + 1))
{ {
fi.checkhitswitch(p, hitspr, 1); fi.checkhitswitch(p, hitspr, 1);
return; return;
@ -464,7 +467,7 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
} }
else if (hitwall >= 0) else if (hitwall >= 0)
{ {
fi.spawn(k, SMALLSMOKE); spawn(spark, SMALLSMOKE);
if (fi.isadoorwall(wall[hitwall].picnum) == 1) if (fi.isadoorwall(wall[hitwall].picnum) == 1)
goto SKIPBULLETHOLE; goto SKIPBULLETHOLE;
@ -505,14 +508,14 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
while ((l = it.NextIndex()) >= 0) while ((l = it.NextIndex()) >= 0)
{ {
if (sprite[l].picnum == BULLETHOLE) if (sprite[l].picnum == BULLETHOLE)
if (dist(&sprite[l], &sprite[k]) < (12 + (krand() & 7))) if (dist(&sprite[l], &spark->s) < (12 + (krand() & 7)))
goto SKIPBULLETHOLE; goto SKIPBULLETHOLE;
} }
l = fi.spawn(k, BULLETHOLE); auto hole = spawn(spark, BULLETHOLE);
sprite[l].xvel = -1; hole->s.xvel = -1;
sprite[l].ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, hole->s.ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x,
wall[hitwall].y - wall[wall[hitwall].point2].y) + 512; wall[hitwall].y - wall[wall[hitwall].point2].y) + 512;
ssp(l, CLIPMASK0); ssp(hole, CLIPMASK0);
} }
SKIPBULLETHOLE: SKIPBULLETHOLE:
@ -522,7 +525,7 @@ static void shootweapon(int i, int p, int sx, int sy, int sz, int sa, int atwith
if (hitz >= (sector[wall[hitwall].nextsector].floorz)) if (hitz >= (sector[wall[hitwall].nextsector].floorz))
hitwall = wall[hitwall].nextwall; hitwall = wall[hitwall].nextwall;
fi.checkhitwall(k, hitwall, hitx, hity, hitz, SHOTSPARK1); fi.checkhitwall(spark->GetIndex(), hitwall, hitx, hity, hitz, SHOTSPARK1);
} }
} }
else else