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_video.h"
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "c_cvars.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.
|
// 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.
|
// 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 == '$')
|
if (*string == '$')
|
||||||
{
|
{
|
||||||
|
unsigned secnum = UINT_MAX;
|
||||||
if (string[1] == 'S' || string[1] == 's')
|
if (string[1] == 'S' || string[1] == 's')
|
||||||
{
|
{
|
||||||
auto secnum = (unsigned)strtoull(string+2, (char**)&string, 10);
|
secnum = (unsigned)strtoull(string+2, (char**)&string, 10);
|
||||||
if (*string == ';') string++;
|
|
||||||
colstr = discovered_secrets.Find(secnum) == discovered_secrets.Size() ? TEXTCOLOR_RED : TEXTCOLOR_GREEN;
|
|
||||||
}
|
}
|
||||||
|
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);
|
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;
|
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())
|
if (discovered_secrets.Find(num) == discovered_secrets.Size())
|
||||||
{
|
{
|
||||||
discovered_secrets.Push(num);
|
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 true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
|
|
||||||
|
enum ESecretType
|
||||||
|
{
|
||||||
|
Secret_Sector = 0,
|
||||||
|
Secret_Sprite,
|
||||||
|
Secret_Wall
|
||||||
|
};
|
||||||
|
|
||||||
class FSerializer;
|
class FSerializer;
|
||||||
void SECRET_Serialize(FSerializer &arc);
|
void SECRET_Serialize(FSerializer &arc);
|
||||||
void SECRET_SetMapName(const char *filename, const char *maptitle);
|
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:
|
case kChannelSecretFound:
|
||||||
{
|
{
|
||||||
int nIndex = -1;
|
int nIndex = -1;
|
||||||
if (eob.isActor() && eob.actor()) nIndex = eob.actor()->GetIndex() + 3 * 65536; // the hint system needs the sprite index.
|
int nType = -1;
|
||||||
else if (eob.isSector()) nIndex = eob.rawindex() + 6 * 65536;
|
if (eob.isActor() && eob.actor()) nIndex = eob.actor()->GetIndex(), nType = Secret_Sprite;
|
||||||
else if (eob.isWall()) nIndex = eob.rawindex();
|
else if (eob.isSector()) nIndex = eob.rawindex(), nType = Secret_Sector;
|
||||||
if (SECRET_Trigger(nIndex)) // if the hint system knows this secret it's a retrigger - skip that.
|
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)
|
if (command >= kCmdNumberic)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue