- moved secret found message to string table and removed the CVAR crutch that dates from a time when modifying string table content wasn't as easy as it is now.

- added 'showsecretsector' CVAR to show the sector number with the secret found message.
This commit is contained in:
Christoph Oelckers 2014-05-29 17:50:14 +02:00
parent 75cde0b221
commit 8f5683e23d
5 changed files with 20 additions and 11 deletions

View file

@ -1018,7 +1018,7 @@ void AInventory::Touch (AActor *toucher)
if (flags5 & MF5_COUNTSECRET)
{
P_GiveSecret(toucher, true, true);
P_GiveSecret(toucher, true, true, -1);
}
//Added by MC: Check if item taken was the roam destination of any bot

View file

@ -42,8 +42,6 @@
#include "v_font.h"
#include "p_spec.h"
EXTERN_CVAR(String, secretmessage)
class ASecretTrigger : public AActor
{
DECLARE_CLASS (ASecretTrigger, AActor)
@ -62,7 +60,7 @@ void ASecretTrigger::PostBeginPlay ()
void ASecretTrigger::Activate (AActor *activator)
{
P_GiveSecret(activator, args[0] <= 1, (args[0] == 0 || args[0] == 2));
P_GiveSecret(activator, args[0] <= 1, (args[0] == 0 || args[0] == 2), -1);
Destroy ();
}

View file

@ -61,6 +61,7 @@
#include "a_sharedglobal.h"
#include "farchive.h"
#include "a_keys.h"
#include "c_dispatch.h"
// State.
#include "r_state.h"
@ -73,9 +74,6 @@ static FRandom pr_playerinspecialsector ("PlayerInSpecialSector");
void P_SetupPortals();
// [GrafZahl] Make this message changable by the user! ;)
CVAR(String, secretmessage, "A Secret is revealed!", CVAR_ARCHIVE)
IMPLEMENT_POINTY_CLASS (DScroller)
DECLARE_POINTER (m_Interpolations[0])
DECLARE_POINTER (m_Interpolations[1])
@ -581,7 +579,7 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector)
if (sector->special & SECRET_MASK)
{
sector->special &= ~SECRET_MASK;
P_GiveSecret(player->mo, true, true);
P_GiveSecret(player->mo, true, true, int(sector - sectors));
}
}
@ -672,7 +670,9 @@ void P_SectorDamage(int tag, int amount, FName type, const PClass *protectClass,
//
//============================================================================
void P_GiveSecret(AActor *actor, bool printmessage, bool playsound)
CVAR(Bool, showsecretsector, false, 0)
void P_GiveSecret(AActor *actor, bool printmessage, bool playsound, int sectornum)
{
if (actor != NULL)
{
@ -682,7 +682,16 @@ void P_GiveSecret(AActor *actor, bool printmessage, bool playsound)
}
if (actor->CheckLocalView (consoleplayer))
{
if (printmessage) C_MidPrint (SmallFont, secretmessage);
if (printmessage)
{
if (!showsecretsector || sectornum < 0) C_MidPrint(SmallFont, GStrings["SECRETMESSAGE"]);
else
{
FString s = GStrings["SECRETMESSAGE"];
s.AppendFormat(" (Sector %d)", sectornum);
C_MidPrint(SmallFont, s);
}
}
if (playsound) S_Sound (CHAN_AUTO | CHAN_UI, "misc/secret", 1, ATTN_NORM);
}
}

View file

@ -172,7 +172,7 @@ void P_PlayerOnSpecialFlat (player_t *player, int floorType);
void P_SectorDamage(int tag, int amount, FName type, const PClass *protectClass, int flags);
void P_SetSectorFriction (int tag, int amount, bool alterFlag);
void P_GiveSecret(AActor *actor, bool printmessage, bool playsound);
void P_GiveSecret(AActor *actor, bool printmessage, bool playsound, int sectornum);
//
// getSide()

View file

@ -2,6 +2,8 @@
[enu default]
SECRETMESSAGE = "A secret is revealed!";
D_DEVSTR = "Useless mode ON.\n";
D_CDROM = "CD-ROM Version: zdoom.ini from c:\\zdoomdat\n";
PRESSKEY = "press a key.";