2006-04-13 20:47:06 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
2010-05-25 10:56:00 +00:00
|
|
|
Copyright (C) 2010 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
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2016-01-08 01:33:35 +00:00
|
|
|
#define sector_c_
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
#include "duke3d.h"
|
2012-06-03 16:11:22 +00:00
|
|
|
#include "input.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
// PRIMITIVE
|
|
|
|
|
2009-01-10 07:38:50 +00:00
|
|
|
static int32_t g_haltSoundHack = 0;
|
2007-01-30 09:03:51 +00:00
|
|
|
|
2014-05-23 20:25:29 +00:00
|
|
|
int32_t S_FindMusicSFX(int32_t sn, int32_t *sndptr)
|
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
|
|
|
|
for (SPRITES_OF_SECT(sn, i))
|
|
|
|
{
|
|
|
|
const int32_t snd = sprite[i].lotag;
|
|
|
|
EDUKE32_STATIC_ASSERT(MAXSOUNDS >= 1000);
|
|
|
|
|
|
|
|
if (PN == MUSICANDSFX && (unsigned)snd < 1000) // XXX: in other places, 999
|
|
|
|
{
|
|
|
|
*sndptr = snd;
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*sndptr = -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
// this function activates a sector's MUSICANDSFX sprite
|
2014-01-31 21:12:55 +00:00
|
|
|
int32_t A_CallSound(int32_t sn, int32_t whatsprite)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-05-23 20:25:29 +00:00
|
|
|
int32_t i, snd;
|
2012-05-29 20:01:48 +00:00
|
|
|
|
2009-01-10 07:38:50 +00:00
|
|
|
if (g_haltSoundHack)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-10 07:38:50 +00:00
|
|
|
g_haltSoundHack = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2012-05-29 20:01:48 +00:00
|
|
|
|
2014-05-23 20:25:29 +00:00
|
|
|
i = S_FindMusicSFX(sn, &snd);
|
|
|
|
|
|
|
|
if (i >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-05-23 20:25:29 +00:00
|
|
|
if (whatsprite == -1)
|
|
|
|
whatsprite = i;
|
2014-01-31 21:12:56 +00:00
|
|
|
|
2014-05-23 20:25:29 +00:00
|
|
|
if (T1 == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-05-23 20:25:29 +00:00
|
|
|
if ((g_sounds[snd].m & SF_GLOBAL) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-05-23 20:25:29 +00:00
|
|
|
if (snd)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-05-23 20:25:29 +00:00
|
|
|
A_PlaySound(snd, whatsprite);
|
|
|
|
if (SHT && snd != SHT && SHT < MAXSOUNDS)
|
|
|
|
S_StopEnvSound(SHT,T6);
|
|
|
|
T6 = whatsprite;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2014-01-31 21:12:56 +00:00
|
|
|
|
2014-05-23 20:25:29 +00:00
|
|
|
if ((sector[SECT].lotag&0xff) != ST_22_SPLITTING_DOOR)
|
|
|
|
T1 = 1;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2014-05-23 20:25:29 +00:00
|
|
|
else if (SHT < MAXSOUNDS)
|
|
|
|
{
|
|
|
|
if (SHT)
|
|
|
|
A_PlaySound(SHT, whatsprite);
|
|
|
|
if ((g_sounds[snd].m & SF_LOOP) || (SHT && SHT != snd))
|
|
|
|
S_StopEnvSound(snd, T6);
|
|
|
|
T6 = whatsprite;
|
|
|
|
T1 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return snd;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2014-01-31 21:12:56 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-01-10 07:38:50 +00:00
|
|
|
int32_t G_CheckActivatorMotion(int32_t lotag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-10 07:38:50 +00:00
|
|
|
int32_t i = headspritestat[STAT_ACTIVATOR], j;
|
2006-04-13 20:47:06 +00:00
|
|
|
spritetype *s;
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
while (i >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (sprite[i].lotag == lotag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
s = &sprite[i];
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
for (j = g_animateCount-1; j >= 0; j--)
|
2006-11-14 21:35:50 +00:00
|
|
|
if (s->sectnum == animatesect[j])
|
|
|
|
return(1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
j = headspritestat[STAT_EFFECTOR];
|
2006-11-14 21:35:50 +00:00
|
|
|
while (j >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (s->sectnum == sprite[j].sectnum)
|
|
|
|
switch (sprite[j].lotag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_11_SWINGING_DOOR:
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_30_TWO_WAY_TRAIN:
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[j].t_data[4])
|
2006-11-16 03:02:42 +00:00
|
|
|
return(1);
|
|
|
|
break;
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_20_STRETCH_BRIDGE:
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_31_FLOOR_RISE_FALL:
|
|
|
|
case SE_32_CEILING_RISE_FALL:
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[j].t_data[0])
|
2006-11-16 03:02:42 +00:00
|
|
|
return(1);
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
j = nextspritestat[j];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
i = nextspritestat[i];
|
|
|
|
}
|
2006-11-14 21:35:50 +00:00
|
|
|
return(0);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t CheckDoorTile(int32_t dapic)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(dapic))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case DOORTILE1__STATIC:
|
|
|
|
case DOORTILE2__STATIC:
|
|
|
|
case DOORTILE3__STATIC:
|
|
|
|
case DOORTILE4__STATIC:
|
|
|
|
case DOORTILE5__STATIC:
|
|
|
|
case DOORTILE6__STATIC:
|
|
|
|
case DOORTILE7__STATIC:
|
|
|
|
case DOORTILE8__STATIC:
|
|
|
|
case DOORTILE9__STATIC:
|
|
|
|
case DOORTILE10__STATIC:
|
|
|
|
case DOORTILE11__STATIC:
|
|
|
|
case DOORTILE12__STATIC:
|
|
|
|
case DOORTILE14__STATIC:
|
|
|
|
case DOORTILE15__STATIC:
|
|
|
|
case DOORTILE16__STATIC:
|
|
|
|
case DOORTILE17__STATIC:
|
|
|
|
case DOORTILE18__STATIC:
|
|
|
|
case DOORTILE19__STATIC:
|
|
|
|
case DOORTILE20__STATIC:
|
|
|
|
case DOORTILE21__STATIC:
|
|
|
|
case DOORTILE22__STATIC:
|
|
|
|
case DOORTILE23__STATIC:
|
|
|
|
return 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t isanunderoperator(int32_t lotag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (lotag&0xff)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-09-08 22:18:44 +00:00
|
|
|
case ST_15_WARP_ELEVATOR:
|
|
|
|
case ST_16_PLATFORM_DOWN:
|
|
|
|
case ST_17_PLATFORM_UP:
|
|
|
|
case ST_18_ELEVATOR_DOWN:
|
|
|
|
case ST_19_ELEVATOR_UP:
|
2012-08-26 22:16:08 +00:00
|
|
|
case ST_22_SPLITTING_DOOR:
|
|
|
|
case ST_26_SPLITTING_ST_DOOR:
|
2006-11-16 03:02:42 +00:00
|
|
|
return 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t isanearoperator(int32_t lotag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (lotag&0xff)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-09-08 22:18:44 +00:00
|
|
|
case ST_9_SLIDING_ST_DOOR:
|
|
|
|
case ST_15_WARP_ELEVATOR:
|
|
|
|
case ST_16_PLATFORM_DOWN:
|
|
|
|
case ST_17_PLATFORM_UP:
|
|
|
|
case ST_18_ELEVATOR_DOWN:
|
|
|
|
case ST_19_ELEVATOR_UP:
|
2012-08-26 22:16:08 +00:00
|
|
|
case ST_20_CEILING_DOOR:
|
|
|
|
case ST_21_FLOOR_DOOR:
|
|
|
|
case ST_22_SPLITTING_DOOR:
|
2012-09-08 22:18:44 +00:00
|
|
|
case ST_23_SWINGING_DOOR:
|
|
|
|
case ST_25_SLIDING_DOOR:
|
2012-08-26 22:16:08 +00:00
|
|
|
case ST_26_SPLITTING_ST_DOOR:
|
|
|
|
case ST_29_TEETH_DOOR://Toothed door
|
2006-11-16 03:02:42 +00:00
|
|
|
return 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-09-02 14:04:16 +00:00
|
|
|
static inline int32_t A_FP_ManhattanDist(const DukePlayer_t *ps, const spritetype *s)
|
|
|
|
{
|
|
|
|
return klabs(ps->opos.x-s->x)
|
|
|
|
+ klabs(ps->opos.y-s->y)
|
|
|
|
+ ((klabs(ps->opos.z-s->z+(28<<8)))>>4);
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t __fastcall A_FindPlayer(const spritetype *s, int32_t *d)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-10-14 22:16:07 +00:00
|
|
|
if (!g_netServer && ud.multimode < 2)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:53 +00:00
|
|
|
DukePlayer_t *const myps = g_player[myconnectindex].ps;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2013-04-15 10:48:13 +00:00
|
|
|
if (d)
|
|
|
|
*d = A_FP_ManhattanDist(myps, s);
|
2006-04-13 20:47:06 +00:00
|
|
|
return myconnectindex;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2012-09-02 14:04:16 +00:00
|
|
|
int32_t j;
|
|
|
|
int32_t closest_player=0, closest=INT32_MAX;
|
2009-01-02 01:03:41 +00:00
|
|
|
|
2012-02-21 19:33:33 +00:00
|
|
|
for (TRAVERSE_CONNECT(j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:53 +00:00
|
|
|
DukePlayer_t *const ps = g_player[j].ps;
|
2012-09-02 14:04:16 +00:00
|
|
|
int32_t x = A_FP_ManhattanDist(ps, s);
|
2012-08-10 19:11:53 +00:00
|
|
|
|
|
|
|
if (x < closest && sprite[ps->i].extra > 0)
|
2009-01-02 01:03:41 +00:00
|
|
|
{
|
|
|
|
closest_player = j;
|
|
|
|
closest = x;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-04-15 10:48:13 +00:00
|
|
|
if (d)
|
|
|
|
*d = closest;
|
2009-01-02 01:03:41 +00:00
|
|
|
return closest_player;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
void G_DoSectorAnimations(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i, j, a, p, v, dasect;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=g_animateCount-1; i>=0; i--)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
a = *animateptr[i];
|
|
|
|
v = animatevel[i]*TICSPERFRAME;
|
|
|
|
dasect = animatesect[i];
|
|
|
|
|
|
|
|
if (a == animategoal[i])
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
G_StopInterpolation(animateptr[i]);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-09-28 11:00:59 +00:00
|
|
|
// This fixes a bug where wall or floor sprites contained in
|
|
|
|
// elevator sectors (ST 16-19) would jitter vertically after the
|
|
|
|
// elevator had stopped.
|
2008-09-26 09:48:35 +00:00
|
|
|
if (animateptr[i] == §or[animatesect[i]].floorz)
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=headspritesect[dasect]; j>=0; j=nextspritesect[j])
|
2011-08-18 22:01:01 +00:00
|
|
|
if (sprite[j].statnum != STAT_EFFECTOR)
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[j].bpos.z = sprite[j].z;
|
2008-09-26 09:48:35 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
g_animateCount--;
|
|
|
|
animateptr[i] = animateptr[g_animateCount];
|
|
|
|
animategoal[i] = animategoal[g_animateCount];
|
|
|
|
animatevel[i] = animatevel[g_animateCount];
|
|
|
|
animatesect[i] = animatesect[g_animateCount];
|
2012-09-08 22:18:44 +00:00
|
|
|
if (sector[animatesect[i]].lotag == ST_18_ELEVATOR_DOWN || sector[animatesect[i]].lotag == ST_19_ELEVATOR_UP)
|
2006-11-13 23:12:47 +00:00
|
|
|
if (animateptr[i] == §or[animatesect[i]].ceilingz)
|
2006-04-13 20:47:06 +00:00
|
|
|
continue;
|
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
if ((sector[dasect].lotag&0xff) != ST_22_SPLITTING_DOOR)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(dasect,-1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
if (v > 0)
|
2014-01-31 21:12:56 +00:00
|
|
|
a = min(a+v, animategoal[i]);
|
2006-11-15 01:16:55 +00:00
|
|
|
else
|
2014-01-31 21:12:56 +00:00
|
|
|
a = max(a+v, animategoal[i]);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (animateptr[i] == §or[animatesect[i]].floorz)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-02-21 19:33:33 +00:00
|
|
|
for (TRAVERSE_CONNECT(p))
|
|
|
|
if (g_player[p].ps->cursectnum == dasect)
|
|
|
|
if ((sector[dasect].floorz-g_player[p].ps->pos.z) < (64<<8))
|
|
|
|
if (sprite[g_player[p].ps->i].owner >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-02-21 19:33:33 +00:00
|
|
|
g_player[p].ps->pos.z += v;
|
|
|
|
g_player[p].ps->vel.z = 0;
|
|
|
|
if (p == myconnectindex)
|
|
|
|
{
|
|
|
|
my.z += v;
|
|
|
|
myvel.z = 0;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=headspritesect[dasect]; j>=0; j=nextspritesect[j])
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sprite[j].statnum != STAT_EFFECTOR)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[j].bpos.z = sprite[j].z;
|
2006-04-13 20:47:06 +00:00
|
|
|
sprite[j].z += v;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].floorz = sector[dasect].floorz+v;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*animateptr[i] = a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-21 18:43:39 +00:00
|
|
|
int32_t GetAnimationGoal(const int32_t *animptr)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-10-25 03:36:34 +00:00
|
|
|
int32_t i=0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
for (; i<g_animateCount; i++)
|
2011-12-21 18:43:39 +00:00
|
|
|
if (animptr == animateptr[i])
|
2010-07-26 22:36:45 +00:00
|
|
|
return i;
|
|
|
|
return -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t SetAnimation(int32_t animsect,int32_t *animptr, int32_t thegoal, int32_t thevel)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i = 0, j = g_animateCount;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2011-12-21 18:43:39 +00:00
|
|
|
if (g_animateCount >= MAXANIMATES)
|
2014-01-31 21:12:55 +00:00
|
|
|
return -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (; i<g_animateCount; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
if (animptr == animateptr[i])
|
|
|
|
{
|
|
|
|
j = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
animatesect[j] = animsect;
|
|
|
|
animateptr[j] = animptr;
|
|
|
|
animategoal[j] = thegoal;
|
2009-08-28 23:08:00 +00:00
|
|
|
animatevel[j] = (thegoal >= *animptr) ? thevel : -thevel;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:55 +00:00
|
|
|
if (j == g_animateCount)
|
|
|
|
g_animateCount++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
G_SetInterpolation(animptr);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:55 +00:00
|
|
|
return j;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2014-12-27 17:17:52 +00:00
|
|
|
static void G_SetupCamTile(int32_t i, int32_t wn, int32_t smoothratio)
|
2014-10-25 03:35:21 +00:00
|
|
|
{
|
2014-12-27 17:17:52 +00:00
|
|
|
vec3_t cam = G_GetCameraPosition(i, smoothratio);
|
|
|
|
|
2014-12-21 15:51:48 +00:00
|
|
|
const int32_t mir = display_mirror;
|
2014-10-25 03:35:21 +00:00
|
|
|
//if (waloff[wn] == 0) loadtile(wn);
|
|
|
|
setviewtotile(wn, tilesiz[wn].y, tilesiz[wn].x);
|
|
|
|
|
|
|
|
yax_preparedrawrooms();
|
2014-12-27 17:17:52 +00:00
|
|
|
drawrooms(cam.x, cam.y, cam.z, SA, 100+sprite[i].shade, SECT);
|
|
|
|
yax_drawrooms(G_DoSpriteAnimations, SECT, 0, smoothratio);
|
2014-10-25 03:35:21 +00:00
|
|
|
|
|
|
|
display_mirror = 3;
|
2014-12-27 17:17:52 +00:00
|
|
|
G_DoSpriteAnimations(cam.x, cam.y, SA, smoothratio);
|
2014-10-25 03:35:21 +00:00
|
|
|
display_mirror = mir;
|
|
|
|
drawmasks();
|
|
|
|
|
|
|
|
setviewback();
|
|
|
|
squarerotatetile(wn);
|
|
|
|
invalidatetile(wn, -1, 255);
|
|
|
|
}
|
|
|
|
|
2014-12-27 17:17:52 +00:00
|
|
|
void G_AnimateCamSprite(int32_t smoothratio)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-12-21 15:51:48 +00:00
|
|
|
const int32_t i = g_curViewscreen;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-02-12 13:47:33 +00:00
|
|
|
#ifdef DEBUG_VALGRIND_NO_SMC
|
|
|
|
return;
|
|
|
|
#endif
|
2013-12-26 19:45:12 +00:00
|
|
|
if (g_curViewscreen < 0)
|
2012-05-26 21:58:21 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-04-17 20:00:24 +00:00
|
|
|
if (totalclock >= T1 + ud.camera_time)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-12-21 15:51:48 +00:00
|
|
|
const DukePlayer_t *const ps = g_player[screenpeek].ps;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-26 19:45:12 +00:00
|
|
|
if (ps->newowner >= 0)
|
|
|
|
OW = ps->newowner;
|
2014-10-25 03:35:21 +00:00
|
|
|
|
2014-12-21 15:51:48 +00:00
|
|
|
if (OW >= 0 && dist(&sprite[ps->i], &sprite[i]) < VIEWSCREEN_ACTIVE_DISTANCE)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2015-07-25 17:23:22 +00:00
|
|
|
const int viewscrShift = G_GetViewscreenSizeShift((const tspritetype *)&sprite[i]);
|
|
|
|
const int viewscrTile = TILE_VIEWSCR-viewscrShift;
|
|
|
|
|
|
|
|
if (waloff[viewscrTile] == 0)
|
|
|
|
allocatepermanenttile(viewscrTile, tilesiz[PN].x<<viewscrShift, tilesiz[PN].y<<viewscrShift);
|
2013-12-26 19:45:12 +00:00
|
|
|
else
|
2015-07-25 17:23:22 +00:00
|
|
|
walock[viewscrTile] = 255;
|
2013-12-26 19:45:12 +00:00
|
|
|
|
2015-07-25 17:23:22 +00:00
|
|
|
G_SetupCamTile(OW, viewscrTile, smoothratio);
|
2011-09-15 17:03:08 +00:00
|
|
|
#ifdef POLYMER
|
2014-02-08 14:37:52 +00:00
|
|
|
// Force texture update on viewscreen sprite in Polymer!
|
2013-05-17 03:44:09 +00:00
|
|
|
if (getrendermode() == REND_POLYMER)
|
2014-02-08 14:37:52 +00:00
|
|
|
polymer_invalidatesprite(i);
|
2011-09-15 17:03:08 +00:00
|
|
|
#endif
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2014-04-17 20:00:24 +00:00
|
|
|
|
|
|
|
T1 = totalclock;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
void G_AnimateWalls(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
int32_t p = g_numAnimWalls-1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (; p>=0; p--)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
const int32_t i = animwall[p].wallnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:58 +00:00
|
|
|
switch (DYNAMICTILEMAP(wall[i].picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case SCREENBREAK1__STATIC:
|
|
|
|
case SCREENBREAK2__STATIC:
|
|
|
|
case SCREENBREAK3__STATIC:
|
|
|
|
case SCREENBREAK4__STATIC:
|
|
|
|
case SCREENBREAK5__STATIC:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case SCREENBREAK9__STATIC:
|
|
|
|
case SCREENBREAK10__STATIC:
|
|
|
|
case SCREENBREAK11__STATIC:
|
|
|
|
case SCREENBREAK12__STATIC:
|
|
|
|
case SCREENBREAK13__STATIC:
|
|
|
|
case SCREENBREAK14__STATIC:
|
|
|
|
case SCREENBREAK15__STATIC:
|
|
|
|
case SCREENBREAK16__STATIC:
|
|
|
|
case SCREENBREAK17__STATIC:
|
|
|
|
case SCREENBREAK18__STATIC:
|
|
|
|
case SCREENBREAK19__STATIC:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if ((krand()&255) < 16)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
animwall[p].tag = wall[i].picnum;
|
|
|
|
wall[i].picnum = SCREENBREAK6;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case SCREENBREAK6__STATIC:
|
|
|
|
case SCREENBREAK7__STATIC:
|
|
|
|
case SCREENBREAK8__STATIC:
|
|
|
|
|
|
|
|
if (animwall[p].tag >= 0 && wall[i].extra != FEMPIC2 && wall[i].extra != FEMPIC3)
|
|
|
|
wall[i].picnum = animwall[p].tag;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wall[i].picnum++;
|
|
|
|
if (wall[i].picnum == (SCREENBREAK6+3))
|
|
|
|
wall[i].picnum = SCREENBREAK6;
|
|
|
|
}
|
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-12-26 19:45:14 +00:00
|
|
|
if ((wall[i].cstat&16) && G_GetForcefieldPicnum(i)==W_FORCEFIELD)
|
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
const int32_t t = animwall[p].tag;
|
2013-12-26 19:45:14 +00:00
|
|
|
|
|
|
|
if (wall[i].cstat&254)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-26 19:45:14 +00:00
|
|
|
wall[i].xpanning -= t>>10; // sintable[(t+512)&2047]>>12;
|
|
|
|
wall[i].ypanning -= t>>10; // sintable[t&2047]>>12;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-26 19:45:14 +00:00
|
|
|
if (wall[i].extra == 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-26 19:45:14 +00:00
|
|
|
wall[i].extra = 0;
|
|
|
|
animwall[p].tag = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2013-12-26 19:45:14 +00:00
|
|
|
else
|
|
|
|
animwall[p].tag+=128;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-26 19:45:14 +00:00
|
|
|
if (animwall[p].tag < (128<<4))
|
|
|
|
{
|
|
|
|
if (animwall[p].tag&128)
|
|
|
|
wall[i].overpicnum = W_FORCEFIELD;
|
|
|
|
else wall[i].overpicnum = W_FORCEFIELD+1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((krand()&255) < 32)
|
|
|
|
animwall[p].tag = 128<<(krand()&3);
|
|
|
|
else wall[i].overpicnum = W_FORCEFIELD+1;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2013-12-26 19:45:14 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-26 19:45:14 +00:00
|
|
|
int32_t G_ActivateWarpElevators(int32_t s, int32_t d) //Parm = sectoreffectornum
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
int32_t i;
|
|
|
|
const int32_t sn = sprite[s].sectnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, i))
|
2012-09-08 22:18:44 +00:00
|
|
|
if (SLT == SE_17_WARP_ELEVATOR && SHT == sprite[s].hitag)
|
2014-01-31 21:12:56 +00:00
|
|
|
{
|
|
|
|
if (klabs(sector[sn].floorz - actor[s].t_data[2]) > SP ||
|
|
|
|
sector[SECT].hitag == sector[sn].hitag - d)
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
break;
|
2014-01-31 21:12:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
if (i == -1)
|
2006-04-13 20:47:06 +00:00
|
|
|
return 1; // No find
|
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
A_PlaySound(d ? ELEVATOR_ON : ELEVATOR_OFF, s);
|
|
|
|
|
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, i))
|
2012-09-08 22:18:44 +00:00
|
|
|
if (SLT == SE_17_WARP_ELEVATOR && SHT == sprite[s].hitag)
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
T1 = T2 = d; //Make all check warp
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-06-07 09:03:16 +00:00
|
|
|
void G_OperateSectors(int32_t sn, int32_t ii)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
int32_t j=0, l;
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i;
|
2014-01-31 21:12:56 +00:00
|
|
|
sectortype *const sptr = §or[sn];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (sptr->lotag&(0xffff-49152))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-26 22:16:08 +00:00
|
|
|
case ST_30_ROTATE_RISE_BRIDGE:
|
2006-11-16 03:02:42 +00:00
|
|
|
j = sector[sn].hitag;
|
2014-01-31 21:12:56 +00:00
|
|
|
|
|
|
|
if (E_SpriteIsValid(j))
|
|
|
|
{
|
|
|
|
if (actor[j].tempang == 0 || actor[j].tempang == 256)
|
|
|
|
A_CallSound(sn,ii);
|
|
|
|
sprite[j].extra = (sprite[j].extra == 1) ? 3 : 1;
|
|
|
|
}
|
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 ST_31_TWO_WAY_TRAIN:
|
2006-11-16 03:02:42 +00:00
|
|
|
j = sector[sn].hitag;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
if (E_SpriteIsValid(j))
|
|
|
|
{
|
|
|
|
if (actor[j].t_data[4] == 0)
|
|
|
|
actor[j].t_data[4] = 1;
|
|
|
|
|
|
|
|
A_CallSound(sn,ii);
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-11-13 23:12:47 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case ST_26_SPLITTING_ST_DOOR: //The split doors
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
if (GetAnimationGoal(&sptr->ceilingz) == -1) //if the door has stopped
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2009-01-10 07:38:50 +00:00
|
|
|
g_haltSoundHack = 1;
|
2006-11-16 03:02:42 +00:00
|
|
|
sptr->lotag &= 0xff00;
|
2012-09-08 22:18:44 +00:00
|
|
|
sptr->lotag |= ST_22_SPLITTING_DOOR;
|
2008-11-20 14:06:36 +00:00
|
|
|
G_OperateSectors(sn,ii);
|
2006-11-16 03:02:42 +00:00
|
|
|
sptr->lotag &= 0xff00;
|
2012-09-08 22:18:44 +00:00
|
|
|
sptr->lotag |= ST_9_SLIDING_ST_DOOR;
|
2008-11-20 14:06:36 +00:00
|
|
|
G_OperateSectors(sn,ii);
|
2006-11-16 03:02:42 +00:00
|
|
|
sptr->lotag &= 0xff00;
|
2012-09-08 22:18:44 +00:00
|
|
|
sptr->lotag |= ST_26_SPLITTING_ST_DOOR;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case ST_9_SLIDING_ST_DOOR:
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
int32_t dax, day;
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t wallfind[2];
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
const int32_t startwall = sptr->wallptr;
|
|
|
|
const int32_t endwall = startwall+sptr->wallnum-1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
const int32_t sp = sptr->extra>>4;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
//first find center point by averaging all points
|
2014-01-31 21:12:56 +00:00
|
|
|
dax = 0, day = 0;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=startwall; i<=endwall; i++)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
dax += wall[i].x;
|
|
|
|
day += wall[i].y;
|
|
|
|
}
|
2014-10-25 03:29:21 +00:00
|
|
|
|
|
|
|
dax = tabledivide32_noinline(dax, (endwall-startwall+1));
|
|
|
|
day = tabledivide32_noinline(day, (endwall-startwall+1));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
//find any points with either same x or same y coordinate
|
|
|
|
// as center (dax, day) - should be 2 points found.
|
|
|
|
wallfind[0] = -1;
|
|
|
|
wallfind[1] = -1;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=startwall; i<=endwall; i++)
|
2014-01-31 21:12:56 +00:00
|
|
|
if (wall[i].x == dax || wall[i].y == day)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wallfind[0] == -1)
|
|
|
|
wallfind[0] = i;
|
|
|
|
else wallfind[1] = i;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-12-20 18:31:24 +00:00
|
|
|
if (wallfind[1] == -1)
|
|
|
|
return;
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=0; j<2; j++)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
const int32_t wf = wallfind[j];
|
|
|
|
int32_t dax2, day2;
|
|
|
|
|
|
|
|
i = wf-1;
|
|
|
|
if (i < startwall) i = endwall;
|
|
|
|
dax2 = ((wall[i].x+wall[wall[wf].point2].x)>>1) - wall[wf].x;
|
|
|
|
day2 = ((wall[i].y+wall[wall[wf].point2].y)>>1) - wall[wf].y;
|
|
|
|
|
|
|
|
if (wall[wf].x == dax && wall[wf].y == day)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
//find what direction door should open by averaging the
|
|
|
|
// 2 neighboring points of wallfind[0] & wallfind[1].
|
|
|
|
if (dax2 != 0)
|
2006-11-13 23:12:47 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
dax2 = wall[wall[wall[wf].point2].point2].x;
|
|
|
|
dax2 -= wall[wall[wf].point2].x;
|
|
|
|
SetAnimation(sn,&wall[wf].x,wall[wf].x+dax2,sp);
|
2008-11-20 14:06:36 +00:00
|
|
|
SetAnimation(sn,&wall[i].x,wall[i].x+dax2,sp);
|
2014-01-31 21:12:56 +00:00
|
|
|
SetAnimation(sn,&wall[wall[wf].point2].x,wall[wall[wf].point2].x+dax2,sp);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(sn,ii);
|
2006-11-13 23:12:47 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else if (day2 != 0)
|
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
day2 = wall[wall[wall[wf].point2].point2].y;
|
|
|
|
day2 -= wall[wall[wf].point2].y;
|
|
|
|
SetAnimation(sn,&wall[wf].y,wall[wf].y+day2,sp);
|
2008-11-20 14:06:36 +00:00
|
|
|
SetAnimation(sn,&wall[i].y,wall[i].y+day2,sp);
|
2014-01-31 21:12:56 +00:00
|
|
|
SetAnimation(sn,&wall[wall[wf].point2].y,wall[wall[wf].point2].y+day2,sp);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(sn,ii);
|
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 (dax2 != 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
SetAnimation(sn,&wall[wf].x,dax,sp);
|
2008-11-20 14:06:36 +00:00
|
|
|
SetAnimation(sn,&wall[i].x,dax+dax2,sp);
|
2014-01-31 21:12:56 +00:00
|
|
|
SetAnimation(sn,&wall[wall[wf].point2].x,dax+dax2,sp);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(sn,ii);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
else if (day2 != 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
SetAnimation(sn,&wall[wf].y,day,sp);
|
2008-11-20 14:06:36 +00:00
|
|
|
SetAnimation(sn,&wall[i].y,day+day2,sp);
|
2014-01-31 21:12:56 +00:00
|
|
|
SetAnimation(sn,&wall[wall[wf].point2].y,day+day2,sp);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(sn,ii);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case ST_15_WARP_ELEVATOR://Warping elevators
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:55 +00:00
|
|
|
if (sprite[ii].picnum != APLAYER)
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF_SECT(sn, i))
|
|
|
|
if (PN==SECTOREFFECTOR && SLT == SE_17_WARP_ELEVATOR)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (i < 0)
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[ii].sectnum == sn)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (G_ActivateWarpElevators(i,-1))
|
|
|
|
G_ActivateWarpElevators(i,1);
|
|
|
|
else if (G_ActivateWarpElevators(i,1))
|
|
|
|
G_ActivateWarpElevators(i,-1);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sptr->floorz > SZ)
|
2008-11-20 14:06:36 +00:00
|
|
|
G_ActivateWarpElevators(i,-1);
|
2006-11-16 03:02:42 +00:00
|
|
|
else
|
2008-11-20 14:06:36 +00:00
|
|
|
G_ActivateWarpElevators(i,1);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case ST_16_PLATFORM_DOWN:
|
|
|
|
case ST_17_PLATFORM_UP:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
i = GetAnimationGoal(&sptr->floorz);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (i == -1)
|
|
|
|
{
|
|
|
|
i = nextsectorneighborz(sn,sptr->floorz,1,1);
|
2006-11-14 21:35:50 +00:00
|
|
|
if (i == -1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
i = nextsectorneighborz(sn,sptr->floorz,1,-1);
|
|
|
|
if (i == -1) return;
|
|
|
|
j = sector[i].floorz;
|
2008-11-20 14:06:36 +00:00
|
|
|
SetAnimation(sn,&sptr->floorz,j,sptr->extra);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
j = sector[i].floorz;
|
2008-11-20 14:06:36 +00:00
|
|
|
SetAnimation(sn,&sptr->floorz,j,sptr->extra);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(sn,ii);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case ST_18_ELEVATOR_DOWN:
|
|
|
|
case ST_19_ELEVATOR_UP:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
i = GetAnimationGoal(&sptr->floorz);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (i==-1)
|
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
int32_t q;
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
i = nextsectorneighborz(sn,sptr->floorz,1,-1);
|
|
|
|
if (i==-1) i = nextsectorneighborz(sn,sptr->floorz,1,1);
|
|
|
|
if (i==-1) return;
|
|
|
|
j = sector[i].floorz;
|
|
|
|
q = sptr->extra;
|
|
|
|
l = sptr->ceilingz-sptr->floorz;
|
2008-11-20 14:06:36 +00:00
|
|
|
SetAnimation(sn,&sptr->floorz,j,q);
|
|
|
|
SetAnimation(sn,&sptr->ceilingz,j+l,q);
|
|
|
|
A_CallSound(sn,ii);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case ST_29_TEETH_DOOR:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, i))
|
|
|
|
if (SLT == SE_22_TEETH_DOOR && SHT == sptr->hitag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sector[SECT].extra = -sector[SECT].extra;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
T1 = sn;
|
|
|
|
T2 = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2010-06-07 09:03:16 +00:00
|
|
|
A_CallSound(sn, ii);
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sptr->lotag ^= 0x8000;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-06-07 09:03:16 +00:00
|
|
|
if (sptr->lotag&0x8000)
|
|
|
|
{
|
|
|
|
j = nextsectorneighborz(sn,sptr->ceilingz,-1,-1);
|
|
|
|
if (j == -1) j = nextsectorneighborz(sn,sptr->ceilingz,1,1);
|
|
|
|
if (j == -1)
|
|
|
|
{
|
|
|
|
OSD_Printf("WARNING: ST29: null sector!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
j = sector[j].ceilingz;
|
|
|
|
}
|
|
|
|
else
|
2010-08-02 08:13:51 +00:00
|
|
|
{
|
2010-06-07 09:03:16 +00:00
|
|
|
j = nextsectorneighborz(sn,sptr->ceilingz,1,1);
|
|
|
|
if (j == -1) j = nextsectorneighborz(sn,sptr->ceilingz,-1,-1);
|
|
|
|
if (j == -1)
|
|
|
|
{
|
|
|
|
OSD_Printf("WARNING: ST29: null sector!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
j = sector[j].floorz;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-06-07 09:03:16 +00:00
|
|
|
SetAnimation(sn,&sptr->ceilingz,j,sptr->extra);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case ST_20_CEILING_DOOR:
|
2006-04-13 20:47:06 +00:00
|
|
|
REDODOOR:
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sptr->lotag&0x8000)
|
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF_SECT(sn, i))
|
2012-09-08 22:18:44 +00:00
|
|
|
if (sprite[i].statnum == STAT_EFFECTOR && SLT==SE_9_DOWN_OPEN_DOOR_LIGHTS)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
j = SZ;
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2014-01-31 21:12:56 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (i==-1)
|
|
|
|
j = sptr->floorz;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
j = nextsectorneighborz(sn,sptr->ceilingz,-1,-1);
|
|
|
|
|
|
|
|
if (j >= 0) j = sector[j].ceilingz;
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sptr->lotag |= 32768;
|
|
|
|
goto REDODOOR;
|
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
|
|
|
sptr->lotag ^= 0x8000;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
SetAnimation(sn,&sptr->ceilingz,j,sptr->extra);
|
|
|
|
A_CallSound(sn,ii);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case ST_21_FLOOR_DOOR:
|
2008-11-20 14:06:36 +00:00
|
|
|
i = GetAnimationGoal(&sptr->floorz);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (i >= 0)
|
|
|
|
{
|
|
|
|
if (animategoal[sn] == sptr->ceilingz)
|
|
|
|
animategoal[i] = sector[nextsectorneighborz(sn,sptr->ceilingz,1,1)].floorz;
|
|
|
|
else animategoal[i] = sptr->ceilingz;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sptr->ceilingz == sptr->floorz)
|
|
|
|
j = sector[nextsectorneighborz(sn,sptr->ceilingz,1,1)].floorz;
|
|
|
|
else j = sptr->ceilingz;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sptr->lotag ^= 0x8000;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (SetAnimation(sn,&sptr->floorz,j,sptr->extra) >= 0)
|
|
|
|
A_CallSound(sn,ii);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case ST_22_SPLITTING_DOOR:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
if (sptr->lotag&0x8000)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
int32_t q = (sptr->ceilingz+sptr->floorz)>>1;
|
|
|
|
j = SetAnimation(sn, &sptr->floorz, q, sptr->extra);
|
|
|
|
j = SetAnimation(sn, &sptr->ceilingz, q, sptr->extra);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
int32_t fneigh = nextsectorneighborz(sn, sptr->floorz, 1, 1);
|
|
|
|
int32_t cneigh = nextsectorneighborz(sn, sptr->ceilingz, -1, -1);
|
2010-12-17 14:22:15 +00:00
|
|
|
|
|
|
|
if (fneigh>=0 && cneigh>=0)
|
|
|
|
{
|
|
|
|
j = SetAnimation(sn, &sptr->floorz, sector[fneigh].floorz, sptr->extra);
|
|
|
|
j = SetAnimation(sn, &sptr->ceilingz, sector[cneigh].ceilingz, sptr->extra);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OSD_Printf("WARNING: ST22: null sector: floor neighbor=%d, ceiling neighbor=%d!\n",
|
|
|
|
fneigh, cneigh);
|
|
|
|
sptr->lotag ^= 0x8000;
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sptr->lotag ^= 0x8000;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(sn,ii);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case ST_23_SWINGING_DOOR: //Swingdoor
|
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
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, i))
|
2012-09-08 22:18:44 +00:00
|
|
|
if (SLT == SE_11_SWINGING_DOOR && SECT == sn && !T5)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
j = i;
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2014-01-31 21:12:56 +00:00
|
|
|
|
|
|
|
if (i < 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
OSD_Printf("WARNING: SE23 i<0!\n");
|
|
|
|
return;
|
|
|
|
} // JBF
|
2014-01-31 21:12:56 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
l = sector[SECT].lotag&0x8000;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j >= 0)
|
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
int32_t playedsnd = 0;
|
|
|
|
|
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, i))
|
2012-09-08 22:18:44 +00:00
|
|
|
if (l == (sector[SECT].lotag&0x8000) && SLT == SE_11_SWINGING_DOOR && sprite[j].hitag == SHT && !T5)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sector[SECT].lotag&0x8000) sector[SECT].lotag &= 0x7fff;
|
|
|
|
else sector[SECT].lotag |= 0x8000;
|
2014-01-31 21:12:56 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
T5 = 1;
|
|
|
|
T4 = -T4;
|
2014-01-31 21:12:56 +00:00
|
|
|
|
|
|
|
if (!playedsnd)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(sn,i);
|
2014-01-31 21:12:56 +00:00
|
|
|
playedsnd = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case ST_25_SLIDING_DOOR: //Subway type sliding doors
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, j))
|
|
|
|
if (sprite[j].lotag == SE_15_SLIDING_DOOR && sprite[j].sectnum == sn)
|
2006-11-16 03:02:42 +00:00
|
|
|
break; //Found the sectoreffector.
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j < 0)
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, i))
|
2006-11-16 03:02:42 +00:00
|
|
|
if (SHT==sprite[j].hitag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-09-08 22:18:44 +00:00
|
|
|
if (SLT == SE_15_SLIDING_DOOR)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sector[SECT].lotag ^= 0x8000; // Toggle the open or close
|
|
|
|
SA += 1024;
|
2014-01-31 21:12:56 +00:00
|
|
|
|
|
|
|
if (T5)
|
|
|
|
A_CallSound(SECT,i);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(SECT,i);
|
2014-01-31 21:12:56 +00:00
|
|
|
|
|
|
|
T5 = (sector[SECT].lotag&0x8000) ? 1 : 2;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2014-01-31 21:12:56 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-08 22:18:44 +00:00
|
|
|
case ST_27_STRETCH_BRIDGE: //Extended bridge
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, j))
|
2012-09-08 22:18:44 +00:00
|
|
|
if ((sprite[j].lotag&0xff)==SE_20_STRETCH_BRIDGE && sprite[j].sectnum == sn) //Bridge
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sector[sn].lotag ^= 0x8000;
|
2014-01-31 21:12:56 +00:00
|
|
|
// Highest bit now set means we're opening.
|
|
|
|
|
|
|
|
actor[j].t_data[0] = (sector[sn].lotag&0x8000) ? 1 : 2;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(sn,ii);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case ST_28_DROP_FLOOR:
|
2006-11-16 03:02:42 +00:00
|
|
|
//activate the rest of them
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF_SECT(sn, j))
|
2012-08-26 22:16:08 +00:00
|
|
|
if (sprite[j].statnum==STAT_EFFECTOR && (sprite[j].lotag&0xff)==SE_21_DROP_FLOOR)
|
2014-01-31 21:12:56 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-02-21 19:32:55 +00:00
|
|
|
if (j >= 0) // PK: The matching SE21 might have gone, see SE_21_KILLIT in actors.c
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-02-21 19:32:55 +00:00
|
|
|
j = sprite[j].hitag;
|
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, l))
|
2012-02-21 19:32:55 +00:00
|
|
|
{
|
2012-08-26 22:16:08 +00:00
|
|
|
if ((sprite[l].lotag&0xff)==SE_21_DROP_FLOOR && !actor[l].t_data[0] &&
|
2014-01-31 21:12:56 +00:00
|
|
|
sprite[l].hitag == j)
|
2012-02-21 19:32:55 +00:00
|
|
|
actor[l].t_data[0] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
A_CallSound(sn,ii);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void G_OperateRespawns(int32_t low)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-29 18:32:51 +00:00
|
|
|
int32_t i, nexti;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-29 18:32:51 +00:00
|
|
|
for (SPRITES_OF_STAT_SAFE(STAT_FX, i, nexti))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-29 18:32:51 +00:00
|
|
|
spritetype *respr = &sprite[i];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-29 18:32:51 +00:00
|
|
|
if (respr->lotag == low && respr->picnum == RESPAWN)
|
|
|
|
{
|
|
|
|
if (!ud.monsters_off || !A_CheckEnemyTile(respr->hitag))
|
|
|
|
{
|
|
|
|
int32_t j = A_Spawn(i, TRANSPORTERSTAR);
|
|
|
|
sprite[j].z -= (32<<8);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-29 18:32:51 +00:00
|
|
|
// Just a way to killit (see G_MoveFX(): RESPAWN__STATIC)
|
|
|
|
respr->extra = 66-12;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-31 21:12:55 +00:00
|
|
|
void G_OperateActivators(int32_t low, int32_t snum)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
int32_t i, nexti, j, k;
|
2006-04-13 20:47:06 +00:00
|
|
|
walltype *wal;
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=g_numCyclers-1; i>=0; i--)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
int16_t *const p = &cyclers[i][0];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p[4] == low)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
p[5] = !p[5];
|
|
|
|
|
|
|
|
sector[p[0]].floorshade = sector[p[0]].ceilingshade = p[3];
|
|
|
|
wal = &wall[sector[p[0]].wallptr];
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=sector[p[0]].wallnum; j > 0; j--,wal++)
|
2006-04-13 20:47:06 +00:00
|
|
|
wal->shade = p[3];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
k = -1;
|
2009-08-28 23:08:00 +00:00
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF_STAT_SAFE(STAT_ACTIVATOR, i, nexti))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (sprite[i].lotag == low)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (sprite[i].picnum == ACTIVATORLOCKED)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
sector[SECT].lotag ^= 16384;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-31 06:18:56 +00:00
|
|
|
if (snum >= 0 && snum < ud.multimode)
|
2014-01-31 21:12:56 +00:00
|
|
|
P_DoQuote((sector[SECT].lotag&16384) ? QUOTE_LOCKED : QUOTE_UNLOCKED,
|
|
|
|
g_player[snum].ps);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (SHT)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case 1:
|
|
|
|
if (sector[SECT].floorz != sector[SECT].ceilingz)
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (sector[SECT].floorz == sector[SECT].ceilingz)
|
|
|
|
continue;
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
// ST_2_UNDERWATER
|
2006-11-14 21:35:50 +00:00
|
|
|
if (sector[sprite[i].sectnum].lotag < 3)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF_SECT(sprite[i].sectnum, j))
|
|
|
|
if (sprite[j].statnum == STAT_EFFECTOR)
|
|
|
|
switch (sprite[j].lotag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_36_PROJ_SHOOTER:
|
|
|
|
case SE_31_FLOOR_RISE_FALL:
|
|
|
|
case SE_32_CEILING_RISE_FALL:
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].t_data[0] = 1-actor[j].t_data[0];
|
2008-11-20 14:06:36 +00:00
|
|
|
A_CallSound(SECT,j);
|
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
|
|
|
if (k == -1 && (sector[SECT].lotag&0xff) == ST_22_SPLITTING_DOOR)
|
2008-11-20 14:06:36 +00:00
|
|
|
k = A_CallSound(SECT,i);
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
G_OperateRespawns(low);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void G_OperateMasterSwitches(int32_t low)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
int32_t i;
|
|
|
|
|
|
|
|
for (SPRITES_OF(STAT_STANDABLE, i))
|
2006-11-14 21:35:50 +00:00
|
|
|
if (PN == MASTERSWITCH && SLT == low && SP == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
SP = 1;
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void G_OperateForceFields(int32_t s, int32_t low)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
int32_t p=g_numAnimWalls;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (; p>=0; p--)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
const int32_t i = animwall[p].wallnum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (low == wall[i].lotag || low == -1)
|
2013-12-26 19:45:14 +00:00
|
|
|
if (G_GetForcefieldPicnum(i) == W_FORCEFIELD
|
2011-08-18 22:01:01 +00:00
|
|
|
|| (wall[i].overpicnum == BIGFORCE))
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-04-13 20:47:06 +00:00
|
|
|
animwall[p].tag = 0;
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (wall[i].cstat)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-26 19:45:14 +00:00
|
|
|
wall[i].cstat = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
if (s >= 0 && sprite[s].picnum == SECTOREFFECTOR && sprite[s].lotag == SE_30_TWO_WAY_TRAIN)
|
2006-04-13 20:47:06 +00:00
|
|
|
wall[i].lotag = 0;
|
|
|
|
}
|
|
|
|
else
|
2013-12-26 19:45:14 +00:00
|
|
|
wall[i].cstat = FORCEFIELD_CSTAT;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-31 21:12:58 +00:00
|
|
|
// List of switches that function like dip (combination lock) switches.
|
|
|
|
#define DIPSWITCH_LIKE_CASES \
|
|
|
|
DIPSWITCH__STATIC: \
|
|
|
|
case TECHSWITCH__STATIC: \
|
|
|
|
case ALIENSWITCH__STATIC
|
|
|
|
|
|
|
|
// List of access switches.
|
|
|
|
#define ACCESSSWITCH_CASES \
|
|
|
|
ACCESSSWITCH__STATIC: \
|
|
|
|
case ACCESSSWITCH2__STATIC
|
|
|
|
|
|
|
|
// List of switches that don't fit the two preceding categories, and are not
|
|
|
|
// the MULTISWITCH. 13 cases.
|
|
|
|
#define REST_SWITCH_CASES \
|
|
|
|
DIPSWITCH2__STATIC: \
|
|
|
|
case DIPSWITCH3__STATIC: \
|
|
|
|
case FRANKENSTINESWITCH__STATIC: \
|
|
|
|
case HANDSWITCH__STATIC: \
|
|
|
|
case LIGHTSWITCH2__STATIC: \
|
|
|
|
case LIGHTSWITCH__STATIC: \
|
|
|
|
case LOCKSWITCH1__STATIC: \
|
|
|
|
case POWERSWITCH1__STATIC: \
|
|
|
|
case POWERSWITCH2__STATIC: \
|
|
|
|
case PULLSWITCH__STATIC: \
|
|
|
|
case SLOTDOOR__STATIC: \
|
|
|
|
case SPACEDOORSWITCH__STATIC: \
|
|
|
|
case SPACELIGHTSWITCH__STATIC
|
|
|
|
|
|
|
|
// Returns:
|
|
|
|
// 0: is not a dipswitch-like switch
|
|
|
|
// 1: is one, off
|
|
|
|
// 2: is one, on
|
|
|
|
static int32_t G_IsLikeDipswitch(int32_t picnum)
|
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
|
|
|
|
for (i=0; i<2; i++)
|
|
|
|
if (picnum == DIPSWITCH+i || picnum == TECHSWITCH+i || picnum == ALIENSWITCH+i)
|
|
|
|
return 1+i;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get base (unpressed) tile number for switch.
|
|
|
|
static int32_t G_GetBaseSwitch(int32_t picnum)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
if (picnum==DIPSWITCH+1
|
|
|
|
|| picnum==TECHSWITCH+1
|
|
|
|
|| picnum==ALIENSWITCH+1
|
|
|
|
|| picnum==DIPSWITCH2+1
|
|
|
|
|| picnum==DIPSWITCH3+1
|
|
|
|
|| picnum==PULLSWITCH+1
|
|
|
|
|| picnum==HANDSWITCH+1
|
|
|
|
|| picnum==SLOTDOOR+1
|
|
|
|
|| picnum==LIGHTSWITCH+1
|
|
|
|
|| picnum==SPACELIGHTSWITCH+1
|
|
|
|
|| picnum==SPACEDOORSWITCH+1
|
|
|
|
|| picnum==FRANKENSTINESWITCH+1
|
|
|
|
|| picnum==LIGHTSWITCH2+1
|
|
|
|
|| picnum==POWERSWITCH1+1
|
|
|
|
|| picnum==LOCKSWITCH1+1
|
|
|
|
|| picnum==POWERSWITCH2+1
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return picnum-1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (picnum > MULTISWITCH && picnum <= MULTISWITCH+3)
|
|
|
|
{
|
|
|
|
return MULTISWITCH;
|
|
|
|
}
|
|
|
|
|
|
|
|
return picnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t P_ActivateSwitch(int32_t snum, int32_t w, int32_t switchissprite)
|
|
|
|
{
|
|
|
|
int32_t lotag, hitag, picnum, switchpal;
|
2009-01-13 04:40:56 +00:00
|
|
|
vec3_t davector;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:58 +00:00
|
|
|
int32_t switchpicnum;
|
|
|
|
int32_t i, correctdips = 1, numdips = 0;
|
|
|
|
|
|
|
|
if (w < 0)
|
|
|
|
return 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-03-10 21:22:03 +00:00
|
|
|
if (switchissprite == 1) // A wall sprite
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
if (actor[w].lasttransport == totalclock)
|
|
|
|
return 0;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[w].lasttransport = totalclock;
|
2014-01-31 21:12:58 +00:00
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
lotag = sprite[w].lotag;
|
2014-01-31 21:12:58 +00:00
|
|
|
if (lotag == 0)
|
|
|
|
return 0;
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
hitag = sprite[w].hitag;
|
2009-01-13 04:40:56 +00:00
|
|
|
|
2009-08-28 23:08:00 +00:00
|
|
|
Bmemcpy(&davector, &sprite[w], sizeof(vec3_t));
|
2006-04-13 20:47:06 +00:00
|
|
|
picnum = sprite[w].picnum;
|
|
|
|
switchpal = sprite[w].pal;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-11-15 01:16:55 +00:00
|
|
|
lotag = wall[w].lotag;
|
2014-01-31 21:12:58 +00:00
|
|
|
if (lotag == 0)
|
|
|
|
return 0;
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
hitag = wall[w].hitag;
|
2014-01-31 21:12:58 +00:00
|
|
|
|
2009-01-13 04:40:56 +00:00
|
|
|
Bmemcpy(&davector, &wall[w], sizeof(int32_t) * 2);
|
2010-05-02 23:27:30 +00:00
|
|
|
davector.z = g_player[snum].ps->pos.z;
|
2006-04-13 20:47:06 +00:00
|
|
|
picnum = wall[w].picnum;
|
|
|
|
switchpal = wall[w].pal;
|
|
|
|
}
|
2014-01-31 21:12:58 +00:00
|
|
|
|
|
|
|
// initprintf("P_ActivateSwitch called picnum=%i switchissprite=%i\n",picnum,switchissprite);
|
|
|
|
|
|
|
|
switchpicnum = G_GetBaseSwitch(picnum);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(switchpicnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
case DIPSWITCH_LIKE_CASES:
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:58 +00:00
|
|
|
|
|
|
|
case ACCESSSWITCH_CASES:
|
2007-08-27 06:46:31 +00:00
|
|
|
if (g_player[snum].ps->access_incs == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
int32_t pp;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:58 +00:00
|
|
|
static const int32_t key_switchpal[3] = { 0, 21, 23 };
|
|
|
|
static const int32_t need_key_quote[3] = {
|
|
|
|
QUOTE_NEED_BLUE_KEY, QUOTE_NEED_RED_KEY, QUOTE_NEED_YELLOW_KEY
|
|
|
|
};
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-02-02 22:18:35 +00:00
|
|
|
for (pp=0; pp<3; pp++)
|
2014-01-31 21:12:58 +00:00
|
|
|
if (switchpal == key_switchpal[pp])
|
|
|
|
{
|
|
|
|
if (g_player[snum].ps->got_access & (1<<pp))
|
|
|
|
g_player[snum].ps->access_incs = 1;
|
|
|
|
else
|
|
|
|
P_DoQuote(need_key_quote[pp], g_player[snum].ps);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-27 06:46:31 +00:00
|
|
|
if (g_player[snum].ps->access_incs == 1)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-03-10 21:22:03 +00:00
|
|
|
if (switchissprite == 0)
|
2007-08-27 06:46:31 +00:00
|
|
|
g_player[snum].ps->access_wallnum = w;
|
2006-11-16 03:02:42 +00:00
|
|
|
else
|
2007-08-27 06:46:31 +00:00
|
|
|
g_player[snum].ps->access_spritenum = w;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2014-01-31 21:12:58 +00:00
|
|
|
/* fall-through (XXX: intended?) */
|
2006-11-16 03:02:42 +00:00
|
|
|
case MULTISWITCH__STATIC:
|
2014-01-31 21:12:58 +00:00
|
|
|
case REST_SWITCH_CASES:
|
|
|
|
if (G_CheckActivatorMotion(lotag))
|
|
|
|
return 0;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:58 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
default:
|
2014-01-31 21:12:58 +00:00
|
|
|
if (CheckDoorTile(picnum) == 0)
|
|
|
|
return 0;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2014-01-31 21:12:58 +00:00
|
|
|
for (SPRITES_OF(STAT_DEFAULT, i))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-15 01:16:55 +00:00
|
|
|
if (lotag == SLT)
|
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
// Put the tile number into a variable so later switches don't
|
|
|
|
// trigger on the result of changes:
|
|
|
|
const int32_t switchpic = PN;
|
|
|
|
|
|
|
|
if (switchpic >= MULTISWITCH && switchpic <= MULTISWITCH+3)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-04-13 20:47:06 +00:00
|
|
|
sprite[i].picnum++;
|
2014-01-31 21:12:58 +00:00
|
|
|
if (sprite[i].picnum > MULTISWITCH+3)
|
2006-04-13 20:47:06 +00:00
|
|
|
sprite[i].picnum = MULTISWITCH;
|
|
|
|
}
|
2014-01-31 21:12:58 +00:00
|
|
|
|
|
|
|
switch (DYNAMICTILEMAP(switchpic))
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
case DIPSWITCH_LIKE_CASES:
|
|
|
|
if (switchissprite == 1 && w == i)
|
|
|
|
PN++;
|
|
|
|
else if (SHT == 0)
|
|
|
|
correctdips++;
|
2006-11-16 03:02:42 +00:00
|
|
|
numdips++;
|
|
|
|
break;
|
2014-01-31 21:12:58 +00:00
|
|
|
|
|
|
|
case ACCESSSWITCH_CASES:
|
|
|
|
case REST_SWITCH_CASES:
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[i].picnum++;
|
|
|
|
break;
|
2014-01-31 21:12:58 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
default:
|
2014-01-31 21:12:58 +00:00
|
|
|
if (switchpic <= 0) // oob safety
|
2011-12-11 13:26:39 +00:00
|
|
|
break;
|
|
|
|
|
2014-01-31 21:12:58 +00:00
|
|
|
switch (DYNAMICTILEMAP(switchpic-1))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
case DIPSWITCH_LIKE_CASES:
|
|
|
|
if (switchissprite == 1 && w == i)
|
|
|
|
PN--;
|
|
|
|
else if (SHT == 1)
|
|
|
|
correctdips++;
|
2006-04-13 20:47:06 +00:00
|
|
|
numdips++;
|
|
|
|
break;
|
2014-01-31 21:12:58 +00:00
|
|
|
|
|
|
|
case REST_SWITCH_CASES:
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[i].picnum--;
|
2006-04-13 20:47:06 +00:00
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=numwalls-1; i>=0; i--)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
const int32_t x = i;
|
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
if (lotag == wall[x].lotag)
|
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
if (wall[x].picnum >= MULTISWITCH && wall[x].picnum <= MULTISWITCH+3)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2006-04-13 20:47:06 +00:00
|
|
|
wall[x].picnum++;
|
2014-01-31 21:12:58 +00:00
|
|
|
if (wall[x].picnum > MULTISWITCH+3)
|
2006-04-13 20:47:06 +00:00
|
|
|
wall[x].picnum = MULTISWITCH;
|
|
|
|
}
|
2011-12-11 13:26:39 +00:00
|
|
|
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(wall[x].picnum))
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
case DIPSWITCH_LIKE_CASES:
|
|
|
|
if (switchissprite == 0 && i == w)
|
|
|
|
wall[x].picnum++;
|
|
|
|
else if (wall[x].hitag == 0)
|
|
|
|
correctdips++;
|
2006-11-16 03:02:42 +00:00
|
|
|
numdips++;
|
|
|
|
break;
|
2014-01-31 21:12:58 +00:00
|
|
|
|
|
|
|
case ACCESSSWITCH_CASES:
|
|
|
|
case REST_SWITCH_CASES:
|
2006-11-16 03:02:42 +00:00
|
|
|
wall[x].picnum++;
|
|
|
|
break;
|
2014-01-31 21:12:58 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
default:
|
2011-12-11 13:26:39 +00:00
|
|
|
if (wall[x].picnum <= 0) // oob safety
|
|
|
|
break;
|
|
|
|
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(wall[x].picnum-1))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
case DIPSWITCH_LIKE_CASES:
|
|
|
|
if (switchissprite == 0 && i == w)
|
|
|
|
wall[x].picnum--;
|
|
|
|
else if (wall[x].hitag == 1)
|
|
|
|
correctdips++;
|
2006-04-13 20:47:06 +00:00
|
|
|
numdips++;
|
|
|
|
break;
|
2014-01-31 21:12:58 +00:00
|
|
|
|
|
|
|
case REST_SWITCH_CASES:
|
2006-11-16 03:02:42 +00:00
|
|
|
wall[x].picnum--;
|
2006-04-13 20:47:06 +00:00
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-04 11:52:51 +00:00
|
|
|
if (lotag == UINT16_MAX)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2015-12-04 11:52:51 +00:00
|
|
|
P_EndLevel();
|
2014-01-31 21:12:55 +00:00
|
|
|
return 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2014-01-31 21:12:58 +00:00
|
|
|
switchpicnum = G_GetBaseSwitch(picnum);
|
2006-04-13 20:47:06 +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
|
|
|
default:
|
2014-01-31 21:12:58 +00:00
|
|
|
if (CheckDoorTile(picnum) == 0)
|
|
|
|
break;
|
|
|
|
/* fall-through */
|
|
|
|
case DIPSWITCH_LIKE_CASES:
|
|
|
|
if (G_IsLikeDipswitch(picnum))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
if (picnum == ALIENSWITCH || picnum == ALIENSWITCH+1)
|
|
|
|
{
|
2012-03-10 21:22:03 +00:00
|
|
|
if (switchissprite == 1)
|
2009-08-06 10:12:13 +00:00
|
|
|
S_PlaySound3D(ALIEN_SWITCH1, w, &davector);
|
2014-01-31 21:12:58 +00:00
|
|
|
else
|
|
|
|
S_PlaySound3D(ALIEN_SWITCH1, g_player[snum].ps->i, &davector);
|
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
|
|
|
{
|
2012-03-10 21:22:03 +00:00
|
|
|
if (switchissprite == 1)
|
2009-08-06 10:12:13 +00:00
|
|
|
S_PlaySound3D(SWITCH_ON, w, &davector);
|
2014-01-31 21:12:58 +00:00
|
|
|
else
|
|
|
|
S_PlaySound3D(SWITCH_ON, g_player[snum].ps->i, &davector);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2014-01-31 21:12:58 +00:00
|
|
|
|
|
|
|
if (numdips != correctdips)
|
|
|
|
break;
|
|
|
|
|
|
|
|
S_PlaySound3D(END_OF_LEVEL_WARN, g_player[snum].ps->i, &davector);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2014-01-31 21:12:58 +00:00
|
|
|
/* fall-through */
|
|
|
|
case ACCESSSWITCH_CASES:
|
2006-11-16 03:02:42 +00:00
|
|
|
case MULTISWITCH__STATIC:
|
2014-01-31 21:12:58 +00:00
|
|
|
case REST_SWITCH_CASES:
|
|
|
|
{
|
|
|
|
int32_t x;
|
|
|
|
|
|
|
|
if (picnum >= MULTISWITCH && picnum <= MULTISWITCH+3)
|
|
|
|
lotag += picnum - MULTISWITCH;
|
|
|
|
|
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, x))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2014-01-31 21:12:58 +00:00
|
|
|
if (sprite[x].hitag == lotag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
switch (sprite[x].lotag)
|
|
|
|
{
|
2012-09-08 22:18:44 +00:00
|
|
|
case SE_12_LIGHT_SWITCH:
|
2006-11-16 03:02:42 +00:00
|
|
|
sector[sprite[x].sectnum].floorpal = 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[x].t_data[0]++;
|
|
|
|
if (actor[x].t_data[0] == 2)
|
|
|
|
actor[x].t_data[0]++;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:58 +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-26 22:16:08 +00:00
|
|
|
case SE_25_PISTON:
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[x].t_data[4] = !actor[x].t_data[4];
|
2014-01-31 21:12:58 +00:00
|
|
|
P_DoQuote(actor[x].t_data[4] ? QUOTE_DEACTIVATED : QUOTE_ACTIVATED,
|
|
|
|
g_player[snum].ps);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:58 +00:00
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
case SE_21_DROP_FLOOR:
|
2014-01-31 21:12:58 +00:00
|
|
|
P_DoQuote(QUOTE_ACTIVATED, g_player[screenpeek].ps);
|
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
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
G_OperateActivators(lotag,snum);
|
2014-01-31 21:12:58 +00:00
|
|
|
G_OperateForceFields(g_player[snum].ps->i, lotag);
|
2008-11-20 14:06:36 +00:00
|
|
|
G_OperateMasterSwitches(lotag);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2014-01-31 21:12:58 +00:00
|
|
|
if (G_IsLikeDipswitch(picnum))
|
|
|
|
return 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (hitag == 0 && CheckDoorTile(picnum) == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-03-10 21:22:03 +00:00
|
|
|
if (switchissprite == 1)
|
2014-01-31 21:12:58 +00:00
|
|
|
S_PlaySound3D(SWITCH_ON, w, &davector);
|
|
|
|
else
|
|
|
|
S_PlaySound3D(SWITCH_ON, g_player[snum].ps->i, &davector);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else if (hitag != 0)
|
|
|
|
{
|
2013-09-08 20:18:56 +00:00
|
|
|
if (switchissprite == 1 && (g_sounds[hitag].m & SF_TALK) == 0)
|
2014-01-31 21:12:58 +00:00
|
|
|
S_PlaySound3D(hitag, w, &davector);
|
|
|
|
else
|
|
|
|
A_PlaySound(hitag, g_player[snum].ps->i);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2014-01-31 21:12:58 +00:00
|
|
|
}
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-01-31 21:12:55 +00:00
|
|
|
void G_ActivateBySector(int32_t sect, int32_t j)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
int32_t i;
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t didit = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF_SECT(sect, i))
|
2006-11-13 23:12:47 +00:00
|
|
|
if (PN == ACTIVATOR)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
G_OperateActivators(SLT,-1);
|
2006-04-13 20:47:06 +00:00
|
|
|
didit = 1;
|
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (didit == 0)
|
2008-11-20 14:06:36 +00:00
|
|
|
G_OperateSectors(sect,j);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2014-01-31 21:12:55 +00:00
|
|
|
static void BreakWall(int32_t newpn, int32_t spr, int32_t dawallnum)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
wall[dawallnum].picnum = newpn;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(VENT_BUST,spr);
|
|
|
|
A_PlaySound(GLASS_HEAVYBREAK,spr);
|
|
|
|
A_SpawnWallGlass(spr,dawallnum,10);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2014-01-31 21:12:55 +00:00
|
|
|
void A_DamageWall(int32_t spr, int32_t dawallnum, const vec3_t *pos, int32_t atwith)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t sn = -1;
|
|
|
|
int32_t j, i, darkestwall;
|
2008-02-06 11:42:34 +00:00
|
|
|
walltype *wal = &wall[dawallnum];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:55 +00:00
|
|
|
if (wal->overpicnum == MIRROR && wal->pal != 4 &&
|
2016-02-02 00:21:17 +00:00
|
|
|
A_CheckSpriteFlags(spr,SFLAG_PROJECTILE) &&
|
2014-01-31 21:12:55 +00:00
|
|
|
(SpriteProjectile[spr].workslike & PROJECTILE_RPG))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-10-11 09:20:04 +00:00
|
|
|
if (wal->nextwall == -1 || wall[wal->nextwall].pal != 4)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SpawnWallGlass(spr,dawallnum,70);
|
2008-10-11 09:20:04 +00:00
|
|
|
wal->cstat &= ~16;
|
|
|
|
wal->overpicnum = MIRRORBROKE;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(GLASS_HEAVYBREAK,spr);
|
2008-10-11 09:20:04 +00:00
|
|
|
return;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2008-10-11 09:20:04 +00:00
|
|
|
if (wal->overpicnum == MIRROR && wal->pal != 4)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(atwith))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case HEAVYHBOMB__STATIC:
|
|
|
|
case RADIUSEXPLOSION__STATIC:
|
|
|
|
case RPG__STATIC:
|
|
|
|
case HYDRENT__STATIC:
|
|
|
|
case SEENINE__STATIC:
|
|
|
|
case OOZFILTER__STATIC:
|
|
|
|
case EXPLODINGBARREL__STATIC:
|
2008-10-13 01:16:40 +00:00
|
|
|
if (wal->nextwall == -1 || wall[wal->nextwall].pal != 4)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SpawnWallGlass(spr,dawallnum,70);
|
2008-10-13 01:16:40 +00:00
|
|
|
wal->cstat &= ~16;
|
|
|
|
wal->overpicnum = MIRRORBROKE;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(GLASS_HEAVYBREAK,spr);
|
2008-10-13 01:16:40 +00:00
|
|
|
return;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (((wal->cstat&16) || wal->overpicnum == BIGFORCE) && wal->nextsector >= 0)
|
2009-01-13 04:40:56 +00:00
|
|
|
if (sector[wal->nextsector].floorz > pos->z)
|
2014-01-31 21:12:56 +00:00
|
|
|
if (sector[wal->nextsector].floorz != sector[wal->nextsector].ceilingz)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
int32_t switchpicnum = G_GetForcefieldPicnum(dawallnum);
|
2013-12-26 19:45:14 +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 W_FORCEFIELD__STATIC:
|
|
|
|
wal->extra = 1; // tell the forces to animate
|
2013-12-26 19:45:14 +00:00
|
|
|
/* fall-through */
|
2006-11-16 03:02:42 +00:00
|
|
|
case BIGFORCE__STATIC:
|
2013-12-26 19:45:14 +00:00
|
|
|
updatesector(pos->x, pos->y, &sn);
|
|
|
|
if (sn < 0)
|
|
|
|
return;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
{
|
2013-12-26 19:45:14 +00:00
|
|
|
int32_t xr=32, yr=32;
|
|
|
|
|
|
|
|
if (atwith == -1)
|
|
|
|
xr = yr = 8;
|
|
|
|
else if (atwith == CHAINGUN)
|
|
|
|
{
|
|
|
|
xr = 16+sprite[spr].xrepeat;
|
|
|
|
yr = 16+sprite[spr].yrepeat;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = A_InsertSprite(sn, pos->x,pos->y,pos->z, FORCERIPPLE,
|
|
|
|
-127, xr,yr, 0,0,0,spr,5);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
CS |= 18+128;
|
|
|
|
SA = getangle(wal->x-wall[wal->point2].x,
|
|
|
|
wal->y-wall[wal->point2].y)-512;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(SOMETHINGHITFORCE,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case FANSPRITE__STATIC:
|
|
|
|
wal->overpicnum = FANSPRITEBROKE;
|
|
|
|
wal->cstat &= 65535-65;
|
|
|
|
if (wal->nextwall >= 0)
|
|
|
|
{
|
|
|
|
wall[wal->nextwall].overpicnum = FANSPRITEBROKE;
|
|
|
|
wall[wal->nextwall].cstat &= 65535-65;
|
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(VENT_BUST,spr);
|
|
|
|
A_PlaySound(GLASS_BREAKING,spr);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case GLASS__STATIC:
|
2009-01-13 04:40:56 +00:00
|
|
|
updatesector(pos->x,pos->y,&sn);
|
2014-01-31 21:12:55 +00:00
|
|
|
if (sn < 0)
|
|
|
|
return;
|
2006-11-16 03:02:42 +00:00
|
|
|
wal->overpicnum=GLASS2;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SpawnWallGlass(spr,dawallnum,10);
|
2006-11-16 03:02:42 +00:00
|
|
|
wal->cstat = 0;
|
|
|
|
|
|
|
|
if (wal->nextwall >= 0)
|
|
|
|
wall[wal->nextwall].cstat = 0;
|
|
|
|
|
2009-01-13 04:40:56 +00:00
|
|
|
i = A_InsertSprite(sn,pos->x,pos->y,pos->z,SECTOREFFECTOR,0,0,0,g_player[0].ps->ang,0,0,spr,3);
|
2006-11-16 03:02:42 +00:00
|
|
|
SLT = 128;
|
|
|
|
T2 = 5;
|
|
|
|
T3 = dawallnum;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(GLASS_BREAKING,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2013-12-26 19:45:14 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case STAINGLASS1__STATIC:
|
2009-01-13 04:40:56 +00:00
|
|
|
updatesector(pos->x,pos->y,&sn);
|
2013-12-26 19:45:14 +00:00
|
|
|
if (sn < 0)
|
|
|
|
return;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SpawnRandomGlass(spr,dawallnum,80);
|
2006-11-16 03:02:42 +00:00
|
|
|
wal->cstat = 0;
|
|
|
|
if (wal->nextwall >= 0)
|
|
|
|
wall[wal->nextwall].cstat = 0;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(VENT_BUST,spr);
|
|
|
|
A_PlaySound(GLASS_BREAKING,spr);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(wal->picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case COLAMACHINE__STATIC:
|
|
|
|
case VENDMACHINE__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
BreakWall(wal->picnum+2,spr,dawallnum);
|
|
|
|
A_PlaySound(VENT_BUST,spr);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case OJ__STATIC:
|
|
|
|
case FEMPIC2__STATIC:
|
|
|
|
case FEMPIC3__STATIC:
|
|
|
|
|
|
|
|
case SCREENBREAK6__STATIC:
|
|
|
|
case SCREENBREAK7__STATIC:
|
|
|
|
case SCREENBREAK8__STATIC:
|
|
|
|
|
|
|
|
case SCREENBREAK1__STATIC:
|
|
|
|
case SCREENBREAK2__STATIC:
|
|
|
|
case SCREENBREAK3__STATIC:
|
|
|
|
case SCREENBREAK4__STATIC:
|
|
|
|
case SCREENBREAK5__STATIC:
|
|
|
|
|
|
|
|
case SCREENBREAK9__STATIC:
|
|
|
|
case SCREENBREAK10__STATIC:
|
|
|
|
case SCREENBREAK11__STATIC:
|
|
|
|
case SCREENBREAK12__STATIC:
|
|
|
|
case SCREENBREAK13__STATIC:
|
|
|
|
case SCREENBREAK14__STATIC:
|
|
|
|
case SCREENBREAK15__STATIC:
|
|
|
|
case SCREENBREAK16__STATIC:
|
|
|
|
case SCREENBREAK17__STATIC:
|
|
|
|
case SCREENBREAK18__STATIC:
|
|
|
|
case SCREENBREAK19__STATIC:
|
|
|
|
case BORNTOBEWILDSCREEN__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SpawnWallGlass(spr,dawallnum,30);
|
|
|
|
wal->picnum=W_SCREENBREAK+(krand()%3);
|
|
|
|
A_PlaySound(GLASS_HEAVYBREAK,spr);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case W_TECHWALL5__STATIC:
|
|
|
|
case W_TECHWALL6__STATIC:
|
|
|
|
case W_TECHWALL7__STATIC:
|
|
|
|
case W_TECHWALL8__STATIC:
|
|
|
|
case W_TECHWALL9__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
BreakWall(wal->picnum+1,spr,dawallnum);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case W_MILKSHELF__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
BreakWall(W_MILKSHELFBROKE,spr,dawallnum);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case W_TECHWALL10__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
BreakWall(W_HITTECHWALL10,spr,dawallnum);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case W_TECHWALL1__STATIC:
|
|
|
|
case W_TECHWALL11__STATIC:
|
|
|
|
case W_TECHWALL12__STATIC:
|
|
|
|
case W_TECHWALL13__STATIC:
|
|
|
|
case W_TECHWALL14__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
BreakWall(W_HITTECHWALL1,spr,dawallnum);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case W_TECHWALL15__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
BreakWall(W_HITTECHWALL15,spr,dawallnum);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case W_TECHWALL16__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
BreakWall(W_HITTECHWALL16,spr,dawallnum);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case W_TECHWALL2__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
BreakWall(W_HITTECHWALL2,spr,dawallnum);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case W_TECHWALL3__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
BreakWall(W_HITTECHWALL3,spr,dawallnum);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case W_TECHWALL4__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
BreakWall(W_HITTECHWALL4,spr,dawallnum);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case ATM__STATIC:
|
|
|
|
wal->picnum = ATMBROKE;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SpawnMultiple(spr, MONEY, 1+(krand()&7));
|
|
|
|
A_PlaySound(GLASS_HEAVYBREAK,spr);
|
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 WALLLIGHT1__STATIC:
|
|
|
|
case WALLLIGHT2__STATIC:
|
|
|
|
case WALLLIGHT3__STATIC:
|
|
|
|
case WALLLIGHT4__STATIC:
|
|
|
|
case TECHLIGHT2__STATIC:
|
|
|
|
case TECHLIGHT4__STATIC:
|
2014-01-31 21:12:56 +00:00
|
|
|
A_PlaySound(rnd(128) ? GLASS_HEAVYBREAK : GLASS_BREAKING, spr);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SpawnWallGlass(spr,dawallnum,30);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wal->picnum == WALLLIGHT1)
|
|
|
|
wal->picnum = WALLLIGHTBUST1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wal->picnum == WALLLIGHT2)
|
|
|
|
wal->picnum = WALLLIGHTBUST2;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wal->picnum == WALLLIGHT3)
|
|
|
|
wal->picnum = WALLLIGHTBUST3;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wal->picnum == WALLLIGHT4)
|
|
|
|
wal->picnum = WALLLIGHTBUST4;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wal->picnum == TECHLIGHT2)
|
|
|
|
wal->picnum = TECHLIGHTBUST2;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wal->picnum == TECHLIGHT4)
|
|
|
|
wal->picnum = TECHLIGHTBUST4;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-12 19:22:16 +00:00
|
|
|
if (wal->lotag == 0)
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sn = wal->nextsector;
|
2013-12-12 19:22:16 +00:00
|
|
|
if (sn < 0)
|
|
|
|
return;
|
2006-11-16 03:02:42 +00:00
|
|
|
darkestwall = 0;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
wal = &wall[sector[sn].wallptr];
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=sector[sn].wallnum; i > 0; i--,wal++)
|
2006-11-16 03:02:42 +00:00
|
|
|
if (wal->shade > darkestwall)
|
|
|
|
darkestwall=wal->shade;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
j = krand()&1;
|
2013-12-12 19:22:16 +00:00
|
|
|
|
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, i))
|
2012-10-14 20:41:21 +00:00
|
|
|
if (SHT == wall[dawallnum].lotag && SLT == SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
T3 = j;
|
|
|
|
T4 = darkestwall;
|
|
|
|
T5 = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2013-12-12 19:22:16 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-20 18:31:33 +00:00
|
|
|
// NOTE: return value never examined in any of the callers.
|
2013-12-20 18:31:29 +00:00
|
|
|
int32_t Sect_DamageCeilingOrFloor(int32_t floorp, int32_t sn)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i, j;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-20 18:31:33 +00:00
|
|
|
const int32_t RETURN_in = floorp ? 131072+sn : 65536+sn;
|
2013-12-24 09:44:14 +00:00
|
|
|
// NOTE: pass RETURN in the dist argument, too.
|
2014-11-22 12:29:25 +00:00
|
|
|
int32_t ret = VM_OnEventWithBoth(EVENT_DAMAGEHPLANE, g_player[screenpeek].ps->i, screenpeek,
|
2013-12-24 09:44:14 +00:00
|
|
|
RETURN_in, RETURN_in);
|
2013-12-20 18:31:33 +00:00
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
return 0;
|
|
|
|
|
2013-12-20 18:31:29 +00:00
|
|
|
if (floorp)
|
|
|
|
return 0;
|
|
|
|
|
2013-12-20 18:31:33 +00:00
|
|
|
if (ret == (1<<20))
|
|
|
|
{
|
|
|
|
// Execute the hard-coded stuff without changing picnum (expected to
|
|
|
|
// have been done by the event).
|
|
|
|
goto GLASSBREAK_CODE;
|
|
|
|
}
|
|
|
|
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(sector[sn].ceilingpicnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case WALLLIGHT1__STATIC:
|
|
|
|
case WALLLIGHT2__STATIC:
|
|
|
|
case WALLLIGHT3__STATIC:
|
|
|
|
case WALLLIGHT4__STATIC:
|
|
|
|
case TECHLIGHT2__STATIC:
|
|
|
|
case TECHLIGHT4__STATIC:
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sector[sn].ceilingpicnum == WALLLIGHT1)
|
|
|
|
sector[sn].ceilingpicnum = WALLLIGHTBUST1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sector[sn].ceilingpicnum == WALLLIGHT2)
|
|
|
|
sector[sn].ceilingpicnum = WALLLIGHTBUST2;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sector[sn].ceilingpicnum == WALLLIGHT3)
|
|
|
|
sector[sn].ceilingpicnum = WALLLIGHTBUST3;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sector[sn].ceilingpicnum == WALLLIGHT4)
|
|
|
|
sector[sn].ceilingpicnum = WALLLIGHTBUST4;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sector[sn].ceilingpicnum == TECHLIGHT2)
|
|
|
|
sector[sn].ceilingpicnum = TECHLIGHTBUST2;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sector[sn].ceilingpicnum == TECHLIGHT4)
|
|
|
|
sector[sn].ceilingpicnum = TECHLIGHTBUST4;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-20 18:31:33 +00:00
|
|
|
GLASSBREAK_CODE:
|
|
|
|
A_SpawnCeilingGlass(g_player[myconnectindex].ps->i,sn,10);
|
|
|
|
A_PlaySound(GLASS_BREAKING,g_player[screenpeek].ps->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-12 19:22:16 +00:00
|
|
|
if (sector[sn].hitag == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-12-12 19:22:16 +00:00
|
|
|
for (SPRITES_OF_SECT(sn, i))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-09-08 22:18:44 +00:00
|
|
|
if (PN == SECTOREFFECTOR && SLT == SE_12_LIGHT_SWITCH)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-12 19:22:16 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, j))
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[j].hitag == SHT)
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].t_data[3] = 1;
|
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
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
j = krand()&1;
|
2013-12-12 19:22:16 +00:00
|
|
|
|
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, i))
|
|
|
|
if (SHT == sector[sn].hitag && SLT == SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
T3 = j;
|
|
|
|
T5 = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
return 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
// hard coded props... :(
|
2009-01-09 09:29:17 +00:00
|
|
|
void A_DamageObject(int32_t i,int32_t sn)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t j;
|
2012-08-02 10:52:13 +00:00
|
|
|
int32_t k, rpg=0;
|
2006-04-13 20:47:06 +00:00
|
|
|
spritetype *s;
|
2012-12-12 02:53:13 +00:00
|
|
|
|
|
|
|
if (g_netClient)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
i &= (MAXSPRITES-1);
|
|
|
|
|
2014-02-22 19:38:52 +00:00
|
|
|
if (A_CheckSpriteFlags(sn,SFLAG_PROJECTILE))
|
2009-07-13 06:55:00 +00:00
|
|
|
if (SpriteProjectile[sn].workslike & PROJECTILE_RPG)
|
2006-04-13 20:47:06 +00:00
|
|
|
rpg = 1;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(PN))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case OCEANSPRITE1__STATIC:
|
|
|
|
case OCEANSPRITE2__STATIC:
|
|
|
|
case OCEANSPRITE3__STATIC:
|
|
|
|
case OCEANSPRITE4__STATIC:
|
|
|
|
case OCEANSPRITE5__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(i,SMALLSMOKE);
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:58 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case QUEBALL__STATIC:
|
|
|
|
case STRIPEBALL__STATIC:
|
|
|
|
if (sprite[sn].picnum == QUEBALL || sprite[sn].picnum == STRIPEBALL)
|
|
|
|
{
|
|
|
|
sprite[sn].xvel = (sprite[i].xvel>>1)+(sprite[i].xvel>>2);
|
|
|
|
sprite[sn].ang -= (SA<<1)+1024;
|
|
|
|
SA = getangle(SX-sprite[sn].x,SY-sprite[sn].y)-512;
|
2008-11-20 14:06:36 +00:00
|
|
|
if (S_CheckSoundPlaying(i,POOLBALLHIT) < 2)
|
|
|
|
A_PlaySound(POOLBALLHIT,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (krand()&3)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[i].xvel = 164;
|
|
|
|
sprite[i].ang = sprite[sn].ang;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SpawnWallGlass(i,-1,3);
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(i);
|
2006-11-13 23:12:47 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:58 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case TREE1__STATIC:
|
|
|
|
case TREE2__STATIC:
|
|
|
|
case TIRE__STATIC:
|
|
|
|
case CONE__STATIC:
|
|
|
|
case BOX__STATIC:
|
|
|
|
{
|
|
|
|
if (rpg == 1)
|
|
|
|
if (T1 == 0)
|
|
|
|
{
|
|
|
|
CS &= ~257;
|
|
|
|
T1 = 1;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(i,BURNING);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(sprite[sn].picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case RADIUSEXPLOSION__STATIC:
|
|
|
|
case RPG__STATIC:
|
|
|
|
case FIRELASER__STATIC:
|
|
|
|
case HYDRENT__STATIC:
|
|
|
|
case HEAVYHBOMB__STATIC:
|
|
|
|
if (T1 == 0)
|
|
|
|
{
|
|
|
|
CS &= ~257;
|
|
|
|
T1 = 1;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(i,BURNING);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-01-31 21:12:58 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case CACTUS__STATIC:
|
|
|
|
{
|
|
|
|
if (rpg == 1)
|
2009-02-19 16:47:54 +00:00
|
|
|
for (k=64; k>0; k--)
|
2006-11-13 23:12:47 +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-11-16 03:02:42 +00:00
|
|
|
sprite[j].pal = 8;
|
2006-11-13 23:12:47 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
// case CACTUSBROKE:
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(sprite[sn].picnum))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
case RADIUSEXPLOSION__STATIC:
|
|
|
|
case RPG__STATIC:
|
|
|
|
case FIRELASER__STATIC:
|
|
|
|
case HYDRENT__STATIC:
|
|
|
|
case HEAVYHBOMB__STATIC:
|
2009-02-19 16:47:54 +00:00
|
|
|
for (k=64; k>0; k--)
|
2006-11-13 23:12:47 +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-11-16 03:02:42 +00:00
|
|
|
sprite[j].pal = 8;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (PN == CACTUS)
|
|
|
|
PN = CACTUSBROKE;
|
2006-11-15 01:16:55 +00:00
|
|
|
CS &= ~257;
|
2012-03-11 17:38:13 +00:00
|
|
|
// else A_DeleteSprite(i);
|
2006-11-15 01:16:55 +00:00
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2014-01-31 21:12:58 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case HANGLIGHT__STATIC:
|
|
|
|
case GENERICPOLE2__STATIC:
|
2009-02-19 16:47:54 +00:00
|
|
|
for (k=6; k>0; k--)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_InsertSprite(SECT,SX,SY,SZ-(8<<8),SCRAP1+(krand()&15),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(sprite[i].zvel>>2),i,5);
|
|
|
|
A_PlaySound(GLASS_HEAVYBREAK,i);
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FANSPRITE__STATIC:
|
|
|
|
PN = FANSPRITEBROKE;
|
|
|
|
CS &= (65535-257);
|
|
|
|
if (sector[SECT].floorpicnum == FANSHADOW)
|
|
|
|
sector[SECT].floorpicnum = FANSHADOWBROKE;
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(GLASS_HEAVYBREAK,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
s = &sprite[i];
|
2014-01-31 21:12:55 +00:00
|
|
|
for (j=16; j>0; j--)
|
|
|
|
RANDOMSCRAP;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
break;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case WATERFOUNTAIN__STATIC:
|
|
|
|
// case WATERFOUNTAIN+1:
|
|
|
|
// case WATERFOUNTAIN+2:
|
|
|
|
PN = WATERFOUNTAINBROKE;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(i,TOILETWATER);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case SATELITE__STATIC:
|
|
|
|
case FUELPOD__STATIC:
|
|
|
|
case SOLARPANNEL__STATIC:
|
|
|
|
case ANTENNA__STATIC:
|
2012-12-29 15:21:28 +00:00
|
|
|
if (sprite[sn].extra != G_InitialActorStrength(SHOTSPARK1))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=15; j>0; j--)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_InsertSprite(SECT,SX,SY,sector[SECT].floorz-(12<<8)-(j<<9),SCRAP1+(krand()&15),-8,64,64,
|
|
|
|
krand()&2047,(krand()&127)+64,-(krand()&511)-256,i,5);
|
|
|
|
A_Spawn(i,EXPLOSION2);
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
break;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case BOTTLE1__STATIC:
|
|
|
|
case BOTTLE2__STATIC:
|
|
|
|
case BOTTLE3__STATIC:
|
|
|
|
case BOTTLE4__STATIC:
|
|
|
|
case BOTTLE5__STATIC:
|
|
|
|
case BOTTLE6__STATIC:
|
|
|
|
case BOTTLE8__STATIC:
|
|
|
|
case BOTTLE10__STATIC:
|
|
|
|
case BOTTLE11__STATIC:
|
|
|
|
case BOTTLE12__STATIC:
|
|
|
|
case BOTTLE13__STATIC:
|
|
|
|
case BOTTLE14__STATIC:
|
|
|
|
case BOTTLE15__STATIC:
|
|
|
|
case BOTTLE16__STATIC:
|
|
|
|
case BOTTLE17__STATIC:
|
|
|
|
case BOTTLE18__STATIC:
|
|
|
|
case BOTTLE19__STATIC:
|
|
|
|
case WATERFOUNTAINBROKE__STATIC:
|
|
|
|
case DOMELITE__STATIC:
|
|
|
|
case SUSHIPLATE1__STATIC:
|
|
|
|
case SUSHIPLATE2__STATIC:
|
|
|
|
case SUSHIPLATE3__STATIC:
|
|
|
|
case SUSHIPLATE4__STATIC:
|
|
|
|
case SUSHIPLATE5__STATIC:
|
|
|
|
case WAITTOBESEATED__STATIC:
|
|
|
|
case VASE__STATIC:
|
|
|
|
case STATUEFLASH__STATIC:
|
|
|
|
case STATUE__STATIC:
|
|
|
|
if (PN == BOTTLE10)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SpawnMultiple(i, MONEY, 4+(krand()&3));
|
2006-11-16 03:02:42 +00:00
|
|
|
else if (PN == STATUE || PN == STATUEFLASH)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SpawnRandomGlass(i,-1,40);
|
|
|
|
A_PlaySound(GLASS_HEAVYBREAK,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
else if (PN == VASE)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_SpawnWallGlass(i,-1,40);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(GLASS_BREAKING,i);
|
|
|
|
SA = krand()&2047;
|
|
|
|
A_SpawnWallGlass(i,-1,8);
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case FETUS__STATIC:
|
|
|
|
PN = FETUSBROKE;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(GLASS_BREAKING,i);
|
|
|
|
A_SpawnWallGlass(i,-1,10);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case FETUSBROKE__STATIC:
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=48; j>0; j--)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Shoot(i,BLOODSPLAT1);
|
2006-11-16 03:02:42 +00:00
|
|
|
SA += 333;
|
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(GLASS_HEAVYBREAK,i);
|
|
|
|
A_PlaySound(SQUISHED,i);
|
2014-01-31 21:12:55 +00:00
|
|
|
/* fall-through */
|
2006-11-16 03:02:42 +00:00
|
|
|
case BOTTLE7__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(GLASS_BREAKING,i);
|
|
|
|
A_SpawnWallGlass(i,-1,10);
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case HYDROPLANT__STATIC:
|
|
|
|
PN = BROKEHYDROPLANT;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(GLASS_BREAKING,i);
|
|
|
|
A_SpawnWallGlass(i,-1,10);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FORCESPHERE__STATIC:
|
|
|
|
sprite[i].xrepeat = 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[OW].t_data[0] = 32;
|
|
|
|
actor[OW].t_data[1] = !actor[OW].t_data[1];
|
|
|
|
actor[OW].t_data[2] ++;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(i,EXPLOSION2);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BROKEHYDROPLANT__STATIC:
|
2011-07-21 22:39:29 +00:00
|
|
|
A_PlaySound(GLASS_BREAKING,i);
|
|
|
|
A_SpawnWallGlass(i,-1,5);
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TOILET__STATIC:
|
|
|
|
PN = TOILETBROKE;
|
2008-11-20 14:06:36 +00:00
|
|
|
CS |= (krand()&1)<<2;
|
2006-11-16 03:02:42 +00:00
|
|
|
CS &= ~257;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(i,TOILETWATER);
|
|
|
|
A_PlaySound(GLASS_BREAKING,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case STALL__STATIC:
|
|
|
|
PN = STALLBROKE;
|
2008-11-20 14:06:36 +00:00
|
|
|
CS |= (krand()&1)<<2;
|
2006-11-16 03:02:42 +00:00
|
|
|
CS &= ~257;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(i,TOILETWATER);
|
|
|
|
A_PlaySound(GLASS_HEAVYBREAK,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HYDRENT__STATIC:
|
|
|
|
PN = BROKEFIREHYDRENT;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Spawn(i,TOILETWATER);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
|
|
|
// for(k=0;k<5;k++)
|
|
|
|
// {
|
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-11-16 03:02:42 +00:00
|
|
|
// sprite[j].pal = 2;
|
|
|
|
// }
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(GLASS_HEAVYBREAK,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GRATE1__STATIC:
|
|
|
|
PN = BGRATE1;
|
|
|
|
CS &= (65535-256-1);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(VENT_BUST,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CIRCLEPANNEL__STATIC:
|
|
|
|
PN = CIRCLEPANNELBROKE;
|
|
|
|
CS &= (65535-256-1);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(VENT_BUST,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case PANNEL1__STATIC:
|
|
|
|
case PANNEL2__STATIC:
|
|
|
|
PN = BPANNEL1;
|
|
|
|
CS &= (65535-256-1);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(VENT_BUST,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case PANNEL3__STATIC:
|
|
|
|
PN = BPANNEL3;
|
|
|
|
CS &= (65535-256-1);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(VENT_BUST,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case PIPE1__STATIC:
|
|
|
|
case PIPE2__STATIC:
|
|
|
|
case PIPE3__STATIC:
|
|
|
|
case PIPE4__STATIC:
|
|
|
|
case PIPE5__STATIC:
|
|
|
|
case PIPE6__STATIC:
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(PN))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
case PIPE1__STATIC:
|
2006-11-16 03:02:42 +00:00
|
|
|
PN=PIPE1B;
|
|
|
|
break;
|
2006-11-13 23:12:47 +00:00
|
|
|
case PIPE2__STATIC:
|
2006-11-16 03:02:42 +00:00
|
|
|
PN=PIPE2B;
|
|
|
|
break;
|
2006-11-13 23:12:47 +00:00
|
|
|
case PIPE3__STATIC:
|
2006-11-16 03:02:42 +00:00
|
|
|
PN=PIPE3B;
|
|
|
|
break;
|
2006-11-13 23:12:47 +00:00
|
|
|
case PIPE4__STATIC:
|
2006-11-16 03:02:42 +00:00
|
|
|
PN=PIPE4B;
|
2006-11-15 01:16:55 +00:00
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
case PIPE5__STATIC:
|
|
|
|
PN=PIPE5B;
|
2006-11-15 01:16:55 +00:00
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
case PIPE6__STATIC:
|
|
|
|
PN=PIPE6B;
|
2006-11-15 01:16:55 +00:00
|
|
|
break;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
j = A_Spawn(i,STEAM);
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[j].z = sector[SECT].floorz-(32<<8);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MONK__STATIC:
|
|
|
|
case LUKE__STATIC:
|
|
|
|
case INDY__STATIC:
|
|
|
|
case JURYGUY__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(SLT,i);
|
|
|
|
A_Spawn(i,SHT);
|
2014-01-31 21:12:55 +00:00
|
|
|
/* fall-through */
|
2006-11-16 03:02:42 +00:00
|
|
|
case SPACEMARINE__STATIC:
|
|
|
|
sprite[i].extra -= sprite[sn].extra;
|
|
|
|
if (sprite[i].extra > 0) break;
|
2008-11-20 14:06:36 +00:00
|
|
|
SA = krand()&2047;
|
|
|
|
A_Shoot(i,BLOODSPLAT1);
|
|
|
|
SA = krand()&2047;
|
|
|
|
A_Shoot(i,BLOODSPLAT2);
|
|
|
|
SA = krand()&2047;
|
|
|
|
A_Shoot(i,BLOODSPLAT3);
|
|
|
|
SA = krand()&2047;
|
|
|
|
A_Shoot(i,BLOODSPLAT4);
|
|
|
|
SA = krand()&2047;
|
|
|
|
A_Shoot(i,BLOODSPLAT1);
|
|
|
|
SA = krand()&2047;
|
|
|
|
A_Shoot(i,BLOODSPLAT2);
|
|
|
|
SA = krand()&2047;
|
|
|
|
A_Shoot(i,BLOODSPLAT3);
|
|
|
|
SA = krand()&2047;
|
|
|
|
A_Shoot(i,BLOODSPLAT4);
|
|
|
|
A_DoGuts(i,JIBS1,1);
|
|
|
|
A_DoGuts(i,JIBS2,2);
|
|
|
|
A_DoGuts(i,JIBS3,3);
|
|
|
|
A_DoGuts(i,JIBS4,4);
|
|
|
|
A_DoGuts(i,JIBS5,1);
|
|
|
|
A_DoGuts(i,JIBS3,6);
|
|
|
|
S_PlaySound(SQUISHED);
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case CHAIR1__STATIC:
|
|
|
|
case CHAIR2__STATIC:
|
|
|
|
PN = BROKENCHAIR;
|
|
|
|
CS = 0;
|
|
|
|
break;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case CHAIR3__STATIC:
|
|
|
|
case MOVIECAMERA__STATIC:
|
|
|
|
case SCALE__STATIC:
|
|
|
|
case VACUUM__STATIC:
|
|
|
|
case CAMERALIGHT__STATIC:
|
|
|
|
case IVUNIT__STATIC:
|
|
|
|
case POT1__STATIC:
|
|
|
|
case POT2__STATIC:
|
|
|
|
case POT3__STATIC:
|
|
|
|
case TRIPODCAMERA__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(GLASS_HEAVYBREAK,i);
|
2006-11-16 03:02:42 +00:00
|
|
|
s = &sprite[i];
|
2014-01-31 21:12:55 +00:00
|
|
|
for (j=16; j>0; j--)
|
|
|
|
RANDOMSCRAP;
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(i);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case PLAYERONWATER__STATIC:
|
|
|
|
i = OW;
|
2014-01-31 21:12:55 +00:00
|
|
|
/* fall-through */
|
2006-11-16 03:02:42 +00:00
|
|
|
default:
|
2009-08-06 10:12:13 +00:00
|
|
|
if ((sprite[i].cstat&16) && SHT == 0 && SLT == 0 && sprite[i].statnum == STAT_DEFAULT)
|
2006-04-13 20:47:06 +00:00
|
|
|
break;
|
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if ((sprite[sn].picnum == FREEZEBLAST || sprite[sn].owner != i) && sprite[i].statnum != STAT_PROJECTILE)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2016-06-21 00:33:45 +00:00
|
|
|
if (A_CheckEnemySprite((tspritetype *)&sprite[i]) == 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:55 +00:00
|
|
|
if (sprite[sn].picnum == RPG)
|
|
|
|
sprite[sn].extra <<= 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if ((PN != DRONE) && (PN != ROTATEGUN) && (PN != COMMANDER) && (PN < GREENSLIME || PN > GREENSLIME+7))
|
|
|
|
if (sprite[sn].picnum != FREEZEBLAST)
|
2016-02-02 00:21:17 +00:00
|
|
|
if (!A_CheckSpriteFlags(i, SFLAG_BADGUY) || A_CheckSpriteFlags(i, SFLAG_HURTSPAWNBLOOD))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
j = A_Spawn(sn,JIBS6);
|
2006-11-16 03:02:42 +00:00
|
|
|
if (sprite[sn].pal == 6)
|
|
|
|
sprite[j].pal = 6;
|
|
|
|
sprite[j].z += (4<<8);
|
|
|
|
sprite[j].xvel = 16;
|
|
|
|
sprite[j].xrepeat = sprite[j].yrepeat = 24;
|
2008-11-20 14:06:36 +00:00
|
|
|
sprite[j].ang += 32-(krand()&63);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
j = sprite[sn].owner;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j >= 0 && sprite[j].picnum == APLAYER && PN != ROTATEGUN && PN != DRONE)
|
2013-12-28 17:04:27 +00:00
|
|
|
if (g_player[P_Get(j)].ps->curr_weapon == SHOTGUN_WEAPON)
|
2016-02-02 00:21:17 +00:00
|
|
|
if (!A_CheckSpriteFlags(i, SFLAG_BADGUY) || A_CheckSpriteFlags(i, SFLAG_HURTSPAWNBLOOD))
|
2015-05-27 08:45:59 +00:00
|
|
|
{
|
|
|
|
A_Shoot(i,BLOODSPLAT3);
|
|
|
|
A_Shoot(i,BLOODSPLAT1);
|
|
|
|
A_Shoot(i,BLOODSPLAT2);
|
|
|
|
A_Shoot(i,BLOODSPLAT4);
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-03-15 14:10:47 +00:00
|
|
|
if (!A_CheckSpriteFlags(i, SFLAG_NODAMAGEPUSH))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-12-01 10:44:18 +00:00
|
|
|
if (sprite[i].extra > 0)
|
|
|
|
{
|
|
|
|
if ((sprite[i].cstat&48) == 0)
|
|
|
|
SA = (sprite[sn].ang+1024)&2047;
|
|
|
|
sprite[i].xvel = -(sprite[sn].extra<<2);
|
|
|
|
j = SECT;
|
2009-01-13 12:23:18 +00:00
|
|
|
pushmove((vec3_t *)&sprite[i],&j,128L,(4L<<8),(4L<<8),CLIPMASK0);
|
2011-03-04 08:50:58 +00:00
|
|
|
if (j != SECT && (unsigned)j < MAXSECTORS)
|
2008-12-01 10:44:18 +00:00
|
|
|
changespritesect(i,j);
|
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[i].statnum == STAT_ZOMBIEACTOR)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-04-24 06:04:13 +00:00
|
|
|
changespritestat(i, STAT_ACTOR);
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].timetosleep = SLEEPTIME;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2012-05-05 22:23:44 +00:00
|
|
|
if ((sprite[i].xrepeat < 24 || PN == SHARK) && sprite[sn].picnum == SHRINKSPARK)
|
|
|
|
return;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[i].statnum != STAT_ZOMBIEACTOR)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (sprite[sn].picnum == FREEZEBLAST && ((PN == APLAYER && sprite[i].pal == 1) || (g_freezerSelfDamage == 0 && sprite[sn].owner == i)))
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[i].picnum = sprite[sn].picnum;
|
|
|
|
actor[i].extra += sprite[sn].extra;
|
|
|
|
actor[i].ang = sprite[sn].ang;
|
|
|
|
actor[i].owner = sprite[sn].owner;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-08-06 10:12:13 +00:00
|
|
|
if (sprite[i].statnum == STAT_PLAYER)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
DukePlayer_t *ps = g_player[P_Get(i)].ps;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-02 10:52:13 +00:00
|
|
|
if (ps->newowner >= 0)
|
|
|
|
G_ClearCameraView(ps);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-05-05 22:23:44 +00:00
|
|
|
if (sprite[i].xrepeat < 24 && sprite[sn].picnum == SHRINKSPARK)
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (sprite[actor[i].owner].picnum != APLAYER)
|
2006-11-16 03:02:42 +00:00
|
|
|
if (ud.player_skill >= 3)
|
|
|
|
sprite[sn].extra += (sprite[sn].extra>>1);
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-12 09:45:14 +00:00
|
|
|
void G_AlignWarpElevators(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-12 19:22:16 +00:00
|
|
|
int32_t i, j;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-12 19:22:16 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, i))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-09-08 22:18:44 +00:00
|
|
|
if (SLT == SE_17_WARP_ELEVATOR && SS > 16)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-12 19:22:16 +00:00
|
|
|
for (SPRITES_OF(STAT_EFFECTOR, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-12 19:22:16 +00:00
|
|
|
if (i != j && sprite[j].lotag == SE_17_WARP_ELEVATOR && SHT == sprite[j].hitag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-12 19:22:16 +00:00
|
|
|
sector[sprite[j].sectnum].floorz = sector[SECT].floorz;
|
|
|
|
sector[sprite[j].sectnum].ceilingz = sector[SECT].ceilingz;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-08 08:03:06 +00:00
|
|
|
|
|
|
|
static int32_t P_CheckDetonatorSpecialCase(DukePlayer_t *const p, int32_t weapid)
|
|
|
|
{
|
|
|
|
if (weapid == HANDBOMB_WEAPON && p->ammo_amount[HANDBOMB_WEAPON] == 0)
|
|
|
|
{
|
|
|
|
int32_t k = headspritestat[STAT_ACTOR];
|
|
|
|
while (k >= 0)
|
|
|
|
{
|
|
|
|
if (sprite[k].picnum == HEAVYHBOMB && sprite[k].owner == p->i)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
k = nextspritestat[k];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-05-15 23:39:48 +00:00
|
|
|
void P_HandleSharedKeys(int32_t snum)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2016-05-02 18:29:25 +00:00
|
|
|
int32_t i, k = 0;
|
2009-01-09 09:29:17 +00:00
|
|
|
uint32_t sb_snum = g_player[snum].sync->bits, j;
|
2014-01-31 21:12:56 +00:00
|
|
|
DukePlayer_t *const p = g_player[snum].ps;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->cheat_phase == 1) return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
// 1<<0 = jump
|
|
|
|
// 1<<1 = crouch
|
|
|
|
// 1<<2 = fire
|
|
|
|
// 1<<3 = aim up
|
|
|
|
// 1<<4 = aim down
|
|
|
|
// 1<<5 = run
|
|
|
|
// 1<<6 = look left
|
|
|
|
// 1<<7 = look right
|
|
|
|
// 15<<8 = !weapon selection (bits 8-11)
|
|
|
|
// 1<<12 = !steroids
|
|
|
|
// 1<<13 = look up
|
|
|
|
// 1<<14 = look down
|
|
|
|
// 1<<15 = !nightvis
|
|
|
|
// 1<<16 = !medkit
|
|
|
|
// 1<<17 = (multiflag==1) ? changes meaning of bits 18 and 19
|
|
|
|
// 1<<18 = centre view
|
|
|
|
// 1<<19 = !holster weapon
|
|
|
|
// 1<<20 = !inventory left
|
|
|
|
// 1<<21 = !pause
|
|
|
|
// 1<<22 = !quick kick
|
|
|
|
// 1<<23 = aim mode
|
|
|
|
// 1<<24 = !holoduke
|
|
|
|
// 1<<25 = !jetpack
|
2008-11-20 14:06:36 +00:00
|
|
|
// 1<<26 = g_gameQuit
|
2006-04-13 20:47:06 +00:00
|
|
|
// 1<<27 = !inventory right
|
|
|
|
// 1<<28 = !turn around
|
|
|
|
// 1<<29 = !open
|
|
|
|
// 1<<30 = !inventory
|
|
|
|
// 1<<31 = !escape
|
|
|
|
|
|
|
|
i = p->aim_mode;
|
2008-11-20 14:06:36 +00:00
|
|
|
p->aim_mode = (sb_snum>>SK_AIMMODE)&1;
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->aim_mode < i)
|
2006-04-13 20:47:06 +00:00
|
|
|
p->return_to_center = 9;
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_QUICK_KICK) && p->quick_kick == 0)
|
2014-10-25 03:25:57 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, WorksLike) != KNEE_WEAPON || p->kickback_pic == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_QUICKKICK,g_player[snum].ps->i,snum) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
p->quick_kick = 14;
|
2008-09-15 02:47:02 +00:00
|
|
|
if (p->fta == 0 || p->ftq == 80)
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_MIGHTY_FOOT,p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-29 19:24:19 +00:00
|
|
|
j = sb_snum & ((15u<<SK_WEAPON_BITS)|BIT(SK_STEROIDS)|BIT(SK_NIGHTVISION)|BIT(SK_MEDKIT)|BIT(SK_QUICK_KICK)| \
|
2008-11-20 14:06:36 +00:00
|
|
|
BIT(SK_HOLSTER)|BIT(SK_INV_LEFT)|BIT(SK_PAUSE)|BIT(SK_HOLODUKE)|BIT(SK_JETPACK)|BIT(SK_INV_RIGHT)| \
|
|
|
|
BIT(SK_TURNAROUND)|BIT(SK_OPEN)|BIT(SK_INVENTORY)|BIT(SK_ESCAPE));
|
2006-04-13 20:47:06 +00:00
|
|
|
sb_snum = j & ~p->interface_toggle_flag;
|
|
|
|
p->interface_toggle_flag |= sb_snum | ((sb_snum&0xf00)?0xf00:0);
|
|
|
|
p->interface_toggle_flag &= j | ((j&0xf00)?0xf00:0);
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (sb_snum && TEST_SYNC_KEY(sb_snum, SK_MULTIFLAG) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_PAUSE))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
KB_ClearKeyDown(sc_Pause);
|
2006-11-13 23:12:47 +00:00
|
|
|
if (ud.pause_on)
|
2006-04-19 05:48:44 +00:00
|
|
|
ud.pause_on = 0;
|
|
|
|
else ud.pause_on = 1+SHIFTS_IS_PRESSED;
|
2006-11-13 23:12:47 +00:00
|
|
|
if (ud.pause_on)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-07-27 05:33:12 +00:00
|
|
|
S_PauseMusic(1);
|
2016-02-02 06:39:22 +00:00
|
|
|
S_PauseSounds(1);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-27 05:33:12 +00:00
|
|
|
if (ud.config.MusicToggle) S_PauseMusic(0);
|
2016-02-02 06:39:22 +00:00
|
|
|
|
|
|
|
S_PauseSounds(0);
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
pub = NUMPAGES;
|
|
|
|
pus = NUMPAGES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (ud.pause_on) return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (sprite[p->i].extra <= 0) return; // if dead...
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_INVENTORY) && p->newowner == -1) // inventory button generates event for selected item
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_INVENTORY,g_player[snum].ps->i,snum) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (p->inven_icon)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2016-04-13 04:03:55 +00:00
|
|
|
case ICON_JETPACK: sb_snum |= BIT(SK_JETPACK); break;
|
|
|
|
case ICON_HOLODUKE: sb_snum |= BIT(SK_HOLODUKE); break;
|
|
|
|
case ICON_HEATS: sb_snum |= BIT(SK_NIGHTVISION); break;
|
|
|
|
case ICON_FIRSTAID: sb_snum |= BIT(SK_MEDKIT); break;
|
|
|
|
case ICON_STEROIDS: sb_snum |= BIT(SK_STEROIDS); break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_NIGHTVISION))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_USENIGHTVISION,g_player[snum].ps->i,snum) == 0
|
2009-12-15 05:53:15 +00:00
|
|
|
&& p->inv_amount[GET_HEATS] > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
p->heat_on = !p->heat_on;
|
2008-11-20 14:06:36 +00:00
|
|
|
P_UpdateScreenPal(p);
|
2012-11-04 23:41:05 +00:00
|
|
|
p->inven_icon = ICON_HEATS;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(NITEVISION_ONOFF,p->i);
|
2012-02-21 19:33:09 +00:00
|
|
|
P_DoQuote(QUOTE_NVG_OFF-!!p->heat_on,p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_STEROIDS))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_USESTEROIDS,g_player[snum].ps->i,snum) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-12-15 05:53:15 +00:00
|
|
|
if (p->inv_amount[GET_STEROIDS] == 400)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-12-15 05:53:15 +00:00
|
|
|
p->inv_amount[GET_STEROIDS]--;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(DUKE_TAKEPILLS,p->i);
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_USED_STEROIDS,p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2009-12-15 05:53:15 +00:00
|
|
|
if (p->inv_amount[GET_STEROIDS] > 0)
|
2012-11-04 23:41:05 +00:00
|
|
|
p->inven_icon = ICON_STEROIDS;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
return; // is there significance to returning?
|
|
|
|
}
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->refresh_inventory)
|
2008-11-20 14:06:36 +00:00
|
|
|
sb_snum |= BIT(SK_INV_LEFT); // emulate move left...
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-05-15 23:39:48 +00:00
|
|
|
if (p->newowner == -1 && (TEST_SYNC_KEY(sb_snum, SK_INV_LEFT) || TEST_SYNC_KEY(sb_snum, SK_INV_RIGHT)))
|
|
|
|
{
|
|
|
|
p->invdisptime = GAMETICSPERSEC*2;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2016-04-13 04:03:55 +00:00
|
|
|
int32_t k = !!(TEST_SYNC_KEY(sb_snum, SK_INV_RIGHT));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-05-15 23:39:48 +00:00
|
|
|
if (p->refresh_inventory) p->refresh_inventory = 0;
|
2016-04-13 04:03:55 +00:00
|
|
|
int32_t dainv = p->inven_icon;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-05-15 23:39:48 +00:00
|
|
|
i = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-05-15 23:39:48 +00:00
|
|
|
CHECKINV1:
|
|
|
|
if (i < 9)
|
|
|
|
{
|
|
|
|
i++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-05-15 23:39:48 +00:00
|
|
|
switch (dainv)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-11-04 23:41:05 +00:00
|
|
|
case ICON_JETPACK:
|
|
|
|
case ICON_SCUBA:
|
|
|
|
case ICON_STEROIDS:
|
|
|
|
case ICON_HOLODUKE:
|
2016-04-13 04:03:55 +00:00
|
|
|
case ICON_HEATS:
|
|
|
|
if (p->inv_amount[icon_to_inv[dainv]] > 0 && i > 1)
|
2012-05-15 23:39:48 +00:00
|
|
|
break;
|
|
|
|
if (k) dainv++;
|
|
|
|
else dainv--;
|
|
|
|
goto CHECKINV1;
|
2012-11-04 23:41:05 +00:00
|
|
|
case ICON_NONE:
|
|
|
|
case ICON_FIRSTAID:
|
2012-05-15 23:39:48 +00:00
|
|
|
if (p->inv_amount[GET_FIRSTAID] > 0 && i > 1)
|
|
|
|
break;
|
|
|
|
if (k) dainv = 2;
|
|
|
|
else dainv = 7;
|
|
|
|
goto CHECKINV1;
|
2012-11-04 23:41:05 +00:00
|
|
|
case ICON_BOOTS:
|
2012-05-15 23:39:48 +00:00
|
|
|
if (p->inv_amount[GET_BOOTS] > 0 && i > 1)
|
|
|
|
break;
|
|
|
|
if (k) dainv = 1;
|
|
|
|
else dainv = 6;
|
|
|
|
goto CHECKINV1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-05-15 23:39:48 +00:00
|
|
|
}
|
|
|
|
else dainv = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-05-15 23:39:48 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_INV_LEFT)) // Inventory_Left
|
|
|
|
{
|
|
|
|
/*Gv_SetVar(g_iReturnVarID,dainv,g_player[snum].ps->i,snum);*/
|
2014-11-22 12:29:25 +00:00
|
|
|
dainv = VM_OnEventWithReturn(EVENT_INVENTORYLEFT,g_player[snum].ps->i,snum, dainv);
|
2012-05-15 23:39:48 +00:00
|
|
|
}
|
|
|
|
else if (TEST_SYNC_KEY(sb_snum, SK_INV_RIGHT)) // Inventory_Right
|
|
|
|
{
|
|
|
|
/*Gv_SetVar(g_iReturnVarID,dainv,g_player[snum].ps->i,snum);*/
|
2014-11-22 12:29:25 +00:00
|
|
|
dainv = VM_OnEventWithReturn(EVENT_INVENTORYRIGHT,g_player[snum].ps->i,snum, dainv);
|
2012-05-15 23:39:48 +00:00
|
|
|
}
|
2009-08-06 10:12:13 +00:00
|
|
|
|
2012-05-15 23:39:48 +00:00
|
|
|
if (dainv >= 1)
|
|
|
|
{
|
|
|
|
p->inven_icon = dainv;
|
|
|
|
|
|
|
|
if (dainv || p->inv_amount[GET_FIRSTAID])
|
|
|
|
{
|
|
|
|
static const int32_t i[8] = { QUOTE_MEDKIT, QUOTE_STEROIDS, QUOTE_HOLODUKE,
|
|
|
|
QUOTE_JETPACK, QUOTE_NVG, QUOTE_SCUBA, QUOTE_BOOTS, 0 };
|
|
|
|
if (dainv>=1 && dainv<=9)
|
|
|
|
P_DoQuote(i[dainv-1], p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2012-05-15 23:39:48 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
j = ((sb_snum&(15<<SK_WEAPON_BITS))>>SK_WEAPON_BITS) - 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2011-03-24 16:55:44 +00:00
|
|
|
switch ((int32_t)j)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2011-03-24 16:55:44 +00:00
|
|
|
case -1:
|
|
|
|
break;
|
2010-05-02 23:27:30 +00:00
|
|
|
default:
|
2014-11-22 12:29:25 +00:00
|
|
|
j = VM_OnEventWithReturn(EVENT_WEAPKEY1+j,p->i,snum, j);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 10:
|
2014-11-22 12:29:25 +00:00
|
|
|
j = VM_OnEventWithReturn(EVENT_PREVIOUSWEAPON,p->i,snum, j);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case 11:
|
2014-11-22 12:29:25 +00:00
|
|
|
j = VM_OnEventWithReturn(EVENT_NEXTWEAPON,p->i,snum, j);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-11-28 21:18:05 +00:00
|
|
|
// NOTE: it is assumed that the above events return either -1 or a
|
|
|
|
// valid weapon index. Presumably, neither other negative numbers nor
|
|
|
|
// positive ones >= MAX_WEAPONS are allowed. However, the code below is
|
|
|
|
// a bit inconsistent in checking "j".
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
if (p->reloading == 1)
|
|
|
|
j = -1;
|
2013-11-28 21:18:05 +00:00
|
|
|
else if ((uint32_t)j < MAX_WEAPONS && p->kickback_pic == 1 && p->weapon_pos == 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
p->wantweaponfire = j;
|
|
|
|
p->kickback_pic = 0;
|
|
|
|
}
|
2013-11-28 21:18:05 +00:00
|
|
|
|
2015-01-11 04:51:17 +00:00
|
|
|
if ((int32_t)j != -1 && p->last_pissed_time <= (GAMETICSPERSEC * 218) && p->show_empty_weapon == 0 &&
|
|
|
|
p->kickback_pic == 0 && p->quick_kick == 0 && sprite[p->i].xrepeat > 32 && p->access_incs == 0 &&
|
|
|
|
p->knee_incs == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-06-27 23:04:57 +00:00
|
|
|
// if( ( p->weapon_pos == 0 || ( p->holster_weapon && p->weapon_pos == WEAPON_POS_LOWER ) ))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (j == 10 || j == 11)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
k = p->curr_weapon;
|
2006-11-14 21:35:50 +00:00
|
|
|
j = (j == 10 ? -1 : 1); // JBF: prev (-1) or next (1) weapon choice
|
2015-01-25 12:16:22 +00:00
|
|
|
i = k;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2015-01-25 12:27:52 +00:00
|
|
|
while ((k >= 0 && k < 11) || (PLUTOPAK && k == GROW_WEAPON))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2015-01-25 12:16:22 +00:00
|
|
|
// this accounts for the expander when handling next/previous
|
2014-10-29 17:08:03 +00:00
|
|
|
|
|
|
|
switch (k)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-10-29 17:08:03 +00:00
|
|
|
case DEVISTATOR_WEAPON:
|
|
|
|
if ((int32_t) j == -1)
|
|
|
|
{
|
2015-01-25 12:16:22 +00:00
|
|
|
if (PLUTOPAK)
|
2014-10-29 17:08:03 +00:00
|
|
|
k = GROW_WEAPON;
|
|
|
|
else
|
2015-01-25 12:16:22 +00:00
|
|
|
k--;
|
2014-10-29 17:08:03 +00:00
|
|
|
}
|
2015-01-25 12:16:22 +00:00
|
|
|
else
|
|
|
|
k++;
|
2014-10-29 17:08:03 +00:00
|
|
|
break;
|
2015-01-25 12:16:22 +00:00
|
|
|
|
2014-10-29 17:08:03 +00:00
|
|
|
case GROW_WEAPON:
|
|
|
|
if ((int32_t)j == -1)
|
2015-01-25 12:16:22 +00:00
|
|
|
k = SHRINKER_WEAPON;
|
|
|
|
else
|
|
|
|
k = DEVISTATOR_WEAPON;
|
2014-10-29 17:08:03 +00:00
|
|
|
break;
|
2015-01-25 12:16:22 +00:00
|
|
|
|
2014-10-29 17:08:03 +00:00
|
|
|
case SHRINKER_WEAPON:
|
|
|
|
if ((int32_t)j == 1)
|
|
|
|
{
|
2015-01-25 12:16:22 +00:00
|
|
|
if (PLUTOPAK)
|
2014-10-29 17:08:03 +00:00
|
|
|
k = GROW_WEAPON;
|
|
|
|
else
|
|
|
|
k++;
|
|
|
|
}
|
2015-01-25 12:16:22 +00:00
|
|
|
else
|
|
|
|
k--;
|
|
|
|
break;
|
|
|
|
|
2015-01-25 12:27:52 +00:00
|
|
|
case HANDREMOTE_WEAPON:
|
|
|
|
i = k = HANDBOMB_WEAPON;
|
2015-01-25 12:16:22 +00:00
|
|
|
default:
|
|
|
|
k += j;
|
2014-10-29 17:08:03 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2014-10-29 17:08:03 +00:00
|
|
|
if (k == -1) k = FREEZE_WEAPON;
|
|
|
|
else if (k == 10) k = KNEE_WEAPON;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2015-02-08 08:03:06 +00:00
|
|
|
if (((p->gotweapon & (1<<k)) && p->ammo_amount[k] > 0) || P_CheckDetonatorSpecialCase(p, k))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
j = k;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-01-25 12:16:22 +00:00
|
|
|
if (i == k) // absolutely no weapons, so use foot
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-29 05:03:02 +00:00
|
|
|
j = KNEE_WEAPON;
|
2006-04-13 20:47:06 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2015-01-25 12:16:22 +00:00
|
|
|
|
|
|
|
if (j == SHRINKER_WEAPON)
|
|
|
|
p->subweapon &= ~(1 << GROW_WEAPON);
|
|
|
|
else if (j == GROW_WEAPON)
|
|
|
|
p->subweapon |= (1<<GROW_WEAPON);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-01-20 21:16:54 +00:00
|
|
|
P_SetWeaponGamevars(snum, p);
|
2010-05-29 05:03:02 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
j = VM_OnEventWithReturn(EVENT_SELECTWEAPON,p->i,snum, j);
|
2010-05-29 05:03:02 +00:00
|
|
|
|
2013-11-28 21:18:05 +00:00
|
|
|
// XXX: any signifcance to "<= MAX_WEAPONS" instead of "<"?
|
2009-07-24 02:31:34 +00:00
|
|
|
if ((int32_t)j != -1 && j <= MAX_WEAPONS)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2015-02-08 08:03:06 +00:00
|
|
|
if (P_CheckDetonatorSpecialCase(p, j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2015-02-08 08:03:06 +00:00
|
|
|
p->gotweapon |= (1<<HANDBOMB_WEAPON);
|
|
|
|
j = HANDREMOTE_WEAPON;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (j == SHRINKER_WEAPON && PLUTOPAK) // JBF 20040116: so we don't select the grower with v1.3d
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (screenpeek == snum) pus = NUMPAGES;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (p->curr_weapon != GROW_WEAPON && p->curr_weapon != SHRINKER_WEAPON)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (p->ammo_amount[GROW_WEAPON] > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if ((p->subweapon&(1<<GROW_WEAPON)) == (1<<GROW_WEAPON))
|
2006-04-13 20:47:06 +00:00
|
|
|
j = GROW_WEAPON;
|
2006-11-13 23:12:47 +00:00
|
|
|
else if (p->ammo_amount[SHRINKER_WEAPON] == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
j = GROW_WEAPON;
|
|
|
|
p->subweapon |= (1<<GROW_WEAPON);
|
|
|
|
}
|
|
|
|
}
|
2006-11-14 21:35:50 +00:00
|
|
|
else if (p->ammo_amount[SHRINKER_WEAPON] > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
p->subweapon &= ~(1<<GROW_WEAPON);
|
|
|
|
}
|
2006-11-14 21:35:50 +00:00
|
|
|
else if (p->curr_weapon == SHRINKER_WEAPON)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
p->subweapon |= (1<<GROW_WEAPON);
|
|
|
|
j = GROW_WEAPON;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p->subweapon &= ~(1<<GROW_WEAPON);
|
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->holster_weapon)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
sb_snum |= BIT(SK_HOLSTER);
|
2013-06-27 23:04:57 +00:00
|
|
|
p->weapon_pos = WEAPON_POS_LOWER;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2013-11-28 21:18:05 +00:00
|
|
|
else if ((uint32_t)j < MAX_WEAPONS && (p->gotweapon & (1<<j)) && (uint32_t)p->curr_weapon != j)
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (j)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case PISTOL_WEAPON:
|
|
|
|
case SHOTGUN_WEAPON:
|
|
|
|
case CHAINGUN_WEAPON:
|
|
|
|
case RPG_WEAPON:
|
|
|
|
case DEVISTATOR_WEAPON:
|
|
|
|
case FREEZE_WEAPON:
|
|
|
|
case GROW_WEAPON:
|
|
|
|
case SHRINKER_WEAPON:
|
|
|
|
if (p->ammo_amount[j] == 0 && p->show_empty_weapon == 0)
|
|
|
|
{
|
|
|
|
p->last_full_weapon = p->curr_weapon;
|
2009-07-24 02:31:34 +00:00
|
|
|
p->show_empty_weapon = 32;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2009-07-24 02:31:34 +00:00
|
|
|
case KNEE_WEAPON:
|
2006-11-16 03:02:42 +00:00
|
|
|
case HANDREMOTE_WEAPON:
|
2015-02-08 08:03:06 +00:00
|
|
|
P_AddWeapon(p, j, 1);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
|
|
|
case HANDBOMB_WEAPON:
|
|
|
|
case TRIPBOMB_WEAPON:
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->ammo_amount[j] > 0 && (p->gotweapon & (1<<j)))
|
2013-12-26 19:45:00 +00:00
|
|
|
P_AddWeapon(p, j, 1);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-13 04:03:59 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_HOLODUKE) && (p->newowner == -1 || p->holoduke_on != -1))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (p->holoduke_on == -1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_HOLODUKEON,g_player[snum].ps->i,snum) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-12-15 05:53:15 +00:00
|
|
|
if (p->inv_amount[GET_HOLODUKE] > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-11-04 23:41:05 +00:00
|
|
|
p->inven_icon = ICON_HOLODUKE;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-07-29 09:57:09 +00:00
|
|
|
if (p->cursectnum > -1)
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->holoduke_on = i = A_InsertSprite(p->cursectnum,p->pos.x,p->pos.y,
|
|
|
|
p->pos.z+(30<<8),APLAYER,-64,0,0,p->ang,0,0,-1,10);
|
2008-07-29 09:57:09 +00:00
|
|
|
T4 = T5 = 0;
|
2014-12-26 17:30:00 +00:00
|
|
|
sprite[i].yvel = snum;
|
2008-07-29 09:57:09 +00:00
|
|
|
sprite[i].extra = 0;
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_HOLODUKE_ON,p);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(TELEPORTER,p->holoduke_on);
|
2008-07-29 09:57:09 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2011-02-25 21:50:19 +00:00
|
|
|
else P_DoQuote(QUOTE_HOLODUKE_NOT_FOUND,p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_HOLODUKEOFF,g_player[snum].ps->i,snum) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(TELEPORTER,p->holoduke_on);
|
2006-04-13 20:47:06 +00:00
|
|
|
p->holoduke_on = -1;
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_HOLODUKE_OFF,p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_MEDKIT))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_USEMEDKIT,g_player[snum].ps->i,snum) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-12-15 05:53:15 +00:00
|
|
|
if (p->inv_amount[GET_FIRSTAID] > 0 && sprite[p->i].extra < p->max_player_health)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2007-08-27 23:11:49 +00:00
|
|
|
j = p->max_player_health-sprite[p->i].extra;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-12-15 05:53:15 +00:00
|
|
|
if ((uint32_t)p->inv_amount[GET_FIRSTAID] > j)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-12-15 05:53:15 +00:00
|
|
|
p->inv_amount[GET_FIRSTAID] -= j;
|
2007-08-27 23:11:49 +00:00
|
|
|
sprite[p->i].extra = p->max_player_health;
|
2012-11-04 23:41:05 +00:00
|
|
|
p->inven_icon = ICON_FIRSTAID;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-12-15 05:53:15 +00:00
|
|
|
sprite[p->i].extra += p->inv_amount[GET_FIRSTAID];
|
|
|
|
p->inv_amount[GET_FIRSTAID] = 0;
|
2008-12-01 10:44:18 +00:00
|
|
|
P_SelectNextInvItem(p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(DUKE_USEMEDKIT,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-13 04:03:59 +00:00
|
|
|
if ((p->newowner == -1 || p->jetpack_on) && TEST_SYNC_KEY(sb_snum, SK_JETPACK))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_USEJETPACK,g_player[snum].ps->i,snum) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-12-15 05:53:15 +00:00
|
|
|
if (p->inv_amount[GET_JETPACK] > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
p->jetpack_on = !p->jetpack_on;
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->jetpack_on)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-11-04 23:41:05 +00:00
|
|
|
p->inven_icon = ICON_JETPACK;
|
2010-06-22 21:50:01 +00:00
|
|
|
if (p->scream_voice > FX_Ok)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
FX_StopSound(p->scream_voice);
|
2009-07-24 02:31:34 +00:00
|
|
|
p->scream_voice = -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(DUKE_JETPACK_ON,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_JETPACK_ON,p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->hard_landing = 0;
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.z = 0;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(DUKE_JETPACK_OFF,p->i);
|
2009-07-15 01:26:38 +00:00
|
|
|
S_StopEnvSound(DUKE_JETPACK_IDLE,p->i);
|
|
|
|
S_StopEnvSound(DUKE_JETPACK_ON,p->i);
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_JETPACK_OFF,p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2011-02-25 21:50:19 +00:00
|
|
|
else P_DoQuote(QUOTE_JETPACK_NOT_FOUND,p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_TURNAROUND) && p->one_eighty_count == 0)
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_TURNAROUND,p->i,snum) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
p->one_eighty_count = -1024;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-13 12:23:18 +00:00
|
|
|
int32_t A_CheckHitSprite(int32_t i, int16_t *hitsp)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2012-08-10 19:12:01 +00:00
|
|
|
hitdata_t hit;
|
2009-01-13 12:23:18 +00:00
|
|
|
int32_t zoff = 0;
|
2006-12-10 06:49:01 +00:00
|
|
|
|
2016-06-21 00:33:45 +00:00
|
|
|
if (A_CheckEnemySprite((tspritetype *) &sprite[i]))
|
2006-12-10 06:49:01 +00:00
|
|
|
zoff = (42<<8);
|
2013-04-15 10:48:09 +00:00
|
|
|
else if (PN == APLAYER)
|
|
|
|
zoff = (39<<8);
|
2006-12-10 06:49:01 +00:00
|
|
|
|
2009-01-13 12:23:18 +00:00
|
|
|
SZ -= zoff;
|
|
|
|
hitscan((const vec3_t *)&sprite[i],SECT,
|
2006-12-10 06:49:01 +00:00
|
|
|
sintable[(SA+512)&2047],
|
|
|
|
sintable[SA&2047],
|
2012-08-10 19:12:01 +00:00
|
|
|
0,&hit,CLIPMASK1);
|
2009-01-13 12:23:18 +00:00
|
|
|
SZ += zoff;
|
2009-08-28 23:08:00 +00:00
|
|
|
|
2013-04-15 10:48:13 +00:00
|
|
|
if (hitsp)
|
|
|
|
*hitsp = hit.sprite;
|
2011-02-25 21:50:19 +00:00
|
|
|
|
2016-06-21 00:33:45 +00:00
|
|
|
if (hit.wall >= 0 && (wall[hit.wall].cstat&16) && A_CheckEnemySprite((tspritetype *) &sprite[i]))
|
2013-04-15 10:48:09 +00:00
|
|
|
return 1<<30;
|
2006-12-10 06:49:01 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
return FindDistance2D(hit.pos.x-SX,hit.pos.y-SY);
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2014-01-31 21:12:55 +00:00
|
|
|
static int32_t P_FindWall(DukePlayer_t *p, int16_t *hitw)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2012-08-10 19:12:01 +00:00
|
|
|
hitdata_t hit;
|
2006-12-10 06:49:01 +00:00
|
|
|
|
2009-01-13 12:23:18 +00:00
|
|
|
hitscan((const vec3_t *)p,p->cursectnum,
|
2006-12-10 06:49:01 +00:00
|
|
|
sintable[(p->ang+512)&2047],
|
|
|
|
sintable[p->ang&2047],
|
2012-08-10 19:12:01 +00:00
|
|
|
0,&hit,CLIPMASK0);
|
2006-12-10 06:49:01 +00:00
|
|
|
|
2012-08-10 19:12:01 +00:00
|
|
|
*hitw = hit.wall;
|
|
|
|
if (hit.wall < 0)
|
2012-02-14 23:14:07 +00:00
|
|
|
return INT32_MAX;
|
2009-01-13 12:23:18 +00:00
|
|
|
|
2013-04-15 10:48:09 +00:00
|
|
|
return FindDistance2D(hit.pos.x-p->pos.x,hit.pos.y-p->pos.y);
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2012-02-20 19:54:24 +00:00
|
|
|
// returns 1 if sprite i should not be considered by neartag
|
|
|
|
static int32_t our_neartag_blacklist(int32_t i)
|
|
|
|
{
|
|
|
|
return sprite[i].picnum >= SECTOREFFECTOR__STATIC && sprite[i].picnum <= GPSPEED__STATIC;
|
|
|
|
}
|
2006-12-10 06:49:01 +00:00
|
|
|
|
2014-01-31 21:12:59 +00:00
|
|
|
static void G_ClearCameras(DukePlayer_t *p)
|
|
|
|
{
|
|
|
|
G_ClearCameraView(p);
|
|
|
|
|
|
|
|
if (I_EscapeTrigger())
|
|
|
|
I_EscapeTriggerClear();
|
|
|
|
}
|
|
|
|
|
2009-02-28 07:44:54 +00:00
|
|
|
void P_CheckSectors(int32_t snum)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
DukePlayer_t *const p = g_player[snum].ps;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-07-29 07:14:54 +00:00
|
|
|
if (p->cursectnum > -1)
|
2008-07-30 02:51:32 +00:00
|
|
|
switch (sector[p->cursectnum].lotag)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2008-07-30 02:51:32 +00:00
|
|
|
case 32767:
|
2006-11-15 01:16:55 +00:00
|
|
|
sector[p->cursectnum].lotag = 0;
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_FOUND_SECRET,p);
|
2008-07-30 02:51:32 +00:00
|
|
|
p->secret_rooms++;
|
|
|
|
return;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2012-11-15 14:28:18 +00:00
|
|
|
case UINT16_MAX:
|
2008-07-30 02:51:32 +00:00
|
|
|
sector[p->cursectnum].lotag = 0;
|
2015-12-04 11:52:51 +00:00
|
|
|
P_EndLevel();
|
2008-07-30 02:51:32 +00:00
|
|
|
return;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2012-11-15 14:28:18 +00:00
|
|
|
case UINT16_MAX-1:
|
2008-07-30 02:51:32 +00:00
|
|
|
sector[p->cursectnum].lotag = 0;
|
2009-04-26 05:57:42 +00:00
|
|
|
p->timebeforeexit = GAMETICSPERSEC*8;
|
2008-07-30 02:51:32 +00:00
|
|
|
p->customexitsound = sector[p->cursectnum].hitag;
|
|
|
|
return;
|
2014-01-31 21:12:55 +00:00
|
|
|
|
2008-07-30 02:51:32 +00:00
|
|
|
default:
|
|
|
|
if (sector[p->cursectnum].lotag >= 10000 && sector[p->cursectnum].lotag < 16383)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (snum == screenpeek || (GametypeFlags[ud.coop]&GAMETYPE_COOPSOUND))
|
|
|
|
A_PlaySound(sector[p->cursectnum].lotag-10000,p->i);
|
2008-07-30 02:51:32 +00:00
|
|
|
sector[p->cursectnum].lotag = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
//After this point the the player effects the map with space
|
|
|
|
|
2014-01-31 21:12:55 +00:00
|
|
|
if (p->gm &MODE_TYPE || sprite[p->i].extra <= 0)
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (TEST_SYNC_KEY(g_player[snum].sync->bits, SK_OPEN))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_USE, p->i, snum) != 0)
|
2008-11-20 14:06:36 +00:00
|
|
|
g_player[snum].sync->bits &= ~BIT(SK_OPEN);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (ud.cashman && TEST_SYNC_KEY(g_player[snum].sync->bits, SK_OPEN))
|
|
|
|
A_SpawnMultiple(p->i, MONEY, 2);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->newowner >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2007-08-27 06:46:31 +00:00
|
|
|
if (klabs(g_player[snum].sync->svel) > 768 || klabs(g_player[snum].sync->fvel) > 768)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:59 +00:00
|
|
|
G_ClearCameras(p);
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (!TEST_SYNC_KEY(g_player[snum].sync->bits, SK_OPEN) && !TEST_SYNC_KEY(g_player[snum].sync->bits, SK_ESCAPE))
|
2006-04-13 20:47:06 +00:00
|
|
|
p->toggle_key_flag = 0;
|
2006-11-13 23:12:47 +00:00
|
|
|
else if (!p->toggle_key_flag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:59 +00:00
|
|
|
int16_t hitscanwall;
|
|
|
|
|
2014-01-31 21:13:00 +00:00
|
|
|
int16_t neartagsector, neartagwall, neartagsprite;
|
|
|
|
int32_t neartaghitdist;
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (TEST_SYNC_KEY(g_player[snum].sync->bits, SK_ESCAPE))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (p->newowner >= 0)
|
2014-01-31 21:12:59 +00:00
|
|
|
G_ClearCameras(p);
|
2006-04-13 20:47:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
neartagsprite = -1;
|
|
|
|
p->toggle_key_flag = 1;
|
|
|
|
hitscanwall = -1;
|
|
|
|
|
2015-12-04 11:52:51 +00:00
|
|
|
int32_t i = P_FindWall(p,&hitscanwall);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-02-14 23:14:07 +00:00
|
|
|
if (hitscanwall >= 0 && i < 1280 && wall[hitscanwall].overpicnum == MIRROR)
|
2008-11-20 14:06:36 +00:00
|
|
|
if (wall[hitscanwall].lotag > 0 && !A_CheckSoundPlaying(p->i,wall[hitscanwall].lotag) && snum == screenpeek)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(wall[hitscanwall].lotag,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (hitscanwall >= 0 && (wall[hitscanwall].cstat&16))
|
2014-01-31 21:12:56 +00:00
|
|
|
if (wall[hitscanwall].lotag)
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->newowner >= 0)
|
2012-02-20 19:54:24 +00:00
|
|
|
neartag(p->opos.x,p->opos.y,p->opos.z,sprite[p->i].sectnum,p->oang,&neartagsector,
|
|
|
|
&neartagwall,&neartagsprite,&neartaghitdist, 1280, 1, our_neartag_blacklist);
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
|
|
|
{
|
2012-02-20 19:54:24 +00:00
|
|
|
neartag(p->pos.x,p->pos.y,p->pos.z,sprite[p->i].sectnum,p->oang,&neartagsector,
|
|
|
|
&neartagwall,&neartagsprite,&neartaghitdist, 1280, 1, our_neartag_blacklist);
|
2006-11-13 23:12:47 +00:00
|
|
|
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
|
2012-02-20 19:54:24 +00:00
|
|
|
neartag(p->pos.x,p->pos.y,p->pos.z+(8<<8),sprite[p->i].sectnum,p->oang,&neartagsector,
|
|
|
|
&neartagwall,&neartagsprite,&neartaghitdist, 1280, 1, our_neartag_blacklist);
|
2006-11-13 23:12:47 +00:00
|
|
|
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
|
2012-02-20 19:54:24 +00:00
|
|
|
neartag(p->pos.x,p->pos.y,p->pos.z+(16<<8),sprite[p->i].sectnum,p->oang,&neartagsector,
|
|
|
|
&neartagwall,&neartagsprite,&neartaghitdist, 1280, 1, our_neartag_blacklist);
|
2006-11-13 23:12:47 +00:00
|
|
|
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-02-20 19:54:24 +00:00
|
|
|
neartag(p->pos.x,p->pos.y,p->pos.z+(16<<8),sprite[p->i].sectnum,p->oang,&neartagsector,
|
|
|
|
&neartagwall,&neartagsprite,&neartaghitdist, 1280, 3, our_neartag_blacklist);
|
2006-11-13 23:12:47 +00:00
|
|
|
if (neartagsprite >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(sprite[neartagsprite].picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case FEM1__STATIC:
|
|
|
|
case FEM2__STATIC:
|
|
|
|
case FEM3__STATIC:
|
|
|
|
case FEM4__STATIC:
|
|
|
|
case FEM5__STATIC:
|
|
|
|
case FEM6__STATIC:
|
|
|
|
case FEM7__STATIC:
|
|
|
|
case FEM8__STATIC:
|
|
|
|
case FEM9__STATIC:
|
|
|
|
case FEM10__STATIC:
|
|
|
|
case PODFEM1__STATIC:
|
|
|
|
case NAKED1__STATIC:
|
|
|
|
case STATUE__STATIC:
|
|
|
|
case TOUGHGAL__STATIC:
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
neartagsprite = -1;
|
|
|
|
neartagwall = -1;
|
|
|
|
neartagsector = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (p->newowner == -1 && neartagsprite == -1 && neartagsector == -1 && neartagwall == -1)
|
|
|
|
if (isanunderoperator(sector[sprite[p->i].sectnum].lotag))
|
2006-04-13 20:47:06 +00:00
|
|
|
neartagsector = sprite[p->i].sectnum;
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (neartagsector >= 0 && (sector[neartagsector].lotag&16384))
|
2006-04-13 20:47:06 +00:00
|
|
|
return;
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (neartagsprite == -1 && neartagwall == -1)
|
2012-02-14 23:13:38 +00:00
|
|
|
if (p->cursectnum >= 0 && sector[p->cursectnum].lotag == 2)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
int32_t oldz = A_CheckHitSprite(p->i,&neartagsprite);
|
|
|
|
if (oldz > 1280)
|
|
|
|
neartagsprite = -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (neartagsprite >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:55 +00:00
|
|
|
if (P_ActivateSwitch(snum, neartagsprite, 1))
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(sprite[neartagsprite].picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case TOILET__STATIC:
|
|
|
|
case STALL__STATIC:
|
|
|
|
if (p->last_pissed_time == 0)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (ud.lockout == 0) A_PlaySound(DUKE_URINATE,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
p->last_pissed_time = GAMETICSPERSEC*220;
|
2006-11-16 03:02:42 +00:00
|
|
|
p->transporter_hold = 29*2;
|
|
|
|
if (p->holster_weapon == 0)
|
|
|
|
{
|
|
|
|
p->holster_weapon = 1;
|
|
|
|
p->weapon_pos = -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2007-08-27 23:11:49 +00:00
|
|
|
if (sprite[p->i].extra <= (p->max_player_health-(p->max_player_health/10)))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2007-08-27 23:11:49 +00:00
|
|
|
sprite[p->i].extra += p->max_player_health/10;
|
2006-11-16 03:02:42 +00:00
|
|
|
p->last_extra = sprite[p->i].extra;
|
|
|
|
}
|
2007-08-27 23:11:49 +00:00
|
|
|
else if (sprite[p->i].extra < p->max_player_health)
|
|
|
|
sprite[p->i].extra = p->max_player_health;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (!A_CheckSoundPlaying(neartagsprite,FLUSH_TOILET))
|
|
|
|
A_PlaySound(FLUSH_TOILET,neartagsprite);
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case NUKEBUTTON__STATIC:
|
2014-01-31 21:12:56 +00:00
|
|
|
{
|
|
|
|
int16_t j;
|
|
|
|
|
|
|
|
P_FindWall(p, &j);
|
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
if (j >= 0 && wall[j].overpicnum == 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[neartagsprite].t_data[0] == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2010-01-16 23:08:17 +00:00
|
|
|
if (ud.noexits && (g_netServer || ud.multimode > 1))
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2009-08-28 23:08:00 +00:00
|
|
|
// NUKEBUTTON frags the player
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[p->i].picnum = NUKEBUTTON;
|
|
|
|
actor[p->i].extra = 250;
|
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
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[neartagsprite].t_data[0] = 1;
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[neartagsprite].owner = p->i;
|
2010-05-02 23:27:30 +00:00
|
|
|
ud.secretlevel =
|
|
|
|
(p->buttonpalette = sprite[neartagsprite].pal) ? sprite[neartagsprite].lotag : 0;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2014-01-31 21:12:56 +00:00
|
|
|
}
|
2009-08-28 23:08:00 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case WATERFOUNTAIN__STATIC:
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[neartagsprite].t_data[0] != 1)
|
2006-11-13 23:12:47 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[neartagsprite].t_data[0] = 1;
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[neartagsprite].owner = p->i;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2007-08-27 23:11:49 +00:00
|
|
|
if (sprite[p->i].extra < p->max_player_health)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[p->i].extra++;
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(DUKE_DRINKING,p->i);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
2009-08-28 23:08:00 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case PLUG__STATIC:
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(SHORT_CIRCUIT,p->i);
|
|
|
|
sprite[p->i].extra -= 2+(krand()&3);
|
2012-05-05 22:24:50 +00:00
|
|
|
|
|
|
|
P_PalFrom(p, 32, 48,48,64);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2009-08-28 23:08:00 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
case VIEWSCREEN__STATIC:
|
|
|
|
case VIEWSCREEN2__STATIC:
|
2012-11-10 14:11:07 +00:00
|
|
|
// Try to find a camera sprite for the viewscreen.
|
|
|
|
for (SPRITES_OF(STAT_ACTOR, i))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
|
|
|
if (PN == CAMERA1 && SP == 0 && sprite[neartagsprite].hitag == SLT)
|
|
|
|
{
|
2014-12-26 17:30:00 +00:00
|
|
|
sprite[i].yvel = 1; // Using this camera
|
2009-07-31 11:45:29 +00:00
|
|
|
A_PlaySound(MONITOR_ACTIVE,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
sprite[neartagsprite].owner = i;
|
2014-12-26 17:30:00 +00:00
|
|
|
sprite[neartagsprite].yvel = 1; // VIEWSCREEN_YVEL
|
|
|
|
g_curViewscreen = neartagsprite;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
{
|
|
|
|
int32_t j = p->cursectnum;
|
|
|
|
p->cursectnum = SECT;
|
|
|
|
P_UpdateScreenPal(p);
|
|
|
|
p->cursectnum = j;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
// parallaxtype = 2;
|
|
|
|
p->newowner = i;
|
2012-11-10 14:11:07 +00:00
|
|
|
|
2012-11-11 17:56:57 +00:00
|
|
|
P_UpdatePosWhenViewingCam(p);
|
2012-11-10 14:11:07 +00:00
|
|
|
|
2006-11-16 03:02:42 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-31 21:12:59 +00:00
|
|
|
G_ClearCameras(p);
|
|
|
|
return;
|
2014-01-31 21:12:55 +00:00
|
|
|
} // switch
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
if (TEST_SYNC_KEY(g_player[snum].sync->bits, SK_OPEN) == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (p->newowner >= 0)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2014-01-31 21:12:59 +00:00
|
|
|
G_ClearCameras(p);
|
|
|
|
return;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (neartagwall == -1 && neartagsector == -1 && neartagsprite == -1)
|
2008-11-20 14:06:36 +00:00
|
|
|
if (klabs(A_GetHitscanRange(p->i)) < 512)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if ((krand()&255) < 16)
|
|
|
|
A_PlaySound(DUKE_SEARCH2,p->i);
|
|
|
|
else A_PlaySound(DUKE_SEARCH,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (neartagwall >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (wall[neartagwall].lotag > 0 && CheckDoorTile(wall[neartagwall].picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (hitscanwall == neartagwall || hitscanwall == -1)
|
2008-11-20 14:06:36 +00:00
|
|
|
P_ActivateSwitch(snum,neartagwall,0);
|
2006-04-13 20:47:06 +00:00
|
|
|
return;
|
|
|
|
}
|
2006-11-13 23:12:47 +00:00
|
|
|
else if (p->newowner >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:59 +00:00
|
|
|
G_ClearCameras(p);
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-31 21:12:56 +00:00
|
|
|
if (neartagsector >= 0 && (sector[neartagsector].lotag&16384) == 0 &&
|
|
|
|
isanearoperator(sector[neartagsector].lotag))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2015-12-04 11:52:51 +00:00
|
|
|
int32_t i;
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF_SECT(neartagsector, i))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (PN == ACTIVATOR || PN == MASTERSWITCH)
|
2006-04-13 20:47:06 +00:00
|
|
|
return;
|
|
|
|
}
|
2014-01-31 21:12:56 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
G_OperateSectors(neartagsector,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-14 21:35:50 +00:00
|
|
|
else if ((sector[sprite[p->i].sectnum].lotag&16384) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (isanunderoperator(sector[sprite[p->i].sectnum].lotag))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
for (SPRITES_OF_SECT(sprite[p->i].sectnum, i))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-01-31 21:12:56 +00:00
|
|
|
if (PN == ACTIVATOR || PN == MASTERSWITCH)
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2014-01-31 21:12:56 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
G_OperateSectors(sprite[p->i].sectnum,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else P_ActivateSwitch(snum,neartagwall,0);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|