- InitEnemyUzi

This commit is contained in:
Christoph Oelckers 2021-11-04 00:23:15 +01:00
parent 614757cda4
commit 63f9330f53

View file

@ -18608,14 +18608,12 @@ InitTurretMgun(SECTOR_OBJECTp sop)
} }
int int InitEnemyUzi(DSWActor* actor)
InitEnemyUzi(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
int SpriteNum = u->SpriteNum; SPRITEp sp = &actor->s(), wp;
SPRITEp sp = User[SpriteNum]->SpriteP,wp;
USERp wu; USERp wu;
short daang, j; short daang;
hitdata_t hitinfo = { { -2, -2, -2 }, -2, -2, -2 }; hitdata_t hitinfo = { { -2, -2, -2 }, -2, -2, -2 };
int daz; int daz;
int zh; int zh;
@ -18626,7 +18624,7 @@ InitEnemyUzi(DSWActor* actor)
// Make sprite shade brighter // Make sprite shade brighter
u->Vis = 128; u->Vis = 128;
setspritez(SpriteNum, &sp->pos); SetActorZ(actor, &sp->pos);
if (u->ID == ZILLA_RUN_R0) if (u->ID == ZILLA_RUN_R0)
{ {
@ -18682,9 +18680,9 @@ InitEnemyUzi(DSWActor* actor)
{ {
if (sp->pal == PALETTE_PLAYER3 || sp->pal == PALETTE_PLAYER5 || if (sp->pal == PALETTE_PLAYER3 || sp->pal == PALETTE_PLAYER5 ||
sp->pal == PAL_XLAT_LT_GREY || sp->pal == PAL_XLAT_LT_TAN) sp->pal == PAL_XLAT_LT_GREY || sp->pal == PAL_XLAT_LT_TAN)
PlaySound(DIGI_M60, sp, v3df_none); PlaySound(DIGI_M60, actor, v3df_none);
else else
PlaySound(DIGI_NINJAUZIATTACK, sp, v3df_none); PlaySound(DIGI_NINJAUZIATTACK, actor, v3df_none);
} }
if (hitinfo.wall >= 0) if (hitinfo.wall >= 0)
@ -18715,55 +18713,54 @@ InitEnemyUzi(DSWActor* actor)
return 0; return 0;
} }
j = SpawnSprite(STAT_MISSILE, UZI_SMOKE+2, s_UziSmoke, hitinfo.sect, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0); auto actorNew = SpawnActor(STAT_MISSILE, UZI_SMOKE+2, s_UziSmoke, hitinfo.sect, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0);
wp = &sprite[j]; wu = actorNew->u();
wp = &actorNew->s();
wp->shade = -40; wp->shade = -40;
wp->xrepeat = UZI_SMOKE_REPEAT; wp->xrepeat = UZI_SMOKE_REPEAT;
wp->yrepeat = UZI_SMOKE_REPEAT; wp->yrepeat = UZI_SMOKE_REPEAT;
if (u->ID == ZOMBIE_RUN_R0) if (u->ID == ZOMBIE_RUN_R0)
SetOwner(sp->owner, j); SetOwner(GetOwner(actor), actorNew);
else else
SetOwner(SpriteNum, j); SetOwner(actor, actorNew);
User[j]->WaitTics = 63; wu->WaitTics = 63;
//SET(wp->cstat, CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER);
SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_YCENTER);
wp->clipdist = 32L >> 2; wp->clipdist = 32L >> 2;
//HitscanSpriteAdjust(j, hitinfo.wall);
j = SpawnSprite(STAT_MISSILE, UZI_SMOKE, s_UziSmoke, hitinfo.sect, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0); actorNew = SpawnActor(STAT_MISSILE, UZI_SMOKE, s_UziSmoke, hitinfo.sect, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0);
wp = &sprite[j]; wp = &actorNew->s();
wp->shade = -40; wp->shade = -40;
wp->xrepeat = UZI_SMOKE_REPEAT; wp->xrepeat = UZI_SMOKE_REPEAT;
wp->yrepeat = UZI_SMOKE_REPEAT; wp->yrepeat = UZI_SMOKE_REPEAT;
SetOwner(SpriteNum, j); SetOwner(actor, actorNew);
SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_YCENTER);
wp->clipdist = 8 >> 2; wp->clipdist = 8 >> 2;
HitscanSpriteAdjust(j, hitinfo.wall); HitscanSpriteAdjust(actorNew->GetSpriteIndex(), hitinfo.wall);
DoHitscanDamage(j, hitinfo.sprite); DoHitscanDamage(actorNew->GetSpriteIndex(), hitinfo.sprite);
j = SpawnSprite(STAT_MISSILE, UZI_SPARK, s_UziSpark, hitinfo.sect, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0); actorNew = SpawnActor(STAT_MISSILE, UZI_SPARK, s_UziSpark, hitinfo.sect, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z, daang, 0);
wp = &sprite[j]; wu = actorNew->u();
wu = User[j].Data(); wp = &actorNew->s();
wp->shade = -40; wp->shade = -40;
wp->xrepeat = UZI_SPARK_REPEAT; wp->xrepeat = UZI_SPARK_REPEAT;
wp->yrepeat = UZI_SPARK_REPEAT; wp->yrepeat = UZI_SPARK_REPEAT;
SetOwner(SpriteNum, j); SetOwner(actor, actorNew);
wu->spal = wp->pal; wu->spal = wp->pal;
SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_YCENTER);
wp->clipdist = 8 >> 2; wp->clipdist = 8 >> 2;
HitscanSpriteAdjust(j, hitinfo.wall); HitscanSpriteAdjust(actorNew->GetSpriteIndex(), hitinfo.wall);
if (RANDOM_P2(1024) < 100) if (RANDOM_P2(1024) < 100)
{ {
PlaySound(DIGI_RICHOCHET1,wp, v3df_none); PlaySound(DIGI_RICHOCHET1,actorNew, v3df_none);
} }
else if (RANDOM_P2(1024) < 100) else if (RANDOM_P2(1024) < 100)
PlaySound(DIGI_RICHOCHET2,wp, v3df_none); PlaySound(DIGI_RICHOCHET2,actorNew, v3df_none);
return 0; return 0;
} }