mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
- added secret hint code.
Not hooked up yet.
This commit is contained in:
parent
dee1cba849
commit
35bc7f56fc
7 changed files with 101 additions and 2 deletions
|
@ -745,6 +745,7 @@ set (PCH_SOURCES
|
|||
common/openaudio.cpp
|
||||
common/optionmenu/optionmenu.cpp
|
||||
common/statistics.cpp
|
||||
common/secrets.cpp
|
||||
|
||||
common/2d/v_2ddrawer.cpp
|
||||
common/2d/v_draw.cpp
|
||||
|
|
|
@ -380,6 +380,7 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command, short causedBy)
|
|||
else viewSetSystemMessage("Invalid Total-Secrets command by xobject #%d (object type %d)", nIndex, nType);
|
||||
break;
|
||||
case kChannelSecretFound:
|
||||
Printf(PRINT_NONOTIFY, "Secret trigger %d\n", nIndex * 65536 + nType);
|
||||
if (command >= kCmdNumberic) levelTriggerSecret(command - kCmdNumberic);
|
||||
else viewSetSystemMessage("Invalid Trigger-Secret command by xobject #%d (object type %d)", nIndex, nType);
|
||||
break;
|
||||
|
|
84
source/common/secrets.cpp
Normal file
84
source/common/secrets.cpp
Normal file
|
@ -0,0 +1,84 @@
|
|||
#include "c_dispatch.h"
|
||||
#include "cache1d.h"
|
||||
#include "printf.h"
|
||||
#include "v_text.h"
|
||||
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// Print secret hints
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
CCMD(secret)
|
||||
{
|
||||
const char *mapname = argv.argc() < 2? primaryLevel->MapName.GetChars() : argv[1];
|
||||
bool thislevel = !stricmp(mapname, primaryLevel->MapName);
|
||||
bool foundsome = false;
|
||||
|
||||
int lumpno=Wads.CheckNumForName("SECRETS");
|
||||
if (lumpno < 0) return;
|
||||
|
||||
auto lump = Wads.OpenLumpReader(lumpno);
|
||||
FString maphdr;
|
||||
maphdr.Format("[%s]", mapname);
|
||||
|
||||
FString linebuild;
|
||||
char readbuffer[1024];
|
||||
bool inlevel = false;
|
||||
|
||||
while (lump.Gets(readbuffer, 1024))
|
||||
{
|
||||
if (!inlevel)
|
||||
{
|
||||
if (readbuffer[0] == '[')
|
||||
{
|
||||
inlevel = !strnicmp(readbuffer, maphdr, maphdr.Len());
|
||||
if (!foundsome)
|
||||
{
|
||||
FString levelname;
|
||||
level_info_t *info = FindLevelInfo(mapname);
|
||||
const char *ln = !(info->flags & LEVEL_LOOKUPLEVELNAME)? info->LevelName.GetChars() : GStrings[info->LevelName.GetChars()];
|
||||
levelname.Format("%s - %s", mapname, ln);
|
||||
Printf(TEXTCOLOR_YELLOW "%s\n", levelname.GetChars());
|
||||
size_t llen = levelname.Len();
|
||||
levelname = "";
|
||||
for(size_t ii=0; ii<llen; ii++) levelname += '-';
|
||||
Printf(TEXTCOLOR_YELLOW "%s\n", levelname.GetChars());
|
||||
foundsome = true;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (readbuffer[0] != '[')
|
||||
{
|
||||
linebuild += readbuffer;
|
||||
if (linebuild.Len() < 1023 || linebuild[1022] == '\n')
|
||||
{
|
||||
// line complete so print it.
|
||||
linebuild.Substitute("\r", "");
|
||||
linebuild.StripRight(" \t\n");
|
||||
PrintSecretString(linebuild, thislevel);
|
||||
linebuild = "";
|
||||
}
|
||||
}
|
||||
else inlevel = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SECRET_Save(FileWriter &fil)
|
||||
{
|
||||
}
|
||||
|
||||
SECRET_Load(FileReader &fil)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SECRET_Trigger(int num)
|
||||
{
|
||||
}
|
||||
|
7
source/common/secrets.h
Normal file
7
source/common/secrets.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
#include "files.h"
|
||||
|
||||
SECRET_Save(FileWriter &fil);
|
||||
SECRET_Load(FileReader &fil);
|
||||
SECRET_Trigger(int num);
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include "files.h"
|
||||
|
||||
void STAT_StartNewGame(const char *episode, int skill);
|
||||
void STAT_NewLevel(const char* mapname);
|
||||
void STAT_Update(bool endofgame);
|
||||
void STAT_Cancel();
|
||||
|
||||
void SaveStatistics(FileWriter& fil);
|
||||
bool ReadStatistics(FileReader& fil);
|
||||
|
|
|
@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
#include "duke3d.h"
|
||||
#include "input.h"
|
||||
#include "printf.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
@ -3122,6 +3123,7 @@ void P_CheckSectors(int playerNum)
|
|||
case 32767:
|
||||
pSector->lotag = 0;
|
||||
P_DoQuote(QUOTE_FOUND_SECRET, pPlayer);
|
||||
Printf(PRINT_NONOTIFY, "Secret in sector %d\n", pPlayer->cursectnum);
|
||||
pPlayer->secret_rooms++;
|
||||
return;
|
||||
|
||||
|
|
|
@ -4284,7 +4284,8 @@ void P_CheckSectors(int playerNum)
|
|||
if (RR && !RRRA)
|
||||
g_canSeePlayer = 0;
|
||||
P_DoQuote(QUOTE_FOUND_SECRET, pPlayer);
|
||||
pPlayer->secret_rooms++;
|
||||
Printf(PRINT_NONOTIFY, "Secret in sector %d\n", pPlayer->cursectnum);
|
||||
pPlayer->secret_rooms++;
|
||||
return;
|
||||
|
||||
case UINT16_MAX:
|
||||
|
|
Loading…
Reference in a new issue