Merge branch SRB2:next into fix-mixerx-1144

This commit is contained in:
Logan Aerl Arias 2024-02-27 18:13:52 +00:00
commit 7d26b173e5
23 changed files with 316 additions and 144 deletions

View file

@ -603,6 +603,7 @@ typedef struct player_s
boolean spectator;
boolean outofcoop;
boolean removing;
boolean muted;
UINT8 bot;
struct player_s *botleader;
UINT16 lastbuttons;

View file

@ -4834,6 +4834,7 @@ const char *const POWERS_LIST[] = {
const char *const HUDITEMS_LIST[] = {
"LIVES",
"INPUT",
"RINGS",
"RINGSNUM",

View file

@ -638,6 +638,7 @@ extern boolean singletics;
extern consvar_t cv_timetic; // display high resolution timer
extern consvar_t cv_powerupdisplay; // display powerups
extern consvar_t cv_showinput; // display input viewer outside of time attack
extern consvar_t cv_showinputjoy; // display joystick in time attack
extern consvar_t cv_forceskin; // force clients to use the server's skin
extern consvar_t cv_downloading; // allow clients to downloading WADs.

View file

@ -465,9 +465,12 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
numwords = COM_Argc() - usedargs;
I_Assert(numwords > 0);
if (CHAT_MUTE) // TODO: Per Player mute.
if (CHAT_MUTE)
{
HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false);
if (cv_mute.value)
HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false);
else
HU_AddChatText(va("%s>ERROR: You have been muted. You can't say anything.", "\x85"), false);
return;
}
@ -644,9 +647,9 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
msg = (char *)*p;
SKIPSTRINGL(*p, HU_MAXMSGLEN + 1);
if ((cv_mute.value || flags & (HU_CSAY|HU_SERVER_SAY)) && playernum != serverplayer && !(IsPlayerAdmin(playernum)))
if ((cv_mute.value || players[playernum].muted || flags & (HU_CSAY|HU_SERVER_SAY)) && playernum != serverplayer && !(IsPlayerAdmin(playernum)))
{
CONS_Alert(CONS_WARNING, cv_mute.value ?
CONS_Alert(CONS_WARNING, (cv_mute.value || players[playernum].muted) ?
M_GetText("Illegal say command received from %s while muted\n") : M_GetText("Illegal csay command received from non-admin %s\n"),
player_names[playernum]);
if (server)
@ -962,7 +965,10 @@ static void HU_sendChatMessage(void)
// last minute mute check
if (CHAT_MUTE)
{
HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false);
if (cv_mute.value)
HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false);
else
HU_AddChatText(va("%s>ERROR: You have been muted. You can't say anything.", "\x85"), false);
return;
}
@ -1567,7 +1573,6 @@ static void HU_DrawChat(void)
INT32 cflag = 0;
const char *ntalk = "Say: ", *ttalk = "Team: ";
const char *talk = ntalk;
const char *mute = "Chat has been muted.";
#ifdef NETSPLITSCREEN
if (splitscreen)
@ -1594,7 +1599,10 @@ static void HU_DrawChat(void)
if (CHAT_MUTE)
{
talk = mute;
if (cv_mute.value)
talk = "Chat has been muted.";
else
talk = "You have been muted.";
typelines = 1;
cflag = V_GRAYMAP; // set text in gray if chat is muted.
}

View file

@ -69,8 +69,8 @@ typedef struct
#else
#define OLDCHAT (cv_consolechat.value == 1 || dedicated || vid.width < 640 || splitscreen)
#endif
#define CHAT_MUTE (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // this still allows to open the chat but not to type. That's used for scrolling and whatnot.
#define OLD_MUTE (OLDCHAT && cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // this is used to prevent oldchat from opening when muted.
#define CHAT_MUTE ((cv_mute.value || players[consoleplayer].muted) && !(server || IsPlayerAdmin(consoleplayer))) // this still allows to open the chat but not to type. That's used for scrolling and whatnot.
#define OLD_MUTE (OLDCHAT && (cv_mute.value || players[consoleplayer].muted) && !(server || IsPlayerAdmin(consoleplayer))) // this is used to prevent oldchat from opening when muted.
// some functions
void HU_AddChatText(const char *text, boolean playsound);

View file

