Merge remote-tracking branch 'origin/master' into online-handling

This commit is contained in:
AJ Martinez 2023-04-11 23:42:58 -07:00
commit 01813c91ba
34 changed files with 2080 additions and 1179 deletions

View file

@ -913,7 +913,8 @@ boolean CON_Responder(event_t *ev)
// let go keyup events, don't eat them
if (ev->type != ev_keydown && ev->type != ev_console)
{
if (ev->data1 == gamecontrol[0][gc_console][0] || ev->data1 == gamecontrol[0][gc_console][1])
if (ev->data1 == gamecontrol[0][gc_console][0] || ev->data1 == gamecontrol[0][gc_console][1]
|| ev->data1 == gamecontrol[0][gc_console][2] || ev->data1 == gamecontrol[0][gc_console][3])
consdown = false;
return false;
}
@ -933,7 +934,8 @@ boolean CON_Responder(event_t *ev)
INT32 i;
for (i = 0; i < num_gamecontrols; i++)
{
if (gamecontrol[0][i][0] == ev->data1 || gamecontrol[0][i][1] == ev->data1)
if (gamecontrol[0][i][0] == ev->data1 || gamecontrol[0][i][1] == ev->data1
|| gamecontrol[0][i][2] == ev->data1 || gamecontrol[0][i][3] == ev->data1)
break;
}
@ -941,7 +943,8 @@ boolean CON_Responder(event_t *ev)
return false;
}
if (key == gamecontrol[0][gc_console][0] || key == gamecontrol[0][gc_console][1])
if (key == gamecontrol[0][gc_console][0] || key == gamecontrol[0][gc_console][1]
|| key == gamecontrol[0][gc_console][2] || key == gamecontrol[0][gc_console][3])
{
if (consdown) // ignore repeat
return true;

View file

@ -6757,6 +6757,8 @@ void NetUpdate(void)
I_unlock_mutex(k_menu_mutex);
#endif
CON_Ticker();
M_ScreenshotTicker();
}
FileSendTicker();

View file

