2019-09-19 22:42:45 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 Nuke.YKT
|
|
|
|
|
|
|
|
This file is part of NBlood.
|
|
|
|
|
|
|
|
NBlood is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
|
2019-09-07 13:15:39 +00:00
|
|
|
#include "compat.h"
|
|
|
|
#include "build.h"
|
2019-09-19 22:42:45 +00:00
|
|
|
#include "player.h"
|
|
|
|
|
2019-09-19 06:10:18 +00:00
|
|
|
#define kMessageLogSize 32
|
|
|
|
#define kMaxMessageTextLength 81
|
|
|
|
|
|
|
|
enum MESSAGE_PRIORITY {
|
|
|
|
MESSAGE_PRIORITY_PICKUP = -10,
|
|
|
|
MESSAGE_PRIORITY_NORMAL = 0,
|
|
|
|
MESSAGE_PRIORITY_SECRET = 10,
|
|
|
|
MESSAGE_PRIORITY_INI = 20
|
|
|
|
};
|
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
class CGameMessageMgr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct messageStruct
|
|
|
|
{
|
2019-09-19 06:10:18 +00:00
|
|
|
ClockTicks lastTickWhenVisible;
|
|
|
|
char text[kMaxMessageTextLength];
|
2019-09-18 10:58:45 +00:00
|
|
|
int pal;
|
2019-09-19 06:10:18 +00:00
|
|
|
MESSAGE_PRIORITY priority;
|
|
|
|
bool deleted = false;
|
2019-09-19 22:42:45 +00:00
|
|
|
};
|
2019-09-19 06:10:18 +00:00
|
|
|
char state;
|
|
|
|
int x;
|
|
|
|
int y;
|
2019-09-07 13:15:39 +00:00
|
|
|
ClockTicks at9;
|
|
|
|
ClockTicks atd;
|
2019-09-19 06:10:18 +00:00
|
|
|
int nFont;
|
|
|
|
int fontHeight;
|
|
|
|
int maxNumberOfMessagesToDisplay;
|
|
|
|
int visibilityDurationInSecs;
|
|
|
|
char messageFlags;
|
|
|
|
int numberOfDisplayedMessages;
|
|
|
|
int messagesIndex;
|
|
|
|
int nextMessagesIndex;
|
|
|
|
messageStruct messages[kMessageLogSize];
|
2019-09-19 22:42:45 +00:00
|
|
|
CGameMessageMgr();
|
|
|
|
void SetState(char state);
|
2019-09-19 06:10:18 +00:00
|
|
|
void Add(const char *pText, char a2, const int pal = 0, const MESSAGE_PRIORITY priority = MESSAGE_PRIORITY_NORMAL);
|
2019-09-19 22:42:45 +00:00
|
|
|
void Display(void);
|
|
|
|
void Clear();
|
|
|
|
void SetMaxMessages(int nMessages);
|
|
|
|
void SetFont(int nFont);
|
|
|
|
void SetCoordinates(int x, int y);
|
|
|
|
void SetMessageTime(int nTime);
|
|
|
|
void SetMessageFlags(unsigned int nFlags);
|
2019-09-19 06:10:18 +00:00
|
|
|
private:
|
|
|
|
void SortMessagesByPriority(messageStruct** messages, int count);
|
|
|
|
void SortMessagesByTime(messageStruct** messages, int count);
|
2019-09-19 22:42:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class CPlayerMsg
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int at0;
|
2019-09-20 10:23:07 +00:00
|
|
|
char text[41];
|
|
|
|
CPlayerMsg() { at0 = 0; text[0] = 0; }
|
2019-09-19 22:42:45 +00:00
|
|
|
void Clear(void);
|
|
|
|
void Term(void);
|
|
|
|
void Draw(void);
|
|
|
|
bool AddChar(char);
|
|
|
|
void DelChar(void);
|
|
|
|
void Set(const char *pzString);
|
|
|
|
void Send(void);
|
|
|
|
void ProcessKeys(void);
|
2019-09-20 10:23:07 +00:00
|
|
|
private:
|
|
|
|
bool IsWhitespaceOnly(const char* const pzString);
|
2019-09-19 22:42:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CCheatMgr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static bool m_bPlayerCheated;
|
|
|
|
enum CHEATCODE
|
|
|
|
{
|
|
|
|
kCheatNone = 0,
|
|
|
|
kCheat1, // refills ammo, no cheat code for it
|
|
|
|
kCheatGriswold,
|
|
|
|
kCheatSatchel,
|
|
|
|
kCheatEvaGalli,
|
|
|
|
kCheatMpkfa,
|
|
|
|
kCheatCapInMyAss,
|
|
|
|
kCheatNoCapInMyAss,
|
|
|
|
kCheatIdaho,
|
|
|
|
kCheatKevorkian,
|
|
|
|
kCheatMcGee,
|
|
|
|
kCheatEdmark,
|
|
|
|
kCheatKrueger,
|
|
|
|
kCheatSterno,
|
|
|
|
kCheat14, // quake effect, not used
|
|
|
|
kCheatSpork,
|
|
|
|
kCheatGoonies,
|
|
|
|
kCheatClarice,
|
|
|
|
kCheatFrankenstein,
|
|
|
|
kCheatCheeseHead,
|
|
|
|
kCheatTequila,
|
|
|
|
kCheatFunkyShoes,
|
|
|
|
kCheatKeyMaster,
|
|
|
|
kCheatOneRing,
|
|
|
|
kCheatVoorhees,
|
|
|
|
kCheatJoJo,
|
|
|
|
kCheatGateKeeper,
|
|
|
|
kCheatRate,
|
|
|
|
kCheatMario,
|
|
|
|
kCheatLaraCroft,
|
|
|
|
kCheatHongKong,
|
|
|
|
kCheatMontana,
|
|
|
|
kCheatBunz,
|
|
|
|
kCheatCousteau,
|
|
|
|
kCheatForkYou,
|
|
|
|
kCheatLieberMan,
|
|
|
|
kCheatSpielberg,
|
|
|
|
kCheatCalgon,
|
|
|
|
kCheatMax
|
|
|
|
};
|
|
|
|
struct CHEATINFO
|
|
|
|
{
|
|
|
|
const char* pzString;
|
|
|
|
CHEATCODE id;
|
|
|
|
int flags;
|
|
|
|
};
|
|
|
|
static CHEATINFO s_CheatInfo[];
|
|
|
|
CCheatMgr() {}
|
|
|
|
bool Check(char *pzString);
|
|
|
|
void Process(CHEATCODE nCheatCode, char* pzArgs);
|
|
|
|
void sub_5BCF4(void);
|
|
|
|
};
|
|
|
|
|
|
|
|
extern CPlayerMsg gPlayerMsg;
|
|
|
|
extern CCheatMgr gCheatMgr;
|
|
|
|
|
|
|
|
void SetAmmo(bool stat);
|
|
|
|
void SetWeapons(bool stat);
|
|
|
|
void SetToys(bool stat);
|
|
|
|
void SetArmor(bool stat);
|
|
|
|
void SetKeys(bool stat);
|
|
|
|
void SetGodMode(bool god);
|
|
|
|
void SetClipMode(bool noclip);
|