- JS_ProcessEchoSpot + UnlockKeyLock

This commit is contained in:
Christoph Oelckers 2021-11-01 09:10:19 +01:00
parent f401d4bb44
commit cf8aaf7ff2
6 changed files with 12 additions and 67 deletions

View file

@ -598,7 +598,7 @@ int QueueFootPrint(short hit_sprite); // Weapon.c
int QueueGeneric(short SpriteNum, short pic); // Weapon.c
int QueueLoWangs(short SpriteNum); // Weapon.c
int SpawnShell(short SpriteNum, short ShellNum); // Weapon.c
void UnlockKeyLock(short key_num, short hit_sprite); // JSector.c
void UnlockKeyLock(short key_num, DSWActor* actor); // JSector.c
#define MAX_PAIN 5
extern int PlayerPainVocs[MAX_PAIN];

View file

@ -478,7 +478,6 @@ void drawroomstotile(int daposx, int daposy, int daposz,
void
JS_ProcessEchoSpot()
{
int i;
SPRITEp tp;
int j,dist;
PLAYERp pp = Player+screenpeek;
@ -486,12 +485,12 @@ JS_ProcessEchoSpot()
bool reverb_set = false;
// Process echo sprites
StatIterator it(STAT_ECHO);
while ((i = it.NextIndex()) >= 0)
SWStatIterator it(STAT_ECHO);
while (auto actor = it.Next())
{
dist = 0x7fffffff;
tp = &sprite[i];
tp = &actor->s();
j = abs(tp->x - pp->posx);
j += abs(tp->y - pp->posy);
@ -940,11 +939,9 @@ JAnalyzeSprites(tspriteptr_t tspr)
////////////////////////////////////////////////////////////////////////////////////////////////
void
UnlockKeyLock(short key_num, short hit_sprite)
void UnlockKeyLock(short key_num, DSWActor* hitActor)
{
SPRITEp sp;
int SpriteNum = 0, color = 0;
int color = 0;
// Get palette by looking at key number
switch (key_num - 1)
@ -975,10 +972,10 @@ UnlockKeyLock(short key_num, short hit_sprite)
break;
}
StatIterator it(STAT_DEFAULT);
while ((SpriteNum = it.NextIndex()) >= 0)
SWStatIterator it(STAT_DEFAULT);
while (auto itActor = it.Next())
{
sp = &sprite[SpriteNum];
auto sp = &itActor->s();
switch (sp->picnum)
{
@ -986,7 +983,7 @@ UnlockKeyLock(short key_num, short hit_sprite)
if (sp->pal == color)
{
PlaySound(DIGI_UNLOCK, sp, v3df_doppler | v3df_dontpan);
if (SpriteNum == hit_sprite)
if (itActor == hitActor)
sp->picnum = SKEL_UNLOCKED;
}
break;
@ -1001,7 +998,7 @@ UnlockKeyLock(short key_num, short hit_sprite)
if (sp->pal == color)
{
PlaySound(DIGI_RAMUNLOCK, sp, v3df_doppler | v3df_dontpan);
if (SpriteNum == hit_sprite)
if (itActor == hitActor)
sp->picnum = CARD_UNLOCKED;
else
sp->picnum = CARD_UNLOCKED+1;

View file

@ -199,19 +199,6 @@ DoRotatorMatch(PLAYERp pp, short match, bool manual)
key_num = SectUser[sectnum]->number;
#if 0
if (pp->HasKey[key_num - 1])
{
int i;
for (i=0; i<numsectors; i++)
{
if (SectUser[i] && SectUser[i]->stag == SECT_LOCK_DOOR && SectUser[i]->number == key_num)
SectUser[i]->number = 0; // unlock all doors of this type
}
UnlockKeyLock(key_num);
}
else
#endif
{
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1));
return -1;

View file

@ -1841,7 +1841,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
if (SectUser[i].Data() && SectUser[i]->stag == SECT_LOCK_DOOR && SectUser[i]->number == key_num)
SectUser[i]->number = 0; // unlock all doors of this type
}
UnlockKeyLock(key_num, SpriteNum);
UnlockKeyLock(key_num, actor);
}
return true;

View file

@ -195,19 +195,6 @@ DoSlidorMatch(PLAYERp pp, short match, bool manual)
key_num = SectUser[sectnum]->number;
#if 0
if (pp->HasKey[key_num - 1])
{
int i;
for (i=0; i<numsectors; i++)
{
if (SectUser[i] && SectUser[i]->stag == SECT_LOCK_DOOR && SectUser[i]->number == key_num)
SectUser[i]->number = 0; // unlock all doors of this type
}
UnlockKeyLock(key_num);
}
else
#endif
{
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1));
return -1;

View file

@ -185,19 +185,6 @@ short DoVatorOperate(PLAYERp pp, short sectnum)
key_num = SectUser[sectnum]->number;
#if 0
if (pp->HasKey[key_num - 1])
{
int i;
for (i=0; i<numsectors; i++)
{
if (SectUser[i] && SectUser[i]->stag == SECT_LOCK_DOOR && SectUser[i]->number == key_num)
SectUser[i]->number = 0; // unlock all doors of this type
}
UnlockKeyLock(key_num);
}
else
#endif
{
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1));
return false;
@ -254,19 +241,6 @@ DoVatorMatch(PLAYERp pp, short match)
key_num = SectUser[sectnum]->number;
#if 0
if (pp->HasKey[key_num - 1])
{
int i;
for (i=0; i<numsectors; i++)
{
if (SectUser[i] && SectUser[i]->stag == SECT_LOCK_DOOR && SectUser[i]->number == key_num)
SectUser[i]->number = 0; // unlock all doors of this type
}
UnlockKeyLock(key_num);
}
else
#endif
{
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1));
return -1;