mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- improved the secret hint management for Blood.
This now uses sprite and sector indices directly instead of encoding them into a larger number. Sprite secrets will use a $t prefix instead of $s now.
This commit is contained in:
parent
3114059145
commit
26179c56cf
3 changed files with 34 additions and 10 deletions
|
@ -11,6 +11,7 @@
|
|||
#include "v_video.h"
|
||||
#include "v_text.h"
|
||||
#include "c_cvars.h"
|
||||
#include "secrets.h"
|
||||
|
||||
// Unlike in GZDoom we have to maintain this list here, because we got different game frontents that all store this info differently.
|
||||
// So the games will have to report the credited secrets so that this code can keep track of how to display them.
|
||||
|
@ -31,12 +32,21 @@ static void PrintSecretString(const char *string, bool thislevel)
|
|||
{
|
||||
if (*string == '$')
|
||||
{
|
||||
unsigned secnum = UINT_MAX;
|
||||
if (string[1] == 'S' || string[1] == 's')
|
||||
{
|
||||
auto secnum = (unsigned)strtoull(string+2, (char**)&string, 10);
|
||||
if (*string == ';') string++;
|
||||
colstr = discovered_secrets.Find(secnum) == discovered_secrets.Size() ? TEXTCOLOR_RED : TEXTCOLOR_GREEN;
|
||||
secnum = (unsigned)strtoull(string+2, (char**)&string, 10);
|
||||
}
|
||||
else if (string[1] == 'T' || string[1] == 't')
|
||||
{
|
||||
secnum = (unsigned)strtoull(string + 2, (char**)&string, 10) + 0x100000 * Secret_Sprite;
|
||||
}
|
||||
else if (string[1] == 'W' || string[1] == 'w')
|
||||
{
|
||||
secnum = (unsigned)strtoull(string + 2, (char**)&string, 10) + 0x100000 * Secret_Wall;
|
||||
}
|
||||
if (*string == ';') string++;
|
||||
if (secnum != UINT_MAX) colstr = discovered_secrets.Find(secnum) == discovered_secrets.Size() ? TEXTCOLOR_RED : TEXTCOLOR_GREEN;
|
||||
}
|
||||
auto brok = V_BreakLines(NewConsoleFont, screen->GetWidth()*95/100, string);
|
||||
|
||||
|
@ -127,12 +137,18 @@ void SECRET_SetMapName(const char *filename, const char *_maptitle)
|
|||
maptitle = _maptitle;
|
||||
}
|
||||
|
||||
bool SECRET_Trigger(int num)
|
||||
bool SECRET_Trigger(int nnum, int type)
|
||||
{
|
||||
int num = nnum + type * 0x100000;
|
||||
if (discovered_secrets.Find(num) == discovered_secrets.Size())
|
||||
{
|
||||
discovered_secrets.Push(num);
|
||||
if (secret_notify) Printf(PRINT_NONOTIFY, "Secret #%d found\n", num);
|
||||
if (secret_notify)
|
||||
{
|
||||
if (type == Secret_Sector) Printf(PRINT_NONOTIFY, "Secret sector #%d found\n", nnum);
|
||||
else if (type == Secret_Sprite) Printf(PRINT_NONOTIFY, "Secret sprite #%d found\n", nnum);
|
||||
else if (type == Secret_Wall) Printf(PRINT_NONOTIFY, "Secret wall #%d found\n", nnum);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
#pragma once
|
||||
#include "files.h"
|
||||
|
||||
enum ESecretType
|
||||
{
|
||||
Secret_Sector = 0,
|
||||
Secret_Sprite,
|
||||
Secret_Wall
|
||||
};
|
||||
|
||||
class FSerializer;
|
||||
void SECRET_Serialize(FSerializer &arc);
|
||||
void SECRET_SetMapName(const char *filename, const char *maptitle);
|
||||
bool SECRET_Trigger(int num);
|
||||
bool SECRET_Trigger(int num, int type = Secret_Sector);
|
||||
|
||||
|
||||
|
|
|
@ -391,10 +391,11 @@ void evSend(EventObject& eob, int rxId, COMMAND_ID command)
|
|||
case kChannelSecretFound:
|
||||
{
|
||||
int nIndex = -1;
|
||||
if (eob.isActor() && eob.actor()) nIndex = eob.actor()->GetIndex() + 3 * 65536; // the hint system needs the sprite index.
|
||||
else if (eob.isSector()) nIndex = eob.rawindex() + 6 * 65536;
|
||||
else if (eob.isWall()) nIndex = eob.rawindex();
|
||||
if (SECRET_Trigger(nIndex)) // if the hint system knows this secret it's a retrigger - skip that.
|
||||
int nType = -1;
|
||||
if (eob.isActor() && eob.actor()) nIndex = eob.actor()->GetIndex(), nType = Secret_Sprite;
|
||||
else if (eob.isSector()) nIndex = eob.rawindex(), nType = Secret_Sector;
|
||||
else if (eob.isWall()) nIndex = eob.rawindex(), nType = Secret_Wall;
|
||||
if (SECRET_Trigger(nIndex, nType)) // if the hint system knows this secret it's a retrigger - skip that.
|
||||
{
|
||||
if (command >= kCmdNumberic)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue