- added CCMDs for all 'holly' cheats that didn't have an equivalent yet.

This commit is contained in:
Christoph Oelckers 2020-08-22 20:34:58 +02:00
parent 6b1d6a44d7
commit 6d852c33dd
2 changed files with 56 additions and 209 deletions

View file

@ -64,7 +64,6 @@ bool EndLevel = false;
/* these are XORed in the original game executable then XORed back to normal when the game first starts. Here they are normally */
const char *gString[] =
{
"PASSWORDS",
"HOLLY",
"KIMBERLY",
"LOBOCOP",
@ -76,22 +75,6 @@ const char *gString[] =
"LOBOSPHERE",
"LOBOSWAG",
"LOBOXY",
"",
"PASSINFO",
"",
"HI SWEETIE, I LOVE YOU",
"",
"",
"FLASHES TOGGLED",
"",
"",
"",
"FULL MAP",
"",
"",
"",
"EOF",
"",
};
@ -358,14 +341,6 @@ void HandleAsync()
}
void ResetPassword()
{
nCodeMin = nFirstPassword;
nCodeIndex = 0;
nCodeMax = (nFirstPassword + nPasswordCount) - 1;
}
void DoPassword(int nPassword)
{
if (nNetPlayerCount) {
@ -563,145 +538,6 @@ void CheckKeys()
{
char ch = inputState.keyGetChar();
if (bHolly)
{
if (ch)
{
size_t nStringLen = strlen(sHollyStr);
if (ch == asc_Enter)
{
const char *pToken = safeStrtok(sHollyStr, " ");
if (!strcmp(pToken, "GOTO"))
{
// move player to X, Y coordinates
int nSprite = PlayerList[0].nSprite;
pToken = safeStrtok(NULL, ",");
sprite[nSprite].x = atoi(pToken);
pToken = safeStrtok(NULL, ",");
sprite[nSprite].y = atoi(pToken);
setsprite(nSprite, &sprite[nSprite].pos);
sprite[nSprite].z = sector[sprite[nSprite].sectnum].floorz;
}
else if (!strcmp(pToken, "LEVEL"))
{
pToken = safeStrtok(NULL, " ");
levelnew = atoi(pToken);
}
else if (!strcmp(pToken, "DOORS"))
{
for (int i = 0; i < kMaxChannels; i++)
{
// CHECKME - does this toggle?
if (sRunChannels[i].c == 0) {
runlist_ChangeChannel(i, 1);
}
else {
runlist_ChangeChannel(i, 0);
}
}
}
else if (!strcmp(pToken, "EXIT"))
{
EndLevel = true;
}
else if (!strcmp(pToken, "CREATURE"))
{
// i = nNetPlayerCount;
if (!nNetPlayerCount)
{
pToken = safeStrtok(NULL, " ");
switch (atoi(pToken))
{
// TODO - enums?
case 0:
BuildAnubis(-1, initx, inity, sector[initsect].floorz, initsect, inita, false);
break;
case 1:
BuildSpider(-1, initx, inity, sector[initsect].floorz, initsect, inita);
break;
case 2:
BuildMummy(-1, initx, inity, sector[initsect].floorz, initsect, inita);
break;
case 3:
BuildFish(-1, initx, inity, initz + eyelevel[nLocalPlayer], initsect, inita);
break;
case 4:
BuildLion(-1, initx, inity, sector[initsect].floorz, initsect, inita);
break;
case 5:
BuildLava(-1, initx, inity, sector[initsect].floorz, initsect, inita, nNetPlayerCount);
break;
case 6:
BuildRex(-1, initx, inity, sector[initsect].floorz, initsect, inita, nNetPlayerCount);
break;
case 7:
BuildSet(-1, initx, inity, sector[initsect].floorz, initsect, inita, nNetPlayerCount);
break;
case 8:
BuildQueen(-1, initx, inity, sector[initsect].floorz, initsect, inita, nNetPlayerCount);
break;
case 9:
BuildRoach(0, -1, initx, inity, sector[initsect].floorz, initsect, inita);
break;
case 10:
BuildRoach(1, -1, initx, inity, sector[initsect].floorz, initsect, inita);
break;
case 11:
BuildWasp(-1, initx, inity, sector[initsect].floorz - 25600, initsect, inita);
break;
case 12:
BuildScorp(-1, initx, inity, sector[initsect].floorz, initsect, inita, nNetPlayerCount);
break;
case 13:
BuildRat(-1, initx, inity, sector[initsect].floorz, initsect, inita);
break;
default:
break;
}
}
}
else
{
if (nStringLen == 0)
{
bHolly = false;
StatusMessage(1, " ");
}
else
{
for (int i = 0; i < nPasswordCount; ++i)
{
if (!strcmp(sHollyStr, gString[i + nFirstPassword]))
{
DoPassword(i);
break;
}
}
}
}
sHollyStr[0] = '\0';
}
else if (ch == asc_BackSpace)
{
if (nStringLen != 0) {
sHollyStr[nStringLen - 1] = '\0';
}
}
else if (nStringLen < (sizeof(sHollyStr) - 1)) // do we have room to add a char and null terminator?
{
sHollyStr[nStringLen] = toupper(ch);
sHollyStr[nStringLen + 1] = '\0';
}
}
else
{
inputState.keyGetChar(); //???
}
}
if (isalpha(ch))
{
@ -724,7 +560,6 @@ void CheckKeys()
ebx -= nFirstPassword;
DoPassword(ebx);
ResetPassword();
}
break;
@ -1007,29 +842,6 @@ static void GameMove(void)
int32_t r_maxfpsoffset = 0;
void PatchDemoStrings()
{
#if 0
if (!ISDEMOVER)
return;
if (EXHUMED) {
gString[60] = "PICK UP A COPY OF EXHUMED";
}
else {
gString[60] = "PICK UP A COPY OF POWERSLAVE";
}
gString[61] = "TODAY TO CONTINUE THE ADVENTURE!";
gString[62] = "MORE LEVELS, NASTIER CREATURES";
gString[63] = "AND THE EVIL DOINGS OF THE";
gString[64] = "KILMAAT AWAIT YOU IN THE FULL";
gString[65] = "VERSION OF THE GAME.";
gString[66] = "TWENTY LEVELS, PLUS 12 NETWORK";
gString[67] = "PLAY LEVELS CAN BE YOURS!";
gString[68] = "END";
#endif
}
void ExitGame()
{
@ -1146,7 +958,6 @@ int GameInterface::app_main()
}
PatchDemoStrings();
// loc_115F5:
nFirstPassword = FindGString("PASSWORDS");
nFirstPassInfo = FindGString("PASSINFO");
@ -2255,10 +2066,4 @@ void LoadTextureState()
TileFiles.InvalidateTile(kEnergy2);
}
CCMD(ex_endlevel)
{
EndLevel = true;
}
END_PS_NS

View file

@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "player.h"
#include "view.h"
#include "mapinfo.h"
#include "aistuff.h"
BEGIN_PS_NS
@ -147,27 +148,68 @@ static int osdcmd_warptocoords(CCmdFuncPtr parm)
return CCMD_OK;
}
static int osdcmd_exitmap(CCmdFuncPtr parm)
{
EndLevel = true;
return CCMD_OK;
}
static int osdcmd_doors(CCmdFuncPtr parm)
{
for (int i = 0; i < kMaxChannels; i++)
{
// CHECKME - does this toggle?
if (sRunChannels[i].c == 0) {
runlist_ChangeChannel(i, 1);
}
else {
runlist_ChangeChannel(i, 0);
}
}
return CCMD_OK;
}
extern int initx;
extern int inity;
extern int initz;
extern short inita;
extern short initsect;
static int osdcmd_spawn(CCmdFuncPtr parm)
{
if (parm->numparms != 1) return CCMD_SHOWHELP;
auto c = parm->parms[0];
if (!stricmp(c, "anubis")) BuildAnubis(-1, initx, inity, sector[initsect].floorz, initsect, inita, false);
else if (!stricmp(c, "spider")) BuildSpider(-1, initx, inity, sector[initsect].floorz, initsect, inita);
else if (!stricmp(c, "mummy")) BuildMummy(-1, initx, inity, sector[initsect].floorz, initsect, inita);
else if (!stricmp(c, "fish")) BuildFish(-1, initx, inity, initz + eyelevel[nLocalPlayer], initsect, inita);
else if (!stricmp(c, "lion")) BuildLion(-1, initx, inity, sector[initsect].floorz, initsect, inita);
else if (!stricmp(c, "lava")) BuildLava(-1, initx, inity, sector[initsect].floorz, initsect, inita, nNetPlayerCount);
else if (!stricmp(c, "rex")) BuildRex(-1, initx, inity, sector[initsect].floorz, initsect, inita, nNetPlayerCount);
else if (!stricmp(c, "set")) BuildSet(-1, initx, inity, sector[initsect].floorz, initsect, inita, nNetPlayerCount);
else if (!stricmp(c, "queen")) BuildQueen(-1, initx, inity, sector[initsect].floorz, initsect, inita, nNetPlayerCount);
else if (!stricmp(c, "roach")) BuildRoach(0, -1, initx, inity, sector[initsect].floorz, initsect, inita);
else if (!stricmp(c, "roach2")) BuildRoach(1, -1, initx, inity, sector[initsect].floorz, initsect, inita);
else if (!stricmp(c, "wasp")) BuildWasp(-1, initx, inity, sector[initsect].floorz - 25600, initsect, inita);
else if (!stricmp(c, "scorp")) BuildScorp(-1, initx, inity, sector[initsect].floorz, initsect, inita, nNetPlayerCount);
else if (!stricmp(c, "rat")) BuildRat(-1, initx, inity, sector[initsect].floorz, initsect, inita);
else Printf("Unknown creature type %s\n", c);
return CCMD_OK;
}
int32_t registerosdcommands(void)
{
//if (VOLUMEONE)
C_RegisterFunction("changelevel","changelevel <level>: warps to the given level", osdcmd_changelevel);
C_RegisterFunction("map","map <mapname>: loads the given map", osdcmd_map);
// C_RegisterFunction("demo","demo <demofile or demonum>: starts the given demo", osdcmd_demo);
//}
//C_RegisterFunction("cmenu","cmenu <#>: jumps to menu", osdcmd_cmenu);
//C_RegisterFunction("give","give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item", osdcmd_give);
C_RegisterFunction("exitmap", "exits current map", osdcmd_exitmap);
C_RegisterFunction("doors", "opens/closes doors", osdcmd_doors);
C_RegisterFunction("god","god: toggles god mode", osdcmd_god);
//C_RegisterFunction("activatecheat","activatecheat <id>: activates a cheat code", osdcmd_activatecheat);
C_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);
//C_RegisterFunction("restartmap", "restartmap: restarts the current map", osdcmd_restartmap);
//C_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound);
//C_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);
C_RegisterFunction("spawn","spawn <creaturetype>: spawns a creature",osdcmd_spawn);
C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords);
return 0;