sector.c: cleanup round 3, P_ActivateSwitch() refactoring.

git-svn-id: https://svn.eduke32.com/eduke32@4282 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-01-31 21:12:58 +00:00
parent ab5c89430c
commit 6de687ba86

View file

@ -384,15 +384,13 @@ void G_AnimateCamSprite(void)
void G_AnimateWalls(void) void G_AnimateWalls(void)
{ {
int32_t i, j, p = g_numAnimWalls-1, t; int32_t p = g_numAnimWalls-1;
for (; p>=0; p--) for (; p>=0; p--)
// for(p=g_numAnimWalls-1;p>=0;p--)
{ {
i = animwall[p].wallnum; const int32_t i = animwall[p].wallnum;
j = wall[i].picnum;
switch (DYNAMICTILEMAP(j)) switch (DYNAMICTILEMAP(wall[i].picnum))
{ {
case SCREENBREAK1__STATIC: case SCREENBREAK1__STATIC:
case SCREENBREAK2__STATIC: case SCREENBREAK2__STATIC:
@ -433,12 +431,11 @@ void G_AnimateWalls(void)
wall[i].picnum = SCREENBREAK6; wall[i].picnum = SCREENBREAK6;
} }
continue; continue;
} }
if ((wall[i].cstat&16) && G_GetForcefieldPicnum(i)==W_FORCEFIELD) if ((wall[i].cstat&16) && G_GetForcefieldPicnum(i)==W_FORCEFIELD)
{ {
t = animwall[p].tag; const int32_t t = animwall[p].tag;
if (wall[i].cstat&254) if (wall[i].cstat&254)
{ {
@ -1076,24 +1073,105 @@ void G_OperateForceFields(int32_t s, int32_t low)
} }
} }
int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchissprite) // 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 switchpal, switchpicnum; int32_t i;
int32_t i, x, lotag,hitag,picnum,correctdips = 1, numdips = 0;
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)
{
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;
vec3_t davector; vec3_t davector;
if (w < 0) return 0; int32_t switchpicnum;
int32_t i, correctdips = 1, numdips = 0;
if (w < 0)
return 0;
if (switchissprite == 1) // A wall sprite if (switchissprite == 1) // A wall sprite
{ {
if (actor[w].lasttransport == totalclock) return 0; if (actor[w].lasttransport == totalclock)
return 0;
actor[w].lasttransport = totalclock; actor[w].lasttransport = totalclock;
lotag = sprite[w].lotag; lotag = sprite[w].lotag;
if (lotag == 0) return 0; if (lotag == 0)
return 0;
hitag = sprite[w].hitag; hitag = sprite[w].hitag;
// sx = sprite[w].x;
// sy = sprite[w].y;
Bmemcpy(&davector, &sprite[w], sizeof(vec3_t)); Bmemcpy(&davector, &sprite[w], sizeof(vec3_t));
picnum = sprite[w].picnum; picnum = sprite[w].picnum;
switchpal = sprite[w].pal; switchpal = sprite[w].pal;
@ -1101,76 +1179,46 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchissprite)
else else
{ {
lotag = wall[w].lotag; lotag = wall[w].lotag;
if (lotag == 0) return 0; if (lotag == 0)
return 0;
hitag = wall[w].hitag; hitag = wall[w].hitag;
// sx = wall[w].x;
// sy = wall[w].y;
Bmemcpy(&davector, &wall[w], sizeof(int32_t) * 2); Bmemcpy(&davector, &wall[w], sizeof(int32_t) * 2);
davector.z = g_player[snum].ps->pos.z; davector.z = g_player[snum].ps->pos.z;
picnum = wall[w].picnum; picnum = wall[w].picnum;
switchpal = wall[w].pal; switchpal = wall[w].pal;
} }
// initprintf("P_ActivateSwitch called picnum=%i switchissprite=%i\n",picnum,switchissprite);
switchpicnum = picnum; // initprintf("P_ActivateSwitch called picnum=%i switchissprite=%i\n",picnum,switchissprite);
if ((picnum==DIPSWITCH+1)
|| (picnum==TECHSWITCH+1) switchpicnum = G_GetBaseSwitch(picnum);
|| (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)
|| (picnum==LIGHTSWITCH+1)
)
{
switchpicnum--;
}
if (picnum > MULTISWITCH && picnum <= MULTISWITCH+3)
{
switchpicnum = MULTISWITCH;
}
switch (DYNAMICTILEMAP(switchpicnum)) switch (DYNAMICTILEMAP(switchpicnum))
{ {
case DIPSWITCH__STATIC: case DIPSWITCH_LIKE_CASES:
// case DIPSWITCH+1:
case TECHSWITCH__STATIC:
// case TECHSWITCH+1:
case ALIENSWITCH__STATIC:
// case ALIENSWITCH+1:
break; break;
case ACCESSSWITCH__STATIC:
case ACCESSSWITCH2__STATIC: case ACCESSSWITCH_CASES:
if (g_player[snum].ps->access_incs == 0) if (g_player[snum].ps->access_incs == 0)
{ {
if (switchpal == 0) int32_t pp;
{
if ((g_player[snum].ps->got_access&1))
g_player[snum].ps->access_incs = 1;
else P_DoQuote(QUOTE_NEED_BLUE_KEY,g_player[snum].ps);
}
else if (switchpal == 21) static const int32_t key_switchpal[3] = { 0, 21, 23 };
{ static const int32_t need_key_quote[3] = {
if (g_player[snum].ps->got_access&2) QUOTE_NEED_BLUE_KEY, QUOTE_NEED_RED_KEY, QUOTE_NEED_YELLOW_KEY
g_player[snum].ps->access_incs = 1; };
else P_DoQuote(QUOTE_NEED_RED_KEY,g_player[snum].ps);
}
else if (switchpal == 23) for (pp=0; pp<2; pp++)
{ if (switchpal == key_switchpal[pp])
if (g_player[snum].ps->got_access&4) {
g_player[snum].ps->access_incs = 1; if (g_player[snum].ps->got_access & (1<<pp))
else P_DoQuote(QUOTE_NEED_YELLOW_KEY,g_player[snum].ps); g_player[snum].ps->access_incs = 1;
} else
P_DoQuote(need_key_quote[pp], g_player[snum].ps);
break;
}
if (g_player[snum].ps->access_incs == 1) if (g_player[snum].ps->access_incs == 1)
{ {
@ -1182,183 +1230,115 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchissprite)
return 0; return 0;
} }
case DIPSWITCH2__STATIC: /* fall-through (XXX: intended?) */
//case DIPSWITCH2+1:
case DIPSWITCH3__STATIC:
//case DIPSWITCH3+1:
case MULTISWITCH__STATIC: case MULTISWITCH__STATIC:
//case MULTISWITCH+1: case REST_SWITCH_CASES:
//case MULTISWITCH+2: if (G_CheckActivatorMotion(lotag))
//case MULTISWITCH+3: return 0;
case PULLSWITCH__STATIC:
//case PULLSWITCH+1:
case HANDSWITCH__STATIC:
//case HANDSWITCH+1:
case SLOTDOOR__STATIC:
//case SLOTDOOR+1:
case LIGHTSWITCH__STATIC:
//case LIGHTSWITCH+1:
case SPACELIGHTSWITCH__STATIC:
//case SPACELIGHTSWITCH+1:
case SPACEDOORSWITCH__STATIC:
//case SPACEDOORSWITCH+1:
case FRANKENSTINESWITCH__STATIC:
//case FRANKENSTINESWITCH+1:
case LIGHTSWITCH2__STATIC:
//case LIGHTSWITCH2+1:
case POWERSWITCH1__STATIC:
//case POWERSWITCH1+1:
case LOCKSWITCH1__STATIC:
//case LOCKSWITCH1+1:
case POWERSWITCH2__STATIC:
//case POWERSWITCH2+1:
if (G_CheckActivatorMotion(lotag)) return 0;
break; break;
default: default:
if (CheckDoorTile(picnum) == 0) return 0; if (CheckDoorTile(picnum) == 0)
return 0;
break; break;
} }
i = headspritestat[STAT_DEFAULT]; for (SPRITES_OF(STAT_DEFAULT, i))
while (i >= 0)
{ {
if (lotag == SLT) if (lotag == SLT)
{ {
int32_t switchpicnum=PN; // put it in a variable so later switches don't trigger on the result of changes // Put the tile number into a variable so later switches don't
if ((switchpicnum >= MULTISWITCH) && (switchpicnum <=MULTISWITCH+3)) // trigger on the result of changes:
const int32_t switchpic = PN;
if (switchpic >= MULTISWITCH && switchpic <= MULTISWITCH+3)
{ {
sprite[i].picnum++; sprite[i].picnum++;
if (sprite[i].picnum > (MULTISWITCH+3)) if (sprite[i].picnum > MULTISWITCH+3)
sprite[i].picnum = MULTISWITCH; sprite[i].picnum = MULTISWITCH;
} }
switch (DYNAMICTILEMAP(switchpicnum))
switch (DYNAMICTILEMAP(switchpic))
{ {
case DIPSWITCH__STATIC: case DIPSWITCH_LIKE_CASES:
case TECHSWITCH__STATIC: if (switchissprite == 1 && w == i)
case ALIENSWITCH__STATIC: PN++;
if (switchissprite == 1 && w == i) PN++; else if (SHT == 0)
else if (SHT == 0) correctdips++; correctdips++;
numdips++; numdips++;
break; break;
case ACCESSSWITCH__STATIC:
case ACCESSSWITCH2__STATIC: case ACCESSSWITCH_CASES:
case SLOTDOOR__STATIC: case REST_SWITCH_CASES:
case LIGHTSWITCH__STATIC:
case SPACELIGHTSWITCH__STATIC:
case SPACEDOORSWITCH__STATIC:
case FRANKENSTINESWITCH__STATIC:
case LIGHTSWITCH2__STATIC:
case POWERSWITCH1__STATIC:
case LOCKSWITCH1__STATIC:
case POWERSWITCH2__STATIC:
case HANDSWITCH__STATIC:
case PULLSWITCH__STATIC:
case DIPSWITCH2__STATIC:
case DIPSWITCH3__STATIC:
sprite[i].picnum++; sprite[i].picnum++;
break; break;
default: default:
if (switchpicnum <= 0) // oob safety if (switchpic <= 0) // oob safety
break; break;
switch (DYNAMICTILEMAP(switchpicnum-1)) switch (DYNAMICTILEMAP(switchpic-1))
{ {
case TECHSWITCH__STATIC: case DIPSWITCH_LIKE_CASES:
case DIPSWITCH__STATIC: if (switchissprite == 1 && w == i)
case ALIENSWITCH__STATIC: PN--;
if (switchissprite == 1 && w == i) PN--; else if (SHT == 1)
else if (SHT == 1) correctdips++; correctdips++;
numdips++; numdips++;
break; break;
case PULLSWITCH__STATIC:
case HANDSWITCH__STATIC: case REST_SWITCH_CASES:
case LIGHTSWITCH2__STATIC:
case POWERSWITCH1__STATIC:
case LOCKSWITCH1__STATIC:
case POWERSWITCH2__STATIC:
case SLOTDOOR__STATIC:
case LIGHTSWITCH__STATIC:
case SPACELIGHTSWITCH__STATIC:
case SPACEDOORSWITCH__STATIC:
case FRANKENSTINESWITCH__STATIC:
case DIPSWITCH2__STATIC:
case DIPSWITCH3__STATIC:
sprite[i].picnum--; sprite[i].picnum--;
break; break;
} }
break; break;
} }
} }
i = nextspritestat[i];
} }
for (i=numwalls-1; i>=0; i--) for (i=numwalls-1; i>=0; i--)
{ {
x = i; const int32_t x = i;
if (lotag == wall[x].lotag) if (lotag == wall[x].lotag)
{ {
if ((wall[x].picnum >= MULTISWITCH) && (wall[x].picnum <=MULTISWITCH+3)) if (wall[x].picnum >= MULTISWITCH && wall[x].picnum <= MULTISWITCH+3)
{ {
wall[x].picnum++; wall[x].picnum++;
if (wall[x].picnum > (MULTISWITCH+3)) if (wall[x].picnum > MULTISWITCH+3)
wall[x].picnum = MULTISWITCH; wall[x].picnum = MULTISWITCH;
} }
switch (DYNAMICTILEMAP(wall[x].picnum)) switch (DYNAMICTILEMAP(wall[x].picnum))
{ {
case DIPSWITCH__STATIC: case DIPSWITCH_LIKE_CASES:
case TECHSWITCH__STATIC: if (switchissprite == 0 && i == w)
case ALIENSWITCH__STATIC: wall[x].picnum++;
if (switchissprite == 0 && i == w) wall[x].picnum++; else if (wall[x].hitag == 0)
else if (wall[x].hitag == 0) correctdips++; correctdips++;
numdips++; numdips++;
break; break;
case ACCESSSWITCH__STATIC:
case ACCESSSWITCH2__STATIC: case ACCESSSWITCH_CASES:
case SLOTDOOR__STATIC: case REST_SWITCH_CASES:
case LIGHTSWITCH__STATIC:
case SPACELIGHTSWITCH__STATIC:
case SPACEDOORSWITCH__STATIC:
case FRANKENSTINESWITCH__STATIC:
case LIGHTSWITCH2__STATIC:
case POWERSWITCH1__STATIC:
case LOCKSWITCH1__STATIC:
case POWERSWITCH2__STATIC:
case HANDSWITCH__STATIC:
case PULLSWITCH__STATIC:
case DIPSWITCH2__STATIC:
case DIPSWITCH3__STATIC:
wall[x].picnum++; wall[x].picnum++;
break; break;
default: default:
if (wall[x].picnum <= 0) // oob safety if (wall[x].picnum <= 0) // oob safety
break; break;
switch (DYNAMICTILEMAP(wall[x].picnum-1)) switch (DYNAMICTILEMAP(wall[x].picnum-1))
{ {
case TECHSWITCH__STATIC: case DIPSWITCH_LIKE_CASES:
case DIPSWITCH__STATIC: if (switchissprite == 0 && i == w)
case ALIENSWITCH__STATIC: wall[x].picnum--;
if (switchissprite == 0 && i == w) wall[x].picnum--; else if (wall[x].hitag == 1)
else if (wall[x].hitag == 1) correctdips++; correctdips++;
numdips++; numdips++;
break; break;
case PULLSWITCH__STATIC:
case HANDSWITCH__STATIC: case REST_SWITCH_CASES:
case LIGHTSWITCH2__STATIC:
case POWERSWITCH1__STATIC:
case LOCKSWITCH1__STATIC:
case POWERSWITCH2__STATIC:
case SLOTDOOR__STATIC:
case LIGHTSWITCH__STATIC:
case SPACELIGHTSWITCH__STATIC:
case SPACEDOORSWITCH__STATIC:
case FRANKENSTINESWITCH__STATIC:
case DIPSWITCH2__STATIC:
case DIPSWITCH3__STATIC:
wall[x].picnum--; wall[x].picnum--;
break; break;
} }
@ -1388,104 +1368,50 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchissprite)
return 1; return 1;
} }
switchpicnum = picnum; switchpicnum = G_GetBaseSwitch(picnum);
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)
|| (picnum==LIGHTSWITCH+1)
)
{
switchpicnum--;
}
if (picnum > MULTISWITCH && picnum <= MULTISWITCH+3)
{
switchpicnum = MULTISWITCH;
}
switch (DYNAMICTILEMAP(switchpicnum)) switch (DYNAMICTILEMAP(switchpicnum))
{ {
default: default:
if (CheckDoorTile(picnum) == 0) break; if (CheckDoorTile(picnum) == 0)
case DIPSWITCH__STATIC: break;
//case DIPSWITCH+1: /* fall-through */
case TECHSWITCH__STATIC: case DIPSWITCH_LIKE_CASES:
//case TECHSWITCH+1: if (G_IsLikeDipswitch(picnum))
case ALIENSWITCH__STATIC:
//case ALIENSWITCH+1:
if (picnum == DIPSWITCH || picnum == DIPSWITCH+1 ||
picnum == ALIENSWITCH || picnum == ALIENSWITCH+1 ||
picnum == TECHSWITCH || picnum == TECHSWITCH+1)
{ {
if (picnum == ALIENSWITCH || picnum == ALIENSWITCH+1) if (picnum == ALIENSWITCH || picnum == ALIENSWITCH+1)
{ {
if (switchissprite == 1) if (switchissprite == 1)
S_PlaySound3D(ALIEN_SWITCH1, w, &davector); S_PlaySound3D(ALIEN_SWITCH1, w, &davector);
else S_PlaySound3D(ALIEN_SWITCH1,g_player[snum].ps->i,&davector); else
S_PlaySound3D(ALIEN_SWITCH1, g_player[snum].ps->i, &davector);
} }
else else
{ {
if (switchissprite == 1) if (switchissprite == 1)
S_PlaySound3D(SWITCH_ON, w, &davector); S_PlaySound3D(SWITCH_ON, w, &davector);
else S_PlaySound3D(SWITCH_ON,g_player[snum].ps->i,&davector); else
S_PlaySound3D(SWITCH_ON, g_player[snum].ps->i, &davector);
} }
if (numdips != correctdips) break;
S_PlaySound3D(END_OF_LEVEL_WARN,g_player[snum].ps->i,&davector); if (numdips != correctdips)
break;
S_PlaySound3D(END_OF_LEVEL_WARN, g_player[snum].ps->i, &davector);
} }
case DIPSWITCH2__STATIC: /* fall-through */
//case DIPSWITCH2+1: case ACCESSSWITCH_CASES:
case DIPSWITCH3__STATIC:
//case DIPSWITCH3+1:
case MULTISWITCH__STATIC: case MULTISWITCH__STATIC:
//case MULTISWITCH+1: case REST_SWITCH_CASES:
//case MULTISWITCH+2: {
//case MULTISWITCH+3: int32_t x;
case ACCESSSWITCH__STATIC:
case ACCESSSWITCH2__STATIC:
case SLOTDOOR__STATIC:
//case SLOTDOOR+1:
case LIGHTSWITCH__STATIC:
//case LIGHTSWITCH+1:
case SPACELIGHTSWITCH__STATIC:
//case SPACELIGHTSWITCH+1:
case SPACEDOORSWITCH__STATIC:
//case SPACEDOORSWITCH+1:
case FRANKENSTINESWITCH__STATIC:
//case FRANKENSTINESWITCH+1:
case LIGHTSWITCH2__STATIC:
//case LIGHTSWITCH2+1:
case POWERSWITCH1__STATIC:
//case POWERSWITCH1+1:
case LOCKSWITCH1__STATIC:
//case LOCKSWITCH1+1:
case POWERSWITCH2__STATIC:
//case POWERSWITCH2+1:
case HANDSWITCH__STATIC:
//case HANDSWITCH+1:
case PULLSWITCH__STATIC:
//case PULLSWITCH+1:
if (picnum == MULTISWITCH || picnum == (MULTISWITCH+1) || if (picnum >= MULTISWITCH && picnum <= MULTISWITCH+3)
picnum == (MULTISWITCH+2) || picnum == (MULTISWITCH+3)) lotag += picnum - MULTISWITCH;
lotag += picnum-MULTISWITCH;
x = headspritestat[STAT_EFFECTOR]; for (SPRITES_OF(STAT_EFFECTOR, x))
while (x >= 0)
{ {
if (((sprite[x].hitag) == lotag)) if (sprite[x].hitag == lotag)
{ {
switch (sprite[x].lotag) switch (sprite[x].lotag)
{ {
@ -1494,47 +1420,49 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchissprite)
actor[x].t_data[0]++; actor[x].t_data[0]++;
if (actor[x].t_data[0] == 2) if (actor[x].t_data[0] == 2)
actor[x].t_data[0]++; actor[x].t_data[0]++;
break; break;
case SE_24_CONVEYOR: case SE_24_CONVEYOR:
case SE_34: case SE_34:
case SE_25_PISTON: case SE_25_PISTON:
actor[x].t_data[4] = !actor[x].t_data[4]; actor[x].t_data[4] = !actor[x].t_data[4];
if (actor[x].t_data[4]) P_DoQuote(actor[x].t_data[4] ? QUOTE_DEACTIVATED : QUOTE_ACTIVATED,
P_DoQuote(QUOTE_DEACTIVATED,g_player[snum].ps); g_player[snum].ps);
else P_DoQuote(QUOTE_ACTIVATED,g_player[snum].ps);
break; break;
case SE_21_DROP_FLOOR: case SE_21_DROP_FLOOR:
P_DoQuote(QUOTE_ACTIVATED,g_player[screenpeek].ps); P_DoQuote(QUOTE_ACTIVATED, g_player[screenpeek].ps);
break; break;
} }
} }
x = nextspritestat[x];
} }
G_OperateActivators(lotag,snum); G_OperateActivators(lotag,snum);
G_OperateForceFields(g_player[snum].ps->i,lotag); G_OperateForceFields(g_player[snum].ps->i, lotag);
G_OperateMasterSwitches(lotag); G_OperateMasterSwitches(lotag);
if (picnum == DIPSWITCH || picnum == DIPSWITCH+1 || if (G_IsLikeDipswitch(picnum))
picnum == ALIENSWITCH || picnum == ALIENSWITCH+1 || return 1;
picnum == TECHSWITCH || picnum == TECHSWITCH+1) return 1;
if (hitag == 0 && CheckDoorTile(picnum) == 0) if (hitag == 0 && CheckDoorTile(picnum) == 0)
{ {
if (switchissprite == 1) if (switchissprite == 1)
S_PlaySound3D(SWITCH_ON,w,&davector); S_PlaySound3D(SWITCH_ON, w, &davector);
else S_PlaySound3D(SWITCH_ON,g_player[snum].ps->i,&davector); else
S_PlaySound3D(SWITCH_ON, g_player[snum].ps->i, &davector);
} }
else if (hitag != 0) else if (hitag != 0)
{ {
if (switchissprite == 1 && (g_sounds[hitag].m & SF_TALK) == 0) if (switchissprite == 1 && (g_sounds[hitag].m & SF_TALK) == 0)
S_PlaySound3D(hitag,w,&davector); S_PlaySound3D(hitag, w, &davector);
else A_PlaySound(hitag,g_player[snum].ps->i); else
A_PlaySound(hitag, g_player[snum].ps->i);
} }
return 1; return 1;
} }
}
return 0; return 0;
} }
@ -1940,6 +1868,7 @@ void A_DamageObject(int32_t i,int32_t sn)
A_Spawn(i,SMALLSMOKE); A_Spawn(i,SMALLSMOKE);
A_DeleteSprite(i); A_DeleteSprite(i);
break; break;
case QUEBALL__STATIC: case QUEBALL__STATIC:
case STRIPEBALL__STATIC: case STRIPEBALL__STATIC:
if (sprite[sn].picnum == QUEBALL || sprite[sn].picnum == STRIPEBALL) if (sprite[sn].picnum == QUEBALL || sprite[sn].picnum == STRIPEBALL)
@ -1964,6 +1893,7 @@ void A_DamageObject(int32_t i,int32_t sn)
} }
} }
break; break;
case TREE1__STATIC: case TREE1__STATIC:
case TREE2__STATIC: case TREE2__STATIC:
case TIRE__STATIC: case TIRE__STATIC:
@ -1994,6 +1924,7 @@ void A_DamageObject(int32_t i,int32_t sn)
} }
break; break;
} }
case CACTUS__STATIC: case CACTUS__STATIC:
{ {
if (rpg == 1) if (rpg == 1)
@ -2024,6 +1955,7 @@ void A_DamageObject(int32_t i,int32_t sn)
} }
break; break;
} }
case HANGLIGHT__STATIC: case HANGLIGHT__STATIC:
case GENERICPOLE2__STATIC: case GENERICPOLE2__STATIC:
for (k=6; k>0; k--) for (k=6; k>0; k--)