@ -248,10 +248,6 @@ void D_ProcessEvents(void)
HandleGamepadDeviceEvents(ev);
// Screenshots over everything so that they can be taken anywhere.
if (M_ScreenshotResponder(ev))
continue; // ate the event
if (gameaction == ga_nothing && gamestate == GS_TITLESCREEN)
{
if (cht_Responder(ev))

View file

@ -468,6 +468,8 @@ consvar_t cv_reducevfx = CVAR_INIT ("reducevfx", "No", CV_SAVE, CV_YesNo, NULL);
static CV_PossibleValue_t votetime_cons_t[] = {{10, "MIN"}, {3600, "MAX"}, {0, NULL}};
consvar_t cv_votetime = CVAR_INIT ("votetime", "20", CV_NETVAR, votetime_cons_t, NULL);
consvar_t cv_botscanvote = CVAR_INIT ("botscanvote", "No", CV_CHEAT, CV_YesNo, NULL);
consvar_t cv_gravity = CVAR_INIT ("gravity", "0.8", CV_CHEAT|CV_FLOAT|CV_CALL, NULL, Gravity_OnChange); // change DEFAULT_GRAVITY if you change this
consvar_t cv_soundtest = CVAR_INIT ("soundtest", "0", CV_CALL, NULL, SoundTest_OnChange);
@ -1098,6 +1100,8 @@ void D_RegisterClientCommands(void)
COM_AddCommand("skynum", Command_Skynum_f);
COM_AddCommand("weather", Command_Weather_f);
COM_AddCommand("grayscale", Command_Grayscale_f);
COM_AddCommand("goto", Command_Goto_f);
COM_AddCommand("angle", Command_Angle_f);
CV_RegisterVar(&cv_renderhitbox);
CV_RegisterVar(&cv_devmode_screen);
@ -2032,6 +2036,7 @@ void D_Cheat(INT32 playernum, INT32 cheat, ...)
break;
case CHEAT_RELATIVE_TELEPORT:
case CHEAT_TELEPORT:
COPY(WRITEFIXED, fixed_t);
COPY(WRITEFIXED, fixed_t);
COPY(WRITEFIXED, fixed_t);
@ -2049,6 +2054,10 @@ void D_Cheat(INT32 playernum, INT32 cheat, ...)
case CHEAT_SCORE:
COPY(WRITEUINT32, UINT32);
break;
case CHEAT_ANGLE:
COPY(WRITEANGLE, angle_t);
break;
}
#undef COPY
@ -2615,83 +2624,110 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pencoremode, boolean r
void D_SetupVote(void)
{
UINT8 buf[5*2]; // four UINT16 maps (at twice the width of a UINT8), and two gametypes
UINT8 buf[(VOTE_NUM_LEVELS * 2) + 2]; // four UINT16 maps (at twice the width of a UINT8), and two gametypes
UINT8 *p = buf;
INT32 i;
UINT8 secondgt = G_SometimesGetDifferentGametype();
INT16 votebuffer[4] = {-1,-1,-1,0};
if ((cv_kartencore.value == 1) && (gametyperules & GTR_ENCORE))
WRITEUINT8(p, (gametype|VOTEMODIFIER_ENCORE));
else
WRITEUINT8(p, gametype);
WRITEUINT8(p, secondgt);
secondgt &= ~VOTEMODIFIER_ENCORE;
UINT16 votebuffer[VOTE_NUM_LEVELS + 1];
memset(votebuffer, UINT16_MAX, sizeof(votebuffer));
for (i = 0; i < 4; i++)
WRITEUINT8(p, ((cv_kartencore.value == 1) && (gametyperules & GTR_ENCORE)));
WRITEUINT8(p, G_SometimesGetDifferentEncore());
for (i = 0; i < VOTE_NUM_LEVELS; i++)
{
UINT16 m;
if (i == 2) // sometimes a different gametype
m = G_RandMap(G_TOLFlag(secondgt), prevmap, ((secondgt != gametype) ? 2 : 0), 0, true, votebuffer);
else if (i >= 3) // Don't Care. Pick any of the available choices.
m = votebuffer[M_RandomRange(0, 2)];
else
m = G_RandMap(G_TOLFlag(gametype), prevmap, 0, 0, true, votebuffer);
if (i < 3)
votebuffer[i] = m;
UINT16 m = G_RandMap(
G_TOLFlag(gametype),
prevmap, false,
(i < VOTE_NUM_LEVELS-1),
votebuffer
);
votebuffer[i] = m;
WRITEUINT16(p, m);
}
SendNetXCmd(XD_SETUPVOTE, buf, p - buf);
}
void D_ModifyClientVote(UINT8 player, SINT8 voted, UINT8 splitplayer)
void D_ModifyClientVote(UINT8 player, SINT8 voted)
{
char buf[2];
char *p = buf;
UINT8 sendPlayer = consoleplayer;
if (splitplayer > 0)
player = g_localplayers[splitplayer];
if (player == UINT8_MAX)
{
// Special game vote (map anger, duel)
if (!server)
{
return;
}
}
if (player == UINT8_MAX)
{
// special vote
WRITEUINT8(p, UINT8_MAX);
}
else
{
INT32 i = 0;
WRITEUINT8(p, player);
for (i = 0; i <= splitscreen; i++)
{
if (g_localplayers[i] == player)
{
sendPlayer = i;
}
}
}
WRITESINT8(p, voted);
WRITEUINT8(p, player);
SendNetXCmd(XD_MODIFYVOTE, &buf, 2);
SendNetXCmdForPlayer(sendPlayer, XD_MODIFYVOTE, buf, p - buf);
}
void D_PickVote(void)
{
char buf[2];
char* p = buf;
SINT8 temppicks[MAXPLAYERS];
SINT8 templevels[MAXPLAYERS];
SINT8 votecompare = -1;
SINT8 temppicks[VOTE_TOTAL];
SINT8 templevels[VOTE_TOTAL];
SINT8 votecompare = VOTE_NOT_PICKED;
UINT8 numvotes = 0, key = 0;
INT32 i;
for (i = 0; i < MAXPLAYERS; i++)
for (i = 0; i < VOTE_TOTAL; i++)
{
if (!playeringame[i] || players[i].spectator)
if (Y_PlayerIDCanVote(i) == false)
{
continue;
if (votes[i] != -1)
}
if (g_votes[i] != VOTE_NOT_PICKED)
{
temppicks[numvotes] = i;
templevels[numvotes] = votes[i];
templevels[numvotes] = g_votes[i];
numvotes++;
if (votecompare == -1)
votecompare = votes[i];
if (votecompare == VOTE_NOT_PICKED)
{
votecompare = g_votes[i];
}
}
}
key = M_RandomKey(numvotes);
if (numvotes > 0)
{
key = M_RandomKey(numvotes);
WRITESINT8(p, temppicks[key]);
WRITESINT8(p, templevels[key]);
}
else
{
WRITESINT8(p, -1);
WRITESINT8(p, VOTE_NOT_PICKED);
WRITESINT8(p, 0);
}
@ -3205,7 +3241,7 @@ static void Command_RandomMap(void)
oldmapnum = -1;
}
newmapnum = G_RandMap(G_TOLFlag(newgametype), oldmapnum, 0, 0, false, NULL) + 1;
newmapnum = G_RandMap(G_TOLFlag(newgametype), oldmapnum, false, false, NULL) + 1;
D_MapChange(newmapnum, newgametype, newencore, newresetplayers, 0, false, false);
}
@ -5371,75 +5407,55 @@ static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum)
static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum)
{
boolean baseEncore = false;
boolean optionalEncore = false;
INT16 tempVoteLevels[VOTE_NUM_LEVELS][2];
INT32 i;
UINT8 gt, secondgt;
INT16 tempvotelevels[4][2];
if (playernum != serverplayer) // admin shouldn't be able to set up vote...
{
CONS_Alert(CONS_WARNING, M_GetText("Illegal vote setup received from %s\n"), player_names[playernum]);
if (server)
SendKick(playernum, KICK_MSG_CON_FAIL);
return;
}
gt = (UINT8)READUINT8(*cp);
secondgt = (UINT8)READUINT8(*cp);
// Strip illegal Encore flag.
if ((gt & VOTEMODIFIER_ENCORE)
&& !(gametypes[(gt & ~VOTEMODIFIER_ENCORE)]->rules & GTR_ENCORE))
{
gt &= ~VOTEMODIFIER_ENCORE;
}
if ((gt & ~VOTEMODIFIER_ENCORE) >= numgametypes)
{
gt &= ~VOTEMODIFIER_ENCORE;
if (server)
I_Error("Got_SetupVotecmd: Internal gametype ID %d not found (numgametypes = %d)", gt, numgametypes);
CONS_Alert(CONS_WARNING, M_GetText("Vote setup with bad gametype ID %d received from %s\n"), gt, player_names[playernum]);
return;
}
if ((secondgt & ~VOTEMODIFIER_ENCORE) >= numgametypes)
{
secondgt &= ~VOTEMODIFIER_ENCORE;
if (server)
I_Error("Got_SetupVotecmd: Internal second gametype ID %d not found (numgametypes = %d)", secondgt, numgametypes);
CONS_Alert(CONS_WARNING, M_GetText("Vote setup with bad second gametype ID %d received from %s\n"), secondgt, player_names[playernum]);
return;
}
for (i = 0; i < 4; i++)
{
tempvotelevels[i][0] = (UINT16)READUINT16(*cp);
tempvotelevels[i][1] = gt;
if (tempvotelevels[i][0] < nummapheaders && mapheaderinfo[tempvotelevels[i][0]])
continue;
if (server)
I_Error("Got_SetupVotecmd: Internal map ID %d not found (nummapheaders = %d)", tempvotelevels[i][0], nummapheaders);
CONS_Alert(CONS_WARNING, M_GetText("Vote setup with bad map ID %d received from %s\n"), tempvotelevels[i][0], player_names[playernum]);
return;
}
// If third entry has an illelegal Encore flag... (illelegal!?)
if ((secondgt & VOTEMODIFIER_ENCORE)
&& !(gametypes[(secondgt & ~VOTEMODIFIER_ENCORE)]->rules & GTR_ENCORE))
{
secondgt &= ~VOTEMODIFIER_ENCORE;
// Apply it to the second entry instead, gametype permitting!
if (gametypes[gt]->rules & GTR_ENCORE)
{
tempvotelevels[1][1] |= VOTEMODIFIER_ENCORE;
SendKick(playernum, KICK_MSG_CON_FAIL);
}
return;
}
// Finally, set third entry's gametype/Encore status.
tempvotelevels[2][1] = secondgt;
baseEncore = (boolean)READUINT8(*cp);
optionalEncore = (boolean)READUINT8(*cp);
memcpy(votelevels, tempvotelevels, sizeof(votelevels));
if (!(gametyperules & GTR_ENCORE))
{
// Strip illegal Encore flags.
baseEncore = optionalEncore = false;
}
for (i = 0; i < VOTE_NUM_LEVELS; i++)
{
tempVoteLevels[i][0] = (UINT16)READUINT16(*cp);
tempVoteLevels[i][1] = (baseEncore == true) ? VOTE_MOD_ENCORE : 0;
if (tempVoteLevels[i][0] < nummapheaders && mapheaderinfo[tempVoteLevels[i][0]])
{
continue;
}
if (server)
{
I_Error("Got_SetupVotecmd: Internal map ID %d not found (nummapheaders = %d)", tempVoteLevels[i][0], nummapheaders);
}
CONS_Alert(CONS_WARNING, M_GetText("Vote setup with bad map ID %d received from %s\n"), tempVoteLevels[i][0], player_names[playernum]);
return;
}
if (optionalEncore == true)
{
tempVoteLevels[VOTE_NUM_LEVELS - 1][1] ^= VOTE_MOD_ENCORE;
}
memcpy(g_voteLevels, tempVoteLevels, sizeof(g_voteLevels));
G_SetGamestate(GS_VOTING);
Y_StartVote();
@ -5447,11 +5463,48 @@ static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum)
static void Got_ModifyVotecmd(UINT8 **cp, INT32 playernum)
{
SINT8 voted = READSINT8(*cp);
UINT8 p = READUINT8(*cp);
UINT8 targetID = READUINT8(*cp);
SINT8 vote = READSINT8(*cp);
(void)playernum;
votes[p] = voted;
if (targetID == UINT8_MAX)
{
if (playernum != serverplayer) // server-only special vote
{
goto fail;
}
targetID = VOTE_SPECIAL;
}
else if (playeringame[targetID] == true && players[targetID].bot == true)
{
if (targetID >= MAXPLAYERS
|| playernum != serverplayer)
{
goto fail;
}
}
else
{
if (targetID >= MAXPLAYERS
|| playernode[targetID] != playernode[playernum])
{
goto fail;
}
}
Y_SetPlayersVote(targetID, vote);
return;
fail:
CONS_Alert(CONS_WARNING,
M_GetText ("Illegal modify vote command received from %s\n"),
player_names[playernum]
);
if (server)
{
SendKick(playernum, KICK_MSG_CON_FAIL);
}
}
static void Got_PickVotecmd(UINT8 **cp, INT32 playernum)
@ -5699,7 +5752,8 @@ static void Got_Cheat(UINT8 **cp, INT32 playernum)
break;
}
case CHEAT_RELATIVE_TELEPORT: {
case CHEAT_RELATIVE_TELEPORT:
case CHEAT_TELEPORT: {
fixed_t x = READFIXED(*cp);
fixed_t y = READFIXED(*cp);
fixed_t z = READFIXED(*cp);
@ -5714,10 +5768,17 @@ static void Got_Cheat(UINT8 **cp, INT32 playernum)
if (!P_MobjWasRemoved(player->mo))
{
P_MapStart();
P_SetOrigin(player->mo,
player->mo->x + x,
player->mo->y + y,
player->mo->z + z);
if (cheat == CHEAT_RELATIVE_TELEPORT)
{
P_SetOrigin(player->mo,
player->mo->x + x,
player->mo->y + y,
player->mo->z + z);
}
else
{
P_SetOrigin(player->mo, x, y, z);
}
P_MapEnd();
S_StartSound(player->mo, sfx_mixup);
@ -5727,7 +5788,10 @@ static void Got_Cheat(UINT8 **cp, INT32 playernum)
strlcpy(t[1], M_Ftrim(f[1]), sizeof t[1]);
strlcpy(t[2], M_Ftrim(f[2]), sizeof t[2]);
CV_CheaterWarning(targetPlayer, va("relative teleport by %d%s, %d%s, %d%s",
CV_CheaterWarning(targetPlayer, va("%s %d%s, %d%s, %d%s",
cheat == CHEAT_RELATIVE_TELEPORT
? "relative teleport by"
: "teleport to",
(int)f[0], t[0], (int)f[1], t[1], (int)f[2], t[2]));
break;
}
@ -5777,6 +5841,16 @@ static void Got_Cheat(UINT8 **cp, INT32 playernum)
break;
}
case CHEAT_ANGLE: {
angle_t angle = READANGLE(*cp);
float anglef = FIXED_TO_FLOAT(AngleFixed(angle));
P_SetPlayerAngle(player, angle);
CV_CheaterWarning(targetPlayer, va("angle = %d%s", (int)anglef, M_Ftrim(anglef)));
break;
}
case NUMBER_OF_CHEATS:
break;
}

View file

@ -90,6 +90,7 @@ extern consvar_t cv_karteliminatelast;
extern consvar_t cv_kartusepwrlv;
extern consvar_t cv_votetime;
extern consvar_t cv_botscanvote;
extern consvar_t cv_kartdebugitem, cv_kartdebugamount, cv_kartdebugdistribution, cv_kartdebughuddrop;
extern consvar_t cv_kartdebugnodes, cv_kartdebugcolorize, cv_kartdebugdirector;
@ -240,7 +241,7 @@ void Command_Retry_f(void);
void D_GameTypeChanged(INT32 lastgametype); // not a real _OnChange function anymore
void D_MapChange(INT32 pmapnum, INT32 pgametype, boolean pencoremode, boolean presetplayers, INT32 pdelay, boolean pskipprecutscene, boolean pfromlevelselect);
void D_SetupVote(void);
void D_ModifyClientVote(UINT8 player, SINT8 voted, UINT8 splitplayer);
void D_ModifyClientVote(UINT8 player, SINT8 voted);
void D_PickVote(void);
void ObjectPlace_OnChange(void);
boolean IsPlayerAdmin(INT32 playernum);

View file

@ -410,6 +410,9 @@ struct mapheader_t
cupheader_t *cup; ///< Cached cup
size_t justPlayed; ///< Prevent this map from showing up in votes if it was recently picked.
size_t anger; ///< No one picked this map... it's mad now.
// Titlecard information
char lvlttl[22]; ///< Level name without "Zone". (21 character limit instead of 32, 21 characters can display on screen max anyway)
char subttl[33]; ///< Subtitle for level
@ -488,8 +491,8 @@ extern mapheader_t** mapheaderinfo;
extern INT32 nummapheaders, mapallocsize;
// Gametypes
#define NUMGAMETYPEFREESLOTS (MAXGAMETYPES-GT_FIRSTFREESLOT)
#define MAXGAMETYPELENGTH 32
#define NUMGAMETYPEFREESLOTS (128)
#define MAXGAMETYPELENGTH (32)
enum GameType
{
@ -500,7 +503,7 @@ enum GameType
GT_TUTORIAL,
GT_FIRSTFREESLOT,
GT_LASTFREESLOT = 127, // Previously (GT_FIRSTFREESLOT + NUMGAMETYPEFREESLOTS - 1) - it would be necessary to rewrite VOTEMODIFIER_ENCORE to go higher than this.
GT_LASTFREESLOT = GT_FIRSTFREESLOT + NUMGAMETYPEFREESLOTS - 1,
MAXGAMETYPES
};
// If you alter this list, update defaultgametypes and *gametypes in g_game.c
@ -732,9 +735,11 @@ extern boolean legitimateexit;
extern boolean comebackshowninfo;
extern tic_t curlap, bestlap;
extern INT16 votelevels[4][2];
extern SINT8 votes[MAXPLAYERS];
extern SINT8 pickedvote;
#define VOTE_SPECIAL (MAXPLAYERS)
#define VOTE_TOTAL (MAXPLAYERS+1)
extern UINT16 g_voteLevels[4][2];
extern SINT8 g_votes[VOTE_TOTAL];
extern SINT8 g_pickedVote;
// ===========================
// Internal parameters, fixed.

View file

@ -2250,7 +2250,7 @@ void F_TitleScreenTicker(boolean run)
// prevent console spam if failed
demoIdleLeft = demoIdleTime;
mapnum = G_RandMap(TOL_RACE|TOL_BATTLE, -2, 2, 0, false, NULL);
mapnum = G_RandMap(TOL_RACE|TOL_BATTLE, UINT16_MAX-1, true, false, NULL);
if (mapnum == 0) // gotta have ONE
{
return;

View file

@ -298,9 +298,9 @@ boolean prevencoremode;
boolean franticitems; // Frantic items currently enabled?
// Voting system
INT16 votelevels[4][2]; // Levels that were rolled by the host
SINT8 votes[MAXPLAYERS]; // Each player's vote
SINT8 pickedvote; // What vote the host rolls
UINT16 g_voteLevels[4][2]; // Levels that were rolled by the host
SINT8 g_votes[VOTE_TOTAL]; // Each player's vote
SINT8 g_pickedVote; // What vote the host rolls
// Server-sided, synched variables
tic_t wantedcalcdelay; // Time before it recalculates WANTED
@ -319,23 +319,6 @@ boolean comebackshowninfo; // Have you already seen the "ATTACK OR PROTECT" mess
tic_t curlap; // Current lap time
tic_t bestlap; // Best lap time
typedef struct
{
INT16 *mapbuffer; // Pointer to zone memory
INT32 lastnummapheaders; // Reset if nummapheaders != this
} randmaps_t;
static randmaps_t randmaps = {NULL, 0};
static void G_ResetRandMapBuffer(void)
{
INT32 i;
Z_Free(randmaps.mapbuffer);
randmaps.lastnummapheaders = nummapheaders;
randmaps.mapbuffer = Z_Malloc(randmaps.lastnummapheaders * sizeof(INT16), PU_STATIC, NULL);
for (i = 0; i < randmaps.lastnummapheaders; i++)
randmaps.mapbuffer[i] = -1;
}
typedef struct joystickvector2_s
{
INT32 xaxis;
@ -3627,32 +3610,28 @@ boolean G_GametypeHasSpectators(void)
}
//
// G_SometimesGetDifferentGametype
// G_SometimesGetDifferentEncore
//
// Because gametypes are no longer on the vote screen, all this does is sometimes flip encore mode.
// However, it remains a seperate function for long-term possibility.
//
INT16 G_SometimesGetDifferentGametype(void)
INT16 G_SometimesGetDifferentEncore(void)
{
boolean encorepossible = ((M_SecretUnlocked(SECRET_ENCORE, false) || encorescramble == 1)
&& (gametyperules & GTR_ENCORE));
UINT8 encoremodifier = 0;
// -- the below is only necessary if you want to use randmaps.mapbuffer here
//if (randmaps.lastnummapheaders != nummapheaders)
//G_ResetRandMapBuffer();
// FORCE to what was scrambled on intermission?
if (encorepossible && encorescramble != -1)
{
// FORCE to what was scrambled on intermission
if ((encorescramble != 0) != (cv_kartencore.value == 1))
{
encoremodifier = VOTEMODIFIER_ENCORE;
encoremodifier = VOTE_MOD_ENCORE;
}
}
return (gametype|encoremodifier);
return encoremodifier;
}
/** Get the typeoflevel flag needed to indicate support of a gametype.
@ -3708,14 +3687,33 @@ static INT32 TOLMaps(UINT8 pgametype)
// Find all the maps that are ok
for (i = 0; i < nummapheaders; i++)
{
if (!mapheaderinfo[i])
if (mapheaderinfo[i] == NULL)
{
continue;
}
if (mapheaderinfo[i]->lumpnum == LUMPERROR)
{
continue;
if (!(mapheaderinfo[i]->typeoflevel & tolflag))
}
if ((mapheaderinfo[i]->typeoflevel & tolflag) == 0)
{
continue;
if (mapheaderinfo[i]->menuflags & LF2_HIDEINMENU) // Don't include Map Hell
}
if (mapheaderinfo[i]->menuflags & LF2_HIDEINMENU)
{
// Don't include hidden
continue;
}
if (M_MapLocked(i + 1))
{
// Don't include locked
continue;
}
num++;
}
@ -3730,168 +3728,174 @@ static INT32 TOLMaps(UINT8 pgametype)
* has those flags.
* \author Graue <graue@oceanbase.org>
*/
static INT16 *okmaps = NULL;
INT16 G_RandMap(UINT32 tolflags, INT16 pprevmap, UINT8 ignorebuffer, UINT8 maphell, boolean callagainsoon, INT16 *extbuffer)
static UINT16 *g_allowedMaps = NULL;
#ifdef PARANOIA
static size_t g_randMapStack = 0;
#endif
UINT16 G_RandMap(UINT32 tolflags, UINT16 pprevmap, boolean ignoreBuffers, boolean callAgainSoon, UINT16 *extBuffer)
{
UINT32 numokmaps = 0;
INT16 ix, bufx;
UINT16 extbufsize = 0;
boolean usehellmaps; // Only consider Hell maps in this pick
INT32 allowedMapsCount = 0;
INT32 extBufferCount = 0;
UINT16 ret = 0;
INT32 i, j;
if (randmaps.lastnummapheaders != nummapheaders)
G_ResetRandMapBuffer();
#ifdef PARANOIA
g_randMapStack++;
#endif
if (!okmaps)
if (g_allowedMaps == NULL)
{
//CONS_Printf("(making okmaps)\n");
okmaps = Z_Malloc(nummapheaders * sizeof(INT16), PU_STATIC, NULL);
g_allowedMaps = Z_Malloc(nummapheaders * sizeof(UINT16), PU_STATIC, NULL);
}
if (extbuffer != NULL)
if (extBuffer != NULL)
{
bufx = 0;
while (extbuffer[bufx])
for (i = 0; extBuffer[i] != UINT16_MAX; i++)
{
extbufsize++; bufx++;
extBufferCount++;
}
}
tryagain:
tryAgain:
usehellmaps = (maphell == 0 ? false : (maphell == 2 || M_RandomChance(FRACUNIT/100))); // 1% chance of Hell
// Find all the maps that are ok and and put them in an array.
for (ix = 0; ix < nummapheaders; ix++)
for (i = 0; i < nummapheaders; i++)
{
boolean isokmap = true;
if (!mapheaderinfo[ix] || mapheaderinfo[ix]->lumpnum == LUMPERROR)
continue;
if (!(mapheaderinfo[ix]->typeoflevel & tolflags)
|| ix == pprevmap
|| M_MapLocked(ix+1)
|| (usehellmaps != (mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU))) // this is bad
continue; //isokmap = false;
if (pprevmap == -2 // title demo hack
&& mapheaderinfo[ix]->ghostCount == 0)
continue;
if (!ignorebuffer)
if (mapheaderinfo[i] == NULL || mapheaderinfo[i]->lumpnum == LUMPERROR)
{
if (extbufsize > 0)
// Doesn't exist?
continue;
}
if (i == pprevmap)
{
// We were just here.
continue;
}
if ((mapheaderinfo[i]->typeoflevel & tolflags) == 0)
{
// Doesn't match our gametype.
continue;
}
if (pprevmap == UINT16_MAX-1 // title demo hack (FUCK YOU, MAKE IT A BOOL)
&& mapheaderinfo[i]->ghostCount == 0)
{
// Doesn't have any ghosts, so it's not suitable for title demos.
continue;
}
if ((mapheaderinfo[i]->menuflags & LF2_HIDEINMENU) == LF2_HIDEINMENU)
{
// Not intended to be accessed in multiplayer.
continue;
}
if (M_MapLocked(i + 1) == true)
{
// We haven't earned this one.
continue;
}
if (ignoreBuffers == false)
{
if (mapheaderinfo[i]->justPlayed > 0)
{
for (bufx = 0; bufx < extbufsize; bufx++)
// We just played this map, don't play it again.
continue;
}
if (extBufferCount > 0)
{
boolean inExt = false;
// An optional additional buffer,
// to avoid duplicates on the voting screen.
for (j = 0; j < extBufferCount; j++)
{
if (extbuffer[bufx] == -1) // Rest of buffer SHOULD be empty
break;
if (ix == extbuffer[bufx])
if (extBuffer[j] >= nummapheaders)
{
isokmap = false;
// Rest of buffer SHOULD be empty.
break;
}
if (i == extBuffer[j])
{
// Map is in this other buffer, don't duplicate.
inExt = true;
break;
}
}
if (!isokmap)
continue;
}
for (bufx = 0; bufx < (maphell ? 3 : randmaps.lastnummapheaders); bufx++)
{
if (randmaps.mapbuffer[bufx] == -1) // Rest of buffer SHOULD be empty
break;
if (ix == randmaps.mapbuffer[bufx])
if (inExt == true)
{
isokmap = false;
break;
// Didn't make it out of this buffer, so don't add this map.
continue;
}
}
if (!isokmap)
continue;
}
okmaps[numokmaps++] = ix;
// Got past the gauntlet, so we can allow this one.
g_allowedMaps[ allowedMapsCount++ ] = i;
}
if (numokmaps == 0) // If there's no matches... (Goodbye, incredibly silly function chains :V)
if (allowedMapsCount == 0)
{
if (!ignorebuffer)
// No maps are available.
if (ignoreBuffers == false)
{
if (randmaps.mapbuffer[3] == -1) // Is the buffer basically empty?
{
ignorebuffer = 1; // This will probably only help in situations where there's very few maps, but it's folly not to at least try it
//CONS_Printf("RANDMAP - ignoring buffer\n");
goto tryagain;
}
for (bufx = 3; bufx < randmaps.lastnummapheaders; bufx++) // Let's clear all but the three most recent maps...
randmaps.mapbuffer[bufx] = -1;
//CONS_Printf("RANDMAP - emptying randmapbuffer\n");
goto tryagain;
// Try again with ignoring the buffer before giving up.
ignoreBuffers = true;
goto tryAgain;
}
if (maphell) // Any wiggle room to loosen our restrictions here?
{
//CONS_Printf("RANDMAP -maphell decrement\n");
maphell--;
goto tryagain;
}
//CONS_Printf("RANDMAP - defaulting to map01\n");
ix = 0; // Sorry, none match. You get MAP01.
if (ignorebuffer == 1)
{
//CONS_Printf("(emptying randmapbuffer entirely)\n");
for (bufx = 0; bufx < randmaps.lastnummapheaders; bufx++)
randmaps.mapbuffer[bufx] = -1; // if we're having trouble finding a map we should probably clear it
}
// Nothing else actually worked. Welp!
// You just get whatever was added first.
ret = 0;
}
else
{
//CONS_Printf("RANDMAP - %d maps available to grab\n", numokmaps);
ix = okmaps[M_RandomKey(numokmaps)];
ret = g_allowedMaps[ M_RandomKey(allowedMapsCount) ];
}
if (!callagainsoon)
if (callAgainSoon == false)
{
//CONS_Printf("(freeing okmaps)\n");
Z_Free(okmaps);
okmaps = NULL;
Z_Free(g_allowedMaps);
g_allowedMaps = NULL;
#ifdef PARANOIA
// Crash if callAgainSoon was mishandled.
I_Assert(g_randMapStack == 1);
#endif
}
return ix;
#ifdef PARANOIA
g_randMapStack--;
#endif
return ret;
}
void G_AddMapToBuffer(INT16 map)
void G_AddMapToBuffer(UINT16 map)
{
INT16 bufx;
INT16 refreshnum = (TOLMaps(gametype))-3;
if (refreshnum < 0)
refreshnum = 3;
if (nummapheaders != randmaps.lastnummapheaders)
if (mapheaderinfo[map]->justPlayed == 0) // Started playing a new map.
{
G_ResetRandMapBuffer();
}
else
{
for (bufx = randmaps.lastnummapheaders-1; bufx > 0; bufx--)
randmaps.mapbuffer[bufx] = randmaps.mapbuffer[bufx-1];
// Decrement every maps' justPlayed value.
INT32 i;
for (i = 0; i < nummapheaders; i++)
{
if (mapheaderinfo[i]->justPlayed > 0)
{
mapheaderinfo[i]->justPlayed--;
}
}
}
randmaps.mapbuffer[0] = map;
// We're getting pretty full, so lets flush this for future usage.
if (randmaps.mapbuffer[refreshnum] != -1)
{
// Clear all but the five most recent maps.
for (bufx = 5; bufx < randmaps.lastnummapheaders; bufx++)
randmaps.mapbuffer[bufx] = -1;
//CONS_Printf("Random map buffer has been flushed.\n");
}
// Set our map's justPlayed value.
mapheaderinfo[map]->justPlayed = TOLMaps(gametype) - VOTE_NUM_LEVELS;
mapheaderinfo[map]->anger = 0; // Reset voting anger now that we're playing it
}
//
@ -4218,7 +4222,7 @@ static void G_GetNextMap(void)
}
/* FALLTHRU */
case 2: // Go to random map.
nextmap = G_RandMap(G_TOLFlag(gametype), prevmap, 0, 0, false, NULL);
nextmap = G_RandMap(G_TOLFlag(gametype), prevmap, false, false, NULL);
break;
default:
if (nextmap >= NEXTMAP_SPECIAL) // Loop back around
@ -5378,8 +5382,6 @@ void G_DeferedInitNew(boolean pencoremode, INT32 map, INT32 pickedchar, UINT8 ss
G_FreeGhosts(); // TODO: do we actually need to do this?
G_ResetRandMapBuffer();
// this leave the actual game if needed
SV_StartSinglePlayerServer(gametype, false);
@ -5508,6 +5510,8 @@ void G_InitNew(UINT8 pencoremode, INT32 map, boolean resetplayer, boolean skippr
}
CON_LogMessage("\"\n");
}
G_AddMapToBuffer(gamemap - 1);
}

View file

@ -182,8 +182,7 @@ INT32 G_GuessGametypeByTOL(UINT32 tol);
boolean G_GametypeUsesLives(void);
boolean G_GametypeHasTeams(void);
boolean G_GametypeHasSpectators(void);
#define VOTEMODIFIER_ENCORE 0x80
INT16 G_SometimesGetDifferentGametype(void);
INT16 G_SometimesGetDifferentEncore(void);
void G_ExitLevel(void);
void G_NextLevel(void);
void G_Continue(void);
@ -256,8 +255,8 @@ FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics);
UINT32 G_TOLFlag(INT32 pgametype);
INT16 G_GetFirstMapOfGametype(UINT8 pgametype);
INT16 G_RandMap(UINT32 tolflags, INT16 pprevmap, UINT8 ignorebuffer, UINT8 maphell, boolean callagainsoon, INT16 *extbuffer);
void G_AddMapToBuffer(INT16 map);
UINT16 G_RandMap(UINT32 tolflags, UINT16 pprevmap, boolean ignoreBuffers, boolean callAgainSoon, UINT16 *extBuffer);
void G_AddMapToBuffer(UINT16 map);
#ifdef __cplusplus
} // extern "C"

