From 0871e56b92f8238a0c91ea97bfdb0414acd3d30f Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 28 Dec 2015 02:04:41 +0000 Subject: [PATCH] Projectile changes: -palette is now set at spawn time, instead of during movement (oops!) -projectiles can no longer hit their owner during their first tic of movement git-svn-id: https://svn.eduke32.com/eduke32@5498 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/actors.c | 20 ++++++++++++++------ polymer/eduke32/source/actors.h | 1 + polymer/eduke32/source/player.c | 3 +++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index d47591cd5..d20aafaf9 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -2677,14 +2677,14 @@ static int32_t Proj_MaybeDamageCF(const spritetype *s) ACTOR_STATIC void Proj_MoveCustom(int32_t i) { + int const m = SpriteProjectile[i].workslike & PROJECTILE_MOVED; + SpriteProjectile[i].workslike |= PROJECTILE_MOVED; + const projectile_t *const proj = &SpriteProjectile[i]; spritetype *const s = &sprite[i]; vec3_t davect; int32_t j=0; - if (proj->pal >= 0) - s->pal = proj->pal; - switch (proj->workslike & PROJECTILE_TYPE_MASK) { case PROJECTILE_HITSCAN: @@ -2727,9 +2727,7 @@ ACTOR_STATIC void Proj_MoveCustom(int32_t i) if (proj->trail >= 0) { - int32_t cnt; - - for (cnt=0; cnt<=proj->tnum; cnt++) + for (int cnt=0; cnt<=proj->tnum; cnt++) { j = A_Spawn(i, proj->trail); @@ -2754,6 +2752,14 @@ ACTOR_STATIC void Proj_MoveCustom(int32_t i) ll >>= 1; } + uint16_t cst = 0; + + if (!m && (unsigned) s->owner < MAXSPRITES) + { + cst = sprite[s->owner].cstat; + sprite[s->owner].cstat &= ~CSTAT_SPRITE_BLOCK; + } + do { vec3_t tmpvect; @@ -2765,6 +2771,8 @@ ACTOR_STATIC void Proj_MoveCustom(int32_t i) j = A_MoveSprite(i, &tmpvect, CLIPMASK1); } while (!j && --cnt > 0); + + if (cst) sprite[s->owner].cstat = cst; } if (!(proj->workslike & PROJECTILE_BOUNCESOFFWALLS) && // NOT_BOUNCESOFFWALLS_YVEL diff --git a/polymer/eduke32/source/actors.h b/polymer/eduke32/source/actors.h index 04885432f..3a61e02c6 100644 --- a/polymer/eduke32/source/actors.h +++ b/polymer/eduke32/source/actors.h @@ -285,6 +285,7 @@ enum pflags_t { PROJECTILE_REALCLIPDIST = 0x00080000, PROJECTILE_ACCURATE = 0x00100000, PROJECTILE_NOSETOWNERSHADE = 0x00200000, + PROJECTILE_MOVED = 0x80000000, // internal flag, do not document PROJECTILE_TYPE_MASK = PROJECTILE_HITSCAN|PROJECTILE_RPG|PROJECTILE_KNEE|PROJECTILE_BLOOD, }; diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 8a12b20e2..0d36ce92a 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -978,6 +978,9 @@ static int32_t A_ShootCustom(const int32_t i, const int32_t atwith, int16_t sa, sprite[j].xrepeat = proj->xrepeat; sprite[j].yrepeat = proj->yrepeat; + if (proj->pal >= 0) + sprite[j].pal = proj->pal; + if (proj->extra_rand > 0) sprite[j].extra += (krand()&proj->extra_rand);