Move enum cheatindex_t from game.c to game.h and use its values in osdcmds.c.

git-svn-id: https://svn.eduke32.com/eduke32@3005 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-09-08 22:18:34 +00:00
parent 06a64b8dd4
commit 8f8a3c6846
3 changed files with 42 additions and 38 deletions

View file

@ -6966,6 +6966,7 @@ skip:
#pragma optimize("",on)
#endif
// KEEPINSYNC game.h: enum cheatindex_t
char CheatStrings[][MAXCHEATLEN] =
{
"cornholio", // 0
@ -6997,37 +6998,6 @@ char CheatStrings[][MAXCHEATLEN] =
"cgs", // 26
};
enum cheatindex_t
{
CHEAT_CORNHOLIO,
CHEAT_STUFF,
CHEAT_SCOTTY,
CHEAT_COORDS,
CHEAT_VIEW,
CHEAT_TIME,
CHEAT_UNLOCK,
CHEAT_CASHMAN,
CHEAT_ITEMS,
CHEAT_RATE,
CHEAT_SKILL,
CHEAT_BETA,
CHEAT_HYPER,
CHEAT_MONSTERS,
CHEAT_RESERVED,
CHEAT_RESERVED2,
CHEAT_TODD,
CHEAT_SHOWMAP,
CHEAT_KROZ,
CHEAT_ALLEN,
CHEAT_CLIP,
CHEAT_WEAPONS,
CHEAT_INVENTORY,
CHEAT_KEYS,
CHEAT_DEBUG,
CHEAT_RESERVED3,
CHEAT_COMEGETSOME,
};
static void doinvcheat(int32_t invidx, int32_t defaultnum, int32_t event)
{
defaultnum = VM_OnEvent(event, g_player[myconnectindex].ps->i, myconnectindex, -1, defaultnum);

View file

@ -371,6 +371,40 @@ enum {
ST_31_TWO_WAY_TRAIN = 31,
};
// Cheats
// KEEPINSYNC game.c: char CheatStrings[][]
enum cheatindex_t
{
CHEAT_CORNHOLIO, // 0
CHEAT_STUFF,
CHEAT_SCOTTY,
CHEAT_COORDS,
CHEAT_VIEW,
CHEAT_TIME, // 5
CHEAT_UNLOCK,
CHEAT_CASHMAN,
CHEAT_ITEMS,
CHEAT_RATE,
CHEAT_SKILL, // 10
CHEAT_BETA,
CHEAT_HYPER,
CHEAT_MONSTERS,
CHEAT_RESERVED,
CHEAT_RESERVED2, // 15
CHEAT_TODD,
CHEAT_SHOWMAP,
CHEAT_KROZ,
CHEAT_ALLEN,
CHEAT_CLIP, // 20
CHEAT_WEAPONS,
CHEAT_INVENTORY,
CHEAT_KEYS,
CHEAT_DEBUG,
CHEAT_RESERVED3, // 25
CHEAT_COMEGETSOME,
};
# define G_ModDirSnprintf(buf, size, basename, ...) \
( \
( \

View file

@ -136,7 +136,7 @@ static int32_t osdcmd_changelevel(const osdfuncparm_t *parm)
if (g_player[myconnectindex].ps->gm & MODE_GAME)
{
// in-game behave like a cheat
osdcmd_cheatsinfo_stat.cheatnum = 2;
osdcmd_cheatsinfo_stat.cheatnum = CHEAT_SCOTTY;
osdcmd_cheatsinfo_stat.volume = volume;
osdcmd_cheatsinfo_stat.level = level;
}
@ -298,7 +298,7 @@ static int32_t osdcmd_god(const osdfuncparm_t *parm)
{
UNREFERENCED_PARAMETER(parm);
if (numplayers == 1 && g_player[myconnectindex].ps->gm & MODE_GAME)
osdcmd_cheatsinfo_stat.cheatnum = 0;
osdcmd_cheatsinfo_stat.cheatnum = CHEAT_CORNHOLIO;
else
OSD_Printf("god: Not in a single-player game.\n");
@ -310,7 +310,7 @@ static int32_t osdcmd_noclip(const osdfuncparm_t *parm)
UNREFERENCED_PARAMETER(parm);
if (numplayers == 1 && g_player[myconnectindex].ps->gm & MODE_GAME)
{
osdcmd_cheatsinfo_stat.cheatnum = 20;
osdcmd_cheatsinfo_stat.cheatnum = CHEAT_CLIP;
}
else
{
@ -644,7 +644,7 @@ static int32_t osdcmd_give(const osdfuncparm_t *parm)
if (!Bstrcasecmp(parm->parms[0], "all"))
{
osdcmd_cheatsinfo_stat.cheatnum = 1;
osdcmd_cheatsinfo_stat.cheatnum = CHEAT_STUFF;
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->parms[0], "health"))
@ -654,7 +654,7 @@ static int32_t osdcmd_give(const osdfuncparm_t *parm)
}
else if (!Bstrcasecmp(parm->parms[0], "weapons"))
{
osdcmd_cheatsinfo_stat.cheatnum = 21;
osdcmd_cheatsinfo_stat.cheatnum = CHEAT_WEAPONS;
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->parms[0], "ammo"))
@ -670,12 +670,12 @@ static int32_t osdcmd_give(const osdfuncparm_t *parm)
}
else if (!Bstrcasecmp(parm->parms[0], "keys"))
{
osdcmd_cheatsinfo_stat.cheatnum = 23;
osdcmd_cheatsinfo_stat.cheatnum = CHEAT_KEYS;
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->parms[0], "inventory"))
{
osdcmd_cheatsinfo_stat.cheatnum = 22;
osdcmd_cheatsinfo_stat.cheatnum = CHEAT_INVENTORY;
return OSDCMD_OK;
}
return OSDCMD_SHOWHELP;