- Blood: only trigger a secret if the hint system hasn't registered it.

There's some bugs in Blood that allow a secret to be triggered multiple times. However, since the hint system already knows which secrets were triggered, use that info to avoid retriggers.
Fixes #206
This commit is contained in:
Christoph Oelckers 2020-12-01 12:49:24 +01:00
parent 6475d772ca
commit 92a72cef8b
3 changed files with 12 additions and 7 deletions

View file

@ -400,9 +400,11 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command)
else viewSetSystemMessage("Invalid Total-Secrets command by xobject #%d (object type %d)", nIndex, nType);
break;
case kChannelSecretFound:
SECRET_Trigger(nIndex + 65536 * nType);
if (command >= kCmdNumberic) levelTriggerSecret(command - kCmdNumberic);
else viewSetSystemMessage("Invalid Trigger-Secret command by xobject #%d (object type %d)", nIndex, nType);
if (SECRET_Trigger(nIndex + 65536 * nType)) // if the hint system knows this secret it's a retrigger - skip that.
{
if (command >= kCmdNumberic) levelTriggerSecret(command - kCmdNumberic);
else viewSetSystemMessage("Invalid Trigger-Secret command by xobject #%d (object type %d)", nIndex, nType);
}
break;
case kChannelRemoteBomb0:
case kChannelRemoteBomb1:

View file

@ -127,10 +127,13 @@ void SECRET_SetMapName(const char *filename, const char *_maptitle)
maptitle = _maptitle;
}
void SECRET_Trigger(int num)
bool SECRET_Trigger(int num)
{
if (secret_notify) Printf(PRINT_NONOTIFY, "Secret #%d found\n", num);
if (discovered_secrets.Find(num) == discovered_secrets.Size())
{
discovered_secrets.Push(num);
if (secret_notify) Printf(PRINT_NONOTIFY, "Secret #%d found\n", num);
return true;
}
return false;
}

View file

@ -4,5 +4,5 @@
class FSerializer;
void SECRET_Serialize(FSerializer &arc);
void SECRET_SetMapName(const char *filename, const char *maptitle);
void SECRET_Trigger(int num);
bool SECRET_Trigger(int num);