View file

@ -750,7 +750,8 @@ static const char *gamecontrolname[num_gamecontrols] =
"teamtalk",
"rankings",
"screenshot",
"recordgif",
"startmovie",
"startlossless",
};
#define NUMKEYNAMES (sizeof (keynames)/sizeof (keyname_t))
@ -889,20 +890,23 @@ void G_DefineDefaultControls(void)
{
// These defaults are less bad than they used to be.
// Keyboard controls
gamecontroldefault[gc_up ][0] = KEY_UPARROW;
gamecontroldefault[gc_down ][0] = KEY_DOWNARROW;
gamecontroldefault[gc_left ][0] = KEY_LEFTARROW;
gamecontroldefault[gc_right ][0] = KEY_RIGHTARROW;
gamecontroldefault[gc_a ][0] = 'f';
gamecontroldefault[gc_b ][0] = 'a';
gamecontroldefault[gc_c ][0] = 'v';
gamecontroldefault[gc_x ][0] = 's';
gamecontroldefault[gc_y ][0] = 'x';
gamecontroldefault[gc_z ][0] = 'c';
gamecontroldefault[gc_l ][0] = KEY_SPACE;
gamecontroldefault[gc_r ][0] = 'd';
gamecontroldefault[gc_start ][0] = KEY_ESCAPE;
gamecontroldefault[gc_rankings][0] = KEY_TAB;
gamecontroldefault[gc_up ][0] = KEY_UPARROW;
gamecontroldefault[gc_down ][0] = KEY_DOWNARROW;
gamecontroldefault[gc_left ][0] = KEY_LEFTARROW;
gamecontroldefault[gc_right ][0] = KEY_RIGHTARROW;
gamecontroldefault[gc_a ][0] = 'f';
gamecontroldefault[gc_b ][0] = 'a';
gamecontroldefault[gc_c ][0] = 'v';
gamecontroldefault[gc_x ][0] = 's';
gamecontroldefault[gc_y ][0] = 'x';
gamecontroldefault[gc_z ][0] = 'c';
gamecontroldefault[gc_l ][0] = KEY_SPACE;
gamecontroldefault[gc_r ][0] = 'd';
gamecontroldefault[gc_start ][0] = KEY_ESCAPE;
gamecontroldefault[gc_rankings ][0] = KEY_TAB;
gamecontroldefault[gc_screenshot ][0] = KEY_F8;
gamecontroldefault[gc_startmovie ][0] = KEY_F9;
gamecontroldefault[gc_startlossless][0] = KEY_F10;
// Gamepad controls
gamecontroldefault[gc_up ][1] = KEY_HAT1+0; // D-Pad Up

View file

@ -84,7 +84,8 @@ typedef enum
gc_teamtalk,
gc_rankings,
gc_screenshot,
gc_recordgif,
gc_startmovie,
gc_startlossless,
num_gamecontrols,

View file

@ -1215,7 +1215,8 @@ boolean HU_Responder(event_t *ev)
if (!chat_on)
{
// enter chat mode
if ((ev->data1 == gamecontrol[0][gc_talk][0] || ev->data1 == gamecontrol[0][gc_talk][1])
if ((ev->data1 == gamecontrol[0][gc_talk][0] || ev->data1 == gamecontrol[0][gc_talk][1]
|| ev->data1 == gamecontrol[0][gc_talk][2] || ev->data1 == gamecontrol[0][gc_talk][3])
&& netgame && !OLD_MUTE) // check for old chat mute, still let the players open the chat incase they want to scroll otherwise.
{
chat_on = true;
@ -1225,7 +1226,8 @@ boolean HU_Responder(event_t *ev)
typelines = 1;
return true;
}
if ((ev->data1 == gamecontrol[0][gc_teamtalk][0] || ev->data1 == gamecontrol[0][gc_teamtalk][1])
if ((ev->data1 == gamecontrol[0][gc_teamtalk][0] || ev->data1 == gamecontrol[0][gc_teamtalk][1]
|| ev->data1 == gamecontrol[0][gc_teamtalk][2] || ev->data1 == gamecontrol[0][gc_teamtalk][3])
&& netgame && !OLD_MUTE)
{
chat_on = true;

View file

@ -342,6 +342,7 @@ void K_RegisterKartStuff(void)
CV_RegisterVar(&cv_karteliminatelast);
CV_RegisterVar(&cv_kartusepwrlv);
CV_RegisterVar(&cv_votetime);
CV_RegisterVar(&cv_botscanvote);
CV_RegisterVar(&cv_kartdebugitem);
CV_RegisterVar(&cv_kartdebugamount);

View file

@ -541,7 +541,10 @@ typedef enum
MBT_Z = 1<<5,
MBT_L = 1<<6,
MBT_R = 1<<7,
MBT_START = 1<<8
MBT_START = 1<<8,
MBT_SCREENSHOT = 1<<9,
MBT_STARTMOVIE = 1<<10,
MBT_STARTLOSSLESS = 1<<11,
} menuButtonCode_t;
struct menucmd_t

View file

@ -5282,7 +5282,7 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
static UINT16 encoremapcache = NEXTMAP_INVALID;
if (encoremapcache > nummapheaders)
{
encoremapcache = G_RandMap(G_TOLFlag(GT_RACE), -1, 2, 0, false, NULL);
encoremapcache = G_RandMap(G_TOLFlag(GT_RACE), UINT16_MAX, true, false, NULL);
}
specialmap = encoremapcache;
break;
@ -5292,7 +5292,7 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
static UINT16 tamapcache = NEXTMAP_INVALID;
if (tamapcache > nummapheaders)
{
tamapcache = G_RandMap(G_TOLFlag(GT_RACE), -1, 2, 0, false, NULL);
tamapcache = G_RandMap(G_TOLFlag(GT_RACE), UINT16_MAX, true, false, NULL);
}
specialmap = tamapcache;
break;
@ -5302,7 +5302,7 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
static UINT16 btcmapcache = NEXTMAP_INVALID;
if (btcmapcache > nummapheaders)
{
btcmapcache = G_RandMap(G_TOLFlag(GT_BATTLE), -1, 2, 0, false, NULL);
btcmapcache = G_RandMap(G_TOLFlag(GT_BATTLE), UINT16_MAX, true, false, NULL);
}
specialmap = btcmapcache;
break;
@ -5312,7 +5312,7 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
static UINT16 sscmapcache = NEXTMAP_INVALID;
if (sscmapcache > nummapheaders)
{
sscmapcache = G_RandMap(G_TOLFlag(GT_SPECIAL), -1, 2, 0, false, NULL);
sscmapcache = G_RandMap(G_TOLFlag(GT_SPECIAL), UINT16_MAX, true, false, NULL);
}
specialmap = sscmapcache;
break;
@ -5322,7 +5322,7 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
static UINT16 spbmapcache = NEXTMAP_INVALID;
if (spbmapcache > nummapheaders)
{
spbmapcache = G_RandMap(G_TOLFlag(GT_RACE), -1, 2, 0, false, NULL);
spbmapcache = G_RandMap(G_TOLFlag(GT_RACE), UINT16_MAX, true, false, NULL);
}
specialmap = spbmapcache;
break;
@ -5332,7 +5332,7 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
static UINT16 hardmapcache = NEXTMAP_INVALID;
if (hardmapcache > nummapheaders)
{
hardmapcache = G_RandMap(G_TOLFlag(GT_RACE), -1, 2, 0, false, NULL);
hardmapcache = G_RandMap(G_TOLFlag(GT_RACE), UINT16_MAX, true, false, NULL);
}
specialmap = hardmapcache;
break;
@ -5342,7 +5342,7 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
static UINT16 mastermapcache = NEXTMAP_INVALID;
if (mastermapcache > nummapheaders)
{
mastermapcache = G_RandMap(G_TOLFlag(GT_RACE), -1, 2, 0, false, NULL);
mastermapcache = G_RandMap(G_TOLFlag(GT_RACE), UINT16_MAX, true, false, NULL);
}
specialmap = mastermapcache;
break;

View file

@ -754,10 +754,18 @@ void M_UpdateMenuCMD(UINT8 i)
menucmd[i].buttonsHeld = menucmd[i].buttons;
menucmd[i].buttons = 0;
if (G_PlayerInputDown(i, gc_up, mp)) { menucmd[i].dpad_ud--; }
if (G_PlayerInputDown(i, gc_screenshot, mp)) { menucmd[i].buttons |= MBT_SCREENSHOT; }
if (G_PlayerInputDown(i, gc_startmovie, mp)) { menucmd[i].buttons |= MBT_STARTMOVIE; }
if (G_PlayerInputDown(i, gc_startlossless, mp)) { menucmd[i].buttons |= MBT_STARTLOSSLESS; }
// Screenshot et al take priority
if (menucmd[i].buttons != 0)
return;
if (G_PlayerInputDown(i, gc_up, mp)) { menucmd[i].dpad_ud--; }
if (G_PlayerInputDown(i, gc_down, mp)) { menucmd[i].dpad_ud++; }
if (G_PlayerInputDown(i, gc_left, mp)) { menucmd[i].dpad_lr--; }
if (G_PlayerInputDown(i, gc_left, mp)) { menucmd[i].dpad_lr--; }
if (G_PlayerInputDown(i, gc_right, mp)) { menucmd[i].dpad_lr++; }
if (G_PlayerInputDown(i, gc_a, mp)) { menucmd[i].buttons |= MBT_A; }
@ -768,6 +776,7 @@ void M_UpdateMenuCMD(UINT8 i)
if (G_PlayerInputDown(i, gc_z, mp)) { menucmd[i].buttons |= MBT_Z; }
if (G_PlayerInputDown(i, gc_l, mp)) { menucmd[i].buttons |= MBT_L; }
if (G_PlayerInputDown(i, gc_r, mp)) { menucmd[i].buttons |= MBT_R; }
if (G_PlayerInputDown(i, gc_start, mp)) { menucmd[i].buttons |= MBT_START; }
if (menucmd[i].dpad_ud == 0 && menucmd[i].dpad_lr == 0 && menucmd[i].buttons == 0)

View file

@ -425,7 +425,9 @@ void PR_LoadProfiles(void)
{
#ifdef DEVELOP
// Profile update 1-->2: Add gc_rankings.
if (j == gc_rankings && version < 2)
// Profile update 3-->5: Add gc_startlossless.
if ((j == gc_rankings && version < 2) ||
(j == gc_startlossless && version < 5))
{
for (k = 0; k < MAXINPUTMAPPING; k++)
{

View file

@ -31,7 +31,7 @@ extern "C" {
#define SKINNAMESIZE 16
#define PROFILENAMELEN 6
#define PROFILEVER 4
#define PROFILEVER 5
#define MAXPROFILES 16
#define PROFILESFILE "ringprofiles.prf"
#define PROFILE_GUEST 0

File diff suppressed because it is too large Load diff

View file

@ -19,6 +19,14 @@
extern "C" {
#endif
#define VOTE_NUM_LEVELS (4)
#define VOTE_NOT_PICKED (-1)
#define VOTE_MOD_ENCORE (0x01)
boolean Y_PlayerIDCanVote(const UINT8 playerId);
void Y_SetPlayersVote(const UINT8 playerId, SINT8 vote);
void Y_VoteDrawer(void);
void Y_VoteTicker(void);
void Y_StartVote(void);

View file

@ -327,223 +327,21 @@ void Command_RTeleport_f(void)
void Command_Teleport_f(void)
{
fixed_t intx, inty, intz;
size_t i;
player_t *p = &players[consoleplayer];
subsector_t *ss;
float x = atof(COM_Argv(1));
float y = atof(COM_Argv(2));
float z = atof(COM_Argv(3));
REQUIRE_CHEATS;
REQUIRE_INLEVEL;
REQUIRE_SINGLEPLAYER; // TODO: make multiplayer compatible
if (COM_Argc() < 3 || COM_Argc() > 11)
if (COM_Argc() != 4)
{
CONS_Printf(M_GetText("teleport -x <value> -y <value> -z <value> -ang <value> -aim <value>: teleport to a location\nteleport -sp <sequence> <placement>: teleport to specified checkpoint\n"));
CONS_Printf(M_GetText("teleport <x> <y> <z>: teleport to a location\n"));
return;
}
if (!p->mo)
return;
i = COM_CheckParm("-sp");
if (i)
{
INT32 starpostnum = atoi(COM_Argv(i + 1)); // starpost number
INT32 starpostpath = atoi(COM_Argv(i + 2)); // quick, dirty way to distinguish between paths
if (starpostnum < 0 || starpostpath < 0)
{
CONS_Alert(CONS_NOTICE, M_GetText("Negative starpost indexing is not valid.\n"));
return;
}
if (!starpostnum) // spawnpoints...
{
mapthing_t *mt;
fixed_t offset;
if (starpostpath >= numcoopstarts)
{
CONS_Alert(CONS_NOTICE, M_GetText("Player %d spawnpoint not found (%d max).\n"), starpostpath+1, numcoopstarts-1);
return;
}
mt = playerstarts[starpostpath]; // Given above check, should never be NULL.
intx = mt->x<<FRACBITS;
inty = mt->y<<FRACBITS;
offset = mt->z<<FRACBITS;
ss = R_PointInSubsectorOrNull(intx, inty);
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
{
CONS_Alert(CONS_NOTICE, M_GetText("Spawnpoint not in a valid location.\n"));
return;
}
// Flagging a player's ambush will make them start on the ceiling
// Objectflip inverts
if (!!(mt->args[0]) ^ !!(mt->options & MTF_OBJECTFLIP))
intz = ss->sector->ceilingheight - p->mo->height - offset;
else
intz = ss->sector->floorheight + offset;
if (mt->options & MTF_OBJECTFLIP) // flip the player!
{
p->mo->eflags |= MFE_VERTICALFLIP;
p->mo->flags2 |= MF2_OBJECTFLIP;
}
else
{
p->mo->eflags &= ~MFE_VERTICALFLIP;
p->mo->flags2 &= ~MF2_OBJECTFLIP;
}
p->mo->angle = p->drawangle = FixedAngle(mt->angle<<FRACBITS);
P_SetPlayerAngle(p, p->mo->angle);
}
else // scan the thinkers to find starposts...
{
mobj_t *mo2 = NULL;
thinker_t *th;
INT32 starpostmax = 0;
intz = starpostpath; // variable reuse - counting down for selection purposes
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type != MT_STARPOST)
continue;
if (mo2->health != starpostnum)
{
if (mo2->health > starpostmax)
starpostmax = mo2->health;
continue;
}
if (intz--)
continue;
break;
}
if (th == &thlist[THINK_MOBJ])
{
if (intz == starpostpath)
CONS_Alert(CONS_NOTICE, M_GetText("No starpost of position %d found (%d max).\n"), starpostnum, starpostmax);
else
CONS_Alert(CONS_NOTICE, M_GetText("Starpost of position %d, %d not found (%d, %d max).\n"), starpostnum, starpostpath, starpostmax, (starpostpath-intz)-1);
return;
}
ss = R_PointInSubsectorOrNull(mo2->x, mo2->y);
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
{
CONS_Alert(CONS_NOTICE, M_GetText("Starpost not in a valid location.\n"));
return;
}
intx = mo2->x;
inty = mo2->y;
intz = mo2->z;
if (mo2->flags2 & MF2_OBJECTFLIP) // flip the player!
{
p->mo->eflags |= MFE_VERTICALFLIP;
p->mo->flags2 |= MF2_OBJECTFLIP;
}
else
{
p->mo->eflags &= ~MFE_VERTICALFLIP;
p->mo->flags2 &= ~MF2_OBJECTFLIP;
}
p->mo->angle = p->drawangle = mo2->angle;
P_SetPlayerAngle(p, p->mo->angle);
}
CONS_Printf(M_GetText("Teleporting to checkpoint %d, %d...\n"), starpostnum, starpostpath);
}
else
{
i = COM_CheckParm("-nop"); // undocumented stupid addition to allow pivoting on the spot with -ang and -aim
if (i)
{
intx = p->mo->x;
inty = p->mo->y;
}
else
{
i = COM_CheckParm("-x");
if (i)
intx = atoi(COM_Argv(i + 1))<<FRACBITS;
else
{
CONS_Alert(CONS_NOTICE, M_GetText("%s value not specified.\n"), "X");
return;
}
i = COM_CheckParm("-y");
if (i)
inty = atoi(COM_Argv(i + 1))<<FRACBITS;
else
{
CONS_Alert(CONS_NOTICE, M_GetText("%s value not specified.\n"), "Y");
return;
}
}
ss = R_PointInSubsectorOrNull(intx, inty);
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
{
CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n"));
return;
}
i = COM_CheckParm("-z");
if (i)
{
intz = atoi(COM_Argv(i + 1))<<FRACBITS;
if (intz < ss->sector->floorheight)
intz = ss->sector->floorheight;
if (intz > ss->sector->ceilingheight - p->mo->height)
intz = ss->sector->ceilingheight - p->mo->height;
}
else
intz = ((p->mo->eflags & MFE_VERTICALFLIP) ? ss->sector->ceilingheight : ss->sector->floorheight);
i = COM_CheckParm("-ang");
if (i)
{
p->drawangle = p->mo->angle = FixedAngle(atoi(COM_Argv(i + 1))<<FRACBITS);
P_SetPlayerAngle(p, p->mo->angle);
}
i = COM_CheckParm("-aim");
if (i)
{
angle_t aim = FixedAngle(atoi(COM_Argv(i + 1))<<FRACBITS);
if (aim >= ANGLE_90 && aim <= ANGLE_270)
{
CONS_Alert(CONS_NOTICE, M_GetText("Not a valid aiming angle (between +/-90).\n"));
return;
}
localaiming[0] = p->aiming = aim;
}
CONS_Printf(M_GetText("Teleporting to %d, %d, %d...\n"), FixedInt(intx), FixedInt(inty), FixedInt(intz));
}
P_MapStart();
if (!P_SetOrigin(p->mo, intx, inty, intz))
CONS_Alert(CONS_WARNING, M_GetText("Unable to teleport to that spot!\n"));
else
S_StartSound(p->mo, sfx_mixup);
P_MapEnd();
D_Cheat(consoleplayer, CHEAT_TELEPORT,
FLOAT_TO_FIXED(x), FLOAT_TO_FIXED(y), FLOAT_TO_FIXED(z));
}
void Command_Skynum_f(void)
@ -781,6 +579,41 @@ void Command_Grayscale_f(void)
COM_ImmedExecute("toggle palette \"\" GRAYPAL");
}
void Command_Goto_f(void)
{
const INT32 id = atoi(COM_Argv(1));
const waypoint_t *wayp = K_GetWaypointFromID(id);
REQUIRE_CHEATS;
REQUIRE_INLEVEL;
if (COM_Argc() != 2)
{
CONS_Printf(M_GetText("goto <waypoint id>: teleport to a waypoint\n"));
return;
}
if (wayp == NULL)
{
CONS_Alert(CONS_WARNING, "goto %d: no waypoint with that ID\n", id);
return;
}
D_Cheat(consoleplayer, CHEAT_TELEPORT,
wayp->mobj->x, wayp->mobj->y, wayp->mobj->z);
}
void Command_Angle_f(void)
{
const float anglef = atof(COM_Argv(1));
const angle_t angle = FixedAngle(FLOAT_TO_FIXED(anglef));
REQUIRE_CHEATS;
REQUIRE_INLEVEL;
D_Cheat(consoleplayer, CHEAT_ANGLE, angle);
}
//
// OBJECTPLACE (and related variables)
//

View file

@ -33,9 +33,11 @@ typedef enum {
CHEAT_FLIP,
CHEAT_HURT,
CHEAT_RELATIVE_TELEPORT,
CHEAT_TELEPORT,
CHEAT_DEVMODE,
CHEAT_GIVEITEM,
CHEAT_SCORE,
CHEAT_ANGLE,
NUMBER_OF_CHEATS
} cheat_t;
@ -82,6 +84,8 @@ void Command_RTeleport_f(void);
void Command_Skynum_f(void);
void Command_Weather_f(void);
void Command_Grayscale_f(void);
void Command_Goto_f(void);
void Command_Angle_f(void);
#ifdef _DEBUG
void Command_CauseCfail_f(void);
#endif

View file

@ -1846,24 +1846,16 @@ failure:
#endif
}
boolean M_ScreenshotResponder(event_t *ev)
void M_ScreenshotTicker(void)
{
INT32 ch = -1;
if (dedicated || ev->type != ev_keydown)
return false;
const UINT8 pid = 0; // TODO: should splitscreen players be allowed to use this too?
ch = ev->data1;
if (ch >= NUMKEYS && menuactive) // If it's not a keyboard key, then don't allow it in the menus!
return false;
switch (ch)
if (M_MenuButtonPressed(pid, MBT_SCREENSHOT))
{
case KEY_F8:
M_ScreenShot();
break;
case KEY_F9:
}
else if (M_MenuButtonPressed(pid, MBT_STARTMOVIE))
{
if (moviemode)
{
M_StopMovie();
@ -1872,9 +1864,9 @@ boolean M_ScreenshotResponder(event_t *ev)
{
M_StartMovie(MM_AVRECORDER);
}
break;
case KEY_F10:
}
else if (M_MenuButtonPressed(pid, MBT_STARTLOSSLESS))
{
if (moviemode)
{
M_StopMovie();
@ -1883,13 +1875,7 @@ boolean M_ScreenshotResponder(event_t *ev)
{
M_StartMovie(static_cast<moviemode_t>(cv_lossless_recorder.value));
}
break;
default:
return false;
}
return true;
}
void M_MinimapGenerate(void)

View file

@ -98,7 +98,7 @@ void M_ScreenShot(void);
#ifdef HWRENDER
void M_DoLegacyGLScreenShot(void);
#endif
boolean M_ScreenshotResponder(event_t *ev);
void M_ScreenshotTicker(void);
void M_MinimapGenerate(void);

View file

@ -53,11 +53,14 @@ menuitem_t OPTIONS_ProfileControls[] = {
{IT_HEADER, "OPTIONAL CONTROLS", "Take a screenshot, chat...",
NULL, {NULL}, 0, 0},
{IT_CONTROL, "SCREENSHOT", "Also usable with F8 on Keyboard.",
{IT_CONTROL, "SCREENSHOT", "Take a high resolution screenshot.",
NULL, {.routine = M_ProfileSetControl}, gc_screenshot, 0},
{IT_CONTROL, "GIF CAPTURE", "Also usable with F9 on Keyboard.",
NULL, {.routine = M_ProfileSetControl}, gc_recordgif, 0},
{IT_CONTROL, "RECORD VIDEO", "Record a video with sound.",
NULL, {.routine = M_ProfileSetControl}, gc_startmovie, 0},
{IT_CONTROL, "RECORD LOSSLESS", "Record a pixel perfect GIF.",
NULL, {.routine = M_ProfileSetControl}, gc_startlossless, 0},
{IT_CONTROL, "OPEN CHAT", "Opens chatbox in online games.",
NULL, {.routine = M_ProfileSetControl}, gc_talk, 0},
@ -313,6 +316,10 @@ void M_MapProfileControl(event_t *ev)
INT32 controln = currentMenu->menuitems[itemOn].mvar1; // gc_
UINT8 where = n; // By default, we'll save the bind where we're supposed to map.
INT32 i;
INT32 *DeviceGameKeyDownArray = G_GetDeviceGameKeyDownArray(ev->device);
if (!DeviceGameKeyDownArray)
return;
//SetDeviceOnPress(); // Update player gamepad assignments
@ -410,6 +417,10 @@ void M_MapProfileControl(event_t *ev)
// Set menu delay regardless of what we're doing to avoid stupid stuff.
M_SetMenuDelay(0);
// Reset this input so (keyboard keys at least) are not
// buffered and caught by menucmd.
DeviceGameKeyDownArray[c] = 0;
// Check if this particular key (c) is already bound in any slot.
// If that's the case, simply do nothing.
for (i = 0; i < MAXINPUTMAPPING; i++)

View file

@ -4997,16 +4997,18 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
WRITEINT16(save->p, lastmap);
WRITEUINT16(save->p, bossdisabled);
for (i = 0; i < 4; i++)
for (i = 0; i < VOTE_NUM_LEVELS; i++)
{
WRITEINT16(save->p, votelevels[i][0]);
WRITEINT16(save->p, votelevels[i][1]);
WRITEUINT16(save->p, g_voteLevels[i][0]);
WRITEUINT16(save->p, g_voteLevels[i][1]);
}
for (i = 0; i < MAXPLAYERS; i++)
WRITESINT8(save->p, votes[i]);
for (i = 0; i < VOTE_TOTAL; i++)
{
WRITESINT8(save->p, g_votes[i]);
}
WRITESINT8(save->p, pickedvote);
WRITESINT8(save->p, g_pickedVote);
WRITEUINT16(save->p, emeralds);
{
@ -5169,16 +5171,18 @@ static inline boolean P_NetUnArchiveMisc(savebuffer_t *save, boolean reloading)
lastmap = READINT16(save->p);
bossdisabled = READUINT16(save->p);
for (i = 0; i < 4; i++)
for (i = 0; i < VOTE_NUM_LEVELS; i++)
{
votelevels[i][0] = READINT16(save->p);
votelevels[i][1] = READINT16(save->p);
g_voteLevels[i][0] = READUINT16(save->p);
g_voteLevels[i][1] = READUINT16(save->p);
}
for (i = 0; i < MAXPLAYERS; i++)
votes[i] = READSINT8(save->p);
for (i = 0; i < VOTE_TOTAL; i++)
{
g_votes[i] = READSINT8(save->p);
}
pickedvote = READSINT8(save->p);
g_pickedVote = READSINT8(save->p);
emeralds = READUINT16(save->p);
{

View file

@ -429,6 +429,9 @@ static void P_ClearSingleMapHeaderInfo(INT16 num)
Z_Free(mapheaderinfo[num]->mainrecord);
mapheaderinfo[num]->mainrecord = NULL;
mapheaderinfo[num]->justPlayed = 0;
mapheaderinfo[num]->anger = 0;
mapheaderinfo[num]->customopts = NULL;
mapheaderinfo[num]->numCustomOptions = 0;
}
@ -8042,8 +8045,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
G_SaveGameData();
}
G_AddMapToBuffer(gamemap-1);
P_MapEnd(); // tm.thing is no longer needed from this point onwards
// Took me 3 hours to figure out why my progression kept on getting overwritten with the titlemap...

View file

@ -126,6 +126,8 @@ int ps_numsprites = 0;
int ps_numdrawnodes = 0;
int ps_numpolyobjects = 0;
struct RenderStats g_renderstats;
static CV_PossibleValue_t drawdist_cons_t[] = {
/*{256, "256"},*/ {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
@ -1553,6 +1555,8 @@ void R_RenderPlayerView(void)
framecount++;
validcount++;
memset(&g_renderstats, 0, sizeof g_renderstats);
// Clear buffers.
R_ClearPlanes();
if (viewmorph[viewssnum].use)

View file

@ -108,6 +108,15 @@ extern int ps_numsprites;
extern int ps_numdrawnodes;
extern int ps_numpolyobjects;
struct RenderStats
{
size_t visplanes;
size_t drawsegs;
size_t skybox_portals;
};
extern struct RenderStats g_renderstats;
//
// REFRESH - the actual rendering functions.
//

View file

@ -341,6 +341,9 @@ static visplane_t *new_visplane(unsigned hash)
}
check->next = visplanes[hash];
visplanes[hash] = check;
g_renderstats.visplanes++;
return check;
}

View file

@ -312,5 +312,5 @@ void Portal_AddSkyboxPortals (const player_t *player)
}
}
CONS_Debug(DBG_RENDER, "Skybox portals: %d\n", count);
g_renderstats.skybox_portals = count;
}

View file

@ -2957,4 +2957,6 @@ void R_StoreWallRange(INT32 start, INT32 stop)
ds_p->bsilheight = twosidedmidtexture ? INT32_MAX: INT32_MIN;
}
ds_p++;
g_renderstats.drawsegs++;
}

View file

@ -434,6 +434,18 @@ static void ST_drawMusicDebug(INT32 *height)
}
}
static void ST_drawRenderDebug(INT32 *height)
{
const struct RenderStats *i = &g_renderstats;
ST_pushDebugString(height, va(" Visplanes: %4s", sizeu1(i->visplanes)));
ST_pushDebugString(height, va(" Drawsegs: %4s", sizeu1(i->drawsegs)));
ST_pushRow(height);
ST_pushDebugString(height, va("Skybox Portals: %4s", sizeu1(i->skybox_portals)));
}
void ST_drawDebugInfo(void)
{
INT32 height = 192;
@ -446,15 +458,25 @@ void ST_drawDebugInfo(void)
if (!stplyr->mo)
return;
if (cv_ticrate.value)
{
height -= 20;
}
if (cv_showping.value)
{
height -= 20;
}
if (cht_debug & DBG_BASIC)
{
const fixed_t d = AngleFixed(stplyr->mo->angle);
V_DrawRightAlignedString(320, 168, V_MONOSPACE, va("X: %6d", stplyr->mo->x>>FRACBITS));
V_DrawRightAlignedString(320, 176, V_MONOSPACE, va("Y: %6d", stplyr->mo->y>>FRACBITS));
V_DrawRightAlignedString(320, 184, V_MONOSPACE, va("Z: %6d", stplyr->mo->z>>FRACBITS));
V_DrawRightAlignedString(320, 192, V_MONOSPACE, va("A: %6d", FixedInt(d)));
V_DrawRightAlignedString(320, height - 24, V_MONOSPACE, va("X: %6d", stplyr->mo->x>>FRACBITS));
V_DrawRightAlignedString(320, height - 16, V_MONOSPACE, va("Y: %6d", stplyr->mo->y>>FRACBITS));
V_DrawRightAlignedString(320, height - 8, V_MONOSPACE, va("Z: %6d", stplyr->mo->z>>FRACBITS));
V_DrawRightAlignedString(320, height, V_MONOSPACE, va("A: %6d", FixedInt(d)));
height = 152;
height -= 40;
}
if (cht_debug & DBG_DETAILED)
@ -506,6 +528,11 @@ void ST_drawDebugInfo(void)
ST_drawMusicDebug(&height);
}
if (cht_debug & DBG_RENDER)
{
ST_drawRenderDebug(&height);
}
if (cht_debug & DBG_MEMORY)
V_DrawRightAlignedString(320, height, V_MONOSPACE, va("Heap used: %7sKB", sizeu1(Z_TagsUsage(0, INT32_MAX)>>10)));
}

View file

@ -1307,7 +1307,7 @@ void V_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c, UINT16 color, U
h *= dupy;
// Center it if necessary
// adjustxy
V_AdjustXYWithSnap(&x, &y, c, dupx, dupy);
}
if (x >= vid.width || y >= vid.height)