Compare commits
42
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5973004bb9 | ||
|
|
599ef7fad7 | ||
|
|
3220faac1e | ||
|
|
ea3e23e055 | ||
|
|
112d389dcd | ||
|
|
0611d49455 | ||
|
|
45ee50b47d | ||
|
|
694a8eeb69 | ||
|
|
908bba2c8a | ||
|
|
88363cf45d | ||
|
|
509e7140e3 | ||
|
|
056f919bbe | ||
|
|
548cad76b2 | ||
|
|
e26fb91350 | ||
|
|
28685ea658 | ||
|
|
a69df8807d | ||
|
|
26fc417555 | ||
|
|
bb3dd435f0 | ||
|
|
16a531272f | ||
|
|
ba5b79e48a | ||
|
|
59470ddbd4 | ||
|
|
82c4191516 | ||
|
|
8a305d3c79 | ||
|
|
7c507c7b3b | ||
|
|
ca27dad6c1 | ||
|
|
383d55cac6 | ||
|
|
0e2ffdeb1d | ||
|
|
b84d101337 | ||
|
|
852aa74d62 | ||
|
|
aa06459c09 | ||
|
|
c07502bf5a | ||
|
|
f751161693 | ||
|
|
ed16c4fd9f | ||
|
|
41407538d4 | ||
|
|
5f394cd938 | ||
|
|
e5bae89d0f | ||
|
|
f749800276 | ||
|
|
5289027272 | ||
|
|
77f4d4ef3b | ||
|
|
a94740f5e9 | ||
|
|
ab27090ecf | ||
|
|
93d0106c28 |
No files matched your search
@@ -49,6 +49,7 @@
|
||||
# Already enabled by default for 32-bit
|
||||
# Windows.
|
||||
# NOCURL=1 - Disable libcurl--HTTP capability.
|
||||
# NOHOLEPUNCH=1 - Disable holepunch capability.
|
||||
# NOLIBGME=1 - Disable game music emu, retro VGM support.
|
||||
# NOOPENMPT=1 - Disable module (tracker) music support.
|
||||
# NOMIXER=1 - Disable SDL Mixer (audio playback).
|
||||
|
||||
@@ -6,7 +6,8 @@ passthru_opts+=\
|
||||
NOHW NOMD5 NOPOSTPROCESSING\
|
||||
MOBJCONSISTANCY PACKETDROP ZDEBUG\
|
||||
HAVE_MINIUPNPC\
|
||||
HAVE_DISCORDRPC DEVELOP
|
||||
HAVE_DISCORDRPC DEVELOP\
|
||||
NOHOLEPUNCH\
|
||||
|
||||
# build with debugging information
|
||||
ifdef DEBUGMODE
|
||||
|
||||
+5
-2
@@ -700,6 +700,7 @@ static void COM_Echo_f(void)
|
||||
|
||||
for (i = 1; i < COM_Argc(); i++)
|
||||
CONS_Printf("%s ", COM_Argv(i));
|
||||
|
||||
CONS_Printf("\n");
|
||||
}
|
||||
|
||||
@@ -708,11 +709,11 @@ static void COM_Echo_f(void)
|
||||
static void COM_CEcho_f(void)
|
||||
{
|
||||
size_t i;
|
||||
char cechotext[1024] = "";
|
||||
char cechotext[1024] = {0};
|
||||
|
||||
for (i = 1; i < COM_Argc(); i++)
|
||||
{
|
||||
strlcpy(cechotext, COM_Argv(i), sizeof(cechotext)-1);
|
||||
strlcat(cechotext, COM_Argv(i), sizeof(cechotext)-1);
|
||||
strlcat(cechotext, " ", sizeof(cechotext)-1);
|
||||
}
|
||||
|
||||
@@ -938,6 +939,8 @@ static void COM_Find_f(void)
|
||||
}
|
||||
|
||||
help = COM_Argv(1);
|
||||
if (!help)
|
||||
return;
|
||||
helplen = strlen(help);
|
||||
CONS_Printf("\x82""Variables:\n");
|
||||
matchesany = false;
|
||||
|
||||
+3
-8
@@ -823,7 +823,7 @@ static void resynch_read_player(resynch_pak *rsp)
|
||||
P_SetThingPosition(players[i].mo);
|
||||
}
|
||||
|
||||
static inline void resynch_write_ctf(resynchend_pak *rst)
|
||||
static void resynch_write_ctf(resynchend_pak *rst)
|
||||
{
|
||||
mobj_t *mflag;
|
||||
UINT8 i, j;
|
||||
@@ -863,7 +863,7 @@ static inline void resynch_write_ctf(resynchend_pak *rst)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void resynch_read_ctf(resynchend_pak *p)
|
||||
static void resynch_read_ctf(resynchend_pak *p)
|
||||
{
|
||||
UINT8 i;
|
||||
|
||||
@@ -1656,12 +1656,7 @@ static void SV_SendPlayerInfo(INT32 node)
|
||||
|
||||
netbuffer->u.playerinfo[i].node = i;
|
||||
|
||||
// Can't really change this because net compatibility, but the warning is annoying
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-truncation"
|
||||
strncpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1);
|
||||
#pragma GCC diagnostic pop
|
||||
netbuffer->u.playerinfo[i].name[MAXPLAYERNAME] = '\0';
|
||||
strlcpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1);
|
||||
|
||||
//fetch IP address
|
||||
//No, don't do that, you fuckface.
|
||||
|
||||
+13
-6
@@ -961,8 +961,11 @@ void D_ClearState(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
demo.title = false;
|
||||
|
||||
// okay, stop now
|
||||
// (otherwise the game still thinks we're playing!)
|
||||
CURLAbortFile();
|
||||
SV_StopServer();
|
||||
SV_ResetServer();
|
||||
serverlistultimatecount = 0;
|
||||
@@ -971,7 +974,10 @@ void D_ClearState(void)
|
||||
CL_ClearPlayer(i);
|
||||
|
||||
splitscreen = 0;
|
||||
SplitScreen_OnChange();
|
||||
|
||||
// recompute screen size
|
||||
R_ExecuteSetViewSize();
|
||||
|
||||
botingame = false;
|
||||
botskin = 0;
|
||||
cv_debug = 0;
|
||||
@@ -990,7 +996,6 @@ void D_ClearState(void)
|
||||
gameaction = ga_nothing;
|
||||
memset(displayplayers, 0, sizeof(displayplayers));
|
||||
consoleplayer = 0;
|
||||
//demosequence = -1;
|
||||
gametype = GT_RACE; // SRB2kart
|
||||
paused = false;
|
||||
|
||||
@@ -1013,6 +1018,11 @@ void D_ClearState(void)
|
||||
|
||||
G_SetGamestate(GS_NULL);
|
||||
wipegamestate = GS_NULL;
|
||||
|
||||
M_ClearMenus(true);
|
||||
|
||||
// map palettes affect this
|
||||
D_ResetDeviceLED();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1020,12 +1030,9 @@ void D_ClearState(void)
|
||||
//
|
||||
void D_StartTitle(void)
|
||||
{
|
||||
demo.title = false;
|
||||
D_ClearState();
|
||||
netgame = false; // title menu shouldnt be a netgame lmao
|
||||
M_ClearMenus(true);
|
||||
multiplayer = netgame = false; // title menu shouldnt be a netgame or multiplayer lmao
|
||||
F_StartTitleScreen();
|
||||
D_ResetDeviceLED();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+2
-3
@@ -1127,9 +1127,7 @@ boolean HGetPacket(void)
|
||||
|
||||
while (true)
|
||||
{
|
||||
I_NetGet();
|
||||
|
||||
if (doomcom->remotenode == -1) // No packet received
|
||||
if (!I_NetGet()) // No packets received
|
||||
return false;
|
||||
|
||||
getbytes += packetheaderlength + doomcom->datalength; // For stat
|
||||
@@ -1165,6 +1163,7 @@ boolean HGetPacket(void)
|
||||
GotAcks();
|
||||
continue;
|
||||
}
|
||||
|
||||
doomcom->datalength -= BASEPACKETSIZE;
|
||||
break;
|
||||
}
|
||||
|
||||
+27
-11
@@ -2487,15 +2487,18 @@ void D_SetupVote(void)
|
||||
INT32 i;
|
||||
UINT8 gt = (cv_kartgametypepreference.value == -1) ? gametype : cv_kartgametypepreference.value;
|
||||
UINT8 secondgt = G_SometimesGetDifferentGametype(gt);
|
||||
INT16 votebuffer[4] = {-1,-1,-1,0};
|
||||
INT16 votebuffer[4] = {-1,-1,-1, 0};
|
||||
INT16 luamaps[4] = {0, 0, 0, 0};
|
||||
|
||||
LUA_HookSetupVote(luamaps, sizeof(luamaps)/sizeof(luamaps[0]), gt, secondgt);
|
||||
|
||||
// Correct secondgt if needed
|
||||
UINT8 typeoflevel = mapheaderinfo[luamaps[2]-1]->typeoflevel;
|
||||
if (luamaps[2] && (typeoflevel & G_TOLFlag(secondgt&(~0x80))) == 0)
|
||||
secondgt = ((typeoflevel & TOL_RACE) ? GT_RACE : GT_MATCH)|(secondgt&0x80);
|
||||
if (luamaps[2])
|
||||
{
|
||||
UINT8 typeoflevel = mapheaderinfo[luamaps[2]-1]->typeoflevel;
|
||||
if ((typeoflevel & G_TOLFlag(secondgt&(~0x80))) == 0)
|
||||
secondgt = ((typeoflevel & TOL_RACE) ? GT_RACE : GT_MATCH)|(secondgt&0x80);
|
||||
}
|
||||
|
||||
if (cv_kartencore.value && gt == GT_RACE)
|
||||
WRITEUINT8(p, (gt|0x80));
|
||||
@@ -2596,14 +2599,18 @@ ConcatCommandArgv (int start, int end)
|
||||
size += strlen(COM_Argv(i)) + 1;
|
||||
}
|
||||
|
||||
final = ZZ_Alloc(size);
|
||||
p = final;
|
||||
p = final = ZZ_Alloc(size);
|
||||
|
||||
if (!p)
|
||||
I_Error("ConcatCommandArgv: Out of memory!\n");
|
||||
|
||||
--end;/* handle the final argument separately */
|
||||
|
||||
for (i = start; i < end; ++i)
|
||||
{
|
||||
p += sprintf(p, "%s ", COM_Argv(i));
|
||||
}
|
||||
|
||||
/* at this point "end" is actually the last argument's position */
|
||||
strcpy(p, COM_Argv(end));
|
||||
|
||||
@@ -4214,23 +4221,32 @@ static void Command_MotD_f(void)
|
||||
|
||||
mymotd = Z_Malloc(sizeof(motd), PU_STATIC, NULL);
|
||||
|
||||
strlcpy(mymotd, COM_Argv(1), sizeof motd);
|
||||
if (!mymotd)
|
||||
return;
|
||||
//I_Error("Command_MotD_f: Out of memory!\n"); // idk if this aint a bit too much lel
|
||||
|
||||
strlcpy(mymotd, COM_Argv(1), sizeof(motd));
|
||||
|
||||
for (i = 2; i < j; i++)
|
||||
{
|
||||
strlcat(mymotd, " ", sizeof motd);
|
||||
strlcat(mymotd, COM_Argv(i), sizeof motd);
|
||||
strlcat(mymotd, " ", sizeof(motd));
|
||||
strlcat(mymotd, COM_Argv(i), sizeof(motd));
|
||||
}
|
||||
|
||||
// Disallow non-printing characters and semicolons.
|
||||
for (i = 0; mymotd[i] != '\0'; i++)
|
||||
{
|
||||
if (!isprint(mymotd[i]) || mymotd[i] == ';')
|
||||
{
|
||||
Z_Free(mymotd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((netgame || multiplayer) && client)
|
||||
{
|
||||
SendNetXCmd(XD_SETMOTD, mymotd, i); // send the actual size of the motd string, not the full buffer's size
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(motd, mymotd);
|
||||
@@ -4429,7 +4445,7 @@ static void Command_Addfile(void)
|
||||
}
|
||||
|
||||
// Add file on your client directly if it is trivial, or you aren't in a netgame.
|
||||
if (!(netgame || multiplayer) || musiconly)
|
||||
if (!netgame || musiconly)
|
||||
{
|
||||
P_AddWadFile(fn, false);
|
||||
return;
|
||||
@@ -4472,7 +4488,7 @@ static void Command_Addfile(void)
|
||||
if (IsPlayerAdmin(consoleplayer) && (!server)) // Request to add file
|
||||
SendNetXCmd(XD_REQADDFILE, buf, buf_p - buf);
|
||||
else
|
||||
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);;
|
||||
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
|
||||
}
|
||||
|
||||
/** Adds something at runtime.
|
||||
|
||||
@@ -1442,7 +1442,7 @@ static INT32 errorcount = 0;
|
||||
*/
|
||||
static boolean shutdowning = false;
|
||||
|
||||
void I_Error(const char *error, ...)
|
||||
FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char buffer[8192];
|
||||
|
||||
@@ -651,7 +651,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||
|
||||
#if defined (HAVE_CURL)
|
||||
#define MASTERSERVER
|
||||
#ifndef NOHOLEPUNCH
|
||||
#define HOLEPUNCH
|
||||
#endif
|
||||
#else
|
||||
#undef UPDATE_ALERT
|
||||
#endif
|
||||
|
||||
@@ -963,6 +963,7 @@ void F_StartTitleScreen(void)
|
||||
finalecount = 0;
|
||||
else
|
||||
wipegamestate = GS_TITLESCREEN;
|
||||
|
||||
G_SetGamestate(GS_TITLESCREEN);
|
||||
CON_ClearHUD();
|
||||
|
||||
|
||||
+382
-315
File diff suppressed because it is too large.
Load diff
@@ -4061,7 +4061,11 @@ char *G_BuildMapTitle(INT32 mapnum)
|
||||
|
||||
title = Z_Malloc(len, PU_STATIC, NULL);
|
||||
|
||||
if (!title)
|
||||
return NULL;
|
||||
|
||||
sprintf(title, "%s", mapheaderinfo[mapnum-1]->lvlttl);
|
||||
|
||||
if (zonetext) sprintf(title + strlen(title), " %s", zonetext);
|
||||
if (actnum) sprintf(title + strlen(title), " %s", actnum);
|
||||
}
|
||||
|
||||
+29
-28
@@ -46,9 +46,9 @@ typedef struct
|
||||
UINT8 image_descriptor; //18
|
||||
} ATTRPACK TGAHeader; // sizeof is 18
|
||||
|
||||
static UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229,255};
|
||||
static UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255};
|
||||
static UINT8 softwaretranstogl_lo[11] = { 0, 12, 24, 36, 48, 60, 71, 83, 95,111,127};
|
||||
static const UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229,255};
|
||||
static const UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255};
|
||||
static const UINT8 softwaretranstogl_lo[11] = { 0, 12, 24, 36, 48, 60, 71, 83, 95,111,127};
|
||||
|
||||
static const float FLOATBASEVIDWIDTH = (float)BASEVIDWIDTH;
|
||||
static const float FLOATBASEVIDHEIGHT = (float)BASEVIDHEIGHT;
|
||||
@@ -87,15 +87,15 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
|
||||
|
||||
switch (option & V_SCALEPATCHMASK)
|
||||
{
|
||||
case V_NOSCALEPATCH:
|
||||
dup = 1.0f;
|
||||
break;
|
||||
case V_SMALLSCALEPATCH:
|
||||
dup = (float)vid.smalldup;
|
||||
break;
|
||||
case V_MEDSCALEPATCH:
|
||||
dup = (float)vid.meddup;
|
||||
break;
|
||||
case V_NOSCALEPATCH:
|
||||
dup = 1.0f;
|
||||
break;
|
||||
case V_SMALLSCALEPATCH:
|
||||
dup = (float)vid.smalldup;
|
||||
break;
|
||||
case V_MEDSCALEPATCH:
|
||||
dup = (float)vid.meddup;
|
||||
break;
|
||||
}
|
||||
|
||||
fscalew = fscaleh = FIXED_TO_FLOAT(pscale);
|
||||
@@ -269,15 +269,15 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
||||
|
||||
switch (option & V_SCALEPATCHMASK)
|
||||
{
|
||||
case V_NOSCALEPATCH:
|
||||
dup = 1.0f;
|
||||
break;
|
||||
case V_SMALLSCALEPATCH:
|
||||
dup = (float)vid.smalldup;
|
||||
break;
|
||||
case V_MEDSCALEPATCH:
|
||||
dup = (float)vid.meddup;
|
||||
break;
|
||||
case V_NOSCALEPATCH:
|
||||
dup = 1.0f;
|
||||
break;
|
||||
case V_SMALLSCALEPATCH:
|
||||
dup = (float)vid.smalldup;
|
||||
break;
|
||||
case V_MEDSCALEPATCH:
|
||||
dup = (float)vid.meddup;
|
||||
break;
|
||||
}
|
||||
|
||||
fscale = FIXED_TO_FLOAT(pscale);
|
||||
@@ -506,7 +506,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
|
||||
if (color & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
if (HWR_ShouldUsePaletteRendering() && cv_glscreentextures.value)
|
||||
if (cv_glscreentextures.value && HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
|
||||
|
||||
@@ -518,12 +518,10 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
GL_UnSetShader();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
|
||||
Surf.PolyColor.s.alpha = (strength*8);
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
|
||||
Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
|
||||
Surf.PolyColor.s.alpha = (strength*8);
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
@@ -890,11 +888,13 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
|
||||
if (fx >= vid.width || fy >= vid.height)
|
||||
return;
|
||||
|
||||
if (fx < 0)
|
||||
{
|
||||
fw += fx;
|
||||
fx = 0;
|
||||
}
|
||||
|
||||
if (fy < 0)
|
||||
{
|
||||
fh += fy;
|
||||
@@ -906,6 +906,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
|
||||
if (fx + fw > vid.width)
|
||||
fw = fvw - fx;
|
||||
|
||||
if (fy + fh > vid.height)
|
||||
fh = fvh - fy;
|
||||
|
||||
|
||||
+25
-17
@@ -431,7 +431,7 @@ void HU_Start(void)
|
||||
|
||||
void HU_Shiftform(void)
|
||||
{
|
||||
shiftxform = cv_keyboardlayout.value == 3 ? french_shiftxform : english_shiftxform;
|
||||
shiftxform = (cv_keyboardlayout.value == 3) ? french_shiftxform : english_shiftxform;
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
@@ -465,8 +465,8 @@ static INT16 addy = 0; // use this to make the messages scroll smoothly when one
|
||||
static void HU_removeChatText_Mini(void)
|
||||
{
|
||||
// MPC: Don't create new arrays, just iterate through an existing one
|
||||
size_t i;
|
||||
for(i=0;i<chat_nummsg_min-1;i++) {
|
||||
for (size_t i = 0; i < chat_nummsg_min - 1; i++)
|
||||
{
|
||||
strcpy(chat_mini[i], chat_mini[i+1]);
|
||||
chat_timers[i] = chat_timers[i+1];
|
||||
}
|
||||
@@ -485,8 +485,8 @@ static void HU_removeChatText_Log(void)
|
||||
return;
|
||||
|
||||
free(chat_log[0]);
|
||||
size_t i;
|
||||
for(i=0;i<chat_nummsg_log-1;i++)
|
||||
|
||||
for (size_t i = 0; i < chat_nummsg_log - 1;i++)
|
||||
{
|
||||
chat_log[i] = chat_log[i+1];
|
||||
}
|
||||
@@ -1101,14 +1101,14 @@ void HU_Ticker(void)
|
||||
size_t i = 0;
|
||||
|
||||
// handle spam while we're at it:
|
||||
for(; (i<MAXPLAYERS); i++)
|
||||
for(; (i < MAXPLAYERS); i++)
|
||||
{
|
||||
if (stop_spamming[i] > 0)
|
||||
stop_spamming[i]--;
|
||||
}
|
||||
|
||||
// handle chat timers
|
||||
for (i=0; (i<chat_nummsg_min); i++)
|
||||
for (i = 0; (i < chat_nummsg_min); i++)
|
||||
{
|
||||
if (chat_timers[i] > 0)
|
||||
chat_timers[i]--;
|
||||
@@ -1231,7 +1231,7 @@ static void HU_SendChatMessage(void)
|
||||
nodenum[2] = '\0';
|
||||
|
||||
// check for undesirable characters in our "number"
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
{
|
||||
// check if nodenum[1] is a space
|
||||
if (nodenum[1] == ' ')
|
||||
@@ -1499,7 +1499,7 @@ static void HU_drawMiniChat(void)
|
||||
if (splitscreen > 1)
|
||||
boxw = max(64, boxw/2);
|
||||
|
||||
for (; i>0; i--)
|
||||
for (; i > 0; i--)
|
||||
{
|
||||
char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]);
|
||||
size_t j = 0;
|
||||
@@ -1572,7 +1572,7 @@ static void HU_drawMiniChat(void)
|
||||
i = 0;
|
||||
prev_linereturn = false;
|
||||
|
||||
for (; i<=(chat_nummsg_min-1); i++) // iterate through our hot messages
|
||||
for (; i <= (chat_nummsg_min-1); i++) // iterate through our hot messages
|
||||
{
|
||||
INT32 clrflag = 0;
|
||||
INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below...
|
||||
@@ -1749,7 +1749,6 @@ static void HU_drawChatLog(INT32 offset)
|
||||
Z_Free(msg);
|
||||
}
|
||||
|
||||
|
||||
if (((chat_scroll >= chat_maxscroll) || (chat_scrollmedown)) && !(justscrolleddown || justscrolledup || chat_scrolltime)) // was already at the bottom of the page before new maxscroll calculation and was NOT scrolling.
|
||||
{
|
||||
atbottom = true; // we should scroll
|
||||
@@ -2284,6 +2283,7 @@ static void HU_DrawSongCreditsBox(void)
|
||||
V_DrawFill(x, y, strwidth*dup, BOXCREDITHEIGHT*dup, 28|flags|(bgt<<V_ALPHASHIFT));
|
||||
V_DrawFill(x+dup, y+dup, (strwidth-2)*dup, (BOXCREDITHEIGHT-2)*dup, 30|flags|(bgt<<V_ALPHASHIFT));
|
||||
}
|
||||
|
||||
if (cursongcredit.trans < NUMTRANSMAPS)
|
||||
{
|
||||
V_DrawSmallString(x+2*dup, y+2*dup, V_ALLOWLOWERCASE|flags|(cursongcredit.trans<<V_ALPHASHIFT), str);
|
||||
@@ -2845,12 +2845,8 @@ void HU_SetCEchoFlags(INT32 flags)
|
||||
|
||||
void HU_DoCEcho(const char *msg)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstringop-truncation" // This is fine, we set null byte later
|
||||
strncpy(cechotext, msg, sizeof(cechotext));
|
||||
#pragma GCC diagnostic pop
|
||||
strncat(cechotext, "\\", sizeof(cechotext) - strlen(cechotext) - 1);
|
||||
cechotext[sizeof(cechotext) - 1] = '\0';
|
||||
strlcpy(cechotext, msg, sizeof(cechotext));
|
||||
strlcat(cechotext, "\\", sizeof(cechotext));
|
||||
|
||||
// just print it to console
|
||||
if (cv_cechotoggle.value == 2)
|
||||
@@ -2859,8 +2855,20 @@ void HU_DoCEcho(const char *msg)
|
||||
strncpy(temp, cechotext, sizeof(temp));
|
||||
|
||||
for (char *p = temp; *p != '\0'; ++p)
|
||||
{
|
||||
if (*p == '\\')
|
||||
{
|
||||
*p = '\n';
|
||||
++p;
|
||||
char *skip_p = p; // Point at which we will move part of string after all \'s
|
||||
|
||||
while (*p == '\\')
|
||||
++p;
|
||||
|
||||
memmove(skip_p, p, strlen(p)+1); // move the rest of string with null byte
|
||||
p = skip_p; // Restore p
|
||||
}
|
||||
}
|
||||
|
||||
CONS_Printf("%s\n", temp);
|
||||
|
||||
|
||||
+116
-49
@@ -28,14 +28,14 @@
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define USE_WINSOCK
|
||||
#define USE_WINSOCK
|
||||
#endif //WIN32 OS
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
#include <ws2tcpip.h>
|
||||
#define addrinfo_t ADDRINFOA
|
||||
#include <ws2tcpip.h>
|
||||
#define addrinfo_t ADDRINFOA
|
||||
#else
|
||||
#define addrinfo_t struct addrinfo
|
||||
#define addrinfo_t struct addrinfo
|
||||
#endif
|
||||
|
||||
#include "doomdef.h"
|
||||
@@ -148,16 +148,16 @@ static UINT8 UPNP_support = TRUE;
|
||||
|
||||
#define DEFAULTPORT "5029"
|
||||
|
||||
#if defined (USE_WINSOCK)
|
||||
typedef SOCKET SOCKET_TYPE;
|
||||
#define ERRSOCKET (SOCKET_ERROR)
|
||||
#ifdef USE_WINSOCK
|
||||
typedef SOCKET SOCKET_TYPE;
|
||||
#define ERRSOCKET (SOCKET_ERROR)
|
||||
#else
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (__HAIKU__)
|
||||
typedef int SOCKET_TYPE;
|
||||
#else
|
||||
typedef unsigned long SOCKET_TYPE;
|
||||
#endif
|
||||
#define ERRSOCKET (-1)
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (__HAIKU__)
|
||||
typedef int SOCKET_TYPE;
|
||||
#else
|
||||
typedef unsigned long SOCKET_TYPE;
|
||||
#endif
|
||||
#define ERRSOCKET (-1)
|
||||
#endif
|
||||
|
||||
#define IPV6_MULTICAST_ADDRESS "ff15::57e1:1a12"
|
||||
@@ -345,17 +345,15 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
||||
{
|
||||
static char s[64]; // 255.255.255.255:65535 or
|
||||
// [ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]:65535
|
||||
|
||||
#ifdef HAVE_IPV6
|
||||
int v6 = (sk->any.sa_family == AF_INET6);
|
||||
#else
|
||||
int v6 = 0;
|
||||
#endif
|
||||
|
||||
void *addr;
|
||||
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
|
||||
|
||||
if(sk->any.sa_family == AF_INET)
|
||||
if (sk->any.sa_family == AF_INET)
|
||||
addr = &sk->ip4.sin_addr;
|
||||
#ifdef HAVE_IPV6
|
||||
else if(sk->any.sa_family == AF_INET6)
|
||||
@@ -364,9 +362,11 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
||||
else
|
||||
addr = NULL;
|
||||
|
||||
if(addr == NULL)
|
||||
if (addr == NULL)
|
||||
{
|
||||
sprintf(s, "No address");
|
||||
else if(inet_ntop(sk->any.sa_family, addr, &s[v6], sizeof (s) - v6) == NULL)
|
||||
}
|
||||
else if (inet_ntop(sk->any.sa_family, addr, &s[v6], sizeof (s) - v6) == NULL)
|
||||
{
|
||||
e = errno;
|
||||
sprintf(s, "Unknown family type, error #%u: %s", e, strerror(e));
|
||||
@@ -381,7 +381,7 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
||||
strcat(s, va(":%d", ntohs(sk->ip6.sin6_port)));
|
||||
}
|
||||
#endif
|
||||
else if(sk->any.sa_family == AF_INET && sk->ip4.sin_port != 0)
|
||||
else if (sk->any.sa_family == AF_INET && sk->ip4.sin_port != 0)
|
||||
strcat(s, va(":%d", ntohs(sk->ip4.sin_port)));
|
||||
|
||||
return s;
|
||||
@@ -481,7 +481,6 @@ static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// This is a hack. For some reason, nodes aren't being freed properly.
|
||||
// This goes through and cleans up what nodes were supposed to be freed.
|
||||
/** \warning This function causes the file downloading to stop if someone joins.
|
||||
@@ -636,7 +635,7 @@ static boolean SOCK_Get(void)
|
||||
c = recvfrom(mysockets[n], (char *)&doomcom->data, MAXPACKETLENGTH, 0,
|
||||
(void *)&fromaddress, &fromlen);
|
||||
|
||||
if (c > 0)
|
||||
if (c != ERRSOCKET)
|
||||
{
|
||||
#ifdef USE_STUN
|
||||
if (STUN_got_response(doomcom->data, c))
|
||||
@@ -652,20 +651,21 @@ static boolean SOCK_Get(void)
|
||||
#endif
|
||||
|
||||
// find remote node number
|
||||
for (j = 1; j <= MAXNETNODES; j++) //include LAN
|
||||
for (j = 1; j <= MAXNETNODES; j++) // include LAN
|
||||
{
|
||||
if (SOCK_cmpaddr(&fromaddress, &clientaddress[j], 0))
|
||||
{
|
||||
doomcom->remotenode = (INT16)j; // good packet from a game player
|
||||
doomcom->datalength = (INT16)c;
|
||||
nodesocket[j] = mysockets[n];
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// not found
|
||||
|
||||
// find a free slot
|
||||
j = getfreenode();
|
||||
|
||||
if (j > 0)
|
||||
{
|
||||
const time_t curTime = time(NULL);
|
||||
@@ -746,13 +746,19 @@ static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr
|
||||
|
||||
#define ALLOWEDERROR(x) ((x) == ECONNREFUSED || (x) == EWOULDBLOCK || (x) == EHOSTUNREACH || (x) == ENETUNREACH || (x) == EADDRNOTAVAIL)
|
||||
|
||||
// FIXME: maybe retry if this failed somehow?
|
||||
// windows kinda dies rather often when some other network heavy thing runs besides kart
|
||||
static void SOCK_Send(void)
|
||||
{
|
||||
ssize_t c = ERRSOCKET;
|
||||
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
|
||||
size_t i, j;
|
||||
|
||||
if (!nodeconnected[doomcom->remotenode])
|
||||
#ifndef USE_WINSOCK
|
||||
errno = 0;
|
||||
#endif
|
||||
|
||||
if (doomcom->remotenode < 0 || !nodeconnected[doomcom->remotenode])
|
||||
return;
|
||||
|
||||
if (doomcom->remotenode == BROADCASTADDR)
|
||||
@@ -840,6 +846,10 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
mysockaddr_t straddr;
|
||||
socklen_t len = sizeof(straddr);
|
||||
|
||||
#ifndef USE_WINSOCK
|
||||
errno = 0;
|
||||
#endif
|
||||
|
||||
if (s == (SOCKET_TYPE)ERRSOCKET)
|
||||
return (SOCKET_TYPE)ERRSOCKET;
|
||||
|
||||
@@ -970,30 +980,90 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
e = errno;
|
||||
I_OutputMsg("getting SO_RCVBUF failed: #%u, %s\n", e, strerror(e));
|
||||
}
|
||||
CONS_Printf(M_GetText("Network system buffer: %dKb\n"), opt>>10);
|
||||
CONS_Printf(M_GetText("Network receive buffer: %dKb\n"), opt>>10);
|
||||
|
||||
if (opt < 64<<10) // 64k
|
||||
//if (opt < 64<<10) // 64k minimum
|
||||
if (opt < 256<<10) // no try 256k first
|
||||
{
|
||||
opt = 64<<10;
|
||||
opts = (socklen_t)sizeof(opt);
|
||||
rc = setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&opt, opts);
|
||||
if (rc <= -1)
|
||||
const int buf_sizes[] = {256<<10, 128<<10, 64<<10}; // Try 256k, 128k, then 64k
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < sizeof(buf_sizes) / sizeof(buf_sizes[0]); i++)
|
||||
{
|
||||
e = errno;
|
||||
I_OutputMsg("setting SO_RCVBUF failed: #%u, %s\n", e, strerror(e));
|
||||
}
|
||||
opt = 0;
|
||||
rc = getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&opt, &opts);
|
||||
if (rc <= -1)
|
||||
{
|
||||
e = errno;
|
||||
I_OutputMsg("getting SO_RCVBUF failed: #%u, %s\n", e, strerror(e));
|
||||
opt = buf_sizes[i];
|
||||
opts = (socklen_t)sizeof(opt);
|
||||
rc = setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&opt, opts);
|
||||
if (rc <= -1)
|
||||
{
|
||||
e = errno;
|
||||
I_OutputMsg("setting SO_RCVBUF to %dKb failed: #%u, %s\n", opt>>10, e, strerror(e));
|
||||
continue;
|
||||
}
|
||||
|
||||
opt = 0;
|
||||
rc = getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&opt, &opts);
|
||||
if (rc <= -1)
|
||||
{
|
||||
e = errno;
|
||||
I_OutputMsg("getting SO_RCVBUF failed: #%u, %s\n", e, strerror(e));
|
||||
}
|
||||
|
||||
if (opt >= buf_sizes[i])
|
||||
{
|
||||
CONS_Printf(M_GetText("Network system receive buffer set to: %dKb\n"), opt>>10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (opt < 64<<10)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Can't set buffer length to 64k, file transfer will be bad\n"));
|
||||
else
|
||||
CONS_Printf(M_GetText("Network system buffer set to: %dKb\n"), opt>>10);
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Can't set receive buffer length to at least 64k, file transfer will be bad\n"));
|
||||
}
|
||||
|
||||
opt = 0;
|
||||
opts = (socklen_t)sizeof(opt);
|
||||
rc = getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&opt, &opts);
|
||||
if (rc <= -1)
|
||||
{
|
||||
e = errno;
|
||||
I_OutputMsg("getting SO_SNDBUF failed: #%u, %s\n", e, strerror(e));
|
||||
}
|
||||
CONS_Printf(M_GetText("Network send buffer: %dKb\n"), opt>>10);
|
||||
|
||||
//if (opt < 64<<10) // 64k minimum
|
||||
if (opt < 256<<10) // no try 256k first
|
||||
{
|
||||
int buf_sizes[] = {256<<10, 128<<10, 64<<10}; // Try 256k, 128k, then 64k
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < sizeof(buf_sizes) / sizeof(buf_sizes[0]); i++)
|
||||
{
|
||||
opt = buf_sizes[i];
|
||||
opts = (socklen_t)sizeof(opt);
|
||||
rc = setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&opt, opts);
|
||||
if (rc <= -1)
|
||||
{
|
||||
e = errno;
|
||||
I_OutputMsg("setting SO_SNDBUF to %dKb failed: #%u, %s\n", opt>>10, e, strerror(e));
|
||||
continue;
|
||||
}
|
||||
|
||||
opt = 0;
|
||||
rc = getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&opt, &opts);
|
||||
if (rc <= -1)
|
||||
{
|
||||
e = errno;
|
||||
I_OutputMsg("getting SO_SNDBUF failed: #%u, %s\n", e, strerror(e));
|
||||
}
|
||||
|
||||
if (opt >= buf_sizes[i])
|
||||
{
|
||||
CONS_Printf(M_GetText("Network system send buffer set to: %dKb\n"), opt>>10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (opt < 64<<10)
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Can't set send buffer length to at least 64k, file transfer will be bad\n"));
|
||||
}
|
||||
|
||||
rc = getsockname(s, &straddr.any, &len);
|
||||
@@ -1269,9 +1339,9 @@ void I_ShutdownTcpDriver(void)
|
||||
init_tcp_driver = false;
|
||||
}
|
||||
|
||||
static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const char *port, boolean test)
|
||||
static boolean SOCK_GetAddr(mysockaddr_t *sin, const char *address, const char *port, boolean test)
|
||||
{
|
||||
addrinfo_t *ai = NULL, *runp, hints;
|
||||
addrinfo_t *ai, *runp, hints;
|
||||
int gaie;
|
||||
size_t i;
|
||||
|
||||
@@ -1287,10 +1357,7 @@ static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const
|
||||
gaie = getaddrinfo(address, port, &hints, &ai);
|
||||
|
||||
if (gaie != 0)
|
||||
{
|
||||
freeaddrinfo(ai);
|
||||
return false;
|
||||
}
|
||||
|
||||
runp = ai;
|
||||
|
||||
@@ -1330,7 +1397,7 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port)
|
||||
|
||||
if (newnode != -1)
|
||||
{
|
||||
if (!SOCK_GetAddr(&clientaddress[newnode].ip4, address, port, true))
|
||||
if (!SOCK_GetAddr(&clientaddress[newnode], address, port, true))
|
||||
{
|
||||
nodeconnected[newnode] = false;
|
||||
return -1;
|
||||
@@ -1358,7 +1425,7 @@ static void rendezvous(int size)
|
||||
|
||||
if (tic != refreshtic)
|
||||
{
|
||||
if (SOCK_GetAddr(&rzv.ip4, host, (port ? port : "7777"), false))
|
||||
if (SOCK_GetAddr(&rzv, host, (port ? port : "7777"), false))
|
||||
{
|
||||
refreshtic = tic;
|
||||
}
|
||||
|
||||
@@ -608,9 +608,6 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, bo
|
||||
if (color >= MAXTRANSLATIONS)
|
||||
I_Error("Invalid skin color #%hu.", (UINT16)color);
|
||||
|
||||
if (skinnum < 0 && skinnum > TC_DEFAULT)
|
||||
I_Error("Invalid translation colormap index %d.", skinnum);
|
||||
|
||||
starttranscolor = (skinnum != TC_DEFAULT) ? K_GetSkinArray(local)[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR;
|
||||
|
||||
if (starttranscolor >= NUM_PALETTE_ENTRIES)
|
||||
|
||||
@@ -288,6 +288,10 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump)
|
||||
lumpinfo_t *lump_p = &wadfiles[wad]->lumpinfo[lump];
|
||||
len += 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name
|
||||
name = malloc(len+1);
|
||||
|
||||
if (!name)
|
||||
I_Error("LUA_LoadLump: Out of memory!\n");
|
||||
|
||||
sprintf(name, "%s|%s", wadfiles[wad]->filename, lump_p->fullname);
|
||||
name[len] = '\0';
|
||||
}
|
||||
|
||||
+5
-3
@@ -69,16 +69,18 @@ INT32 M_CheckProtoParam(const char *check)
|
||||
|
||||
for (i = 1; i < myargc; i++)
|
||||
{
|
||||
if (strncmp(myargv[i], "srb2kart://", 11) == 0)
|
||||
if (strncmp(myargv[i], "srb2kart://", 11) == 0)
|
||||
{
|
||||
if (strncmp(myargv[i]+11, check, strlen(check))==0)
|
||||
if (strncmp(myargv[i]+11, check, strlen(check)) == 0)
|
||||
{
|
||||
found = i;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
found = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -93,7 +95,7 @@ const char *M_GetProtoParam(void)
|
||||
|
||||
for (i = 1; i < myargc; i++)
|
||||
{
|
||||
if (strncmp(myargv[i], "srb2kart://", 11) == 0)
|
||||
if (strncmp(myargv[i], "srb2kart://", 11) == 0)
|
||||
{
|
||||
string = strchr(myargv[i], '/');
|
||||
string = strchr(string+1, '/');
|
||||
|
||||
+11
-7
@@ -7179,17 +7179,21 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
||||
namescroll = 0;
|
||||
}
|
||||
|
||||
if (renderisnewtic) namescroll++;
|
||||
if (renderisnewtic)
|
||||
namescroll++;
|
||||
|
||||
char *addonname = wadfiles[mapwads[cv_nextmap.value-1]]->filename;
|
||||
INT32 len;
|
||||
INT32 charlimit = min((size_t)(21 + (dupadjust/5)), sizeof(namescrollbuf)-1);
|
||||
|
||||
nameonly(addonname);
|
||||
len = strlen(addonname);
|
||||
|
||||
if (len > charlimit)
|
||||
M_ScrollString(addonname, len, namescrollbuf, charlimit, namescroll);
|
||||
else
|
||||
strncpy(namescrollbuf, addonname, sizeof(namescrollbuf));
|
||||
strncpy(namescrollbuf, addonname, sizeof(namescrollbuf) - 1);
|
||||
|
||||
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT|MENUCAPS, namescrollbuf); // variable reuse...
|
||||
}
|
||||
|
||||
@@ -8279,12 +8283,12 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
||||
|
||||
sprframe = &sprdef->spriteframes[frame];
|
||||
|
||||
//minenice's speen css, it's a piece of shit but hey
|
||||
// minenice's speen css, it's a piece of shit but hey
|
||||
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
|
||||
|
||||
//this is a very shitty solution for checking if a sprite needs flipping
|
||||
//but it works
|
||||
if ((sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]) && (speenframe > 4))
|
||||
// this is a very shitty solution for checking if a sprite needs flipping
|
||||
// but it works
|
||||
if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
|
||||
flags = V_FLIP; // This sprite is left/right flipped!
|
||||
|
||||
patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
|
||||
@@ -9639,7 +9643,7 @@ static void M_DrawLocalSkinMenu(void)
|
||||
|
||||
//this is a very shitty solution for checking if a sprite needs flipping
|
||||
//but it works
|
||||
if ((sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]) && (speenframe > 4))
|
||||
if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
|
||||
{
|
||||
flags = V_FLIP; // This sprite is left/right flipped!
|
||||
}
|
||||
|
||||
+12
-12
@@ -968,16 +968,16 @@ static const char* OP_ExpTooltips[] =
|
||||
NULL,
|
||||
"How far Mobj interpolation should take effect.",
|
||||
"When weather is on this will cut the object amount used in half.",
|
||||
"Sets minimum sector brightness, useful for dark areas",
|
||||
"Sets minimum sector brightness, useful for dark areas.",
|
||||
//"Should the directional lightning be randomized each map?\nTakes effect on next map load.",
|
||||
"Toggle being able to see the sky.",
|
||||
"Change the FPS counter sampling method\nInaccurate updates slower and might miss frame drops and such\nAccurate updates faster and is more accurate, but might be less readable", // how to ingles??
|
||||
"Skips rendering frames if game logic takes too long preventing issues during performance drops." // idk im shit as describing things
|
||||
"Change the FPS counter sampling method\nInaccurate updates slower\nand might miss sudden framerate changes and drops,\nproviding a more averaged result.\nAccurate updates faster, but might be less readable.", // how to ingles??
|
||||
"Skips rendering frames if game logic takes too long\npreventing gameplay issues during performance drops.", // idk im shit as describing things
|
||||
"Different methods of scaling the votescreen backgrounds.",
|
||||
#ifdef HWRENDER
|
||||
"Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.",
|
||||
#ifdef USE_FBO_OGL
|
||||
"Allows the game to downsample from a higher resolution than your display\nin OpenGL renderer mode. Requires a GPU with atleast OpenGL 3.0 support.",
|
||||
"Allows the game to downsample from a higher resolution\nthan your display in OpenGL renderer mode.\nRequires a GPU with atleast OpenGL 2.1 support.",
|
||||
#endif
|
||||
"Change the bit depth of the Lookup Palette in Palette rendering mode\n 16 bits is like software looks ingame\nwhile 24 bits is how software looks in screenshots.",
|
||||
#endif
|
||||
@@ -1375,15 +1375,15 @@ static menuitem_t OP_Player4CamOptionsMenu[] =
|
||||
static const char* OP_PlayerCamOptionsTooltips[] =
|
||||
{
|
||||
NULL,
|
||||
"Should the Camera flip on gravity flipped sections?.",
|
||||
"Should the Camera flip on gravity flipped sections?",
|
||||
"Camera distance relative to the Player.",
|
||||
"Height of the Camera",
|
||||
"Pitch Camera on Upwards or Downhill Slopes",
|
||||
"Speed of the Camera",
|
||||
"Should looking back inherit the Players Momentum?\nEither inherit Player Momentum or double of it\nmay make looking back while boosting or going in high speed less jarring",
|
||||
"Height of the Camera.",
|
||||
"Pitch Camera on Upwards or Downhill Slopes.",
|
||||
"Speed of the Camera.",
|
||||
"Should looking back inherit the Players Momentum?\nEither inherit Player Momentum or double of it\nmay make looking back while boosting or going in high speed less jarring.",
|
||||
"Allows looking up/down by holding\naim forward/backward while standing still.",
|
||||
"Speed of the Freecam/Spectator Camera",
|
||||
"Toggle between Third or First Person camera",
|
||||
"Speed of the Freecam/Spectator Camera.",
|
||||
"Toggle between Third or First Person camera.",
|
||||
};
|
||||
|
||||
// Ok it's still called chatoptions but we'll put ping display in here to be clean
|
||||
@@ -1763,7 +1763,7 @@ static const char* OP_PlayerDistortTooltips[] =
|
||||
"Distance object rotation should be visable.",
|
||||
"Player rotation when sliptiding.",
|
||||
"Rotation of a player's boost trails and drift sparks.",
|
||||
"Should banans rotate when thrown?\nAnd should they stay rotated when on the ground?.",
|
||||
"Should banans rotate when thrown?\nAnd should they stay rotated when on the ground?",
|
||||
"Player squash and stretch.",
|
||||
"Player landing sound effect.",
|
||||
"Kart hopping while drifting. This is purely visual.",
|
||||
|
||||
+41
-23
@@ -708,7 +708,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
HU_SetCEchoFlags(0);
|
||||
HU_SetCEchoDuration(5);
|
||||
HU_DoCEcho(va("%s\\was hit by a kitchen sink.\\\\\\\\", player_names[thing->player-players]));
|
||||
I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[thing->player-players]);
|
||||
//I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[thing->player-players]);
|
||||
P_DamageMobj(thing, tmthing, tmthing->target, DMG_INSTAKILL);
|
||||
P_KillMobj(tmthing, thing, thing);
|
||||
}
|
||||
@@ -977,7 +977,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
HU_SetCEchoFlags(0);
|
||||
HU_SetCEchoDuration(5);
|
||||
HU_DoCEcho(va("%s\\was hit by a kitchen sink.\\\\\\\\", player_names[tmthing->player-players]));
|
||||
I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[tmthing->player-players]);
|
||||
//I_OutputMsg("%s was hit by a kitchen sink.\n", player_names[tmthing->player-players]);
|
||||
P_DamageMobj(tmthing, thing, thing->target, DMG_INSTAKILL);
|
||||
P_KillMobj(thing, tmthing, tmthing);
|
||||
}
|
||||
@@ -2189,7 +2189,7 @@ static boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
//
|
||||
boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
{
|
||||
subsector_t *s;
|
||||
subsector_t *subsec;
|
||||
UINT8 i;
|
||||
|
||||
floatok = false;
|
||||
@@ -2198,9 +2198,9 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
return false;
|
||||
|
||||
if (thiscam->x != x || thiscam->y != y || thiscam->subsector == NULL)
|
||||
s = R_PointInSubsectorFast(x, y);
|
||||
subsec = R_PointInSubsectorFast(x, y);
|
||||
else
|
||||
s = thiscam->subsector;
|
||||
subsec = thiscam->subsector;
|
||||
|
||||
if (players[displayplayers[0]].mo)
|
||||
{
|
||||
@@ -2220,7 +2220,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
thiscam->ceilingz = thiscam->z + thiscam->height;
|
||||
thiscam->x = x;
|
||||
thiscam->y = y;
|
||||
thiscam->subsector = s;
|
||||
thiscam->subsector = subsec;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2232,6 +2232,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
tryx -= MAXRADIUS;
|
||||
else
|
||||
tryx = x;
|
||||
|
||||
if (y-tryy > MAXRADIUS)
|
||||
tryy += MAXRADIUS;
|
||||
else if (y-tryy < -MAXRADIUS)
|
||||
@@ -2249,14 +2250,14 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
|
||||
if (tmceilingz - thiscam->z < thiscam->height)
|
||||
{
|
||||
if (s == thiscam->subsector && tmceilingz >= thiscam->z)
|
||||
if (subsec == thiscam->subsector && tmceilingz >= thiscam->z)
|
||||
{
|
||||
floatok = true;
|
||||
thiscam->floorz = tmfloorz;
|
||||
thiscam->ceilingz = tmfloorz + thiscam->height;
|
||||
thiscam->x = x;
|
||||
thiscam->y = y;
|
||||
thiscam->subsector = s;
|
||||
thiscam->subsector = subsec;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -2281,7 +2282,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
|
||||
thiscam->ceilingz = tmceilingz;
|
||||
thiscam->x = x;
|
||||
thiscam->y = y;
|
||||
thiscam->subsector = s;
|
||||
thiscam->subsector = subsec;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2394,6 +2395,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
tryx -= radius;
|
||||
else
|
||||
tryx = x;
|
||||
|
||||
if (y-tryy > radius)
|
||||
tryy += radius;
|
||||
else if (y-tryy < -radius)
|
||||
@@ -2409,28 +2411,34 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
{
|
||||
//All things are affected by their scale.
|
||||
fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
|
||||
INT32 special = 0;
|
||||
|
||||
if (thing->player)
|
||||
{
|
||||
const INT32 special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1);
|
||||
special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1);
|
||||
|
||||
// If using type Section1:13, double the maxstep.
|
||||
if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13)
|
||||
|| special == 13)
|
||||
if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13) || special == 13)
|
||||
{
|
||||
maxstep <<= 1;
|
||||
}
|
||||
// If using type Section1:12, no maxstep. For ledges you don't want the player to climb! (see: Egg Zeppelin & SMK port walls)
|
||||
else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12)
|
||||
|| special == 12)
|
||||
else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12) || special == 12)
|
||||
{
|
||||
maxstep = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (thing->type == MT_SKIM)
|
||||
{
|
||||
maxstep = 0;
|
||||
}
|
||||
|
||||
if (tmceilingz - tmfloorz < thing->height)
|
||||
{
|
||||
if (tmfloorthing)
|
||||
tmhitthing = tmfloorthing;
|
||||
|
||||
return false; // doesn't fit
|
||||
}
|
||||
|
||||
@@ -2463,11 +2471,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
return false; // mobj must lower itself to fit
|
||||
}
|
||||
}
|
||||
else if (maxstep > 0 && !(
|
||||
thing->player && (
|
||||
P_PlayerTouchingSectorSpecial(thing->player, 1, 14)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14)
|
||||
)) // Step down
|
||||
else if (maxstep > 0 && !(thing->player &&
|
||||
(P_PlayerTouchingSectorSpecial(thing->player, 1, 14) || special == 14))) // Step down
|
||||
{
|
||||
// If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS
|
||||
// step down! Formerly required a Section1:13 sector for the full MAXSTEPMOVE, but no more.
|
||||
@@ -2489,10 +2494,14 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
if (thing->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
if (tmdrpoffceilz - tmceilingz > maxstep)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (tmfloorz - tmdropoffz > maxstep)
|
||||
{
|
||||
return false; // don't stand over a dropoff
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (tryx != x || tryy != y);
|
||||
@@ -2568,6 +2577,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
|
||||
tryx = thing->x;
|
||||
tryy = thing->y;
|
||||
|
||||
do {
|
||||
if (x-tryx > MAXRADIUS)
|
||||
tryx += MAXRADIUS;
|
||||
@@ -2575,6 +2585,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
tryx -= MAXRADIUS;
|
||||
else
|
||||
tryx = x;
|
||||
|
||||
if (y-tryy > MAXRADIUS)
|
||||
tryy += MAXRADIUS;
|
||||
else if (y-tryy < -MAXRADIUS)
|
||||
@@ -2587,14 +2598,14 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
|
||||
if (!(thing->flags & MF_NOCLIP))
|
||||
{
|
||||
const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
|
||||
|
||||
if (tmceilingz - tmfloorz < thing->height)
|
||||
return false; // doesn't fit
|
||||
|
||||
if (tmceilingz - thing->z < thing->height)
|
||||
return false; // mobj must lower itself to fit
|
||||
|
||||
const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
|
||||
|
||||
if (tmfloorz - thing->z > maxstep)
|
||||
return false; // too big a step up
|
||||
}
|
||||
@@ -2928,6 +2939,7 @@ static boolean PTR_SlideTraverse(intercept_t *in)
|
||||
{
|
||||
if (P_PointOnLineSide(slidemo->x, slidemo->y, li))
|
||||
return true; // don't hit the back side
|
||||
|
||||
goto isblocking;
|
||||
}
|
||||
|
||||
@@ -3346,10 +3358,12 @@ void P_BouncePlayerMove(mobj_t *mo)
|
||||
|
||||
{
|
||||
mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP);
|
||||
|
||||
if (mo->eflags & MFE_VERTICALFLIP)
|
||||
fx->eflags |= MFE_VERTICALFLIP;
|
||||
else
|
||||
fx->eflags &= ~MFE_VERTICALFLIP;
|
||||
|
||||
fx->scale = mo->scale;
|
||||
|
||||
S_StartSound(mo, sfx_s3k49);
|
||||
@@ -3363,7 +3377,8 @@ void P_BouncePlayerMove(mobj_t *mo)
|
||||
mo->player->cmomx = tmxmove;
|
||||
mo->player->cmomy = tmymove;
|
||||
|
||||
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true)) {
|
||||
if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true))
|
||||
{
|
||||
P_TryMove(mo, mo->x - oldmomx, mo->y - oldmomy, true);
|
||||
}
|
||||
}
|
||||
@@ -3740,6 +3755,7 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
|
||||
{
|
||||
size_t i;
|
||||
sector_t *sec;
|
||||
|
||||
for (i = 0; i < sector->numattached; i++)
|
||||
{
|
||||
sec = §ors[sector->attached[i]];
|
||||
@@ -3946,6 +3962,7 @@ static msecnode_t *P_DelSecnode(msecnode_t *node)
|
||||
|
||||
tp = node->m_sectorlist_prev;
|
||||
tn = node->m_sectorlist_next;
|
||||
|
||||
if (tp)
|
||||
tp->m_sectorlist_next = tn;
|
||||
if (tn)
|
||||
@@ -3956,6 +3973,7 @@ static msecnode_t *P_DelSecnode(msecnode_t *node)
|
||||
|
||||
sp = node->m_thinglist_prev;
|
||||
sn = node->m_thinglist_next;
|
||||
|
||||
if (sp)
|
||||
sp->m_thinglist_next = sn;
|
||||
else
|
||||
@@ -4003,7 +4021,7 @@ static inline boolean PIT_GetSectors(line_t *ld)
|
||||
// allowed to move to this position, then the sector_list
|
||||
// will be attached to the Thing's mobj_t at touching_sectorlist.
|
||||
|
||||
sector_list = P_AddSecnode(ld->frontsector,tmthing,sector_list);
|
||||
sector_list = P_AddSecnode(ld->frontsector, tmthing, sector_list);
|
||||
|
||||
// Don't assume all lines are 2-sided, since some Things
|
||||
// like MT_TFOG are allowed regardless of whether their radius takes
|
||||
|
||||
+1
-2
@@ -2091,8 +2091,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
// Change the music and apply position/fade operations
|
||||
else
|
||||
{
|
||||
strncpy(mapmusic.name, sides[line->sidenum[0]].text, 7);
|
||||
mapmusic.name[6] = 0;
|
||||
strlcpy(mapmusic.name, sides[line->sidenum[0]].text, sizeof(mapmusic.name));
|
||||
|
||||
mapmusic.flags = tracknum & MUSIC_TRACKMASK;
|
||||
if (!(line->flags & ML_BLOCKMONSTERS))
|
||||
|
||||
+8
-2
@@ -3315,7 +3315,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
|
||||
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
||||
}
|
||||
|
||||
lang += (cmd->angleturn<<16);
|
||||
lang += (cmd->angleturn << 16);
|
||||
|
||||
cam->localangle = lang;
|
||||
if (!cam->reset_aiming)
|
||||
@@ -3821,7 +3821,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
|
||||
if (demo.playback)
|
||||
{
|
||||
focusangle = mo->angle;
|
||||
// Hack-adjacent.
|
||||
// Sometimes stale ticcmds send a weird angle at the start of the race.
|
||||
// P_UpdatePlayerAngle knows to ignore cmd angle when you literally can't turn, so we do the same here.
|
||||
if (leveltime > starttime)
|
||||
focusangle = player->cmd.angleturn << 16;
|
||||
else
|
||||
focusangle = mo->angle; // Just use something known sane.
|
||||
focusaiming = 0;
|
||||
}
|
||||
else if (P_IsLocalPlayer(player))
|
||||
|
||||
@@ -1391,6 +1391,7 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap)
|
||||
|
||||
// Load in the light tables, now 64k aligned for smokie...
|
||||
lump = W_GetNumForName(colormap);
|
||||
|
||||
if (lump == LUMPERROR)
|
||||
lump = basecolormaplump;
|
||||
else
|
||||
|
||||
@@ -260,7 +260,7 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
||||
// texture has no height, so just go
|
||||
while (--count >= 0)
|
||||
{
|
||||
*dest = R_DrawColumnPixel<Type>(dc, dest, frac>>FRACBITS, source, colormap);
|
||||
*dest = R_DrawColumnPixel<Type>(dc, dest, (frac>>FRACBITS), source, colormap);
|
||||
|
||||
dest += stride;
|
||||
frac += fracstep;
|
||||
|
||||
+24
-18
@@ -208,15 +208,15 @@ static void R_CalcTiltedLighting(std::vector<INT32>& lightbuffer, INT32 x1, INT3
|
||||
|
||||
for (i = x1; i <= x2; i++)
|
||||
{
|
||||
fixed_t light = start >> FRACBITS;
|
||||
const fixed_t light = start >> FRACBITS;
|
||||
lightbuffer[i] = CLAMP(light, 0, MAXLIGHTSCALE - 1);
|
||||
start += step;
|
||||
}
|
||||
}
|
||||
|
||||
static void R_GetTiltedLighting(std::vector<INT32>& tiltlighting, const drawspandata_t* ds, const float iz, const int width, const INT32 stride)
|
||||
static void R_GetTiltedLighting(std::vector<INT32>& tiltlighting, const drawspandata_t* ds, const float iz, const INT32 width, const INT32 stride)
|
||||
{
|
||||
float planelightfloat = PLANELIGHTFLOAT;
|
||||
const float planelightfloat = PLANELIGHTFLOAT;
|
||||
const fixed_t lightstart = FloatToFixed(iz * planelightfloat);
|
||||
const fixed_t lightend = FloatToFixed((iz + ds->szp.x * width) * planelightfloat);
|
||||
|
||||
@@ -232,7 +232,7 @@ static void R_GetTiltedLighting(std::vector<INT32>& tiltlighting, const drawspan
|
||||
template<DrawSpanType Type>
|
||||
static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
{
|
||||
int width = ds->x2 - ds->x1;
|
||||
INT32 width = ds->x2 - ds->x1;
|
||||
float iz, uz, vz;
|
||||
UINT32 u, v;
|
||||
int i;
|
||||
@@ -246,7 +246,6 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
UINT32 stepu, stepv;
|
||||
UINT32 bit;
|
||||
|
||||
INT32 x1 = ds->x1;
|
||||
const INT32 nflatxshift = ds->nflatxshift;
|
||||
const INT32 nflatyshift = ds->nflatyshift;
|
||||
const INT32 nflatmask = ds->nflatmask;
|
||||
@@ -263,6 +262,11 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
const UINT8 * restrict source = ds->source;
|
||||
const UINT8 * restrict colormap = ds->colormap;
|
||||
|
||||
const ptrdiff_t colormap_diff = (colormap - colormaps);
|
||||
|
||||
const INT32 * restrict tiltlight = tiltlighting.data();
|
||||
lighttable_t * const * restrict planezlight = ds->planezlight;
|
||||
|
||||
if constexpr (Type & DS_RIPPLE)
|
||||
{
|
||||
dsrc = vid.screens[1] + (ds->y + ds->bgofs) * stride + ds->x1;
|
||||
@@ -300,7 +304,6 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
izstep = ds->szp.x * SPANSIZE;
|
||||
uzstep = ds->sup.x * SPANSIZE;
|
||||
vzstep = ds->svp.x * SPANSIZE;
|
||||
//x1 = 0;
|
||||
width++;
|
||||
|
||||
while (width >= SPANSIZE)
|
||||
@@ -317,12 +320,12 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
|
||||
x1 = ds->x1;
|
||||
const INT32 x1 = ds->x1;
|
||||
|
||||
for (i = 0; i < SPANSIZE; i++)
|
||||
{
|
||||
bit = (((v + stepv * i) >> nflatyshift) & nflatmask) | ((u + stepu * i) >> nflatxshift);
|
||||
colormap = ds->planezlight[tiltlighting[x1 + i]] + (ds->colormap - colormaps);
|
||||
colormap = planezlight[tiltlight[x1 + i]] + colormap_diff;
|
||||
if constexpr (Type & DS_RIPPLE)
|
||||
dest[i] = R_DrawSpanPixel<Type>(ds, &dsrc[i], colormap, bit, source);
|
||||
else
|
||||
@@ -345,7 +348,7 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
u = (INT64)(startu);
|
||||
v = (INT64)(startv);
|
||||
bit = ((v >> nflatyshift) & nflatmask) | (u >> nflatxshift);
|
||||
colormap = ds->planezlight[tiltlighting[ds->x1]] + (ds->colormap - colormaps);
|
||||
colormap = planezlight[tiltlight[ds->x1]] + colormap_diff;
|
||||
if constexpr (Type & DS_RIPPLE)
|
||||
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
||||
else
|
||||
@@ -371,7 +374,7 @@ static void R_DrawTiltedSpanTemplate(drawspandata_t* ds)
|
||||
for (; width != 0; width--)
|
||||
{
|
||||
bit = ((v >> ds->nflatyshift) & ds->nflatmask) | (u >> ds->nflatxshift);
|
||||
colormap = ds->planezlight[tiltlighting[ds->x1]] + (ds->colormap - colormaps);
|
||||
colormap = planezlight[tiltlight[ds->x1]] + colormap_diff;
|
||||
if constexpr (Type & DS_RIPPLE)
|
||||
*dest = R_DrawSpanPixel<Type>(ds, dsrc, colormap, bit, source);
|
||||
else
|
||||
@@ -410,7 +413,7 @@ DEFINE_SPAN_COMBO(R_DrawTranslucentWaterSpan, DS_TRANSMAP|DS_RIPPLE)
|
||||
*/
|
||||
void R_DrawFogSpan(drawspandata_t* ds)
|
||||
{
|
||||
INT32 count = ds->x2 - ds->x1 + 1;
|
||||
intptr_t count = ds->x2 - ds->x1 + 1;
|
||||
|
||||
const UINT8 * restrict colormap = ds->colormap;
|
||||
UINT8 * restrict dest = R_Address(ds->x1, ds->y);
|
||||
@@ -435,20 +438,23 @@ void R_DrawFogSpan(drawspandata_t* ds)
|
||||
|
||||
void R_DrawFogSpan_Tilted(drawspandata_t* ds)
|
||||
{
|
||||
int width = ds->x2 - ds->x1;
|
||||
float iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
|
||||
UINT8 * restrict dest;
|
||||
local_for_thread std::vector<INT32> tiltlighting;
|
||||
|
||||
dest = R_Address(ds->x1, ds->y);
|
||||
INT32 width = ds->x2 - ds->x1;
|
||||
const INT32 stride = vid.width;
|
||||
const float iz = ds->szp.z + ds->szp.y*(centery-ds->y) + ds->szp.x*(ds->x1-centerx);
|
||||
UINT8 * restrict dest = R_Address(ds->x1, ds->y);
|
||||
const ptrdiff_t colormap_diff = (ds->colormap - colormaps);
|
||||
|
||||
local_for_thread std::vector<INT32> tiltlighting;
|
||||
|
||||
// Lighting is simple. It's just linear interpolation from start to end
|
||||
R_GetTiltedLighting(tiltlighting, ds, iz, width, stride);
|
||||
|
||||
const INT32 * restrict tiltlight = tiltlighting.data();
|
||||
lighttable_t * const * restrict planezlight = ds->planezlight;
|
||||
|
||||
do
|
||||
{
|
||||
UINT8 *colormap = ds->planezlight[tiltlighting[ds->x1++]] + (ds->colormap - colormaps);
|
||||
UINT8 *colormap = planezlight[tiltlight[ds->x1++]] + colormap_diff;
|
||||
*dest = colormap[*dest];
|
||||
dest++;
|
||||
}
|
||||
|
||||
+4
-1
@@ -253,6 +253,7 @@ void SplitScreen_OnChange(void)
|
||||
if (playeringame[i] && i != consoleplayer)
|
||||
{
|
||||
UINT8 j;
|
||||
|
||||
for (j = 1; j < MAXSPLITSCREENPLAYERS; j++)
|
||||
{
|
||||
if (displayplayers[j] == consoleplayer)
|
||||
@@ -268,6 +269,7 @@ void SplitScreen_OnChange(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Fov_OnChange(void)
|
||||
{
|
||||
R_SetViewSize();
|
||||
@@ -943,9 +945,10 @@ void R_ExecuteSetViewSize(void)
|
||||
memset(scalelight, 0xFF, sizeof(scalelight));
|
||||
|
||||
// Calculate the light levels to use for each level/scale combination.
|
||||
for (i = 0; i< LIGHTLEVELS; i++)
|
||||
for (i = 0; i < LIGHTLEVELS; i++)
|
||||
{
|
||||
startmapl = ((LIGHTLEVELS - 1 - i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
|
||||
|
||||
for (j = 0; j < MAXLIGHTSCALE; j++)
|
||||
{
|
||||
level = startmapl - j*vid.width/(viewwidth)/DISTMAP;
|
||||
|
||||
@@ -545,7 +545,7 @@ static inline void I_ShutdownConsole(void){}
|
||||
|
||||
|
||||
//
|
||||
//I_OutputMsg
|
||||
// I_OutputMsg
|
||||
//
|
||||
void I_OutputMsg(const char *fmt, ...)
|
||||
{
|
||||
@@ -553,6 +553,9 @@ void I_OutputMsg(const char *fmt, ...)
|
||||
char *txt;
|
||||
va_list argptr;
|
||||
|
||||
if (!fmt)
|
||||
return;
|
||||
|
||||
va_start(argptr,fmt);
|
||||
len = vsnprintf(NULL, 0, fmt, argptr);
|
||||
va_end(argptr);
|
||||
@@ -560,6 +563,10 @@ void I_OutputMsg(const char *fmt, ...)
|
||||
return;
|
||||
|
||||
txt = static_cast<char*>(malloc(len+1));
|
||||
|
||||
if (!txt)
|
||||
I_Error("I_OutputMsg: Out of memory!\n");
|
||||
|
||||
va_start(argptr,fmt);
|
||||
vsprintf(txt, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
+18
-7
@@ -156,9 +156,9 @@ static SDL_bool usesdl2soft = SDL_FALSE;
|
||||
static SDL_bool borderlesswindow = SDL_FALSE;
|
||||
|
||||
// SDL2 vars
|
||||
SDL_Window *window;
|
||||
SDL_Renderer *renderer;
|
||||
static SDL_Texture *texture;
|
||||
SDL_Window *window = NULL;
|
||||
SDL_Renderer *renderer = NULL;
|
||||
static SDL_Texture *texture = NULL;
|
||||
static SDL_bool havefocus = SDL_TRUE;
|
||||
static const char *fallback_resolution_name = "Fallback";
|
||||
|
||||
@@ -412,6 +412,10 @@ static INT32 GetTypedChar(SDL_Keysym keysym)
|
||||
break;
|
||||
}
|
||||
|
||||
// Special case for console key
|
||||
if (scancode == SDL_SCANCODE_GRAVE)
|
||||
return '`';
|
||||
|
||||
if (SDL_PeepEvents(&next_event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1 && next_event.type == SDL_TEXTINPUT)
|
||||
{
|
||||
if (next_event.text.text[1] == '\0') // limit to ASCII
|
||||
@@ -905,6 +909,7 @@ static void Impl_HandleControllerAddedEvent(SDL_Event evt)
|
||||
cv_usejoystick[i].value = 0;
|
||||
else if (atoi(cv_usejoystick[i].string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick[i].value) // update the cvar ONLY if a device exists
|
||||
|
||||
CV_SetValue(&cv_usejoystick[i], cv_usejoystick[i].value);
|
||||
}
|
||||
|
||||
@@ -1107,9 +1112,11 @@ void I_OsPolling(void)
|
||||
I_GetEvent();
|
||||
|
||||
mod = SDL_GetModState();
|
||||
|
||||
/* Handle here so that our state is always synched with the system. */
|
||||
shiftdown = ctrldown = altdown = 0;
|
||||
capslock = false;
|
||||
|
||||
if (mod & KMOD_LSHIFT) shiftdown |= 1;
|
||||
if (mod & KMOD_RSHIFT) shiftdown |= 2;
|
||||
if (mod & KMOD_LCTRL) ctrldown |= 1;
|
||||
@@ -1143,7 +1150,7 @@ static void VID_Command_Mode_f (void)
|
||||
{
|
||||
INT32 modenum;
|
||||
|
||||
if (COM_Argc()!= 2)
|
||||
if (COM_Argc() != 2)
|
||||
{
|
||||
CONS_Printf("vid_mode <modenum> : set video mode, current video mode %i\n", vid.modenum);
|
||||
return;
|
||||
@@ -1288,8 +1295,8 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
|
||||
#endif
|
||||
OglSdlSurface(vid.width, vid.height);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
SDL_RenderClear(renderer);
|
||||
@@ -1354,7 +1361,8 @@ void I_FinishUpdate(void)
|
||||
|
||||
const boolean isserverplayer = consoleplayer == serverplayer;
|
||||
|
||||
if (cv_showping.value && ((netgame && !isserverplayer) || (simulated_lag != 0 && isserverplayer && Playing())))
|
||||
if (cv_showping.value && ((netgame && !isserverplayer) ||
|
||||
(simulated_lag != 0 && isserverplayer && Playing())))
|
||||
SCR_DisplayLocalPing();
|
||||
}
|
||||
|
||||
@@ -1621,11 +1629,13 @@ static SDL_bool Impl_CreateContext(void)
|
||||
|
||||
if (!renderer)
|
||||
renderer = SDL_CreateRenderer(window, -1, flags);
|
||||
|
||||
if (renderer == NULL)
|
||||
{
|
||||
CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT);
|
||||
}
|
||||
|
||||
@@ -1728,6 +1738,7 @@ void I_StartupGraphics(void)
|
||||
#endif
|
||||
{
|
||||
const char *vd = SDL_GetCurrentVideoDriver();
|
||||
|
||||
//CONS_Printf(M_GetText("Starting up with video driver: %s\n"), vd);
|
||||
if (vd && (strncasecmp(vd, "fbcon", 6) == 0))
|
||||
framebuffer = SDL_TRUE;
|
||||
@@ -1958,7 +1969,7 @@ static void Impl_SetVsync(void)
|
||||
#endif
|
||||
#ifdef HWRENDER
|
||||
if (!renderer && rendermode == render_opengl &&
|
||||
sdlglcontext != NULL && SDL_GL_GetCurrentContext() == sdlglcontext)
|
||||
sdlglcontext != NULL && SDL_GL_GetCurrentContext() == sdlglcontext)
|
||||
{
|
||||
SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);
|
||||
}
|
||||
|
||||
+234
-122
@@ -123,13 +123,12 @@ static int result;
|
||||
static void var_cleanup(void)
|
||||
{
|
||||
song_length = loop_point = 0.0f;
|
||||
music_bytes = fading_source = fading_target =\
|
||||
fading_timer = fading_duration = 0;
|
||||
music_bytes = fading_source = fading_target =
|
||||
fading_timer = fading_duration = 0;
|
||||
music_end_bytes = 0;
|
||||
music_stutter_bytes = 0;
|
||||
|
||||
songpaused = is_looping =\
|
||||
is_fading = false;
|
||||
songpaused = is_looping = is_fading = false;
|
||||
|
||||
fading_callback = NULL;
|
||||
fading_do_callback = false;
|
||||
@@ -229,6 +228,7 @@ void I_ShutdownSound(void)
|
||||
{
|
||||
if (!sound_started)
|
||||
return; // not an error condition
|
||||
|
||||
sound_started = false;
|
||||
|
||||
Mix_CloseAudio();
|
||||
@@ -254,6 +254,7 @@ void I_UpdateSound(void)
|
||||
{
|
||||
if (fading_callback)
|
||||
(*fading_callback)();
|
||||
|
||||
fading_callback = NULL;
|
||||
fading_do_callback = false;
|
||||
}
|
||||
@@ -280,6 +281,7 @@ static Mix_Chunk *ds2chunk(void *stream)
|
||||
ver = READUINT16(stream); // sound version format?
|
||||
if (ver != 3) // It should be 3 if it's a doomsound...
|
||||
return NULL; // onos! it's not a doomsound!
|
||||
|
||||
freq = READUINT16(stream);
|
||||
samples = READUINT32(stream);
|
||||
|
||||
@@ -287,91 +289,100 @@ static Mix_Chunk *ds2chunk(void *stream)
|
||||
return NULL; // division by zero
|
||||
|
||||
// convert from signed 8bit ???hz to signed 16bit 44100hz.
|
||||
switch(freq)
|
||||
switch (freq)
|
||||
{
|
||||
case 44100:
|
||||
if (samples >= UINT32_MAX>>2)
|
||||
return NULL; // would wrap, can't store.
|
||||
newsamples = samples;
|
||||
break;
|
||||
case 22050:
|
||||
if (samples >= UINT32_MAX>>3)
|
||||
return NULL; // would wrap, can't store.
|
||||
newsamples = samples<<1;
|
||||
break;
|
||||
case 11025:
|
||||
if (samples >= UINT32_MAX>>4)
|
||||
return NULL; // would wrap, can't store.
|
||||
newsamples = samples<<2;
|
||||
break;
|
||||
default:
|
||||
frac = (44100 << FRACBITS) / (UINT32)freq;
|
||||
if (!(frac & 0xFFFF)) // other solid multiples (change if FRACBITS != 16)
|
||||
newsamples = samples * (frac >> FRACBITS);
|
||||
else // strange and unusual fractional frequency steps, plus anything higher than 44100hz.
|
||||
newsamples = FixedMul(FixedDiv(samples, freq), 44100) + 1; // add 1 to counter truncation.
|
||||
if (newsamples >= UINT32_MAX>>2)
|
||||
return NULL; // would and/or did wrap, can't store.
|
||||
break;
|
||||
case 44100:
|
||||
if (samples >= UINT32_MAX>>2)
|
||||
return NULL; // would wrap, can't store.
|
||||
|
||||
newsamples = samples;
|
||||
break;
|
||||
case 22050:
|
||||
if (samples >= UINT32_MAX>>3)
|
||||
return NULL; // would wrap, can't store.
|
||||
|
||||
newsamples = samples<<1;
|
||||
break;
|
||||
case 11025:
|
||||
if (samples >= UINT32_MAX>>4)
|
||||
return NULL; // would wrap, can't store.
|
||||
|
||||
newsamples = samples<<2;
|
||||
break;
|
||||
default:
|
||||
frac = (44100 << FRACBITS) / (UINT32)freq;
|
||||
|
||||
if (!(frac & 0xFFFF)) // other solid multiples (change if FRACBITS != 16)
|
||||
newsamples = samples * (frac >> FRACBITS);
|
||||
else // strange and unusual fractional frequency steps, plus anything higher than 44100hz.
|
||||
newsamples = FixedMul(FixedDiv(samples, freq), 44100) + 1; // add 1 to counter truncation.
|
||||
|
||||
if (newsamples >= UINT32_MAX>>2)
|
||||
return NULL; // would and/or did wrap, can't store.
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
sound = Z_Malloc(newsamples<<2, PU_SOUND, NULL); // samples * frequency shift * bytes per sample * channels
|
||||
|
||||
s = (SINT8 *)stream;
|
||||
d = (INT16 *)sound;
|
||||
|
||||
i = 0;
|
||||
|
||||
switch(freq)
|
||||
{
|
||||
case 44100: // already at the same rate? well that makes it simple.
|
||||
while(i++ < samples)
|
||||
{
|
||||
o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
}
|
||||
break;
|
||||
case 22050: // unwrap 2x
|
||||
while(i++ < samples)
|
||||
{
|
||||
o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
}
|
||||
break;
|
||||
case 11025: // unwrap 4x
|
||||
while(i++ < samples)
|
||||
{
|
||||
o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
}
|
||||
break;
|
||||
default: // convert arbitrary hz to 44100.
|
||||
step = 0;
|
||||
frac = ((UINT32)freq << FRACBITS) / 44100 + 1; //Add 1 to counter truncation.
|
||||
while (i < samples)
|
||||
{
|
||||
o = (INT16)(*s+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
while (step < FRACUNIT) // this is as fast as I can make it.
|
||||
case 44100: // already at the same rate? well that makes it simple.
|
||||
while(i++ < samples)
|
||||
{
|
||||
o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
step += frac;
|
||||
}
|
||||
do {
|
||||
i++; s++;
|
||||
step -= FRACUNIT;
|
||||
} while (step >= FRACUNIT);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 22050: // unwrap 2x
|
||||
while(i++ < samples)
|
||||
{
|
||||
o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
}
|
||||
break;
|
||||
case 11025: // unwrap 4x
|
||||
while(i++ < samples)
|
||||
{
|
||||
o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
}
|
||||
break;
|
||||
default: // convert arbitrary hz to 44100.
|
||||
step = 0;
|
||||
frac = ((UINT32)freq << FRACBITS) / 44100 + 1; //Add 1 to counter truncation.
|
||||
|
||||
while (i < samples)
|
||||
{
|
||||
o = (INT16)(*s+0x80)<<8; // changed signedness and shift up to 16 bits
|
||||
while (step < FRACUNIT) // this is as fast as I can make it.
|
||||
{
|
||||
*d++ = o; // left channel
|
||||
*d++ = o; // right channel
|
||||
step += frac;
|
||||
}
|
||||
do {
|
||||
i++; s++;
|
||||
step -= FRACUNIT;
|
||||
} while (step >= FRACUNIT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// return Mixer Chunk.
|
||||
@@ -390,12 +401,14 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
|
||||
if (sfx->lumpnum == LUMPERROR)
|
||||
sfx->lumpnum = S_GetSfxLumpNum(sfx);
|
||||
|
||||
sfx->length = W_LumpLength(sfx->lumpnum);
|
||||
|
||||
lump = W_CacheLumpNum(sfx->lumpnum, PU_SOUND);
|
||||
|
||||
// convert from standard DoomSound format.
|
||||
chunk = ds2chunk(lump);
|
||||
|
||||
if (chunk)
|
||||
{
|
||||
Z_Free(lump);
|
||||
@@ -415,6 +428,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
int zErr; // Somewhere to handle any error messages zlib tosses out
|
||||
|
||||
memset(&stream, 0x00, sizeof (z_stream)); // Init zlib stream
|
||||
|
||||
// Begin the inflation process
|
||||
inflatedLen = *(UINT32 *)lump + (sfx->length-4); // Last 4 bytes are the decompressed size, typically
|
||||
inflatedData = (UINT8 *)Z_Malloc(inflatedLen, PU_SOUND, NULL); // Make room for the decompressed data
|
||||
@@ -424,10 +438,13 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
stream.next_out = inflatedData;
|
||||
|
||||
zErr = inflateInit2(&stream, 32 + MAX_WBITS);
|
||||
|
||||
if (zErr == Z_OK) // We're good to go
|
||||
{
|
||||
zErr = inflate(&stream, Z_FINISH);
|
||||
if (zErr == Z_STREAM_END) {
|
||||
|
||||
if (zErr == Z_STREAM_END)
|
||||
{
|
||||
// Run GME on new data
|
||||
if (!gme_open_data(inflatedData, inflatedLen, &emu, SAMPLERATE))
|
||||
{
|
||||
@@ -444,6 +461,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
|
||||
len = (info->play_length * 441 / 10) << 2;
|
||||
mem = Z_Malloc(len, PU_SOUND, 0);
|
||||
|
||||
gme_play(emu, len >> 1, mem);
|
||||
gme_free_info(info);
|
||||
gme_delete(emu);
|
||||
@@ -453,10 +471,14 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
}
|
||||
else
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
|
||||
(void)inflateEnd(&stream);
|
||||
}
|
||||
else // Hold up, zlib's got a problem
|
||||
{
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
}
|
||||
|
||||
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
|
||||
#else
|
||||
return NULL; // No zlib support
|
||||
@@ -477,6 +499,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
|
||||
len = (info->play_length * 441 / 10) << 2;
|
||||
mem = Z_Malloc(len, PU_SOUND, 0);
|
||||
|
||||
gme_play(emu, len >> 1, mem);
|
||||
gme_free_info(info);
|
||||
gme_delete(emu);
|
||||
@@ -487,6 +510,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
|
||||
// Try to load it as a WAVE or OGG using Mixer.
|
||||
rw = SDL_RWFromMem(lump, sfx->length);
|
||||
|
||||
if (rw != NULL)
|
||||
{
|
||||
chunk = Mix_LoadWAV_RW(rw, 1);
|
||||
@@ -502,19 +526,23 @@ void I_FreeSfx(sfxinfo_t *sfx)
|
||||
{
|
||||
Mix_Chunk *chunk = (Mix_Chunk*)sfx->data;
|
||||
UINT8 *abufdata = NULL;
|
||||
|
||||
if (chunk->allocated == 0)
|
||||
{
|
||||
// We allocated the data in this chunk, so get the abuf from mixer, then let it free the chunk, THEN we free the data
|
||||
// I believe this should ensure the sound is not playing when we free it
|
||||
abufdata = chunk->abuf;
|
||||
}
|
||||
|
||||
Mix_FreeChunk(sfx->data);
|
||||
|
||||
if (abufdata)
|
||||
{
|
||||
// I'm going to assume we used Z_Malloc to allocate this data.
|
||||
Z_Free(abufdata);
|
||||
}
|
||||
}
|
||||
|
||||
sfx->data = NULL;
|
||||
sfx->lumpnum = LUMPERROR;
|
||||
}
|
||||
@@ -572,9 +600,12 @@ static UINT32 get_adjusted_position(UINT32 position)
|
||||
{
|
||||
// all in milliseconds
|
||||
UINT32 length = I_GetSongLength();
|
||||
UINT32 looppoint = I_GetSongLoopPoint();
|
||||
|
||||
if (length)
|
||||
{
|
||||
UINT32 looppoint = I_GetSongLoopPoint();
|
||||
return position >= length ? (position % (length-looppoint)) : position;
|
||||
}
|
||||
else
|
||||
return position;
|
||||
}
|
||||
@@ -589,8 +620,7 @@ static void do_fading_callback(void)
|
||||
/// Music Hooks
|
||||
/// ------------------------
|
||||
|
||||
static void
|
||||
Countstutter (int len)
|
||||
static void Countstutter(int len)
|
||||
{
|
||||
UINT32 bytes;
|
||||
|
||||
@@ -617,7 +647,7 @@ Countstutter (int len)
|
||||
else
|
||||
bytes = ( music_bytes - music_stutter_bytes );
|
||||
|
||||
I_SetSongPosition((int)( (float)bytes/4/44100.0f*1000 ));
|
||||
I_SetSongPosition((int)((float)bytes/4/44100.0f*1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -628,7 +658,9 @@ static void count_music_bytes(int chan, void *stream, int len, void *udata)
|
||||
(void)stream;
|
||||
(void)udata;
|
||||
|
||||
if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD || I_SongType() == MU_MID)
|
||||
const musictype_t mustype = I_SongType();
|
||||
|
||||
if (!music || mustype == MU_GME || mustype == MU_MOD || mustype == MU_MID)
|
||||
return;
|
||||
|
||||
music_bytes += len;
|
||||
@@ -662,7 +694,9 @@ static UINT32 music_fade(UINT32 interval, void *param)
|
||||
return 0;
|
||||
}
|
||||
else if (songpaused) // don't decrement timer
|
||||
{
|
||||
return interval;
|
||||
}
|
||||
else if ((fading_timer -= 10) <= 0)
|
||||
{
|
||||
internal_volume = fading_target;
|
||||
@@ -675,11 +709,14 @@ static UINT32 music_fade(UINT32 interval, void *param)
|
||||
{
|
||||
UINT8 delta = abs(fading_target - fading_source);
|
||||
fixed_t factor = FixedDiv(fading_duration - fading_timer, fading_duration);
|
||||
|
||||
if (fading_target < fading_source)
|
||||
internal_volume = max(min(internal_volume, fading_source - FixedMul(delta, factor)), fading_target);
|
||||
else if (fading_target > fading_source)
|
||||
internal_volume = min(max(internal_volume, fading_source + FixedMul(delta, factor)), fading_target);
|
||||
|
||||
Mix_VolumeMusic(get_real_volume(music_volume));
|
||||
|
||||
return interval;
|
||||
}
|
||||
}
|
||||
@@ -763,14 +800,22 @@ musictype_t I_SongType(void)
|
||||
#endif
|
||||
if (!music)
|
||||
return MU_NONE;
|
||||
else if (Mix_GetMusicType(music) == MUS_MID)
|
||||
return MU_MID;
|
||||
else if (Mix_GetMusicType(music) == MUS_MOD || Mix_GetMusicType(music) == MUS_MODPLUG)
|
||||
return MU_MOD;
|
||||
else if (Mix_GetMusicType(music) == MUS_MP3 || Mix_GetMusicType(music) == MUS_MP3_MAD)
|
||||
return MU_MP3;
|
||||
else
|
||||
return (musictype_t)Mix_GetMusicType(music);
|
||||
|
||||
const Mix_MusicType mustype = Mix_GetMusicType(music);
|
||||
|
||||
switch (mustype)
|
||||
{
|
||||
case MUS_MID:
|
||||
return MU_MID;
|
||||
case MUS_MOD:
|
||||
case MUS_MODPLUG:
|
||||
return MU_MOD;
|
||||
case MUS_MP3:
|
||||
case MUS_MP3_MAD:
|
||||
return MU_MP3;
|
||||
default:
|
||||
return (musictype_t)mustype;
|
||||
}
|
||||
}
|
||||
|
||||
boolean I_SongPlaying(void)
|
||||
@@ -799,6 +844,7 @@ boolean I_SetSongSpeed(float speed)
|
||||
{
|
||||
if (speed > 250.0f)
|
||||
speed = 250.0f; //limit speed up to 250x
|
||||
|
||||
#ifdef HAVE_LIBGME
|
||||
if (gme)
|
||||
{
|
||||
@@ -857,51 +903,63 @@ UINT32 I_GetSongLength(void)
|
||||
// reconstruct info->play_length, from GME source
|
||||
// we only want intro + 1 loop, not 2
|
||||
length = info->length;
|
||||
|
||||
if (length <= 0)
|
||||
{
|
||||
length = info->intro_length + info->loop_length; // intro + 1 loop
|
||||
|
||||
if (length <= 0)
|
||||
length = 150 * 1000; // 2.5 minutes
|
||||
}
|
||||
}
|
||||
|
||||
gme_free_info(info);
|
||||
|
||||
return max(length, 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef HAVE_OPENMPT
|
||||
if (openmpt_mhandle)
|
||||
{
|
||||
return (UINT32)(openmpt_module_get_duration_seconds(openmpt_mhandle) * 1000.);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (!music || I_SongType() == MU_MOD || I_SongType() == MU_MID)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// VERY IMPORTANT to set your LENGTHMS= in your song files, folks!
|
||||
// SDL mixer can't read music length itself.
|
||||
length = (UINT32)(song_length*1000);
|
||||
|
||||
if (!length)
|
||||
CONS_Debug(DBG_DETAILED, "Getting music length: music is missing LENGTHMS= tag. Needed for seeking.\n");
|
||||
|
||||
return length;
|
||||
}
|
||||
}
|
||||
|
||||
boolean I_SetSongLoopPoint(UINT32 looppoint)
|
||||
{
|
||||
if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD || I_SongType() == MU_MID || !is_looping)
|
||||
if (!music|| !is_looping)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
UINT32 length = I_GetSongLength();
|
||||
|
||||
if (length > 0)
|
||||
looppoint %= length;
|
||||
const musictype_t mustype = I_SongType();
|
||||
|
||||
loop_point = max((float)(looppoint / 1000.0L), 0);
|
||||
return true;
|
||||
}
|
||||
if (mustype == MU_GME || mustype == MU_MOD || mustype == MU_MID)
|
||||
return false;
|
||||
|
||||
UINT32 length = I_GetSongLength();
|
||||
|
||||
if (length > 0)
|
||||
looppoint %= length;
|
||||
|
||||
loop_point = max((float)(looppoint / 1000.0L), 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
UINT32 I_GetSongLoopPoint(void)
|
||||
@@ -927,14 +985,19 @@ UINT32 I_GetSongLoopPoint(void)
|
||||
else
|
||||
#endif
|
||||
if (!music || I_SongType() == MU_MOD || I_SongType() == MU_MID)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (UINT32)(loop_point * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
boolean I_SetSongPosition(UINT32 position)
|
||||
{
|
||||
UINT32 length;
|
||||
|
||||
#ifdef HAVE_LIBGME
|
||||
if (gme)
|
||||
{
|
||||
@@ -971,9 +1034,13 @@ boolean I_SetSongPosition(UINT32 position)
|
||||
else
|
||||
#endif
|
||||
if (!music || I_SongType() == MU_MID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (I_SongType() == MU_MOD)
|
||||
{
|
||||
return Mix_SetMusicPosition(position); // Goes by channels
|
||||
}
|
||||
else
|
||||
{
|
||||
// Because SDL mixer can't identify song length, if you have
|
||||
@@ -981,11 +1048,13 @@ boolean I_SetSongPosition(UINT32 position)
|
||||
// music_bytes becomes inaccurate.
|
||||
|
||||
length = I_GetSongLength(); // get it in MS
|
||||
|
||||
if (length)
|
||||
position = get_adjusted_position(position);
|
||||
|
||||
Mix_RewindMusic(); // needed for mp3
|
||||
if(Mix_SetMusicPosition((float)(position/1000.0L)) == 0)
|
||||
|
||||
if (Mix_SetMusicPosition((float)(position/1000.0L)) == 0)
|
||||
music_bytes = (UINT32)(position/1000.0L*44100.0L*4); //assume 44.1khz, 4-byte length (see I_GetSongPosition)
|
||||
else
|
||||
// NOTE: This block fires on incorrect song format,
|
||||
@@ -1025,6 +1094,7 @@ UINT32 I_GetSongPosition(void)
|
||||
}
|
||||
|
||||
gme_free_info(info);
|
||||
|
||||
return max(position, 0);
|
||||
}
|
||||
else
|
||||
@@ -1038,12 +1108,16 @@ UINT32 I_GetSongPosition(void)
|
||||
else
|
||||
#endif
|
||||
if (!music || I_SongType() == MU_MID)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (UINT32)(music_bytes/44100.0L*1000.0L/4); //assume 44.1khz
|
||||
// 4 = byte length for 16-bit samples (AUDIO_S16SYS), stereo (2-channel)
|
||||
// This is hardcoded in I_StartupSound. Other formats for factor:
|
||||
// 8M: 1 | 8S: 2 | 16M: 2 | 16S: 4
|
||||
}
|
||||
}
|
||||
|
||||
void I_UpdateSongLagThreshold(void)
|
||||
@@ -1057,12 +1131,16 @@ void I_UpdateSongLagThreshold(void)
|
||||
|
||||
boolean I_LoadSong(char *data, size_t len)
|
||||
{
|
||||
const char *key1 = "LOOP";
|
||||
const char *key2 = "POINT=";
|
||||
const char *key3 = "MS=";
|
||||
const size_t key1len = strlen(key1);
|
||||
const size_t key2len = strlen(key2);
|
||||
const size_t key3len = strlen(key3);
|
||||
static const char *key1 = "LOOP";
|
||||
static const char *key2 = "POINT=";
|
||||
static const char *key3 = "MS=";
|
||||
static const size_t key1len = sizeof("LOOP")-1;
|
||||
static const size_t key2len = sizeof("POINT=")-1;
|
||||
static const size_t key3len = sizeof("MS=")-1;
|
||||
//const size_t key1len = strlen(key1);
|
||||
//const size_t key2len = strlen(key2);
|
||||
//const size_t key3len = strlen(key3);
|
||||
|
||||
char *p = data;
|
||||
SDL_RWops *rw;
|
||||
|
||||
@@ -1099,6 +1177,7 @@ boolean I_LoadSong(char *data, size_t len)
|
||||
stream.next_out = inflatedData;
|
||||
|
||||
zErr = inflateInit2(&stream, 32 + MAX_WBITS);
|
||||
|
||||
if (zErr == Z_OK) // We're good to go
|
||||
{
|
||||
zErr = inflate(&stream, Z_FINISH);
|
||||
@@ -1114,10 +1193,12 @@ boolean I_LoadSong(char *data, size_t len)
|
||||
}
|
||||
else
|
||||
CONS_Alert(CONS_ERROR, "Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
|
||||
(void)inflateEnd(&stream);
|
||||
}
|
||||
else // Hold up, zlib's got a problem
|
||||
CONS_Alert(CONS_ERROR, "Encountered %s when running inflateInit: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
|
||||
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
|
||||
return false;
|
||||
#else
|
||||
@@ -1146,6 +1227,7 @@ boolean I_LoadSong(char *data, size_t len)
|
||||
if (result == OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS) // We only cared if it succeeded, continue on if not.
|
||||
{
|
||||
openmpt_mhandle = openmpt_module_create_from_memory2(data, len, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (!openmpt_mhandle) // Failed to create module handle? Show error and return!
|
||||
{
|
||||
mod_err = openmpt_module_error_get_last(openmpt_mhandle);
|
||||
@@ -1160,10 +1242,12 @@ boolean I_LoadSong(char *data, size_t len)
|
||||
|
||||
// Let's see if Mixer is able to load this.
|
||||
rw = SDL_RWFromMem(data, len);
|
||||
|
||||
if (rw != NULL)
|
||||
{
|
||||
music = Mix_LoadMUS_RW(rw, 1);
|
||||
}
|
||||
|
||||
if (!music)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
|
||||
@@ -1191,7 +1275,7 @@ boolean I_LoadSong(char *data, size_t len)
|
||||
else if (!strncmp(p, key3, key3len)) // is it LOOPMS=?
|
||||
{
|
||||
p += key3len; // skip MS=
|
||||
loop_point = (float)(atoi(p) / 1000.0L); // LOOPMS works by real time, as miliseconds.
|
||||
loop_point = (float)(atof(p) / 1000.0); // LOOPMS works by real time, as miliseconds.
|
||||
// Everything that uses LOOPMS will work perfectly with SDL_Mixer.
|
||||
}
|
||||
}
|
||||
@@ -1201,6 +1285,7 @@ boolean I_LoadSong(char *data, size_t len)
|
||||
else // continue searching
|
||||
p++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1243,6 +1328,7 @@ boolean I_PlaySong(boolean looping)
|
||||
gme_start_track(gme, 0);
|
||||
current_track = 0;
|
||||
Mix_HookMusic(mix_gme, gme);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -1282,15 +1368,17 @@ boolean I_PlaySong(boolean looping)
|
||||
if (!music)
|
||||
return false;
|
||||
|
||||
if (fpclassify(song_length) == FP_ZERO && (I_SongType() == MU_OGG || I_SongType() == MU_MP3 || I_SongType() == MU_FLAC))
|
||||
const musictype_t mustype = I_SongType();
|
||||
|
||||
if (fpclassify(song_length) == FP_ZERO && (mustype == MU_OGG || mustype == MU_MP3 || mustype == MU_FLAC))
|
||||
CONS_Debug(DBG_DETAILED, "This song is missing a LENGTHMS= tag! Required to make seeking work properly.\n");
|
||||
|
||||
if (I_SongType() != MU_MOD && I_SongType() != MU_MID && Mix_PlayMusic(music, 0) == -1)
|
||||
if (mustype != MU_MOD && mustype != MU_MID && Mix_PlayMusic(music, 0) == -1)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
|
||||
return false;
|
||||
}
|
||||
else if ((I_SongType() == MU_MOD || I_SongType() == MU_MID) && Mix_PlayMusic(music, looping ? -1 : 0) == -1) // if MOD, loop forever
|
||||
else if ((mustype == MU_MOD || mustype == MU_MID) && Mix_PlayMusic(music, looping ? -1 : 0) == -1) // if MOD, loop forever
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
|
||||
return false;
|
||||
@@ -1300,10 +1388,10 @@ boolean I_PlaySong(boolean looping)
|
||||
|
||||
I_SetMusicVolume(music_volume);
|
||||
|
||||
if (I_SongType() != MU_MOD && I_SongType() != MU_MID)
|
||||
if (mustype != MU_MOD && mustype != MU_MID)
|
||||
Mix_HookMusicFinished(music_loop); // don't bother counting if MOD
|
||||
|
||||
if(I_SongType() != MU_MOD && I_SongType() != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL))
|
||||
if (mustype != MU_MOD && mustype != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL))
|
||||
CONS_Alert(CONS_WARNING, "Error registering SDL music position counter: %s\n", Mix_GetError());
|
||||
|
||||
return true;
|
||||
@@ -1339,10 +1427,12 @@ void I_StopSong(void)
|
||||
|
||||
void I_PauseSong(void)
|
||||
{
|
||||
if(I_SongType() == MU_MID) // really, SDL Mixer? why can't you pause MIDI???
|
||||
const musictype_t mustype = I_SongType();
|
||||
|
||||
if (mustype == MU_MID) // really, SDL Mixer? why can't you pause MIDI???
|
||||
return;
|
||||
|
||||
if(I_SongType() != MU_GME && I_SongType() != MU_MOD && I_SongType() != MU_MID)
|
||||
if (mustype != MU_GME && mustype != MU_MOD && mustype != MU_MID)
|
||||
Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes);
|
||||
|
||||
Mix_PauseMusic();
|
||||
@@ -1351,15 +1441,17 @@ void I_PauseSong(void)
|
||||
|
||||
void I_ResumeSong(void)
|
||||
{
|
||||
if (I_SongType() == MU_MID)
|
||||
const musictype_t mustype = I_SongType();
|
||||
|
||||
if (mustype == MU_MID)
|
||||
return;
|
||||
|
||||
if (I_SongType() != MU_GME && I_SongType() != MU_MOD && I_SongType() != MU_MID)
|
||||
if (mustype != MU_GME && mustype != MU_MOD && mustype != MU_MID)
|
||||
{
|
||||
while(Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes) != 0) { }
|
||||
while (Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes) != 0) { }
|
||||
// HACK: fixes issue of multiple effect callbacks being registered
|
||||
|
||||
if(music && I_SongType() != MU_MOD && I_SongType() != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL))
|
||||
if (music && mustype != MU_MOD && mustype != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL))
|
||||
CONS_Alert(CONS_WARNING, "Error registering SDL music position counter: %s\n", Mix_GetError());
|
||||
}
|
||||
|
||||
@@ -1392,20 +1484,24 @@ boolean I_SetSongTrack(INT32 track)
|
||||
{
|
||||
if (current_track == track)
|
||||
return false;
|
||||
|
||||
SDL_LockAudio();
|
||||
if (track >= 0 && track < gme_track_count(gme)-1)
|
||||
{
|
||||
gme_err_t gme_e = gme_start_track(gme, track);
|
||||
|
||||
if (gme_e != NULL)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "GME error: %s\n", gme_e);
|
||||
return false;
|
||||
}
|
||||
|
||||
current_track = track;
|
||||
SDL_UnlockAudio();
|
||||
return true;
|
||||
}
|
||||
SDL_UnlockAudio();
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -1415,6 +1511,7 @@ boolean I_SetSongTrack(INT32 track)
|
||||
{
|
||||
if (current_subsong == track)
|
||||
return false;
|
||||
|
||||
SDL_LockAudio();
|
||||
if (track >= 0 && track < openmpt_module_get_num_subsongs(openmpt_mhandle))
|
||||
{
|
||||
@@ -1428,8 +1525,10 @@ boolean I_SetSongTrack(INT32 track)
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (I_SongType() == MU_MOD)
|
||||
return !Mix_SetMusicPosition(track);
|
||||
|
||||
(void)track;
|
||||
return false;
|
||||
}
|
||||
@@ -1441,8 +1540,10 @@ boolean I_SetSongTrack(INT32 track)
|
||||
void I_SetInternalMusicVolume(UINT8 volume)
|
||||
{
|
||||
internal_volume = volume;
|
||||
|
||||
if (!I_SongPlaying())
|
||||
return;
|
||||
|
||||
Mix_VolumeMusic(get_real_volume(music_volume));
|
||||
}
|
||||
|
||||
@@ -1450,6 +1551,7 @@ void I_StopFadingSong(void)
|
||||
{
|
||||
if (fading_id)
|
||||
SDL_RemoveTimer(fading_id);
|
||||
|
||||
is_fading = false;
|
||||
fading_source = fading_target = fading_timer = fading_duration = fading_id = 0;
|
||||
}
|
||||
@@ -1466,8 +1568,10 @@ boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms
|
||||
if (!ms && volume_delta)
|
||||
{
|
||||
I_SetInternalMusicVolume(target_volume);
|
||||
|
||||
if (callback)
|
||||
(*callback)();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
@@ -1475,20 +1579,28 @@ boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms
|
||||
{
|
||||
if (callback)
|
||||
(*callback)();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Round MS to nearest 10
|
||||
// If n - lower > higher - n, then round up
|
||||
ms = (ms - ((ms / 10) * 10) > (((ms / 10) * 10) + 10) - ms) ?
|
||||
(((ms / 10) * 10) + 10) // higher
|
||||
: ((ms / 10) * 10); // lower
|
||||
//ms = (ms - ((ms / 10) * 10) > (((ms / 10) * 10) + 10) - ms) ?
|
||||
// (((ms / 10) * 10) + 10) // higher
|
||||
// : ((ms / 10) * 10); // lower
|
||||
|
||||
const int lower = (ms / 10) * 10;
|
||||
const int upper = lower + 10;
|
||||
ms = (ms - lower > upper - ms) ? upper : lower;
|
||||
|
||||
if (!ms)
|
||||
{
|
||||
I_SetInternalMusicVolume(target_volume);
|
||||
}
|
||||
else if (source_volume != target_volume)
|
||||
{
|
||||
fading_id = SDL_AddTimer(10, music_fade, NULL);
|
||||
|
||||
if (fading_id)
|
||||
{
|
||||
is_fading = true;
|
||||
@@ -1519,7 +1631,7 @@ boolean I_FadeInPlaySong(UINT32 ms, boolean looping)
|
||||
{
|
||||
if (I_PlaySong(looping))
|
||||
return I_FadeSongFromVolume(100, 0, ms, NULL);
|
||||
else
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
+36
-23
@@ -641,8 +641,8 @@ void VID_BlitLinearScreen(const UINT8 *restrict srcptr, UINT8 *restrict destptr,
|
||||
}
|
||||
}
|
||||
|
||||
static UINT8 hudplusalpha[11] = { 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0};
|
||||
static UINT8 hudminusalpha[11] = { 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5};
|
||||
static const UINT8 hudplusalpha[11] = { 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0};
|
||||
static const UINT8 hudminusalpha[11] = { 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5};
|
||||
UINT8 hudtrans = 0;
|
||||
|
||||
static const UINT8 *v_colormap = NULL;
|
||||
@@ -1739,59 +1739,69 @@ void V_DrawHorizontallyScaledFullScreenPatch(patch_t *patch)
|
||||
|
||||
void V_DrawVhsEffect(boolean rewind)
|
||||
{
|
||||
static fixed_t upbary = 100*FRACUNIT, downbary = 150*FRACUNIT;
|
||||
static fixed_t upbary = 100, downbary = 150;
|
||||
|
||||
UINT8 barsize, updistort, downdistort;
|
||||
|
||||
UINT8 *buf = vid.screens[0], *tmp = vid.screens[4];
|
||||
UINT16 y;
|
||||
UINT32 x, pos = 0;
|
||||
UINT32 x, pos;
|
||||
|
||||
UINT8 *normalmapstart = ((UINT8 *)transtables + (8<<FF_TRANSSHIFT|(19<<8)));
|
||||
UINT8 *buf, *tmp;
|
||||
UINT8 *normalmapstart, *thismapstart;
|
||||
#ifdef HQ_VHS
|
||||
UINT8 *tmapstart = ((UINT8 *)transtables + (6<<FF_TRANSSHIFT));
|
||||
UINT8 *tmapstart;
|
||||
#endif
|
||||
UINT8 *thismapstart;
|
||||
SINT8 offs;
|
||||
|
||||
UINT8 barsize = vid.dup<<5;
|
||||
UINT8 updistort = vid.dup<<(rewind ? 5 : 3);
|
||||
UINT8 downdistort = updistort>>1;
|
||||
barsize = vid.dup << 5;
|
||||
updistort = vid.dup << (rewind ? 5 : 3);
|
||||
downdistort = updistort >> 1;
|
||||
|
||||
if (rewind)
|
||||
V_DrawVhsEffect(false); // experimentation
|
||||
|
||||
upbary -= renderdeltatics * (vid.dup * (rewind ? 3 : 1.8f));
|
||||
downbary += renderdeltatics * (vid.dup * (rewind ? 2 : 1));
|
||||
upbary -= FixedMul(vid.dup * (rewind ? 3 : 1.8f), renderdeltatics);
|
||||
downbary += FixedMul(vid.dup * (rewind ? 2 : 1), renderdeltatics);
|
||||
|
||||
if (upbary < -barsize*FRACUNIT)
|
||||
upbary = vid.height<<FRACBITS;
|
||||
if (downbary > vid.height<<FRACBITS)
|
||||
downbary = -barsize*FRACUNIT;
|
||||
if (upbary < -barsize)
|
||||
upbary = vid.height;
|
||||
|
||||
fixed_t uby = upbary>>FRACBITS, dby = downbary>>FRACBITS;
|
||||
if (downbary > vid.height)
|
||||
downbary = -barsize;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
HWR_RenderVhsEffect(uby, dby, updistort, downdistort, barsize);
|
||||
HWR_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
buf = vid.screens[0];
|
||||
tmp = vid.screens[4];
|
||||
|
||||
normalmapstart = ((UINT8 *)transtables + (8<<FF_TRANSSHIFT|(19<<8)));
|
||||
#ifdef HQ_VHS
|
||||
tmapstart = ((UINT8 *)transtables + (6<<FF_TRANSSHIFT));
|
||||
#endif
|
||||
|
||||
pos = 0;
|
||||
|
||||
for (y = 0; y < vid.height; y+=2)
|
||||
{
|
||||
thismapstart = normalmapstart;
|
||||
offs = 0;
|
||||
|
||||
if (y >= uby && y < uby+barsize)
|
||||
if (y >= upbary && y < upbary+barsize)
|
||||
{
|
||||
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
|
||||
offs += updistort * 2.0f * min(y-uby, uby+barsize-y) / barsize;
|
||||
offs += updistort * 2.0f * min(y-upbary, upbary+barsize-y) / barsize;
|
||||
}
|
||||
|
||||
if (y >= dby && y < dby+barsize)
|
||||
if (y >= downbary && y < downbary+barsize)
|
||||
{
|
||||
thismapstart -= (2<<FF_TRANSSHIFT) - (5<<8);
|
||||
offs -= downdistort * 2.0f * min(y-dby, dby+barsize-y) / barsize;
|
||||
offs -= downdistort * 2.0f * min(y-downbary, downbary+barsize-y) / barsize;
|
||||
}
|
||||
|
||||
offs += M_RandomKey(vid.dup<<1);
|
||||
@@ -1909,8 +1919,10 @@ UINT8 *V_GetStringColormap(INT32 colorflags)
|
||||
}
|
||||
#else // optimised
|
||||
colorflags = ((colorflags & V_CHARCOLORMASK) >> V_CHARCOLORSHIFT);
|
||||
|
||||
if (!colorflags || colorflags > 15) // INT32 is signed, but V_CHARCOLORMASK is a very restrictive mask.
|
||||
return NULL;
|
||||
|
||||
return (purplemap+((colorflags-1)<<8));
|
||||
#endif
|
||||
}
|
||||
@@ -2000,6 +2012,7 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
||||
for (i = 0; i < slen; ++i)
|
||||
{
|
||||
c = newstring[i];
|
||||
|
||||
if ((UINT8)c >= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09
|
||||
continue;
|
||||
|
||||
|
||||
+7
-1
@@ -259,9 +259,12 @@ static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum)
|
||||
size_t length = len + 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name
|
||||
char *name = malloc(length + 1);
|
||||
|
||||
if (!name)
|
||||
I_Error("W_LoadDehackedLumpsPK3: Out of memory!\n");
|
||||
|
||||
sprintf(name, "%s|%s", wadfiles[wadnum]->filename, lump_p->fullname);
|
||||
name[length] = '\0';
|
||||
CONS_Printf(M_GetText("Loading SOC from %s\n"), name);
|
||||
CONS_Printf("Loading SOC from %s\n", name);
|
||||
DEH_LoadDehackedLumpPwad(wadnum, posStart);
|
||||
free(name);
|
||||
}
|
||||
@@ -292,6 +295,9 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum)
|
||||
size_t length = len + 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name
|
||||
char *name = malloc(length + 1);
|
||||
|
||||
if (!name)
|
||||
I_Error("W_LoadDehackedLumps: Out of memory!\n");
|
||||
|
||||
sprintf(name, "%s|%s", wadfiles[wadnum]->filename, lump_p->fullname);
|
||||
name[length] = '\0';
|
||||
|
||||
|
||||
+2
-12
@@ -552,18 +552,8 @@ void Y_Ticker(void)
|
||||
|
||||
intertic++;
|
||||
|
||||
// multiplayer uses timer (based on cv_inttime)
|
||||
if (timer)
|
||||
{
|
||||
if (!--timer)
|
||||
{
|
||||
Y_EndIntermission();
|
||||
Y_FollowIntermission();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// single player is hardcoded to go away after awhile
|
||||
else if (intertic == endtic)
|
||||
if ((timer && !--timer)
|
||||
|| (intertic == endtic))
|
||||
{
|
||||
Y_EndIntermission();
|
||||
Y_FollowIntermission();
|
||||
|
||||
Reference in new issue
Block a user