@ -648,13 +648,13 @@ playersprite_t spr2defaults[NUMPLAYERSPRITES] = {
0, // SPR2_TRNS,
FF_SPR2SUPER|SPR2_STND, // SPR2_NSTD,
FF_SPR2SUPER|SPR2_FALL, // SPR2_NFLT,
SPR2_STND, // SPR2_NSTD,
SPR2_FALL, // SPR2_NFLT,
0, // SPR2_NFLY, (will never be referenced unless skin 0 lacks this)
SPR2_NFLY, // SPR2_NDRL,
FF_SPR2SUPER|SPR2_STUN, // SPR2_NSTN,
SPR2_STUN, // SPR2_NSTN,
SPR2_NSTN, // SPR2_NPUL,
FF_SPR2SUPER|SPR2_ROLL, // SPR2_NATK,
SPR2_ROLL, // SPR2_NATK,
0, // SPR2_TAL0, (this will look mighty stupid but oh well)
SPR2_TAL0, // SPR2_TAL1,

View file

@ -19,11 +19,13 @@ enum hud {
hud_stagetitle = 0,
hud_textspectator,
hud_crosshair,
hud_powerups,
// Singleplayer / Co-op
hud_score,
hud_time,
hud_rings,
hud_lives,
hud_input,
// Match / CTF / Tag / Ringslinger
hud_weaponrings,
hud_powerstones,

View file

@ -41,6 +41,7 @@ static const char *const hud_disable_options[] = {
"stagetitle",
"textspectator",
"crosshair",
"powerups",
"score",
"time",

View file

@ -1432,14 +1432,22 @@ void OP_ObjectplaceMovement(player_t *player)
//
// Objectplace related commands.
//
/*void Command_Writethings_f(void)
void Command_Writethings_f(void)
{
REQUIRE_INLEVEL;
REQUIRE_SINGLEPLAYER;
REQUIRE_OBJECTPLACE;
P_WriteThings();
}*/
if (COM_Argc() > 1)
{
P_WriteThings(COM_Argv(1));
}
else
{
CONS_Printf(M_GetText("writethings <filename>: write out map things to a file, .txt or .lmp automatically appended.\n"));
return;
}
}
void Command_ObjectPlace_f(void)
{

View file

@ -26,7 +26,7 @@ void cht_Init(void);
// ObjectPlace
//
void Command_ObjectPlace_f(void);
//void Command_Writethings_f(void);
void Command_Writethings_f(void);
extern consvar_t cv_opflags, cv_ophoopflags, cv_mapthingnum, cv_speed;
//extern consvar_t cv_snapto, cv_grid;

View file

@ -41,6 +41,8 @@ typedef struct banreason_s
static banreason_t *reasontail = NULL; //last entry, use prev
static banreason_t *reasonhead = NULL; //1st entry, use next
static boolean bans_loaded = false;
void Ban_Add(const char *reason)
{
banreason_t *reasonlist = malloc(sizeof(*reasonlist));
@ -85,6 +87,8 @@ void Ban_Load_File(boolean warning)
if (!I_ClearBans)
return;
bans_loaded = true;
f = fopen(va("%s"PATHSEP"%s", srb2home, "ban.txt"), "r");
if (!f)
@ -124,6 +128,12 @@ void D_SaveBan(void)
const char *address, *mask;
const char *path = va("%s"PATHSEP"%s", srb2home, "ban.txt");
if (!bans_loaded)
{
// don't save bans if they were never loaded.
return;
}
if (!reasonhead)
{
remove(path);

View file

@ -149,6 +149,10 @@ static void Command_Teamchange_f(void);
static void Command_Teamchange2_f(void);
static void Command_ServerTeamChange_f(void);
static void Command_MutePlayer_f(void);
static void Command_UnmutePlayer_f(void);
static void Got_MutePlayer(UINT8 **cp, INT32 playernum);
static void Command_Clearscores_f(void);
// Remote Administration
@ -209,6 +213,7 @@ static CV_PossibleValue_t matchboxes_cons_t[] = {{0, "Normal"}, {1, "Mystery"},
static CV_PossibleValue_t chances_cons_t[] = {{0, "MIN"}, {9, "MAX"}, {0, NULL}};
static CV_PossibleValue_t pause_cons_t[] = {{0, "Server"}, {1, "All"}, {0, NULL}};
consvar_t cv_showinput = CVAR_INIT ("showinput", "Off", CV_ALLOWLUA, CV_OnOff, NULL);
consvar_t cv_showinputjoy = CVAR_INIT ("showinputjoy", "Off", CV_ALLOWLUA, CV_OnOff, NULL);
#ifdef NETGAME_DEVMODE
@ -487,6 +492,10 @@ void D_RegisterServerCommands(void)
RegisterNetXCmd(XD_TEAMCHANGE, Got_Teamchange);
COM_AddCommand("serverchangeteam", Command_ServerTeamChange_f, COM_LUA);
RegisterNetXCmd(XD_MUTEPLAYER, Got_MutePlayer);
COM_AddCommand("muteplayer", Command_MutePlayer_f, COM_LUA);
COM_AddCommand("unmuteplayer", Command_UnmutePlayer_f, COM_LUA);
RegisterNetXCmd(XD_CLEARSCORES, Got_Clearscores);
COM_AddCommand("clearscores", Command_Clearscores_f, COM_LUA);
COM_AddCommand("map", Command_Map_f, COM_LUA);
@ -736,6 +745,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_timetic);
CV_RegisterVar(&cv_powerupdisplay);
CV_RegisterVar(&cv_itemfinder);
CV_RegisterVar(&cv_showinput);
CV_RegisterVar(&cv_showinputjoy);
// time attack ghost options are also saved to config
@ -911,7 +921,7 @@ void D_RegisterClientCommands(void)
// ingame object placing
COM_AddCommand("objectplace", Command_ObjectPlace_f, COM_LUA);
//COM_AddCommand("writethings", Command_Writethings_f);
COM_AddCommand("writethings", Command_Writethings_f, COM_LUA);
CV_RegisterVar(&cv_speed);
CV_RegisterVar(&cv_opflags);
CV_RegisterVar(&cv_ophoopflags);
@ -1313,7 +1323,7 @@ static void SendNameAndColor(void)
CV_StealthSet(&cv_playername, player_names[consoleplayer]);
HU_AddChatText("\x85*You must wait to change your name again", false);
}
else if (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer)))
else if ((cv_mute.value || players[consoleplayer].muted) && !(server || IsPlayerAdmin(consoleplayer)))
CV_StealthSet(&cv_playername, player_names[consoleplayer]);
else // Cleanup name if changing it
CleanupPlayerName(consoleplayer, cv_playername.zstring);
@ -2488,6 +2498,91 @@ static void Command_Teamchange2_f(void)
SendNetXCmd2(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
}
static void MutePlayer(boolean mute)
{
UINT8 data[2];
if (!(server || (IsPlayerAdmin(consoleplayer))))
{
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
return;
}
if (COM_Argc() < 2)
{
CONS_Printf(M_GetText("muteplayer <playernum>: mute a player\n"));
return;
}
data[0] = atoi(COM_Argv(1));
if (data[0] >= MAXPLAYERS || !playeringame[data[0]])
{
CONS_Alert(CONS_NOTICE, M_GetText("There is no player %u!\n"), (unsigned int)data[0]);
return;
}
if (players[data[0]].muted && mute)
{
CONS_Printf(M_GetText("%s is already muted!\n"), player_names[data[0]]);
return;
}
else if (!players[data[0]].muted && !mute)
{
CONS_Printf(M_GetText("%s is not muted!\n"), player_names[data[0]]);
return;
}
data[1] = mute;
SendNetXCmd(XD_MUTEPLAYER, &data, sizeof(data));
}
static void Command_MutePlayer_f(void)
{
MutePlayer(true);
}
static void Command_UnmutePlayer_f(void)
{
MutePlayer(false);
}
static void Got_MutePlayer(UINT8 **cp, INT32 playernum)
{
UINT8 player = READUINT8(*cp);
UINT8 muted = READUINT8(*cp);
if (playernum != serverplayer && !IsPlayerAdmin(playernum))
{
CONS_Alert(CONS_WARNING, M_GetText("Illegal mute received from player %s\n"), player_names[playernum]);
if (server)
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
return;
}
if (player >= MAXPLAYERS || !playeringame[player])
{
CONS_Alert(CONS_WARNING, M_GetText("Illegal mute received from player %s\n"), player_names[playernum]);
if (server)
SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY);
return;
}
if (!players[player].muted && muted)
{
if (player == consoleplayer)
CONS_Printf(M_GetText("You have been muted.\n"));
else
CONS_Printf(M_GetText("%s has been muted.\n"), player_names[player]);
}
else if (players[player].muted && !muted)
{
if (player == consoleplayer)
CONS_Printf(M_GetText("You are no longer muted.\n"));
else
CONS_Printf(M_GetText("%s is no longer muted.\n"), player_names[player]);
}
players[player].muted = muted;
}
static void Command_ServerTeamChange_f(void)
{
changeteam_union NetPacket;
@ -4785,7 +4880,7 @@ static void ForceSkin_OnChange(void)
//Allows the player's name to be changed if cv_mute is off.
static void Name_OnChange(void)
{
if (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer)))
if ((cv_mute.value || players[consoleplayer].muted) && !(server || IsPlayerAdmin(consoleplayer)))
{
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
CV_StealthSet(&cv_playername, player_names[consoleplayer]);
@ -4796,7 +4891,7 @@ static void Name_OnChange(void)
static void Name2_OnChange(void)
{
if (cv_mute.value) //Secondary player can't be admin.
if (cv_mute.value || players[consoleplayer].muted) //Secondary player can't be admin.
{
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
CV_StealthSet(&cv_playername2, player_names[secondarydisplayplayer]);

View file

@ -147,6 +147,7 @@ typedef enum
XD_LUACMD, // 22
XD_LUAVAR, // 23
XD_LUAFILE, // 24
XD_MUTEPLAYER, // 25
MAXNETXCMD
} netxcmd_t;

View file

@ -402,9 +402,9 @@ static boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
UINT16 stateframe = st->frame;
// Add/Remove FF_SPR2SUPER based on certain conditions
if (player->charflags & SF_NOSUPERSPRITES)
if (player->charflags & SF_NOSUPERSPRITES || (player->powers[pw_carry] == CR_NIGHTSMODE && (player->charflags & SF_NONIGHTSSUPER)))
stateframe = stateframe & ~FF_SPR2SUPER;
else if (player->powers[pw_super])
else if (player->powers[pw_super] || (player->powers[pw_carry] == CR_NIGHTSMODE && (player->charflags & SF_SUPER)))
stateframe = stateframe | FF_SPR2SUPER;
if (stateframe & FF_SPR2SUPER)

View file

@ -170,6 +170,7 @@ static void P_NetArchivePlayers(void)
WRITEUINT8(save_p, players[i].panim);
WRITEUINT8(save_p, players[i].stronganim);
WRITEUINT8(save_p, players[i].spectator);
WRITEUINT8(save_p, players[i].muted);
WRITEUINT16(save_p, players[i].flashpal);
WRITEUINT16(save_p, players[i].flashcount);
@ -399,6 +400,7 @@ static void P_NetUnArchivePlayers(void)
players[i].panim = READUINT8(save_p);
players[i].stronganim = READUINT8(save_p);
players[i].spectator = READUINT8(save_p);
players[i].muted = READUINT8(save_p);
players[i].flashpal = READUINT16(save_p);
players[i].flashcount = READUINT16(save_p);

View file

@ -877,14 +877,32 @@ static void P_SpawnMapThings(boolean spawnemblems)
P_SpawnEmeraldHunt();
}
static void P_WriteTextmap_Things(FILE *f, const mapthing_t *wmapthings); // proto
// Experimental groovy write function!
/*void P_WriteThings(void)
void P_WriteThings(const char *filepath)
{
size_t i, length;
mapthing_t *mt;
UINT8 *savebuffer, *savebuf_p;
INT16 temp;
if (udmf)
{
FILE *f = fopen(va("%s.txt", filepath), "w");
if (!f)
{
CONS_Alert(CONS_ERROR, M_GetText("Couldn't write to file %s\n"), filepath);
return;
}
P_WriteTextmap_Things(f, mapthings);
fclose(f);
CONS_Printf(M_GetText("%s.txt saved.\n"), filepath);
return;
}
savebuf_p = savebuffer = (UINT8 *)malloc(nummapthings * sizeof (mapthing_t));
if (!savebuf_p)
@ -908,12 +926,12 @@ static void P_SpawnMapThings(boolean spawnemblems)
length = savebuf_p - savebuffer;
FIL_WriteFile(va("newthings%d.lmp", gamemap), savebuffer, length);
FIL_WriteFile(va("%s.lmp", filepath), savebuffer, length);
free(savebuffer);
savebuf_p = NULL;
CONS_Printf(M_GetText("newthings%d.lmp saved.\n"), gamemap);
}*/
CONS_Printf(M_GetText("%s.lmp saved.\n"), filepath);
}
//
// MAP LOADING FUNCTIONS
@ -2150,6 +2168,60 @@ typedef struct
mapthing_t *angleanchor;
} sectorspecialthings_t;
static void P_WriteTextmap_Things(FILE *f, const mapthing_t *wmapthings)
{
size_t i, j;
mtag_t firsttag;
// Actual writing
for (i = 0; i < nummapthings; i++)
{
fprintf(f, "thing // %s\n", sizeu1(i));
fprintf(f, "{\n");
firsttag = Tag_FGet(&wmapthings[i].tags);
if (firsttag != 0)
fprintf(f, "id = %d;\n", firsttag);
if (wmapthings[i].tags.count > 1)
{
fprintf(f, "moreids = \"");
for (j = 1; j < wmapthings[i].tags.count; j++)
{
if (j > 1)
fprintf(f, " ");
fprintf(f, "%d", wmapthings[i].tags.tags[j]);
}
fprintf(f, "\";\n");
}
fprintf(f, "x = %d;\n", wmapthings[i].x);
fprintf(f, "y = %d;\n", wmapthings[i].y);
if (wmapthings[i].z != 0)
fprintf(f, "height = %d;\n", wmapthings[i].z);
fprintf(f, "angle = %d;\n", wmapthings[i].angle);
if (wmapthings[i].pitch != 0)
fprintf(f, "pitch = %d;\n", wmapthings[i].pitch);
if (wmapthings[i].roll != 0)
fprintf(f, "roll = %d;\n", wmapthings[i].roll);
if (wmapthings[i].type != 0)
fprintf(f, "type = %d;\n", wmapthings[i].type);
if (wmapthings[i].spritexscale != FRACUNIT)
fprintf(f, "scalex = %f;\n", FIXED_TO_FLOAT(wmapthings[i].spritexscale));
if (wmapthings[i].spriteyscale != FRACUNIT)
fprintf(f, "scaley = %f;\n", FIXED_TO_FLOAT(wmapthings[i].spriteyscale));
if (wmapthings[i].scale != FRACUNIT)
fprintf(f, "mobjscale = %f;\n", FIXED_TO_FLOAT(wmapthings[i].scale));
if (wmapthings[i].options & MTF_OBJECTFLIP)
fprintf(f, "flip = true;\n");
for (j = 0; j < NUMMAPTHINGARGS; j++)
if (wmapthings[i].args[j] != 0)
fprintf(f, "arg%s = %d;\n", sizeu1(j), wmapthings[i].args[j]);
for (j = 0; j < NUMMAPTHINGSTRINGARGS; j++)
if (mapthings[i].stringargs[j])
fprintf(f, "stringarg%s = \"%s\";\n", sizeu1(j), mapthings[i].stringargs[j]);
fprintf(f, "}\n");
fprintf(f, "\n");
}
}
static void P_WriteTextmap(void)
{
size_t i, j;
@ -2417,52 +2489,7 @@ static void P_WriteTextmap(void)
}
fprintf(f, "namespace = \"srb2\";\n");
for (i = 0; i < nummapthings; i++)
{
fprintf(f, "thing // %s\n", sizeu1(i));
fprintf(f, "{\n");
firsttag = Tag_FGet(&wmapthings[i].tags);
if (firsttag != 0)
fprintf(f, "id = %d;\n", firsttag);
if (wmapthings[i].tags.count > 1)
{
fprintf(f, "moreids = \"");
for (j = 1; j < wmapthings[i].tags.count; j++)
{
if (j > 1)
fprintf(f, " ");
fprintf(f, "%d", wmapthings[i].tags.tags[j]);
}
fprintf(f, "\";\n");
}
fprintf(f, "x = %d;\n", wmapthings[i].x);
fprintf(f, "y = %d;\n", wmapthings[i].y);
if (wmapthings[i].z != 0)
fprintf(f, "height = %d;\n", wmapthings[i].z);
fprintf(f, "angle = %d;\n", wmapthings[i].angle);
if (wmapthings[i].pitch != 0)
fprintf(f, "pitch = %d;\n", wmapthings[i].pitch);
if (wmapthings[i].roll != 0)
fprintf(f, "roll = %d;\n", wmapthings[i].roll);
if (wmapthings[i].type != 0)
fprintf(f, "type = %d;\n", wmapthings[i].type);
if (wmapthings[i].spritexscale != FRACUNIT)
fprintf(f, "scalex = %f;\n", FIXED_TO_FLOAT(wmapthings[i].spritexscale));
if (wmapthings[i].spriteyscale != FRACUNIT)
fprintf(f, "scaley = %f;\n", FIXED_TO_FLOAT(wmapthings[i].spriteyscale));
if (wmapthings[i].scale != FRACUNIT)
fprintf(f, "mobjscale = %f;\n", FIXED_TO_FLOAT(wmapthings[i].scale));
if (wmapthings[i].options & MTF_OBJECTFLIP)
fprintf(f, "flip = true;\n");
for (j = 0; j < NUMMAPTHINGARGS; j++)
if (wmapthings[i].args[j] != 0)
fprintf(f, "arg%s = %d;\n", sizeu1(j), wmapthings[i].args[j]);
for (j = 0; j < NUMMAPTHINGSTRINGARGS; j++)
if (mapthings[i].stringargs[j])
fprintf(f, "stringarg%s = \"%s\";\n", sizeu1(j), mapthings[i].stringargs[j]);
fprintf(f, "}\n");
fprintf(f, "\n");
}
P_WriteTextmap_Things(f, wmapthings);
for (i = 0; i < numvertexes; i++)
{

View file

@ -71,7 +71,7 @@ boolean P_AddFolder(const char *folderpath);
boolean P_RunSOC(const char *socfilename);
void P_LoadSoundsRange(UINT16 wadnum, UINT16 first, UINT16 num);
void P_LoadMusicsRange(UINT16 wadnum, UINT16 first, UINT16 num);
//void P_WriteThings(void);
void P_WriteThings(const char *filepath);
size_t P_PrecacheLevelFlats(void);
void P_AllocMapHeader(INT16 i);

View file

@ -4977,7 +4977,7 @@ void P_DoJumpShield(player_t *player)
}
else
{
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE);
player->pflags |= PF_NOJUMPDAMAGE;
P_SetMobjState(player->mo, S_PLAY_FALL);
S_StartSound(player->mo, sfx_wdjump);
}
@ -13199,7 +13199,7 @@ void P_ForceLocalAngle(player_t *player, angle_t angle)
boolean P_PlayerFullbright(player_t *player)
{
return (player->powers[pw_super]
|| ((player->powers[pw_carry] == CR_NIGHTSMODE && (((skin_t *)player->mo->skin)->flags & (SF_SUPER|SF_NONIGHTSSUPER)) == SF_SUPER) // Super colours? Super bright!
|| ((player->powers[pw_carry] == CR_NIGHTSMODE && (player->charflags & (SF_SUPER|SF_NONIGHTSSUPER)) == SF_SUPER) // Super colours? Super bright!
&& (player->exiting
|| !(player->mo->state >= &states[S_PLAY_NIGHTS_TRANS1]
&& player->mo->state < &states[S_PLAY_NIGHTS_TRANS6])))); // Note the < instead of <=

View file

@ -186,7 +186,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
if (frontsector->numlights)
{
dc_numlights = frontsector->numlights;
if (dc_numlights >= dc_maxlights)
if (dc_numlights > dc_maxlights)
{
dc_maxlights = dc_numlights;
dc_lightlist = Z_Realloc(dc_lightlist, sizeof (*dc_lightlist) * dc_maxlights, PU_STATIC, NULL);
@ -342,7 +342,6 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
{
lighttable_t **xwalllights;
sprbotscreen = INT32_MAX;
sprtopscreen = windowtop = (centeryfrac - FixedMul(dc_texturemid, spryscale));
realbot = FixedMul(textureheight[texnum], spryscale) + sprtopscreen;
@ -449,10 +448,13 @@ static void R_DrawRepeatMaskedColumn(column_t *col, unsigned lengthcol)
static void R_DrawRepeatFlippedMaskedColumn(column_t *col, unsigned lengthcol)
{
do {
while (sprtopscreen < sprbotscreen) {
R_DrawFlippedMaskedColumn(col, lengthcol);
sprtopscreen += dc_texheight*spryscale;
} while (sprtopscreen < sprbotscreen);
if ((INT64)sprtopscreen + (INT64)dc_texheight*spryscale > (INT64)INT32_MAX) // prevent overflow
sprtopscreen = INT32_MAX;
else
sprtopscreen += dc_texheight*spryscale;
}
}
// Returns true if a fake floor is translucent.
@ -742,7 +744,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
if (textures[texnum]->flip & 2) // vertically flipped?
colfunc_2s = R_DrawRepeatFlippedMaskedColumn;
else
colfunc_2s = R_DrawRepeatMaskedColumn; // render the usual 2sided single-patch packed texture
colfunc_2s = R_DrawRepeatMaskedColumn;
lengthcol = textures[texnum]->height;
@ -787,6 +789,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
else if (bottom_frac > (INT64)CLAMPMIN) sprbotscreen = windowbottom = (fixed_t)bottom_frac;
else sprbotscreen = windowbottom = CLAMPMIN;
fixed_t bottomclip = sprbotscreen;
top_frac += top_step;
bottom_frac += bottom_step;
@ -819,14 +823,13 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
lighttable_t **xwalllights;
fixed_t height;
fixed_t bheight = 0;
INT32 solid = 0;
INT32 lighteffect = 0;
boolean lighteffect = false;
for (i = 0; i < dc_numlights; i++)
{
// Check if the current light effects the colormap/lightlevel
rlight = &dc_lightlist[i];
lighteffect = !(dc_lightlist[i].flags & FOF_NOSHADE);
lighteffect = !(rlight->flags & FOF_NOSHADE);
if (lighteffect)
{
lightnum = rlight->lightnum;
@ -859,11 +862,11 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
}
}
solid = 0; // don't carry over solid-cutting flag from the previous light
// Check if the current light can cut the current 3D floor.
boolean solid = false;
if (rlight->flags & FOF_CUTSOLIDS && !(pfloor->fofflags & FOF_EXTRA))
solid = 1;
solid = true;
else if (rlight->flags & FOF_CUTEXTRA && pfloor->fofflags & FOF_EXTRA)
{
if (rlight->flags & FOF_EXTRA)
@ -871,13 +874,13 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
// The light is from an extra 3D floor... Check the flags so
// there are no undesired cuts.
if ((rlight->flags & (FOF_FOG|FOF_SWIMMABLE)) == (pfloor->fofflags & (FOF_FOG|FOF_SWIMMABLE)))
solid = 1;
solid = true;
}
else
solid = 1;
solid = true;
}
else
solid = 0;
solid = false;
height = rlight->height;
rlight->height += rlight->heightstep;
@ -893,14 +896,14 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
if (lighteffect)
dc_colormap = rlight->rcolormap;
if (solid && windowtop < bheight)
windowtop = bheight;
sprtopscreen = windowtop = bheight;
continue;
}
windowbottom = height;
if (windowbottom >= sprbotscreen)
sprbotscreen = windowbottom = height;
if (windowbottom >= bottomclip)
{
windowbottom = sprbotscreen;
sprbotscreen = windowbottom = bottomclip;
// draw the texture
colfunc_2s (col, lengthcol);
for (i++; i < dc_numlights; i++)
@ -918,10 +921,11 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
windowtop = bheight;
else
windowtop = windowbottom + 1;
sprtopscreen = windowtop;
if (lighteffect)
dc_colormap = rlight->rcolormap;
}
windowbottom = sprbotscreen;
sprbotscreen = windowbottom = bottomclip;
// draw the texture, if there is any space left
if (windowtop < windowbottom)
colfunc_2s (col, lengthcol);
@ -1022,6 +1026,9 @@ static void R_RenderSegLoop (void)
if (bottomtexture)
R_CheckTextureCache(bottomtexture);
if (dc_numlights)
colfunc = colfuncs[COLDRAWFUNC_SHADOWED];
for (; rw_x < rw_stopx; rw_x++)
{
// mark floor / ceiling areas
@ -1234,8 +1241,6 @@ static void R_RenderSegLoop (void)
dc_lightlist[i].rcolormap = dc_lightlist[i].extra_colormap->colormap + (xwalllights[pindex] - colormaps);
else
dc_lightlist[i].rcolormap = xwalllights[pindex];
colfunc = colfuncs[COLDRAWFUNC_SHADOWED];
}
}
@ -2449,7 +2454,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (frontsector->numlights)
{
dc_numlights = frontsector->numlights;
if (dc_numlights >= dc_maxlights)
if (dc_numlights > dc_maxlights)
{
dc_maxlights = dc_numlights;
dc_lightlist = Z_Realloc(dc_lightlist, sizeof (*dc_lightlist) * dc_maxlights, PU_STATIC, NULL);

View file

@ -44,6 +44,8 @@
// SRB2Kart
#include "r_fps.h" // R_GetFramerateCap
#include "lua_hud.h" // LUA_HudEnabled
// --------------------------------------------
// assembly or c drawer routines for 8bpp/16bpp
// --------------------------------------------
@ -494,6 +496,7 @@ void SCR_ClosedCaptions(void)
basey -= 8;
else if ((modeattacking == ATTACKING_NIGHTS)
|| (!(maptol & TOL_NIGHTS)
&& LUA_HudEnabled(hud_powerups)
&& ((cv_powerupdisplay.value == 2) // "Always"
|| (cv_powerupdisplay.value == 1 && !camera.chase)))) // "First-person only"
basey -= 16;

View file

@ -191,7 +191,8 @@
<ClCompile>
<DisableSpecificWarnings>4244;4267;4146;4003</DisableSpecificWarnings>
<PreprocessorDefinitions>HAVE_CURL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\libs\curl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\libs\curl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<CustomBuild>
<Command />
@ -204,7 +205,7 @@
</CustomBuild>
<Link>
<AdditionalDependencies>libcurl.dll.a;libz32.a;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\libs\zlib\win32;..\libs\curl\lib32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>..\..\libs\zlib\win32;..\..\libs\curl\lib32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">

View file

@ -139,6 +139,7 @@ static patch_t *fireflower;
hudinfo_t hudinfo[NUMHUDITEMS] =
{
{ 16, 176, V_SNAPTOLEFT|V_SNAPTOBOTTOM}, // HUD_LIVES
{ 16, 152, V_SNAPTOLEFT|V_SNAPTOBOTTOM}, // HUD_INPUT
{ 16, 42, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_RINGS
{ 96, 42, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_RINGSNUM
@ -1037,32 +1038,36 @@ static void ST_drawInput(void)
INT32 col;
UINT8 offs;
INT32 x = hudinfo[HUD_LIVES].x, y = hudinfo[HUD_LIVES].y;
INT32 x = hudinfo[HUD_INPUT].x, y = hudinfo[HUD_INPUT].y;
if (stplyr->powers[pw_carry] == CR_NIGHTSMODE)
y -= 16;
y += 8;
else if (modeattacking || !LUA_HudEnabled(hud_lives))
y += 24;
else if (G_RingSlingerGametype() && LUA_HudEnabled(hud_powerstones))
y -= 5;
if (F_GetPromptHideHud(y))
return;
// O backing
V_DrawFill(x, y-1, 16, 16, hudinfo[HUD_LIVES].f|20);
V_DrawFill(x, y+15, 16, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x, y-1, 16, 16, hudinfo[HUD_INPUT].f|20);
V_DrawFill(x, y+15, 16, 1, hudinfo[HUD_INPUT].f|29);
if (cv_showinputjoy.value) // joystick render!
{
/*V_DrawFill(x , y , 16, 1, hudinfo[HUD_LIVES].f|16);
V_DrawFill(x , y+15, 16, 1, hudinfo[HUD_LIVES].f|16);
V_DrawFill(x , y+ 1, 1, 14, hudinfo[HUD_LIVES].f|16);
V_DrawFill(x+15, y+ 1, 1, 14, hudinfo[HUD_LIVES].f|16); -- red's outline*/
/*V_DrawFill(x , y , 16, 1, hudinfo[HUD_INPUT.f|16);
V_DrawFill(x , y+15, 16, 1, hudinfo[HUD_INPUT].f|16);
V_DrawFill(x , y+ 1, 1, 14, hudinfo[HUD_INPUT].f|16);
V_DrawFill(x+15, y+ 1, 1, 14, hudinfo[HUD_INPUT].f|16); -- red's outline*/
if (stplyr->cmd.sidemove || stplyr->cmd.forwardmove)
{
// joystick hole
V_DrawFill(x+5, y+4, 6, 6, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+5, y+4, 6, 6, hudinfo[HUD_INPUT].f|29);
// joystick top
V_DrawFill(x+3+stplyr->cmd.sidemove/12,
y+2-stplyr->cmd.forwardmove/12,
10, 10, hudinfo[HUD_LIVES].f|29);
10, 10, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+3+stplyr->cmd.sidemove/9,
y+1-stplyr->cmd.forwardmove/9,
10, 10, accent);
@ -1070,10 +1075,10 @@ static void ST_drawInput(void)
else
{
// just a limited, greyed out joystick top
V_DrawFill(x+3, y+11, 10, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+3, y+11, 10, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+3,
y+1,
10, 10, hudinfo[HUD_LIVES].f|16);
10, 10, hudinfo[HUD_INPUT].f|16);
}
}
else // arrows!
@ -1087,10 +1092,10 @@ static void ST_drawInput(void)
else
{
offs = 1;
col = hudinfo[HUD_LIVES].f|16;
V_DrawFill(x- 2, y+10, 6, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+ 4, y+ 9, 1, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+ 5, y+ 8, 1, 1, hudinfo[HUD_LIVES].f|29);
col = hudinfo[HUD_INPUT].f|16;
V_DrawFill(x- 2, y+10, 6, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+ 4, y+ 9, 1, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+ 5, y+ 8, 1, 1, hudinfo[HUD_INPUT].f|29);
}
V_DrawFill(x- 2, y+ 5-offs, 6, 6, col);
V_DrawFill(x+ 4, y+ 6-offs, 1, 4, col);
@ -1105,12 +1110,12 @@ static void ST_drawInput(void)
else
{
offs = 1;
col = hudinfo[HUD_LIVES].f|16;
V_DrawFill(x+ 5, y+ 3, 1, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+ 6, y+ 4, 1, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+ 7, y+ 5, 2, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+ 9, y+ 4, 1, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+10, y+ 3, 1, 1, hudinfo[HUD_LIVES].f|29);
col = hudinfo[HUD_INPUT].f|16;
V_DrawFill(x+ 5, y+ 3, 1, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+ 6, y+ 4, 1, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+ 7, y+ 5, 2, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+ 9, y+ 4, 1, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+10, y+ 3, 1, 1, hudinfo[HUD_INPUT].f|29);
}
V_DrawFill(x+ 5, y- 2-offs, 6, 6, col);
V_DrawFill(x+ 6, y+ 4-offs, 4, 1, col);
@ -1125,10 +1130,10 @@ static void ST_drawInput(void)
else
{
offs = 1;
col = hudinfo[HUD_LIVES].f|16;
V_DrawFill(x+12, y+10, 6, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+11, y+ 9, 1, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+10, y+ 8, 1, 1, hudinfo[HUD_LIVES].f|29);
col = hudinfo[HUD_INPUT].f|16;
V_DrawFill(x+12, y+10, 6, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+11, y+ 9, 1, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+10, y+ 8, 1, 1, hudinfo[HUD_INPUT].f|29);
}
V_DrawFill(x+12, y+ 5-offs, 6, 6, col);
V_DrawFill(x+11, y+ 6-offs, 1, 4, col);
@ -1143,8 +1148,8 @@ static void ST_drawInput(void)
else
{
offs = 1;
col = hudinfo[HUD_LIVES].f|16;
V_DrawFill(x+ 5, y+17, 6, 1, hudinfo[HUD_LIVES].f|29);
col = hudinfo[HUD_INPUT].f|16;
V_DrawFill(x+ 5, y+17, 6, 1, hudinfo[HUD_INPUT].f|29);
}
V_DrawFill(x+ 5, y+12-offs, 6, 6, col);
V_DrawFill(x+ 6, y+11-offs, 4, 1, col);
@ -1160,16 +1165,16 @@ static void ST_drawInput(void)
else\
{\
offs = 1;\
col = hudinfo[HUD_LIVES].f|16;\
V_DrawFill(x+16+(xoffs), y+9+(yoffs), 10, 1, hudinfo[HUD_LIVES].f|29);\
col = hudinfo[HUD_INPUT].f|16;\
V_DrawFill(x+16+(xoffs), y+9+(yoffs), 10, 1, hudinfo[HUD_INPUT].f|29);\
}\
V_DrawFill(x+16+(xoffs), y+(yoffs)-offs, 10, 10, col);\
V_DrawCharacter(x+16+1+(xoffs), y+1+(yoffs)-offs, hudinfo[HUD_LIVES].f|symb, false)
V_DrawCharacter(x+16+1+(xoffs), y+1+(yoffs)-offs, hudinfo[HUD_INPUT].f|symb, false)
drawbutt( 4,-3, BT_JUMP, 'J');
drawbutt(15,-3, BT_SPIN, 'S');
V_DrawFill(x+16+4, y+8, 21, 10, hudinfo[HUD_LIVES].f|20); // sundial backing
V_DrawFill(x+16+4, y+8, 21, 10, hudinfo[HUD_INPUT].f|20); // sundial backing
if (stplyr->mo)
{
UINT8 i, precision;
@ -1189,7 +1194,7 @@ static void ST_drawInput(void)
{
V_DrawFill(x+16+14-(i*xcomp)/precision,
y+12-(i*ycomp)/precision,
1, 1, hudinfo[HUD_LIVES].f|16);
1, 1, hudinfo[HUD_INPUT].f|16);
}
if (ycomp <= 0)
@ -1206,7 +1211,7 @@ static void ST_drawInput(void)
if (stplyr->pflags & PF_AUTOBRAKE)
{
V_DrawThinString(x, y,
hudinfo[HUD_LIVES].f|
hudinfo[HUD_INPUT].f|
((!stplyr->powers[pw_carry]
&& (stplyr->pflags & PF_APPLYAUTOBRAKE)
&& !(stplyr->cmd.sidemove || stplyr->cmd.forwardmove)
@ -1219,22 +1224,22 @@ static void ST_drawInput(void)
switch (P_ControlStyle(stplyr))
{
case CS_LMAOGALOG:
V_DrawThinString(x, y, hudinfo[HUD_LIVES].f, "ANALOG");
V_DrawThinString(x, y, hudinfo[HUD_INPUT].f, "ANALOG");
y -= 8;
break;
case CS_SIMPLE:
V_DrawThinString(x, y, hudinfo[HUD_LIVES].f, "AUTOMATIC");
V_DrawThinString(x, y, hudinfo[HUD_INPUT].f, "AUTOMATIC");
y -= 8;
break;
case CS_STANDARD:
V_DrawThinString(x, y, hudinfo[HUD_LIVES].f, "MANUAL");
V_DrawThinString(x, y, hudinfo[HUD_INPUT].f, "MANUAL");
y -= 8;
break;
case CS_LEGACY:
V_DrawThinString(x, y, hudinfo[HUD_LIVES].f, "STRAFE");
V_DrawThinString(x, y, hudinfo[HUD_INPUT].f, "STRAFE");
y -= 8;
break;
@ -1243,7 +1248,7 @@ static void ST_drawInput(void)
}
}
if (!demosynced) // should always be last, so it doesn't push anything else around
V_DrawThinString(x, y, hudinfo[HUD_LIVES].f|((leveltime & 4) ? V_YELLOWMAP : V_REDMAP), "BAD DEMO!!");
V_DrawThinString(x, y, hudinfo[HUD_INPUT].f|((leveltime & 4) ? V_YELLOWMAP : V_REDMAP), "BAD DEMO!!");
}
static patch_t *lt_patches[3];
@ -2816,14 +2821,14 @@ static void ST_overlayDrawer(void)
|| ((splitscreen && stplyr == &players[secondarydisplayplayer]) && !camera2.chase))
{
ST_drawFirstPersonHUD();
if (cv_powerupdisplay.value)
if (cv_powerupdisplay.value && LUA_HudEnabled(hud_powerups))
ST_drawPowerupHUD(); // same as it ever was...
}
else if (cv_powerupdisplay.value == 2)
else if (cv_powerupdisplay.value == 2 && LUA_HudEnabled(hud_powerups))
ST_drawPowerupHUD(); // same as it ever was...
}
else if (!(netgame || multiplayer) && cv_powerupdisplay.value == 2)
else if (!(netgame || multiplayer) && cv_powerupdisplay.value == 2 && LUA_HudEnabled(hud_powerups))
ST_drawPowerupHUD(); // same as it ever was...
if (!(netgame || multiplayer) || !hu_showscores)
@ -2844,7 +2849,7 @@ static void ST_overlayDrawer(void)
if (!hu_showscores && (netgame || multiplayer) && LUA_HudEnabled(hud_textspectator))
ST_drawTextHUD();
if (modeattacking && !(demoplayback && hu_showscores))
if ((cv_showinput.value && !players[displayplayer].spectator) || (modeattacking && !(demoplayback && hu_showscores)))
ST_drawInput();
ST_drawDebugInfo();

View file

@ -92,6 +92,7 @@ typedef struct
typedef enum
{
HUD_LIVES,
HUD_INPUT,
HUD_RINGS,
HUD_RINGSNUM,