2006-04-13 20:47:06 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
2016-02-07 02:38:03 +00:00
|
|
|
Copyright (C) 2016 EDuke32 developers and contributors
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-25 10:56:00 +00:00
|
|
|
This file is part of EDuke32.
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2014-07-20 08:55:56 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-04-13 20:47:06 +00:00
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2010-05-25 10:56:00 +00:00
|
|
|
|
2016-01-08 01:33:35 +00:00
|
|
|
#define actors_c_
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
#include "duke3d.h"
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
#if KRANDDEBUG
|
|
|
|
# define ACTOR_STATIC
|
|
|
|
#else
|
|
|
|
# define ACTOR_STATIC static
|
|
|
|
#endif
|
|
|
|
|
2012-04-13 10:45:49 +00:00
|
|
|
#define KILLIT(KX) do { A_DeleteSprite(KX); goto BOLT; } while (0)
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t g_numEnvSoundsPlaying;
|
|
|
|
extern int32_t g_noEnemies;
|
2008-11-20 14:06:36 +00:00
|
|
|
|
2013-04-15 10:48:05 +00:00
|
|
|
int32_t otherp;
|
|
|
|
|
2015-03-24 00:40:05 +00:00
|
|
|
int32_t G_SetInterpolation(int32_t * const posptr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-02-16 18:53:00 +00:00
|
|
|
if (g_numInterpolations >= MAXINTERPOLATIONS)
|
|
|
|
return 1;
|
|
|
|
|
2015-03-24 00:40:05 +00:00
|
|
|
for (int i = 0; i < g_numInterpolations; ++i)
|
2013-02-16 18:53:00 +00:00
|
|
|
if (curipos[i] == posptr)
|
|
|
|
return 0;
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
curipos[g_numInterpolations] = posptr;
|
|
|
|
oldipos[g_numInterpolations] = *posptr;
|
|
|
|
g_numInterpolations++;
|
2013-02-16 18:53:00 +00:00
|
|
|
return 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2015-03-24 00:40:05 +00:00
|
|
|
void G_StopInterpolation(int32_t * const posptr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2015-03-24 00:40:05 +00:00
|
|
|
for (int i = startofdynamicinterpolations; i < g_numInterpolations; ++i)
|
2006-04-13 20:47:06 +00:00
|
|
|
if (curipos[i] == posptr)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
g_numInterpolations--;
|
|
|
|
oldipos[i] = oldipos[g_numInterpolations];
|
|
|
|
bakipos[i] = bakipos[g_numInterpolations];
|
|
|
|
curipos[i] = curipos[g_numInterpolations];
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void G_DoInterpolations(int32_t smoothratio) //Stick at beginning of drawscreen
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-10-15 16:02:55 +00:00
|
|
|
if (g_interpolationLock++)
|
|
|
|
return;
|
|
|
|
|
2015-03-24 00:40:05 +00:00
|
|
|
int32_t odelta, ndelta = 0;
|
|
|
|
|
|
|
|
for (int i = 0, j = 0; i < g_numInterpolations; ++i)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-15 01:16:55 +00:00
|
|
|
odelta = ndelta;
|
2015-03-24 00:40:05 +00:00
|
|
|
bakipos[i] = *curipos[i];
|
|
|
|
ndelta = (*curipos[i]) - oldipos[i];
|
|
|
|
if (odelta != ndelta)
|
|
|
|
j = mulscale16(ndelta, smoothratio);
|
|
|
|
*curipos[i] = oldipos[i] + j;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-02 10:52:13 +00:00
|
|
|
void G_ClearCameraView(DukePlayer_t *ps)
|
|
|
|
{
|
|
|
|
int32_t k;
|
|
|
|
|
|
|
|
ps->newowner = -1;
|
2015-03-24 00:40:05 +00:00
|
|
|
ps->pos = ps->opos;
|
2012-08-02 10:52:13 +00:00
|
|
|
ps->ang = ps->oang;
|
|
|
|
|
|
|
|
updatesector(ps->pos.x, ps->pos.y, &ps->cursectnum);
|
|
|
|
P_UpdateScreenPal(ps);
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_ACTOR, k))
|
2012-08-02 10:52:13 +00:00
|
|
|
if (sprite[k].picnum==CAMERA1)
|
|
|
|
sprite[k].yvel = 0;
|
|
|
|
}
|
|
|
|
|
2013-12-20 18:31:26 +00:00
|
|
|
// Manhattan distance between wall-point and sprite.
|
2015-02-11 05:21:38 +00:00
|
|
|
static inline int32_t G_WallSpriteDist(const twalltype *wal, const spritetype *spr)
|
2013-12-20 18:31:26 +00:00
|
|
|
{
|
|
|
|
return klabs(wal->x - spr->x) + klabs(wal->y - spr->y);
|
|
|
|
}
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3, int32_t hp4)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t d, q, stati;
|
|
|
|
const spritetype *const s = &sprite[i];
|
|
|
|
|
2013-04-15 10:48:05 +00:00
|
|
|
static const int32_t statlist[] = {
|
2013-04-15 10:48:09 +00:00
|
|
|
STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE,
|
|
|
|
STAT_PLAYER, STAT_FALLER, STAT_ZOMBIEACTOR, STAT_MISC
|
2013-01-01 15:24:14 +00:00
|
|
|
};
|
|
|
|
|
2013-12-12 19:22:16 +00:00
|
|
|
// XXX: accesses to 'sectorlist' potentially unaligned
|
|
|
|
int16_t *const sectorlist = (int16_t *)tempbuf;
|
|
|
|
const int32_t maxsects = sizeof(tempbuf)/sizeof(int16_t);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
if (s->picnum == RPG && s->xrepeat < 11)
|
|
|
|
goto SKIPWALLCHECK;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->picnum != SHRINKSPARK)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t sectcnt = 0;
|
|
|
|
int32_t sectend = 1;
|
|
|
|
|
2013-12-12 19:22:16 +00:00
|
|
|
sectorlist[0] = s->sectnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2015-02-11 05:21:38 +00:00
|
|
|
const twalltype *wal;
|
2013-12-12 19:22:16 +00:00
|
|
|
const int32_t dasect = sectorlist[sectcnt++];
|
2013-04-15 10:48:09 +00:00
|
|
|
const int32_t startwall = sector[dasect].wallptr;
|
|
|
|
const int32_t endwall = startwall+sector[dasect].wallnum;
|
2013-12-20 18:31:29 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t w;
|
2013-12-20 18:31:29 +00:00
|
|
|
const int32_t w2 = wall[startwall].point2;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2013-12-20 18:31:29 +00:00
|
|
|
// Check if "hit" 1st or 3rd wall-point. This mainly makes sense
|
|
|
|
// for rectangular "ceiling light"-style sectors.
|
2015-02-11 05:21:38 +00:00
|
|
|
if (G_WallSpriteDist((twalltype *)&wall[startwall], s) < r ||
|
|
|
|
G_WallSpriteDist((twalltype *)&wall[wall[w2].point2], s) < r)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-20 18:31:29 +00:00
|
|
|
if (((sector[dasect].ceilingz-s->z)>>8) < r)
|
|
|
|
Sect_DamageCeilingOrFloor(0, dasect);
|
|
|
|
if (((s->z-sector[dasect].floorz)>>8) < r)
|
|
|
|
Sect_DamageCeilingOrFloor(1, dasect);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2015-02-11 05:21:38 +00:00
|
|
|
for (w=startwall,wal=(twalltype *)&wall[startwall]; w<endwall; w++,wal++)
|
2013-12-20 18:31:26 +00:00
|
|
|
if (G_WallSpriteDist(wal, s) < r)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:05 +00:00
|
|
|
int16_t sect = -1;
|
2013-04-15 10:48:09 +00:00
|
|
|
const int32_t nextsect = wal->nextsector;
|
|
|
|
int32_t x1, y1;
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
if (nextsect >= 0)
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t dasect2;
|
|
|
|
for (dasect2=sectend-1; dasect2>=0; dasect2--)
|
2013-12-12 19:22:16 +00:00
|
|
|
if (sectorlist[dasect2] == nextsect)
|
2013-04-15 10:48:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
if (dasect2 < 0)
|
2013-12-12 19:22:16 +00:00
|
|
|
{
|
|
|
|
if (sectend == maxsects)
|
|
|
|
goto SKIPWALLCHECK; // prevent oob access of 'sectorlist'
|
|
|
|
sectorlist[sectend++] = nextsect;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
x1 = (((wal->x+wall[wal->point2].x)>>1)+s->x)>>1;
|
|
|
|
y1 = (((wal->y+wall[wal->point2].y)>>1)+s->y)>>1;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
updatesector(x1,y1,§);
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (sect >= 0 && cansee(x1,y1,s->z,sect,s->x,s->y,s->z,s->sectnum))
|
2009-01-13 04:40:56 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
vec3_t tmpvect = { wal->x, wal->y, s->z };
|
|
|
|
A_DamageWall(i, w, &tmpvect, s->picnum);
|
2009-01-13 04:40:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
while (sectcnt < sectend);
|
|
|
|
}
|
|
|
|
|
|
|
|
SKIPWALLCHECK:
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
q = -(16<<8) + (krand()&((32<<8)-1));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-12 19:22:16 +00:00
|
|
|
for (stati=0; stati < ARRAY_SSIZE(statlist); stati++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t j = headspritestat[statlist[stati]];
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
while (j >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
const int32_t nextj = nextspritestat[j];
|
2013-01-01 15:24:14 +00:00
|
|
|
spritetype *const sj = &sprite[j];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
// DEFAULT, ZOMBIEACTOR, MISC
|
|
|
|
if (stati == 0 || stati >= 5 || AFLAMABLE(sj->picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->picnum != SHRINKSPARK || (sj->cstat&257))
|
|
|
|
if (dist(s, sj) < r)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (A_CheckEnemySprite(sj) && !cansee(sj->x, sj->y,sj->z+q, sj->sectnum, s->x, s->y, s->z+q, s->sectnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
goto BOLT;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_DamageObject(j, i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (sj->extra >= 0 && sj != s && (sj->picnum == TRIPBOMB || A_CheckEnemySprite(sj) || sj->picnum == QUEBALL || sj->picnum == STRIPEBALL || (sj->cstat&257) || sj->picnum == DUKELYINGDEAD))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->picnum == SHRINKSPARK && sj->picnum != SHARK && (j == s->owner || sj->xrepeat < 24))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
j = nextj;
|
|
|
|
continue;
|
|
|
|
}
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->picnum == MORTER && j == s->owner)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
j = nextj;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (sj->picnum == APLAYER) sj->z -= PHEIGHT;
|
2006-11-14 21:35:50 +00:00
|
|
|
d = dist(s, sj);
|
2006-11-13 23:12:47 +00:00
|
|
|
if (sj->picnum == APLAYER) sj->z += PHEIGHT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (d < r && cansee(sj->x, sj->y, sj->z-(8<<8), sj->sectnum, s->x, s->y, s->z-(12<<8), s->sectnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].ang = getangle(sj->x-s->x,sj->y-s->y);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->picnum == RPG && sj->extra > 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].picnum = RPG;
|
2014-02-22 19:38:52 +00:00
|
|
|
else if (A_CheckSpriteFlags(i,SFLAG_PROJECTILE) && SpriteProjectile[i].workslike & PROJECTILE_RADIUS_PICNUM && sj->extra > 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].picnum = s->picnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->picnum == SHRINKSPARK)
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].picnum = SHRINKSPARK;
|
|
|
|
else actor[j].picnum = RADIUSEXPLOSION;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->picnum != SHRINKSPARK)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
const int32_t k = r/3;
|
|
|
|
|
2008-08-09 10:16:18 +00:00
|
|
|
if (d < k)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (hp4 == hp3) hp4++;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].extra = hp3 + (krand()%(hp4-hp3));
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
else if (d < k*2)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (hp3 == hp2) hp3++;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].extra = hp2 + (krand()%(hp3-hp2));
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-14 21:35:50 +00:00
|
|
|
else if (d < r)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (hp2 == hp1) hp2++;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].extra = hp1 + (krand()%(hp2-hp1));
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2014-12-28 20:57:13 +00:00
|
|
|
if (!A_CheckSpriteFlags(j, SFLAG_NODAMAGEPUSH))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (sj->xvel < 0) sj->xvel = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
sj->xvel += (s->extra<<2);
|
|
|
|
}
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (sj->picnum == PODFEM1 || sj->picnum == FEM1 ||
|
2006-04-13 20:47:06 +00:00
|
|
|
sj->picnum == FEM2 || sj->picnum == FEM3 ||
|
|
|
|
sj->picnum == FEM4 || sj->picnum == FEM5 ||
|
|
|
|
sj->picnum == FEM6 || sj->picnum == FEM7 ||
|
|
|
|
sj->picnum == FEM8 || sj->picnum == FEM9 ||
|
|
|
|
sj->picnum == FEM10 || sj->picnum == STATUE ||
|
|
|
|
sj->picnum == STATUEFLASH || sj->picnum == SPACEMARINE || sj->picnum == QUEBALL || sj->picnum == STRIPEBALL)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_DamageObject(j, i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else if (s->extra == 0) actor[j].extra = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (sj->picnum != RADIUSEXPLOSION &&
|
|
|
|
s->owner >= 0 && sprite[s->owner].statnum < MAXSTATUS)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (sj->picnum == APLAYER)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
DukePlayer_t *ps = g_player[P_GetP(sj)].ps;
|
2012-08-02 10:52:13 +00:00
|
|
|
|
|
|
|
if (ps->newowner >= 0)
|
|
|
|
G_ClearCameraView(ps);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-08-02 10:52:13 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].owner = s->owner;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BOLT:
|
|
|
|
j = nextj;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-15 10:48:05 +00:00
|
|
|
// Maybe do a projectile transport via an SE7.
|
|
|
|
// <spritenum>: the projectile
|
|
|
|
// <i>: the SE7
|
|
|
|
// <fromunderp>: below->above change?
|
2015-03-24 00:40:05 +00:00
|
|
|
static int32_t Proj_MaybeDoTransport(int32_t spritenum, const tspritetype * const effector, int32_t fromunderp, int32_t daz)
|
2013-04-15 10:48:05 +00:00
|
|
|
{
|
2015-03-24 00:40:05 +00:00
|
|
|
if (totalclock <= actor[spritenum].lasttransport)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
spritetype *const spr = &sprite[spritenum];
|
|
|
|
const tspritetype *const otherse = (tspritetype *)&sprite[effector->owner];
|
2013-04-15 10:48:05 +00:00
|
|
|
|
2015-03-24 00:40:05 +00:00
|
|
|
actor[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2);
|
2013-04-15 10:48:05 +00:00
|
|
|
|
2015-03-24 00:40:05 +00:00
|
|
|
spr->x += (otherse->x - effector->x);
|
|
|
|
spr->y += (otherse->y - effector->y);
|
2013-04-15 10:48:05 +00:00
|
|
|
|
2015-03-24 00:40:05 +00:00
|
|
|
// above->below
|
|
|
|
spr->z = (!fromunderp) ? sector[otherse->sectnum].ceilingz - daz + sector[effector->sectnum].floorz :
|
|
|
|
sector[otherse->sectnum].floorz - daz + sector[effector->sectnum].ceilingz;
|
|
|
|
// below->above
|
2013-04-15 10:48:18 +00:00
|
|
|
|
2015-03-24 00:40:05 +00:00
|
|
|
actor[spritenum].bpos = *(vec3_t *)&sprite[spritenum];
|
|
|
|
changespritesect(spritenum, otherse->sectnum);
|
2013-04-15 10:48:18 +00:00
|
|
|
|
2015-03-24 00:40:05 +00:00
|
|
|
return 1;
|
2013-04-15 10:48:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check whether sprite <s> is on/in a non-SE7 water sector.
|
|
|
|
// <othersectptr>: if not NULL, the sector on the other side.
|
2016-03-14 00:07:12 +00:00
|
|
|
int32_t A_CheckNoSE7Water(const spritetype *s, int32_t sectnum, int32_t slotag, int32_t *othersectptr)
|
2013-04-15 10:48:05 +00:00
|
|
|
{
|
|
|
|
if (slotag==ST_1_ABOVE_WATER || slotag==ST_2_UNDERWATER)
|
|
|
|
{
|
|
|
|
int32_t othersect = yax_getneighborsect(
|
|
|
|
s->x, s->y, sectnum, slotag==ST_1_ABOVE_WATER ? YAX_FLOOR : YAX_CEILING);
|
|
|
|
|
|
|
|
int32_t othertag = (slotag==ST_1_ABOVE_WATER) ?
|
|
|
|
ST_2_UNDERWATER : ST_1_ABOVE_WATER;
|
|
|
|
|
|
|
|
// If submerging, the lower sector MUST have lotag 2.
|
|
|
|
// If emerging, the upper sector MUST have lotag 1.
|
|
|
|
// This way, the x/y coordinates where above/below water
|
|
|
|
// changes can happen are the same.
|
|
|
|
if (othersect >= 0 && sector[othersect].lotag==othertag)
|
|
|
|
{
|
|
|
|
if (othersectptr)
|
|
|
|
*othersectptr = othersect;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check whether to do a z position update of sprite <spritenum>.
|
|
|
|
// Returns:
|
|
|
|
// 0 if no.
|
|
|
|
// 1 if yes, but stayed inside [actor[].ceilingz+1, actor[].floorz].
|
2013-04-15 10:48:20 +00:00
|
|
|
// <0 if yes, but passed a TROR no-SE7 water boundary. -returnvalue-1 is the
|
|
|
|
// other-side sector number.
|
2013-04-15 10:48:05 +00:00
|
|
|
static int32_t A_CheckNeedZUpdate(int32_t spritenum, int32_t changez, int32_t *dazptr)
|
|
|
|
{
|
|
|
|
const spritetype *spr = &sprite[spritenum];
|
2013-07-04 19:38:35 +00:00
|
|
|
const int32_t daz = spr->z + (changez>>1);
|
2013-04-15 10:48:05 +00:00
|
|
|
|
|
|
|
*dazptr = daz;
|
|
|
|
|
|
|
|
if (changez == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (daz > actor[spritenum].ceilingz && daz <= actor[spritenum].floorz)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
{
|
|
|
|
const int32_t psect=spr->sectnum, slotag=sector[psect].lotag;
|
2013-04-15 10:48:20 +00:00
|
|
|
int32_t othersect;
|
2013-04-15 10:48:05 +00:00
|
|
|
|
|
|
|
// Non-SE7 water.
|
2013-04-15 10:48:18 +00:00
|
|
|
// PROJECTILE_CHSECT
|
2013-04-15 10:48:05 +00:00
|
|
|
if ((changez < 0 && slotag==ST_2_UNDERWATER) || (changez > 0 && slotag==ST_1_ABOVE_WATER))
|
2013-04-15 10:48:20 +00:00
|
|
|
if (A_CheckNoSE7Water(spr, sprite[spritenum].sectnum, slotag, &othersect))
|
2013-04-15 10:48:05 +00:00
|
|
|
{
|
2013-04-15 10:48:20 +00:00
|
|
|
A_Spawn(spritenum, WATERSPLASH2);
|
|
|
|
// NOTE: Don't tweak its z position afterwards like with
|
|
|
|
// SE7-induced projectile teleportation. It doesn't look good
|
|
|
|
// with TROR water.
|
|
|
|
|
2014-02-22 19:38:52 +00:00
|
|
|
actor[spritenum].flags |= SFLAG_DIDNOSE7WATER;
|
2013-04-15 10:48:20 +00:00
|
|
|
return -othersect-1;
|
2013-04-15 10:48:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-09-07 18:10:16 +00:00
|
|
|
int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t cliptype, int32_t clipdist)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-10-14 20:41:25 +00:00
|
|
|
spritetype *const spr = &sprite[spritenum];
|
2015-02-08 18:48:31 +00:00
|
|
|
const int32_t badguy = A_CheckEnemySprite(spr);
|
2012-10-14 20:41:25 +00:00
|
|
|
const int32_t oldx = spr->x, oldy = spr->y;
|
2009-08-28 23:08:00 +00:00
|
|
|
|
2015-02-08 18:48:31 +00:00
|
|
|
if (spr->statnum == STAT_MISC || (badguy && spr->xrepeat < 4))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-07-04 19:38:35 +00:00
|
|
|
spr->x += change->x;
|
|
|
|
spr->y += change->y;
|
|
|
|
spr->z += change->z;
|
2012-10-14 20:41:25 +00:00
|
|
|
|
2015-02-08 18:48:31 +00:00
|
|
|
if (badguy)
|
2012-10-14 20:41:25 +00:00
|
|
|
setsprite(spritenum, (vec3_t *)spr);
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-02-08 18:48:31 +00:00
|
|
|
if (clipdist >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2015-02-08 18:48:31 +00:00
|
|
|
// use that value
|
|
|
|
}
|
2016-02-02 00:21:17 +00:00
|
|
|
else if (A_CheckSpriteFlags(spritenum, SFLAG_REALCLIPDIST))
|
|
|
|
clipdist = spr->clipdist<<2;
|
2015-02-08 18:48:31 +00:00
|
|
|
else if (badguy)
|
|
|
|
{
|
|
|
|
if (spr->xrepeat > 60)
|
|
|
|
clipdist = 1024;
|
|
|
|
else if (spr->picnum == LIZMAN)
|
|
|
|
clipdist = 292;
|
2016-02-02 00:21:17 +00:00
|
|
|
else if (A_CheckSpriteFlags(spritenum, SFLAG_BADGUY))
|
2015-02-08 18:48:31 +00:00
|
|
|
clipdist = spr->clipdist<<2;
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
2015-02-08 18:48:31 +00:00
|
|
|
clipdist = 192;
|
2012-10-14 20:41:25 +00:00
|
|
|
}
|
2015-02-08 18:48:31 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (spr->statnum == STAT_PROJECTILE && (SpriteProjectile[spritenum].workslike & PROJECTILE_REALCLIPDIST) == 0)
|
|
|
|
clipdist = 8;
|
|
|
|
else
|
|
|
|
clipdist = spr->clipdist<<2;
|
|
|
|
}
|
|
|
|
|
2015-02-20 22:10:26 +00:00
|
|
|
int16_t dasectnum = spr->sectnum;
|
|
|
|
const int16_t osectnum = dasectnum;
|
|
|
|
int32_t daz = spr->z - 2*tilesiz[spr->picnum].y*spr->yrepeat;
|
|
|
|
const int32_t oldz = spr->z;
|
|
|
|
|
2015-02-08 18:48:31 +00:00
|
|
|
// Handle horizontal movement first.
|
|
|
|
spr->z = daz;
|
|
|
|
int32_t retval = clipmove((vec3_t *)spr, &dasectnum,
|
|
|
|
change->x<<13, change->y<<13,
|
|
|
|
clipdist, 4<<8, 4<<8, cliptype);
|
|
|
|
spr->z = oldz;
|
2012-10-14 20:41:25 +00:00
|
|
|
|
2015-02-08 18:48:31 +00:00
|
|
|
if (badguy)
|
2012-10-14 20:41:25 +00:00
|
|
|
{
|
2015-02-08 18:48:31 +00:00
|
|
|
// Handle potential stayput condition (map-provided or hard-coded).
|
2012-10-14 20:41:25 +00:00
|
|
|
if (dasectnum < 0 ||
|
|
|
|
((actor[spritenum].actorstayput >= 0 && actor[spritenum].actorstayput != dasectnum) ||
|
|
|
|
(spr->picnum == BOSS2 && spr->pal == 0 && sector[dasectnum].lotag != ST_3) ||
|
|
|
|
((spr->picnum == BOSS1 || spr->picnum == BOSS2) && sector[dasectnum].lotag == ST_1_ABOVE_WATER)
|
2015-02-20 22:10:26 +00:00
|
|
|
|| (sector[osectnum].lotag != ST_1_ABOVE_WATER && sector[dasectnum].lotag == ST_1_ABOVE_WATER &&
|
|
|
|
(spr->picnum == LIZMAN || (spr->picnum == LIZTROOP && spr->zvel == 0)))
|
2012-10-14 20:41:25 +00:00
|
|
|
)
|
|
|
|
)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-08-28 23:08:00 +00:00
|
|
|
spr->x = oldx;
|
|
|
|
spr->y = oldy;
|
2015-02-08 18:48:31 +00:00
|
|
|
|
|
|
|
// NOTE: in Duke3D, LIZMAN on water takes on random angle here.
|
|
|
|
|
2012-10-14 20:41:25 +00:00
|
|
|
setsprite(spritenum, (vec3_t *)spr);
|
|
|
|
|
|
|
|
if (dasectnum < 0)
|
|
|
|
dasectnum = 0;
|
|
|
|
|
2013-04-15 10:48:05 +00:00
|
|
|
return 16384+dasectnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2009-01-14 10:40:30 +00:00
|
|
|
|
2012-10-14 20:41:25 +00:00
|
|
|
if ((retval&49152) >= 32768 && actor[spritenum].cgg==0)
|
|
|
|
spr->ang += 768;
|
2009-08-28 23:08:00 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-08-28 23:08:00 +00:00
|
|
|
if (dasectnum == -1)
|
|
|
|
{
|
|
|
|
dasectnum = spr->sectnum;
|
2010-12-17 14:22:15 +00:00
|
|
|
// OSD_Printf("%s:%d wtf\n",__FILE__,__LINE__);
|
2009-08-28 23:08:00 +00:00
|
|
|
}
|
2012-10-14 20:41:25 +00:00
|
|
|
else if (dasectnum != spr->sectnum)
|
2009-08-28 23:08:00 +00:00
|
|
|
{
|
2012-10-14 20:41:25 +00:00
|
|
|
changespritesect(spritenum, dasectnum);
|
2012-10-24 13:21:02 +00:00
|
|
|
// A_GetZLimits(spritenum);
|
2009-01-13 12:23:18 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:25 +00:00
|
|
|
Bassert(dasectnum == spr->sectnum);
|
|
|
|
|
2015-02-08 18:48:31 +00:00
|
|
|
int dozupdate = A_CheckNeedZUpdate(spritenum, change->z, &daz);
|
2009-08-28 23:08:00 +00:00
|
|
|
|
2013-04-15 10:48:05 +00:00
|
|
|
// Update sprite's z positions and (for TROR) maybe the sector number.
|
|
|
|
if (dozupdate)
|
2011-05-07 18:23:34 +00:00
|
|
|
{
|
2009-08-28 23:08:00 +00:00
|
|
|
spr->z = daz;
|
2011-05-07 18:23:34 +00:00
|
|
|
#ifdef YAX_ENABLE
|
2013-04-15 10:48:20 +00:00
|
|
|
if (dozupdate < 0)
|
2013-04-15 10:48:05 +00:00
|
|
|
{
|
|
|
|
// If we passed a TROR no-SE7 water boundary, signal to the outside
|
|
|
|
// that the ceiling/floor was not hit. However, this is not enough:
|
|
|
|
// later, code checks for (retval&49152)!=49152
|
|
|
|
// [i.e. not "was ceiling or floor hit", but "was no sprite hit"]
|
|
|
|
// and calls G_WeaponHitCeilingOrFloor() then, so we need to set
|
2014-02-22 19:38:52 +00:00
|
|
|
// actor[].flags |= SFLAG_DIDNOSE7WATER in A_CheckNeedZUpdate()
|
2013-04-15 10:48:05 +00:00
|
|
|
// previously.
|
|
|
|
// XXX: Why is this contrived data flow necessary? (If at all.)
|
2013-04-15 10:48:20 +00:00
|
|
|
changespritesect(spritenum, -dozupdate-1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (yax_getbunch(dasectnum, (change->z>0))>=0
|
|
|
|
&& (SECTORFLD(dasectnum,stat, (change->z>0))&yax_waltosecmask(cliptype))==0)
|
|
|
|
{
|
|
|
|
setspritez(spritenum, (vec3_t *)spr);
|
2013-04-15 10:48:05 +00:00
|
|
|
}
|
2011-05-07 18:23:34 +00:00
|
|
|
#endif
|
|
|
|
}
|
2013-04-16 20:08:45 +00:00
|
|
|
else if (change->z != 0 && retval == 0)
|
2012-10-14 20:41:25 +00:00
|
|
|
retval = 16384+dasectnum;
|
2009-07-04 09:28:21 +00:00
|
|
|
|
2013-04-15 10:48:05 +00:00
|
|
|
if (retval == 16384+dasectnum)
|
2009-08-28 23:08:00 +00:00
|
|
|
if (spr->statnum == STAT_PROJECTILE)
|
2009-07-04 09:28:21 +00:00
|
|
|
{
|
2013-04-15 10:48:05 +00:00
|
|
|
int32_t i;
|
2009-07-04 09:28:21 +00:00
|
|
|
|
2013-04-15 10:48:18 +00:00
|
|
|
// Projectile sector changes due to transport SEs (SE7_PROJECTILE).
|
|
|
|
// PROJECTILE_CHSECT
|
2013-04-15 10:48:05 +00:00
|
|
|
for (SPRITES_OF(STAT_TRANSPORT, i))
|
2012-02-21 19:33:33 +00:00
|
|
|
if (sprite[i].sectnum == dasectnum)
|
2009-07-04 09:28:21 +00:00
|
|
|
{
|
2013-04-15 10:48:18 +00:00
|
|
|
const int32_t lotag = sector[dasectnum].lotag;
|
|
|
|
|
|
|
|
if (lotag == ST_1_ABOVE_WATER)
|
2012-02-21 19:33:33 +00:00
|
|
|
if (daz >= actor[spritenum].floorz)
|
2015-03-24 00:40:05 +00:00
|
|
|
if (Proj_MaybeDoTransport(spritenum, (tspritetype *)&sprite[i], 0, daz))
|
2013-04-15 10:48:18 +00:00
|
|
|
return 0;
|
2013-04-15 10:48:05 +00:00
|
|
|
|
2013-04-15 10:48:18 +00:00
|
|
|
if (lotag == ST_2_UNDERWATER)
|
2012-02-21 19:33:33 +00:00
|
|
|
if (daz <= actor[spritenum].ceilingz)
|
2015-03-24 00:40:05 +00:00
|
|
|
if (Proj_MaybeDoTransport(spritenum, (tspritetype *)&sprite[i], 1, daz))
|
2013-04-15 10:48:18 +00:00
|
|
|
return 0;
|
2009-07-04 09:28:21 +00:00
|
|
|
}
|
|
|
|
}
|
2009-01-14 10:40:30 +00:00
|
|
|
|
2013-04-15 10:48:05 +00:00
|
|
|
return retval;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t block_deletesprite = 0;
|
2008-11-16 00:48:02 +00:00
|
|
|
|
2011-09-06 17:45:21 +00:00
|
|
|
#ifdef POLYMER
|
2012-10-05 20:48:10 +00:00
|
|
|
static void A_DeleteLight(int32_t s)
|
2011-09-06 17:45:21 +00:00
|
|
|
{
|
2011-12-09 19:11:31 +00:00
|
|
|
if (actor[s].lightId >= 0)
|
|
|
|
polymer_deletelight(actor[s].lightId);
|
2011-09-06 17:45:21 +00:00
|
|
|
actor[s].lightId = -1;
|
|
|
|
actor[s].lightptr = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void G_Polymer_UnInit(void)
|
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
|
|
|
|
for (i=0; i<MAXSPRITES; i++)
|
2012-10-05 20:48:10 +00:00
|
|
|
A_DeleteLight(i);
|
2011-09-06 17:45:21 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-03-11 17:38:13 +00:00
|
|
|
// deletesprite() game wrapper
|
2009-01-09 09:29:17 +00:00
|
|
|
void A_DeleteSprite(int32_t s)
|
2007-12-20 19:14:38 +00:00
|
|
|
{
|
2014-10-29 17:05:46 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(block_deletesprite))
|
2008-11-16 00:48:02 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
OSD_Printf(OSD_ERROR "A_DeleteSprite(): tried to remove sprite %d in EVENT_EGS\n", s);
|
2008-11-16 00:48:02 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-06-05 20:09:13 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (VM_HaveEvent(EVENT_KILLIT))
|
2008-02-06 11:42:34 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
int32_t p, pl = A_FindPlayer(&sprite[s], &p);
|
2009-01-02 01:03:41 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEventWithDist_(EVENT_KILLIT, s, pl, p))
|
2008-02-06 11:42:34 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-06-05 20:09:13 +00:00
|
|
|
|
|
|
|
#ifdef POLYMER
|
2014-11-22 12:29:25 +00:00
|
|
|
if (actor[s].lightptr != NULL && getrendermode() == REND_POLYMER)
|
2012-10-05 20:48:10 +00:00
|
|
|
A_DeleteLight(s);
|
2009-06-05 20:09:13 +00:00
|
|
|
#endif
|
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
// AMBIENT_SFX_PLAYING
|
|
|
|
if (sprite[s].picnum == MUSICANDSFX && actor[s].t_data[0] == 1)
|
2013-05-28 19:52:51 +00:00
|
|
|
S_StopEnvSound(sprite[s].lotag, s);
|
|
|
|
|
2012-12-12 02:53:13 +00:00
|
|
|
// NetAlloc
|
|
|
|
if (Net_IsRelevantSprite(s))
|
|
|
|
{
|
|
|
|
Net_DeleteSprite(s);
|
2014-11-22 12:29:25 +00:00
|
|
|
return;
|
2012-12-12 02:53:13 +00:00
|
|
|
}
|
2014-11-22 12:29:25 +00:00
|
|
|
|
|
|
|
deletesprite(s);
|
2009-08-28 23:08:00 +00:00
|
|
|
}
|
2007-12-20 19:14:38 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void A_AddToDeleteQueue(int32_t i)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-10-28 22:27:53 +00:00
|
|
|
if (g_spriteDeleteQueueSize == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(i);
|
2008-02-06 21:02:11 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2007-03-11 00:47:32 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (SpriteDeletionQueue[g_spriteDeleteQueuePos] >= 0)
|
|
|
|
sprite[SpriteDeletionQueue[g_spriteDeleteQueuePos]].xrepeat = 0;
|
|
|
|
SpriteDeletionQueue[g_spriteDeleteQueuePos] = i;
|
|
|
|
g_spriteDeleteQueuePos = (g_spriteDeleteQueuePos+1)%g_spriteDeleteQueueSize;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void A_SpawnMultiple(int32_t sp, int32_t pic, int32_t n)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t j;
|
2007-03-01 00:50:59 +00:00
|
|
|
spritetype *s = &sprite[sp];
|
2007-03-11 00:47:32 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (; n>0; n--)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
j = A_InsertSprite(s->sectnum,s->x,s->y,s->z-(krand()%(47<<8)),pic,-32,8,8,krand()&2047,0,0,sp,5);
|
|
|
|
A_Spawn(-1, j);
|
|
|
|
sprite[j].cstat = krand()&12;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void A_DoGuts(int32_t sp, int32_t gtype, int32_t n)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t gutz,floorz;
|
|
|
|
int32_t i,a,j,sx = 32,sy = 32;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
|
|
|
const spritetype *const s = &sprite[sp];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (A_CheckEnemySprite(s) && s->xrepeat < 16)
|
2006-04-13 20:47:06 +00:00
|
|
|
sx = sy = 8;
|
|
|
|
|
|
|
|
gutz = s->z-(8<<8);
|
|
|
|
floorz = getflorzofslope(s->sectnum,s->x,s->y);
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (gutz > (floorz-(8<<8)))
|
2006-04-13 20:47:06 +00:00
|
|
|
gutz = floorz-(8<<8);
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->picnum == COMMANDER)
|
2006-04-13 20:47:06 +00:00
|
|
|
gutz -= (24<<8);
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=n; j>0; j--)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
a = krand()&2047;
|
|
|
|
i = A_InsertSprite(s->sectnum,s->x+(krand()&255)-128,s->y+(krand()&255)-128,gutz-(krand()&8191),gtype,-32,sx,sy,a,48+(krand()&31),-512-(krand()&2047),sp,5);
|
2006-11-13 23:12:47 +00:00
|
|
|
if (PN == JIBS2)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
sprite[i].xrepeat >>= 2;
|
|
|
|
sprite[i].yrepeat >>= 2;
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2008-08-07 10:48:21 +00:00
|
|
|
sprite[i].pal = s->pal;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void A_DoGutsDir(int32_t sp, int32_t gtype, int32_t n)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t gutz,floorz;
|
|
|
|
int32_t i,a,j,sx = 32,sy = 32;
|
2013-04-15 10:48:09 +00:00
|
|
|
const spritetype *const s = &sprite[sp];
|
2007-03-11 00:47:32 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (A_CheckEnemySprite(s) && s->xrepeat < 16)
|
2006-04-13 20:47:06 +00:00
|
|
|
sx = sy = 8;
|
|
|
|
|
|
|
|
gutz = s->z-(8<<8);
|
|
|
|
floorz = getflorzofslope(s->sectnum,s->x,s->y);
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (gutz > (floorz-(8<<8)))
|
2006-04-13 20:47:06 +00:00
|
|
|
gutz = floorz-(8<<8);
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->picnum == COMMANDER)
|
2006-04-13 20:47:06 +00:00
|
|
|
gutz -= (24<<8);
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=n; j>0; j--)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
a = krand()&2047;
|
|
|
|
i = A_InsertSprite(s->sectnum,s->x,s->y,gutz,gtype,-32,sx,sy,a,256+(krand()&127),-512-(krand()&2047),sp,5);
|
2008-08-07 10:48:21 +00:00
|
|
|
sprite[i].pal = s->pal;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-05 17:53:18 +00:00
|
|
|
LUNATIC_EXTERN int32_t G_ToggleWallInterpolation(int32_t w, int32_t doset)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-02-16 18:53:00 +00:00
|
|
|
if (doset)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-02-16 18:53:00 +00:00
|
|
|
return G_SetInterpolation(&wall[w].x)
|
|
|
|
|| G_SetInterpolation(&wall[w].y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
G_StopInterpolation(&wall[w].x);
|
|
|
|
G_StopInterpolation(&wall[w].y);
|
|
|
|
return 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
void Sect_ToggleInterpolation(int sectnum, int doset)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
int k, j = sector[sectnum].wallptr;
|
|
|
|
const int endwall = sector[sectnum].wallptr + sector[sectnum].wallnum;
|
2007-03-01 00:50:59 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (; j<endwall; j++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-02-16 18:53:00 +00:00
|
|
|
G_ToggleWallInterpolation(j, doset);
|
|
|
|
|
2010-09-27 21:52:04 +00:00
|
|
|
k = wall[j].nextwall;
|
|
|
|
if (k >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-02-16 18:53:00 +00:00
|
|
|
G_ToggleWallInterpolation(k, doset);
|
|
|
|
G_ToggleWallInterpolation(wall[k].point2, doset);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-23 19:24:21 +00:00
|
|
|
static int32_t move_rotfixed_sprite(int32_t j, int32_t pivotspr, int32_t daang)
|
2011-06-22 19:12:47 +00:00
|
|
|
{
|
2012-12-23 19:24:21 +00:00
|
|
|
if ((ROTFIXSPR_STATNUMP(sprite[j].statnum) ||
|
2014-11-22 12:29:25 +00:00
|
|
|
((sprite[j].statnum == STAT_ACTOR || sprite[j].statnum == STAT_ZOMBIEACTOR) &&
|
2016-02-02 00:21:17 +00:00
|
|
|
A_CheckSpriteFlags(j, SFLAG_ROTFIXED))) &&
|
2014-11-22 12:29:25 +00:00
|
|
|
actor[j].t_data[7] == (ROTFIXSPR_MAGIC | pivotspr))
|
2011-06-22 19:12:47 +00:00
|
|
|
{
|
2015-05-26 00:47:54 +00:00
|
|
|
rotatepoint(zerovec, *(vec2_t *)&actor[j].t_data[8], daang & 2047, (vec2_t *)&sprite[j].x);
|
2011-06-22 19:12:47 +00:00
|
|
|
sprite[j].x += sprite[pivotspr].x;
|
|
|
|
sprite[j].y += sprite[pivotspr].y;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-01-21 19:35:34 +00:00
|
|
|
void A_MoveSector(int i)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
// T1,T2 and T3 are used for all the sector moving stuff!!!
|
2016-01-21 19:35:22 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
spritetype * const s = &sprite[i];
|
2016-01-21 19:35:22 +00:00
|
|
|
int32_t p, pl = A_FindPlayer(s, &p);
|
|
|
|
int const k = VM_OnEventWithBoth(EVENT_MOVESECTOR, i, pl, p, T3);
|
2015-05-26 00:47:54 +00:00
|
|
|
int j = T2;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
s->x += (s->xvel * (sintable[(s->ang + 512) & 2047])) >> 14;
|
|
|
|
s->y += (s->xvel * (sintable[s->ang & 2047])) >> 14;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
const int endwall = sector[s->sectnum].wallptr + sector[s->sectnum].wallnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
for (i = sector[s->sectnum].wallptr; i < endwall; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2016-01-21 19:35:30 +00:00
|
|
|
vec2_t const v = g_origins[j];
|
2015-05-26 00:47:54 +00:00
|
|
|
vec2_t t;
|
|
|
|
rotatepoint(zerovec, v, k & 2047, &t);
|
|
|
|
dragpoint(i, s->x + t.x, s->y + t.y, 0);
|
2007-03-01 00:50:59 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
j++;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-15 10:48:13 +00:00
|
|
|
#if !defined LUNATIC
|
2013-06-30 20:38:48 +00:00
|
|
|
// NOTE: T5 is AC_ACTION_ID
|
2014-11-22 12:29:25 +00:00
|
|
|
# define LIGHTRAD_PICOFS (T5 ? *(script + T5) + (*(script + T5 + 2)) * AC_CURFRAME(actor[i].t_data) : 0)
|
2012-05-18 12:46:10 +00:00
|
|
|
#else
|
2012-08-06 20:00:29 +00:00
|
|
|
// startframe + viewtype*[cyclic counter]
|
2014-11-22 12:29:25 +00:00
|
|
|
# define LIGHTRAD_PICOFS (actor[i].ac.startframe + actor[i].ac.viewtype * AC_CURFRAME(actor[i].t_data))
|
2012-05-18 12:46:10 +00:00
|
|
|
#endif
|
2011-12-21 18:40:47 +00:00
|
|
|
|
2009-06-06 22:30:53 +00:00
|
|
|
// this is the same crap as in game.c's tspr manipulation. puke.
|
2013-06-30 20:38:48 +00:00
|
|
|
// XXX: may access tilesizy out-of-bounds by bad user code.
|
2014-09-30 04:14:21 +00:00
|
|
|
#define LIGHTRAD (s->yrepeat * tilesiz[s->picnum + LIGHTRAD_PICOFS].y)
|
2015-12-23 04:05:31 +00:00
|
|
|
#define LIGHTRAD2 ((s->yrepeat + ((rand() % s->yrepeat)>>2)) * tilesiz[s->picnum + LIGHTRAD_PICOFS].y)
|
2009-06-06 22:30:53 +00:00
|
|
|
|
2016-04-13 04:04:13 +00:00
|
|
|
void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, int32_t range, int32_t color, int32_t priority)
|
2009-06-06 10:20:00 +00:00
|
|
|
{
|
|
|
|
#ifdef POLYMER
|
2009-06-08 00:31:53 +00:00
|
|
|
spritetype *s = &sprite[srcsprite];
|
|
|
|
|
2015-10-23 23:00:21 +00:00
|
|
|
if (getrendermode() != REND_POLYMER || pr_lighting != 1)
|
2009-06-07 12:57:46 +00:00
|
|
|
return;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[srcsprite].lightptr == NULL)
|
2009-06-06 10:20:00 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
#pragma pack(push, 1)
|
2009-06-06 10:20:00 +00:00
|
|
|
_prlight mylight;
|
2009-07-12 01:55:34 +00:00
|
|
|
#pragma pack(pop)
|
2011-07-22 13:32:01 +00:00
|
|
|
Bmemset(&mylight, 0, sizeof(mylight));
|
2009-06-06 10:20:00 +00:00
|
|
|
|
|
|
|
mylight.sector = s->sectnum;
|
|
|
|
mylight.x = s->x;
|
|
|
|
mylight.y = s->y;
|
2014-11-22 12:29:25 +00:00
|
|
|
mylight.z = s->z - zoffset;
|
|
|
|
mylight.color[0] = color & 255;
|
|
|
|
mylight.color[1] = (color >> 8) & 255;
|
|
|
|
mylight.color[2] = (color >> 16) & 255;
|
2009-06-06 10:20:00 +00:00
|
|
|
mylight.radius = radius;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[srcsprite].lightmaxrange = mylight.range = range;
|
2009-06-06 10:20:00 +00:00
|
|
|
|
|
|
|
mylight.priority = priority;
|
2009-10-03 21:14:42 +00:00
|
|
|
mylight.tilenum = 0;
|
2009-06-06 10:20:00 +00:00
|
|
|
|
2012-10-21 04:52:43 +00:00
|
|
|
mylight.publicflags.emitshadow = 1;
|
|
|
|
mylight.publicflags.negative = 0;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[srcsprite].lightId = polymer_addlight(&mylight);
|
|
|
|
if (actor[srcsprite].lightId >= 0)
|
|
|
|
actor[srcsprite].lightptr = &prlights[actor[srcsprite].lightId];
|
2009-06-06 10:20:00 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
s->z -= zoffset;
|
2009-06-09 06:19:58 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
if (range<actor[srcsprite].lightmaxrange>> 1)
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[srcsprite].lightmaxrange = 0;
|
2009-06-13 21:06:45 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
if (range > actor[srcsprite].lightmaxrange || priority != actor[srcsprite].lightptr->priority ||
|
|
|
|
Bmemcmp(&sprite[srcsprite], actor[srcsprite].lightptr, sizeof(int32_t) * 3))
|
2009-06-06 10:20:00 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (range > actor[srcsprite].lightmaxrange)
|
|
|
|
actor[srcsprite].lightmaxrange = range;
|
2009-06-07 03:13:55 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
Bmemcpy(actor[srcsprite].lightptr, &sprite[srcsprite], sizeof(int32_t) * 3);
|
|
|
|
actor[srcsprite].lightptr->sector = s->sectnum;
|
|
|
|
actor[srcsprite].lightptr->flags.invalidate = 1;
|
2009-06-06 10:20:00 +00:00
|
|
|
}
|
2009-06-06 22:30:53 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[srcsprite].lightptr->priority = priority;
|
|
|
|
actor[srcsprite].lightptr->range = range;
|
2014-11-22 12:29:25 +00:00
|
|
|
actor[srcsprite].lightptr->color[0] = color & 255;
|
|
|
|
actor[srcsprite].lightptr->color[1] = (color >> 8) & 255;
|
|
|
|
actor[srcsprite].lightptr->color[2] = (color >> 16) & 255;
|
2009-06-06 22:30:53 +00:00
|
|
|
|
2009-06-06 10:20:00 +00:00
|
|
|
s->z += zoffset;
|
|
|
|
|
|
|
|
#else
|
|
|
|
UNREFERENCED_PARAMETER(radius);
|
2009-08-09 05:32:17 +00:00
|
|
|
UNREFERENCED_PARAMETER(srcsprite);
|
|
|
|
UNREFERENCED_PARAMETER(zoffset);
|
2009-06-06 10:20:00 +00:00
|
|
|
UNREFERENCED_PARAMETER(range);
|
|
|
|
UNREFERENCED_PARAMETER(color);
|
|
|
|
UNREFERENCED_PARAMETER(priority);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
// sleeping monsters, etc
|
2010-01-24 23:33:17 +00:00
|
|
|
ACTOR_STATIC void G_MoveZombieActors(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t i = headspritestat[STAT_ZOMBIEACTOR], j;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
while (i >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
const int32_t nexti = nextspritestat[i];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t x;
|
|
|
|
spritetype *const s = &sprite[i];
|
|
|
|
const int32_t p = A_FindPlayer(s,&x);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
int16_t ssect = s->sectnum;
|
|
|
|
int16_t psect = s->sectnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-27 06:46:31 +00:00
|
|
|
if (sprite[g_player[p].ps->i].extra > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (x < 30000)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].timetosleep++;
|
|
|
|
if (actor[i].timetosleep >= (x>>8))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (A_CheckEnemySprite(s))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
const int32_t px = g_player[p].ps->opos.x+64-(krand()&127);
|
|
|
|
const int32_t py = g_player[p].ps->opos.y+64-(krand()&127);
|
|
|
|
int32_t sx, sy;
|
|
|
|
|
2006-12-02 06:00:49 +00:00
|
|
|
updatesector(px,py,&psect);
|
2006-11-13 23:12:47 +00:00
|
|
|
if (psect == -1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
i = nexti;
|
|
|
|
continue;
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
sx = s->x+64-(krand()&127);
|
|
|
|
sy = s->y+64-(krand()&127);
|
2006-12-02 06:00:49 +00:00
|
|
|
updatesector(px,py,&ssect);
|
2006-11-13 23:12:47 +00:00
|
|
|
if (ssect == -1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
i = nexti;
|
|
|
|
continue;
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
|
|
|
j = cansee(sx,sy,s->z-(krand()%(52<<8)),s->sectnum, px,py,
|
|
|
|
g_player[p].ps->opos.z-(krand()%(32<<8)),g_player[p].ps->cursectnum);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
2013-04-15 10:48:09 +00:00
|
|
|
j = cansee(s->x,s->y,s->z-((krand()&31)<<8),s->sectnum, g_player[p].ps->opos.x,g_player[p].ps->opos.y,
|
|
|
|
g_player[p].ps->opos.z-((krand()&31)<<8), g_player[p].ps->cursectnum);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-05-14 18:12:27 +00:00
|
|
|
if (j)
|
|
|
|
{
|
2012-05-14 22:45:40 +00:00
|
|
|
switch (DYNAMICTILEMAP(s->picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case RUBBERCAN__STATIC:
|
|
|
|
case EXPLODINGBARREL__STATIC:
|
|
|
|
case WOODENHORSE__STATIC:
|
|
|
|
case HORSEONSIDE__STATIC:
|
|
|
|
case CANWITHSOMETHING__STATIC:
|
|
|
|
case CANWITHSOMETHING2__STATIC:
|
|
|
|
case CANWITHSOMETHING3__STATIC:
|
|
|
|
case CANWITHSOMETHING4__STATIC:
|
|
|
|
case FIREBARREL__STATIC:
|
|
|
|
case FIREVASE__STATIC:
|
|
|
|
case NUKEBARREL__STATIC:
|
|
|
|
case NUKEBARRELDENTED__STATIC:
|
|
|
|
case NUKEBARRELLEAKED__STATIC:
|
|
|
|
case TRIPBOMB__STATIC:
|
2014-05-22 08:56:56 +00:00
|
|
|
if (sector[s->sectnum].ceilingstat&1 && A_CheckSpriteFlags(i,SFLAG_NOSHADE) == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
s->shade = sector[s->sectnum].ceilingshade;
|
|
|
|
else s->shade = sector[s->sectnum].floorshade;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].timetosleep = 0;
|
2012-05-05 22:24:33 +00:00
|
|
|
changespritestat(i, STAT_STANDABLE);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2009-04-23 07:09:24 +00:00
|
|
|
case RECON__STATIC:
|
|
|
|
CS |= 257;
|
2013-04-15 10:48:09 +00:00
|
|
|
// fall-through
|
2006-11-16 03:02:42 +00:00
|
|
|
default:
|
2014-02-22 19:38:52 +00:00
|
|
|
if (A_CheckSpriteFlags(i, SFLAG_USEACTIVATOR) && sector[sprite[i].sectnum].lotag & 16384)
|
2009-07-12 01:55:34 +00:00
|
|
|
break;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].timetosleep = 0;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlayAlertSound(i);
|
2009-04-24 06:04:13 +00:00
|
|
|
changespritestat(i, STAT_ACTOR);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-05-14 18:12:27 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else actor[i].timetosleep = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2014-02-22 19:38:52 +00:00
|
|
|
if (A_CheckEnemySprite(s) && A_CheckSpriteFlags(i,SFLAG_NOSHADE) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
if (sector[s->sectnum].ceilingstat&1)
|
|
|
|
s->shade = sector[s->sectnum].ceilingshade;
|
|
|
|
else s->shade = sector[s->sectnum].floorshade;
|
|
|
|
}
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
i = nexti;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-02 14:30:32 +00:00
|
|
|
// stupid name, but it's what the function does.
|
2014-11-22 12:29:25 +00:00
|
|
|
FORCE_INLINE int G_FindExplosionInSector(int sectnum)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
for (int SPRITES_OF(STAT_MISC, i))
|
2006-11-14 21:35:50 +00:00
|
|
|
if (PN == EXPLOSION2 && sectnum == SECT)
|
2006-04-13 20:47:06 +00:00
|
|
|
return i;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
FORCE_INLINE void P_Nudge(int p, int sn, int shl)
|
2012-08-10 19:11:49 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
g_player[p].ps->vel.x += actor[sn].extra * (sintable[(actor[sn].ang + 512) & 2047]) << shl;
|
|
|
|
g_player[p].ps->vel.y += actor[sn].extra * (sintable[actor[sn].ang & 2047]) << shl;
|
2012-08-10 19:11:49 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t A_IncurDamage(int32_t sn)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-10-05 20:48:10 +00:00
|
|
|
spritetype *const targ = &sprite[sn];
|
|
|
|
actor_t *const dmg = &actor[sn];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-03-29 15:59:23 +00:00
|
|
|
// dmg->picnum check: safety, since it might have been set to <0 from CON.
|
|
|
|
if (dmg->extra < 0 || targ->extra < 0 || dmg->picnum < 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-10-05 20:48:10 +00:00
|
|
|
dmg->extra = -1;
|
|
|
|
return -1;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
if (targ->picnum == APLAYER)
|
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
const int p = P_GetP(targ);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
if (ud.god && dmg->picnum != SHRINKSPARK)
|
|
|
|
return -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
if (dmg->owner >= 0 && ud.ffire == 0 && sprite[dmg->owner].picnum == APLAYER &&
|
|
|
|
(GametypeFlags[ud.coop] & GAMETYPE_PLAYERSFRIENDLY ||
|
2013-12-28 17:04:27 +00:00
|
|
|
(GametypeFlags[ud.coop] & GAMETYPE_TDM && g_player[p].ps->team == g_player[P_Get(dmg->owner)].ps->team)))
|
2012-10-05 20:48:10 +00:00
|
|
|
return -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
targ->extra -= dmg->extra;
|
2006-08-18 23:52:26 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
if (dmg->owner >= 0 && targ->extra <= 0 && dmg->picnum != FREEZEBLAST)
|
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
const int32_t ow = dmg->owner;
|
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
targ->extra = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-28 17:04:27 +00:00
|
|
|
g_player[p].ps->wackedbyactor = ow;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-28 17:04:27 +00:00
|
|
|
if (sprite[ow].picnum == APLAYER && p != P_Get(ow))
|
|
|
|
g_player[p].ps->frag_ps = P_Get(ow);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
dmg->owner = g_player[p].ps->i;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
switch (DYNAMICTILEMAP(dmg->picnum))
|
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
case RADIUSEXPLOSION__STATIC:
|
|
|
|
case RPG__STATIC:
|
|
|
|
case HYDRENT__STATIC:
|
|
|
|
case HEAVYHBOMB__STATIC:
|
|
|
|
case SEENINE__STATIC:
|
|
|
|
case OOZFILTER__STATIC:
|
|
|
|
case EXPLODINGBARREL__STATIC:
|
2012-10-05 20:48:10 +00:00
|
|
|
P_Nudge(p, sn, 2);
|
2014-11-22 12:29:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2016-02-02 00:21:17 +00:00
|
|
|
if (A_CheckSpriteFlags(dmg->owner, SFLAG_PROJECTILE) &&
|
|
|
|
(SpriteProjectile[dmg->owner].workslike & PROJECTILE_RPG))
|
2014-11-22 12:29:25 +00:00
|
|
|
P_Nudge(p, sn, 2);
|
|
|
|
else
|
|
|
|
P_Nudge(p, sn, 1);
|
|
|
|
break;
|
2012-10-05 20:48:10 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
dmg->extra = -1;
|
|
|
|
return dmg->picnum;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
if (dmg->extra == 0 && dmg->picnum == SHRINKSPARK && targ->xrepeat < 24)
|
|
|
|
return -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
targ->extra -= dmg->extra;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
if (targ->picnum != RECON && targ->owner >= 0 && sprite[targ->owner].statnum < MAXSTATUS)
|
|
|
|
targ->owner = dmg->owner;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
dmg->extra = -1;
|
2014-11-22 12:29:25 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
return dmg->picnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
void A_MoveCyclers(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-10-05 20:48:10 +00:00
|
|
|
int32_t i;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
for (i=g_numCyclers-1; i>=0; i--)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int16_t *const c = cyclers[i];
|
|
|
|
const int32_t sect = c[0];
|
|
|
|
const int32_t t = c[3];
|
|
|
|
int32_t j = t + (sintable[c[1]&2047]>>10);
|
2012-10-05 20:48:10 +00:00
|
|
|
int32_t cshade = c[2];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
if (j < cshade)
|
|
|
|
j = cshade;
|
|
|
|
else if (j > t)
|
|
|
|
j = t;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
c[1] += sector[sect].extra;
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (c[5])
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-10-05 20:48:10 +00:00
|
|
|
walltype *wal = &wall[sector[sect].wallptr];
|
|
|
|
int32_t x;
|
|
|
|
|
|
|
|
for (x = sector[sect].wallnum; x>0; x--,wal++)
|
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (wal->hitag != 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
wal->shade = j;
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if ((wal->cstat&2) && wal->nextwall >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
wall[wal->nextwall].shade = j;
|
|
|
|
}
|
2012-10-05 20:48:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sector[sect].floorshade = sector[sect].ceilingshade = j;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
void A_MoveDummyPlayers(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t i = headspritestat[STAT_DUMMYPLAYER];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
while (i >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
const int32_t p = P_Get(OW);
|
2012-08-10 19:11:56 +00:00
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
2012-02-14 23:13:38 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
const int32_t nexti = nextspritestat[i];
|
|
|
|
const int32_t psectnum = ps->cursectnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (ps->on_crane >= 0 || (psectnum >= 0 && sector[psectnum].lotag != ST_1_ABOVE_WATER) || sprite[ps->i].extra <= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->dummyplayersprite = -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-10-14 20:41:21 +00:00
|
|
|
if (ps->on_ground && ps->on_warping_sector == 1 && psectnum >= 0 && sector[psectnum].lotag == ST_1_ABOVE_WATER)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
CS = 257;
|
|
|
|
SZ = sector[SECT].ceilingz+(27<<8);
|
2012-08-10 19:11:56 +00:00
|
|
|
SA = ps->ang;
|
2006-11-13 23:12:47 +00:00
|
|
|
if (T1 == 8)
|
2006-04-13 20:47:06 +00:00
|
|
|
T1 = 0;
|
|
|
|
else T1++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[SECT].lotag != ST_2_UNDERWATER) SZ = sector[SECT].floorz;
|
2012-11-18 19:01:34 +00:00
|
|
|
CS = 32768;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
SX += (ps->pos.x-ps->opos.x);
|
|
|
|
SY += (ps->pos.y-ps->opos.y);
|
2012-10-14 20:41:25 +00:00
|
|
|
setsprite(i, (vec3_t *)&sprite[i]);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
BOLT:
|
|
|
|
i = nexti;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-14 20:41:17 +00:00
|
|
|
|
|
|
|
static int32_t P_Submerge(int32_t j, int32_t p, DukePlayer_t *ps, int32_t sect, int32_t othersect);
|
|
|
|
static int32_t P_Emerge(int32_t j, int32_t p, DukePlayer_t *ps, int32_t sect, int32_t othersect);
|
|
|
|
static void P_FinishWaterChange(int32_t j, DukePlayer_t *ps, int32_t sectlotag, int32_t ow, int32_t newsectnum);
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
ACTOR_STATIC void G_MovePlayers(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
int32_t i = headspritestat[STAT_PLAYER];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
while (i >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
const int32_t nexti = nextspritestat[i];
|
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
spritetype *const s = &sprite[i];
|
2013-12-28 17:04:27 +00:00
|
|
|
DukePlayer_t *const p = g_player[P_GetP(s)].ps;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->owner >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (p->newowner >= 0) //Looking thru the camera
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
s->x = p->opos.x;
|
|
|
|
s->y = p->opos.y;
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[i].bpos.z = s->z = p->opos.z+PHEIGHT;
|
2006-04-13 20:47:06 +00:00
|
|
|
s->ang = p->oang;
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-10-14 20:41:17 +00:00
|
|
|
int32_t otherx;
|
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
// TROR water submerge/emerge
|
|
|
|
const int32_t psect=s->sectnum, slotag=sector[psect].lotag;
|
2013-04-15 10:48:05 +00:00
|
|
|
int32_t othersect;
|
2012-10-14 20:41:17 +00:00
|
|
|
|
2013-04-15 10:48:05 +00:00
|
|
|
if (A_CheckNoSE7Water(s, psect, slotag, &othersect))
|
2012-10-14 20:41:17 +00:00
|
|
|
{
|
2013-04-15 10:48:05 +00:00
|
|
|
int32_t k = 0;
|
2013-04-15 10:48:00 +00:00
|
|
|
|
2013-04-15 10:48:05 +00:00
|
|
|
// NOTE: Compare with G_MoveTransports().
|
|
|
|
p->on_warping_sector = 1;
|
2012-10-14 20:41:17 +00:00
|
|
|
|
2013-04-15 10:48:05 +00:00
|
|
|
if (slotag==ST_1_ABOVE_WATER)
|
2013-12-28 17:04:27 +00:00
|
|
|
k = P_Submerge(i, P_GetP(s), p, psect, othersect);
|
2013-04-15 10:48:05 +00:00
|
|
|
else
|
2013-12-28 17:04:27 +00:00
|
|
|
k = P_Emerge(i, P_GetP(s), p, psect, othersect);
|
2012-10-14 20:41:17 +00:00
|
|
|
|
2013-04-15 10:48:05 +00:00
|
|
|
if (k == 1)
|
|
|
|
P_FinishWaterChange(i, p, slotag, -1, othersect);
|
2012-10-14 20:41:17 +00:00
|
|
|
}
|
|
|
|
#endif
|
2012-08-19 12:54:30 +00:00
|
|
|
if (g_netServer || ud.multimode > 1)
|
2013-12-28 17:04:27 +00:00
|
|
|
otherp = P_FindOtherPlayer(P_GetP(s), &otherx);
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
otherp = P_GetP(s);
|
2006-04-13 20:47:06 +00:00
|
|
|
otherx = 0;
|
|
|
|
}
|
|
|
|
|
2012-12-29 15:21:28 +00:00
|
|
|
if (G_HaveActor(sprite[i].picnum))
|
2013-12-28 17:04:27 +00:00
|
|
|
A_Execute(i, P_GetP(s), otherx);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-19 12:54:30 +00:00
|
|
|
if (g_netServer || ud.multimode > 1)
|
2007-08-27 06:46:31 +00:00
|
|
|
if (sprite[g_player[otherp].ps->i].extra > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2007-08-27 06:46:31 +00:00
|
|
|
if (s->yrepeat > 32 && sprite[g_player[otherp].ps->i].yrepeat < 32)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (otherx < 1400 && p->knee_incs == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
p->knee_incs = 1;
|
|
|
|
p->weapon_pos = -1;
|
2007-08-27 06:46:31 +00:00
|
|
|
p->actorsqu = g_player[otherp].ps->i;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (ud.god)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2007-08-27 23:11:49 +00:00
|
|
|
s->extra = p->max_player_health;
|
2006-04-13 20:47:06 +00:00
|
|
|
s->cstat = 257;
|
2015-11-25 12:08:31 +00:00
|
|
|
if (!WW2GI)
|
|
|
|
p->inv_amount[GET_JETPACK] = 1599;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->extra > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].owner = i;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (ud.god == 0)
|
2008-11-20 14:06:36 +00:00
|
|
|
if (G_CheckForSpaceCeiling(s->sectnum) || G_CheckForSpaceFloor(s->sectnum))
|
|
|
|
P_QuickKill(p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->pos.x = s->x;
|
|
|
|
p->pos.y = s->y;
|
|
|
|
p->pos.z = s->z-(20<<8);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
p->newowner = -1;
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (p->wackedbyactor >= 0 && sprite[p->wackedbyactor].statnum < MAXSTATUS)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->ang += G_GetAngleDelta(p->ang,getangle(sprite[p->wackedbyactor].x-p->pos.x,sprite[p->wackedbyactor].y-p->pos.y))>>1;
|
2006-04-13 20:47:06 +00:00
|
|
|
p->ang &= 2047;
|
|
|
|
}
|
|
|
|
}
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
s->ang = p->ang;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->holoduke_on == -1)
|
2006-04-13 20:47:06 +00:00
|
|
|
KILLIT(i);
|
|
|
|
|
2013-11-04 18:21:07 +00:00
|
|
|
Bmemcpy(&actor[i].bpos, s, sizeof(vec3_t));
|
2006-04-13 20:47:06 +00:00
|
|
|
s->cstat = 0;
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->xrepeat < 42)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
s->xrepeat += 4;
|
|
|
|
s->cstat |= 2;
|
|
|
|
}
|
|
|
|
else s->xrepeat = 42;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->yrepeat < 36)
|
2006-04-13 20:47:06 +00:00
|
|
|
s->yrepeat += 4;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s->yrepeat = 36;
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[s->sectnum].lotag != ST_2_UNDERWATER)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
2012-10-14 20:41:21 +00:00
|
|
|
if (s->zvel == 0 && sector[s->sectnum].lotag == ST_1_ABOVE_WATER)
|
2006-04-13 20:47:06 +00:00
|
|
|
s->z += (32<<8);
|
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->extra < 8)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
s->xvel = 128;
|
|
|
|
s->ang = p->ang;
|
|
|
|
s->extra++;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SetSprite(i,CLIPMASK0);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s->ang = 2047-p->ang;
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sector[s->sectnum].ceilingstat&1)
|
2014-03-23 14:29:09 +00:00
|
|
|
s->shade = logapproach(s->shade, sector[s->sectnum].ceilingshade);
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
2014-03-23 14:29:09 +00:00
|
|
|
s->shade = logapproach(s->shade, sector[s->sectnum].floorshade);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
BOLT:
|
|
|
|
i = nexti;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
ACTOR_STATIC void G_MoveFX(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-13 18:25:59 +00:00
|
|
|
int32_t i = headspritestat[STAT_FX];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
while (i >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-13 18:25:59 +00:00
|
|
|
spritetype *const s = &sprite[i];
|
|
|
|
const int32_t nexti = nextspritestat[i];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(s->picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case RESPAWN__STATIC:
|
|
|
|
if (sprite[i].extra == 66)
|
|
|
|
{
|
2012-08-13 18:25:59 +00:00
|
|
|
/*int32_t j =*/ A_Spawn(i,SHT);
|
2006-11-16 03:02:42 +00:00
|
|
|
// sprite[j].pal = sprite[i].pal;
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
else if (sprite[i].extra > (66-13))
|
|
|
|
sprite[i].extra++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MUSICANDSFX__STATIC:
|
2012-08-13 18:25:53 +00:00
|
|
|
{
|
|
|
|
const int32_t ht = s->hitag;
|
2012-08-13 18:25:59 +00:00
|
|
|
DukePlayer_t *const peekps = g_player[screenpeek].ps;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
if (T2 != ud.config.SoundToggle)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-05-28 19:52:51 +00:00
|
|
|
// If sound playback was toggled, restart.
|
2007-08-27 00:20:15 +00:00
|
|
|
T2 = ud.config.SoundToggle;
|
2006-11-16 03:02:42 +00:00
|
|
|
T1 = 0;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->lotag >= 1000 && s->lotag < 2000)
|
|
|
|
{
|
2012-08-13 18:25:59 +00:00
|
|
|
int32_t x = ldist(&sprite[peekps->i],s);
|
2012-08-13 18:25:53 +00:00
|
|
|
|
2014-01-12 14:04:51 +00:00
|
|
|
#ifdef SPLITSCREEN_MOD_HACKS
|
2012-08-22 22:51:38 +00:00
|
|
|
if (g_fakeMultiMode==2)
|
2012-08-13 18:25:53 +00:00
|
|
|
{
|
|
|
|
// HACK for splitscreen mod
|
|
|
|
int32_t otherdist = ldist(&sprite[g_player[1].ps->i],s);
|
|
|
|
x = min(x, otherdist);
|
|
|
|
}
|
2014-01-12 14:04:51 +00:00
|
|
|
#endif
|
2012-08-13 18:25:53 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x < ht && T1 == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
FX_SetReverb(s->lotag - 1000);
|
|
|
|
T1 = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x >= ht && T1 == 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
FX_SetReverb(0);
|
|
|
|
FX_SetReverbDelay(0);
|
|
|
|
T1 = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2012-09-08 22:18:44 +00:00
|
|
|
else if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 && // ST_9_SLIDING_ST_DOOR
|
2012-08-13 18:25:59 +00:00
|
|
|
ud.config.AmbienceToggle && sector[SECT].floorz != sector[SECT].ceilingz)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-09-08 20:18:56 +00:00
|
|
|
if (g_sounds[s->lotag].m & SF_MSFX)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-13 18:25:59 +00:00
|
|
|
int32_t x = dist(&sprite[peekps->i],s);
|
2012-08-13 18:25:53 +00:00
|
|
|
|
2014-01-12 14:04:51 +00:00
|
|
|
#ifdef SPLITSCREEN_MOD_HACKS
|
2012-08-22 22:51:38 +00:00
|
|
|
if (g_fakeMultiMode==2)
|
2012-08-13 18:25:53 +00:00
|
|
|
{
|
|
|
|
// HACK for splitscreen mod
|
|
|
|
int32_t otherdist = dist(&sprite[g_player[1].ps->i],s);
|
|
|
|
x = min(x, otherdist);
|
|
|
|
}
|
2014-01-12 14:04:51 +00:00
|
|
|
#endif
|
2012-08-13 18:25:53 +00:00
|
|
|
|
2007-09-11 05:26:38 +00:00
|
|
|
if (x < ht && T1 == 0 && FX_VoiceAvailable(g_sounds[s->lotag].pr-1))
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2013-05-28 19:52:51 +00:00
|
|
|
// Start playing an ambience sound.
|
|
|
|
|
2012-12-29 10:58:09 +00:00
|
|
|
char om = g_sounds[s->lotag].m;
|
2008-11-20 14:06:36 +00:00
|
|
|
if (g_numEnvSoundsPlaying == ud.config.NumVoices)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2012-08-13 18:25:59 +00:00
|
|
|
int32_t j;
|
|
|
|
|
|
|
|
for (SPRITES_OF(STAT_FX, j))
|
2013-04-15 10:48:13 +00:00
|
|
|
if (j != i && S_IsAmbientSFX(j) && actor[j].t_data[0] == 1 &&
|
2012-08-13 18:25:59 +00:00
|
|
|
dist(&sprite[j], &sprite[peekps->i]) > x)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
S_StopEnvSound(sprite[j].lotag,j);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2012-08-13 18:25:59 +00:00
|
|
|
|
|
|
|
if (j == -1)
|
|
|
|
goto BOLT;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2012-08-13 18:25:59 +00:00
|
|
|
|
2013-09-08 20:18:56 +00:00
|
|
|
g_sounds[s->lotag].m |= SF_LOOP;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(s->lotag,i);
|
2012-12-29 10:58:09 +00:00
|
|
|
g_sounds[s->lotag].m = om;
|
2014-02-22 19:38:53 +00:00
|
|
|
T1 = 1; // AMBIENT_SFX_PLAYING
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2012-08-13 18:25:59 +00:00
|
|
|
else if (x >= ht && T1 == 1)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2013-05-28 19:52:51 +00:00
|
|
|
// Stop playing ambience sound because we're out of its range.
|
|
|
|
|
2014-02-22 19:38:53 +00:00
|
|
|
// T1 will be reset in sounds.c: CLEAR_SOUND_T0
|
2010-02-23 18:13:46 +00:00
|
|
|
// T1 = 0;
|
2008-11-20 14:06:36 +00:00
|
|
|
S_StopEnvSound(s->lotag,i);
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-08-13 18:25:59 +00:00
|
|
|
|
2013-09-08 20:18:56 +00:00
|
|
|
if (g_sounds[s->lotag].m & SF_GLOBAL)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-08-13 18:25:59 +00:00
|
|
|
// Randomly playing global sounds (flyby of planes, screams, ...)
|
|
|
|
|
|
|
|
if (T5 > 0)
|
|
|
|
T5--;
|
2008-11-20 14:06:36 +00:00
|
|
|
else
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
int32_t p;
|
2012-02-21 19:33:33 +00:00
|
|
|
for (TRAVERSE_CONNECT(p))
|
|
|
|
if (p == myconnectindex && g_player[p].ps->cursectnum == s->sectnum)
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
S_PlaySound(s->lotag + (unsigned)g_globalRandom % (s->hitag+1));
|
|
|
|
T5 = GAMETICSPERSEC*40 + g_globalRandom%(GAMETICSPERSEC*40);
|
2012-02-21 19:33:33 +00:00
|
|
|
}
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-08-13 18:25:53 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
BOLT:
|
|
|
|
i = nexti;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
ACTOR_STATIC void G_MoveFallers(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t i = headspritestat[STAT_FALLER];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
while (i >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
const int32_t nexti = nextspritestat[i];
|
|
|
|
spritetype *const s = &sprite[i];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
const int32_t sect = s->sectnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (T1 == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t j;
|
|
|
|
const int32_t oextra = s->extra;
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
s->z -= (16<<8);
|
|
|
|
T2 = s->ang;
|
2011-02-25 21:50:19 +00:00
|
|
|
if ((j = A_IncurDamage(i)) >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER)
|
2007-08-25 01:05:00 +00:00
|
|
|
{
|
|
|
|
if (s->extra <= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
T1 = 1;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
|
|
|
for (SPRITES_OF(STAT_FALLER, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (sprite[j].hitag == SHT)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].t_data[0] = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
sprite[j].cstat &= (65535-64);
|
2006-11-13 23:12:47 +00:00
|
|
|
if (sprite[j].picnum == CEILINGSTEAM || sprite[j].picnum == STEAM)
|
2006-04-13 20:47:06 +00:00
|
|
|
sprite[j].cstat |= 32768;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].extra = 0;
|
2013-04-15 10:48:09 +00:00
|
|
|
s->extra = oextra;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
s->ang = T2;
|
|
|
|
s->z += (16<<8);
|
|
|
|
}
|
2006-11-13 23:12:47 +00:00
|
|
|
else if (T1 == 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-11-18 19:01:29 +00:00
|
|
|
if ((int16_t)s->lotag > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
s->lotag-=3;
|
2012-11-18 19:01:29 +00:00
|
|
|
if ((int16_t)s->lotag <= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
s->xvel = (32+(krand()&63));
|
|
|
|
s->zvel = -(1024+(krand()&1023));
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t x;
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->xvel > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
s->xvel -= 8;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SetSprite(i,CLIPMASK0);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2014-10-29 17:05:46 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(G_CheckForSpaceFloor(s->sectnum)))
|
2008-11-24 09:22:07 +00:00
|
|
|
x = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
|
|
|
{
|
2014-10-29 17:05:46 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(G_CheckForSpaceCeiling(s->sectnum)))
|
2008-11-24 09:22:07 +00:00
|
|
|
x = g_spriteGravity/6;
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
2008-11-24 09:22:07 +00:00
|
|
|
x = g_spriteGravity;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
if (s->z < (sector[sect].floorz-ZOFFSET))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
s->zvel += x;
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->zvel > 6144)
|
2006-04-13 20:47:06 +00:00
|
|
|
s->zvel = 6144;
|
|
|
|
s->z += s->zvel;
|
|
|
|
}
|
2006-11-14 21:35:50 +00:00
|
|
|
if ((sector[sect].floorz-s->z) < (16<<8))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t j = 1+(krand()&7);
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=0; x<j; x++) RANDOMSCRAP;
|
2006-04-13 20:47:06 +00:00
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BOLT:
|
|
|
|
i = nexti;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
ACTOR_STATIC void G_MoveStandables(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t i = headspritestat[STAT_STANDABLE], j, switchpicnum;
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t l=0, x;
|
2012-03-11 17:37:50 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
while (i >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
const int32_t nexti = nextspritestat[i];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t *const t = &actor[i].t_data[0];
|
|
|
|
spritetype *const s = &sprite[i];
|
|
|
|
const int32_t sect = s->sectnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-04-13 10:46:04 +00:00
|
|
|
if (sect < 0)
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:18 +00:00
|
|
|
// Rotation-fixed sprites in rotating sectors already have bpos* updated.
|
2012-12-23 19:24:21 +00:00
|
|
|
if ((t[7]&(0xffff0000))!=ROTFIXSPR_MAGIC)
|
2013-11-04 18:21:07 +00:00
|
|
|
Bmemcpy(&actor[i].bpos, s, sizeof(vec3_t));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-05 17:53:25 +00:00
|
|
|
if (PN >= CRANE && PN <= CRANE+3)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t nextj;
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
//t[0] = state
|
|
|
|
//t[1] = checking sector number
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (s->xvel) A_GetZLimits(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (t[0] == 0) //Waiting to check the sector
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT_SAFE(t[1], j, nextj))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
switch (sprite[j].statnum)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-08-06 10:12:13 +00:00
|
|
|
case STAT_ACTOR:
|
|
|
|
case STAT_ZOMBIEACTOR:
|
|
|
|
case STAT_STANDABLE:
|
|
|
|
case STAT_PLAYER:
|
2013-04-15 10:48:09 +00:00
|
|
|
{
|
2016-01-21 19:35:30 +00:00
|
|
|
vec3_t vect = { g_origins[t[4]+1].x, g_origins[t[4]+1].y, sprite[j].z };
|
2009-01-13 12:23:18 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
s->ang = getangle(vect.x-s->x, vect.y-s->y);
|
|
|
|
setsprite(j, &vect);
|
|
|
|
t[0]++;
|
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
else if (t[0]==1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->xvel < 184)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
s->picnum = CRANE+1;
|
|
|
|
s->xvel += 8;
|
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SetSprite(i,CLIPMASK0);
|
2006-11-13 23:12:47 +00:00
|
|
|
if (sect == t[1])
|
2006-04-13 20:47:06 +00:00
|
|
|
t[0]++;
|
|
|
|
}
|
2006-11-13 23:12:47 +00:00
|
|
|
else if (t[0]==2 || t[0]==7)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
s->z += (1024+512);
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (t[0]==2)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (sector[sect].floorz - s->z < (64<<8))
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->picnum > CRANE) s->picnum--;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
if (sector[sect].floorz - s->z < 4096+1024)
|
2006-04-13 20:47:06 +00:00
|
|
|
t[0]++;
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (t[0]==7)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (sector[sect].floorz - s->z < (64<<8))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->picnum > CRANE) s->picnum--;
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->owner==-2)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:13 +00:00
|
|
|
int32_t p = A_FindPlayer(s, NULL);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(DUKE_GRUNT,g_player[p].ps->i);
|
2007-08-27 06:46:31 +00:00
|
|
|
if (g_player[p].ps->on_crane == i)
|
|
|
|
g_player[p].ps->on_crane = -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
t[0]++;
|
|
|
|
s->owner = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-11-13 23:12:47 +00:00
|
|
|
else if (t[0]==3)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
s->picnum++;
|
2013-04-15 10:48:09 +00:00
|
|
|
if (s->picnum == CRANE+2)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
int32_t p = G_CheckPlayerInSector(t[1]);
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2007-08-27 06:46:31 +00:00
|
|
|
if (p >= 0 && g_player[p].ps->on_ground)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
s->owner = -2;
|
2007-08-27 06:46:31 +00:00
|
|
|
g_player[p].ps->on_crane = i;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(DUKE_GRUNT,g_player[p].ps->i);
|
2007-08-27 06:46:31 +00:00
|
|
|
g_player[p].ps->ang = s->ang+1024;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(t[1], j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
switch (sprite[j].statnum)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-08-06 10:12:13 +00:00
|
|
|
case STAT_ACTOR:
|
|
|
|
case STAT_STANDABLE:
|
2006-11-16 03:02:42 +00:00
|
|
|
s->owner = j;
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
t[0]++;//Grabbed the sprite
|
|
|
|
t[2]=0;
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
}
|
2006-11-13 23:12:47 +00:00
|
|
|
else if (t[0]==4) //Delay before going up
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
t[2]++;
|
2006-11-13 23:12:47 +00:00
|
|
|
if (t[2] > 10)
|
2006-04-13 20:47:06 +00:00
|
|
|
t[0]++;
|
|
|
|
}
|
2006-11-13 23:12:47 +00:00
|
|
|
else if (t[0]==5 || t[0] == 8)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (t[0]==8 && s->picnum < (CRANE+2))
|
2006-11-14 21:35:50 +00:00
|
|
|
if ((sector[sect].floorz-s->z) > 8192)
|
2006-04-13 20:47:06 +00:00
|
|
|
s->picnum++;
|
|
|
|
|
2016-01-21 19:35:30 +00:00
|
|
|
if (s->z < g_origins[t[4]+2].x)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
t[0]++;
|
|
|
|
s->xvel = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
s->z -= (1024+512);
|
|
|
|
}
|
2006-11-13 23:12:47 +00:00
|
|
|
else if (t[0]==6)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->xvel < 192)
|
2006-04-13 20:47:06 +00:00
|
|
|
s->xvel += 8;
|
2016-01-21 19:35:30 +00:00
|
|
|
s->ang = getangle(g_origins[t[4]].x - s->x, g_origins[t[4]].y - s->y);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SetSprite(i,CLIPMASK0);
|
2016-01-21 19:35:30 +00:00
|
|
|
if (((s->x-g_origins[t[4]].x)*(s->x-g_origins[t[4]].x)+(s->y-g_origins[t[4]].y)*(s->y-g_origins[t[4]].y)) < (128*128))
|
2006-04-13 20:47:06 +00:00
|
|
|
t[0]++;
|
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
else if (t[0]==9)
|
2006-04-13 20:47:06 +00:00
|
|
|
t[0] = 0;
|
|
|
|
|
2009-01-13 12:23:18 +00:00
|
|
|
{
|
|
|
|
vec3_t vect;
|
|
|
|
Bmemcpy(&vect,s,sizeof(vec3_t));
|
|
|
|
vect.z -= (34<<8);
|
2016-01-21 19:35:30 +00:00
|
|
|
setsprite(g_origins[t[4]+2].y, &vect);
|
2009-01-13 12:23:18 +00:00
|
|
|
}
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->owner != -1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:13 +00:00
|
|
|
int32_t p = A_FindPlayer(s, NULL);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:13 +00:00
|
|
|
if (A_IncurDamage(i) >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->owner == -2)
|
2007-08-27 06:46:31 +00:00
|
|
|
if (g_player[p].ps->on_crane == i)
|
|
|
|
g_player[p].ps->on_crane = -1;
|
2007-08-25 01:05:00 +00:00
|
|
|
s->owner = -1;
|
|
|
|
s->picnum = CRANE;
|
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-25 01:05:00 +00:00
|
|
|
if (s->owner >= 0)
|
|
|
|
{
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(s->owner,(vec3_t *)s);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-11-04 18:21:07 +00:00
|
|
|
Bmemcpy(&actor[s->owner].bpos, s, sizeof(vec3_t));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-25 01:05:00 +00:00
|
|
|
s->zvel = 0;
|
|
|
|
}
|
|
|
|
else if (s->owner == -2)
|
|
|
|
{
|
2012-08-10 19:11:53 +00:00
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
2009-01-13 12:23:18 +00:00
|
|
|
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->opos.x = ps->pos.x = s->x-(sintable[(ps->ang+512)&2047]>>6);
|
|
|
|
ps->opos.y = ps->pos.y = s->y-(sintable[ps->ang&2047]>>6);
|
|
|
|
ps->opos.z = ps->pos.z = s->z+(2<<8);
|
|
|
|
|
|
|
|
setsprite(ps->i, (vec3_t *)ps);
|
|
|
|
ps->cursectnum = sprite[ps->i].sectnum;
|
2007-08-25 01:05:00 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
|
2013-04-05 17:53:25 +00:00
|
|
|
if (PN >= WATERFOUNTAIN && PN <= WATERFOUNTAIN+3)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (t[0] > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (t[0] < 20)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
t[0]++;
|
|
|
|
|
|
|
|
s->picnum++;
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->picnum == (WATERFOUNTAIN+3))
|
2006-04-13 20:47:06 +00:00
|
|
|
s->picnum = WATERFOUNTAIN+1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
A_FindPlayer(s,&x);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (x > 512)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
t[0] = 0;
|
|
|
|
s->picnum = WATERFOUNTAIN;
|
|
|
|
}
|
|
|
|
else t[0] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (AFLAMABLE(s->picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (T1 == 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
T2++;
|
2006-11-14 21:35:50 +00:00
|
|
|
if ((T2&3) > 0) goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->picnum == TIRE && T2 == 32)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
s->cstat = 0;
|
2008-11-20 14:06:36 +00:00
|
|
|
j = A_Spawn(i,BLOODPOOL);
|
2006-04-13 20:47:06 +00:00
|
|
|
sprite[j].shade = 127;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->shade < 64) s->shade++;
|
2006-04-13 20:47:06 +00:00
|
|
|
else KILLIT(i);
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
j = s->xrepeat-(krand()&7);
|
2006-11-13 23:12:47 +00:00
|
|
|
if (j < 10)
|
2006-04-13 20:47:06 +00:00
|
|
|
KILLIT(i);
|
|
|
|
|
|
|
|
s->xrepeat = j;
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
j = s->yrepeat-(krand()&7);
|
2006-11-15 01:16:55 +00:00
|
|
|
if (j < 4)
|
|
|
|
KILLIT(i);
|
2012-04-13 10:46:04 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
s->yrepeat = j;
|
|
|
|
}
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->picnum == BOX)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].ceilingz = sector[s->sectnum].ceilingz;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->picnum == TRIPBOMB)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-12 14:54:34 +00:00
|
|
|
// TIMER_CONTROL
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[i].t_data[6] == 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[i].t_data[7] >= 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].t_data[7]--;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[i].t_data[7] <= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
T3=16;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].t_data[6]=3;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(LASERTRIP_ARMING,i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
// we're on a timer....
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
if (T3 > 0 && actor[i].t_data[6] == 3)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
T3--;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (T3 == 8)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=0; j<5; j++) RANDOMSCRAP;
|
2006-04-13 20:47:06 +00:00
|
|
|
x = s->extra;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_RadiusDamage(i, g_tripbombBlastRadius, x>>2,x>>1,x-(x>>2),x);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
j = A_Spawn(i,EXPLOSION2);
|
2010-07-03 08:53:57 +00:00
|
|
|
A_PlaySound(LASERTRIP_EXPLODE,j);
|
2006-04-13 20:47:06 +00:00
|
|
|
sprite[j].ang = s->ang;
|
|
|
|
sprite[j].xvel = 348;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SetSprite(j,CLIPMASK0);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_MISC, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (sprite[j].picnum == LASERLINE && s->hitag == sprite[j].hitag)
|
2006-04-13 20:47:06 +00:00
|
|
|
sprite[j].xrepeat = sprite[j].yrepeat = 0;
|
|
|
|
}
|
2012-04-13 10:46:04 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
const int32_t oextra = s->extra;
|
2006-04-13 20:47:06 +00:00
|
|
|
s->extra = 1;
|
|
|
|
l = s->ang;
|
2013-04-15 10:48:09 +00:00
|
|
|
if (A_IncurDamage(i) >= 0)
|
|
|
|
{
|
|
|
|
actor[i].t_data[6] = 3;
|
|
|
|
T3 = 16;
|
|
|
|
}
|
|
|
|
s->extra = oextra;
|
2006-04-13 20:47:06 +00:00
|
|
|
s->ang = l;
|
|
|
|
}
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
switch (T1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
default:
|
2012-08-10 19:11:56 +00:00
|
|
|
A_FindPlayer(s,&x);
|
2010-05-02 23:27:30 +00:00
|
|
|
if (x > 768 || T1 > 16) T1++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 32:
|
2013-04-15 10:48:13 +00:00
|
|
|
{
|
|
|
|
int16_t m;
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
l = s->ang;
|
|
|
|
s->ang = T6;
|
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
T4 = s->x;
|
|
|
|
T5 = s->y;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
s->x += sintable[(T6+512)&2047]>>9;
|
|
|
|
s->y += sintable[(T6)&2047]>>9;
|
|
|
|
s->z -= (3<<8);
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:13 +00:00
|
|
|
x = A_CheckHitSprite(i, &m);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].lastvx = x;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
s->ang = l;
|
|
|
|
|
|
|
|
// if(lTripBombControl & TRIPBOMB_TRIPWIRE)
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[i].t_data[6] != 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
// we're on a trip wire
|
2011-10-10 00:07:00 +00:00
|
|
|
int16_t cursectnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
while (x > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
j = A_Spawn(i,LASERLINE);
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(j,(vec3_t *)&sprite[j]);
|
2006-04-13 20:47:06 +00:00
|
|
|
sprite[j].hitag = s->hitag;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].t_data[1] = sprite[j].z;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
s->x += sintable[(T6+512)&2047]>>4;
|
|
|
|
s->y += sintable[(T6)&2047]>>4;
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (x < 1024)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
sprite[j].xrepeat = x>>5;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
x -= 1024;
|
2011-10-10 00:07:00 +00:00
|
|
|
|
|
|
|
cursectnum = s->sectnum;
|
|
|
|
updatesector(s->x, s->y, &cursectnum);
|
|
|
|
if (cursectnum < 0)
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
T1++;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
s->x = T4;
|
|
|
|
s->y = T5;
|
2006-04-13 20:47:06 +00:00
|
|
|
s->z += (3<<8);
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2010-05-02 23:27:30 +00:00
|
|
|
T4 = T3 = 0;
|
|
|
|
|
|
|
|
if (m >= 0 && actor[i].t_data[6] != 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].t_data[6] = 3;
|
2006-04-13 20:47:06 +00:00
|
|
|
T3 = 13;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(LASERTRIP_ARMING,i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
break;
|
2013-04-15 10:48:13 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
case 33:
|
|
|
|
T2++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
T4 = s->x;
|
|
|
|
T5 = s->y;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
s->x += sintable[(T6+512)&2047]>>9;
|
|
|
|
s->y += sintable[(T6)&2047]>>9;
|
|
|
|
s->z -= (3<<8);
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:13 +00:00
|
|
|
x = A_CheckHitSprite(i, NULL);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
s->x = T4;
|
|
|
|
s->y = T5;
|
2006-04-13 20:47:06 +00:00
|
|
|
s->z += (3<<8);
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
// if( Actor[i].lastvx != x && lTripBombControl & TRIPBOMB_TRIPWIRE)
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[i].lastvx != x && actor[i].t_data[6] != 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].t_data[6] = 3;
|
2006-04-13 20:47:06 +00:00
|
|
|
T3 = 13;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(LASERTRIP_ARMING,i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->picnum >= CRACK1 && s->picnum <= CRACK4)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->hitag > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:15 +00:00
|
|
|
int32_t k;
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
t[0] = s->cstat;
|
|
|
|
t[1] = s->ang;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2013-04-15 10:48:15 +00:00
|
|
|
k = A_IncurDamage(i);
|
2013-05-10 12:31:33 +00:00
|
|
|
if (k < 0)
|
|
|
|
goto crack_default;
|
2013-04-15 10:48:15 +00:00
|
|
|
|
2013-05-10 12:31:33 +00:00
|
|
|
switch (DYNAMICTILEMAP(k))
|
|
|
|
{
|
|
|
|
case FIREEXT__STATIC:
|
|
|
|
case RPG__STATIC:
|
|
|
|
case RADIUSEXPLOSION__STATIC:
|
|
|
|
case SEENINE__STATIC:
|
|
|
|
case OOZFILTER__STATIC:
|
|
|
|
for (SPRITES_OF(STAT_STANDABLE, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-05-10 12:31:33 +00:00
|
|
|
if (s->hitag == sprite[j].hitag && (sprite[j].picnum == OOZFILTER || sprite[j].picnum == SEENINE))
|
|
|
|
if (sprite[j].shade != -32)
|
|
|
|
sprite[j].shade = -32;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-05-10 12:31:33 +00:00
|
|
|
goto DETONATE;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2013-05-10 12:31:33 +00:00
|
|
|
crack_default:
|
|
|
|
default:
|
|
|
|
s->cstat = t[0];
|
|
|
|
s->ang = t[1];
|
|
|
|
s->extra = 0;
|
2013-04-15 10:48:15 +00:00
|
|
|
|
2013-05-10 12:31:33 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->picnum == FIREEXT)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t k;
|
|
|
|
|
2013-03-29 15:59:23 +00:00
|
|
|
if (A_IncurDamage(i) < 0)
|
2012-10-05 20:48:10 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (k=0; k<16; k++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
j = A_InsertSprite(SECT,SX,SY,SZ-(krand()%(48<<8)),SCRAP3+(krand()&3),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(sprite[i].zvel>>2),i,5);
|
2006-04-13 20:47:06 +00:00
|
|
|
sprite[j].pal = 2;
|
|
|
|
}
|
|
|
|
|
2010-07-03 08:53:57 +00:00
|
|
|
j = A_Spawn(i,EXPLOSION2);
|
|
|
|
A_PlaySound(PIPEBOMB_EXPLODE,j);
|
|
|
|
A_PlaySound(GLASS_HEAVYBREAK,j);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-11-18 19:01:29 +00:00
|
|
|
if ((int16_t)s->hitag > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_STANDABLE, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
// XXX: This block seems to be CODEDUP'd a lot of times.
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->hitag == sprite[j].hitag && (sprite[j].picnum == OOZFILTER || sprite[j].picnum == SEENINE))
|
2006-11-13 23:12:47 +00:00
|
|
|
if (sprite[j].shade != -32)
|
2006-04-13 20:47:06 +00:00
|
|
|
sprite[j].shade = -32;
|
|
|
|
}
|
|
|
|
|
|
|
|
x = s->extra;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_RadiusDamage(i, g_pipebombBlastRadius,x>>2, x-(x>>1),x-(x>>2), x);
|
2010-07-03 08:53:57 +00:00
|
|
|
j = A_Spawn(i,EXPLOSION2);
|
|
|
|
A_PlaySound(PIPEBOMB_EXPLODE,j);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
goto DETONATE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_RadiusDamage(i,g_seenineBlastRadius,10,15,20,25);
|
2006-04-13 20:47:06 +00:00
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
if (s->picnum == OOZFILTER || s->picnum == SEENINE || s->picnum == SEENINEDEAD || s->picnum == SEENINEDEAD+1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->shade != -32 && s->shade != -33)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->xrepeat)
|
2008-11-20 14:06:36 +00:00
|
|
|
j = (A_IncurDamage(i) >= 0);
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
|
|
|
j = 0;
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (j || s->shade == -31)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (j) s->lotag = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
t[3] = 1;
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_STANDABLE, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->hitag == sprite[j].hitag && (sprite[j].picnum == SEENINE || sprite[j].picnum == OOZFILTER))
|
2006-04-13 20:47:06 +00:00
|
|
|
sprite[j].shade = -32;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->shade == -32)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-11-18 19:01:29 +00:00
|
|
|
if ((int16_t)s->lotag > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
s->lotag -= 3;
|
2012-11-18 19:01:29 +00:00
|
|
|
if ((int16_t)s->lotag <= 0)
|
|
|
|
s->lotag = (uint16_t)(-99);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
s->shade = -33;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->xrepeat > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
T3++;
|
2006-11-13 23:12:47 +00:00
|
|
|
if (T3 == 3)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->picnum == OOZFILTER)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
T3 = 0;
|
|
|
|
goto DETONATE;
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->picnum != (SEENINEDEAD+1))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
T3 = 0;
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
if (s->picnum == SEENINEDEAD)
|
|
|
|
s->picnum++;
|
2006-11-13 23:12:47 +00:00
|
|
|
else if (s->picnum == SEENINE)
|
2006-04-13 20:47:06 +00:00
|
|
|
s->picnum = SEENINEDEAD;
|
|
|
|
}
|
|
|
|
else goto DETONATE;
|
|
|
|
}
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
|
|
|
|
DETONATE:
|
2008-11-20 14:06:36 +00:00
|
|
|
g_earthquakeTime = 16;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->hitag == sprite[j].hitag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-09-08 22:18:44 +00:00
|
|
|
if (sprite[j].lotag == SE_13_EXPLOSIVE)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[j].t_data[2] == 0)
|
|
|
|
actor[j].t_data[2] = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-09-08 22:18:44 +00:00
|
|
|
else if (sprite[j].lotag == SE_8_UP_OPEN_DOOR_LIGHTS)
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].t_data[4] = 1;
|
2012-09-08 22:18:44 +00:00
|
|
|
else if (sprite[j].lotag == SE_18_INCREMENTAL_SECTOR_RISE_FALL)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[j].t_data[0] == 0)
|
|
|
|
actor[j].t_data[0] = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-08-26 22:16:08 +00:00
|
|
|
else if (sprite[j].lotag == SE_21_DROP_FLOOR)
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].t_data[0] = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s->z -= (32<<8);
|
|
|
|
|
2010-07-03 08:53:57 +00:00
|
|
|
if (s->xrepeat)
|
|
|
|
for (x=0; x<8; x++) RANDOMSCRAP;
|
|
|
|
|
2012-11-18 19:01:29 +00:00
|
|
|
if ((t[3] == 1 && s->xrepeat) || (int16_t)s->lotag == -99)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-07-03 08:53:57 +00:00
|
|
|
int32_t j = A_Spawn(i,EXPLOSION2);
|
2006-04-13 20:47:06 +00:00
|
|
|
x = s->extra;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_RadiusDamage(i,g_seenineBlastRadius,x>>2, x-(x>>1),x-(x>>2), x);
|
2010-07-03 08:53:57 +00:00
|
|
|
A_PlaySound(PIPEBOMB_EXPLODE,j);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->picnum == MASTERSWITCH)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->yvel == 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
s->hitag--;
|
2012-11-18 19:01:29 +00:00
|
|
|
if ((int16_t)s->hitag <= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
G_OperateSectors(sect,i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(sect, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[j].statnum == STAT_EFFECTOR)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (sprite[j].lotag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_2_EARTHQUAKE:
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_21_DROP_FLOOR:
|
|
|
|
case SE_31_FLOOR_RISE_FALL:
|
|
|
|
case SE_32_CEILING_RISE_FALL:
|
|
|
|
case SE_36_PROJ_SHOOTER:
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].t_data[0] = 1;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT:
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].t_data[4] = 1;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-06 10:12:13 +00:00
|
|
|
else if (sprite[j].statnum == STAT_STANDABLE)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(sprite[j].picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case SEENINE__STATIC:
|
|
|
|
case OOZFILTER__STATIC:
|
|
|
|
sprite[j].shade = -31;
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
goto BOLT;
|
|
|
|
}
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
switchpicnum = s->picnum;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
if (switchpicnum > SIDEBOLT1 && switchpicnum <= SIDEBOLT1+3)
|
2006-04-13 20:47:06 +00:00
|
|
|
switchpicnum = SIDEBOLT1;
|
2013-04-15 10:48:09 +00:00
|
|
|
else if (switchpicnum > BOLT1 && switchpicnum <= BOLT1+3)
|
2006-04-13 20:47:06 +00:00
|
|
|
switchpicnum = BOLT1;
|
|
|
|
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(switchpicnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case VIEWSCREEN__STATIC:
|
|
|
|
case VIEWSCREEN2__STATIC:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-04-13 10:46:04 +00:00
|
|
|
if (s->xrepeat == 0)
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2014-12-26 17:30:00 +00:00
|
|
|
const int32_t p = A_FindPlayer(s, &x);
|
|
|
|
const DukePlayer_t *const ps = g_player[p].ps;
|
|
|
|
|
|
|
|
if (dist(&sprite[ps->i], s) < VIEWSCREEN_ACTIVE_DISTANCE)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
if (sprite[i].yvel == 1) // VIEWSCREEN_YVEL
|
|
|
|
g_curViewscreen = i;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else if (g_curViewscreen == i /*&& T1 == 1*/)
|
|
|
|
{
|
|
|
|
g_curViewscreen = -1;
|
|
|
|
sprite[i].yvel = 0; // VIEWSCREEN_YVEL
|
|
|
|
T1 = 0;
|
2015-07-25 17:23:22 +00:00
|
|
|
|
|
|
|
for (int ii=0; ii < VIEWSCREENFACTOR; ii++)
|
|
|
|
walock[TILE_VIEWSCR-ii] = 199;
|
2014-12-26 17:30:00 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case TRASH__STATIC:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel == 0) s->xvel = 1;
|
2011-02-25 21:50:19 +00:00
|
|
|
if (A_SetSprite(i, CLIPMASK0))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
|
|
|
if (krand()&1) s->zvel -= 256;
|
2014-11-22 12:32:56 +00:00
|
|
|
if ((s->xvel) < 48)
|
2008-11-20 14:06:36 +00:00
|
|
|
s->xvel += (krand()&3);
|
2007-08-25 01:05:00 +00:00
|
|
|
}
|
|
|
|
else KILLIT(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case SIDEBOLT1__STATIC:
|
|
|
|
// case SIDEBOLT1+1:
|
|
|
|
// case SIDEBOLT1+2:
|
|
|
|
// case SIDEBOLT1+3:
|
2012-08-10 19:11:56 +00:00
|
|
|
A_FindPlayer(s, &x);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x > 20480) goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
CLEAR_THE_BOLT2:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[2])
|
|
|
|
{
|
|
|
|
t[2]--;
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
if ((s->xrepeat|s->yrepeat) == 0)
|
|
|
|
{
|
|
|
|
s->xrepeat=t[0];
|
|
|
|
s->yrepeat=t[1];
|
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
if ((krand()&8) == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
t[0]=s->xrepeat;
|
|
|
|
t[1]=s->yrepeat;
|
2008-11-20 14:06:36 +00:00
|
|
|
t[2] = g_globalRandom&4;
|
2006-11-16 03:02:42 +00:00
|
|
|
s->xrepeat=s->yrepeat=0;
|
|
|
|
goto CLEAR_THE_BOLT2;
|
|
|
|
}
|
|
|
|
s->picnum++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:13 +00:00
|
|
|
// NOTE: Um, this 'l' was assigned to last at the beginning of this function.
|
|
|
|
// SIDEBOLT1 never gets translucent as a consequence, unlike BOLT1.
|
2006-11-16 03:02:42 +00:00
|
|
|
if (l&1) s->cstat ^= 2;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if ((krand()&1) && sector[sect].floorpicnum == HURTRAIL)
|
|
|
|
A_PlaySound(SHORT_CIRCUIT,i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->picnum == SIDEBOLT1+4) s->picnum = SIDEBOLT1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case BOLT1__STATIC:
|
|
|
|
// case BOLT1+1:
|
|
|
|
// case BOLT1+2:
|
|
|
|
// case BOLT1+3:
|
2012-08-10 19:11:56 +00:00
|
|
|
A_FindPlayer(s, &x);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x > 20480) goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[3] == 0)
|
|
|
|
t[3]=sector[sect].floorshade;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
CLEAR_THE_BOLT:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[2])
|
|
|
|
{
|
|
|
|
t[2]--;
|
|
|
|
sector[sect].floorshade = 20;
|
|
|
|
sector[sect].ceilingshade = 20;
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
if ((s->xrepeat|s->yrepeat) == 0)
|
|
|
|
{
|
|
|
|
s->xrepeat=t[0];
|
|
|
|
s->yrepeat=t[1];
|
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if ((krand()&8) == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
t[0]=s->xrepeat;
|
|
|
|
t[1]=s->yrepeat;
|
2008-11-20 14:06:36 +00:00
|
|
|
t[2] = g_globalRandom&4;
|
2006-11-16 03:02:42 +00:00
|
|
|
s->xrepeat=s->yrepeat=0;
|
|
|
|
goto CLEAR_THE_BOLT;
|
|
|
|
}
|
|
|
|
s->picnum++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
l = g_globalRandom&7;
|
2006-11-16 03:02:42 +00:00
|
|
|
s->xrepeat=l+8;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (l&1) s->cstat ^= 2;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (s->picnum == (BOLT1+1) && (krand()&7) == 0 && sector[sect].floorpicnum == HURTRAIL)
|
|
|
|
A_PlaySound(SHORT_CIRCUIT,i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->picnum==BOLT1+4) s->picnum=BOLT1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->picnum&1)
|
|
|
|
{
|
|
|
|
sector[sect].floorshade = 0;
|
|
|
|
sector[sect].ceilingshade = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sector[sect].floorshade = 20;
|
|
|
|
sector[sect].ceilingshade = 20;
|
|
|
|
}
|
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case WATERDRIP__STATIC:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[1])
|
|
|
|
{
|
2010-06-22 21:50:01 +00:00
|
|
|
if (--t[1] == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
s->cstat &= 32767;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
|
|
|
A_SetSprite(i,CLIPMASK0);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel > 0) s->xvel -= 2;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->zvel == 0)
|
|
|
|
{
|
|
|
|
s->cstat |= 32768;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->pal != 2 && s->hitag == 0)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(SOMETHING_DRIPPING,i);
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[s->owner].picnum != WATERDRIP)
|
|
|
|
{
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[i].bpos.z = s->z = t[0];
|
2008-11-20 14:06:36 +00:00
|
|
|
t[1] = 48+(krand()&31);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case DOORSHOCK__STATIC:
|
|
|
|
j = klabs(sector[sect].ceilingz-sector[sect].floorz)>>9;
|
|
|
|
s->yrepeat = j+4;
|
|
|
|
s->xrepeat = 16;
|
|
|
|
s->z = sector[sect].floorz;
|
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case TOUCHPLATE__STATIC:
|
2012-11-18 19:01:29 +00:00
|
|
|
if (t[1] == 1 && (int16_t)s->hitag >= 0) //Move the sector floor
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
x = sector[sect].floorz;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[3] == 1)
|
|
|
|
{
|
|
|
|
if (x >= t[2])
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sector[sect].floorz = x;
|
|
|
|
t[1] = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
int32_t p;
|
2006-11-16 03:02:42 +00:00
|
|
|
sector[sect].floorz += sector[sect].extra;
|
2009-01-13 12:23:18 +00:00
|
|
|
p = G_CheckPlayerInSector(sect);
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p >= 0) g_player[p].ps->pos.z += sector[sect].extra;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (x <= s->z)
|
|
|
|
{
|
|
|
|
sector[sect].floorz = s->z;
|
|
|
|
t[1] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
int32_t p;
|
2006-11-16 03:02:42 +00:00
|
|
|
sector[sect].floorz -= sector[sect].extra;
|
2009-01-13 12:23:18 +00:00
|
|
|
p = G_CheckPlayerInSector(sect);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (p >= 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
g_player[p].ps->pos.z -= sector[sect].extra;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[5] == 1) goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
int32_t p = G_CheckPlayerInSector(sect);
|
|
|
|
|
|
|
|
if (p >= 0 &&
|
|
|
|
(g_player[p].ps->on_ground || s->ang == 512))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
if (t[0] == 0 && !G_CheckActivatorMotion(s->lotag))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
t[0] = 1;
|
|
|
|
t[1] = 1;
|
|
|
|
t[3] = !t[3];
|
|
|
|
G_OperateMasterSwitches(s->lotag);
|
|
|
|
G_OperateActivators(s->lotag,p);
|
2012-11-18 19:01:29 +00:00
|
|
|
if ((int16_t)s->hitag > 0)
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
s->hitag--;
|
|
|
|
if (s->hitag == 0) t[5] = 1;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2012-08-10 19:11:56 +00:00
|
|
|
else t[0] = 0;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[1] == 1)
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_STANDABLE, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j != i && sprite[j].picnum == TOUCHPLATE && sprite[j].lotag == s->lotag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].t_data[1] = 1;
|
|
|
|
actor[j].t_data[3] = t[3];
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case CANWITHSOMETHING__STATIC:
|
|
|
|
case CANWITHSOMETHING2__STATIC:
|
|
|
|
case CANWITHSOMETHING3__STATIC:
|
|
|
|
case CANWITHSOMETHING4__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
2013-04-15 10:48:15 +00:00
|
|
|
if (A_IncurDamage(i) >= 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(VENT_BUST,i);
|
2010-05-02 23:27:30 +00:00
|
|
|
|
|
|
|
for (j=9; j>=0; j--)
|
2007-08-25 01:05:00 +00:00
|
|
|
RANDOMSCRAP;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (s->lotag) A_Spawn(i,s->lotag);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-25 01:05:00 +00:00
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
goto BOLT;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
case FLOORFLAME__STATIC:
|
|
|
|
case FIREBARREL__STATIC:
|
|
|
|
case FIREVASE__STATIC:
|
2009-04-13 06:01:50 +00:00
|
|
|
case EXPLODINGBARREL__STATIC:
|
|
|
|
case WOODENHORSE__STATIC:
|
|
|
|
case HORSEONSIDE__STATIC:
|
2007-08-25 01:05:00 +00:00
|
|
|
case NUKEBARREL__STATIC:
|
|
|
|
case NUKEBARRELDENTED__STATIC:
|
|
|
|
case NUKEBARRELLEAKED__STATIC:
|
|
|
|
case TOILETWATER__STATIC:
|
|
|
|
case RUBBERCAN__STATIC:
|
|
|
|
case STEAM__STATIC:
|
|
|
|
case CEILINGSTEAM__STATIC:
|
2006-11-16 03:02:42 +00:00
|
|
|
case WATERBUBBLEMAKER__STATIC:
|
2012-12-29 15:21:28 +00:00
|
|
|
if (!G_HaveActor(sprite[i].picnum))
|
2008-09-03 10:47:19 +00:00
|
|
|
goto BOLT;
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
int32_t p = A_FindPlayer(s, &x);
|
|
|
|
A_Execute(i,p,x);
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BOLT:
|
|
|
|
i = nexti;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
ACTOR_STATIC void A_DoProjectileBounce(int32_t i)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t dax, day, daz = 4096;
|
2006-04-13 20:47:06 +00:00
|
|
|
spritetype *s = &sprite[i];
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t hitsect = s->sectnum;
|
|
|
|
int32_t k = sector[hitsect].wallptr;
|
|
|
|
int32_t l = wall[k].point2;
|
2007-03-01 00:50:59 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t xvect = mulscale10(s->xvel,sintable[(s->ang+512)&2047]);
|
|
|
|
int32_t yvect = mulscale10(s->xvel,sintable[s->ang&2047]);
|
|
|
|
int32_t zvect = s->zvel;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t daang = getangle(wall[l].x-wall[k].x,wall[l].y-wall[k].y);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (s->z < (actor[i].floorz+actor[i].ceilingz)>>1)
|
2006-04-13 20:47:06 +00:00
|
|
|
k = sector[hitsect].ceilingheinum;
|
|
|
|
else
|
|
|
|
k = sector[hitsect].floorheinum;
|
|
|
|
|
|
|
|
dax = mulscale14(k,sintable[(daang)&2047]);
|
|
|
|
day = mulscale14(k,sintable[(daang+1536)&2047]);
|
|
|
|
|
|
|
|
k = xvect*dax+yvect*day+zvect*daz;
|
|
|
|
l = dax*dax+day*day+daz*daz;
|
|
|
|
if ((klabs(k)>>14) < l)
|
|
|
|
{
|
|
|
|
k = divscale17(k,l);
|
|
|
|
xvect -= mulscale16(dax,k);
|
|
|
|
yvect -= mulscale16(day,k);
|
|
|
|
zvect -= mulscale16(daz,k);
|
|
|
|
}
|
|
|
|
|
|
|
|
s->zvel = zvect;
|
|
|
|
s->xvel = ksqrt(dmulscale8(xvect,xvect,yvect,yvect));
|
|
|
|
s->ang = getangle(xvect,yvect);
|
|
|
|
}
|
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
ACTOR_STATIC void P_HandleBeingSpitOn(DukePlayer_t *ps)
|
2012-02-09 22:42:51 +00:00
|
|
|
{
|
|
|
|
ps->horiz += 32;
|
|
|
|
ps->return_to_center = 8;
|
|
|
|
|
|
|
|
if (ps->loogcnt == 0)
|
|
|
|
{
|
|
|
|
int32_t j, x;
|
|
|
|
|
|
|
|
if (!A_CheckSoundPlaying(ps->i, DUKE_LONGTERM_PAIN))
|
|
|
|
A_PlaySound(DUKE_LONGTERM_PAIN,ps->i);
|
|
|
|
|
|
|
|
j = 3+(krand()&3);
|
|
|
|
ps->numloogs = j;
|
|
|
|
ps->loogcnt = 24*4;
|
|
|
|
for (x=0; x < j; x++)
|
|
|
|
{
|
|
|
|
ps->loogiex[x] = krand()%xdim;
|
|
|
|
ps->loogiey[x] = krand()%ydim;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
static void A_DoProjectileEffects(int32_t i, const vec3_t *davect, int32_t do_radius_damage)
|
2012-07-01 22:11:22 +00:00
|
|
|
{
|
2012-10-05 20:48:10 +00:00
|
|
|
const projectile_t *proj = &SpriteProjectile[i];
|
|
|
|
|
|
|
|
if (proj->spawns >= 0)
|
2012-07-01 22:11:22 +00:00
|
|
|
{
|
2012-10-05 20:48:10 +00:00
|
|
|
int32_t k = A_Spawn(i,proj->spawns);
|
2012-07-01 22:11:22 +00:00
|
|
|
|
|
|
|
if (davect)
|
|
|
|
Bmemcpy(&sprite[k],davect,sizeof(vec3_t));
|
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
if (proj->sxrepeat > 4)
|
|
|
|
sprite[k].xrepeat=proj->sxrepeat;
|
|
|
|
if (proj->syrepeat > 4)
|
|
|
|
sprite[k].yrepeat=proj->syrepeat;
|
2012-07-01 22:11:22 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
if (proj->isound >= 0)
|
|
|
|
A_PlaySound(proj->isound,i);
|
2012-07-01 22:11:22 +00:00
|
|
|
|
|
|
|
if (do_radius_damage)
|
|
|
|
{
|
|
|
|
spritetype *const s = &sprite[i];
|
|
|
|
int32_t x;
|
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
s->extra=proj->extra;
|
2012-07-01 22:11:22 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
if (proj->extra_rand > 0)
|
|
|
|
s->extra += (krand()&proj->extra_rand);
|
2012-07-01 22:11:22 +00:00
|
|
|
|
|
|
|
x = s->extra;
|
2012-10-05 20:48:10 +00:00
|
|
|
A_RadiusDamage(i,proj->hitradius, x>>2,x>>1,x-(x>>2),x);
|
2012-07-01 22:11:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-14 20:41:30 +00:00
|
|
|
static void G_WeaponHitCeilingOrFloor(int32_t i, spritetype *s, int32_t *j)
|
|
|
|
{
|
2014-02-22 19:38:52 +00:00
|
|
|
if (actor[i].flags & SFLAG_DIDNOSE7WATER)
|
2013-04-15 10:48:18 +00:00
|
|
|
{
|
2014-02-22 19:38:52 +00:00
|
|
|
actor[i].flags &= ~SFLAG_DIDNOSE7WATER;
|
2013-04-15 10:48:05 +00:00
|
|
|
return;
|
2013-04-15 10:48:18 +00:00
|
|
|
}
|
2013-04-15 10:48:05 +00:00
|
|
|
|
2012-10-14 20:41:30 +00:00
|
|
|
if (s->z < actor[i].ceilingz)
|
|
|
|
{
|
|
|
|
*j = 16384|s->sectnum;
|
|
|
|
s->zvel = -1;
|
|
|
|
}
|
|
|
|
else if (s->z > actor[i].floorz + (16<<8)*(sector[s->sectnum].lotag == ST_1_ABOVE_WATER))
|
|
|
|
{
|
|
|
|
*j = 16384|s->sectnum;
|
|
|
|
|
|
|
|
if (sector[s->sectnum].lotag != ST_1_ABOVE_WATER)
|
|
|
|
s->zvel = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-07 21:00:55 +00:00
|
|
|
static void Proj_BounceOffWall(spritetype *s, int32_t j)
|
|
|
|
{
|
|
|
|
int32_t k = getangle(
|
|
|
|
wall[wall[j].point2].x-wall[j].x,
|
|
|
|
wall[wall[j].point2].y-wall[j].y);
|
|
|
|
s->ang = ((k<<1) - s->ang)&2047;
|
|
|
|
}
|
|
|
|
|
2013-12-20 18:31:26 +00:00
|
|
|
#define PROJ_DECAYVELOCITY(s) s->xvel >>= 1, s->zvel >>= 1
|
|
|
|
|
|
|
|
// Maybe damage a ceiling or floor as the consequence of projectile impact.
|
|
|
|
// Returns 1 if sprite <s> should be killed.
|
|
|
|
// NOTE: Compare with Proj_MaybeDamageCF2() in sector.c
|
|
|
|
static int32_t Proj_MaybeDamageCF(const spritetype *s)
|
|
|
|
{
|
|
|
|
if (s->zvel < 0)
|
|
|
|
{
|
|
|
|
if ((sector[s->sectnum].ceilingstat&1) && sector[s->sectnum].ceilingpal == 0)
|
|
|
|
return 1;
|
|
|
|
|
2013-12-20 18:31:29 +00:00
|
|
|
Sect_DamageCeilingOrFloor(0, s->sectnum);
|
|
|
|
}
|
|
|
|
else if (s->zvel > 0)
|
|
|
|
{
|
|
|
|
if ((sector[s->sectnum].floorstat&1) && sector[s->sectnum].floorpal == 0)
|
|
|
|
{
|
|
|
|
// Keep original Duke3D behavior: pass projectiles through
|
|
|
|
// parallaxed ceilings, but NOT through such floors.
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Sect_DamageCeilingOrFloor(1, s->sectnum);
|
2013-12-20 18:31:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2013-08-06 23:53:34 +00:00
|
|
|
|
|
|
|
ACTOR_STATIC void Proj_MoveCustom(int32_t i)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2015-12-28 02:04:41 +00:00
|
|
|
int const m = SpriteProjectile[i].workslike & PROJECTILE_MOVED;
|
|
|
|
SpriteProjectile[i].workslike |= PROJECTILE_MOVED;
|
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
const projectile_t *const proj = &SpriteProjectile[i];
|
|
|
|
spritetype *const s = &sprite[i];
|
|
|
|
vec3_t davect;
|
|
|
|
int32_t j=0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
switch (proj->workslike & PROJECTILE_TYPE_MASK)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
case PROJECTILE_HITSCAN:
|
|
|
|
if (!G_HaveActor(sprite[i].picnum))
|
|
|
|
return;
|
|
|
|
{
|
|
|
|
int32_t x, p = A_FindPlayer(s, &x);
|
|
|
|
A_Execute(i, p, x);
|
|
|
|
}
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
case PROJECTILE_KNEE:
|
|
|
|
case PROJECTILE_BLOOD:
|
|
|
|
A_DeleteSprite(i);
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
default:
|
|
|
|
case PROJECTILE_RPG:
|
|
|
|
Bmemcpy(&davect, s, sizeof(vec3_t));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2016-04-13 04:04:13 +00:00
|
|
|
if (proj->flashcolor)
|
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 2048, proj->flashcolor, PR_LIGHT_PRIO_LOW_GAME);
|
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_BOUNCESOFFWALLS && s->yvel < 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
A_DoProjectileEffects(i, NULL, 1);
|
|
|
|
A_DeleteSprite(i);
|
|
|
|
return;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_COOLEXPLOSION1 && ++s->shade >= 40)
|
|
|
|
{
|
|
|
|
A_DeleteSprite(i);
|
|
|
|
return;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
s->zvel -= proj->drop;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_SPIT && s->zvel < 6144)
|
|
|
|
s->zvel += g_spriteGravity-112;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
A_GetZLimits(i);
|
2009-05-22 23:49:25 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->trail >= 0)
|
|
|
|
{
|
2015-12-28 02:04:41 +00:00
|
|
|
for (int cnt=0; cnt<=proj->tnum; cnt++)
|
2013-08-06 23:53:34 +00:00
|
|
|
{
|
|
|
|
j = A_Spawn(i, proj->trail);
|
2009-02-19 09:39:19 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
sprite[j].z += (proj->toffset<<8);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->txrepeat >= 0)
|
|
|
|
sprite[j].xrepeat=proj->txrepeat;
|
2006-12-18 04:18:46 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->tyrepeat >= 0)
|
|
|
|
sprite[j].yrepeat=proj->tyrepeat;
|
|
|
|
}
|
|
|
|
}
|
2006-12-18 04:18:46 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
{
|
|
|
|
int32_t cnt = proj->movecnt;
|
|
|
|
int32_t k = s->xvel;
|
|
|
|
int32_t ll = s->zvel;
|
2006-12-18 04:18:46 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (sector[s->sectnum].lotag == ST_2_UNDERWATER)
|
|
|
|
{
|
|
|
|
k >>= 1;
|
|
|
|
ll >>= 1;
|
|
|
|
}
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2015-12-28 02:04:41 +00:00
|
|
|
uint16_t cst = 0;
|
|
|
|
|
|
|
|
if (!m && (unsigned) s->owner < MAXSPRITES)
|
|
|
|
{
|
|
|
|
cst = sprite[s->owner].cstat;
|
2016-01-03 20:07:20 +00:00
|
|
|
sprite[s->owner].cstat &= (uint16_t)~CSTAT_SPRITE_BLOCK;
|
2015-12-28 02:04:41 +00:00
|
|
|
}
|
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
vec3_t tmpvect;
|
|
|
|
Bmemcpy(&davect, s, sizeof(vec3_t));
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
tmpvect.x = (k*(sintable[(s->ang+512)&2047]))>>14;
|
|
|
|
tmpvect.y = (k*(sintable[s->ang&2047]))>>14;
|
|
|
|
tmpvect.z = ll;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2016-06-21 00:32:28 +00:00
|
|
|
j = A_MoveSprite(i, &tmpvect, (A_CheckSpriteFlags(i, SFLAG_NOCLIP) ? 0 : CLIPMASK1));
|
2013-08-06 23:53:34 +00:00
|
|
|
} while (!j && --cnt > 0);
|
2015-12-28 02:04:41 +00:00
|
|
|
|
|
|
|
if (cst) sprite[s->owner].cstat = cst;
|
2013-08-06 23:53:34 +00:00
|
|
|
}
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2013-12-28 17:04:36 +00:00
|
|
|
if (!(proj->workslike & PROJECTILE_BOUNCESOFFWALLS) && // NOT_BOUNCESOFFWALLS_YVEL
|
2013-12-28 17:04:34 +00:00
|
|
|
(unsigned)s->yvel < MAXSPRITES && sprite[s->yvel].sectnum != MAXSECTORS)
|
2013-08-06 23:53:34 +00:00
|
|
|
if (FindDistance2D(s->x-sprite[s->yvel].x, s->y-sprite[s->yvel].y) < 256)
|
|
|
|
j = 49152|s->yvel;
|
2006-12-18 04:18:46 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
actor[i].movflag = j;
|
2012-10-11 03:25:10 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (s->sectnum < 0)
|
|
|
|
{
|
|
|
|
A_DeleteSprite(i);
|
|
|
|
return;
|
|
|
|
}
|
2012-10-11 03:25:10 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_TIMED && proj->range > 0)
|
|
|
|
{
|
|
|
|
if (++actor[i].t_data[8] > proj->range)
|
|
|
|
{
|
|
|
|
if (proj->workslike & PROJECTILE_EXPLODEONTIMER)
|
|
|
|
A_DoProjectileEffects(i, &davect, 1);
|
2012-10-11 03:25:10 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
A_DeleteSprite(i);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2009-01-13 04:40:56 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if ((j&49152) != 49152 && !(proj->workslike & PROJECTILE_BOUNCESOFFWALLS))
|
|
|
|
G_WeaponHitCeilingOrFloor(i, s, &j);
|
2009-01-13 04:40:56 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_WATERBUBBLES && sector[s->sectnum].lotag == ST_2_UNDERWATER && rnd(140))
|
|
|
|
A_Spawn(i, WATERBUBBLE);
|
2006-12-18 04:18:46 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (j != 0)
|
|
|
|
{
|
|
|
|
int32_t k;
|
2006-12-18 04:18:46 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_COOLEXPLOSION1)
|
|
|
|
{
|
|
|
|
s->xvel = 0;
|
|
|
|
s->zvel = 0;
|
|
|
|
}
|
2008-08-26 04:00:42 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
switch (j&49152)
|
|
|
|
{
|
|
|
|
case 49152:
|
|
|
|
j &= (MAXSPRITES-1);
|
2006-12-18 04:18:46 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_BOUNCESOFFSPRITES)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
s->yvel--;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
k = getangle(sprite[j].x-s->x, sprite[j].y-s->y)+(sprite[j].cstat&16 ? 0 : 512);
|
|
|
|
s->ang = ((k<<1) - s->ang)&2047;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->bsound >= 0)
|
|
|
|
A_PlaySound(proj->bsound, i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_LOSESVELOCITY)
|
2013-12-20 18:31:26 +00:00
|
|
|
PROJ_DECAYVELOCITY(s);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (!(proj->workslike & PROJECTILE_FORCEIMPACT))
|
|
|
|
return;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
A_DamageObject(j, i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (sprite[j].picnum == APLAYER)
|
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
int32_t p = P_Get(j);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
A_PlaySound(PISTOL_BODYHIT, j);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_SPIT)
|
|
|
|
P_HandleBeingSpitOn(g_player[p].ps);
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_RPG_IMPACT)
|
|
|
|
{
|
|
|
|
actor[j].owner = s->owner;
|
|
|
|
actor[j].picnum = s->picnum;
|
|
|
|
actor[j].extra += proj->extra;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
A_DoProjectileEffects(i, &davect, 0);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (!(proj->workslike & PROJECTILE_FORCEIMPACT))
|
|
|
|
{
|
|
|
|
A_DeleteSprite(i);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_FORCEIMPACT)
|
|
|
|
return;
|
|
|
|
break;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
case 32768:
|
|
|
|
j &= (MAXWALLS-1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_BOUNCESOFFMIRRORS &&
|
|
|
|
(wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR))
|
|
|
|
{
|
|
|
|
Proj_BounceOffWall(s, j);
|
|
|
|
s->owner = i;
|
|
|
|
A_Spawn(i, TRANSPORTERSTAR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setsprite(i, &davect);
|
|
|
|
A_DamageWall(i, j, (vec3_t *) s, s->picnum);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_BOUNCESOFFWALLS)
|
|
|
|
{
|
|
|
|
if (wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR)
|
|
|
|
s->yvel--;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
Proj_BounceOffWall(s, j);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->bsound >= 0)
|
|
|
|
A_PlaySound(proj->bsound, i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_LOSESVELOCITY)
|
2013-12-20 18:31:26 +00:00
|
|
|
PROJ_DECAYVELOCITY(s);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2013-08-06 23:53:34 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
case 16384:
|
|
|
|
setsprite(i, &davect);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-20 18:31:26 +00:00
|
|
|
if (Proj_MaybeDamageCF(s))
|
2013-08-06 23:53:34 +00:00
|
|
|
{
|
2013-12-20 18:31:26 +00:00
|
|
|
A_DeleteSprite(i);
|
|
|
|
return;
|
2013-08-06 23:53:34 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_BOUNCESOFFWALLS)
|
|
|
|
{
|
|
|
|
A_DoProjectileBounce(i);
|
|
|
|
A_SetSprite(i, CLIPMASK1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
s->yvel--;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->bsound >= 0)
|
|
|
|
A_PlaySound(proj->bsound, i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_LOSESVELOCITY)
|
2013-12-20 18:31:26 +00:00
|
|
|
PROJ_DECAYVELOCITY(s);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
A_DoProjectileEffects(i, &davect, 1);
|
|
|
|
A_DeleteSprite(i);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
ACTOR_STATIC void G_MoveWeapons(void)
|
|
|
|
{
|
|
|
|
int32_t i = headspritestat[STAT_PROJECTILE], j=0, k;
|
|
|
|
int32_t x, ll;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
while (i >= 0)
|
|
|
|
{
|
|
|
|
const int32_t nexti = nextspritestat[i];
|
|
|
|
spritetype *const s = &sprite[i];
|
|
|
|
vec3_t davect;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (s->sectnum < 0)
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-11-04 18:21:07 +00:00
|
|
|
Bmemcpy(&actor[i].bpos, s, sizeof(vec3_t));
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
/* Custom projectiles */
|
2014-02-22 19:38:52 +00:00
|
|
|
if (A_CheckSpriteFlags(i, SFLAG_PROJECTILE))
|
2013-08-06 23:53:34 +00:00
|
|
|
{
|
|
|
|
Proj_MoveCustom(i);
|
2012-10-05 20:48:10 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-10-05 20:48:10 +00:00
|
|
|
|
|
|
|
// hard coded projectiles
|
|
|
|
switch (DYNAMICTILEMAP(s->picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-10-05 20:48:10 +00:00
|
|
|
case RADIUSEXPLOSION__STATIC:
|
|
|
|
case KNEE__STATIC:
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
case FREEZEBLAST__STATIC:
|
|
|
|
if (s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0)
|
|
|
|
{
|
|
|
|
j = A_Spawn(i,TRANSPORTERSTAR);
|
|
|
|
sprite[j].pal = 1;
|
|
|
|
sprite[j].xrepeat = 32;
|
|
|
|
sprite[j].yrepeat = 32;
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
case SHRINKSPARK__STATIC:
|
|
|
|
case RPG__STATIC:
|
|
|
|
case FIRELASER__STATIC:
|
|
|
|
case SPIT__STATIC:
|
|
|
|
case COOLEXPLOSION1__STATIC:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
if (s->picnum == COOLEXPLOSION1)
|
|
|
|
if (!S_CheckSoundPlaying(i,WIERDSHOT_FLY))
|
|
|
|
A_PlaySound(WIERDSHOT_FLY,i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
k = s->xvel;
|
|
|
|
ll = s->zvel;
|
2006-12-17 21:20:35 +00:00
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (s->picnum == RPG && sector[s->sectnum].lotag == ST_2_UNDERWATER)
|
2012-10-05 20:48:10 +00:00
|
|
|
{
|
|
|
|
k >>= 1;
|
|
|
|
ll >>= 1;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
Bmemcpy(&davect,s,sizeof(vec3_t));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
A_GetZLimits(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-21 19:55:03 +00:00
|
|
|
if (s->picnum == RPG && actor[i].picnum != BOSS2 && s->xrepeat >= 10 &&
|
2013-05-23 18:28:04 +00:00
|
|
|
sector[s->sectnum].lotag != ST_2_UNDERWATER && g_scriptVersion >= 13)
|
2012-10-05 20:48:10 +00:00
|
|
|
{
|
2013-04-21 19:55:03 +00:00
|
|
|
j = A_Spawn(i,SMALLSMOKE);
|
|
|
|
sprite[j].z += (1<<8);
|
2012-10-05 20:48:10 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
{
|
|
|
|
vec3_t tmpvect;
|
2009-01-13 04:40:56 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
tmpvect.x = (k*(sintable[(s->ang+512)&2047]))>>14;
|
|
|
|
tmpvect.y = (k*(sintable[s->ang&2047]))>>14;
|
|
|
|
tmpvect.z = ll;
|
2016-06-21 00:32:28 +00:00
|
|
|
j = A_MoveSprite(i,&tmpvect, (A_CheckSpriteFlags(i, SFLAG_NOCLIP) ? 0 : CLIPMASK1));
|
2012-10-05 20:48:10 +00:00
|
|
|
}
|
2009-01-13 04:40:56 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-28 17:04:36 +00:00
|
|
|
if (s->picnum == RPG && (unsigned)s->yvel < MAXSPRITES) // RPG_YVEL
|
2012-10-05 20:48:10 +00:00
|
|
|
if (FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256)
|
|
|
|
j = 49152|s->yvel;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
actor[i].movflag = j;
|
2008-08-26 04:00:42 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
if (s->sectnum < 0)
|
|
|
|
KILLIT(i);
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2013-04-15 10:48:05 +00:00
|
|
|
if ((j&49152) != 49152 && s->picnum != FREEZEBLAST)
|
|
|
|
G_WeaponHitCeilingOrFloor(i, s, &j);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:28 +00:00
|
|
|
if (s->picnum == FIRELASER)
|
|
|
|
{
|
|
|
|
for (k=-3; k<2; k++)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-10-14 20:41:28 +00:00
|
|
|
x = A_InsertSprite(s->sectnum,
|
|
|
|
s->x+((k*sintable[(s->ang+512)&2047])>>9),
|
|
|
|
s->y+((k*sintable[s->ang&2047])>>9),
|
|
|
|
s->z+((k*ksgn(s->zvel))*klabs(s->zvel/24)),FIRELASER,-40+(k<<2),
|
|
|
|
s->xrepeat,s->yrepeat,0,0,0,s->owner,5);
|
|
|
|
|
|
|
|
sprite[x].cstat = 128;
|
|
|
|
sprite[x].pal = s->pal;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2012-10-14 20:41:28 +00:00
|
|
|
}
|
|
|
|
else if (s->picnum == SPIT)
|
|
|
|
if (s->zvel < 6144)
|
2012-10-05 20:48:10 +00:00
|
|
|
s->zvel += g_spriteGravity-112;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:28 +00:00
|
|
|
if (j != 0)
|
|
|
|
{
|
|
|
|
if (s->picnum == COOLEXPLOSION1)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-10-14 20:41:28 +00:00
|
|
|
if ((j&49152) == 49152 && sprite[j&(MAXSPRITES-1)].picnum != APLAYER)
|
|
|
|
goto COOLEXPLOSION;
|
|
|
|
s->xvel = 0;
|
|
|
|
s->zvel = 0;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
switch (j&49152)
|
2012-10-14 20:41:28 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
case 49152:
|
2012-10-14 20:41:28 +00:00
|
|
|
j &= (MAXSPRITES-1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:28 +00:00
|
|
|
if (s->picnum == FREEZEBLAST && sprite[j].pal == 1)
|
|
|
|
if (A_CheckEnemySprite(&sprite[j]) || sprite[j].picnum == APLAYER)
|
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
j = A_Spawn(i, TRANSPORTERSTAR);
|
2012-10-14 20:41:28 +00:00
|
|
|
sprite[j].pal = 1;
|
|
|
|
sprite[j].xrepeat = 32;
|
|
|
|
sprite[j].yrepeat = 32;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:28 +00:00
|
|
|
KILLIT(i);
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
A_DamageObject(j, i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (sprite[j].picnum == APLAYER)
|
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
int32_t p = P_Get(j);
|
2013-08-06 23:53:34 +00:00
|
|
|
A_PlaySound(PISTOL_BODYHIT, j);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (s->picnum == SPIT)
|
|
|
|
P_HandleBeingSpitOn(g_player[p].ps);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 32768:
|
2012-10-14 20:41:28 +00:00
|
|
|
j &= (MAXWALLS-1);
|
|
|
|
|
2013-04-21 19:55:03 +00:00
|
|
|
if (s->picnum != RPG && s->picnum != FREEZEBLAST && s->picnum != SPIT &&
|
2013-08-06 23:53:34 +00:00
|
|
|
(wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-02-07 21:00:55 +00:00
|
|
|
Proj_BounceOffWall(s, j);
|
2012-10-14 20:41:28 +00:00
|
|
|
s->owner = i;
|
2013-08-06 23:53:34 +00:00
|
|
|
A_Spawn(i, TRANSPORTERSTAR);
|
2012-10-14 20:41:28 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
setsprite(i, &davect);
|
|
|
|
A_DamageWall(i, j, (vec3_t *) s, s->picnum);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2012-10-14 20:41:28 +00:00
|
|
|
if (s->picnum == FREEZEBLAST)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-10-14 20:41:28 +00:00
|
|
|
if (wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR)
|
|
|
|
{
|
|
|
|
s->extra >>= 1;
|
|
|
|
s->yvel--;
|
|
|
|
}
|
|
|
|
|
2013-02-07 21:00:55 +00:00
|
|
|
Proj_BounceOffWall(s, j);
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
2012-10-14 20:41:28 +00:00
|
|
|
}
|
2013-08-06 23:53:34 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 16384:
|
|
|
|
setsprite(i, &davect);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-20 18:31:26 +00:00
|
|
|
if (Proj_MaybeDamageCF(s))
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:28 +00:00
|
|
|
if (s->picnum == FREEZEBLAST)
|
|
|
|
{
|
|
|
|
A_DoProjectileBounce(i);
|
|
|
|
A_SetSprite(i, CLIPMASK1);
|
2013-08-06 23:53:34 +00:00
|
|
|
|
2012-10-14 20:41:28 +00:00
|
|
|
s->extra >>= 1;
|
2013-08-06 23:53:34 +00:00
|
|
|
s->yvel--;
|
|
|
|
|
2012-10-14 20:41:28 +00:00
|
|
|
if (s->xrepeat > 8)
|
2013-08-06 23:53:34 +00:00
|
|
|
{
|
2012-10-14 20:41:28 +00:00
|
|
|
s->xrepeat -= 2;
|
2013-08-06 23:53:34 +00:00
|
|
|
|
|
|
|
if (s->yrepeat > 8)
|
|
|
|
s->yrepeat -= 2;
|
|
|
|
}
|
|
|
|
|
2012-10-14 20:41:28 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
2013-08-06 23:53:34 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2012-10-14 20:41:28 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
switch (DYNAMICTILEMAP(s->picnum))
|
2012-10-14 20:41:28 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
case SPIT__STATIC:
|
|
|
|
case COOLEXPLOSION1__STATIC:
|
|
|
|
case FREEZEBLAST__STATIC:
|
|
|
|
case FIRELASER__STATIC:
|
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
case RPG__STATIC:
|
|
|
|
k = A_Spawn(i, EXPLOSION2);
|
|
|
|
A_PlaySound(RPG_EXPLODE, k);
|
|
|
|
Bmemcpy(&sprite[k], &davect, sizeof(vec3_t));
|
2006-12-17 21:20:35 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (s->xrepeat < 10)
|
|
|
|
{
|
|
|
|
sprite[k].xrepeat = 6;
|
|
|
|
sprite[k].yrepeat = 6;
|
|
|
|
}
|
|
|
|
else if ((j&49152) == 16384)
|
|
|
|
{
|
|
|
|
if (s->zvel > 0)
|
|
|
|
A_Spawn(i, EXPLOSION2BOT);
|
2012-10-14 20:41:28 +00:00
|
|
|
else
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
sprite[k].cstat |= 8;
|
|
|
|
sprite[k].z += (48<<8);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2012-10-14 20:41:28 +00:00
|
|
|
}
|
2013-08-06 23:53:34 +00:00
|
|
|
|
|
|
|
if (s->xrepeat >= 10)
|
|
|
|
{
|
|
|
|
x = s->extra;
|
|
|
|
A_RadiusDamage(i, g_rpgBlastRadius, x>>2, x>>1, x-(x>>2), x);
|
|
|
|
}
|
|
|
|
else
|
2012-10-14 20:41:28 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
x = s->extra+(g_globalRandom&3);
|
|
|
|
A_RadiusDamage(i, (g_rpgBlastRadius>>1), x>>2, x>>1, x-(x>>2), x);
|
2012-10-14 20:41:28 +00:00
|
|
|
}
|
2013-08-06 23:53:34 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SHRINKSPARK__STATIC:
|
|
|
|
A_Spawn(i, SHRINKEREXPLOSION);
|
|
|
|
A_PlaySound(SHRINKER_HIT, i);
|
|
|
|
A_RadiusDamage(i, g_shrinkerBlastRadius, 0, 0, 0, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
k = A_Spawn(i, EXPLOSION2);
|
|
|
|
sprite[k].xrepeat = sprite[k].yrepeat = s->xrepeat>>1;
|
|
|
|
if ((j&49152) == 16384)
|
2012-10-14 20:41:28 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
if (s->zvel < 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
sprite[k].cstat |= 8;
|
|
|
|
sprite[k].z += (72<<8);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2013-08-06 23:53:34 +00:00
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2012-04-13 10:46:04 +00:00
|
|
|
|
2012-10-14 20:41:28 +00:00
|
|
|
if (s->picnum != COOLEXPLOSION1)
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->picnum == COOLEXPLOSION1)
|
|
|
|
{
|
2011-03-05 03:57:15 +00:00
|
|
|
COOLEXPLOSION:
|
2012-10-14 20:41:28 +00:00
|
|
|
s->shade++;
|
|
|
|
if (s->shade >= 40)
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
else if (s->picnum == RPG && sector[s->sectnum].lotag == ST_2_UNDERWATER && s->xrepeat >= 10 && rnd(140))
|
|
|
|
A_Spawn(i,WATERBUBBLE);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:28 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
case SHOTSPARK1__STATIC:
|
2012-12-29 15:21:28 +00:00
|
|
|
if (!G_HaveActor(sprite[i].picnum))
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2012-10-05 20:48:10 +00:00
|
|
|
{
|
|
|
|
int32_t p = A_FindPlayer(s,&x);
|
|
|
|
A_Execute(i,p,x);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-10-05 20:48:10 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
BOLT:
|
|
|
|
i = nexti;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-14 20:41:17 +00:00
|
|
|
|
|
|
|
static int32_t P_Submerge(int32_t j, int32_t p, DukePlayer_t *ps, int32_t sect, int32_t othersect)
|
|
|
|
{
|
|
|
|
if (ps->on_ground &&
|
|
|
|
ps->pos.z >= sector[sect].floorz &&
|
|
|
|
(TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH) || ps->vel.z > 2048))
|
|
|
|
// if( onfloorz && sectlotag == 1 && ps->pos.z > (sector[sect].floorz-(6<<8)) )
|
|
|
|
{
|
|
|
|
if (screenpeek == p)
|
|
|
|
{
|
|
|
|
FX_StopAllSounds();
|
|
|
|
S_ClearSoundLocks();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sprite[ps->i].extra > 0)
|
|
|
|
A_PlaySound(DUKE_UNDERWATER, j);
|
|
|
|
|
|
|
|
ps->opos.z = ps->pos.z = sector[othersect].ceilingz;
|
|
|
|
// ps->vel.x = 4096-(krand()&8192);
|
|
|
|
// ps->vel.y = 4096-(krand()&8192);
|
|
|
|
|
|
|
|
if (TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH))
|
|
|
|
ps->vel.z += 512;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int32_t P_Emerge(int32_t j, int32_t p, DukePlayer_t *ps, int32_t sect, int32_t othersect)
|
|
|
|
{
|
|
|
|
// r1449-:
|
|
|
|
if (ps->pos.z < (sector[sect].ceilingz+1080) && ps->vel.z == 0)
|
|
|
|
// r1450+, breaks submergible slime in bobsp2:
|
|
|
|
// if (onfloorz && sectlotag == 2 && ps->pos.z <= sector[sect].ceilingz /*&& ps->vel.z == 0*/)
|
|
|
|
{
|
|
|
|
// if( sprite[j].extra <= 0) break;
|
|
|
|
if (screenpeek == p)
|
|
|
|
{
|
|
|
|
FX_StopAllSounds();
|
|
|
|
S_ClearSoundLocks();
|
|
|
|
}
|
|
|
|
|
|
|
|
A_PlaySound(DUKE_GASP, j);
|
|
|
|
|
|
|
|
ps->opos.z = ps->pos.z = sector[othersect].floorz;
|
|
|
|
ps->vel.z = 0;
|
|
|
|
// ps->vel.z += 1024;
|
|
|
|
|
|
|
|
ps->jumping_toggle = 1;
|
|
|
|
ps->jumping_counter = 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void P_FinishWaterChange(int32_t j, DukePlayer_t *ps, int32_t sectlotag, int32_t ow, int32_t newsectnum)
|
|
|
|
{
|
|
|
|
int32_t l;
|
|
|
|
vec3_t vect;
|
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
ps->bobpos.x = ps->opos.x = ps->pos.x;
|
|
|
|
ps->bobpos.y = ps->opos.y = ps->pos.y;
|
2012-10-14 20:41:17 +00:00
|
|
|
|
|
|
|
if (ow < 0 || sprite[ow].owner != ow)
|
|
|
|
ps->transporter_hold = -2;
|
|
|
|
|
|
|
|
ps->cursectnum = newsectnum;
|
|
|
|
changespritesect(j, newsectnum);
|
|
|
|
|
|
|
|
vect.x = ps->pos.x;
|
|
|
|
vect.y = ps->pos.y;
|
|
|
|
vect.z = ps->pos.z+PHEIGHT;
|
|
|
|
setsprite(ps->i, &vect);
|
|
|
|
|
|
|
|
P_UpdateScreenPal(ps);
|
|
|
|
|
|
|
|
if ((krand()&255) < 32)
|
|
|
|
A_Spawn(j, WATERSPLASH2);
|
|
|
|
|
|
|
|
if (sectlotag == ST_1_ABOVE_WATER)
|
|
|
|
for (l = 0; l < 9; l++)
|
|
|
|
{
|
|
|
|
int32_t q = A_Spawn(ps->i,WATERBUBBLE);
|
|
|
|
sprite[q].z += krand()&16383;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-29 19:24:12 +00:00
|
|
|
// Check prevention of teleportation *when alive*. For example, commanders and
|
|
|
|
// octabrains would be transported by SE7 (both water and normal) only if dead.
|
2012-10-24 13:21:02 +00:00
|
|
|
static int32_t A_CheckNonTeleporting(int32_t s)
|
2012-10-14 20:41:23 +00:00
|
|
|
{
|
2012-10-24 13:21:02 +00:00
|
|
|
int32_t pic = sprite[s].picnum;
|
|
|
|
|
2014-02-22 19:38:52 +00:00
|
|
|
if (A_CheckSpriteFlags(s, SFLAG_NOTELEPORT)) return 1;
|
2012-10-24 13:21:02 +00:00
|
|
|
|
2012-10-14 20:41:23 +00:00
|
|
|
return (pic == SHARK || pic == COMMANDER || pic == OCTABRAIN
|
|
|
|
|| (pic >= GREENSLIME && pic <= GREENSLIME+7));
|
|
|
|
}
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
ACTOR_STATIC void G_MoveTransports(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t i = headspritestat[STAT_TRANSPORT];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
while (i >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-10-14 20:41:17 +00:00
|
|
|
const int32_t sect = SECT;
|
|
|
|
const int32_t sectlotag = sector[sect].lotag;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:17 +00:00
|
|
|
const int32_t nexti = nextspritestat[i];
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t j, k;
|
|
|
|
|
|
|
|
const int32_t onfloorz = T5; // ONFLOORZ
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (OW == i)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
i = nexti;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (T1 > 0) T1--;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
j = headspritesect[sect];
|
2006-11-13 23:12:47 +00:00
|
|
|
while (j >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-10-14 20:41:17 +00:00
|
|
|
const int32_t nextj = nextspritesect[j];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (sprite[j].statnum)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-08-06 10:12:13 +00:00
|
|
|
case STAT_PLAYER:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[j].owner != -1)
|
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
const int32_t p = P_Get(j);
|
2012-08-10 19:11:53 +00:00
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->on_warping_sector = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->transporter_hold == 0 && ps->jumping_counter == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->on_ground && sectlotag == 0 && onfloorz && ps->jetpack_on == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[i].pal == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(i,TRANSPORTERBEAM);
|
|
|
|
A_PlaySound(TELEPORTER,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-02-21 19:33:33 +00:00
|
|
|
for (TRAVERSE_CONNECT(k))
|
|
|
|
if (g_player[k].ps->cursectnum == sprite[OW].sectnum)
|
|
|
|
{
|
|
|
|
g_player[k].ps->frag_ps = p;
|
|
|
|
sprite[g_player[k].ps->i].extra = 0;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->ang = sprite[OW].ang;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[OW].owner != OW)
|
|
|
|
{
|
|
|
|
T1 = 13;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[OW].t_data[0] = 13;
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->transporter_hold = 13;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
ps->bobpos.x = ps->opos.x = ps->pos.x = sprite[OW].x;
|
|
|
|
ps->bobpos.y = ps->opos.y = ps->pos.y = sprite[OW].y;
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->opos.z = ps->pos.z = sprite[OW].z-PHEIGHT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
changespritesect(j,sprite[OW].sectnum);
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->cursectnum = sprite[j].sectnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[i].pal == 0)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
k = A_Spawn(OW,TRANSPORTERBEAM);
|
|
|
|
A_PlaySound(TELEPORTER,k);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2012-10-14 20:41:21 +00:00
|
|
|
else if (!(sectlotag == ST_1_ABOVE_WATER && ps->on_ground == 1)) break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:53 +00:00
|
|
|
if (onfloorz == 0 && klabs(SZ-ps->pos.z) < 6144)
|
2013-04-15 10:48:18 +00:00
|
|
|
if (!ps->jetpack_on || TEST_SYNC_KEY(g_player[p].sync->bits, SK_JUMP) ||
|
|
|
|
TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
ps->bobpos.x = ps->opos.x = ps->pos.x += sprite[OW].x-SX;
|
|
|
|
ps->bobpos.y = ps->opos.y = ps->pos.y += sprite[OW].y-SY;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->jetpack_on && (TEST_SYNC_KEY(g_player[p].sync->bits, SK_JUMP) || ps->jetpack_on < 11))
|
|
|
|
ps->pos.z = sprite[OW].z-6144;
|
|
|
|
else ps->pos.z = sprite[OW].z+6144;
|
|
|
|
ps->opos.z = ps->pos.z;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[ps->i].bpos.x = ps->pos.x;
|
|
|
|
actor[ps->i].bpos.y = ps->pos.y;
|
|
|
|
actor[ps->i].bpos.z = ps->pos.z;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
changespritesect(j,sprite[OW].sectnum);
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->cursectnum = sprite[OW].sectnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
k = 0;
|
2012-10-14 20:41:17 +00:00
|
|
|
if (onfloorz)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-10-14 20:41:17 +00:00
|
|
|
if (sectlotag==ST_1_ABOVE_WATER)
|
|
|
|
k = P_Submerge(j, p, ps, sect, sprite[OW].sectnum);
|
|
|
|
else if (sectlotag==ST_2_UNDERWATER)
|
|
|
|
k = P_Emerge(j, p, ps, sect, sprite[OW].sectnum);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (k == 1)
|
|
|
|
{
|
2012-10-14 20:41:17 +00:00
|
|
|
ps->pos.x += sprite[OW].x-SX;
|
|
|
|
ps->pos.y += sprite[OW].y-SY;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:17 +00:00
|
|
|
P_FinishWaterChange(j, ps, sectlotag, OW, sprite[OW].sectnum);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:23 +00:00
|
|
|
|
|
|
|
////////// Non-player teleportation //////////
|
|
|
|
|
2009-08-06 10:12:13 +00:00
|
|
|
case STAT_PROJECTILE:
|
2013-04-15 10:48:18 +00:00
|
|
|
// SE7_PROJECTILE, PROJECTILE_CHSECT.
|
2011-08-16 19:17:45 +00:00
|
|
|
// comment out to make RPGs pass through water: (r1450 breaks this)
|
|
|
|
// if (sectlotag != 0) goto JBOLT;
|
2009-08-06 10:12:13 +00:00
|
|
|
case STAT_ACTOR:
|
2012-10-24 13:21:02 +00:00
|
|
|
if (sprite[j].extra > 0 && A_CheckNonTeleporting(j))
|
2012-10-14 20:41:23 +00:00
|
|
|
goto JBOLT;
|
2009-08-06 10:12:13 +00:00
|
|
|
case STAT_MISC:
|
|
|
|
case STAT_FALLER:
|
|
|
|
case STAT_DUMMYPLAYER:
|
2012-10-14 20:41:17 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (totalclock > actor[j].lasttransport)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2015-05-16 11:56:47 +00:00
|
|
|
const int32_t zvel = sprite[j].zvel;
|
|
|
|
const int32_t ll = klabs(zvel);
|
2012-10-14 20:41:17 +00:00
|
|
|
int32_t warpspriteto = 0;
|
|
|
|
|
2012-10-14 20:41:23 +00:00
|
|
|
if (ll != 0)
|
|
|
|
{
|
2015-05-16 11:56:47 +00:00
|
|
|
if (sectlotag == ST_2_UNDERWATER && sprite[j].z < (sector[sect].ceilingz+ll) && zvel < 0)
|
2012-10-14 20:41:23 +00:00
|
|
|
warpspriteto = 1;
|
2015-05-16 11:56:47 +00:00
|
|
|
if (sectlotag == ST_1_ABOVE_WATER && sprite[j].z > (sector[sect].floorz-ll) && zvel > 0)
|
2012-10-14 20:41:23 +00:00
|
|
|
warpspriteto = 1;
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
if (sectlotag == 0 && (onfloorz || klabs(sprite[j].z-SZ) < 4096))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[OW].owner != OW && onfloorz && T1 > 0 && sprite[j].statnum != STAT_MISC)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
T1++;
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
warpspriteto = 1;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:23 +00:00
|
|
|
if (warpspriteto)
|
|
|
|
{
|
2014-02-22 19:38:52 +00:00
|
|
|
if (A_CheckSpriteFlags(j,SFLAG_DECAL))
|
2012-10-14 20:41:23 +00:00
|
|
|
goto JBOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(sprite[j].picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case TRANSPORTERSTAR__STATIC:
|
|
|
|
case TRANSPORTERBEAM__STATIC:
|
|
|
|
case TRIPBOMB__STATIC:
|
|
|
|
case BULLETHOLE__STATIC:
|
|
|
|
case WATERSPLASH2__STATIC:
|
|
|
|
case BURNING__STATIC:
|
|
|
|
case BURNING2__STATIC:
|
|
|
|
case FIRE__STATIC:
|
|
|
|
case FIRE2__STATIC:
|
|
|
|
case TOILETWATER__STATIC:
|
|
|
|
case LASERLINE__STATIC:
|
|
|
|
goto JBOLT;
|
2012-10-14 20:41:21 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case PLAYERONWATER__STATIC:
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sectlotag == ST_2_UNDERWATER)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-07-04 09:28:21 +00:00
|
|
|
sprite[j].cstat &= 32768;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2013-04-15 10:48:18 +00:00
|
|
|
// fall-through
|
2006-11-16 03:02:42 +00:00
|
|
|
default:
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sprite[j].statnum == STAT_MISC && !(sectlotag == ST_1_ABOVE_WATER || sectlotag == ST_2_UNDERWATER))
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2013-04-15 10:48:18 +00:00
|
|
|
// fall-through
|
2006-11-16 03:02:42 +00:00
|
|
|
case WATERBUBBLE__STATIC:
|
2012-10-14 20:41:21 +00:00
|
|
|
// if( rnd(192) && sprite[j].picnum == WATERBUBBLE)
|
|
|
|
// break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sectlotag > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:18 +00:00
|
|
|
// Water SE7 teleportation.
|
2012-10-14 20:41:23 +00:00
|
|
|
const int32_t osect = sprite[OW].sectnum;
|
|
|
|
|
|
|
|
Bassert(sectlotag==ST_1_ABOVE_WATER || sectlotag==ST_2_UNDERWATER);
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
k = A_Spawn(j,WATERSPLASH2);
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sectlotag == ST_1_ABOVE_WATER && sprite[j].statnum == STAT_PROJECTILE)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
sprite[k].xvel = sprite[j].xvel>>1;
|
|
|
|
sprite[k].ang = sprite[j].ang;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SetSprite(k,CLIPMASK0);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-10-14 20:41:23 +00:00
|
|
|
//
|
|
|
|
actor[j].lasttransport = totalclock + (TICSPERFRAME<<2);
|
|
|
|
|
|
|
|
sprite[j].x += (sprite[OW].x-SX);
|
|
|
|
sprite[j].y += (sprite[OW].y-SY);
|
|
|
|
sprite[j].z = sectlotag==ST_1_ABOVE_WATER ?
|
|
|
|
sector[osect].ceilingz : sector[osect].floorz;
|
|
|
|
|
2013-11-04 18:21:07 +00:00
|
|
|
Bmemcpy(&actor[j].bpos, &sprite[j], sizeof(vec3_t));
|
2012-10-14 20:41:23 +00:00
|
|
|
|
|
|
|
changespritesect(j, sprite[OW].sectnum);
|
|
|
|
}
|
|
|
|
else if (Bassert(sectlotag==0), 1)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-04-15 10:48:18 +00:00
|
|
|
// Non-water SE7 teleportation.
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (onfloorz)
|
|
|
|
{
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[j].statnum == STAT_PROJECTILE ||
|
2013-04-15 10:48:18 +00:00
|
|
|
(G_CheckPlayerInSector(sect) == -1 && G_CheckPlayerInSector(sprite[OW].sectnum) == -1))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[j].x += (sprite[OW].x-SX);
|
|
|
|
sprite[j].y += (sprite[OW].y-SY);
|
|
|
|
sprite[j].z -= SZ - sector[sprite[OW].sectnum].floorz;
|
|
|
|
sprite[j].ang = sprite[OW].ang;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-11-04 18:21:07 +00:00
|
|
|
Bmemcpy(&actor[j].bpos, &sprite[j], sizeof(vec3_t));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[i].pal == 0)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
k = A_Spawn(i,TRANSPORTERBEAM);
|
|
|
|
A_PlaySound(TELEPORTER,k);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
k = A_Spawn(OW,TRANSPORTERBEAM);
|
|
|
|
A_PlaySound(TELEPORTER,k);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (sprite[OW].owner != OW)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
T1 = 13;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[OW].t_data[0] = 13;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
changespritesect(j,sprite[OW].sectnum);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite[j].x += (sprite[OW].x-SX);
|
|
|
|
sprite[j].y += (sprite[OW].y-SY);
|
|
|
|
sprite[j].z = sprite[OW].z+4096;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-11-04 18:21:07 +00:00
|
|
|
Bmemcpy(&actor[j].bpos, &sprite[j], sizeof(vec3_t));
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
changespritesect(j,sprite[OW].sectnum);
|
|
|
|
}
|
2012-10-14 20:41:17 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
break;
|
2012-10-14 20:41:23 +00:00
|
|
|
} // switch (DYNAMICTILEMAP(sprite[j].picnum))
|
|
|
|
} // if (warpspriteto)
|
|
|
|
} // if (totalclock > actor[j].lasttransport)
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2012-10-14 20:41:23 +00:00
|
|
|
} // five cases
|
|
|
|
|
2012-10-14 20:41:17 +00:00
|
|
|
} // switch (sprite[j].statnum)
|
2006-04-13 20:47:06 +00:00
|
|
|
JBOLT:
|
|
|
|
j = nextj;
|
|
|
|
}
|
|
|
|
BOLT:
|
|
|
|
i = nexti;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
static int16_t A_FindLocator(int32_t n, int32_t sn)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t i;
|
2007-03-01 00:50:59 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_LOCATOR, i))
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
|
|
|
if ((sn == -1 || sn == SECT) && n == SLT)
|
|
|
|
return i;
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-12-10 06:49:01 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
ACTOR_STATIC void G_MoveActors(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t x, m, l;
|
2012-03-11 17:37:50 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t j;
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i = headspritestat[STAT_ACTOR];
|
2007-03-01 00:50:59 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
while (i >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
const int32_t nexti = nextspritestat[i];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
spritetype *const s = &sprite[i];
|
|
|
|
const int32_t sect = s->sectnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t switchpicnum;
|
|
|
|
int32_t *const t = actor[i].t_data;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->xrepeat == 0 || sect < 0 || sect >= MAXSECTORS)
|
2006-04-13 20:47:06 +00:00
|
|
|
KILLIT(i);
|
|
|
|
|
2013-11-04 18:21:07 +00:00
|
|
|
Bmemcpy(&actor[i].bpos, s, sizeof(vec3_t));
|
2009-08-28 23:08:00 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
switchpicnum = s->picnum;
|
2012-05-14 18:12:27 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
if (s->picnum > GREENSLIME && s->picnum <= GREENSLIME+7)
|
2006-04-13 20:47:06 +00:00
|
|
|
switchpicnum = GREENSLIME;
|
2012-05-14 18:12:27 +00:00
|
|
|
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(switchpicnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case DUCK__STATIC:
|
|
|
|
case TARGET__STATIC:
|
|
|
|
if (s->cstat&32)
|
|
|
|
{
|
|
|
|
t[0]++;
|
|
|
|
if (t[0] > 60)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0] = 0;
|
|
|
|
s->cstat = 128+257+16;
|
|
|
|
s->extra = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (A_IncurDamage(i) >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t k = 1;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->cstat = 32+128;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_ACTOR, j))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (sprite[j].lotag == s->lotag && sprite[j].picnum == s->picnum)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-28 16:45:29 +00:00
|
|
|
if ((sprite[j].hitag!=0) ^ ((sprite[j].cstat&32)!=0))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
k = 0;
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (k == 1)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
G_OperateActivators(s->lotag,-1);
|
|
|
|
G_OperateForceFields(i,s->lotag);
|
|
|
|
G_OperateMasterSwitches(s->lotag);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case RESPAWNMARKERRED__STATIC:
|
|
|
|
case RESPAWNMARKERYELLOW__STATIC:
|
|
|
|
case RESPAWNMARKERGREEN__STATIC:
|
2010-05-02 23:27:30 +00:00
|
|
|
if (++T1 > g_itemRespawnTime)
|
2006-11-16 03:02:42 +00:00
|
|
|
KILLIT(i);
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (T1 >= (g_itemRespawnTime>>1) && T1 < ((g_itemRespawnTime>>1)+(g_itemRespawnTime>>2)))
|
2006-11-16 03:02:42 +00:00
|
|
|
PN = RESPAWNMARKERYELLOW;
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (T1 > ((g_itemRespawnTime>>1)+(g_itemRespawnTime>>2)))
|
2006-11-16 03:02:42 +00:00
|
|
|
PN = RESPAWNMARKERGREEN;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case HELECOPT__STATIC:
|
|
|
|
case DUKECAR__STATIC:
|
|
|
|
s->z += s->zvel;
|
|
|
|
t[0]++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (t[0] == 4) A_PlaySound(WAR_AMBIENCE2,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
if (t[0] > (GAMETICSPERSEC*8))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(RPG_EXPLODE);
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=0; j<32; j++) RANDOMSCRAP;
|
2008-11-20 14:06:36 +00:00
|
|
|
g_earthquakeTime = 16;
|
2006-11-16 03:02:42 +00:00
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
else if ((t[0]&3) == 0)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(i,EXPLOSION2);
|
|
|
|
A_SetSprite(i,CLIPMASK0);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2012-04-13 10:46:04 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case RAT__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
2011-02-25 21:50:19 +00:00
|
|
|
if (A_SetSprite(i, CLIPMASK0))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if ((krand()&255) < 3) A_PlaySound(RATTY,i);
|
|
|
|
s->ang += (krand()&31)-15+(sintable[(t[0]<<8)&2047]>>11);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
T1++;
|
|
|
|
if (T1 > 1)
|
2007-08-25 01:05:00 +00:00
|
|
|
{
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else s->ang = (krand()&2047);
|
2007-08-25 01:05:00 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel < 128)
|
|
|
|
s->xvel+=2;
|
2008-11-20 14:06:36 +00:00
|
|
|
s->ang += (krand()&3)-6;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2012-04-13 10:46:04 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case QUEBALL__STATIC:
|
|
|
|
case STRIPEBALL__STATIC:
|
|
|
|
if (s->xvel)
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_DEFAULT, j))
|
2012-04-13 10:46:04 +00:00
|
|
|
if (sprite[j].picnum == POCKET && ldist(&sprite[j],s) < 52)
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-13 12:23:18 +00:00
|
|
|
j = clipmove((vec3_t *)s,&s->sectnum,
|
2006-11-16 03:02:42 +00:00
|
|
|
(((s->xvel*(sintable[(s->ang+512)&2047]))>>14)*TICSPERFRAME)<<11,
|
|
|
|
(((s->xvel*(sintable[s->ang&2047]))>>14)*TICSPERFRAME)<<11,
|
|
|
|
24L,(4<<8),(4<<8),CLIPMASK1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j&49152)
|
|
|
|
{
|
|
|
|
if ((j&49152) == 32768)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
j &= (MAXWALLS-1);
|
2013-02-07 21:00:55 +00:00
|
|
|
Proj_BounceOffWall(s, j);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else if ((j&49152) == 49152)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
j &= (MAXSPRITES-1);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_DamageObject(i,j);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
|
|
|
s->xvel--;
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel < 0) s->xvel = 0;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->picnum == STRIPEBALL)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
s->cstat = 257;
|
2010-05-02 23:27:30 +00:00
|
|
|
s->cstat |= (4 & s->xvel) | (8 & s->xvel);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
const int32_t p = A_FindPlayer(s,&x);
|
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x < 1596)
|
2013-04-15 10:48:09 +00:00
|
|
|
// if (s->pal == 12)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
j = G_GetAngleDelta(ps->ang,getangle(s->x-ps->pos.x,s->y-ps->pos.y));
|
|
|
|
|
|
|
|
if (j > -64 && j < 64 && TEST_SYNC_KEY(g_player[p].sync->bits, SK_OPEN))
|
|
|
|
if (ps->toggle_key_flag == 1)
|
|
|
|
{
|
|
|
|
int32_t a;
|
|
|
|
|
|
|
|
for (SPRITES_OF(STAT_ACTOR, a))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (sprite[a].picnum == QUEBALL || sprite[a].picnum == STRIPEBALL)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
j = G_GetAngleDelta(ps->ang,getangle(sprite[a].x-ps->pos.x,sprite[a].y-ps->pos.y));
|
|
|
|
if (j > -64 && j < 64)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
A_FindPlayer(&sprite[a],&l);
|
|
|
|
if (x > l) break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
|
|
|
if (a == -1)
|
|
|
|
{
|
|
|
|
if (s->pal == 12)
|
|
|
|
s->xvel = 164;
|
|
|
|
else s->xvel = 140;
|
|
|
|
s->ang = ps->ang;
|
|
|
|
ps->toggle_key_flag = 2;
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-08-10 19:11:56 +00:00
|
|
|
|
|
|
|
if (x < 512 && s->sectnum == ps->cursectnum)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
s->ang = getangle(s->x-ps->pos.x,s->y-ps->pos.y);
|
2006-11-16 03:02:42 +00:00
|
|
|
s->xvel = 48;
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-04-13 10:46:04 +00:00
|
|
|
case FORCESPHERE__STATIC:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->yvel == 0)
|
|
|
|
{
|
|
|
|
s->yvel = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (l=512; l<(2048-512); l+= 128)
|
|
|
|
for (j=0; j<2048; j += 128)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t k = A_Spawn(i,FORCESPHERE);
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[k].cstat = 257+128;
|
|
|
|
sprite[k].clipdist = 64;
|
|
|
|
sprite[k].ang = j;
|
|
|
|
sprite[k].zvel = sintable[l&2047]>>5;
|
|
|
|
sprite[k].xvel = sintable[(l+512)&2047]>>9;
|
|
|
|
sprite[k].owner = i;
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[3] > 0)
|
|
|
|
{
|
|
|
|
if (s->zvel < 6144)
|
|
|
|
s->zvel += 192;
|
|
|
|
s->z += s->zvel;
|
|
|
|
if (s->z > sector[sect].floorz)
|
|
|
|
s->z = sector[sect].floorz;
|
|
|
|
t[3]--;
|
|
|
|
if (t[3] == 0)
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
else if (t[2] > 10)
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_MISC, j))
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[j].owner == i && sprite[j].picnum == FORCESPHERE)
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].t_data[1] = 1+(krand()&63);
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
t[3] = 64;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case RECON__STATIC:
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
int32_t p;
|
|
|
|
DukePlayer_t *ps;
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_GetZLimits(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sector[s->sectnum].ceilingstat&1)
|
|
|
|
s->shade += (sector[s->sectnum].ceilingshade-s->shade)>>1;
|
|
|
|
else s->shade += (sector[s->sectnum].floorshade-s->shade)>>1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->z < sector[sect].ceilingz+(32<<8))
|
|
|
|
s->z = sector[sect].ceilingz+(32<<8);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-06 20:00:31 +00:00
|
|
|
#if 0 //def POLYMER
|
|
|
|
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].sector = s->sectnum;
|
|
|
|
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].x = s->x;
|
|
|
|
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].y = s->y;
|
|
|
|
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].z = s->z + 10248;
|
|
|
|
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].range = 8192;
|
|
|
|
|
|
|
|
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].angle = s->ang;
|
|
|
|
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].horiz = 100;
|
|
|
|
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].radius = 256;
|
|
|
|
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].faderadius = 200;
|
|
|
|
|
|
|
|
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[0] = 255;
|
|
|
|
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[1] = 255;
|
|
|
|
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[2] = 255;
|
|
|
|
|
|
|
|
gamelights[gamelightcount&(PR_MAXLIGHTS-1)].priority = PR_LIGHT_PRIO_MAX_GAME;
|
|
|
|
|
|
|
|
if (gamelightcount < PR_MAXLIGHTS)
|
|
|
|
gamelightcount++;
|
|
|
|
#endif
|
2009-04-12 13:02:36 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (!g_netServer && ud.multimode < 2)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (g_noEnemies == 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-11-18 19:01:34 +00:00
|
|
|
s->cstat = 32768;
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (g_noEnemies == 2) s->cstat = 257;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
if (A_IncurDamage(i) >= 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
if (s->extra < 0 && t[0] != -1)
|
2007-08-25 01:05:00 +00:00
|
|
|
{
|
|
|
|
t[0] = -1;
|
2006-11-16 03:02:42 +00:00
|
|
|
s->extra = 0;
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(RECO_PAIN,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
RANDOMSCRAP;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[0] == -1)
|
|
|
|
{
|
|
|
|
s->z += 1024;
|
|
|
|
t[2]++;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
|
|
|
if ((t[2]&3) == 0)
|
|
|
|
A_Spawn(i,EXPLOSION2);
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_GetZLimits(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
s->ang += 96;
|
|
|
|
s->xvel = 128;
|
2008-11-20 14:06:36 +00:00
|
|
|
j = A_SetSprite(i,CLIPMASK0);
|
2013-04-15 10:48:09 +00:00
|
|
|
|
|
|
|
if (!j || s->z > actor[i].floorz)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2009-02-19 16:47:54 +00:00
|
|
|
for (l=0; l<16; l++)
|
2006-11-16 03:02:42 +00:00
|
|
|
RANDOMSCRAP;
|
2010-07-03 08:53:57 +00:00
|
|
|
j = A_Spawn(i,EXPLOSION2);
|
|
|
|
A_PlaySound(LASERTRIP_EXPLODE,j);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(i,PIGCOP);
|
2007-08-27 06:46:31 +00:00
|
|
|
g_player[myconnectindex].ps->actors_killed++;
|
2006-11-16 03:02:42 +00:00
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (s->z > actor[i].floorz-(48<<8))
|
|
|
|
s->z = actor[i].floorz-(48<<8);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
p = A_FindPlayer(s,&x);
|
2012-08-10 19:11:56 +00:00
|
|
|
ps = g_player[p].ps;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
j = s->owner;
|
|
|
|
|
|
|
|
// 3 = findplayerz, 4 = shoot
|
|
|
|
|
|
|
|
if (t[0] >= 4)
|
|
|
|
{
|
|
|
|
t[2]++;
|
|
|
|
if ((t[2]&15) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t a = s->ang;
|
2010-05-02 23:27:30 +00:00
|
|
|
s->ang = actor[i].tempang;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(RECO_ATTACK,i);
|
|
|
|
A_Shoot(i,FIRELASER);
|
2006-11-16 03:02:42 +00:00
|
|
|
s->ang = a;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-08-10 19:11:56 +00:00
|
|
|
if (t[2] > (GAMETICSPERSEC*3) || !cansee(s->x,s->y,s->z-(16<<8),s->sectnum, ps->pos.x,ps->pos.y,ps->pos.z,ps->cursectnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0] = 0;
|
|
|
|
t[2] = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else actor[i].tempang +=
|
2012-08-10 19:11:56 +00:00
|
|
|
G_GetAngleDelta(actor[i].tempang,getangle(ps->pos.x-s->x,ps->pos.y-s->y))/3;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else if (t[0] == 2 || t[0] == 3)
|
|
|
|
{
|
|
|
|
t[3] = 0;
|
|
|
|
if (s->xvel > 0) s->xvel -= 16;
|
|
|
|
else s->xvel = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] == 2)
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
l = ps->pos.z-s->z;
|
2006-11-16 03:02:42 +00:00
|
|
|
if (klabs(l) < (48<<8)) t[0] = 3;
|
2012-08-10 19:11:56 +00:00
|
|
|
else s->z += ksgn(ps->pos.z-s->z)<<10;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
t[2]++;
|
2012-08-10 19:11:56 +00:00
|
|
|
if (t[2] > (GAMETICSPERSEC*3) || !cansee(s->x,s->y,s->z-(16<<8),s->sectnum, ps->pos.x,ps->pos.y,ps->pos.z,ps->cursectnum))
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0] = 1;
|
2006-11-15 01:16:55 +00:00
|
|
|
t[2] = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else if ((t[2]&15) == 0)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(RECO_ATTACK,i);
|
|
|
|
A_Shoot(i,FIRELASER);
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-08-10 19:11:56 +00:00
|
|
|
s->ang += G_GetAngleDelta(s->ang,getangle(ps->pos.x-s->x,ps->pos.y-s->y))>>2;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (t[0] != 2 && t[0] != 3)
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t a;
|
2006-11-16 03:02:42 +00:00
|
|
|
l = ldist(&sprite[j],s);
|
|
|
|
if (l <= 1524)
|
|
|
|
{
|
|
|
|
a = s->ang;
|
|
|
|
s->xvel >>= 1;
|
|
|
|
}
|
|
|
|
else a = getangle(sprite[j].x-s->x,sprite[j].y-s->y);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] == 1 || t[0] == 4) // Found a locator and going with it
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
l = dist(&sprite[j],s);
|
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
if (l <= 1524)
|
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] == 1) t[0] = 0;
|
|
|
|
else t[0] = 5;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
// Control speed here
|
|
|
|
if (l > 1524)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel < 256) s->xvel += 32;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel > 0) s->xvel -= 16;
|
|
|
|
else s->xvel = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] < 2) t[2]++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
if (x < 6144 && t[0] < 2 && t[2] > (GAMETICSPERSEC*4))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
t[0] = 2+(krand()&2);
|
2006-11-16 03:02:42 +00:00
|
|
|
t[2] = 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].tempang = s->ang;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] == 0 || t[0] == 5)
|
|
|
|
{
|
|
|
|
if (t[0] == 0)
|
|
|
|
t[0] = 1;
|
|
|
|
else t[0] = 4;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
j = s->owner = A_FindLocator(s->hitag,-1);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j == -1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
s->hitag = j = actor[i].t_data[5];
|
2008-11-20 14:06:36 +00:00
|
|
|
s->owner = A_FindLocator(j,-1);
|
2006-11-16 03:02:42 +00:00
|
|
|
j = s->owner;
|
2012-04-13 10:46:04 +00:00
|
|
|
if (j == -1)
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else s->hitag++;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
|
|
|
|
2012-08-06 20:00:31 +00:00
|
|
|
// RECON_T4
|
2008-11-20 14:06:36 +00:00
|
|
|
t[3] = G_GetAngleDelta(s->ang,a);
|
2006-11-16 03:02:42 +00:00
|
|
|
s->ang += t[3]>>3;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
if (s->z < sprite[j].z-512)
|
2008-11-20 14:06:36 +00:00
|
|
|
s->z += 512;
|
2013-04-15 10:48:09 +00:00
|
|
|
else if (s->z > sprite[j].z+512)
|
2008-11-20 14:06:36 +00:00
|
|
|
s->z -= 512;
|
|
|
|
else s->z = sprite[j].z;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (!A_CheckSoundPlaying(i,RECO_ROAM))
|
|
|
|
A_PlaySound(RECO_ROAM,i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SetSprite(i,CLIPMASK0);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case OOZ__STATIC:
|
|
|
|
case OOZ2__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
A_GetZLimits(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
j = (actor[i].floorz-actor[i].ceilingz)>>9;
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j > 255) j = 255;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
x = 25-(j>>1);
|
|
|
|
if (x < 8) x = 8;
|
|
|
|
else if (x > 48) x = 48;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->yrepeat = j;
|
|
|
|
s->xrepeat = x;
|
2010-05-02 23:27:30 +00:00
|
|
|
s->z = actor[i].floorz;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
|
|
|
|
|
|
|
case GREENSLIME__STATIC:
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
int32_t p;
|
|
|
|
DukePlayer_t *ps;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
// #ifndef VOLUMEONE
|
2012-08-07 13:08:57 +00:00
|
|
|
if (!g_netServer && ud.multimode < 2)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (g_noEnemies == 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-11-18 19:01:34 +00:00
|
|
|
s->cstat = 32768;
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (g_noEnemies == 2) s->cstat = 257;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
// #endif
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
t[1]+=128;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sector[sect].floorstat&1)
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
p = A_FindPlayer(s,&x);
|
2012-08-10 19:11:56 +00:00
|
|
|
ps = g_player[p].ps;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x > 20480)
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].timetosleep++;
|
|
|
|
if (actor[i].timetosleep > SLEEPTIME)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].timetosleep = 0;
|
2009-04-24 06:04:13 +00:00
|
|
|
changespritestat(i, STAT_ZOMBIEACTOR);
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] == -5) // FROZEN
|
|
|
|
{
|
|
|
|
t[3]++;
|
|
|
|
if (t[3] > 280)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
s->pal = 0;
|
|
|
|
t[0] = 0;
|
2006-11-15 01:16:55 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
s->cstat = 257;
|
|
|
|
s->picnum = GREENSLIME+2;
|
|
|
|
s->extra = 1;
|
|
|
|
s->pal = 1;
|
2011-02-25 21:50:19 +00:00
|
|
|
if ((j = A_IncurDamage(i)) >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j == FREEZEBLAST) goto BOLT;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=16; j >= 0 ; j--)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t k = A_InsertSprite(SECT,SX,SY,SZ,GLASSPIECES+(j%3),-32,36,36,krand()&2047,32+(krand()&63),1024-(krand()&1023),i,5);
|
2007-08-25 01:05:00 +00:00
|
|
|
sprite[k].pal = 1;
|
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(GLASS_BREAKING,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
KILLIT(i);
|
|
|
|
}
|
2012-08-10 19:11:56 +00:00
|
|
|
else if (x < 1024 && ps->quick_kick == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
j = G_GetAngleDelta(ps->ang,getangle(SX-ps->pos.x,SY-ps->pos.y));
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j > -128 && j < 128)
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->quick_kick = 14;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x < 1596)
|
|
|
|
s->cstat = 0;
|
|
|
|
else s->cstat = 257;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] == -4) //On the player
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
if (sprite[ps->i].extra < 1)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
t[0] = 0;
|
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
s->ang = ps->ang;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
if ((TEST_SYNC_KEY(g_player[p].sync->bits, SK_FIRE) || (ps->quick_kick > 0)) && sprite[ps->i].extra > 0)
|
2014-10-25 03:25:57 +00:00
|
|
|
if (ps->quick_kick > 0 ||
|
2016-06-05 04:46:28 +00:00
|
|
|
(PWEAPON(p, ps->curr_weapon, WorksLike) != HANDREMOTE_WEAPON && PWEAPON(p, ps->curr_weapon, WorksLike) != HANDBOMB_WEAPON &&
|
2014-10-25 03:25:57 +00:00
|
|
|
PWEAPON(p, ps->curr_weapon, WorksLike) != TRIPBOMB_WEAPON && ps->ammo_amount[ps->curr_weapon] >= 0))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=0; x<8; x++)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
j = A_InsertSprite(sect,s->x,s->y,s->z-(8<<8),SCRAP3+(krand()&3),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(s->zvel>>2),i,5);
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[j].pal = 6;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(SLIM_DYING,i);
|
|
|
|
A_PlaySound(SQUISHED,i);
|
|
|
|
if ((krand()&255) < 32)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
j = A_Spawn(i,BLOODPOOL);
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[j].pal = 0;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->actors_killed ++;
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0] = -3;
|
2012-08-10 19:11:56 +00:00
|
|
|
if (ps->somethingonplayer == i)
|
|
|
|
ps->somethingonplayer = -1;
|
2006-11-16 03:02:42 +00:00
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
s->z = ps->pos.z+ps->pyoff-t[2]+(8<<8);
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
s->z += (100-ps->horiz)<<4;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[2] > 512)
|
|
|
|
t[2] -= 128;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[2] < 348)
|
|
|
|
t[2] += 128;
|
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
if (ps->newowner >= 0)
|
|
|
|
G_ClearCameraView(ps);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[3]>0)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2012-05-01 12:41:35 +00:00
|
|
|
static const char frames[] = {5,5,6,6,7,7,6,5};
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->picnum = GREENSLIME+frames[t[3]];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[3] == 5)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
sprite[ps->i].extra += -(5+(krand()&3));
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(SLIM_ATTACK,i);
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[3] < 7) t[3]++;
|
|
|
|
else t[3] = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
s->picnum = GREENSLIME+5;
|
|
|
|
if (rnd(32))
|
|
|
|
t[3] = 1;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->xrepeat = 20+(sintable[t[1]&2047]>>13);
|
|
|
|
s->yrepeat = 15+(sintable[t[1]&2047]>>13);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
s->x = ps->pos.x + (sintable[(ps->ang+512)&2047]>>7);
|
|
|
|
s->y = ps->pos.y + (sintable[ps->ang&2047]>>7);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
else if (s->xvel < 64 && x < 768)
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
if (ps->somethingonplayer == -1)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->somethingonplayer = i;
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] == 3 || t[0] == 2) //Falling downward
|
|
|
|
t[2] = (12<<8);
|
|
|
|
else t[2] = -(13<<8); //Climbing up duke
|
|
|
|
t[0] = -4;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
if ((j = A_IncurDamage(i)) >= 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(SLIM_DYING,i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->actors_killed ++;
|
|
|
|
if (ps->somethingonplayer == i)
|
|
|
|
ps->somethingonplayer = -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j == FREEZEBLAST)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(SOMETHINGFROZE,i);
|
2007-08-25 01:05:00 +00:00
|
|
|
t[0] = -5 ;
|
|
|
|
t[3] = 0 ;
|
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if ((krand()&255) < 32)
|
2007-08-25 01:05:00 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
j = A_Spawn(i,BLOODPOOL);
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[j].pal = 0;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=0; x<8; x++)
|
2007-08-25 01:05:00 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
j = A_InsertSprite(sect,s->x,s->y,s->z-(8<<8),SCRAP3+(krand()&3),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(s->zvel>>2),i,5);
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[j].pal = 6;
|
|
|
|
}
|
|
|
|
t[0] = -3;
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
// All weap
|
|
|
|
if (t[0] == -1) //Shrinking down
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->cstat &= 65535-8;
|
|
|
|
s->picnum = GREENSLIME+4;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
// if(s->yrepeat > 62)
|
2008-11-20 14:06:36 +00:00
|
|
|
// A_DoGuts(s,JIBS6,5,myconnectindex);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (s->xrepeat > 32) s->xrepeat -= krand()&7;
|
|
|
|
if (s->yrepeat > 16) s->yrepeat -= krand()&7;
|
2006-11-16 03:02:42 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
s->xrepeat = 40;
|
|
|
|
s->yrepeat = 16;
|
|
|
|
t[5] = -1;
|
|
|
|
t[0] = 0;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (t[0] != -2) A_GetZLimits(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
if (t[0] == -2) //On top of somebody
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[t[5]].xvel = 0;
|
|
|
|
|
|
|
|
l = sprite[t[5]].ang;
|
|
|
|
|
|
|
|
s->z = sprite[t[5]].z;
|
|
|
|
s->x = sprite[t[5]].x+(sintable[(l+512)&2047]>>11);
|
|
|
|
s->y = sprite[t[5]].y+(sintable[l&2047]>>11);
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
s->picnum = GREENSLIME+2+(g_globalRandom&1);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
if (s->yrepeat < 64) s->yrepeat+=2;
|
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xrepeat < 32) s->xrepeat += 4;
|
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0] = -1;
|
|
|
|
x = ldist(s,&sprite[t[5]]);
|
|
|
|
if (x < 768)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[t[5]].xrepeat = 0;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
// JBF 20041129: a slimer eating another enemy really ought
|
|
|
|
// to decrease the maximum kill count by one.
|
2012-04-13 10:46:04 +00:00
|
|
|
if (sprite[t[5]].extra > 0)
|
|
|
|
g_player[myconnectindex].ps->max_actors_killed--;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
//Check randomly to see of there is an actor near
|
|
|
|
if (rnd(32))
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(sect, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2016-02-02 00:21:17 +00:00
|
|
|
if (A_CheckSpriteFlags(j, SFLAG_GREENSLIMEFOOD))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (ldist(s,&sprite[j]) < 768 && (klabs(s->z-sprite[j].z)<8192)) //Gulp them
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[5] = j;
|
|
|
|
t[0] = -2;
|
|
|
|
t[1] = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
//Moving on the ground or ceiling
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] == 0 || t[0] == 2)
|
|
|
|
{
|
|
|
|
s->picnum = GREENSLIME;
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if ((krand()&511) == 0)
|
|
|
|
A_PlaySound(SLIM_ROAM,i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0]==2)
|
|
|
|
{
|
|
|
|
s->zvel = 0;
|
|
|
|
s->cstat &= (65535-8);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if ((sector[sect].ceilingstat&1) || (actor[i].ceilingz+6144) < s->z)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
s->z += 2048;
|
|
|
|
t[0] = 3;
|
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
s->cstat |= 8;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (everyothertime&1) A_SetSprite(i,CLIPMASK0);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
if (s->xvel > 96)
|
|
|
|
{
|
|
|
|
s->xvel -= 2;
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel < 32) s->xvel += 4;
|
|
|
|
s->xvel = 64 - (sintable[(t[1]+512)&2047]>>9);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
s->ang += G_GetAngleDelta(s->ang,
|
2012-08-10 19:11:56 +00:00
|
|
|
getangle(ps->pos.x-s->x,ps->pos.y-s->y))>>3;
|
2006-11-16 03:02:42 +00:00
|
|
|
// TJR
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->xrepeat = 36 + (sintable[(t[1]+512)&2047]>>11);
|
|
|
|
s->yrepeat = 16 + (sintable[t[1]&2047]>>13);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (rnd(4) && (sector[sect].ceilingstat&1) == 0 &&
|
2010-05-02 23:27:30 +00:00
|
|
|
klabs(actor[i].floorz-actor[i].ceilingz)
|
2006-11-16 03:02:42 +00:00
|
|
|
< (192<<8))
|
|
|
|
{
|
|
|
|
s->zvel = 0;
|
|
|
|
t[0]++;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0]==1)
|
|
|
|
{
|
|
|
|
s->picnum = GREENSLIME;
|
|
|
|
if (s->yrepeat < 40) s->yrepeat+=8;
|
|
|
|
if (s->xrepeat > 8) s->xrepeat-=4;
|
|
|
|
if (s->zvel > -(2048+1024))
|
|
|
|
s->zvel -= 348;
|
|
|
|
s->z += s->zvel;
|
2010-05-02 23:27:30 +00:00
|
|
|
if (s->z < actor[i].ceilingz+4096)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
s->z = actor[i].ceilingz+4096;
|
2006-11-16 03:02:42 +00:00
|
|
|
s->xvel = 0;
|
|
|
|
t[0] = 2;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0]==3)
|
|
|
|
{
|
|
|
|
s->picnum = GREENSLIME+1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (s->z > actor[i].floorz-(8<<8))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
s->yrepeat-=4;
|
|
|
|
s->xrepeat+=2;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->yrepeat < (40-4)) s->yrepeat+=8;
|
|
|
|
if (s->xrepeat > 8) s->xrepeat-=4;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (s->z > actor[i].floorz-2048)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
s->z = actor[i].floorz-2048;
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0] = 0;
|
|
|
|
s->xvel = 0;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
goto BOLT;
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2015-08-02 08:50:31 +00:00
|
|
|
case BOUNCEMINE__STATIC:
|
2015-08-08 07:04:11 +00:00
|
|
|
if (s->xvel != 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
case MORTER__STATIC:
|
2015-08-08 07:04:11 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
j = A_Spawn(i,(PLUTOPAK?FRAMEEFFECT1:FRAMEEFFECT1_13));
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].t_data[0] = 3;
|
2015-08-08 07:04:11 +00:00
|
|
|
}
|
|
|
|
/* fall-through */
|
2006-11-16 03:02:42 +00:00
|
|
|
case HEAVYHBOMB__STATIC:
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
int32_t p;
|
|
|
|
DukePlayer_t *ps;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
if ((s->cstat&32768))
|
|
|
|
{
|
|
|
|
t[2]--;
|
|
|
|
if (t[2] <= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(TELEPORTER,i);
|
|
|
|
A_Spawn(i,TRANSPORTERSTAR);
|
2006-11-16 03:02:42 +00:00
|
|
|
s->cstat = 257;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
p = A_FindPlayer(s,&x);
|
2012-08-10 19:11:56 +00:00
|
|
|
ps = g_player[p].ps;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
if (x < 1220) s->cstat &= ~257;
|
|
|
|
else s->cstat |= 257;
|
|
|
|
|
|
|
|
if (t[3] == 0)
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (A_IncurDamage(i) >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
t[3] = 1;
|
2009-07-04 09:28:21 +00:00
|
|
|
t[2] = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
l = 0;
|
|
|
|
s->xvel = 0;
|
|
|
|
goto DETONATEB;
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->picnum != BOUNCEMINE)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if ((sector[sect].lotag != ST_1_ABOVE_WATER || actor[i].floorz != sector[sect].floorz) && s->z >= actor[i].floorz-(ZOFFSET) && s->yvel < 3)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (s->yvel > 0 || (s->yvel == 0 && actor[i].floorz == sector[sect].floorz))
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(PIPEBOMB_BOUNCE,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
s->zvel = -((4-s->yvel)<<8);
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[s->sectnum].lotag == ST_2_UNDERWATER)
|
2006-11-16 03:02:42 +00:00
|
|
|
s->zvel >>= 2;
|
|
|
|
s->yvel++;
|
|
|
|
}
|
2012-10-14 20:41:21 +00:00
|
|
|
if (s->z < actor[i].ceilingz) // && sector[sect].lotag != ST_2_UNDERWATER )
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
s->z = actor[i].ceilingz+(3<<8);
|
2006-11-16 03:02:42 +00:00
|
|
|
s->zvel = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-13 04:40:56 +00:00
|
|
|
{
|
|
|
|
vec3_t tmpvect;
|
|
|
|
|
|
|
|
tmpvect.x = (s->xvel*(sintable[(s->ang+512)&2047]))>>14;
|
|
|
|
tmpvect.y = (s->xvel*(sintable[s->ang&2047]))>>14;
|
|
|
|
tmpvect.z = s->zvel;
|
|
|
|
j = A_MoveSprite(i,&tmpvect,CLIPMASK0);
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].movflag = j;
|
2008-08-26 04:00:42 +00:00
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[SECT].lotag == ST_1_ABOVE_WATER && s->zvel == 0 && actor[i].floorz == sector[sect].floorz)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
s->z += (32<<8);
|
|
|
|
if (t[5] == 0)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[5] = 1;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(i,WATERSPLASH2);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else t[5] = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[3] == 0 && (s->picnum == BOUNCEMINE || s->picnum == MORTER) && (j || x < 844))
|
|
|
|
{
|
|
|
|
t[3] = 1;
|
2009-07-04 09:28:21 +00:00
|
|
|
t[2] = 0;
|
2006-11-16 03:02:42 +00:00
|
|
|
l = 0;
|
|
|
|
s->xvel = 0;
|
|
|
|
goto DETONATEB;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[s->owner].picnum == APLAYER)
|
2013-12-28 17:04:27 +00:00
|
|
|
l = P_Get(s->owner);
|
2006-11-16 03:02:42 +00:00
|
|
|
else l = -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel > 0)
|
|
|
|
{
|
|
|
|
s->xvel -= 5;
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[sect].lotag == ST_2_UNDERWATER)
|
2006-11-16 03:02:42 +00:00
|
|
|
s->xvel -= 10;
|
|
|
|
|
|
|
|
if (s->xvel < 0)
|
|
|
|
s->xvel = 0;
|
|
|
|
if (s->xvel&8) s->cstat ^= 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((j&49152) == 32768)
|
|
|
|
{
|
2009-01-13 04:40:56 +00:00
|
|
|
vec3_t davect;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
j &= (MAXWALLS-1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
Bmemcpy(&davect, s, sizeof(vec3_t));
|
2009-01-13 04:40:56 +00:00
|
|
|
A_DamageWall(i,j,&davect,s->picnum);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2013-02-07 21:00:55 +00:00
|
|
|
Proj_BounceOffWall(s, j);
|
2006-11-16 03:02:42 +00:00
|
|
|
s->xvel >>= 1;
|
|
|
|
}
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
DETONATEB:
|
2013-01-20 21:16:58 +00:00
|
|
|
// Pipebomb control set to timer? (see player.c)
|
2014-01-12 14:54:34 +00:00
|
|
|
// TIMER_CONTROL
|
2008-08-09 22:02:57 +00:00
|
|
|
if (s->picnum == HEAVYHBOMB && t[6] == 1)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
/* if(s->extra >= 1)
|
|
|
|
{
|
|
|
|
s->extra--;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(s->extra <= 0)
|
|
|
|
s->lotag=911;
|
|
|
|
*/
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-17 22:48:31 +00:00
|
|
|
if (t[7] >= 1)
|
2008-08-09 22:02:57 +00:00
|
|
|
t[7]--;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-17 22:48:31 +00:00
|
|
|
if (t[7] <= 0)
|
2008-08-09 22:02:57 +00:00
|
|
|
t[6] = 3;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-08-09 22:02:57 +00:00
|
|
|
if ((l >= 0 && g_player[l].ps->hbomb_on == 0 && t[6] == 2) || t[3] == 1)
|
|
|
|
t[6] = 3;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-08-09 22:02:57 +00:00
|
|
|
if (t[6] == 3)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2009-07-04 09:28:21 +00:00
|
|
|
t[2]++;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-07-04 09:28:21 +00:00
|
|
|
if (t[2] == 2)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2010-07-03 08:53:57 +00:00
|
|
|
int32_t j;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
x = s->extra;
|
|
|
|
m = 0;
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(s->picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case HEAVYHBOMB__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
m = g_pipebombBlastRadius;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case MORTER__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
m = g_morterBlastRadius;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case BOUNCEMINE__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
m = g_bouncemineBlastRadius;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_RadiusDamage(i, m,x>>2,x>>1,x-(x>>2),x);
|
2010-07-03 08:53:57 +00:00
|
|
|
j = A_Spawn(i,EXPLOSION2);
|
|
|
|
A_PlaySound(PIPEBOMB_EXPLODE,j);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->zvel == 0)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(i,EXPLOSION2BOT);
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=0; x<8; x++)
|
2006-11-16 03:02:42 +00:00
|
|
|
RANDOMSCRAP;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->yrepeat)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
s->yrepeat = 0;
|
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-07-04 09:28:21 +00:00
|
|
|
if (t[2] > 20)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
if (s->owner != i || ud.respawn_items == 0)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
KILLIT(i);
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
t[2] = g_itemRespawnTime;
|
|
|
|
A_Spawn(i,RESPAWNMARKERRED);
|
2012-11-18 19:01:34 +00:00
|
|
|
s->cstat = 32768;
|
2006-11-16 03:02:42 +00:00
|
|
|
s->yrepeat = 9;
|
2006-11-15 01:16:55 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (s->picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && s->xvel == 0)
|
2012-08-10 19:11:56 +00:00
|
|
|
if (cansee(s->x,s->y,s->z-(8<<8),s->sectnum,ps->pos.x,ps->pos.y,ps->pos.z,ps->cursectnum))
|
|
|
|
if (ps->ammo_amount[HANDBOMB_WEAPON] < ps->max_ammo_amount[HANDBOMB_WEAPON])
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if ((GametypeFlags[ud.coop] & GAMETYPE_WEAPSTAY) && s->owner == i)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
for (j=0; j<ps->weapreccnt; j++)
|
|
|
|
if (ps->weaprecs[j] == s->picnum)
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
if (ps->weapreccnt < MAX_WEAPONS)
|
|
|
|
ps->weaprecs[ps->weapreccnt++] = s->picnum;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
P_AddAmmo(HANDBOMB_WEAPON,ps,1);
|
|
|
|
A_PlaySound(DUKE_GET,ps->i);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
if ((ps->gotweapon & (1<<HANDBOMB_WEAPON)) == 0 || s->owner == ps->i)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-12-26 19:45:00 +00:00
|
|
|
int32_t doswitch = ((ps->weaponswitch & 1) ||
|
2014-10-25 03:27:01 +00:00
|
|
|
PWEAPON(p, ps->curr_weapon, WorksLike) == HANDREMOTE_WEAPON);
|
2013-12-26 19:45:00 +00:00
|
|
|
P_AddWeapon(ps, HANDBOMB_WEAPON, doswitch);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (sprite[s->owner].picnum != APLAYER)
|
2012-08-10 19:11:56 +00:00
|
|
|
P_PalFrom(ps, 32, 0,32,0);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->owner != i || ud.respawn_items == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (s->owner == i && (GametypeFlags[ud.coop] & GAMETYPE_WEAPSTAY))
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
t[2] = g_itemRespawnTime;
|
|
|
|
A_Spawn(i,RESPAWNMARKERRED);
|
2012-11-18 19:01:34 +00:00
|
|
|
s->cstat = 32768;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] < 8) t[0]++;
|
|
|
|
goto BOLT;
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case REACTORBURNT__STATIC:
|
|
|
|
case REACTOR2BURNT__STATIC:
|
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case REACTOR__STATIC:
|
|
|
|
case REACTOR2__STATIC:
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
int32_t p;
|
|
|
|
DukePlayer_t *ps;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[4] == 1)
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(sect, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(sprite[j].picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case SECTOREFFECTOR__STATIC:
|
|
|
|
if (sprite[j].lotag == 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-11-18 19:01:34 +00:00
|
|
|
sprite[j].lotag = 65535;
|
|
|
|
sprite[j].hitag = 65535;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case REACTOR__STATIC:
|
|
|
|
sprite[j].picnum = REACTORBURNT;
|
|
|
|
break;
|
|
|
|
case REACTOR2__STATIC:
|
|
|
|
sprite[j].picnum = REACTOR2BURNT;
|
|
|
|
break;
|
|
|
|
case REACTORSPARK__STATIC:
|
|
|
|
case REACTOR2SPARK__STATIC:
|
2012-11-18 19:01:34 +00:00
|
|
|
sprite[j].cstat = 32768;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[1] >= 20)
|
|
|
|
{
|
|
|
|
t[4] = 1;
|
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
p = A_FindPlayer(s,&x);
|
2012-08-10 19:11:56 +00:00
|
|
|
ps = g_player[p].ps;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
t[2]++;
|
|
|
|
if (t[2] == 4) t[2]=0;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x < 4096)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if ((krand()&255) < 16)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
if (!A_CheckSoundPlaying(ps->i, DUKE_LONGTERM_PAIN))
|
|
|
|
A_PlaySound(DUKE_LONGTERM_PAIN,ps->i);
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(SHORT_CIRCUIT,i);
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
sprite[ps->i].extra --;
|
2012-05-05 22:24:50 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
P_PalFrom(ps, 32, 32,0,0);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0] += 128;
|
|
|
|
if (t[3] == 0)
|
|
|
|
t[3] = 1;
|
|
|
|
}
|
|
|
|
else t[3] = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[1])
|
|
|
|
{
|
|
|
|
t[1]++;
|
|
|
|
|
|
|
|
t[4] = s->z;
|
2008-11-20 14:06:36 +00:00
|
|
|
s->z = sector[sect].floorz-(krand()%(sector[sect].floorz-sector[sect].ceilingz));
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
switch (t[1])
|
|
|
|
{
|
|
|
|
case 3:
|
|
|
|
//Turn on all of those flashing sectoreffector.
|
2008-11-20 14:06:36 +00:00
|
|
|
A_RadiusDamage(i, 4096,
|
|
|
|
g_impactDamage<<2,
|
|
|
|
g_impactDamage<<2,
|
|
|
|
g_impactDamage<<2,
|
|
|
|
g_impactDamage<<2);
|
2013-04-15 10:48:09 +00:00
|
|
|
|
|
|
|
for (SPRITES_OF(STAT_STANDABLE, j))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
if (sprite[j].picnum == MASTERSWITCH)
|
|
|
|
if (sprite[j].hitag == s->hitag)
|
|
|
|
if (sprite[j].yvel == 0)
|
|
|
|
sprite[j].yvel = 1;
|
|
|
|
}
|
|
|
|
break;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case 4:
|
|
|
|
case 7:
|
|
|
|
case 10:
|
|
|
|
case 15:
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(sect, j))
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j != i)
|
|
|
|
{
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(j);
|
2006-11-15 01:16:55 +00:00
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=0; x<16; x++)
|
2006-11-16 03:02:42 +00:00
|
|
|
RANDOMSCRAP;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->z = t[4];
|
|
|
|
t[4] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (A_IncurDamage(i) >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=0; x<32; x++)
|
2007-08-25 01:05:00 +00:00
|
|
|
RANDOMSCRAP;
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->extra < 0)
|
|
|
|
t[1] = 1;
|
|
|
|
}
|
2007-08-25 01:05:00 +00:00
|
|
|
}
|
|
|
|
goto BOLT;
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-25 01:05:00 +00:00
|
|
|
case CAMERA1__STATIC:
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2007-08-25 01:05:00 +00:00
|
|
|
if (t[0] == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
t[1]+=8;
|
2008-11-20 14:06:36 +00:00
|
|
|
if (g_damageCameras)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (A_IncurDamage(i) >= 0)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0] = 1; // static
|
2012-11-18 19:01:34 +00:00
|
|
|
s->cstat = 32768;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=0; x<5; x++) RANDOMSCRAP;
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2007-08-25 01:05:00 +00:00
|
|
|
if (s->hitag > 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (t[1] < s->hitag)
|
2006-11-16 03:02:42 +00:00
|
|
|
s->ang+=8;
|
2013-04-15 10:48:09 +00:00
|
|
|
else if (t[1] < s->hitag*3)
|
2006-11-16 03:02:42 +00:00
|
|
|
s->ang-=8;
|
|
|
|
else if (t[1] < (s->hitag<<2))
|
|
|
|
s->ang+=8;
|
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[1]=8;
|
|
|
|
s->ang+=16;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
if (!g_netServer && ud.multimode < 2 && A_CheckEnemySprite(s))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (g_noEnemies == 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-11-18 19:01:34 +00:00
|
|
|
s->cstat = 32768;
|
2006-04-13 20:47:06 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (g_noEnemies == 2)
|
2006-12-17 21:20:35 +00:00
|
|
|
{
|
|
|
|
s->cstat = 0;
|
|
|
|
if (s->extra)
|
|
|
|
s->cstat = 257;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2008-08-09 22:02:57 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
if (G_HaveActor(sprite[i].picnum))
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
int32_t p = A_FindPlayer(s,&x);
|
|
|
|
A_Execute(i,p,x);
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
BOLT:
|
|
|
|
i = nexti;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t i = headspritestat[STAT_MISC];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
while (i >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
const int32_t nexti = nextspritestat[i];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t l, x;
|
|
|
|
int32_t *const t = actor[i].t_data;
|
|
|
|
|
|
|
|
spritetype *const s = &sprite[i];
|
|
|
|
int32_t sect = s->sectnum; // XXX: not const
|
|
|
|
int32_t switchpicnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-04-13 10:46:04 +00:00
|
|
|
if (sect < 0 || s->xrepeat == 0)
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-11-04 18:21:07 +00:00
|
|
|
Bmemcpy(&actor[i].bpos, s, sizeof(vec3_t));
|
2009-08-28 23:08:00 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
switchpicnum = s->picnum;
|
2012-09-12 09:45:14 +00:00
|
|
|
if (s->picnum > NUKEBUTTON && s->picnum <= NUKEBUTTON+3)
|
2006-04-13 20:47:06 +00:00
|
|
|
switchpicnum = NUKEBUTTON;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2012-09-12 09:45:14 +00:00
|
|
|
if (s->picnum > GLASSPIECES && s->picnum <= GLASSPIECES+2)
|
2006-04-13 20:47:06 +00:00
|
|
|
switchpicnum = GLASSPIECES;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2012-09-12 09:45:14 +00:00
|
|
|
if (s->picnum == INNERJAW+1)
|
2006-04-13 20:47:06 +00:00
|
|
|
switchpicnum--;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if ((s->picnum == MONEY+1) || (s->picnum == MAIL+1) || (s->picnum == PAPER+1))
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].floorz = s->z = getflorzofslope(s->sectnum,s->x,s->y);
|
2012-01-28 14:38:23 +00:00
|
|
|
else switch (DYNAMICTILEMAP(switchpicnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-12-05 09:22:43 +00:00
|
|
|
case APLAYER__STATIC:
|
|
|
|
s->cstat = 32768;
|
|
|
|
goto BOLT;
|
2006-11-16 03:02:42 +00:00
|
|
|
case NEON1__STATIC:
|
|
|
|
case NEON2__STATIC:
|
|
|
|
case NEON3__STATIC:
|
|
|
|
case NEON4__STATIC:
|
|
|
|
case NEON5__STATIC:
|
|
|
|
case NEON6__STATIC:
|
|
|
|
|
2015-04-18 21:59:17 +00:00
|
|
|
if ((tabledivide32_noinline(g_globalRandom, s->lotag+1)&31) > 4)
|
|
|
|
s->shade = -127;
|
2006-11-16 03:02:42 +00:00
|
|
|
else s->shade = 127;
|
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case BLOODSPLAT1__STATIC:
|
|
|
|
case BLOODSPLAT2__STATIC:
|
|
|
|
case BLOODSPLAT3__STATIC:
|
|
|
|
case BLOODSPLAT4__STATIC:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2015-10-21 19:54:02 +00:00
|
|
|
if (t[0] == 3*GAMETICSPERSEC) goto BOLT;
|
|
|
|
actor[i].bpos.z -= s->z;
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0]++;
|
2015-10-21 19:54:02 +00:00
|
|
|
if ((t[0]%9) == 0)
|
|
|
|
{
|
|
|
|
s->yrepeat++;
|
|
|
|
s->z += (tilesiz[s->picnum].y*s->yrepeat)>>2;
|
|
|
|
}
|
|
|
|
else s->z += 16 + (krand() & 15);
|
|
|
|
actor[i].bpos.z += s->z;
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case NUKEBUTTON__STATIC:
|
|
|
|
// case NUKEBUTTON+1:
|
|
|
|
// case NUKEBUTTON+2:
|
|
|
|
// case NUKEBUTTON+3:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0])
|
|
|
|
{
|
|
|
|
t[0]++;
|
|
|
|
if (t[0] == 8) s->picnum = NUKEBUTTON+1;
|
|
|
|
else if (t[0] == 16)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
s->picnum = NUKEBUTTON+2;
|
2013-12-28 17:04:27 +00:00
|
|
|
g_player[P_Get(s->owner)].ps->fist_incs = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2013-12-28 17:04:27 +00:00
|
|
|
if (g_player[P_Get(s->owner)].ps->fist_incs == GAMETICSPERSEC)
|
2006-11-16 03:02:42 +00:00
|
|
|
s->picnum = NUKEBUTTON+3;
|
|
|
|
}
|
|
|
|
goto BOLT;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case FORCESPHERE__STATIC:
|
2013-04-15 10:48:09 +00:00
|
|
|
{
|
|
|
|
int32_t j;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
l = s->xrepeat;
|
|
|
|
if (t[1] > 0)
|
|
|
|
{
|
|
|
|
t[1]--;
|
|
|
|
if (t[1] == 0)
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[s->owner].t_data[1] == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
if (t[0] < 64)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0]++;
|
|
|
|
l += 3;
|
|
|
|
}
|
|
|
|
}
|
2009-02-19 16:47:54 +00:00
|
|
|
else if (t[0] > 64)
|
|
|
|
{
|
|
|
|
t[0]--;
|
|
|
|
l -= 3;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->x = sprite[s->owner].x;
|
|
|
|
s->y = sprite[s->owner].y;
|
|
|
|
s->z = sprite[s->owner].z;
|
2010-05-02 23:27:30 +00:00
|
|
|
s->ang += actor[s->owner].t_data[0];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (l > 64) l = 64;
|
|
|
|
else if (l < 1) l = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->xrepeat = l;
|
|
|
|
s->yrepeat = l;
|
|
|
|
s->shade = (l>>1)-48;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=t[0]; j > 0; j--)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SetSprite(i,CLIPMASK0);
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2013-04-15 10:48:09 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2012-08-06 20:00:31 +00:00
|
|
|
case WATERSPLASH2__STATIC:
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0]++;
|
|
|
|
if (t[0] == 1)
|
|
|
|
{
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[sect].lotag != ST_1_ABOVE_WATER && sector[sect].lotag != ST_2_UNDERWATER)
|
2006-11-16 03:02:42 +00:00
|
|
|
KILLIT(i);
|
2012-08-06 20:00:31 +00:00
|
|
|
/*
|
|
|
|
else
|
|
|
|
{
|
|
|
|
l = getflorzofslope(sect,s->x,s->y)-s->z;
|
|
|
|
if( l > (16<<8) ) KILLIT(i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*/
|
2008-11-20 14:06:36 +00:00
|
|
|
if (!S_CheckSoundPlaying(i,ITEM_SPLASH))
|
|
|
|
A_PlaySound(ITEM_SPLASH,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
if (t[0] == 3)
|
|
|
|
{
|
|
|
|
t[0] = 0;
|
2012-08-06 20:00:31 +00:00
|
|
|
t[1]++; // WATERSPLASH_T2
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
if (t[1] == 5)
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2012-08-06 20:00:31 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case FRAMEEFFECT1_13__STATIC:
|
|
|
|
if (PLUTOPAK) goto BOLT; // JBF: ideally this should never happen...
|
|
|
|
case FRAMEEFFECT1__STATIC:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->owner >= 0)
|
|
|
|
{
|
2006-04-13 20:47:06 +00:00
|
|
|
t[0]++;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] > 7)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
KILLIT(i);
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else if (t[0] > 4)
|
|
|
|
s->cstat |= 512+2;
|
|
|
|
else if (t[0] > 2)
|
|
|
|
s->cstat |= 2;
|
|
|
|
s->xoffset = sprite[s->owner].xoffset;
|
|
|
|
s->yoffset = sprite[s->owner].yoffset;
|
|
|
|
}
|
|
|
|
goto BOLT;
|
|
|
|
case INNERJAW__STATIC:
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
// case INNERJAW+1:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
int32_t p = A_FindPlayer(s,&x);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x < 512)
|
|
|
|
{
|
2012-05-05 22:24:50 +00:00
|
|
|
P_PalFrom(g_player[p].ps, 32, 32,0,0);
|
2007-08-27 06:46:31 +00:00
|
|
|
sprite[g_player[p].ps->i].extra -= 4;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case FIRELASER__STATIC:
|
2009-04-30 21:09:44 +00:00
|
|
|
if (s->extra != 5)
|
|
|
|
s->extra = 5;
|
2006-11-16 03:02:42 +00:00
|
|
|
else KILLIT(i);
|
|
|
|
break;
|
|
|
|
case TONGUE__STATIC:
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case MONEY__STATIC:
|
|
|
|
case MAIL__STATIC:
|
|
|
|
case PAPER__STATIC:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
s->xvel = (krand()&7)+(sintable[T1&2047]>>9);
|
|
|
|
T1 += (krand()&63);
|
2006-11-16 03:02:42 +00:00
|
|
|
if ((T1&2047) > 512 && (T1&2047) < 1596)
|
|
|
|
{
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[sect].lotag == ST_2_UNDERWATER)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->zvel < 64)
|
2008-11-24 09:22:07 +00:00
|
|
|
s->zvel += (g_spriteGravity>>5)+(krand()&7);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2009-02-19 16:47:54 +00:00
|
|
|
else if (s->zvel < 144)
|
|
|
|
s->zvel += (g_spriteGravity>>5)+(krand()&7);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SetSprite(i,CLIPMASK0);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if ((krand()&3) == 0)
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-04-13 10:46:04 +00:00
|
|
|
if (s->sectnum == -1)
|
|
|
|
KILLIT(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
l = getflorzofslope(s->sectnum,s->x,s->y);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->z > l)
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t j;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->z = l;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_AddToDeleteQueue(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
PN ++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_MISC, j))
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[j].picnum == BLOODPOOL)
|
|
|
|
if (ldist(s,&sprite[j]) < 348)
|
|
|
|
{
|
|
|
|
s->pal = 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case JIBS1__STATIC:
|
|
|
|
case JIBS2__STATIC:
|
|
|
|
case JIBS3__STATIC:
|
|
|
|
case JIBS4__STATIC:
|
|
|
|
case JIBS5__STATIC:
|
|
|
|
case JIBS6__STATIC:
|
|
|
|
case HEADJIB1__STATIC:
|
|
|
|
case ARMJIB1__STATIC:
|
|
|
|
case LEGJIB1__STATIC:
|
|
|
|
case LIZMANHEAD1__STATIC:
|
|
|
|
case LIZMANARM1__STATIC:
|
|
|
|
case LIZMANLEG1__STATIC:
|
|
|
|
case DUKETORSO__STATIC:
|
|
|
|
case DUKEGUN__STATIC:
|
|
|
|
case DUKELEG__STATIC:
|
|
|
|
|
|
|
|
if (s->xvel > 0) s->xvel--;
|
|
|
|
else s->xvel = 0;
|
|
|
|
|
2008-08-10 07:23:42 +00:00
|
|
|
if (++t[5] == (30*10))
|
2006-11-16 03:02:42 +00:00
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->zvel > 1024 && s->zvel < 1280)
|
|
|
|
{
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-11-16 03:02:42 +00:00
|
|
|
sect = s->sectnum;
|
|
|
|
}
|
|
|
|
|
2008-08-09 22:02:57 +00:00
|
|
|
getzsofslope(sect,s->x,s->y,&x,&l);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x == l || sect < 0 || sect >= MAXSECTORS) KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->z < l-(2<<8))
|
|
|
|
{
|
|
|
|
if (t[1] < 2) t[1]++;
|
2012-10-14 20:41:21 +00:00
|
|
|
else if (sector[sect].lotag != ST_2_UNDERWATER)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[1] = 0;
|
|
|
|
if (s->picnum == DUKELEG || s->picnum == DUKETORSO || s->picnum == DUKEGUN)
|
|
|
|
{
|
|
|
|
if (t[0] > 6) t[0] = 0;
|
|
|
|
else t[0]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (t[0] > 2)
|
|
|
|
t[0] = 0;
|
|
|
|
else t[0]++;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->zvel < 6144)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[sect].lotag == ST_2_UNDERWATER)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->zvel < 1024)
|
|
|
|
s->zvel += 48;
|
|
|
|
else s->zvel = 1024;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2008-11-24 09:22:07 +00:00
|
|
|
else s->zvel += g_spriteGravity-50;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->x += (s->xvel*sintable[(s->ang+512)&2047])>>14;
|
|
|
|
s->y += (s->xvel*sintable[s->ang&2047])>>14;
|
|
|
|
s->z += s->zvel;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (t[2] == 0)
|
|
|
|
{
|
|
|
|
if (s->sectnum == -1)
|
|
|
|
KILLIT(i);
|
2012-04-13 10:46:04 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if ((sector[s->sectnum].floorstat&2))
|
|
|
|
KILLIT(i);
|
2012-04-13 10:46:04 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
t[2]++;
|
|
|
|
}
|
|
|
|
l = getflorzofslope(s->sectnum,s->x,s->y);
|
|
|
|
|
|
|
|
s->z = l-(2<<8);
|
|
|
|
s->xvel = 0;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->picnum == JIBS6)
|
|
|
|
{
|
|
|
|
t[1]++;
|
|
|
|
if ((t[1]&3) == 0 && t[0] < 7)
|
|
|
|
t[0]++;
|
2012-04-13 10:46:04 +00:00
|
|
|
if (t[1] > 20)
|
|
|
|
KILLIT(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s->picnum = JIBS6;
|
|
|
|
t[0] = 0;
|
|
|
|
t[1] = 0;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case BLOODPOOL__STATIC:
|
|
|
|
case PUKE__STATIC:
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
int32_t p;
|
|
|
|
DukePlayer_t *ps;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
if (t[0] == 0)
|
|
|
|
{
|
|
|
|
t[0] = 1;
|
|
|
|
if (sector[sect].floorstat&2)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else A_AddToDeleteQueue(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
p = A_FindPlayer(s,&x);
|
2012-08-10 19:11:56 +00:00
|
|
|
ps = g_player[p].ps;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2015-10-23 23:00:06 +00:00
|
|
|
s->z = actor[i].floorz - 1;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[2] < 32)
|
|
|
|
{
|
|
|
|
t[2]++;
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[i].picnum == TIRE)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xrepeat < 64 && s->yrepeat < 64)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
s->xrepeat += krand()&3;
|
|
|
|
s->yrepeat += krand()&3;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (s->xrepeat < 32 && s->yrepeat < 32)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
s->xrepeat += krand()&3;
|
|
|
|
s->yrepeat += krand()&3;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x < 844 && s->xrepeat > 6 && s->yrepeat > 6)
|
|
|
|
{
|
2012-10-05 20:48:10 +00:00
|
|
|
if (s->pal == 0 && s->picnum != PUKE && (krand()&255) < 16)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
if (ps->inv_amount[GET_BOOTS] > 0)
|
|
|
|
ps->inv_amount[GET_BOOTS]--;
|
2006-11-16 03:02:42 +00:00
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
if (!A_CheckSoundPlaying(ps->i,DUKE_LONGTERM_PAIN))
|
|
|
|
A_PlaySound(DUKE_LONGTERM_PAIN,ps->i);
|
|
|
|
sprite[ps->i].extra --;
|
2012-05-05 22:24:50 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
P_PalFrom(ps, 32, 16,0,0);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[1] == 1) goto BOLT;
|
|
|
|
t[1] = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[i].picnum == TIRE)
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->footprintcount = 10;
|
|
|
|
else ps->footprintcount = 3;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->footprintpal = s->pal;
|
|
|
|
ps->footprintshade = s->shade;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[2] == 32)
|
|
|
|
{
|
|
|
|
s->xrepeat -= 6;
|
|
|
|
s->yrepeat -= 6;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else t[1] = 0;
|
|
|
|
goto BOLT;
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case BURNING__STATIC:
|
|
|
|
case BURNING2__STATIC:
|
|
|
|
case FECES__STATIC:
|
|
|
|
case WATERBUBBLE__STATIC:
|
|
|
|
case SMALLSMOKE__STATIC:
|
|
|
|
case EXPLOSION2__STATIC:
|
|
|
|
case SHRINKEREXPLOSION__STATIC:
|
|
|
|
case EXPLOSION2BOT__STATIC:
|
|
|
|
case BLOOD__STATIC:
|
|
|
|
case LASERSITE__STATIC:
|
|
|
|
case FORCERIPPLE__STATIC:
|
|
|
|
case TRANSPORTERSTAR__STATIC:
|
|
|
|
case TRANSPORTERBEAM__STATIC:
|
2009-04-13 06:53:03 +00:00
|
|
|
{
|
2012-12-29 15:21:28 +00:00
|
|
|
if (!G_HaveActor(sprite[i].picnum))
|
2008-09-03 10:47:19 +00:00
|
|
|
goto BOLT;
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
int32_t p = A_FindPlayer(s,&x);
|
|
|
|
A_Execute(i,p,x);
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2009-04-13 06:53:03 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case SHELL__STATIC:
|
|
|
|
case SHOTGUNSHELL__STATIC:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SetSprite(i,CLIPMASK0);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-04-13 10:46:04 +00:00
|
|
|
if (sect < 0 || (sector[sect].floorz + 256) < s->z)
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[sect].lotag == ST_2_UNDERWATER)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
t[1]++;
|
|
|
|
if (t[1] > 8)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[1] = 0;
|
|
|
|
t[0]++;
|
|
|
|
t[0] &= 3;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2008-11-24 09:22:07 +00:00
|
|
|
if (s->zvel < 128) s->zvel += (g_spriteGravity/13); // 8
|
2006-11-16 03:02:42 +00:00
|
|
|
else s->zvel -= 64;
|
|
|
|
if (s->xvel > 0)
|
|
|
|
s->xvel -= 4;
|
|
|
|
else s->xvel = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t[1]++;
|
|
|
|
if (t[1] > 3)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[1] = 0;
|
|
|
|
t[0]++;
|
|
|
|
t[0] &= 3;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2008-11-24 09:22:07 +00:00
|
|
|
if (s->zvel < 512) s->zvel += (g_spriteGravity/3); // 52;
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel > 0)
|
|
|
|
s->xvel --;
|
|
|
|
// else KILLIT(i);
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case GLASSPIECES__STATIC:
|
|
|
|
// case GLASSPIECES+1:
|
|
|
|
// case GLASSPIECES+2:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->zvel > 4096) s->zvel = 4096;
|
2012-04-13 10:46:04 +00:00
|
|
|
if (sect < 0)
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
if (s->z == actor[i].floorz-(ZOFFSET) && t[0] < 3)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
s->zvel = -((3-t[0])<<8)-(krand()&511);
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[sect].lotag == ST_2_UNDERWATER)
|
2006-11-16 03:02:42 +00:00
|
|
|
s->zvel >>= 1;
|
|
|
|
s->xrepeat >>= 1;
|
|
|
|
s->yrepeat >>= 1;
|
|
|
|
if (rnd(96))
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0]++;//Number of bounces
|
|
|
|
}
|
2012-04-13 10:46:04 +00:00
|
|
|
else if (t[0] == 3)
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel > 0)
|
|
|
|
{
|
|
|
|
s->xvel -= 2;
|
|
|
|
s->cstat = ((s->xvel&3)<<2);
|
|
|
|
}
|
|
|
|
else s->xvel = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SetSprite(i,CLIPMASK0);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-04-05 17:53:25 +00:00
|
|
|
if (PN >= SCRAP6 && PN <= SCRAP5+3)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->xvel > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
s->xvel--;
|
|
|
|
else s->xvel = 0;
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->zvel > 1024 && s->zvel < 1280)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-04-13 20:47:06 +00:00
|
|
|
sect = s->sectnum;
|
|
|
|
}
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->z < sector[sect].floorz-(2<<8))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (t[1] < 1) t[1]++;
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
t[1] = 0;
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->picnum < SCRAP6+8)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (t[0] > 6)
|
2006-04-13 20:47:06 +00:00
|
|
|
t[0] = 0;
|
|
|
|
else t[0]++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (t[0] > 2)
|
2006-04-13 20:47:06 +00:00
|
|
|
t[0] = 0;
|
|
|
|
else t[0]++;
|
|
|
|
}
|
|
|
|
}
|
2008-11-24 09:22:07 +00:00
|
|
|
if (s->zvel < 4096) s->zvel += g_spriteGravity-50;
|
2006-04-13 20:47:06 +00:00
|
|
|
s->x += (s->xvel*sintable[(s->ang+512)&2047])>>14;
|
|
|
|
s->y += (s->xvel*sintable[s->ang&2047])>>14;
|
|
|
|
s->z += s->zvel;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-12-28 17:04:36 +00:00
|
|
|
if (s->picnum == SCRAP1 && s->yvel > 0 && s->yvel < MAXUSERTILES)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-28 17:04:36 +00:00
|
|
|
int32_t j = A_Spawn(i, s->yvel);
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(j,(vec3_t *)s);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_GetZLimits(j);
|
2006-04-13 20:47:06 +00:00
|
|
|
sprite[j].hitag = sprite[j].lotag = 0;
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOLT:
|
|
|
|
i = nexti;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-13 10:45:33 +00:00
|
|
|
|
|
|
|
// i: SE spritenum
|
2013-04-01 18:35:44 +00:00
|
|
|
static void HandleSE31(int32_t i, int32_t setfloorzp, int32_t zref, int32_t t2val, int32_t movesignexp)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-04-13 10:45:33 +00:00
|
|
|
const spritetype *s = &sprite[i];
|
2013-04-15 10:48:09 +00:00
|
|
|
sectortype *const sc = §or[sprite[i].sectnum];
|
2012-04-13 10:45:33 +00:00
|
|
|
int32_t *const t = actor[i].t_data;
|
2012-03-11 17:37:50 +00:00
|
|
|
|
2012-04-13 10:45:33 +00:00
|
|
|
if (klabs(sc->floorz - zref) < SP)
|
|
|
|
{
|
2013-04-01 18:35:44 +00:00
|
|
|
if (setfloorzp)
|
|
|
|
sc->floorz = zref;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2012-04-13 10:45:33 +00:00
|
|
|
t[2] = t2val;
|
|
|
|
t[0] = 0;
|
|
|
|
t[3] = s->hitag;
|
|
|
|
A_CallSound(s->sectnum,i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int32_t j;
|
|
|
|
int32_t l = ksgn(movesignexp)*SP;
|
|
|
|
|
|
|
|
sc->floorz += l;
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(s->sectnum, j))
|
2012-04-13 10:45:33 +00:00
|
|
|
{
|
|
|
|
if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0)
|
2013-12-28 17:04:27 +00:00
|
|
|
if (g_player[P_Get(j)].ps->on_ground == 1)
|
|
|
|
g_player[P_Get(j)].ps->pos.z += l;
|
2013-04-01 18:35:44 +00:00
|
|
|
|
2012-04-13 10:45:33 +00:00
|
|
|
if (sprite[j].zvel == 0 && sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PROJECTILE)
|
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[j].bpos.z = sprite[j].z += l;
|
2012-04-13 10:45:33 +00:00
|
|
|
actor[j].floorz = sc->floorz;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// s: SE sprite
|
|
|
|
static void MaybeTrainKillPlayer(const spritetype *s, int32_t dosetopos)
|
|
|
|
{
|
|
|
|
int32_t p;
|
|
|
|
|
|
|
|
for (TRAVERSE_CONNECT(p))
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
|
|
|
|
|
|
|
if (sprite[ps->i].extra > 0)
|
2012-04-13 10:45:33 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
int16_t k = ps->cursectnum;
|
2012-04-13 10:45:33 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
updatesector(ps->pos.x,ps->pos.y,&k);
|
|
|
|
if ((k == -1 && ud.noclip == 0) || (k == s->sectnum && ps->cursectnum != s->sectnum))
|
2012-04-13 10:45:33 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->pos.x = s->x;
|
|
|
|
ps->pos.y = s->y;
|
2012-03-11 17:37:50 +00:00
|
|
|
|
2012-04-13 10:45:33 +00:00
|
|
|
if (dosetopos)
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->opos.x = ps->pos.x;
|
|
|
|
ps->opos.y = ps->pos.y;
|
2012-04-13 10:45:33 +00:00
|
|
|
}
|
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->cursectnum = s->sectnum;
|
2012-04-13 10:45:33 +00:00
|
|
|
|
2016-01-11 05:05:38 +00:00
|
|
|
setsprite(ps->i,(vec3_t const *)s);
|
2012-08-10 19:11:56 +00:00
|
|
|
P_QuickKill(ps);
|
2012-04-13 10:45:33 +00:00
|
|
|
}
|
|
|
|
}
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2012-04-13 10:45:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// i: SE spritenum
|
|
|
|
static void MaybeTrainKillEnemies(int32_t i, int32_t numguts)
|
|
|
|
{
|
|
|
|
int32_t j = headspritesect[sprite[OW].sectnum];
|
|
|
|
|
|
|
|
while (j >= 0)
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
const int32_t nextj = nextspritesect[j];
|
2012-04-13 10:45:33 +00:00
|
|
|
|
2013-04-15 10:48:13 +00:00
|
|
|
if (sprite[j].extra >= 0 && sprite[j].statnum == STAT_ACTOR && A_CheckEnemySprite(&sprite[j]))
|
2012-04-13 10:45:33 +00:00
|
|
|
{
|
|
|
|
int16_t k = sprite[j].sectnum;
|
|
|
|
|
|
|
|
updatesector(sprite[j].x,sprite[j].y,&k);
|
2013-04-15 10:48:13 +00:00
|
|
|
if (k == sprite[i].sectnum)
|
2012-04-13 10:45:33 +00:00
|
|
|
{
|
|
|
|
A_DoGutsDir(j,JIBS6,numguts);
|
|
|
|
A_PlaySound(SQUISHED,j);
|
|
|
|
A_DeleteSprite(j);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
j = nextj;
|
2012-04-13 10:45:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|
|
|
{
|
2006-04-13 20:47:06 +00:00
|
|
|
walltype *wal;
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t q=0, j, k, l, m, x;
|
|
|
|
int32_t i = headspritestat[STAT_EFFECTOR];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
while (i >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-04-13 10:45:33 +00:00
|
|
|
const int32_t nexti = nextspritestat[i];
|
|
|
|
spritetype *const s = &sprite[i];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2016-01-21 19:35:25 +00:00
|
|
|
int32_t p, pl = A_FindPlayer(s, &p);
|
|
|
|
|
|
|
|
if (VM_OnEventWithBoth(EVENT_MOVEEFFECTORS, i, pl, p, 0))
|
|
|
|
{
|
|
|
|
i = nexti;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-04-13 10:45:33 +00:00
|
|
|
sectortype *const sc = §or[s->sectnum];
|
|
|
|
const int32_t st = s->lotag;
|
|
|
|
const int32_t sh = s->hitag;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-04-13 10:45:33 +00:00
|
|
|
int32_t *const t = &actor[i].t_data[0];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (st)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-06-22 11:31:13 +00:00
|
|
|
case SE_0_ROTATING_SECTOR:
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t zchange = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
j = s->owner;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-11-15 14:28:18 +00:00
|
|
|
if (sprite[j].lotag == UINT16_MAX)
|
2006-11-16 03:02:42 +00:00
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
q = sc->extra>>3;
|
|
|
|
l = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
if (sc->lotag == ST_30_ROTATE_RISE_BRIDGE)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
q >>= 2;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[i].extra == 1)
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[i].tempang < 256)
|
2006-11-13 23:12:47 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].tempang += 4;
|
|
|
|
if (actor[i].tempang >= 256)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(s->sectnum,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->clipdist) l = 1;
|
|
|
|
else l = -1;
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else actor[i].tempang = 256;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sc->floorz > s->z) //z's are touching
|
|
|
|
{
|
|
|
|
sc->floorz -= 512;
|
|
|
|
zchange = -512;
|
|
|
|
if (sc->floorz < s->z)
|
|
|
|
sc->floorz = s->z;
|
|
|
|
}
|
|
|
|
else if (sc->floorz < s->z) //z's are touching
|
|
|
|
{
|
|
|
|
sc->floorz += 512;
|
|
|
|
zchange = 512;
|
|
|
|
if (sc->floorz > s->z)
|
|
|
|
sc->floorz = s->z;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else if (sprite[i].extra == 3)
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[i].tempang > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].tempang -= 4;
|
|
|
|
if (actor[i].tempang <= 0)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(s->sectnum,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->clipdist) l = -1;
|
|
|
|
else l = 1;
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else actor[i].tempang = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sc->floorz > T4) //z's are touching
|
|
|
|
{
|
|
|
|
sc->floorz -= 512;
|
|
|
|
zchange = -512;
|
|
|
|
if (sc->floorz < T4)
|
|
|
|
sc->floorz = T4;
|
2006-11-13 23:12:47 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else if (sc->floorz < T4) //z's are touching
|
|
|
|
{
|
|
|
|
sc->floorz += 512;
|
|
|
|
zchange = 512;
|
|
|
|
if (sc->floorz > T4)
|
|
|
|
sc->floorz = T4;
|
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[j].t_data[0] == 0) break;
|
|
|
|
if (actor[j].t_data[0] == 2) KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[j].ang > 1024)
|
|
|
|
l = -1;
|
|
|
|
else l = 1;
|
|
|
|
if (t[3] == 0)
|
|
|
|
t[3] = ldist(s,&sprite[j]);
|
|
|
|
s->xvel = t[3];
|
|
|
|
s->x = sprite[j].x;
|
|
|
|
s->y = sprite[j].y;
|
|
|
|
}
|
|
|
|
|
2012-05-25 18:39:22 +00:00
|
|
|
s->ang += (l*q);
|
|
|
|
t[2] += (l*q);
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (l && (sc->floorstat&64))
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
int32_t p;
|
|
|
|
|
2012-02-21 19:33:33 +00:00
|
|
|
for (TRAVERSE_CONNECT(p))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
|
|
|
|
|
|
|
if (ps->cursectnum == s->sectnum && ps->on_ground == 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->ang += (l*q);
|
|
|
|
ps->ang &= 2047;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->pos.z += zchange;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2015-05-26 00:47:54 +00:00
|
|
|
vec2_t r;
|
|
|
|
rotatepoint(*(vec2_t *)&sprite[j],*(vec2_t *)&ps->pos,(q*l),&r);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2015-05-26 00:47:54 +00:00
|
|
|
ps->bobpos.x += r.x-ps->pos.x;
|
|
|
|
ps->bobpos.y += r.y-ps->pos.y;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2015-05-26 00:47:54 +00:00
|
|
|
*(vec2_t *)&ps->pos = r;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
if (sprite[ps->i].extra <= 0)
|
2015-05-26 00:47:54 +00:00
|
|
|
*(vec2_t *)&sprite[ps->i] = r;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-05-29 20:01:48 +00:00
|
|
|
for (SPRITES_OF_SECT(s->sectnum, p))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
// KEEPINSYNC1
|
|
|
|
if (sprite[p].statnum != STAT_EFFECTOR && sprite[p].statnum != STAT_PROJECTILE)
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[p].picnum != LASERLINE)
|
|
|
|
{
|
|
|
|
if (sprite[p].picnum == APLAYER && sprite[p].owner >= 0)
|
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[p].ang += (l*q);
|
|
|
|
sprite[p].ang &= 2047;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[p].z += zchange;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2011-06-22 19:12:47 +00:00
|
|
|
// interpolation fix
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[p].bpos.x = sprite[p].x;
|
|
|
|
actor[p].bpos.y = sprite[p].y;
|
2011-06-22 19:12:47 +00:00
|
|
|
|
2012-12-23 19:24:21 +00:00
|
|
|
if (move_rotfixed_sprite(p, j, t[2]))
|
2015-05-26 00:47:54 +00:00
|
|
|
rotatepoint(*(vec2_t *)&sprite[j], *(vec2_t *)&sprite[p], (q * l), (vec2_t *)&sprite[p].x);
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2011-06-24 11:16:12 +00:00
|
|
|
else if (l==0 && (sc->floorstat&64))
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
int32_t p;
|
|
|
|
|
2011-06-24 11:16:12 +00:00
|
|
|
// fix for jittering of sprites in halted rotating sectors
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(s->sectnum, p))
|
2011-06-24 11:16:12 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
// KEEPINSYNC1
|
|
|
|
if (sprite[p].statnum != STAT_EFFECTOR && sprite[p].statnum != STAT_PROJECTILE)
|
2011-06-24 11:16:12 +00:00
|
|
|
if (sprite[p].picnum != LASERLINE)
|
|
|
|
{
|
|
|
|
if (sprite[p].picnum == APLAYER && sprite[p].owner >= 0)
|
|
|
|
continue;
|
|
|
|
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[p].bpos.x = sprite[p].x;
|
|
|
|
actor[p].bpos.y = sprite[p].y;
|
2011-06-24 11:16:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
A_MoveSector(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2013-06-22 11:31:13 +00:00
|
|
|
case SE_1_PIVOT: //Nothing for now used as the pivot
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->owner == -1) //Init
|
|
|
|
{
|
|
|
|
s->owner = i;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-09-08 22:18:44 +00:00
|
|
|
if (sprite[j].lotag == SE_19_EXPLOSION_LOWERS_CEILING && sprite[j].hitag == sh)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0] = 0;
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case 6:
|
|
|
|
k = sc->extra;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[4] > 0)
|
|
|
|
{
|
|
|
|
t[4]--;
|
|
|
|
if (t[4] >= (k-(k>>3)))
|
|
|
|
s->xvel -= (k>>5);
|
|
|
|
if (t[4] > ((k>>1)-1) && t[4] < (k-(k>>3)))
|
|
|
|
s->xvel = 0;
|
|
|
|
if (t[4] < (k>>1))
|
|
|
|
s->xvel += (k>>5);
|
|
|
|
if (t[4] < ((k>>1)-(k>>3)))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[4] = 0;
|
|
|
|
s->xvel = k;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else s->xvel = k;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, j))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (sprite[j].lotag == SE_14_SUBWAY_CAR && sh == sprite[j].hitag && actor[j].t_data[0] == t[0])
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[j].xvel = s->xvel;
|
|
|
|
// if( t[4] == 1 )
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[j].t_data[5] == 0)
|
|
|
|
actor[j].t_data[5] = dist(&sprite[j],s);
|
|
|
|
x = ksgn(dist(&sprite[j],s)-actor[j].t_data[5]);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[j].extra)
|
|
|
|
x = -x;
|
|
|
|
s->xvel += x;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].t_data[4] = t[4];
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
x = 0; // XXX: This assignment is dead?
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_14_SUBWAY_CAR:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->owner==-1)
|
2009-01-09 09:29:17 +00:00
|
|
|
s->owner = A_FindLocator((int16_t)t[3],(int16_t)t[0]);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->owner == -1)
|
|
|
|
{
|
2011-05-12 23:31:13 +00:00
|
|
|
// debugging subway cars (mapping-wise) is freakin annoying
|
|
|
|
// let's at least have a helpful message...
|
|
|
|
Bsprintf(tempbuf,"Could not find any locators in sector %d"
|
|
|
|
" for SE# 6 or 14 with hitag %d.\n", (int)t[0], (int)t[3]);
|
2008-11-20 14:06:36 +00:00
|
|
|
G_GameExit(tempbuf);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
j = ldist(&sprite[s->owner],s);
|
|
|
|
|
|
|
|
if (j < 1024L)
|
|
|
|
{
|
2014-05-30 19:39:06 +00:00
|
|
|
if (st==SE_6_SUBWAY)
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[s->owner].hitag&1)
|
|
|
|
t[4]=sc->extra; //Slow it down
|
|
|
|
t[3]++;
|
2008-11-20 14:06:36 +00:00
|
|
|
s->owner = A_FindLocator(t[3],t[0]);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->owner==-1)
|
|
|
|
{
|
|
|
|
t[3]=0;
|
2008-11-20 14:06:36 +00:00
|
|
|
s->owner = A_FindLocator(0,t[0]);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->xvel)
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
int32_t p;
|
2011-06-26 21:59:42 +00:00
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
int32_t firstrun = 1;
|
|
|
|
#endif
|
2006-11-16 03:02:42 +00:00
|
|
|
x = getangle(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y);
|
2008-11-20 14:06:36 +00:00
|
|
|
q = G_GetAngleDelta(s->ang,x)>>3;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
t[2] += q;
|
|
|
|
s->ang += q;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel == sc->extra)
|
|
|
|
{
|
|
|
|
if ((sc->floorstat&1) == 0 && (sc->ceilingstat&1) == 0)
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (!S_CheckSoundPlaying(i,actor[i].lastvx))
|
|
|
|
A_PlaySound(actor[i].lastvx,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else if (ud.monsters_off == 0 && sc->floorpal == 0 && (sc->floorstat&1) && rnd(8))
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
p = A_FindPlayer(s,&x);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x < 20480)
|
|
|
|
{
|
|
|
|
j = s->ang;
|
2010-05-02 23:27:30 +00:00
|
|
|
s->ang = getangle(s->x-g_player[p].ps->pos.x,s->y-g_player[p].ps->pos.y);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Shoot(i,RPG);
|
2006-11-16 03:02:42 +00:00
|
|
|
s->ang = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->xvel <= 64 && (sc->floorstat&1) == 0 && (sc->ceilingstat&1) == 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
S_StopEnvSound(actor[i].lastvx,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
if ((sc->floorz-sc->ceilingz) < (108<<8))
|
|
|
|
{
|
2012-03-11 17:38:50 +00:00
|
|
|
if (ud.noclip == 0 && s->xvel >= 192)
|
2012-04-13 10:45:33 +00:00
|
|
|
MaybeTrainKillPlayer(s, 0);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
m = (s->xvel*sintable[(s->ang+512)&2047])>>14;
|
|
|
|
x = (s->xvel*sintable[s->ang&2047])>>14;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-02-21 19:33:33 +00:00
|
|
|
for (TRAVERSE_CONNECT(p))
|
2010-01-23 22:12:02 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
|
|
|
|
|
|
|
if (ps->cursectnum < 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2011-06-26 21:59:42 +00:00
|
|
|
// might happen when squished into void space
|
|
|
|
// initprintf("cursectnum < 0!\n");
|
|
|
|
break;
|
2010-01-23 22:12:02 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[ps->cursectnum].lotag != ST_2_UNDERWATER)
|
2010-01-23 22:12:02 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (g_playerSpawnPoints[p].sect == s->sectnum)
|
2011-06-26 21:59:42 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
g_playerSpawnPoints[p].pos.x += m;
|
|
|
|
g_playerSpawnPoints[p].pos.y += x;
|
2011-06-26 21:59:42 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
if (s->sectnum == sprite[ps->i].sectnum
|
2011-06-26 21:59:42 +00:00
|
|
|
#ifdef YAX_ENABLE
|
2012-08-10 19:11:56 +00:00
|
|
|
|| (t[9]>=0 && t[9] == sprite[ps->i].sectnum)
|
2011-06-26 21:59:42 +00:00
|
|
|
#endif
|
|
|
|
)
|
|
|
|
{
|
2015-05-26 00:47:54 +00:00
|
|
|
rotatepoint(*(vec2_t *)s, *(vec2_t *)&ps->pos, q, (vec2_t *)&ps->pos);
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->pos.x += m;
|
|
|
|
ps->pos.y += x;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
ps->bobpos.x += m;
|
|
|
|
ps->bobpos.y += x;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->ang += q;
|
|
|
|
ps->ang &= 2047;
|
2011-06-26 21:59:42 +00:00
|
|
|
|
|
|
|
if (g_netServer || numplayers > 1)
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->opos.x = ps->pos.x;
|
|
|
|
ps->opos.y = ps->pos.y;
|
2011-06-26 21:59:42 +00:00
|
|
|
}
|
2012-08-10 19:11:56 +00:00
|
|
|
if (sprite[ps->i].extra <= 0)
|
2011-06-26 21:59:42 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
sprite[ps->i].x = ps->pos.x;
|
|
|
|
sprite[ps->i].y = ps->pos.y;
|
2011-06-26 21:59:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2010-01-23 22:12:02 +00:00
|
|
|
}
|
2011-06-26 21:59:42 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
// NOTE: special loop handling
|
2006-11-16 03:02:42 +00:00
|
|
|
j = headspritesect[s->sectnum];
|
|
|
|
while (j >= 0)
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
// KEEPINSYNC2
|
|
|
|
// XXX: underwater check?
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sprite[j].statnum != STAT_PLAYER && sector[sprite[j].sectnum].lotag != ST_2_UNDERWATER &&
|
2012-10-05 20:48:10 +00:00
|
|
|
(sprite[j].picnum != SECTOREFFECTOR || (sprite[j].lotag == SE_49_POINT_LIGHT||sprite[j].lotag == SE_50_SPOT_LIGHT))
|
2009-06-24 08:20:10 +00:00
|
|
|
&& sprite[j].picnum != LOCATORS)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2011-06-22 19:12:47 +00:00
|
|
|
// fix interpolation
|
|
|
|
if (numplayers < 2 && !g_netServer)
|
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[j].bpos.x = sprite[j].x;
|
|
|
|
actor[j].bpos.y = sprite[j].y;
|
2011-06-22 19:12:47 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-12-23 19:24:21 +00:00
|
|
|
if (move_rotfixed_sprite(j, s-sprite, t[2]))
|
2015-05-26 00:47:54 +00:00
|
|
|
rotatepoint(*(vec2_t *)s,*(vec2_t *)&sprite[j],q,(vec2_t *)&sprite[j].x);
|
2011-06-24 11:16:12 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[j].x+= m;
|
|
|
|
sprite[j].y+= x;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[j].ang+=q;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
if (g_netServer || numplayers > 1)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[j].bpos.x = sprite[j].x;
|
|
|
|
actor[j].bpos.y = sprite[j].y;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
j = nextspritesect[j];
|
2011-06-26 21:59:42 +00:00
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
if (j < 0)
|
|
|
|
{
|
|
|
|
if (t[9]>=0 && firstrun)
|
|
|
|
{
|
|
|
|
firstrun = 0;
|
|
|
|
j = headspritesect[t[9]];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
A_MoveSector(i);
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if ((sc->floorz-sc->ceilingz) < (108<<8))
|
|
|
|
{
|
2012-03-11 17:38:50 +00:00
|
|
|
if (ud.noclip == 0 && s->xvel >= 192)
|
2012-04-13 10:45:33 +00:00
|
|
|
MaybeTrainKillPlayer(s, 1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-04-13 10:45:33 +00:00
|
|
|
MaybeTrainKillEnemies(i, 72);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2011-06-22 19:12:47 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// fix for jittering of sprites in halted subways
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(s->sectnum, j))
|
2011-06-22 19:12:47 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
// KEEPINSYNC2
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sprite[j].statnum != STAT_PLAYER && sector[sprite[j].sectnum].lotag != ST_2_UNDERWATER &&
|
2012-10-05 20:48:10 +00:00
|
|
|
(sprite[j].picnum != SECTOREFFECTOR || (sprite[j].lotag == SE_49_POINT_LIGHT||sprite[j].lotag == SE_50_SPOT_LIGHT))
|
2011-06-22 19:12:47 +00:00
|
|
|
&& sprite[j].picnum != LOCATORS)
|
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[j].bpos.x = sprite[j].x;
|
|
|
|
actor[j].bpos.y = sprite[j].y;
|
2011-06-22 19:12:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_30_TWO_WAY_TRAIN:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->owner == -1)
|
|
|
|
{
|
|
|
|
t[3] = !t[3];
|
2008-11-20 14:06:36 +00:00
|
|
|
s->owner = A_FindLocator(t[3],t[0]);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[4] == 1) // Starting to go
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (ldist(&sprite[s->owner],s) < (2048-128))
|
|
|
|
t[4] = 2;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (s->xvel == 0)
|
2008-11-20 14:06:36 +00:00
|
|
|
G_OperateActivators(s->hitag+(!t[3]),-1);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel < 256)
|
|
|
|
s->xvel += 16;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[4] == 2)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
l = FindDistance2D(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (l <= 128)
|
|
|
|
s->xvel = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel > 0)
|
|
|
|
s->xvel -= 16;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s->xvel = 0;
|
2009-01-09 09:29:17 +00:00
|
|
|
G_OperateActivators(s->hitag+(int16_t)t[3],-1);
|
2006-11-16 03:02:42 +00:00
|
|
|
s->owner = -1;
|
|
|
|
s->ang += 1024;
|
|
|
|
t[4] = 0;
|
2008-11-20 14:06:36 +00:00
|
|
|
G_OperateForceFields(i,s->hitag);
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(s->sectnum, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[j].bpos.x = sprite[j].x;
|
|
|
|
actor[j].bpos.y = sprite[j].y;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel)
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
int32_t p;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
l = (s->xvel*sintable[(s->ang+512)&2047])>>14;
|
|
|
|
x = (s->xvel*sintable[s->ang&2047])>>14;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if ((sc->floorz-sc->ceilingz) < (108<<8))
|
2012-03-11 17:38:50 +00:00
|
|
|
if (ud.noclip == 0)
|
2012-04-13 10:45:33 +00:00
|
|
|
MaybeTrainKillPlayer(s, 0);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-02-21 19:33:33 +00:00
|
|
|
for (TRAVERSE_CONNECT(p))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
|
|
|
|
|
|
|
if (sprite[ps->i].sectnum == s->sectnum)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->pos.x += l;
|
|
|
|
ps->pos.y += x;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
if (g_netServer || numplayers > 1)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->opos.x = ps->pos.x;
|
|
|
|
ps->opos.y = ps->pos.y;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
ps->bobpos.x += l;
|
|
|
|
ps->bobpos.y += x;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (g_playerSpawnPoints[p].sect == s->sectnum)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
g_playerSpawnPoints[p].pos.x += l;
|
|
|
|
g_playerSpawnPoints[p].pos.y += x;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(s->sectnum, j))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
// TODO: replace some checks for SE 49/50 with statnum LIGHT instead?
|
2012-10-05 20:48:10 +00:00
|
|
|
if ((sprite[j].picnum != SECTOREFFECTOR || sprite[j].lotag==SE_49_POINT_LIGHT || sprite[j].lotag==SE_50_SPOT_LIGHT)
|
2012-04-28 21:56:23 +00:00
|
|
|
&& sprite[j].picnum != LOCATORS)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-01-16 23:08:17 +00:00
|
|
|
if (numplayers < 2 && !g_netServer)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[j].bpos.x = sprite[j].x;
|
|
|
|
actor[j].bpos.y = sprite[j].y;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[j].x += l;
|
|
|
|
sprite[j].y += x;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
if (g_netServer || numplayers > 1)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[j].bpos.x = sprite[j].x;
|
|
|
|
actor[j].bpos.y = sprite[j].y;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
A_MoveSector(i);
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
if (sc->floorz-sc->ceilingz < (108<<8))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-03-11 17:38:50 +00:00
|
|
|
if (ud.noclip == 0)
|
2012-04-13 10:45:33 +00:00
|
|
|
MaybeTrainKillPlayer(s, 1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-04-13 10:45:33 +00:00
|
|
|
MaybeTrainKillEnemies(i, 24);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
|
2013-06-22 11:31:13 +00:00
|
|
|
case SE_2_EARTHQUAKE://Quakes
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[4] > 0 && t[0] == 0)
|
|
|
|
{
|
|
|
|
if (t[4] < sh)
|
|
|
|
t[4]++;
|
|
|
|
else t[0] = 1;
|
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] > 0)
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t p, nextj;
|
2012-08-10 19:11:56 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0]++;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->xvel = 3;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] > 96)
|
|
|
|
{
|
|
|
|
t[0] = -1; //Stop the quake
|
|
|
|
t[4] = -1;
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((t[0]&31) == 8)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
g_earthquakeTime = 48;
|
|
|
|
A_PlaySound(EARTHQUAKE,g_player[screenpeek].ps->i);
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (klabs(sc->floorheinum-t[5]) < 8)
|
|
|
|
sc->floorheinum = t[5];
|
|
|
|
else sc->floorheinum += (ksgn(t[5]-sc->floorheinum)<<4);
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
m = (s->xvel*sintable[(s->ang+512)&2047])>>14;
|
|
|
|
x = (s->xvel*sintable[s->ang&2047])>>14;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
|
2012-02-21 19:33:33 +00:00
|
|
|
for (TRAVERSE_CONNECT(p))
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
|
|
|
|
|
|
|
if (ps->cursectnum == s->sectnum && ps->on_ground)
|
2012-02-21 19:33:33 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->pos.x += m;
|
|
|
|
ps->pos.y += x;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
ps->bobpos.x += m;
|
|
|
|
ps->bobpos.y += x;
|
2012-02-21 19:33:33 +00:00
|
|
|
}
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT_SAFE(s->sectnum, j, nextj))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
if (sprite[j].picnum != SECTOREFFECTOR)
|
|
|
|
{
|
|
|
|
sprite[j].x+=m;
|
|
|
|
sprite[j].y+=x;
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(j,(vec3_t *)&sprite[j]);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
A_MoveSector(i);
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
//Flashing sector lights after reactor EXPLOSION2
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-06-22 11:31:13 +00:00
|
|
|
case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT:
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[4] == 0) break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
// if(t[5] > 0) { t[5]--; break; }
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2015-04-18 21:59:17 +00:00
|
|
|
if ((tabledivide32_noinline(g_globalRandom, sh+1)&31) < 4 && !t[2])
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
// t[5] = 4+(g_globalRandom&7);
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingpal = s->owner>>8;
|
|
|
|
sc->floorpal = s->owner&0xff;
|
2008-11-20 14:06:36 +00:00
|
|
|
t[0] = s->shade + (g_globalRandom&15);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
// t[5] = 4+(g_globalRandom&3);
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingpal = s->pal;
|
|
|
|
sc->floorpal = s->pal;
|
|
|
|
t[0] = t[3];
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingshade = t[0];
|
|
|
|
sc->floorshade = t[0];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
wal = &wall[sc->wallptr];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=sc->wallnum; x > 0; x--,wal++)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
if (wal->hitag != 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
wal->shade = t[0];
|
|
|
|
if ((wal->cstat&2) && wal->nextwall >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
wall[wal->nextwall].shade = wal->shade;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-06-22 11:31:13 +00:00
|
|
|
case SE_4_RANDOM_LIGHTS:
|
2015-04-18 21:59:17 +00:00
|
|
|
{
|
|
|
|
// See A_Spawn():
|
|
|
|
// s->owner: original ((ceilingpal<<8) | floorpal)
|
|
|
|
// t[2]: original floor shade
|
|
|
|
// t[3]: max wall shade
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2015-04-18 21:59:17 +00:00
|
|
|
if ((tabledivide32_noinline(g_globalRandom, sh+1)&31) < 4)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
t[1] = s->shade + (g_globalRandom&15);//Got really bright
|
|
|
|
t[0] = s->shade + (g_globalRandom&15);
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingpal = s->owner>>8;
|
|
|
|
sc->floorpal = s->owner&0xff;
|
|
|
|
j = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t[1] = t[2];
|
|
|
|
t[0] = t[3];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingpal = s->pal;
|
|
|
|
sc->floorpal = s->pal;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
j = 0;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->floorshade = t[1];
|
|
|
|
sc->ceilingshade = t[1];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
wal = &wall[sc->wallptr];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=sc->wallnum; x > 0; x--,wal++)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
if (j) wal->pal = (s->owner&0xff);
|
|
|
|
else wal->pal = s->pal;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wal->hitag != 1)
|
|
|
|
{
|
|
|
|
wal->shade = t[0];
|
|
|
|
if ((wal->cstat&2) && wal->nextwall >= 0)
|
|
|
|
wall[wal->nextwall].shade = wal->shade;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(SECT, j))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2014-02-22 19:38:52 +00:00
|
|
|
if (sprite[j].cstat&16 && A_CheckSpriteFlags(j,SFLAG_NOSHADE) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sc->ceilingstat&1)
|
|
|
|
sprite[j].shade = sc->ceilingshade;
|
|
|
|
else sprite[j].shade = sc->floorshade;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-04-13 10:46:04 +00:00
|
|
|
if (t[4])
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2015-04-18 21:59:17 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
//BOSS
|
2013-06-22 11:31:13 +00:00
|
|
|
case SE_5:
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
const int32_t p = A_FindPlayer(s,&x);
|
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x < 8192)
|
|
|
|
{
|
|
|
|
j = s->ang;
|
2012-08-10 19:11:56 +00:00
|
|
|
s->ang = getangle(s->x-ps->pos.x,s->y-ps->pos.y);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Shoot(i,FIRELASER);
|
2006-11-16 03:02:42 +00:00
|
|
|
s->ang = j;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->owner==-1) //Start search
|
|
|
|
{
|
|
|
|
t[4]=0;
|
2012-09-02 14:04:16 +00:00
|
|
|
l = INT32_MAX;
|
2006-11-16 03:02:42 +00:00
|
|
|
while (1) //Find the shortest dist
|
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
s->owner = A_FindLocator((int16_t)t[4],-1); //t[0] hold sectnum
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->owner==-1) break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
m = ldist(&sprite[ps->i],&sprite[s->owner]);
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (l > m)
|
|
|
|
{
|
|
|
|
q = s->owner;
|
|
|
|
l = m;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
t[4]++;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->owner = q;
|
|
|
|
s->zvel = ksgn(sprite[q].z-s->z)<<4;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (ldist(&sprite[s->owner],s) < 1024)
|
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t ta;
|
2006-11-16 03:02:42 +00:00
|
|
|
ta = s->ang;
|
2012-08-10 19:11:56 +00:00
|
|
|
s->ang = getangle(ps->pos.x-s->x,ps->pos.y-s->y);
|
2006-11-16 03:02:42 +00:00
|
|
|
s->ang = ta;
|
|
|
|
s->owner = -1;
|
|
|
|
goto BOLT;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else s->xvel=256;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
x = getangle(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y);
|
2008-11-20 14:06:36 +00:00
|
|
|
q = G_GetAngleDelta(s->ang,x)>>3;
|
2006-11-16 03:02:42 +00:00
|
|
|
s->ang += q;
|
|
|
|
|
|
|
|
if (rnd(32))
|
|
|
|
{
|
|
|
|
t[2]+=q;
|
|
|
|
sc->ceilingshade = 127;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
t[2] += G_GetAngleDelta(t[2]+512,getangle(ps->pos.x-s->x,ps->pos.y-s->y))>>2;
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingshade = 0;
|
|
|
|
}
|
2011-02-25 21:50:19 +00:00
|
|
|
|
2013-04-15 10:48:15 +00:00
|
|
|
if (A_IncurDamage(i) >= 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2011-02-25 21:50:19 +00:00
|
|
|
if (++t[3] == 5)
|
2007-08-25 01:05:00 +00:00
|
|
|
{
|
|
|
|
s->zvel += 1024;
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_WASTED, g_player[myconnectindex].ps);
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->z += s->zvel;
|
|
|
|
sc->ceilingz += s->zvel;
|
|
|
|
sector[t[0]].ceilingz += s->zvel;
|
2010-01-16 23:08:17 +00:00
|
|
|
A_MoveSector(i);
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_8_UP_OPEN_DOOR_LIGHTS:
|
|
|
|
case SE_9_DOWN_OPEN_DOOR_LIGHTS:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
// work only if its moving
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
j = -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[i].t_data[4])
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].t_data[4]++;
|
2012-04-13 10:46:04 +00:00
|
|
|
if (actor[i].t_data[4] > 8)
|
|
|
|
KILLIT(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
j = 1;
|
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else j = GetAnimationGoal(&sc->ceilingz);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j >= 0)
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if ((sc->lotag&0x8000) || actor[i].t_data[4])
|
2006-11-16 03:02:42 +00:00
|
|
|
x = -t[3];
|
|
|
|
else
|
|
|
|
x = t[3];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-05-30 19:39:06 +00:00
|
|
|
if (st == SE_9_DOWN_OPEN_DOOR_LIGHTS)
|
|
|
|
x = -x;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, j))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (sprite[j].lotag == st && sprite[j].hitag == sh)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-05-30 19:39:06 +00:00
|
|
|
int32_t sn = sprite[j].sectnum;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
m = sprite[j].shade;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
wal = &wall[sector[sn].wallptr];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (l=sector[sn].wallnum; l>0; l--,wal++)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
if (wal->hitag != 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
wal->shade+=x;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wal->shade < m)
|
|
|
|
wal->shade = m;
|
2010-05-02 23:27:30 +00:00
|
|
|
else if (wal->shade > actor[j].t_data[2])
|
|
|
|
wal->shade = actor[j].t_data[2];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wal->nextwall >= 0)
|
|
|
|
if (wall[wal->nextwall].hitag != 1)
|
|
|
|
wall[wal->nextwall].shade = wal->shade;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sector[sn].floorshade += x;
|
|
|
|
sector[sn].ceilingshade += x;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sector[sn].floorshade < m)
|
|
|
|
sector[sn].floorshade = m;
|
2010-05-02 23:27:30 +00:00
|
|
|
else if (sector[sn].floorshade > actor[j].t_data[0])
|
|
|
|
sector[sn].floorshade = actor[j].t_data[0];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sector[sn].ceilingshade < m)
|
|
|
|
sector[sn].ceilingshade = m;
|
2010-05-02 23:27:30 +00:00
|
|
|
else if (sector[sn].ceilingshade > actor[j].t_data[1])
|
|
|
|
sector[sn].ceilingshade = actor[j].t_data[1];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_10_DOOR_AUTO_CLOSE:
|
|
|
|
// XXX: 32791, what the hell?
|
2012-11-15 14:28:18 +00:00
|
|
|
if ((sc->lotag&0xff) == ST_27_STRETCH_BRIDGE || (sc->floorz > sc->ceilingz && (sc->lotag&0xff) != ST_23_SWINGING_DOOR) || sc->lotag == 32791)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
int32_t p;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
j = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
if ((sc->lotag&0xff) != ST_27_STRETCH_BRIDGE)
|
2012-02-21 19:33:33 +00:00
|
|
|
for (TRAVERSE_CONNECT(p))
|
2012-08-26 22:16:08 +00:00
|
|
|
if (sc->lotag != ST_30_ROTATE_RISE_BRIDGE && sc->lotag != ST_31_TWO_WAY_TRAIN && sc->lotag != 0)
|
2012-02-21 19:33:33 +00:00
|
|
|
if (s->sectnum == sprite[g_player[p].ps->i].sectnum)
|
|
|
|
j = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j == 1)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] > sh)
|
|
|
|
switch (sector[s->sectnum].lotag)
|
|
|
|
{
|
2012-08-26 22:16:08 +00:00
|
|
|
case ST_20_CEILING_DOOR:
|
|
|
|
case ST_21_FLOOR_DOOR:
|
|
|
|
case ST_22_SPLITTING_DOOR:
|
|
|
|
case ST_26_SPLITTING_ST_DOOR:
|
2008-11-20 14:06:36 +00:00
|
|
|
if (GetAnimationGoal(§or[s->sectnum].ceilingz) >= 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-02-25 21:50:19 +00:00
|
|
|
G_ActivateBySector(s->sectnum,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0] = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else t[0]++;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else t[0]=0;
|
|
|
|
break;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_11_SWINGING_DOOR: //Swingdoor
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[5] > 0)
|
|
|
|
{
|
|
|
|
t[5]--;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[4])
|
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t endwall = sc->wallptr+sc->wallnum;
|
2007-03-01 00:50:59 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=sc->wallptr; j<endwall; j++)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_ACTOR, k))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (sprite[k].extra > 0 && A_CheckEnemySprite(&sprite[k])
|
|
|
|
&& clipinsidebox(sprite[k].x, sprite[k].y, j, 256) == 1)
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_PLAYER, k))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (sprite[k].owner >= 0 && clipinsidebox(sprite[k].x, sprite[k].y, j, 144) == 1)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[5] = 8; // Delay
|
|
|
|
k = (SP>>3)*t[3];
|
2013-04-15 10:48:09 +00:00
|
|
|
t[2] -= k;
|
|
|
|
t[4] -= k;
|
2010-01-16 23:08:17 +00:00
|
|
|
A_MoveSector(i);
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-11-16 03:02:42 +00:00
|
|
|
goto BOLT;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
k = (SP>>3)*t[3];
|
|
|
|
t[2]+=k;
|
|
|
|
t[4]+=k;
|
2010-01-16 23:08:17 +00:00
|
|
|
A_MoveSector(i);
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[4] <= -511 || t[4] >= 512)
|
|
|
|
{
|
|
|
|
t[4] = 0;
|
|
|
|
t[2] &= 0xffffff00;
|
2010-01-16 23:08:17 +00:00
|
|
|
A_MoveSector(i);
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_12_LIGHT_SWITCH:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] == 3 || t[3] == 1) //Lights going off
|
|
|
|
{
|
|
|
|
sc->floorpal = 0;
|
|
|
|
sc->ceilingpal = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
wal = &wall[sc->wallptr];
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j = sc->wallnum; j > 0; j--, wal++)
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wal->hitag != 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
wal->shade = t[1];
|
|
|
|
wal->pal = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->floorshade = t[1];
|
|
|
|
sc->ceilingshade = t[2];
|
|
|
|
t[0]=0;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(SECT, j))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2014-02-22 19:38:52 +00:00
|
|
|
if (sprite[j].cstat&16 && A_CheckSpriteFlags(j,SFLAG_NOSHADE) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sc->ceilingstat&1)
|
|
|
|
sprite[j].shade = sc->ceilingshade;
|
|
|
|
else sprite[j].shade = sc->floorshade;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-13 10:46:04 +00:00
|
|
|
if (t[3] == 1)
|
|
|
|
KILLIT(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
if (t[0] == 1) //Lights flickering on
|
|
|
|
{
|
|
|
|
if (sc->floorshade > s->shade)
|
|
|
|
{
|
|
|
|
sc->floorpal = s->pal;
|
|
|
|
sc->ceilingpal = s->pal;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->floorshade -= 2;
|
|
|
|
sc->ceilingshade -= 2;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
wal = &wall[sc->wallptr];
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=sc->wallnum; j>0; j--,wal++)
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wal->hitag != 1)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
wal->pal = s->pal;
|
|
|
|
wal->shade -= 2;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else t[0] = 2;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(SECT, j))
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[j].cstat&16)
|
|
|
|
{
|
2014-02-22 19:38:52 +00:00
|
|
|
if (sc->ceilingstat&1 && A_CheckSpriteFlags(j,SFLAG_NOSHADE) == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[j].shade = sc->ceilingshade;
|
|
|
|
else sprite[j].shade = sc->floorshade;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_13_EXPLOSIVE:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[2])
|
|
|
|
{
|
2011-06-26 21:59:42 +00:00
|
|
|
// t[0]: ceiling z
|
|
|
|
// t[1]: floor z
|
|
|
|
// s->owner: 1 if affect ceiling, 0 if affect floor
|
|
|
|
// t[3]: 1 if ceiling was parallaxed at premap, 0 else
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
j = (SP<<5)|1;
|
|
|
|
|
|
|
|
if (s->ang == 512)
|
|
|
|
{
|
|
|
|
if (s->owner)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (klabs(t[0]-sc->ceilingz) >= j)
|
|
|
|
sc->ceilingz += ksgn(t[0]-sc->ceilingz)*j;
|
|
|
|
else sc->ceilingz = t[0];
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (klabs(t[1]-sc->floorz) >= j)
|
2006-04-13 20:47:06 +00:00
|
|
|
sc->floorz += ksgn(t[1]-sc->floorz)*j;
|
|
|
|
else sc->floorz = t[1];
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (klabs(t[1]-sc->floorz) >= j)
|
|
|
|
sc->floorz += ksgn(t[1]-sc->floorz)*j;
|
|
|
|
else sc->floorz = t[1];
|
|
|
|
if (klabs(t[0]-sc->ceilingz) >= j)
|
|
|
|
sc->ceilingz += ksgn(t[0]-sc->ceilingz)*j;
|
|
|
|
sc->ceilingz = t[0];
|
|
|
|
}
|
2011-06-26 21:59:42 +00:00
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
if (s->ang == 512)
|
|
|
|
{
|
|
|
|
int16_t cf=!s->owner, bn=yax_getbunch(sc-sector, cf);
|
|
|
|
int32_t jj, daz=SECTORFLD(sc-sector,z, cf);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2011-06-26 21:59:42 +00:00
|
|
|
if (bn >= 0)
|
|
|
|
{
|
|
|
|
for (SECTORS_OF_BUNCH(bn, cf, jj))
|
|
|
|
{
|
|
|
|
SECTORFLD(jj,z, cf) = daz;
|
|
|
|
SECTORFLD(jj,stat, cf) &= ~(128+256 + 512+2048);
|
|
|
|
}
|
|
|
|
for (SECTORS_OF_BUNCH(bn, !cf, jj))
|
|
|
|
{
|
|
|
|
SECTORFLD(jj,z, !cf) = daz;
|
|
|
|
SECTORFLD(jj,stat, !cf) &= ~(128+256 + 512+2048);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[3] == 1)
|
|
|
|
{
|
|
|
|
//Change the shades
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
t[3]++;
|
|
|
|
sc->ceilingstat ^= 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->ang == 512)
|
|
|
|
{
|
|
|
|
wal = &wall[sc->wallptr];
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=sc->wallnum; j>0; j--,wal++)
|
2006-11-16 03:02:42 +00:00
|
|
|
wal->shade = s->shade;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->floorshade = s->shade;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2007-08-27 06:46:31 +00:00
|
|
|
if (g_player[0].ps->one_parallax_sectnum >= 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
sc->ceilingpicnum =
|
2007-08-27 06:46:31 +00:00
|
|
|
sector[g_player[0].ps->one_parallax_sectnum].ceilingpicnum;
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingshade =
|
2007-08-27 06:46:31 +00:00
|
|
|
sector[g_player[0].ps->one_parallax_sectnum].ceilingshade;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
t[2]++;
|
|
|
|
if (t[2] > 256)
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[2] == 4 && s->ang != 512)
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=0; x<7; x++) RANDOMSCRAP;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_15_SLIDING_DOOR:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[4])
|
|
|
|
{
|
|
|
|
s->xvel = 16;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[4] == 1) //Opening
|
|
|
|
{
|
|
|
|
if (t[3] >= (SP>>3))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[4] = 0; //Turn off the sliders
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(s->sectnum,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
t[3]++;
|
|
|
|
}
|
|
|
|
else if (t[4] == 2)
|
|
|
|
{
|
|
|
|
if (t[3]<1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[4] = 0;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(s->sectnum,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
t[3]--;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
A_MoveSector(i);
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_16_REACTOR: //Reactor
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
t[2]+=32;
|
|
|
|
if (sc->floorz<sc->ceilingz) s->shade=0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
else if (sc->ceilingz < t[3])
|
|
|
|
{
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
//The following code check to see if
|
|
|
|
//there is any other sprites in the sector.
|
|
|
|
//If there isn't, then kill this sectoreffector
|
|
|
|
//itself.....
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(s->sectnum, j))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
if (sprite[j].picnum == REACTOR || sprite[j].picnum == REACTOR2)
|
|
|
|
break;
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j == -1)
|
|
|
|
KILLIT(i);
|
2013-04-15 10:48:09 +00:00
|
|
|
|
|
|
|
s->shade = 1;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->shade) sc->ceilingz+=1024;
|
|
|
|
else sc->ceilingz-=512;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
A_MoveSector(i);
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_17_WARP_ELEVATOR:
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t nextk;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
q = t[0]*(SP<<2);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingz += q;
|
|
|
|
sc->floorz += q;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT(s->sectnum, j))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[j].statnum == STAT_PLAYER && sprite[j].owner >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
const int32_t p = P_Get(j);
|
2012-08-10 19:11:56 +00:00
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
if (numplayers < 2 && !g_netServer)
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->opos.z = ps->pos.z;
|
2015-10-20 07:15:21 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->pos.z += q;
|
|
|
|
ps->truefz += q;
|
|
|
|
ps->truecz += q;
|
2015-10-20 07:15:21 +00:00
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
if (g_netServer || numplayers > 1)
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->opos.z = ps->pos.z;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[j].statnum != STAT_EFFECTOR)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[j].bpos.z = sprite[j].z;
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[j].z += q;
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].floorz = sc->floorz;
|
|
|
|
actor[j].ceilingz = sc->ceilingz;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
|
2009-07-12 01:55:34 +00:00
|
|
|
if (t[0]) //If in motion
|
|
|
|
{
|
|
|
|
if (klabs(sc->floorz-t[2]) <= SP)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2009-07-12 01:55:34 +00:00
|
|
|
G_ActivateWarpElevators(i,0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-08-28 21:42:49 +00:00
|
|
|
// If we still see the opening, we can't yet teleport.
|
2009-07-12 01:55:34 +00:00
|
|
|
if (t[0]==-1)
|
|
|
|
{
|
|
|
|
if (sc->floorz > t[3])
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2009-07-12 01:55:34 +00:00
|
|
|
}
|
|
|
|
else if (sc->ceilingz < t[4]) break;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-07-12 01:55:34 +00:00
|
|
|
if (t[1] == 0) break;
|
|
|
|
t[1] = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, j))
|
2009-07-12 01:55:34 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (i != j && sprite[j].lotag == SE_17_WARP_ELEVATOR)
|
|
|
|
if (sc->hitag-t[0] == sector[sprite[j].sectnum].hitag
|
|
|
|
&& sh == sprite[j].hitag)
|
2009-07-12 01:55:34 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2009-07-12 01:55:34 +00:00
|
|
|
if (j == -1) break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT_SAFE(s->sectnum, k, nextk))
|
2009-07-12 01:55:34 +00:00
|
|
|
{
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[k].statnum == STAT_PLAYER && sprite[k].owner >= 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
const int32_t p = P_Get(k);
|
2012-08-10 19:11:56 +00:00
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->pos.x += sprite[j].x-s->x;
|
|
|
|
ps->pos.y += sprite[j].y-s->y;
|
2015-10-20 07:15:21 +00:00
|
|
|
ps->opos.z -= ps->pos.z;
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->pos.z = sector[sprite[j].sectnum].floorz-(sc->floorz-ps->pos.z);
|
2015-10-20 07:15:21 +00:00
|
|
|
ps->opos.z += ps->pos.z;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[k].floorz = sector[sprite[j].sectnum].floorz;
|
|
|
|
actor[k].ceilingz = sector[sprite[j].sectnum].ceilingz;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
ps->bobpos.x = ps->opos.x = ps->pos.x;
|
|
|
|
ps->bobpos.y = ps->opos.y = ps->pos.y;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->truefz = actor[k].floorz;
|
|
|
|
ps->truecz = actor[k].ceilingz;
|
|
|
|
ps->bobcounter = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-07-12 01:55:34 +00:00
|
|
|
changespritesect(k,sprite[j].sectnum);
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->cursectnum = sprite[j].sectnum;
|
2009-07-12 01:55:34 +00:00
|
|
|
}
|
2009-08-06 10:12:13 +00:00
|
|
|
else if (sprite[k].statnum != STAT_EFFECTOR)
|
2009-07-12 01:55:34 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
sprite[k].x += sprite[j].x-s->x;
|
|
|
|
sprite[k].y += sprite[j].y-s->y;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2015-10-20 07:15:21 +00:00
|
|
|
Bmemcpy(&actor[k].bpos, &sprite[k], sizeof(vec2_t));
|
|
|
|
|
|
|
|
actor[k].bpos.z -= sprite[k].z;
|
|
|
|
sprite[k].z = sector[sprite[j].sectnum].floorz-
|
|
|
|
(sc->floorz-sprite[k].z);
|
|
|
|
actor[k].bpos.z += sprite[k].z;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-07-12 01:55:34 +00:00
|
|
|
changespritesect(k,sprite[j].sectnum);
|
|
|
|
setsprite(k,(vec3_t *)&sprite[k]);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[k].floorz = sector[sprite[j].sectnum].floorz;
|
|
|
|
actor[k].ceilingz = sector[sprite[j].sectnum].ceilingz;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2009-07-12 01:55:34 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0])
|
|
|
|
{
|
|
|
|
if (s->pal)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->ang == 512)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingz -= sc->extra;
|
|
|
|
if (sc->ceilingz <= t[1])
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingz = t[1];
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->floorz += sc->extra;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
|
|
|
for (SPRITES_OF_SECT(s->sectnum, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0)
|
2013-12-28 17:04:27 +00:00
|
|
|
if (g_player[P_Get(j)].ps->on_ground == 1)
|
|
|
|
g_player[P_Get(j)].ps->pos.z += sc->extra;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[j].zvel == 0 && sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PROJECTILE)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[j].bpos.z = sprite[j].z += sc->extra;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].floorz = sc->floorz;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sc->floorz >= t[1])
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->floorz = t[1];
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->ang == 512)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingz += sc->extra;
|
|
|
|
if (sc->ceilingz >= s->z)
|
|
|
|
{
|
|
|
|
sc->ceilingz = s->z;
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->floorz -= sc->extra;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
|
|
|
for (SPRITES_OF_SECT(s->sectnum, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0)
|
2013-12-28 17:04:27 +00:00
|
|
|
if (g_player[P_Get(j)].ps->on_ground == 1)
|
|
|
|
g_player[P_Get(j)].ps->pos.z -= sc->extra;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[j].zvel == 0 && sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PROJECTILE)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[j].bpos.z = sprite[j].z -= sc->extra;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].floorz = sc->floorz;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sc->floorz <= s->z)
|
|
|
|
{
|
|
|
|
sc->floorz = s->z;
|
|
|
|
KILLIT(i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
t[2]++;
|
|
|
|
if (t[2] >= s->hitag)
|
|
|
|
{
|
|
|
|
t[2] = 0;
|
|
|
|
t[0] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_19_EXPLOSION_LOWERS_CEILING: //Battlestar galactia shields
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0])
|
|
|
|
{
|
|
|
|
if (t[0] == 1)
|
|
|
|
{
|
|
|
|
t[0]++;
|
|
|
|
x = sc->wallptr;
|
|
|
|
q = x+sc->wallnum;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=x; j<q; j++)
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wall[j].overpicnum == BIGFORCE)
|
|
|
|
{
|
|
|
|
wall[j].cstat &= (128+32+8+4+2);
|
|
|
|
wall[j].overpicnum = 0;
|
|
|
|
if (wall[j].nextwall >= 0)
|
|
|
|
{
|
|
|
|
wall[wall[j].nextwall].overpicnum = 0;
|
|
|
|
wall[wall[j].nextwall].cstat &= (128+32+8+4+2);
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sc->ceilingz < sc->floorz)
|
|
|
|
sc->ceilingz += SP;
|
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingz = sc->floorz;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-06-22 11:31:13 +00:00
|
|
|
if (sprite[j].lotag == SE_0_ROTATING_SECTOR && sprite[j].hitag==sh)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
sectortype *const sec = §or[sprite[j].sectnum];
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
q = sprite[sprite[j].owner].sectnum;
|
2013-04-15 10:48:09 +00:00
|
|
|
sec->floorpal = sec->ceilingpal = sector[q].floorpal;
|
|
|
|
sec->floorshade = sec->ceilingshade = sector[q].floorshade;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[sprite[j].owner].t_data[0] = 2;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-04-13 10:45:49 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else //Not hit yet
|
|
|
|
{
|
2012-09-02 14:30:32 +00:00
|
|
|
if (G_FindExplosionInSector(s->sectnum) >= 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
P_DoQuote(QUOTE_UNLOCKED, g_player[myconnectindex].ps);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, l))
|
2007-08-25 01:05:00 +00:00
|
|
|
{
|
|
|
|
x = sprite[l].lotag&0x7fff;
|
2006-11-16 03:02:42 +00:00
|
|
|
switch (x)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_0_ROTATING_SECTOR:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[l].hitag == sh)
|
|
|
|
{
|
2012-04-13 10:45:49 +00:00
|
|
|
int32_t ow = sprite[l].owner;
|
2006-11-16 03:02:42 +00:00
|
|
|
q = sprite[l].sectnum;
|
2012-04-13 10:45:49 +00:00
|
|
|
sector[q].floorshade = sector[q].ceilingshade = sprite[ow].shade;
|
|
|
|
sector[q].floorpal = sector[q].ceilingpal = sprite[ow].pal;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_1_PIVOT:
|
|
|
|
case SE_12_LIGHT_SWITCH:
|
2013-04-15 10:48:09 +00:00
|
|
|
// case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_19_EXPLOSION_LOWERS_CEILING:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sh == sprite[l].hitag)
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[l].t_data[0] == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[l].t_data[0] = 1; //Shut them all on
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[l].owner = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_20_STRETCH_BRIDGE: //Extend-o-bridge
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] == 0) break;
|
|
|
|
if (t[0] == 1) s->xvel = 8;
|
|
|
|
else s->xvel = -8;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->xvel) //Moving
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t p, nextj;
|
2012-08-10 19:11:56 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
x = (s->xvel*sintable[(s->ang+512)&2047])>>14;
|
|
|
|
l = (s->xvel*sintable[s->ang&2047])>>14;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
t[3] += s->xvel;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->x += x;
|
|
|
|
s->y += l;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[3] <= 0 || (t[3]>>6) >= (SP>>6))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
s->x -= x;
|
|
|
|
s->y -= l;
|
|
|
|
t[0] = 0;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(s->sectnum,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT_SAFE(s->sectnum, j, nextj))
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[j].statnum != STAT_EFFECTOR && sprite[j].zvel == 0)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[j].x += x;
|
|
|
|
sprite[j].y += l;
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(j,(vec3_t *)&sprite[j]);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sector[sprite[j].sectnum].floorstat&2)
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[j].statnum == STAT_ZOMBIEACTOR)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(j);
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-01-16 20:38:41 +00:00
|
|
|
dragpoint((int16_t)t[1],wall[t[1]].x+x,wall[t[1]].y+l,0);
|
|
|
|
dragpoint((int16_t)t[2],wall[t[2]].x+x,wall[t[2]].y+l,0);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-02-21 19:33:33 +00:00
|
|
|
for (TRAVERSE_CONNECT(p))
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
|
|
|
|
|
|
|
if (ps->cursectnum == s->sectnum && ps->on_ground)
|
2012-02-21 19:33:33 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->pos.x += x;
|
|
|
|
ps->pos.y += l;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->opos.x = ps->pos.x;
|
|
|
|
ps->opos.y = ps->pos.y;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
ps->pos.z += PHEIGHT;
|
|
|
|
setsprite(ps->i,(vec3_t *)ps);
|
|
|
|
ps->pos.z -= PHEIGHT;
|
2012-02-21 19:33:33 +00:00
|
|
|
}
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->floorxpanning-=x>>3;
|
|
|
|
sc->floorypanning-=l>>3;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingxpanning-=x>>3;
|
|
|
|
sc->ceilingypanning-=l>>3;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_21_DROP_FLOOR: // Cascading effect
|
2011-12-21 18:40:47 +00:00
|
|
|
{
|
|
|
|
int32_t *zptr;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] == 0) break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->ang == 1536)
|
2011-12-21 18:40:47 +00:00
|
|
|
zptr = &sc->ceilingz;
|
2006-11-16 03:02:42 +00:00
|
|
|
else
|
2011-12-21 18:40:47 +00:00
|
|
|
zptr = &sc->floorz;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] == 1) //Decide if the s->sectnum should go up or down
|
|
|
|
{
|
2011-12-21 18:40:47 +00:00
|
|
|
s->zvel = ksgn(s->z-*zptr) * (SP<<4);
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sc->extra == 0)
|
|
|
|
{
|
2011-12-21 18:40:47 +00:00
|
|
|
*zptr += s->zvel;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2011-12-21 18:40:47 +00:00
|
|
|
if (klabs(*zptr-s->z) < 1024)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2011-12-21 18:40:47 +00:00
|
|
|
*zptr = s->z;
|
2012-02-21 19:32:55 +00:00
|
|
|
KILLIT(i); //All done // SE_21_KILLIT, see sector.c
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else sc->extra--;
|
|
|
|
break;
|
2011-12-21 18:40:47 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_22_TEETH_DOOR:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[1])
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (GetAnimationGoal(§or[t[0]].ceilingz) >= 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingz += sc->extra*9;
|
|
|
|
else t[1] = 0;
|
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_24_CONVEYOR:
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_34:
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t p, nextj;
|
2012-08-10 19:11:56 +00:00
|
|
|
|
2012-04-13 10:46:04 +00:00
|
|
|
if (t[4])
|
|
|
|
break;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
x = (SP*sintable[(s->ang+512)&2047])>>18;
|
|
|
|
l = (SP*sintable[s->ang&2047])>>18;
|
|
|
|
|
|
|
|
k = 0;
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT_SAFE(s->sectnum, j, nextj))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
if (sprite[j].zvel >= 0)
|
|
|
|
switch (sprite[j].statnum)
|
|
|
|
{
|
2009-08-06 10:12:13 +00:00
|
|
|
case STAT_MISC:
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(sprite[j].picnum))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
case BLOODPOOL__STATIC:
|
|
|
|
case PUKE__STATIC:
|
|
|
|
case FOOTPRINTS__STATIC:
|
|
|
|
case FOOTPRINTS2__STATIC:
|
|
|
|
case FOOTPRINTS3__STATIC:
|
|
|
|
case FOOTPRINTS4__STATIC:
|
|
|
|
case BULLETHOLE__STATIC:
|
|
|
|
case BLOODSPLAT1__STATIC:
|
|
|
|
case BLOODSPLAT2__STATIC:
|
|
|
|
case BLOODSPLAT3__STATIC:
|
|
|
|
case BLOODSPLAT4__STATIC:
|
|
|
|
sprite[j].xrepeat = sprite[j].yrepeat = 0;
|
|
|
|
continue;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case LASERLINE__STATIC:
|
|
|
|
continue;
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
// fall-through
|
2009-08-06 10:12:13 +00:00
|
|
|
case STAT_STANDABLE:
|
2013-04-15 10:48:09 +00:00
|
|
|
if (sprite[j].picnum == TRIPBOMB)
|
|
|
|
break;
|
|
|
|
// else, fall-through
|
2009-08-06 10:12:13 +00:00
|
|
|
case STAT_ACTOR:
|
|
|
|
case STAT_DEFAULT:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (
|
|
|
|
sprite[j].picnum == BOLT1 ||
|
|
|
|
sprite[j].picnum == BOLT1+1 ||
|
|
|
|
sprite[j].picnum == BOLT1+2 ||
|
|
|
|
sprite[j].picnum == BOLT1+3 ||
|
|
|
|
sprite[j].picnum == SIDEBOLT1 ||
|
|
|
|
sprite[j].picnum == SIDEBOLT1+1 ||
|
|
|
|
sprite[j].picnum == SIDEBOLT1+2 ||
|
|
|
|
sprite[j].picnum == SIDEBOLT1+3 ||
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CheckSwitchTile(j)
|
2006-11-16 03:02:42 +00:00
|
|
|
)
|
|
|
|
break;
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
if (!(sprite[j].picnum >= CRANE && sprite[j].picnum <= CRANE+3))
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
if (sprite[j].z > actor[j].floorz-(16<<8))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[j].bpos.x = sprite[j].x;
|
|
|
|
actor[j].bpos.y = sprite[j].y;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
sprite[j].x += x>>2;
|
|
|
|
sprite[j].y += l>>2;
|
|
|
|
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(j,(vec3_t *)&sprite[j]);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
if (sector[sprite[j].sectnum].floorstat&2)
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[j].statnum == STAT_ZOMBIEACTOR)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Fall(j);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-11-22 12:28:12 +00:00
|
|
|
for (TRAVERSE_CONNECT(p))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
{
|
2015-07-25 19:42:54 +00:00
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
|
|
|
|
|
|
|
if (ps->cursectnum == s->sectnum && ps->on_ground)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2015-07-25 19:42:54 +00:00
|
|
|
if (klabs(ps->pos.z-ps->truefz) < PHEIGHT+(9<<8))
|
2014-11-22 12:28:12 +00:00
|
|
|
{
|
2015-07-25 19:42:54 +00:00
|
|
|
ps->fric.x += x<<3;
|
|
|
|
ps->fric.y += l<<3;
|
2014-11-22 12:28:12 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2014-11-22 12:28:12 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->floorxpanning += SP>>7;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-06-22 11:31:13 +00:00
|
|
|
case SE_35:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sc->ceilingz > s->z)
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j = 0; j < 8; j++)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
s->ang += krand()&511;
|
|
|
|
k = A_Spawn(i,SMALLSMOKE);
|
|
|
|
sprite[k].xvel = 96+(krand()&127);
|
|
|
|
A_SetSprite(k,CLIPMASK0);
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(k,(vec3_t *)&sprite[k]);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (rnd(16))
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(i,EXPLOSION2);
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
switch (t[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
sc->ceilingz += s->yvel;
|
|
|
|
if (sc->ceilingz > sc->floorz)
|
|
|
|
sc->floorz = sc->ceilingz;
|
|
|
|
if (sc->ceilingz > s->z+(32<<8))
|
|
|
|
t[0]++;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sc->ceilingz-=(s->yvel<<2);
|
|
|
|
if (sc->ceilingz < t[4])
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingz = t[4];
|
|
|
|
t[0] = 0;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_25_PISTON: //PISTONS
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[4] == 0) break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sc->floorz <= sc->ceilingz)
|
|
|
|
s->shade = 0;
|
|
|
|
else if (sc->ceilingz <= t[3])
|
|
|
|
s->shade = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (s->shade)
|
|
|
|
{
|
|
|
|
sc->ceilingz += SP<<4;
|
|
|
|
if (sc->ceilingz > sc->floorz)
|
|
|
|
sc->ceilingz = sc->floorz;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc->ceilingz -= SP<<4;
|
|
|
|
if (sc->ceilingz < t[3])
|
|
|
|
sc->ceilingz = t[3];
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_26:
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
int32_t p, nextj;
|
2012-08-10 19:11:56 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
s->xvel = 32;
|
|
|
|
l = (s->xvel*sintable[(s->ang+512)&2047])>>14;
|
|
|
|
x = (s->xvel*sintable[s->ang&2047])>>14;
|
|
|
|
|
|
|
|
s->shade++;
|
|
|
|
if (s->shade > 7)
|
|
|
|
{
|
|
|
|
s->x = t[3];
|
|
|
|
s->y = t[4];
|
|
|
|
sc->floorz -= ((s->zvel*s->shade)-s->zvel);
|
|
|
|
s->shade = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sc->floorz += s->zvel;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF_SECT_SAFE(s->sectnum, j, nextj))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PLAYER)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[j].bpos.x = sprite[j].x;
|
|
|
|
actor[j].bpos.y = sprite[j].y;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
sprite[j].x += l;
|
|
|
|
sprite[j].y += x;
|
|
|
|
|
|
|
|
sprite[j].z += s->zvel;
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(j,(vec3_t *)&sprite[j]);
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-02-21 19:33:33 +00:00
|
|
|
for (TRAVERSE_CONNECT(p))
|
2014-11-22 12:28:12 +00:00
|
|
|
{
|
2015-07-25 19:42:54 +00:00
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
|
|
|
|
|
|
|
if (sprite[ps->i].sectnum == s->sectnum && ps->on_ground)
|
2014-11-22 12:28:12 +00:00
|
|
|
{
|
2015-07-25 19:42:54 +00:00
|
|
|
ps->fric.x += l<<5;
|
|
|
|
ps->fric.y += x<<5;
|
|
|
|
ps->pos.z += s->zvel;
|
2014-11-22 12:28:12 +00:00
|
|
|
}
|
|
|
|
}
|
2010-01-16 23:08:17 +00:00
|
|
|
A_MoveSector(i);
|
2009-01-13 12:23:18 +00:00
|
|
|
setsprite(i,(vec3_t *)s);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_27_DEMO_CAM:
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
|
|
|
int32_t p;
|
|
|
|
DukePlayer_t *ps;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (ud.recstat == 0 || !ud.democams) break;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].tempang = s->ang;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
p = A_FindPlayer(s,&x);
|
2012-08-10 19:11:56 +00:00
|
|
|
ps = g_player[p].ps;
|
|
|
|
|
|
|
|
if (sprite[ps->i].extra > 0 && myconnectindex == screenpeek)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
if (t[0] < 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
ud.camerasprite = i;
|
|
|
|
t[0]++;
|
|
|
|
}
|
2012-08-10 19:11:56 +00:00
|
|
|
else if (ud.recstat == 2 && ps->newowner == -1)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
if (cansee(s->x,s->y,s->z,SECT,ps->pos.x,ps->pos.y,ps->pos.z,ps->cursectnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
if (x < (int32_t)((unsigned)sh))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
ud.camerasprite = i;
|
|
|
|
t[0] = 999;
|
2012-08-10 19:11:56 +00:00
|
|
|
s->ang += G_GetAngleDelta(s->ang,getangle(ps->pos.x-s->x,ps->pos.y-s->y))>>3;
|
|
|
|
SP = 100+((s->z-ps->pos.z)/257);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else if (t[0] == 999)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (ud.camerasprite == i)
|
|
|
|
t[0] = 0;
|
|
|
|
else t[0] = -10;
|
|
|
|
ud.camerasprite = i;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
s->ang = getangle(ps->pos.x-s->x,ps->pos.y-s->y);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
if (t[0] == 999)
|
|
|
|
{
|
|
|
|
if (ud.camerasprite == i)
|
|
|
|
t[0] = 0;
|
|
|
|
else t[0] = -20;
|
|
|
|
ud.camerasprite = i;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2012-04-13 10:46:04 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_28_LIGHTNING:
|
2012-08-10 19:11:56 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[5] > 0)
|
|
|
|
{
|
|
|
|
t[5]--;
|
2006-04-13 20:47:06 +00:00
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (T1 == 0)
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
A_FindPlayer(s,&x);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x > 15500)
|
|
|
|
break;
|
|
|
|
T1 = 1;
|
2008-11-20 14:06:36 +00:00
|
|
|
T2 = 64 + (krand()&511);
|
2006-11-16 03:02:42 +00:00
|
|
|
T3 = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
T3++;
|
|
|
|
if (T3 > T2)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
T1 = 0;
|
2007-08-27 06:46:31 +00:00
|
|
|
g_player[screenpeek].ps->visibility = ud.const_visibility;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else if (T3 == (T2>>1))
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(THUNDER,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
else if (T3 == (T2>>3))
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(LIGHTNING_SLAP,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
else if (T3 == (T2>>2))
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2012-05-29 20:01:48 +00:00
|
|
|
for (SPRITES_OF(STAT_DEFAULT, j))
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[j].picnum == NATURALLIGHTNING && sprite[j].hitag == s->hitag)
|
|
|
|
sprite[j].cstat |= 32768;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else if (T3 > (T2>>3) && T3 < (T2>>2))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (cansee(s->x,s->y,s->z,s->sectnum,g_player[screenpeek].ps->pos.x,g_player[screenpeek].ps->pos.y,g_player[screenpeek].ps->pos.z,g_player[screenpeek].ps->cursectnum))
|
2006-11-16 03:02:42 +00:00
|
|
|
j = 1;
|
|
|
|
else j = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (rnd(192) && (T3&1))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j)
|
2007-08-27 06:46:31 +00:00
|
|
|
g_player[screenpeek].ps->visibility = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else if (j)
|
2007-08-27 06:46:31 +00:00
|
|
|
g_player[screenpeek].ps->visibility = ud.const_visibility;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_DEFAULT, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[j].picnum == NATURALLIGHTNING && sprite[j].hitag == s->hitag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (rnd(32) && (T3&1))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
int32_t p;
|
|
|
|
DukePlayer_t *ps;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[j].cstat &= 32767;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(j,SMALLSMOKE);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-04-15 10:48:13 +00:00
|
|
|
p = A_FindPlayer(s, NULL);
|
2012-08-10 19:11:56 +00:00
|
|
|
ps = g_player[p].ps;
|
|
|
|
|
|
|
|
x = ldist(&sprite[ps->i], &sprite[j]);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (x < 768)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
if (!A_CheckSoundPlaying(ps->i,DUKE_LONGTERM_PAIN))
|
|
|
|
A_PlaySound(DUKE_LONGTERM_PAIN,ps->i);
|
|
|
|
A_PlaySound(SHORT_CIRCUIT,ps->i);
|
|
|
|
sprite[ps->i].extra -= 8+(krand()&7);
|
2012-05-05 22:24:50 +00:00
|
|
|
|
2012-08-10 19:11:56 +00:00
|
|
|
P_PalFrom(ps, 32, 16,0,0);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else sprite[j].cstat |= 32768;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2012-08-10 19:11:56 +00:00
|
|
|
}
|
2012-04-13 10:46:04 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_29_WAVES:
|
2006-11-16 03:02:42 +00:00
|
|
|
s->hitag += 64;
|
2009-01-09 09:29:17 +00:00
|
|
|
l = mulscale12((int32_t)s->yvel,sintable[s->hitag&2047]);
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->floorz = s->z + l;
|
|
|
|
break;
|
2012-04-13 10:46:04 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_31_FLOOR_RISE_FALL: // True Drop Floor
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] == 1)
|
|
|
|
{
|
|
|
|
// Choose dir
|
|
|
|
|
|
|
|
if (t[3] > 0)
|
|
|
|
{
|
|
|
|
t[3]--;
|
|
|
|
break;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[2] == 1) // Retract
|
|
|
|
{
|
|
|
|
if (SA != 1536)
|
2013-04-01 18:35:44 +00:00
|
|
|
HandleSE31(i, 1, s->z, 0, s->z-sc->floorz);
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
2013-04-01 18:35:44 +00:00
|
|
|
HandleSE31(i, 1, t[1], 0, t[1]-sc->floorz);
|
2011-06-29 19:57:05 +00:00
|
|
|
|
|
|
|
Yax_SetBunchZs(sc-sector, YAX_FLOOR, sc->floorz);
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if ((s->ang&2047) == 1536)
|
2013-04-01 18:35:44 +00:00
|
|
|
HandleSE31(i, 0, s->z, 1, s->z-sc->floorz);
|
2006-11-16 03:02:42 +00:00
|
|
|
else
|
2013-04-01 18:35:44 +00:00
|
|
|
HandleSE31(i, 0, t[1], 1, t[1]-s->z);
|
2011-06-29 19:57:05 +00:00
|
|
|
|
|
|
|
Yax_SetBunchZs(sc-sector, YAX_FLOOR, sc->floorz);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_32_CEILING_RISE_FALL: // True Drop Ceiling
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] == 1)
|
|
|
|
{
|
|
|
|
// Choose dir
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[2] == 1) // Retract
|
|
|
|
{
|
|
|
|
if (SA != 1536)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-04-13 10:46:04 +00:00
|
|
|
if (klabs(sc->ceilingz - s->z) < (SP<<1))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-15 01:16:55 +00:00
|
|
|
sc->ceilingz = s->z;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(s->sectnum,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
t[2] = 0;
|
|
|
|
t[0] = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-04-13 10:46:04 +00:00
|
|
|
else sc->ceilingz += ksgn(s->z-sc->ceilingz)*SP;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-13 10:46:04 +00:00
|
|
|
if (klabs(sc->ceilingz - t[1]) < (SP<<1))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingz = t[1];
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(s->sectnum,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
t[2] = 0;
|
|
|
|
t[0] = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-04-13 10:46:04 +00:00
|
|
|
else sc->ceilingz += ksgn(t[1]-sc->ceilingz)*SP;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2011-06-29 19:57:05 +00:00
|
|
|
|
|
|
|
Yax_SetBunchZs(sc-sector, YAX_CEILING, sc->ceilingz);
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if ((s->ang&2047) == 1536)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-04-13 10:46:04 +00:00
|
|
|
if (klabs(sc->ceilingz-s->z) < (SP<<1))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2006-04-13 20:47:06 +00:00
|
|
|
t[0] = 0;
|
2006-11-16 03:02:42 +00:00
|
|
|
t[2] = !t[2];
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(s->sectnum,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
sc->ceilingz = s->z;
|
|
|
|
}
|
2012-04-13 10:46:04 +00:00
|
|
|
else sc->ceilingz += ksgn(s->z-sc->ceilingz)*SP;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (klabs(sc->ceilingz-t[1]) < (SP<<1))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0] = 0;
|
|
|
|
t[2] = !t[2];
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(s->sectnum,i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else sc->ceilingz -= ksgn(s->z-t[1])*SP;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2011-06-29 19:57:05 +00:00
|
|
|
|
|
|
|
Yax_SetBunchZs(sc-sector, YAX_CEILING, sc->ceilingz);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_33_QUAKE_DEBRIS:
|
2008-11-20 14:06:36 +00:00
|
|
|
if (g_earthquakeTime > 0 && (krand()&7) == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
RANDOMSCRAP;
|
|
|
|
break;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_36_PROJ_SHOOTER:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0])
|
|
|
|
{
|
|
|
|
if (t[0] == 1)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Shoot(i,sc->extra);
|
2009-04-26 05:57:42 +00:00
|
|
|
else if (t[0] == GAMETICSPERSEC*5)
|
2006-11-16 03:02:42 +00:00
|
|
|
t[0] = 0;
|
|
|
|
t[0]++;
|
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case 128: //SE to control glass breakage
|
|
|
|
wal = &wall[t[2]];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wal->cstat|32)
|
|
|
|
{
|
|
|
|
wal->cstat &= (255-32);
|
|
|
|
wal->cstat |= 16;
|
|
|
|
if (wal->nextwall >= 0)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
wall[wal->nextwall].cstat &= (255-32);
|
|
|
|
wall[wal->nextwall].cstat |= 16;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
wal->overpicnum++;
|
|
|
|
if (wal->nextwall >= 0)
|
|
|
|
wall[wal->nextwall].overpicnum++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] < t[1]) t[0]++;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wal->cstat &= (128+32+8+4+2);
|
|
|
|
if (wal->nextwall >= 0)
|
|
|
|
wall[wal->nextwall].cstat &= (128+32+8+4+2);
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2013-06-22 11:31:13 +00:00
|
|
|
case SE_130:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] > 80)
|
|
|
|
{
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
else t[0]++;
|
|
|
|
|
|
|
|
x = sc->floorz-sc->ceilingz;
|
|
|
|
|
|
|
|
if (rnd(64))
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
k = A_Spawn(i,EXPLOSION2);
|
|
|
|
sprite[k].xrepeat = sprite[k].yrepeat = 2+(krand()&7);
|
|
|
|
sprite[k].z = sc->floorz-(krand()%x);
|
|
|
|
sprite[k].ang += 256-(krand()%511);
|
|
|
|
sprite[k].xvel = krand()&127;
|
|
|
|
A_SetSprite(k,CLIPMASK0);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2013-06-22 11:31:13 +00:00
|
|
|
case SE_131:
|
2006-11-16 03:02:42 +00:00
|
|
|
if (t[0] > 40)
|
|
|
|
{
|
|
|
|
KILLIT(i);
|
|
|
|
}
|
|
|
|
else t[0]++;
|
|
|
|
|
|
|
|
x = sc->floorz-sc->ceilingz;
|
|
|
|
|
|
|
|
if (rnd(32))
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
k = A_Spawn(i,EXPLOSION2);
|
|
|
|
sprite[k].xrepeat = sprite[k].yrepeat = 2+(krand()&3);
|
|
|
|
sprite[k].z = sc->floorz-(krand()%x);
|
|
|
|
sprite[k].ang += 256-(krand()%511);
|
|
|
|
sprite[k].xvel = krand()&127;
|
|
|
|
A_SetSprite(k,CLIPMASK0);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
case SE_49_POINT_LIGHT:
|
|
|
|
case SE_50_SPOT_LIGHT:
|
2012-05-14 18:12:27 +00:00
|
|
|
changespritestat(i, STAT_LIGHT);
|
|
|
|
break;
|
2012-05-06 21:01:52 +00:00
|
|
|
}
|
|
|
|
BOLT:
|
|
|
|
i = nexti;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Sloped sin-wave floors!
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, i))
|
2012-05-06 21:01:52 +00:00
|
|
|
{
|
|
|
|
const spritetype *s = &sprite[i];
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
if (s->lotag == SE_29_WAVES)
|
|
|
|
{
|
|
|
|
sectortype *const sc = §or[s->sectnum];
|
|
|
|
|
|
|
|
if (sc->wallnum == 4)
|
|
|
|
{
|
|
|
|
wal = &wall[sc->wallptr+2];
|
|
|
|
if (wal->nextsector >= 0)
|
|
|
|
alignflorslope(s->sectnum, wal->x,wal->y, sector[wal->nextsector].floorz);
|
|
|
|
}
|
|
|
|
}
|
2012-05-06 21:01:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
static void G_DoEffectorLights(void) // STATNUM 14
|
2012-05-06 21:01:52 +00:00
|
|
|
{
|
|
|
|
int32_t i;
|
2012-04-13 10:46:04 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
for (SPRITES_OF(STAT_LIGHT, i))
|
2012-05-06 21:01:52 +00:00
|
|
|
{
|
|
|
|
switch (sprite[i].lotag)
|
|
|
|
{
|
2009-04-29 19:43:51 +00:00
|
|
|
#ifdef POLYMER
|
2012-10-05 20:48:10 +00:00
|
|
|
case SE_49_POINT_LIGHT:
|
2009-04-24 06:04:13 +00:00
|
|
|
{
|
2014-02-22 19:38:52 +00:00
|
|
|
if (!A_CheckSpriteFlags(i, SFLAG_NOLIGHT) && getrendermode() == REND_POLYMER &&
|
|
|
|
!(A_CheckSpriteFlags(i, SFLAG_USEACTIVATOR) && sector[sprite[i].sectnum].lotag & 16384))
|
2009-04-24 06:04:13 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[i].lightptr == NULL)
|
2009-06-06 10:20:00 +00:00
|
|
|
{
|
2009-07-12 01:55:34 +00:00
|
|
|
#pragma pack(push,1)
|
2009-06-08 00:31:53 +00:00
|
|
|
_prlight mylight;
|
2009-07-12 01:55:34 +00:00
|
|
|
#pragma pack(pop)
|
2009-06-08 00:31:53 +00:00
|
|
|
mylight.sector = SECT;
|
2009-07-12 01:55:34 +00:00
|
|
|
Bmemcpy(&mylight, &sprite[i], sizeof(int32_t) * 3);
|
2009-06-08 00:31:53 +00:00
|
|
|
mylight.range = SHT;
|
2009-07-12 01:55:34 +00:00
|
|
|
mylight.color[0] = sprite[i].xvel;
|
|
|
|
mylight.color[1] = sprite[i].yvel;
|
|
|
|
mylight.color[2] = sprite[i].zvel;
|
2009-06-08 00:31:53 +00:00
|
|
|
mylight.radius = 0;
|
|
|
|
mylight.angle = SA;
|
|
|
|
mylight.horiz = SH;
|
|
|
|
mylight.minshade = sprite[i].xoffset;
|
|
|
|
mylight.maxshade = sprite[i].yoffset;
|
2009-10-03 21:14:42 +00:00
|
|
|
mylight.tilenum = 0;
|
2012-10-21 03:41:13 +00:00
|
|
|
mylight.publicflags.emitshadow = 0;
|
2012-10-21 04:52:43 +00:00
|
|
|
mylight.publicflags.negative = !!(CS & 128);
|
2009-06-06 10:20:00 +00:00
|
|
|
|
2009-06-08 00:31:53 +00:00
|
|
|
if (CS & 2)
|
|
|
|
{
|
|
|
|
if (CS & 512)
|
|
|
|
mylight.priority = PR_LIGHT_PRIO_LOW;
|
|
|
|
else
|
|
|
|
mylight.priority = PR_LIGHT_PRIO_HIGH;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
mylight.priority = PR_LIGHT_PRIO_MAX;
|
2009-04-28 05:31:32 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].lightId = polymer_addlight(&mylight);
|
|
|
|
if (actor[i].lightId >= 0)
|
|
|
|
actor[i].lightptr = &prlights[actor[i].lightId];
|
2009-06-08 00:31:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (Bmemcmp(&sprite[i], actor[i].lightptr, sizeof(int32_t) * 3))
|
2009-06-08 00:31:53 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
Bmemcpy(actor[i].lightptr, &sprite[i], sizeof(int32_t) * 3);
|
|
|
|
actor[i].lightptr->sector = sprite[i].sectnum;
|
|
|
|
actor[i].lightptr->flags.invalidate = 1;
|
2009-06-08 00:31:53 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
if (SHT != actor[i].lightptr->range)
|
2009-07-13 22:30:13 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].lightptr->range = SHT;
|
|
|
|
actor[i].lightptr->flags.invalidate = 1;
|
2009-07-13 22:30:13 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
if ((sprite[i].xvel != actor[i].lightptr->color[0]) ||
|
|
|
|
(sprite[i].yvel != actor[i].lightptr->color[1]) ||
|
|
|
|
(sprite[i].zvel != actor[i].lightptr->color[2]))
|
2009-07-13 22:30:13 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].lightptr->color[0] = sprite[i].xvel;
|
|
|
|
actor[i].lightptr->color[1] = sprite[i].yvel;
|
|
|
|
actor[i].lightptr->color[2] = sprite[i].zvel;
|
2009-07-13 22:30:13 +00:00
|
|
|
}
|
2012-11-15 14:28:41 +00:00
|
|
|
if ((int)!!(CS & 128) != actor[i].lightptr->publicflags.negative) {
|
2012-10-21 04:52:43 +00:00
|
|
|
actor[i].lightptr->publicflags.negative = !!(CS & 128);
|
|
|
|
}
|
2009-06-06 10:20:00 +00:00
|
|
|
}
|
2009-04-24 06:04:13 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-10-05 20:48:10 +00:00
|
|
|
case SE_50_SPOT_LIGHT:
|
2009-04-24 06:04:13 +00:00
|
|
|
{
|
2014-02-22 19:38:52 +00:00
|
|
|
if (!A_CheckSpriteFlags(i, SFLAG_NOLIGHT) && getrendermode() == REND_POLYMER &&
|
|
|
|
!(A_CheckSpriteFlags(i, SFLAG_USEACTIVATOR) && sector[sprite[i].sectnum].lotag & 16384))
|
2009-04-24 06:04:13 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[i].lightptr == NULL)
|
2009-06-06 10:20:00 +00:00
|
|
|
{
|
2009-07-12 01:55:34 +00:00
|
|
|
#pragma pack(push,1)
|
2009-06-08 00:31:53 +00:00
|
|
|
_prlight mylight;
|
2009-07-12 01:55:34 +00:00
|
|
|
#pragma pack(pop)
|
2009-06-06 10:20:00 +00:00
|
|
|
|
2009-06-08 00:31:53 +00:00
|
|
|
mylight.sector = SECT;
|
2009-07-12 01:55:34 +00:00
|
|
|
Bmemcpy(&mylight, &sprite[i], sizeof(int32_t) * 3);
|
2009-06-08 00:31:53 +00:00
|
|
|
mylight.range = SHT;
|
2009-07-12 01:55:34 +00:00
|
|
|
mylight.color[0] = sprite[i].xvel;
|
|
|
|
mylight.color[1] = sprite[i].yvel;
|
|
|
|
mylight.color[2] = sprite[i].zvel;
|
2009-06-08 00:31:53 +00:00
|
|
|
mylight.radius = (256-(SS+128))<<1;
|
2009-07-12 01:55:34 +00:00
|
|
|
mylight.faderadius = (int16_t)(mylight.radius * 0.75f);
|
2009-06-08 00:31:53 +00:00
|
|
|
mylight.angle = SA;
|
|
|
|
mylight.horiz = SH;
|
|
|
|
mylight.minshade = sprite[i].xoffset;
|
|
|
|
mylight.maxshade = sprite[i].yoffset;
|
2010-07-22 20:29:09 +00:00
|
|
|
mylight.tilenum = actor[i].picnum;
|
2012-10-21 03:41:13 +00:00
|
|
|
mylight.publicflags.emitshadow = !(CS & 64);
|
2012-10-21 04:52:43 +00:00
|
|
|
mylight.publicflags.negative = !!(CS & 128);
|
2009-06-06 10:20:00 +00:00
|
|
|
|
2009-06-08 00:31:53 +00:00
|
|
|
if (CS & 2)
|
|
|
|
{
|
|
|
|
if (CS & 512)
|
|
|
|
mylight.priority = PR_LIGHT_PRIO_LOW;
|
|
|
|
else
|
|
|
|
mylight.priority = PR_LIGHT_PRIO_HIGH;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
mylight.priority = PR_LIGHT_PRIO_MAX;
|
2009-04-28 05:31:32 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].lightId = polymer_addlight(&mylight);
|
|
|
|
if (actor[i].lightId >= 0)
|
2012-02-08 11:01:03 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].lightptr = &prlights[actor[i].lightId];
|
2011-10-02 07:09:04 +00:00
|
|
|
|
2012-02-08 11:01:03 +00:00
|
|
|
// Hack in case polymer_addlight tweaked the horiz value
|
|
|
|
if (actor[i].lightptr->horiz != SH)
|
|
|
|
SH = actor[i].lightptr->horiz;
|
|
|
|
}
|
2009-06-08 00:31:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (Bmemcmp(&sprite[i], actor[i].lightptr, sizeof(int32_t) * 3))
|
2009-06-08 00:31:53 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
Bmemcpy(actor[i].lightptr, &sprite[i], sizeof(int32_t) * 3);
|
|
|
|
actor[i].lightptr->sector = sprite[i].sectnum;
|
|
|
|
actor[i].lightptr->flags.invalidate = 1;
|
2009-06-08 00:31:53 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
if (SHT != actor[i].lightptr->range)
|
2009-07-13 22:30:13 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].lightptr->range = SHT;
|
|
|
|
actor[i].lightptr->flags.invalidate = 1;
|
2009-07-13 22:30:13 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
if ((sprite[i].xvel != actor[i].lightptr->color[0]) ||
|
|
|
|
(sprite[i].yvel != actor[i].lightptr->color[1]) ||
|
|
|
|
(sprite[i].zvel != actor[i].lightptr->color[2]))
|
2009-07-13 22:30:13 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].lightptr->color[0] = sprite[i].xvel;
|
|
|
|
actor[i].lightptr->color[1] = sprite[i].yvel;
|
|
|
|
actor[i].lightptr->color[2] = sprite[i].zvel;
|
2009-07-13 22:30:13 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
if (((256-(SS+128))<<1) != actor[i].lightptr->radius)
|
2009-07-13 22:30:13 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].lightptr->radius = (256-(SS+128))<<1;
|
|
|
|
actor[i].lightptr->faderadius = (int16_t)(actor[i].lightptr->radius * 0.75f);
|
|
|
|
actor[i].lightptr->flags.invalidate = 1;
|
2009-07-13 22:30:13 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
if (SA != actor[i].lightptr->angle)
|
2009-07-13 22:30:13 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].lightptr->angle = SA;
|
|
|
|
actor[i].lightptr->flags.invalidate = 1;
|
2009-07-13 22:30:13 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
if (SH != actor[i].lightptr->horiz)
|
2009-07-13 22:30:13 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].lightptr->horiz = SH;
|
|
|
|
actor[i].lightptr->flags.invalidate = 1;
|
2009-07-13 22:30:13 +00:00
|
|
|
}
|
2012-11-15 14:28:41 +00:00
|
|
|
if ((int)!(CS & 64) != actor[i].lightptr->publicflags.emitshadow) {
|
2012-10-21 03:41:13 +00:00
|
|
|
actor[i].lightptr->publicflags.emitshadow = !(CS & 64);
|
|
|
|
}
|
2012-11-15 14:28:41 +00:00
|
|
|
if ((int)!!(CS & 128) != actor[i].lightptr->publicflags.negative) {
|
2012-10-21 04:52:43 +00:00
|
|
|
actor[i].lightptr->publicflags.negative = !!(CS & 128);
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].lightptr->tilenum = actor[i].picnum;
|
2009-04-29 19:43:51 +00:00
|
|
|
}
|
2009-04-28 05:31:32 +00:00
|
|
|
|
2009-04-24 06:04:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif // POLYMER
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
#ifdef POLYMER
|
2016-04-13 04:04:13 +00:00
|
|
|
static void A_DoLight(int32_t i)
|
2012-10-05 20:48:10 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
spritetype *const s = &sprite[i];
|
2012-10-05 20:48:10 +00:00
|
|
|
int32_t numsavedfires = 0;
|
|
|
|
|
2015-12-23 04:05:31 +00:00
|
|
|
if (((sector[s->sectnum].floorz - sector[s->sectnum].ceilingz) < 16) || s->z > sector[s->sectnum].floorz || s->z > actor[i].floorz ||
|
|
|
|
(s->picnum != SECTOREFFECTOR && ((s->cstat & 32768) || s->yrepeat < 4)) ||
|
|
|
|
A_CheckSpriteFlags(i, SFLAG_NOLIGHT) || (A_CheckSpriteFlags(i, SFLAG_USEACTIVATOR) && sector[s->sectnum].lotag & 16384))
|
2012-10-05 20:48:10 +00:00
|
|
|
{
|
|
|
|
if (actor[i].lightptr != NULL)
|
|
|
|
A_DeleteLight(i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int32_t ii;
|
|
|
|
|
|
|
|
if (actor[i].lightptr != NULL && actor[i].lightcount)
|
|
|
|
{
|
|
|
|
if (!(--actor[i].lightcount))
|
|
|
|
A_DeleteLight(i);
|
|
|
|
}
|
|
|
|
|
2015-10-23 23:00:21 +00:00
|
|
|
if (pr_lighting != 1)
|
|
|
|
return;
|
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
for (ii=0; ii<2; ii++)
|
|
|
|
{
|
2015-12-23 04:05:31 +00:00
|
|
|
if (s->picnum <= 0) // oob safety
|
2012-10-05 20:48:10 +00:00
|
|
|
break;
|
|
|
|
|
2015-12-23 04:05:31 +00:00
|
|
|
switch (DYNAMICTILEMAP(s->picnum-1+ii))
|
2012-10-05 20:48:10 +00:00
|
|
|
{
|
|
|
|
case DIPSWITCH__STATIC:
|
|
|
|
case DIPSWITCH2__STATIC:
|
|
|
|
case DIPSWITCH3__STATIC:
|
|
|
|
case PULLSWITCH__STATIC:
|
|
|
|
case SLOTDOOR__STATIC:
|
|
|
|
case LIGHTSWITCH__STATIC:
|
|
|
|
case SPACELIGHTSWITCH__STATIC:
|
|
|
|
case SPACEDOORSWITCH__STATIC:
|
|
|
|
case FRANKENSTINESWITCH__STATIC:
|
|
|
|
case POWERSWITCH1__STATIC:
|
|
|
|
case LOCKSWITCH1__STATIC:
|
|
|
|
case POWERSWITCH2__STATIC:
|
|
|
|
case TECHSWITCH__STATIC:
|
|
|
|
case ACCESSSWITCH__STATIC:
|
|
|
|
case ACCESSSWITCH2__STATIC:
|
|
|
|
{
|
2014-02-22 19:38:52 +00:00
|
|
|
if ((s->cstat & 32768) || A_CheckSpriteFlags(i, SFLAG_NOLIGHT))
|
2012-10-05 20:48:10 +00:00
|
|
|
{
|
|
|
|
if (actor[i].lightptr != NULL)
|
|
|
|
A_DeleteLight(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-12-23 04:05:31 +00:00
|
|
|
vec2_t const d = { sintable[(s->ang+512)&2047]>>7, sintable[(s->ang)&2047]>>7 };
|
|
|
|
|
|
|
|
s->x += d.x;
|
|
|
|
s->y += d.y;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2015-10-23 23:00:13 +00:00
|
|
|
int16_t sectnum = s->sectnum;
|
|
|
|
updatesector(s->x, s->y, §num);
|
|
|
|
|
2015-12-23 04:05:31 +00:00
|
|
|
if ((unsigned) sectnum >= MAXSECTORS || s->z > sector[sectnum].floorz || s->z < sector[sectnum].ceilingz)
|
|
|
|
goto POOP;
|
2015-10-23 23:00:13 +00:00
|
|
|
|
2015-12-23 04:05:31 +00:00
|
|
|
G_AddGameLight(0, i, (s->yrepeat*tilesiz[s->picnum].y)<<1, 512-ii*128,
|
2016-04-13 04:04:13 +00:00
|
|
|
ii==0 ? (172+(200<<8)+(104<<16)) : 216+(52<<8)+(20<<16), PR_LIGHT_PRIO_LOW);
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2015-12-23 04:05:31 +00:00
|
|
|
POOP:
|
|
|
|
s->x -= d.x;
|
|
|
|
s->y -= d.y;
|
|
|
|
}
|
2012-10-05 20:48:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-23 04:05:31 +00:00
|
|
|
switch (DYNAMICTILEMAP(s->picnum))
|
2012-10-05 20:48:10 +00:00
|
|
|
{
|
|
|
|
case ATOMICHEALTH__STATIC:
|
2016-04-13 04:04:13 +00:00
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD2, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
2012-10-05 20:48:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FIRE__STATIC:
|
|
|
|
case FIRE2__STATIC:
|
|
|
|
case BURNING__STATIC:
|
|
|
|
case BURNING2__STATIC:
|
|
|
|
{
|
|
|
|
uint32_t color;
|
|
|
|
int32_t jj;
|
|
|
|
|
|
|
|
static int32_t savedfires[32][4]; // sectnum x y z
|
|
|
|
|
|
|
|
/*
|
|
|
|
if (Actor[i].floorz - Actor[i].ceilingz < 128) break;
|
|
|
|
if (s->z > Actor[i].floorz+2048) break;
|
|
|
|
*/
|
|
|
|
|
|
|
|
switch (s->pal)
|
|
|
|
{
|
|
|
|
case 1: color = 128+(128<<8)+(255<<16); break;
|
|
|
|
case 2: color = 255+(48<<8)+(48<<16); break;
|
|
|
|
case 8: color = 48+(255<<8)+(48<<16); break;
|
2015-12-23 04:05:31 +00:00
|
|
|
default: color = 240+(160<<8)+(80<<16); break;
|
2012-10-05 20:48:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (jj=numsavedfires-1; jj>=0; jj--)
|
|
|
|
if (savedfires[jj][0]==s->sectnum && savedfires[jj][1]==(s->x>>3) &&
|
|
|
|
savedfires[jj][2]==(s->y>>3) && savedfires[jj][3]==(s->z>>7))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (jj==-1 && numsavedfires<32)
|
|
|
|
{
|
|
|
|
jj = numsavedfires;
|
2016-04-13 04:04:13 +00:00
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD2, color, PR_LIGHT_PRIO_HIGH_GAME);
|
2012-10-05 20:48:10 +00:00
|
|
|
savedfires[jj][0] = s->sectnum;
|
|
|
|
savedfires[jj][1] = s->x>>3;
|
|
|
|
savedfires[jj][2] = s->y>>3;
|
|
|
|
savedfires[jj][3] = s->z>>7;
|
|
|
|
numsavedfires++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OOZFILTER__STATIC:
|
|
|
|
if (s->xrepeat > 4)
|
2016-04-13 04:04:13 +00:00
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 4096, 176+(252<<8)+(120<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
2012-10-05 20:48:10 +00:00
|
|
|
break;
|
|
|
|
case FLOORFLAME__STATIC:
|
|
|
|
case FIREBARREL__STATIC:
|
|
|
|
case FIREVASE__STATIC:
|
2016-04-13 04:04:13 +00:00
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<2), LIGHTRAD2>>1, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
|
2012-10-05 20:48:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EXPLOSION2__STATIC:
|
|
|
|
if (!actor[i].lightcount)
|
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
// XXX: This block gets CODEDUP'd too much.
|
2012-10-05 20:48:10 +00:00
|
|
|
int32_t x = ((sintable[(s->ang+512)&2047])>>6);
|
|
|
|
int32_t y = ((sintable[(s->ang)&2047])>>6);
|
|
|
|
|
|
|
|
s->x -= x;
|
|
|
|
s->y -= y;
|
|
|
|
|
2015-12-23 04:05:31 +00:00
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD, 240+(160<<8)+(80<<16),
|
2016-04-13 04:04:13 +00:00
|
|
|
s->yrepeat > 32 ? PR_LIGHT_PRIO_HIGH_GAME : PR_LIGHT_PRIO_LOW_GAME);
|
2012-10-05 20:48:10 +00:00
|
|
|
|
|
|
|
s->x += x;
|
|
|
|
s->y += y;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FORCERIPPLE__STATIC:
|
|
|
|
case TRANSPORTERBEAM__STATIC:
|
2016-04-13 04:04:13 +00:00
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD, 80+(80<<8)+(255<<16),PR_LIGHT_PRIO_LOW_GAME);
|
2012-10-05 20:48:10 +00:00
|
|
|
break;
|
|
|
|
case GROWSPARK__STATIC:
|
|
|
|
{
|
|
|
|
int32_t x = ((sintable[(s->ang+512)&2047])>>6);
|
|
|
|
int32_t y = ((sintable[(s->ang)&2047])>>6);
|
|
|
|
|
|
|
|
s->x -= x;
|
|
|
|
s->y -= y;
|
|
|
|
|
2016-04-13 04:04:13 +00:00
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 1024, 216+(52<<8)+(20<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
2012-10-05 20:48:10 +00:00
|
|
|
|
|
|
|
s->x += x;
|
|
|
|
s->y += y;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SHRINKEREXPLOSION__STATIC:
|
|
|
|
{
|
|
|
|
int32_t x = ((sintable[(s->ang+512)&2047])>>6);
|
|
|
|
int32_t y = ((sintable[(s->ang)&2047])>>6);
|
|
|
|
|
|
|
|
s->x -= x;
|
|
|
|
s->y -= y;
|
|
|
|
|
2016-04-13 04:04:13 +00:00
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 2048, 176+(252<<8)+(120<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
2012-10-05 20:48:10 +00:00
|
|
|
|
|
|
|
s->x += x;
|
|
|
|
s->y += y;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FREEZEBLAST__STATIC:
|
2016-04-13 04:04:13 +00:00
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD<<2, 72+(88<<8)+(140<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
2012-10-05 20:48:10 +00:00
|
|
|
break;
|
|
|
|
case COOLEXPLOSION1__STATIC:
|
2016-04-13 04:04:13 +00:00
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD<<2, 128+(0<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
2012-10-05 20:48:10 +00:00
|
|
|
break;
|
|
|
|
case SHRINKSPARK__STATIC:
|
2016-04-13 04:04:13 +00:00
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD, 176+(252<<8)+(120<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
2012-10-05 20:48:10 +00:00
|
|
|
break;
|
|
|
|
case FIRELASER__STATIC:
|
2015-12-23 04:05:27 +00:00
|
|
|
if (s->statnum == STAT_PROJECTILE)
|
2016-04-13 04:04:13 +00:00
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME);
|
2012-10-05 20:48:10 +00:00
|
|
|
break;
|
|
|
|
case RPG__STATIC:
|
2016-04-13 04:04:13 +00:00
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 128 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME);
|
2012-10-05 20:48:10 +00:00
|
|
|
break;
|
|
|
|
case SHOTSPARK1__STATIC:
|
|
|
|
if (actor[i].t_data[2] == 0) // check for first frame of action
|
|
|
|
{
|
|
|
|
int32_t x = ((sintable[(s->ang+512)&2047])>>7);
|
|
|
|
int32_t y = ((sintable[(s->ang)&2047])>>7);
|
|
|
|
|
|
|
|
s->x -= x;
|
|
|
|
s->y -= y;
|
|
|
|
|
2016-04-13 04:04:13 +00:00
|
|
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 8 * s->yrepeat, 240+(160<<8)+(80<<16),PR_LIGHT_PRIO_LOW_GAME);
|
2012-10-05 20:48:10 +00:00
|
|
|
actor[i].lightcount = 1;
|
|
|
|
|
|
|
|
s->x += x;
|
|
|
|
s->y += y;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // POLYMER
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void A_PlayAlertSound(int32_t i)
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
|
|
|
if (sprite[i].extra > 0)
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(PN))
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
|
|
|
case LIZTROOPONTOILET__STATIC:
|
|
|
|
case LIZTROOPJUSTSIT__STATIC:
|
|
|
|
case LIZTROOPSHOOT__STATIC:
|
|
|
|
case LIZTROOPJETPACK__STATIC:
|
|
|
|
case LIZTROOPDUCKING__STATIC:
|
|
|
|
case LIZTROOPRUNNING__STATIC:
|
|
|
|
case LIZTROOP__STATIC:
|
|
|
|
A_PlaySound(PRED_RECOG,i);
|
|
|
|
break;
|
|
|
|
case LIZMAN__STATIC:
|
|
|
|
case LIZMANSPITTING__STATIC:
|
|
|
|
case LIZMANFEEDING__STATIC:
|
|
|
|
case LIZMANJUMP__STATIC:
|
|
|
|
A_PlaySound(CAPT_RECOG,i);
|
|
|
|
break;
|
|
|
|
case PIGCOP__STATIC:
|
|
|
|
case PIGCOPDIVE__STATIC:
|
|
|
|
A_PlaySound(PIG_RECOG,i);
|
|
|
|
break;
|
|
|
|
case RECON__STATIC:
|
|
|
|
A_PlaySound(RECO_RECOG,i);
|
|
|
|
break;
|
|
|
|
case DRONE__STATIC:
|
|
|
|
A_PlaySound(DRON_RECOG,i);
|
|
|
|
break;
|
|
|
|
case COMMANDER__STATIC:
|
|
|
|
case COMMANDERSTAYPUT__STATIC:
|
|
|
|
A_PlaySound(COMM_RECOG,i);
|
|
|
|
break;
|
|
|
|
case ORGANTIC__STATIC:
|
|
|
|
A_PlaySound(TURR_RECOG,i);
|
|
|
|
break;
|
|
|
|
case OCTABRAIN__STATIC:
|
|
|
|
case OCTABRAINSTAYPUT__STATIC:
|
|
|
|
A_PlaySound(OCTA_RECOG,i);
|
|
|
|
break;
|
|
|
|
case BOSS1__STATIC:
|
2013-03-04 01:23:55 +00:00
|
|
|
case BOSS1STAYPUT__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(BOS1_RECOG);
|
|
|
|
break;
|
|
|
|
case BOSS2__STATIC:
|
2013-03-04 01:23:55 +00:00
|
|
|
if (sprite[i].pal != 0)
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(BOS2_RECOG);
|
|
|
|
else S_PlaySound(WHIPYOURASS);
|
|
|
|
break;
|
|
|
|
case BOSS3__STATIC:
|
2013-03-04 01:23:55 +00:00
|
|
|
if (sprite[i].pal != 0)
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(BOS3_RECOG);
|
|
|
|
else S_PlaySound(RIPHEADNECK);
|
|
|
|
break;
|
|
|
|
case BOSS4__STATIC:
|
|
|
|
case BOSS4STAYPUT__STATIC:
|
2013-03-04 01:23:55 +00:00
|
|
|
if (sprite[i].pal != 0)
|
2008-11-20 14:06:36 +00:00
|
|
|
S_PlaySound(BOS4_RECOG);
|
2013-03-19 06:22:08 +00:00
|
|
|
else S_PlaySound(BOSS4_FIRSTSEE);
|
2008-11-20 14:06:36 +00:00
|
|
|
break;
|
|
|
|
case GREENSLIME__STATIC:
|
|
|
|
A_PlaySound(SLIM_RECOG,i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t A_CheckSwitchTile(int32_t i)
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t j;
|
2011-12-11 13:26:39 +00:00
|
|
|
|
|
|
|
if (PN <= 0) // picnum 0 would oob in the switch below
|
|
|
|
return 0;
|
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
// MULTISWITCH has 4 states so deal with it separately.
|
|
|
|
if (PN >= MULTISWITCH && PN <= MULTISWITCH+3)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
// ACCESSSWITCH and ACCESSSWITCH2 are only active in one state so deal with
|
|
|
|
// them separately.
|
2014-02-22 19:38:47 +00:00
|
|
|
if (PN == ACCESSSWITCH || PN == ACCESSSWITCH2)
|
|
|
|
return 1;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
|
|
|
// Loop to catch both states of switches.
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=1; j>=0; j--)
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(PN-j))
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
|
|
|
case HANDPRINTSWITCH__STATIC:
|
|
|
|
case ALIENSWITCH__STATIC:
|
|
|
|
case MULTISWITCH__STATIC:
|
|
|
|
case PULLSWITCH__STATIC:
|
|
|
|
case HANDSWITCH__STATIC:
|
|
|
|
case SLOTDOOR__STATIC:
|
|
|
|
case LIGHTSWITCH__STATIC:
|
|
|
|
case SPACELIGHTSWITCH__STATIC:
|
|
|
|
case SPACEDOORSWITCH__STATIC:
|
|
|
|
case FRANKENSTINESWITCH__STATIC:
|
|
|
|
case LIGHTSWITCH2__STATIC:
|
|
|
|
case POWERSWITCH1__STATIC:
|
|
|
|
case LOCKSWITCH1__STATIC:
|
|
|
|
case POWERSWITCH2__STATIC:
|
|
|
|
case DIPSWITCH__STATIC:
|
|
|
|
case DIPSWITCH2__STATIC:
|
|
|
|
case TECHSWITCH__STATIC:
|
|
|
|
case DIPSWITCH3__STATIC:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-04-13 04:04:13 +00:00
|
|
|
void G_RefreshLights(void)
|
2015-10-23 23:00:21 +00:00
|
|
|
{
|
|
|
|
#ifdef POLYMER
|
2015-10-24 00:30:35 +00:00
|
|
|
if (Numsprites && getrendermode() == REND_POLYMER)
|
2015-10-23 23:00:21 +00:00
|
|
|
{
|
|
|
|
int32_t i, k = 0;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
i = headspritestat[k++];
|
|
|
|
|
|
|
|
while (i >= 0)
|
|
|
|
{
|
2016-04-13 04:04:13 +00:00
|
|
|
A_DoLight(i);
|
2015-10-23 23:00:21 +00:00
|
|
|
i = nextspritestat[i];
|
|
|
|
}
|
|
|
|
} while (k < MAXSTATUS);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
void G_MoveWorld(void)
|
2006-12-10 03:15:56 +00:00
|
|
|
{
|
2013-07-13 21:04:47 +00:00
|
|
|
extern double g_moveActorsTime;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2015-03-27 12:29:05 +00:00
|
|
|
VM_OnEvent(EVENT_PREWORLD, -1, -1);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(VM_HaveEvent(EVENT_PREGAME)))
|
2012-08-27 03:49:55 +00:00
|
|
|
{
|
2014-10-25 03:36:34 +00:00
|
|
|
int32_t i, j, k = 0, p, pl;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
do
|
2012-08-27 03:49:55 +00:00
|
|
|
{
|
2014-10-25 03:36:34 +00:00
|
|
|
i = headspritestat[k++];
|
2012-08-27 03:49:55 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
while (i >= 0)
|
2012-08-27 03:49:55 +00:00
|
|
|
{
|
2014-10-25 03:36:34 +00:00
|
|
|
j = nextspritestat[i];
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (A_CheckSpriteFlags(i, SFLAG_NOEVENTCODE))
|
|
|
|
{
|
|
|
|
i = j;
|
|
|
|
continue;
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
pl = A_FindPlayer(&sprite[i], &p);
|
2014-11-22 12:29:25 +00:00
|
|
|
VM_OnEventWithDist_(EVENT_PREGAME, i, pl, p);
|
2014-10-25 03:36:34 +00:00
|
|
|
|
|
|
|
i = j;
|
|
|
|
}
|
|
|
|
} while (k < MAXSTATUS);
|
2012-08-27 03:49:55 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
G_MoveZombieActors(); //ST 2
|
|
|
|
G_MoveWeapons(); //ST 4
|
|
|
|
G_MoveTransports(); //ST 9
|
2006-12-10 03:15:56 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
G_MovePlayers(); //ST 10
|
|
|
|
G_MoveFallers(); //ST 12
|
|
|
|
G_MoveMisc(); //ST 5
|
2006-12-10 03:15:56 +00:00
|
|
|
|
2013-07-13 21:04:47 +00:00
|
|
|
{
|
|
|
|
double t = gethiticks();
|
|
|
|
|
|
|
|
G_MoveActors(); //ST 1
|
|
|
|
|
|
|
|
g_moveActorsTime = (1-0.033)*g_moveActorsTime + 0.033*(gethiticks()-t);
|
|
|
|
}
|
2012-05-06 21:01:52 +00:00
|
|
|
|
|
|
|
// XXX: Has to be before effectors, in particular movers?
|
|
|
|
// TODO: lights in moving sectors ought to be interpolated
|
2012-10-05 20:48:10 +00:00
|
|
|
G_DoEffectorLights();
|
2012-05-06 21:01:52 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
G_MoveEffectors(); //ST 3
|
2006-12-10 03:15:56 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
G_MoveStandables(); //ST 6
|
2006-12-10 03:15:56 +00:00
|
|
|
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2015-03-27 12:29:05 +00:00
|
|
|
VM_OnEvent(EVENT_WORLD, -1, -1);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(VM_HaveEvent(EVENT_GAME)))
|
2006-12-10 03:15:56 +00:00
|
|
|
{
|
2014-10-25 03:36:34 +00:00
|
|
|
int32_t i, j, k = 0, p, pl;
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
do
|
2006-12-10 03:15:56 +00:00
|
|
|
{
|
2014-10-25 03:36:34 +00:00
|
|
|
i = headspritestat[k++];
|
2009-01-02 01:03:41 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
while (i >= 0)
|
2012-10-05 20:48:10 +00:00
|
|
|
{
|
2014-10-25 03:36:34 +00:00
|
|
|
|
|
|
|
if (A_CheckSpriteFlags(i, SFLAG_NOEVENTCODE))
|
|
|
|
{
|
|
|
|
i = nextspritestat[i];
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
j = nextspritestat[i];
|
|
|
|
|
|
|
|
pl = A_FindPlayer(&sprite[i], &p);
|
2014-11-22 12:29:25 +00:00
|
|
|
VM_OnEventWithDist_(EVENT_GAME, i, pl, p);
|
2014-10-25 03:36:34 +00:00
|
|
|
|
2008-02-06 11:42:34 +00:00
|
|
|
i = j;
|
2012-10-05 20:48:10 +00:00
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
} while (k < MAXSTATUS);
|
|
|
|
}
|
2012-10-05 20:48:10 +00:00
|
|
|
|
2016-04-13 04:04:13 +00:00
|
|
|
G_RefreshLights();
|
2008-11-20 14:06:36 +00:00
|
|
|
G_DoSectorAnimations();
|
|
|
|
G_MoveFX(); //ST 11
|
2006-12-10 03:15:56 +00:00
|
|
|
}
|