TOL/Level platter stuff

This commit is contained in:
Jaime Passos 2019-12-18 13:24:10 -03:00
parent b759ebf622
commit 79d5192b7c
6 changed files with 109 additions and 35 deletions

View File

@ -1095,10 +1095,8 @@ static void readsprite2(MYFILE *f, INT32 num)
Z_Free(s);
}
static const struct {
const char *name;
const UINT16 flag;
} TYPEOFLEVEL[] = {
INT32 numtolinfo = NUMBASETOL;
tolinfo_t TYPEOFLEVEL[NUMMAXTOL] = {
{"SOLO",TOL_SP},
{"SP",TOL_SP},
{"SINGLEPLAYER",TOL_SP},

View File

@ -39,7 +39,7 @@ extern UINT32 mapmusposition;
#define MUSIC_FORCERESET 0x4000 // -*--------------
// Use other bits if necessary.
extern INT16 maptol;
extern UINT32 maptol;
extern UINT8 globalweather;
extern INT32 curWeather;
extern INT32 cursaveslot;
@ -364,30 +364,6 @@ typedef struct
extern mapheader_t* mapheaderinfo[NUMMAPS];
enum TypeOfLevel
{
TOL_SP = 0x01, ///< Single Player
TOL_COOP = 0x02, ///< Cooperative
TOL_COMPETITION = 0x04, ///< Competition
TOL_RACE = 0x08, ///< Race
// Single Player default = 15
TOL_MATCH = 0x10, ///< Match
TOL_TAG = 0x20, ///< Tag
// Match/Tag default = 48
TOL_CTF = 0x40, ///< Capture the Flag
// CTF default = 64
//TOL_CUSTOM = 0x80, ///< Custom (Lua-scripted, etc.)
TOL_2D = 0x0100, ///< 2D
TOL_MARIO = 0x0200, ///< Mario
TOL_NIGHTS = 0x0400, ///< NiGHTS
TOL_ERZ3 = 0x0800, ///< ERZ3
TOL_XMAS = 0x1000 ///< Christmas NiGHTS
};
// Gametypes
#define NUMGAMETYPEFREESLOTS 128
enum GameType
@ -441,6 +417,41 @@ enum GameTypeRules
// String names for gametypes
extern const char *Gametype_Names[NUMGAMETYPES];
enum TypeOfLevel
{
TOL_SP = 0x01, ///< Single Player
TOL_COOP = 0x02, ///< Cooperative
TOL_COMPETITION = 0x04, ///< Competition
TOL_RACE = 0x08, ///< Race
// Single Player default = 15
TOL_MATCH = 0x10, ///< Match
TOL_TAG = 0x20, ///< Tag
// Match/Tag default = 48
TOL_CTF = 0x40, ///< Capture the Flag
// CTF default = 64
// 0x80 was here
TOL_2D = 0x0100, ///< 2D
TOL_MARIO = 0x0200, ///< Mario
TOL_NIGHTS = 0x0400, ///< NiGHTS
TOL_ERZ3 = 0x0800, ///< ERZ3
TOL_XMAS = 0x1000, ///< Christmas NiGHTS
};
#define NUMBASETOL 18
#define NUMMAXTOL (18 + NUMGAMETYPEFREESLOTS)
typedef struct
{
const char *name;
UINT32 flag;
} tolinfo_t;
extern tolinfo_t TYPEOFLEVEL[NUMMAXTOL];
extern INT32 numtolinfo;
extern tic_t totalplaytime;
extern UINT8 stagefailed;

View File

@ -79,7 +79,7 @@ UINT16 mapmusflags; // Track and reset bit
UINT32 mapmusposition; // Position to jump to
INT16 gamemap = 1;
INT16 maptol;
UINT32 maptol;
UINT8 globalweather = 0;
INT32 curWeather = PRECIP_NONE;
INT32 cursaveslot = 0; // Auto-save 1p savegame slot
@ -3095,11 +3095,11 @@ void G_SetGametype(INT16 gtype)
}
//
// G_NewGametype
// G_AddGametype
//
// Create a new gametype. Returns the new gametype number.
// Add a gametype. Returns the new gametype number.
//
INT16 G_NewGametype(UINT32 rules)
INT16 G_AddGametype(UINT32 rules)
{
INT32 i;
INT16 newgtype = gametypecount;
@ -3121,6 +3121,59 @@ INT16 G_NewGametype(UINT32 rules)
return newgtype;
}
//
// G_SetGametypeDescription
//
// Set a description for the specified gametype.
// (Level platter)
//
void G_SetGametypeDescription(INT16 gtype, const char *description, UINT8 leftcolor, UINT8 rightcolor)
{
strncpy(gametypedesc[gtype].notes, description, 441);
gametypedesc[gtype].col[0] = leftcolor;
gametypedesc[gtype].col[1] = rightcolor;
}
UINT32 gametypetol[NUMGAMETYPES] =
{
TOL_COOP, // Co-op
TOL_COMPETITION, // Competition
TOL_RACE, // Race
TOL_MATCH, // Match
TOL_MATCH, // Team Match
TOL_TAG, // Tag
TOL_TAG, // Hide and Seek
TOL_CTF, // CTF
};
//
// G_AddTOL
//
// Adds a type of level.
//
void G_AddTOL(UINT32 newtol, const char *tolname)
{
TYPEOFLEVEL[numtolinfo].name = tolname;
TYPEOFLEVEL[numtolinfo].flag = newtol;
numtolinfo++;
TYPEOFLEVEL[numtolinfo].name = NULL;
TYPEOFLEVEL[numtolinfo].flag = 0;
}
//
// G_AddTOL
//
// Assigns a type of level to a gametype.
//
void G_AddGametypeTOL(INT16 gametype, UINT32 newtol)
{
gametypetol[gametype] = newtol;
}
//
// G_GetGametypeByName
//
@ -3240,6 +3293,8 @@ boolean G_TagGametype(void)
INT16 G_TOLFlag(INT32 pgametype)
{
if (!multiplayer) return TOL_SP;
return gametypetol[pgametype];
#if 0
if (pgametype == GT_COOP) return TOL_COOP;
if (pgametype == GT_COMPETITION) return TOL_COMPETITION;
if (pgametype == GT_RACE) return TOL_RACE;
@ -3251,6 +3306,7 @@ INT16 G_TOLFlag(INT32 pgametype)
CONS_Alert(CONS_ERROR, M_GetText("Unknown gametype! %d\n"), pgametype);
return INT16_MAX;
#endif
}
/** Select a random map with the given typeoflevel flags.

View File

@ -201,8 +201,13 @@ ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(boolean kill);
void G_StopDemo(void);
boolean G_CheckDemoStatus(void);
extern INT16 gametypedefaultrules[NUMGAMETYPES];
extern UINT32 gametypetol[NUMGAMETYPES];
void G_SetGametype(INT16 gametype);
INT16 G_NewGametype(UINT32 rules);
INT16 G_AddGametype(UINT32 rules);
void G_AddTOL(UINT32 newtol, const char *tolname);
void G_AddGametypeTOL(INT16 gametype, UINT32 newtol);
INT32 G_GetGametypeByName(const char *gametypestr);
boolean G_IsSpecialStage(INT32 mapnum);

View File

@ -605,7 +605,7 @@ static menuitem_t MISC_ChangeTeamMenu[] =
{IT_WHITESTRING|IT_CALL, NULL, "Confirm", M_ConfirmTeamChange, 90},
};
static const gtdesc_t gametypedesc[] =
gtdesc_t gametypedesc[NUMGAMETYPES] =
{
{{ 54, 54}, "Play through the single-player campaign with your friends, teaming up to beat Dr Eggman's nefarious challenges!"},
{{103, 103}, "Speed your way through the main acts, competing in several different categories to see who's the best."},
@ -4684,6 +4684,9 @@ static boolean M_CanShowLevelOnPlatter(INT32 mapnum, INT32 gt)
if (gt == GT_RACE && (mapheaderinfo[mapnum]->typeoflevel & TOL_RACE))
return true;
if (gt > 0 && gt < gametypecount && (mapheaderinfo[mapnum]->typeoflevel & gametypetol[gt]))
return true;
return false;
case LLM_LEVELSELECT:

View File

@ -371,6 +371,7 @@ typedef struct
UINT8 col[2];
char notes[441];
} gtdesc_t;
extern gtdesc_t gametypedesc[NUMGAMETYPES];
// mode descriptions for video mode menu
typedef struct