Merge branch 'Saturn-Next' into Saturn-Testing
This commit is contained in:
commit
e5b4905a12
75 files changed
+2923
-3891
No files matched your search
@@ -229,6 +229,7 @@ endif
|
||||
|
||||
ifdef LINUX
|
||||
UNIXCOMMON=1
|
||||
NOOBJDUMP=1
|
||||
ifndef NOGME
|
||||
HAVE_LIBGME=1
|
||||
endif
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
|
||||
return;
|
||||
|
||||
// Lua can handle it!
|
||||
if (LUAh_BotAI(sonic, tails, cmd))
|
||||
if (LUA_HookBotAI(sonic, tails, cmd))
|
||||
return;
|
||||
|
||||
if (tails->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
|
||||
@@ -119,7 +119,7 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
|
||||
}
|
||||
|
||||
// Let Lua scripts build ticcmds
|
||||
if (LUAh_BotTiccmd(player, cmd))
|
||||
if (LUA_HookTiccmd(player, cmd, HOOK(BotTiccmd)))
|
||||
return;
|
||||
|
||||
// We don't have any main character AI, sorry. D:
|
||||
|
||||
+28
-23
@@ -1,7 +1,7 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2024 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -11,6 +11,9 @@
|
||||
/// \brief Macros to read/write from/to a UINT8 *,
|
||||
/// used for packet creation and such
|
||||
|
||||
#ifndef __BYTEPTR_H__
|
||||
#define __BYTEPTR_H__
|
||||
|
||||
#if defined (__alpha__) || defined (__arm__) || defined (__mips__) || defined (__ia64__) || defined (__clang__)
|
||||
#define DEALIGNED
|
||||
#endif
|
||||
@@ -150,7 +153,7 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
|
||||
|
||||
#undef DEALIGNED
|
||||
|
||||
#define WRITESTRINGN(p, s, n) ({ \
|
||||
#define WRITESTRINGN(p, s, n) do { \
|
||||
size_t tmp_i; \
|
||||
\
|
||||
for (tmp_i = 0; tmp_i < n && s[tmp_i] != '\0'; tmp_i++) \
|
||||
@@ -158,70 +161,72 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
|
||||
\
|
||||
if (tmp_i < n) \
|
||||
WRITECHAR(p, '\0'); \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define WRITESTRINGL(p, s, n) ({ \
|
||||
#define WRITESTRINGL(p, s, n) do { \
|
||||
size_t tmp_i; \
|
||||
\
|
||||
for (tmp_i = 0; tmp_i < n - 1 && s[tmp_i] != '\0'; tmp_i++) \
|
||||
WRITECHAR(p, s[tmp_i]); \
|
||||
\
|
||||
WRITECHAR(p, '\0'); \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define WRITESTRING(p, s) ({ \
|
||||
#define WRITESTRING(p, s) do { \
|
||||
size_t tmp_i; \
|
||||
\
|
||||
for (tmp_i = 0; s[tmp_i] != '\0'; tmp_i++) \
|
||||
WRITECHAR(p, s[tmp_i]); \
|
||||
\
|
||||
WRITECHAR(p, '\0'); \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define WRITEMEM(p, s, n) ({ \
|
||||
memcpy(p, s, n); \
|
||||
p += n; \
|
||||
})
|
||||
#define WRITEMEM(p, s, n) do { \
|
||||
memcpy(p, s, n); \
|
||||
p += n; \
|
||||
} while (0)
|
||||
|
||||
#define SKIPSTRING(p) while (READCHAR(p) != '\0')
|
||||
|
||||
#define SKIPSTRINGN(p, n) ({ \
|
||||
#define SKIPSTRINGN(p, n) do { \
|
||||
size_t tmp_i = 0; \
|
||||
\
|
||||
while (tmp_i < n && READCHAR(p) != '\0') \
|
||||
tmp_i++; \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define SKIPSTRINGL(p, n) SKIPSTRINGN(p, n)
|
||||
|
||||
#define READSTRINGN(p, s, n) ({ \
|
||||
#define READSTRINGN(p, s, n) do { \
|
||||
size_t tmp_i = 0; \
|
||||
\
|
||||
while (tmp_i < n && (s[tmp_i] = READCHAR(p)) != '\0') \
|
||||
tmp_i++; \
|
||||
\
|
||||
s[tmp_i] = '\0'; \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define READSTRINGL(p, s, n) ({ \
|
||||
#define READSTRINGL(p, s, n) do { \
|
||||
size_t tmp_i = 0; \
|
||||
\
|
||||
while (tmp_i < n - 1 && (s[tmp_i] = READCHAR(p)) != '\0') \
|
||||
tmp_i++; \
|
||||
\
|
||||
s[tmp_i] = '\0'; \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define READSTRING(p, s) ({ \
|
||||
#define READSTRING(p, s) do { \
|
||||
size_t tmp_i = 0; \
|
||||
\
|
||||
while ((s[tmp_i] = READCHAR(p)) != '\0') \
|
||||
tmp_i++; \
|
||||
\
|
||||
s[tmp_i] = '\0'; \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define READMEM(p, s, n) ({ \
|
||||
memcpy(s, p, n); \
|
||||
p += n; \
|
||||
})
|
||||
#define READMEM(p, s, n) do { \
|
||||
memcpy(s, p, n); \
|
||||
p += n; \
|
||||
} while (0)
|
||||
|
||||
#endif // __BYTEPTR_H__
|
||||
+222
-303
@@ -50,6 +50,7 @@
|
||||
#include "s_sound.h" // sfx_syfail
|
||||
#include "m_perfstats.h"
|
||||
#include "d_main.h"
|
||||
#include "r_fps.h"
|
||||
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
// cl loading screen
|
||||
@@ -139,10 +140,7 @@ static UINT8 gamestate_resend_counter[MAXNETNODES];
|
||||
boolean hu_stopped = false;
|
||||
|
||||
// Client specific
|
||||
static ticcmd_t localcmds;
|
||||
static ticcmd_t localcmds2;
|
||||
static ticcmd_t localcmds3;
|
||||
static ticcmd_t localcmds4;
|
||||
static ticcmd_t localcmds[MAXSPLITSCREENPLAYERS];
|
||||
static boolean cl_packetmissed;
|
||||
// here it is for the secondary local player (splitscreen)
|
||||
static UINT8 mynode; // my address pointofview server
|
||||
@@ -159,10 +157,7 @@ boolean is_client_saturn[MAXNETNODES];
|
||||
#define ISSATURN 69
|
||||
#endif
|
||||
|
||||
static UINT8 localtextcmd[MAXTEXTCMD];
|
||||
static UINT8 localtextcmd2[MAXTEXTCMD]; // splitscreen
|
||||
static UINT8 localtextcmd3[MAXTEXTCMD]; // splitscreen == 2
|
||||
static UINT8 localtextcmd4[MAXTEXTCMD]; // splitscreen == 3
|
||||
static UINT8 localtextcmd[MAXSPLITSCREENPLAYERS][MAXTEXTCMD];
|
||||
static tic_t neededtic;
|
||||
SINT8 servernode = 0; // the number of the server node
|
||||
char connectedservername[MAXSERVERNAME+1];
|
||||
@@ -276,77 +271,30 @@ void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum))
|
||||
listnetxcmd[id] = cmd_f;
|
||||
}
|
||||
|
||||
void SendNetXCmd(netxcmd_t id, const void *param, size_t nparam)
|
||||
void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_t nparam)
|
||||
{
|
||||
if (localtextcmd[0]+2+nparam > MAXTEXTCMD)
|
||||
if ((localtextcmd[playerid])[0]+2+nparam > MAXTEXTCMD)
|
||||
{
|
||||
// for future reference: if (cv_debug) != debug disabled.
|
||||
CONS_Alert(CONS_ERROR, M_GetText("NetXCmd buffer full, cannot add netcmd %d! (size: %d, needed: %s)\n"), id, localtextcmd[0], sizeu1(nparam));
|
||||
// for future reference: if (cht_debug) != debug disabled.
|
||||
CONS_Alert(CONS_ERROR, M_GetText("NetXCmd buffer full, cannot add netcmd %d! (size: %d, needed: %s)\n"), id, localtextcmd[playerid][0], sizeu1(nparam));
|
||||
return;
|
||||
}
|
||||
localtextcmd[0]++;
|
||||
localtextcmd[localtextcmd[0]] = (UINT8)id;
|
||||
|
||||
localtextcmd[playerid][0]++;
|
||||
localtextcmd[playerid][localtextcmd[playerid][0]] = (UINT8)id;
|
||||
|
||||
if (param && nparam)
|
||||
{
|
||||
M_Memcpy(&localtextcmd[localtextcmd[0]+1], param, nparam);
|
||||
localtextcmd[0] = (UINT8)(localtextcmd[0] + (UINT8)nparam);
|
||||
M_Memcpy(&localtextcmd[playerid][localtextcmd[playerid][0] + 1], param, nparam);
|
||||
localtextcmd[playerid][0] = (UINT8)(localtextcmd[playerid][0] + (UINT8)nparam);
|
||||
}
|
||||
}
|
||||
|
||||
// splitscreen player
|
||||
void SendNetXCmd2(netxcmd_t id, const void *param, size_t nparam)
|
||||
{
|
||||
if (localtextcmd2[0]+2+nparam > MAXTEXTCMD)
|
||||
{
|
||||
I_Error("No more place in the buffer for netcmd %d\n",id);
|
||||
return;
|
||||
}
|
||||
localtextcmd2[0]++;
|
||||
localtextcmd2[localtextcmd2[0]] = (UINT8)id;
|
||||
if (param && nparam)
|
||||
{
|
||||
M_Memcpy(&localtextcmd2[localtextcmd2[0]+1], param, nparam);
|
||||
localtextcmd2[0] = (UINT8)(localtextcmd2[0] + (UINT8)nparam);
|
||||
}
|
||||
}
|
||||
|
||||
void SendNetXCmd3(netxcmd_t id, const void *param, size_t nparam)
|
||||
{
|
||||
if (localtextcmd3[0]+2+nparam > MAXTEXTCMD)
|
||||
{
|
||||
I_Error("No more place in the buffer for netcmd %d\n",id);
|
||||
return;
|
||||
}
|
||||
localtextcmd3[0]++;
|
||||
localtextcmd3[localtextcmd3[0]] = (UINT8)id;
|
||||
if (param && nparam)
|
||||
{
|
||||
M_Memcpy(&localtextcmd3[localtextcmd3[0]+1], param, nparam);
|
||||
localtextcmd3[0] = (UINT8)(localtextcmd3[0] + (UINT8)nparam);
|
||||
}
|
||||
}
|
||||
|
||||
void SendNetXCmd4(netxcmd_t id, const void *param, size_t nparam)
|
||||
{
|
||||
if (localtextcmd4[0]+2+nparam > MAXTEXTCMD)
|
||||
{
|
||||
I_Error("No more place in the buffer for netcmd %d\n",id);
|
||||
return;
|
||||
}
|
||||
localtextcmd4[0]++;
|
||||
localtextcmd4[localtextcmd4[0]] = (UINT8)id;
|
||||
if (param && nparam)
|
||||
{
|
||||
M_Memcpy(&localtextcmd4[localtextcmd4[0]+1], param, nparam);
|
||||
localtextcmd4[0] = (UINT8)(localtextcmd4[0] + (UINT8)nparam);
|
||||
}
|
||||
}
|
||||
|
||||
UINT8 GetFreeXCmdSize(void)
|
||||
/*UINT8 GetFreeXCmdSize(UINT8 playerid)
|
||||
{
|
||||
// -1 for the size and another -1 for the ID.
|
||||
return (UINT8)(localtextcmd[0] - 2);
|
||||
}
|
||||
return (UINT8)(localtextcmd[playerid][0] - 2);
|
||||
}*/
|
||||
|
||||
// Frees all textcmd memory for the specified tic
|
||||
static void D_FreeTextcmd(tic_t tic)
|
||||
@@ -510,10 +458,8 @@ void D_ResetTiccmds(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
memset(&localcmds, 0, sizeof(ticcmd_t));
|
||||
memset(&localcmds2, 0, sizeof(ticcmd_t));
|
||||
memset(&localcmds3, 0, sizeof(ticcmd_t));
|
||||
memset(&localcmds4, 0, sizeof(ticcmd_t));
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
memset(&localcmds[i], 0, sizeof(ticcmd_t));
|
||||
|
||||
// Reset the net command list
|
||||
for (i = 0; i < TEXTCMD_HASH_SIZE; i++)
|
||||
@@ -1122,7 +1068,7 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
|
||||
//Draw bottom box
|
||||
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP, "Press ESC to abort");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP|MENUCAPS, "Press ESC to abort");
|
||||
|
||||
for (i = 0; i < 16; ++i)
|
||||
V_DrawFill((BASEVIDWIDTH/2-128) + (i * 16), BASEVIDHEIGHT-24, 16, 8, palstart + ((animtime - i) & 15));
|
||||
@@ -1169,7 +1115,7 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
cltext = M_GetText("Connecting to server...");
|
||||
break;
|
||||
}
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP, cltext);
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP|MENUCAPS, cltext);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1179,7 +1125,7 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
INT32 checkednum = 0;
|
||||
INT32 i;
|
||||
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP, "Press ESC to abort");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP|MENUCAPS, "Press ESC to abort");
|
||||
|
||||
//ima just count files here
|
||||
for (i = 0; i < fileneedednum; i++)
|
||||
@@ -1187,12 +1133,12 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
checkednum++;
|
||||
|
||||
// Loading progress
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP, "Checking server addons...");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP|MENUCAPS, "Checking server addons...");
|
||||
totalfileslength = (INT32)((checkednum/(double)(fileneedednum)) * 256);
|
||||
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
|
||||
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
|
||||
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, totalfileslength, 8, 160);
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
|
||||
va(" %2u/%2u Files",checkednum,fileneedednum));
|
||||
}
|
||||
else if (cl_mode == CL_LOADFILES)
|
||||
@@ -1201,7 +1147,7 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
INT32 loadcompletednum = 0;
|
||||
INT32 i;
|
||||
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP, "Press ESC to abort");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP|MENUCAPS, "Press ESC to abort");
|
||||
|
||||
//ima just count files here
|
||||
for (i = 0; i < fileneedednum; i++)
|
||||
@@ -1209,12 +1155,12 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
loadcompletednum++;
|
||||
|
||||
// Loading progress
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP, "Loading server addons...");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP|MENUCAPS, "Loading server addons...");
|
||||
totalfileslength = (INT32)((loadcompletednum/(double)(fileneedednum)) * 256);
|
||||
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
|
||||
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
|
||||
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, totalfileslength, 8, 160);
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
|
||||
va(" %2u/%2u Files",loadcompletednum,fileneedednum));
|
||||
}
|
||||
else if (lastfilenum != -1)
|
||||
@@ -1228,7 +1174,7 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
|
||||
// Draw the bottom box.
|
||||
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-58-8, 32, 1);
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-14, V_YELLOWMAP, "Press ESC to abort");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-14, V_YELLOWMAP|MENUCAPS, "Press ESC to abort");
|
||||
|
||||
Net_GetNetStat();
|
||||
dldlength = (INT32)((file->currentsize/(double)file->totalsize) * 256);
|
||||
@@ -1253,17 +1199,17 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
strncpy(tempname, filename, sizeof(tempname)-1);
|
||||
}
|
||||
#ifdef HAVE_CURL
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-30, 0,
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-30, MENUCAPS,
|
||||
va(M_GetText("%s downloading"), ((cl_mode == CL_DOWNLOADHTTPFILES) ? "\x82""HTTP" : "\x85""Direct")));
|
||||
#else
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-30, 0,
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-30, MENUCAPS,
|
||||
va(M_GetText("%s downloading"),("\x85""Direct")));
|
||||
#endif
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-22, V_YELLOWMAP,
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-22, V_YELLOWMAP|MENUCAPS,
|
||||
va(M_GetText("\"%s\""), tempname));
|
||||
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE,
|
||||
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE|MENUCAPS,
|
||||
va(" %4uK/%4uK",fileneeded[lastfilenum].currentsize>>10,file->totalsize>>10));
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE,
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE|MENUCAPS,
|
||||
va("%3.1fK/s ", ((double)getbps)/1024));
|
||||
|
||||
// Download progress
|
||||
@@ -1273,20 +1219,20 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
else
|
||||
totaldldsize = downloadcompletedsize;
|
||||
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-14, V_YELLOWMAP, "Overall Download Progress");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-14, V_YELLOWMAP|MENUCAPS, "Overall Download Progress");
|
||||
totalfileslength = (INT32)((totaldldsize/(double)totalfilesrequestedsize) * 256);
|
||||
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
|
||||
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
|
||||
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, totalfileslength, 8, 160);
|
||||
|
||||
if (totalfilesrequestedsize>>20 >= 10) //display in MB if over 10MB
|
||||
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
||||
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
|
||||
va(" %4uM/%4uM",totaldldsize>>20,totalfilesrequestedsize>>20));
|
||||
else
|
||||
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
||||
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
|
||||
va(" %4uK/%4uK",totaldldsize>>10,totalfilesrequestedsize>>10));
|
||||
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
|
||||
va("%2u/%2u Files ",downloadcompletednum,totalfilesrequestednum));
|
||||
}
|
||||
else
|
||||
@@ -1297,12 +1243,12 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
|
||||
//Draw bottom box
|
||||
M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1);
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP, "Press ESC to abort");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-24, V_YELLOWMAP|MENUCAPS, "Press ESC to abort");
|
||||
|
||||
for (i = 0; i < 16; ++i)
|
||||
V_DrawFill((BASEVIDWIDTH/2-128) + (i * 16), BASEVIDHEIGHT-24, 16, 8, palstart + ((animtime - i) & 15));
|
||||
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP,
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP|MENUCAPS,
|
||||
M_GetText("Waiting to download files..."));
|
||||
}
|
||||
}
|
||||
@@ -1680,7 +1626,7 @@ static boolean SV_ResendingSavegameToAnyone(void)
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < MAXNETNODES; i++)
|
||||
if (resendingsavegame[i])
|
||||
if (nodeingame[i] && resendingsavegame[i])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -1892,12 +1838,12 @@ static void CL_ReloadReceivedSavegame(void)
|
||||
// we dont have P_ForceLocalAngle so were setting it manually here
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
localangle[i] = (angle_t)(players[displayplayers[i]].cmd.angleturn<<16);
|
||||
localangle[i] = (angle_t)(players[displayplayers[i]].cmd.angleturn << 16);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
camera[i].subsector = R_PointInSubsector(camera[i].x, camera[i].y);
|
||||
camera[i].subsector = R_PointInSubsectorFast(camera[i].x, camera[i].y);
|
||||
}
|
||||
|
||||
cl_redownloadinggamestate = false;
|
||||
@@ -3124,7 +3070,7 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||
|
||||
demo_extradata[playernum] |= DXD_PLAYSTATE;
|
||||
|
||||
if (server && !demo.playback)
|
||||
if (server && !demo.playback && playernode[playernum] != UINT8_MAX)
|
||||
{
|
||||
INT32 node = playernode[playernum];
|
||||
//playerpernode[node] = 0; // It'd be better to remove them all at once, but ghosting happened, so continue to let CL_RemovePlayer do it one-by-one
|
||||
@@ -3133,13 +3079,7 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||
{
|
||||
SV_InitResynchVars(node); // If a resynch was in progress, well, it no longer needs to be.
|
||||
|
||||
nodeingame[node] = false;
|
||||
#ifdef SATURNPAK
|
||||
is_client_saturn[node] = false;
|
||||
#endif
|
||||
#ifdef SATURNSYNCH
|
||||
can_receive_gamestate[node] = false;
|
||||
#endif
|
||||
nodeingame[node] = false; // do we even need this?
|
||||
Net_CloseConnection(node);
|
||||
ResetNode(node);
|
||||
}
|
||||
@@ -3178,7 +3118,10 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||
}
|
||||
}
|
||||
|
||||
LUAh_PlayerQuit(&players[playernum], reason); // Lua hook for player quitting
|
||||
LUA_HookPlayerQuit(&players[playernum], reason); // Lua hook for player quitting
|
||||
|
||||
if (playernum == displayplayers[0] && !demo.playback)
|
||||
displayplayers[0] = consoleplayer; // don't look through someone's view who isn't there
|
||||
|
||||
if (playernum == displayplayers[0] && !demo.playback)
|
||||
displayplayers[0] = consoleplayer; // don't look through someone's view who isn't there
|
||||
@@ -3242,9 +3185,6 @@ void CL_Reset(void)
|
||||
if (servernode > 0 && servernode < MAXNETNODES)
|
||||
{
|
||||
nodeingame[(UINT8)servernode] = false;
|
||||
#ifdef SATURNPAK
|
||||
is_client_saturn[(UINT8)servernode] = false;
|
||||
#endif
|
||||
Net_CloseConnection(servernode);
|
||||
}
|
||||
D_CloseConnection(); // netgame = false
|
||||
@@ -3589,16 +3529,13 @@ static void Command_Kick(void)
|
||||
if (pn == -1 || pn == 0)
|
||||
return;
|
||||
|
||||
if (server)
|
||||
// Special case if we are trying to kick a player who is downloading the game state:
|
||||
// trigger a timeout instead of kicking them, because a kick would only
|
||||
// take effect after they have finished downloading
|
||||
if (server && playernode[pn] != UINT8_MAX && sendingsavegame[playernode[pn]])
|
||||
{
|
||||
// Special case if we are trying to kick a player who is downloading the game state:
|
||||
// trigger a timeout instead of kicking them, because a kick would only
|
||||
// take effect after they have finished downloading
|
||||
if (sendingsavegame[playernode[pn]])
|
||||
{
|
||||
Net_ConnectionTimeout(playernode[pn]);
|
||||
return;
|
||||
}
|
||||
Net_ConnectionTimeout(playernode[pn]);
|
||||
return;
|
||||
}
|
||||
|
||||
WRITESINT8(p, pn);
|
||||
@@ -3654,7 +3591,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||
|
||||
// Is playernum authorized to make this kick?
|
||||
if (playernum != serverplayer && !IsPlayerAdmin(playernum)
|
||||
/*&& !(playerpernode[playernode[playernum]] == 2
|
||||
/*&& !(playernode[playernum] != UINT8_MAX && playerpernode[playernode[playernum]] == 2
|
||||
//&& nodetoplayer2[playernode[playernum]] == pnum)*/)
|
||||
{
|
||||
// We received a kick command from someone who isn't the
|
||||
@@ -4353,10 +4290,10 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
|
||||
|
||||
D_AddPostloadFiles();
|
||||
|
||||
LUAh_PlayerJoin(newplayernum);
|
||||
LUA_HookInt(newplayernum, HOOK(PlayerJoin));
|
||||
|
||||
if (newplayernum == consoleplayer)
|
||||
LUAh_ServerJoin();
|
||||
LUA_HookVoid(HOOK(ServerJoin));
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
DRPC_UpdatePresence();
|
||||
@@ -4538,10 +4475,8 @@ void SV_StopServer(void)
|
||||
Y_EndVote();
|
||||
gamestate = wipegamestate = GS_NULL;
|
||||
|
||||
localtextcmd[0] = 0;
|
||||
localtextcmd2[0] = 0;
|
||||
localtextcmd3[0] = 0;
|
||||
localtextcmd4[0] = 0;
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
localtextcmd[i][0] = 0;
|
||||
|
||||
for (i = firstticstosend; i < firstticstosend + TICQUEUE; i++)
|
||||
D_Clearticcmd(i);
|
||||
@@ -5280,11 +5215,10 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
}
|
||||
|
||||
// Check player consistancy during the level
|
||||
if (((!can_receive_gamestate[node]) && realstart <= gametic && realstart > gametic - TICQUEUE+1 && gamestate == GS_LEVEL
|
||||
&& consistancy[realstart%TICQUEUE] != SHORT(netbuffer->u.clientpak.consistancy)) || (can_receive_gamestate[node] && realstart <= gametic && realstart + TICQUEUE - 1 > gametic && gamestate == GS_LEVEL
|
||||
if (gamestate == GS_LEVEL
|
||||
&& (realstart > gametic - TICQUEUE+1 && realstart <= gametic)
|
||||
&& consistancy[realstart%TICQUEUE] != SHORT(netbuffer->u.clientpak.consistancy)
|
||||
&& !resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime()
|
||||
&& !SV_ResendingSavegameToAnyone()))
|
||||
&& (!can_receive_gamestate[node] || (!resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone())))
|
||||
{
|
||||
//#ifndef SATURNPAK // lug: keep this behaviour for v7.1 atleast
|
||||
// we need to send this so the client can tell us if it can receive the savegame
|
||||
@@ -5342,8 +5276,6 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
DEBFILE(va("player %d kicked (synch failure) [%u] %d!=%d\n",
|
||||
netconsole, realstart, consistancy[realstart%TICQUEUE],
|
||||
SHORT(netbuffer->u.clientpak.consistancy)));
|
||||
gamestate_resend_counter[node] = 0;
|
||||
DEBFILE(va("gamestate counter %d for node %d\n", gamestate_resend_counter[node], netconsole));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -5496,12 +5428,6 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
}
|
||||
Net_CloseConnection(node);
|
||||
nodeingame[node] = false;
|
||||
#ifdef SATURNPAK
|
||||
is_client_saturn[node] = false;
|
||||
#endif
|
||||
#ifdef SATURNSYNCH
|
||||
can_receive_gamestate[node] = false;
|
||||
#endif
|
||||
break;
|
||||
// -------------------------------------------- CLIENT RECEIVE ----------
|
||||
case PT_RESYNCHEND:
|
||||
@@ -5960,26 +5886,26 @@ static void CL_SendClientCmd(void)
|
||||
else if (gamestate != GS_NULL)
|
||||
{
|
||||
packetsize = sizeof (clientcmd_pak);
|
||||
G_MoveTiccmd(&netbuffer->u.clientpak.cmd, &localcmds, 1);
|
||||
G_MoveTiccmd(&netbuffer->u.clientpak.cmd, &localcmds[0], 1);
|
||||
netbuffer->u.clientpak.consistancy = SHORT(consistancy[gametic%TICQUEUE]);
|
||||
|
||||
if (splitscreen || botingame) // Send a special packet with 2 cmd for splitscreen
|
||||
{
|
||||
netbuffer->packettype = (mis ? PT_CLIENT2MIS : PT_CLIENT2CMD);
|
||||
packetsize = sizeof (client2cmd_pak);
|
||||
G_MoveTiccmd(&netbuffer->u.client2pak.cmd2, &localcmds2, 1);
|
||||
G_MoveTiccmd(&netbuffer->u.client2pak.cmd2, &localcmds[1], 1);
|
||||
|
||||
if (splitscreen > 1)
|
||||
{
|
||||
netbuffer->packettype = (mis ? PT_CLIENT3MIS : PT_CLIENT3CMD);
|
||||
packetsize = sizeof (client3cmd_pak);
|
||||
G_MoveTiccmd(&netbuffer->u.client3pak.cmd3, &localcmds3, 1);
|
||||
G_MoveTiccmd(&netbuffer->u.client3pak.cmd3, &localcmds[2], 1);
|
||||
|
||||
if (splitscreen > 2)
|
||||
{
|
||||
netbuffer->packettype = (mis ? PT_CLIENT4MIS : PT_CLIENT4CMD);
|
||||
packetsize = sizeof (client4cmd_pak);
|
||||
G_MoveTiccmd(&netbuffer->u.client4pak.cmd4, &localcmds4, 1);
|
||||
G_MoveTiccmd(&netbuffer->u.client4pak.cmd4, &localcmds[3], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5989,44 +5915,33 @@ static void CL_SendClientCmd(void)
|
||||
|
||||
if (cl_mode == CL_CONNECTED || dedicated)
|
||||
{
|
||||
UINT8 i;
|
||||
// Send extra data if needed
|
||||
if (localtextcmd[0])
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
netbuffer->packettype = PT_TEXTCMD;
|
||||
M_Memcpy(netbuffer->u.textcmd,localtextcmd, localtextcmd[0]+1);
|
||||
// All extra data have been sent
|
||||
if (HSendPacket(servernode, true, 0, localtextcmd[0]+1)) // Send can fail...
|
||||
localtextcmd[0] = 0;
|
||||
}
|
||||
if (localtextcmd[i][0])
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 3:
|
||||
netbuffer->packettype = PT_TEXTCMD4;
|
||||
break;
|
||||
case 2:
|
||||
netbuffer->packettype = PT_TEXTCMD3;
|
||||
break;
|
||||
case 1:
|
||||
netbuffer->packettype = PT_TEXTCMD2;
|
||||
break;
|
||||
default:
|
||||
netbuffer->packettype = PT_TEXTCMD;
|
||||
break;
|
||||
}
|
||||
|
||||
// Send extra data if needed for player 2 (splitscreen == 1)
|
||||
if (localtextcmd2[0])
|
||||
{
|
||||
netbuffer->packettype = PT_TEXTCMD2;
|
||||
M_Memcpy(netbuffer->u.textcmd, localtextcmd2, localtextcmd2[0]+1);
|
||||
// All extra data have been sent
|
||||
if (HSendPacket(servernode, true, 0, localtextcmd2[0]+1)) // Send can fail...
|
||||
localtextcmd2[0] = 0;
|
||||
}
|
||||
|
||||
// Send extra data if needed for player 3 (splitscreen == 2)
|
||||
if (localtextcmd3[0])
|
||||
{
|
||||
netbuffer->packettype = PT_TEXTCMD3;
|
||||
M_Memcpy(netbuffer->u.textcmd, localtextcmd3, localtextcmd3[0]+1);
|
||||
// All extra data have been sent
|
||||
if (HSendPacket(servernode, true, 0, localtextcmd3[0]+1)) // Send can fail...
|
||||
localtextcmd3[0] = 0;
|
||||
}
|
||||
|
||||
// Send extra data if needed for player 4 (splitscreen == 3)
|
||||
if (localtextcmd4[0])
|
||||
{
|
||||
netbuffer->packettype = PT_TEXTCMD4;
|
||||
M_Memcpy(netbuffer->u.textcmd, localtextcmd4, localtextcmd4[0]+1);
|
||||
// All extra data have been sent
|
||||
if (HSendPacket(servernode, true, 0, localtextcmd4[0]+1)) // Send can fail...
|
||||
localtextcmd4[0] = 0;
|
||||
M_Memcpy(netbuffer->u.textcmd, localtextcmd[i], localtextcmd[i][0]+1);
|
||||
// All extra data have been sent
|
||||
if (HSendPacket(servernode, true, 0, localtextcmd[i][0]+1)) // Send can fail...
|
||||
localtextcmd[i][0] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6046,106 +5961,108 @@ static void SV_SendTics(void)
|
||||
// for each node create a packet with x tics and send it
|
||||
// x is computed using supposedtics[n], max packet size and maketic
|
||||
for (n = 1; n < MAXNETNODES; n++)
|
||||
if (nodeingame[n])
|
||||
{
|
||||
if (!nodeingame[n])
|
||||
continue;
|
||||
|
||||
// assert supposedtics[n]>=nettics[n]
|
||||
realfirsttic = supposedtics[n];
|
||||
lasttictosend = maketic;
|
||||
|
||||
if (lasttictosend - nettics[n] >= BACKUPTICS)
|
||||
lasttictosend = nettics[n] + BACKUPTICS-1;
|
||||
|
||||
if (realfirsttic >= lasttictosend)
|
||||
{
|
||||
// assert supposedtics[n]>=nettics[n]
|
||||
realfirsttic = supposedtics[n];
|
||||
lasttictosend = maketic;
|
||||
|
||||
if (lasttictosend - nettics[n] >= BACKUPTICS)
|
||||
lasttictosend = nettics[n] + BACKUPTICS-1;
|
||||
|
||||
if (realfirsttic >= lasttictosend)
|
||||
{
|
||||
// well we have sent all tics we will so use extrabandwidth
|
||||
// to resent packet that are supposed lost (this is necessary since lost
|
||||
// packet detection work when we have received packet with firsttic > neededtic
|
||||
// (getpacket servertics case)
|
||||
DEBFILE(va("Nothing to send node %u mak=%u sup=%u net=%u \n",
|
||||
n, lasttictosend, supposedtics[n], nettics[n]));
|
||||
realfirsttic = nettics[n];
|
||||
if (realfirsttic >= lasttictosend || (I_GetTime() + n)&3)
|
||||
// all tic are ok
|
||||
continue;
|
||||
DEBFILE(va("Sent %d anyway\n", realfirsttic));
|
||||
}
|
||||
if (realfirsttic < firstticstosend)
|
||||
realfirsttic = firstticstosend;
|
||||
|
||||
// compute the length of the packet and cut it if too large
|
||||
packsize = BASESERVERTICSSIZE;
|
||||
for (i = realfirsttic; i < lasttictosend; i++)
|
||||
{
|
||||
packsize += sizeof (ticcmd_t) * doomcom->numslots;
|
||||
packsize += TotalTextCmdPerTic(i);
|
||||
|
||||
if (packsize > software_MAXPACKETLENGTH)
|
||||
{
|
||||
DEBFILE(va("packet too large (%s) at tic %d (should be from %d to %d)\n",
|
||||
sizeu1(packsize), i, realfirsttic, lasttictosend));
|
||||
lasttictosend = i;
|
||||
|
||||
// too bad: too much player have send extradata and there is too
|
||||
// much data in one tic.
|
||||
// To avoid it put the data on the next tic. (see getpacket
|
||||
// textcmd case) but when numplayer changes the computation can be different
|
||||
if (lasttictosend == realfirsttic)
|
||||
{
|
||||
if (packsize > MAXPACKETLENGTH)
|
||||
I_Error("Too many players: can't send %s data for %d players to node %d\n"
|
||||
"Well sorry nobody is perfect....\n",
|
||||
sizeu1(packsize), doomcom->numslots, n);
|
||||
else
|
||||
{
|
||||
lasttictosend++; // send it anyway!
|
||||
DEBFILE("sending it anyway\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Send the tics
|
||||
netbuffer->packettype = PT_SERVERTICS;
|
||||
netbuffer->u.serverpak.starttic = (UINT8)realfirsttic;
|
||||
netbuffer->u.serverpak.numtics = (UINT8)(lasttictosend - realfirsttic);
|
||||
netbuffer->u.serverpak.numslots = (UINT8)SHORT(doomcom->numslots);
|
||||
bufpos = (UINT8 *)&netbuffer->u.serverpak.cmds;
|
||||
|
||||
for (i = realfirsttic; i < lasttictosend; i++)
|
||||
{
|
||||
bufpos = G_DcpyTiccmd(bufpos, netcmds[i%TICQUEUE], doomcom->numslots * sizeof (ticcmd_t));
|
||||
}
|
||||
|
||||
// add textcmds
|
||||
for (i = realfirsttic; i < lasttictosend; i++)
|
||||
{
|
||||
ntextcmd = bufpos++;
|
||||
*ntextcmd = 0;
|
||||
for (j = 0; j < MAXPLAYERS; j++)
|
||||
{
|
||||
UINT8 *textcmd = D_GetExistingTextcmd(i, j);
|
||||
INT32 size = textcmd ? textcmd[0] : 0;
|
||||
|
||||
if ((!j || playeringame[j]) && size)
|
||||
{
|
||||
(*ntextcmd)++;
|
||||
WRITEUINT8(bufpos, j);
|
||||
M_Memcpy(bufpos, textcmd, size + 1);
|
||||
bufpos += size + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
packsize = bufpos - (UINT8 *)&(netbuffer->u);
|
||||
|
||||
HSendPacket(n, false, 0, packsize);
|
||||
// when tic are too large, only one tic is sent so don't go backward!
|
||||
if (lasttictosend-doomcom->extratics > realfirsttic)
|
||||
supposedtics[n] = lasttictosend-doomcom->extratics;
|
||||
else
|
||||
supposedtics[n] = lasttictosend;
|
||||
if (supposedtics[n] < nettics[n]) supposedtics[n] = nettics[n];
|
||||
// well we have sent all tics we will so use extrabandwidth
|
||||
// to resent packet that are supposed lost (this is necessary since lost
|
||||
// packet detection work when we have received packet with firsttic > neededtic
|
||||
// (getpacket servertics case)
|
||||
DEBFILE(va("Nothing to send node %u mak=%u sup=%u net=%u \n",
|
||||
n, lasttictosend, supposedtics[n], nettics[n]));
|
||||
realfirsttic = nettics[n];
|
||||
if (realfirsttic >= lasttictosend || (I_GetTime() + n)&3)
|
||||
// all tic are ok
|
||||
continue;
|
||||
DEBFILE(va("Sent %d anyway\n", realfirsttic));
|
||||
}
|
||||
if (realfirsttic < firstticstosend)
|
||||
realfirsttic = firstticstosend;
|
||||
|
||||
// compute the length of the packet and cut it if too large
|
||||
packsize = BASESERVERTICSSIZE;
|
||||
for (i = realfirsttic; i < lasttictosend; i++)
|
||||
{
|
||||
packsize += sizeof (ticcmd_t) * doomcom->numslots;
|
||||
packsize += TotalTextCmdPerTic(i);
|
||||
|
||||
if (packsize > software_MAXPACKETLENGTH)
|
||||
{
|
||||
DEBFILE(va("packet too large (%s) at tic %d (should be from %d to %d)\n",
|
||||
sizeu1(packsize), i, realfirsttic, lasttictosend));
|
||||
lasttictosend = i;
|
||||
|
||||
// too bad: too much player have send extradata and there is too
|
||||
// much data in one tic.
|
||||
// To avoid it put the data on the next tic. (see getpacket
|
||||
// textcmd case) but when numplayer changes the computation can be different
|
||||
if (lasttictosend == realfirsttic)
|
||||
{
|
||||
if (packsize > MAXPACKETLENGTH)
|
||||
I_Error("Too many players: can't send %s data for %d players to node %d\n"
|
||||
"Well sorry nobody is perfect....\n",
|
||||
sizeu1(packsize), doomcom->numslots, n);
|
||||
else
|
||||
{
|
||||
lasttictosend++; // send it anyway!
|
||||
DEBFILE("sending it anyway\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Send the tics
|
||||
netbuffer->packettype = PT_SERVERTICS;
|
||||
netbuffer->u.serverpak.starttic = (UINT8)realfirsttic;
|
||||
netbuffer->u.serverpak.numtics = (UINT8)(lasttictosend - realfirsttic);
|
||||
netbuffer->u.serverpak.numslots = (UINT8)SHORT(doomcom->numslots);
|
||||
bufpos = (UINT8 *)&netbuffer->u.serverpak.cmds;
|
||||
|
||||
for (i = realfirsttic; i < lasttictosend; i++)
|
||||
{
|
||||
bufpos = G_DcpyTiccmd(bufpos, netcmds[i%TICQUEUE], doomcom->numslots * sizeof (ticcmd_t));
|
||||
}
|
||||
|
||||
// add textcmds
|
||||
for (i = realfirsttic; i < lasttictosend; i++)
|
||||
{
|
||||
ntextcmd = bufpos++;
|
||||
*ntextcmd = 0;
|
||||
for (j = 0; j < MAXPLAYERS; j++)
|
||||
{
|
||||
UINT8 *textcmd = D_GetExistingTextcmd(i, j);
|
||||
INT32 size = textcmd ? textcmd[0] : 0;
|
||||
|
||||
if ((!j || playeringame[j]) && size)
|
||||
{
|
||||
(*ntextcmd)++;
|
||||
WRITEUINT8(bufpos, j);
|
||||
M_Memcpy(bufpos, textcmd, size + 1);
|
||||
bufpos += size + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
packsize = bufpos - (UINT8 *)&(netbuffer->u);
|
||||
|
||||
HSendPacket(n, false, 0, packsize);
|
||||
// when tic are too large, only one tic is sent so don't go backward!
|
||||
if (lasttictosend-doomcom->extratics > realfirsttic)
|
||||
supposedtics[n] = lasttictosend-doomcom->extratics;
|
||||
else
|
||||
supposedtics[n] = lasttictosend;
|
||||
if (supposedtics[n] < nettics[n]) supposedtics[n] = nettics[n];
|
||||
}
|
||||
// node 0 is me!
|
||||
supposedtics[0] = maketic;
|
||||
}
|
||||
@@ -6153,27 +6070,27 @@ static void SV_SendTics(void)
|
||||
//
|
||||
// TryRunTics
|
||||
//
|
||||
static inline void CreateNewLocalCMD(UINT8 p, INT32 realtics)
|
||||
{
|
||||
G_BuildTiccmd(&localcmds[p], realtics, p+1);
|
||||
localcmds[p].angleturn |= TICCMD_RECEIVED;
|
||||
}
|
||||
|
||||
static void Local_Maketic(INT32 realtics)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
I_OsPolling(); // I_Getevent
|
||||
D_ProcessEvents(); // menu responder, cons responder,
|
||||
// game responder calls HU_Responder, AM_Responder, F_Responder,
|
||||
// and G_MapEventsToControls
|
||||
if (!dedicated) rendergametic = gametic;
|
||||
// translate inputs (keyboard/mouse/joystick) into game controls
|
||||
G_BuildTiccmd(&localcmds, realtics, 1);
|
||||
if (splitscreen || botingame)
|
||||
{
|
||||
G_BuildTiccmd(&localcmds2, realtics, 2);
|
||||
if (splitscreen > 1)
|
||||
{
|
||||
G_BuildTiccmd(&localcmds3, realtics, 3);
|
||||
if (splitscreen > 2)
|
||||
G_BuildTiccmd(&localcmds4, realtics, 4);
|
||||
}
|
||||
}
|
||||
|
||||
localcmds.angleturn |= TICCMD_RECEIVED;
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
CreateNewLocalCMD(i, realtics);
|
||||
}
|
||||
}
|
||||
|
||||
void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle)
|
||||
@@ -6212,29 +6129,31 @@ static void SV_Maketic(void)
|
||||
INT32 j;
|
||||
|
||||
for (j = 0; j < MAXNETNODES; j++)
|
||||
if (playerpernode[j])
|
||||
{
|
||||
INT32 player = nodetoplayer[j];
|
||||
if ((netcmds[maketic%TICQUEUE][player].angleturn & TICCMD_RECEIVED) == 0)
|
||||
{ // we didn't receive this tic
|
||||
INT32 i;
|
||||
{
|
||||
if (!playerpernode[j])
|
||||
continue;
|
||||
|
||||
DEBFILE(va("MISS tic%4d for node %d\n", maketic, j));
|
||||
INT32 player = nodetoplayer[j];
|
||||
if ((netcmds[maketic%TICQUEUE][player].angleturn & TICCMD_RECEIVED) == 0)
|
||||
{ // we didn't receive this tic
|
||||
INT32 i;
|
||||
|
||||
DEBFILE(va("MISS tic%4d for node %d\n", maketic, j));
|
||||
#if defined(PARANOIA) && 0
|
||||
CONS_Debug(DBG_NETPLAY, "Client Misstic %d\n", maketic);
|
||||
CONS_Debug(DBG_NETPLAY, "Client Misstic %d\n", maketic);
|
||||
#endif
|
||||
// copy the old tic
|
||||
for (i = 0; i < playerpernode[j]; i++)
|
||||
{
|
||||
if (i == 0) player = nodetoplayer[j];
|
||||
else if (i == 1) player = nodetoplayer2[j];
|
||||
else if (i == 2) player = nodetoplayer3[j];
|
||||
else if (i == 3) player = nodetoplayer4[j];
|
||||
netcmds[maketic%TICQUEUE][player] = netcmds[(maketic-1)%TICQUEUE][player];
|
||||
netcmds[maketic%TICQUEUE][player].angleturn &= ~TICCMD_RECEIVED;
|
||||
}
|
||||
// copy the old tic
|
||||
for (i = 0; i < playerpernode[j]; i++)
|
||||
{
|
||||
if (i == 0) player = nodetoplayer[j];
|
||||
else if (i == 1) player = nodetoplayer2[j];
|
||||
else if (i == 2) player = nodetoplayer3[j];
|
||||
else if (i == 3) player = nodetoplayer4[j];
|
||||
netcmds[maketic%TICQUEUE][player] = netcmds[(maketic-1)%TICQUEUE][player];
|
||||
netcmds[maketic%TICQUEUE][player].angleturn &= ~TICCMD_RECEIVED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// all tic are now proceed make the next
|
||||
maketic++;
|
||||
@@ -6463,7 +6382,7 @@ static void UpdatePingTable(void)
|
||||
PingUpdate();
|
||||
// update node latency values so we can take an average later.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i])
|
||||
if (playeringame[i] && playernode[i] != UINT8_MAX)
|
||||
realpingtable[i] += GetLag(playernode[i]);
|
||||
pingmeasurecount++;
|
||||
}
|
||||
|
||||
+3
-5
@@ -592,10 +592,8 @@ void D_ClientServerInit(void);
|
||||
|
||||
// Initialise the other field
|
||||
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum));
|
||||
void SendNetXCmd(netxcmd_t id, const void *param, size_t nparam);
|
||||
void SendNetXCmd2(netxcmd_t id, const void *param, size_t nparam); // splitsreen player
|
||||
void SendNetXCmd3(netxcmd_t id, const void *param, size_t nparam); // splitsreen3 player
|
||||
void SendNetXCmd4(netxcmd_t id, const void *param, size_t nparam); // splitsreen4 player
|
||||
void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_t nparam);
|
||||
#define SendNetXCmd(id, param, nparam) SendNetXCmdForPlayer(0, id, param, nparam) // Shortcut for P1
|
||||
|
||||
// Create any new ticcmds and broadcast to other players.
|
||||
void NetKeepAlive(void);
|
||||
@@ -642,7 +640,7 @@ INT32 D_NumPlayers(void);
|
||||
void D_ResetTiccmds(void);
|
||||
|
||||
tic_t GetLag(INT32 node);
|
||||
UINT8 GetFreeXCmdSize(void);
|
||||
//UINT8 GetFreeXCmdSize(UINT8 playerid);
|
||||
|
||||
extern UINT8 hu_resynching;
|
||||
#ifdef SATURNSYNCH
|
||||
|
||||
+6
-1
@@ -539,6 +539,8 @@ static boolean D_Display(void)
|
||||
PS_START_TIMING(ps_uitime);
|
||||
ST_Drawer();
|
||||
HU_Drawer();
|
||||
|
||||
NetUpdate(); // TEST: run this EVERY frame
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -854,7 +856,7 @@ void D_SRB2Loop(void)
|
||||
LUA_Step();
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
if (! dedicated)
|
||||
if (!dedicated)
|
||||
{
|
||||
Discord_RunCallbacks();
|
||||
}
|
||||
@@ -963,6 +965,9 @@ void D_StartTitle(void)
|
||||
//demosequence = -1;
|
||||
gametype = GT_RACE; // SRB2kart
|
||||
paused = false;
|
||||
|
||||
S_ResetKeepAndSpecialMus(); // just in case
|
||||
|
||||
F_StartTitleScreen();
|
||||
|
||||
// Reset the palette -- SRB2Kart: actually never mind let's do this in the middle of every fade
|
||||
|
||||
+33
-20
@@ -1656,7 +1656,7 @@ static void SendNameAndColor(void)
|
||||
WRITESTRINGN(p, cv_playername.zstring, MAXPLAYERNAME);
|
||||
WRITEUINT8(p, (UINT8)cv_playercolor.value);
|
||||
WRITEUINT8(p, (UINT8)cv_skin.value);
|
||||
SendNetXCmd(XD_NAMEANDCOLOR, buf, p - buf);
|
||||
SendNetXCmdForPlayer(0, XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
||||
// splitscreen
|
||||
@@ -1761,7 +1761,7 @@ static void SendNameAndColor2(void)
|
||||
WRITESTRINGN(p, cv_playername2.zstring, MAXPLAYERNAME);
|
||||
WRITEUINT8(p, (UINT8)cv_playercolor2.value);
|
||||
WRITEUINT8(p, (UINT8)cv_skin2.value);
|
||||
SendNetXCmd2(XD_NAMEANDCOLOR, buf, p - buf);
|
||||
SendNetXCmdForPlayer(1, XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
||||
static void SendNameAndColor3(void)
|
||||
@@ -1873,7 +1873,7 @@ static void SendNameAndColor3(void)
|
||||
WRITESTRINGN(p, cv_playername3.zstring, MAXPLAYERNAME);
|
||||
WRITEUINT8(p, (UINT8)cv_playercolor3.value);
|
||||
WRITEUINT8(p, (UINT8)cv_skin3.value);
|
||||
SendNetXCmd3(XD_NAMEANDCOLOR, buf, p - buf);
|
||||
SendNetXCmdForPlayer(2, XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
||||
static void SendNameAndColor4(void)
|
||||
@@ -1977,7 +1977,7 @@ static void SendNameAndColor4(void)
|
||||
WRITESTRINGN(p, cv_playername4.zstring, MAXPLAYERNAME);
|
||||
WRITEUINT8(p, (UINT8)cv_playercolor4.value);
|
||||
WRITEUINT8(p, (UINT8)cv_skin4.value);
|
||||
SendNetXCmd4(XD_NAMEANDCOLOR, buf, p - buf);
|
||||
SendNetXCmdForPlayer(3, XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
||||
static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
||||
@@ -2075,7 +2075,7 @@ void SendWeaponPref(void)
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam[0].value)
|
||||
buf[0] |= 1;
|
||||
SendNetXCmd(XD_WEAPONPREF, buf, 1);
|
||||
SendNetXCmdForPlayer(0, XD_WEAPONPREF, buf, 1);
|
||||
}
|
||||
|
||||
void SendWeaponPref2(void)
|
||||
@@ -2085,7 +2085,7 @@ void SendWeaponPref2(void)
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam[1].value)
|
||||
buf[0] |= 1;
|
||||
SendNetXCmd2(XD_WEAPONPREF, buf, 1);
|
||||
SendNetXCmdForPlayer(1, XD_WEAPONPREF, buf, 1);
|
||||
}
|
||||
|
||||
void SendWeaponPref3(void)
|
||||
@@ -2095,7 +2095,7 @@ void SendWeaponPref3(void)
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam[2].value)
|
||||
buf[0] |= 1;
|
||||
SendNetXCmd3(XD_WEAPONPREF, buf, 1);
|
||||
SendNetXCmdForPlayer(2, XD_WEAPONPREF, buf, 1);
|
||||
}
|
||||
|
||||
void SendWeaponPref4(void)
|
||||
@@ -2105,7 +2105,7 @@ void SendWeaponPref4(void)
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam[3].value)
|
||||
buf[0] |= 1;
|
||||
SendNetXCmd4(XD_WEAPONPREF, buf, 1);
|
||||
SendNetXCmdForPlayer(3, XD_WEAPONPREF, buf, 1);
|
||||
}
|
||||
|
||||
static void Got_WeaponPref(UINT8 **cp,INT32 playernum)
|
||||
@@ -2364,6 +2364,12 @@ static void Command_Playdemo_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!demo.playback && gamestate == GS_LEVEL) // special case: allow starting another demo while watching a demo
|
||||
{
|
||||
CONS_Printf(M_GetText("You can't time a demo while in a game.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
// disconnect from server here?
|
||||
if (demo.playback)
|
||||
G_StopDemo();
|
||||
@@ -2403,6 +2409,12 @@ static void Command_Timedemo_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!demo.playback && gamestate == GS_LEVEL) // special case: allow starting another demo while watching a demo
|
||||
{
|
||||
CONS_Printf(M_GetText("You can't time a demo while in a game.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
// disconnect from server here?
|
||||
if (demo.playback)
|
||||
G_StopDemo();
|
||||
@@ -2866,9 +2878,14 @@ static void Command_Map_f(void)
|
||||
}
|
||||
}
|
||||
|
||||
// spend atleast 35 seconds in one map
|
||||
if (cv_demochangemap.value && demo.recording && demo.savemode != DSM_NOTSAVING && (timeinmap > 1463) && ((cv_demochangemap.value == 2 && newmapnum == gamemap) || newmapnum != gamemap))
|
||||
G_SaveDemo();
|
||||
if (cv_demochangemap.value && demo.recording)
|
||||
{
|
||||
// spend atleast 40 seconds in one map
|
||||
if (demo.savemode != DSM_NOTSAVING && (timeinmap > (TICRATE * 40)) && ((cv_demochangemap.value == 2 && newmapnum == gamemap) || newmapnum != gamemap))
|
||||
G_SaveDemo();
|
||||
else
|
||||
G_ResetDemoRecording();
|
||||
}
|
||||
|
||||
fromlevelselect = false;
|
||||
D_MapChange(newmapnum, newgametype, newencoremode, newresetplayers, 0, false, false);
|
||||
@@ -2957,7 +2974,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||
SetPlayerSkinByNum(0, cv_chooseskin.value-1);
|
||||
|
||||
//mapnumber = M_MapNumber(mapname[3], mapname[4]);
|
||||
//LUAh_MapChange(mapnumber);
|
||||
//LUA_HookInt(mapnumber, HOOK(MapChange));
|
||||
|
||||
demo.savemode = (cv_recordmultiplayerdemos.value == 2) ? DSM_WILLAUTOSAVE : DSM_NOTSAVING;
|
||||
demo.savebutton = 0;
|
||||
@@ -3293,7 +3310,7 @@ static void Command_Teamchange_f(void)
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmd(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
SendNetXCmdForPlayer(0, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
|
||||
static void Command_Teamchange2_f(void)
|
||||
@@ -3360,7 +3377,7 @@ static void Command_Teamchange2_f(void)
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmd2(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
SendNetXCmdForPlayer(1, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
|
||||
static void Command_Teamchange3_f(void)
|
||||
@@ -3427,7 +3444,7 @@ static void Command_Teamchange3_f(void)
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmd3(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
SendNetXCmdForPlayer(2, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
|
||||
static void Command_Teamchange4_f(void)
|
||||
@@ -3494,7 +3511,7 @@ static void Command_Teamchange4_f(void)
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmd4(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
SendNetXCmdForPlayer(3, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
|
||||
static void Command_ServerTeamChange_f(void)
|
||||
@@ -4458,10 +4475,6 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
||||
boolean kick = false;
|
||||
boolean toomany = false;
|
||||
INT32 i,j;
|
||||
serverinfo_pak *dummycheck = NULL;
|
||||
|
||||
// Shut the compiler up.
|
||||
(void)dummycheck;
|
||||
|
||||
READSTRINGN(*cp, filename, 240);
|
||||
READMEM(*cp, md5sum, 16);
|
||||
|
||||
@@ -403,7 +403,6 @@ typedef struct player_s
|
||||
angle_t old_frameangle, old_frameangle2;
|
||||
|
||||
// SRB2Kart CEP: Sliptide rolling
|
||||
INT32 sliptidemem;
|
||||
angle_t sliproll;
|
||||
|
||||
INT16 lturn_max[MAXPREDICTTICS]; // What's the expected turn value for full-left for a number of frames back (to account for netgame latency)?
|
||||
|
||||
@@ -49,6 +49,7 @@ typedef struct thinker_s
|
||||
// killough 11/98: count of how many other objects reference
|
||||
// this one using pointers. Used for garbage collection.
|
||||
INT32 references;
|
||||
boolean cachable;
|
||||
} thinker_t;
|
||||
|
||||
#endif
|
||||
@@ -1477,9 +1477,6 @@ actionpointer_t actionpointers[] =
|
||||
{{A_SpawnObjectRelative}, "A_SPAWNOBJECTRELATIVE"},
|
||||
{{A_ChangeAngleRelative}, "A_CHANGEANGLERELATIVE"},
|
||||
{{A_ChangeAngleAbsolute}, "A_CHANGEANGLEABSOLUTE"},
|
||||
{{A_RollAngle}, "A_ROLLANGLE"},
|
||||
{{A_ChangeRollAngleRelative},"A_CHANGEROLLANGLERELATIVE"},
|
||||
{{A_ChangeRollAngleAbsolute},"A_CHANGEROLLANGLEABSOLUTE"},
|
||||
{{A_PlaySound}, "A_PLAYSOUND"},
|
||||
{{A_FindTarget}, "A_FINDTARGET"},
|
||||
{{A_FindTracer}, "A_FINDTRACER"},
|
||||
|
||||
@@ -365,6 +365,30 @@ typedef UINT32 tic_t;
|
||||
#define UINT2RGBA(a) (UINT32)((a&0xff)<<24)|((a&0xff00)<<8)|((a&0xff0000)>>8)|(((UINT32)a&0xff000000)>>24)
|
||||
#endif
|
||||
|
||||
#define TOSTR(x) #x
|
||||
|
||||
typedef UINT8 bitarray_t;
|
||||
|
||||
#define BIT_ARRAY_SIZE(n) (((n) + 7) >> 3)
|
||||
|
||||
static inline int
|
||||
in_bit_array (const bitarray_t * const array, const int value)
|
||||
{
|
||||
return (array[value >> 3] & (1<<(value & 7)));
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_bit_array (bitarray_t * const array, const int value)
|
||||
{
|
||||
array[value >> 3] |= (1<<(value & 7));
|
||||
}
|
||||
|
||||
static inline void
|
||||
unset_bit_array (bitarray_t * const array, const int value)
|
||||
{
|
||||
array[value >> 3] &= ~(1<<(value & 7));
|
||||
}
|
||||
|
||||
typedef UINT64 precise_t;
|
||||
|
||||
#endif //__DOOMTYPE__
|
||||
+6
-5
@@ -327,7 +327,8 @@ char menupath[1024];
|
||||
size_t menupathindex[menudepth];
|
||||
size_t menudepthleft = menudepth;
|
||||
|
||||
char menusearch[MAXSTRINGLENGTH+1];
|
||||
char menusearchbuf[MAXSTRINGLENGTH+1];
|
||||
textinput_t menusearch;
|
||||
|
||||
char **dirmenu, **coredirmenu; // core only local for this file
|
||||
size_t sizedirmenu, sizecoredirmenu; // ditto
|
||||
@@ -497,7 +498,7 @@ static boolean filemenucmp(char *haystack, char *needle)
|
||||
strupr(localhaystack);
|
||||
if (cv_addons_search_type.value)
|
||||
return (strstr(localhaystack, needle) != 0);
|
||||
return (!strncmp(localhaystack, needle, menusearch[0]));
|
||||
return (!strncmp(localhaystack, needle, menusearch.length));
|
||||
}
|
||||
|
||||
void closefilemenu(boolean validsize)
|
||||
@@ -563,7 +564,7 @@ void searchfilemenu(char *tempname)
|
||||
|
||||
first = (((UINT8)(coredirmenu[0][DIR_TYPE]) == EXT_UP) ? 1 : 0); // skip UP...
|
||||
|
||||
if (!menusearch[0])
|
||||
if (!menusearch.length)
|
||||
{
|
||||
if (dirmenu)
|
||||
Z_Free(dirmenu);
|
||||
@@ -590,7 +591,7 @@ void searchfilemenu(char *tempname)
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(localmenusearch, menusearch+1);
|
||||
strcpy(localmenusearch, menusearch.buffer);
|
||||
if (!cv_addons_search_case.value)
|
||||
strupr(localmenusearch);
|
||||
|
||||
@@ -652,7 +653,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
||||
tempname = Z_StrDup(dirmenu[dir_on[menudepthleft]]+DIR_STRING); // don't need to I_Error if can't make - not important, just QoL
|
||||
}
|
||||
else
|
||||
menusearch[0] = menusearch[1] = 0; // clear search
|
||||
M_TextInputInit(&menusearch, menusearchbuf, MAXSTRINGLENGTH+1);
|
||||
|
||||
if (!(dirhandle = opendir(menupath))) // get directory
|
||||
{
|
||||
|
||||
+3
-1
@@ -7,6 +7,7 @@
|
||||
#include "doomdef.h"
|
||||
#include "d_netfil.h"
|
||||
#include "m_menu.h" // MAXSTRINGLENGTH
|
||||
#include "m_textinput.h"
|
||||
|
||||
extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type;
|
||||
|
||||
@@ -34,7 +35,8 @@ extern char menupath[1024];
|
||||
extern size_t menupathindex[menudepth];
|
||||
extern size_t menudepthleft;
|
||||
|
||||
extern char menusearch[MAXSTRINGLENGTH+1];
|
||||
extern char menusearchbuf[MAXSTRINGLENGTH+1];
|
||||
extern textinput_t menusearch;
|
||||
|
||||
extern char **dirmenu;
|
||||
extern size_t sizedirmenu;
|
||||
|
||||
+77
-87
@@ -82,6 +82,8 @@ static void G_DoContinued(void);
|
||||
static void G_DoWorldDone(void);
|
||||
static void G_DoStartVote(void);
|
||||
|
||||
static void G_ResetDemoPlayback(char *pdemoname);
|
||||
|
||||
char mapmusname[7]; // Music name
|
||||
UINT16 mapmusflags; // Track and reset bit
|
||||
UINT32 mapmusposition; // Position to jump to
|
||||
@@ -357,6 +359,7 @@ void SendWeaponPref3(void);
|
||||
void SendWeaponPref4(void);
|
||||
|
||||
static void G_FixCamera(UINT8 view);
|
||||
|
||||
// don't mind me putting these here, I was lazy to figure out where else I could put those without blowing up the compiler.
|
||||
|
||||
// chat timer thingy
|
||||
@@ -540,7 +543,6 @@ static CV_PossibleValue_t sloperolldist_cons_t[] = {
|
||||
{8192, "8192"}, {0, "Infinite"}, {0, NULL}};
|
||||
consvar_t cv_sloperolldist = {"sloperolldist", "Infinite", CV_SAVE, sloperolldist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t sloperoll_cons_t[] = {{0, "Off"}, {1, "Players"}, {2, "Everything"}, {0, NULL}};
|
||||
consvar_t cv_spriteroll = {"spriteroll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL, sloperoll_cons_t, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_sparkroll = {"sparkroll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_sliptideroll = {"sliptideroll", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -994,7 +996,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
|
||||
if (player->spectator || cv_mouseturn.value)
|
||||
{
|
||||
//THIS WORKS WTF????????
|
||||
//THIS WORKS WTF????????
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - ((mousex*(encoremode ? -1 : 1)*8)));
|
||||
cmd->driftturn = (INT16)(cmd->driftturn - ((mousex*(encoremode ? -1 : 1)*8)));
|
||||
}
|
||||
@@ -1198,7 +1200,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
-Making a Mario Kart 8 Deluxe tier baby mode that steers you away from walls and whatnot. You know what, do what you want!
|
||||
*/
|
||||
if (gamestate == GS_LEVEL)
|
||||
LUAh_PlayerCmd(player, cmd);
|
||||
LUA_HookTiccmd(player, cmd, HOOK(PlayerCmd));
|
||||
|
||||
//Reset away view if a command is given.
|
||||
if ((cmd->forwardmove || cmd->sidemove || cmd->buttons)
|
||||
@@ -1210,16 +1212,19 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
if (cv_director.value)
|
||||
CV_SetValue(&cv_director, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// G_DoLoadLevel
|
||||
//
|
||||
void G_DoLoadLevel(boolean resetplayer)
|
||||
static void G_DoLoadLevel(boolean resetplayer)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
// Saturn Music Feature stuffs
|
||||
S_ResetKeepAndSpecialMus();
|
||||
S_CheckMap();
|
||||
|
||||
// Make sure objectplace is OFF when you first start the level!
|
||||
OP_ResetObjectplace();
|
||||
|
||||
@@ -1686,7 +1691,7 @@ static void G_FixCamera(UINT8 view)
|
||||
player_t *player = &players[displayplayers[view - 1]];
|
||||
// The order of displayplayers can change, which would
|
||||
// invalidate localangle.
|
||||
localangle[view - 1] = player->mo->angle; // Players *always* have mobjs, right?
|
||||
localangle[view - 1] = (angle_t)(player->cmd.angleturn << 16);
|
||||
|
||||
P_ResetCamera(player, &camera[view - 1]);
|
||||
// Make sure the viewport doesn't interpolate at all into
|
||||
@@ -1707,7 +1712,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
|
||||
|
||||
INT32 playernumd;
|
||||
|
||||
INT32 *displayplayerp;
|
||||
INT32 *displayplayerp;
|
||||
|
||||
INT32 olddisplayplayer;
|
||||
INT32 playersviewable;
|
||||
@@ -2392,7 +2397,7 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
|
||||
if (starpost) //Don't even bother with looking for a place to spawn.
|
||||
{
|
||||
P_MovePlayerToStarpost(playernum);
|
||||
LUAh_PlayerSpawn(&players[playernum]); // Lua hook for player spawning :)
|
||||
LUA_HookPlayer(&players[playernum], HOOK(PlayerSpawn)); // Lua hook for player spawning :)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2438,7 +2443,7 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
|
||||
}
|
||||
P_MovePlayerToSpawn(playernum, spawnpoint);
|
||||
|
||||
LUAh_PlayerSpawn(&players[playernum]); // Lua hook for player spawning :)
|
||||
LUA_HookPlayer(&players[playernum], HOOK(PlayerSpawn)); // Lua hook for player spawning :)
|
||||
}
|
||||
|
||||
mapthing_t *G_FindCTFStart(INT32 playernum)
|
||||
@@ -3209,6 +3214,8 @@ void G_AfterIntermission(void)
|
||||
}
|
||||
else if (demo.recording && (modeattacking || demo.savemode != DSM_NOTSAVING))
|
||||
G_SaveDemo();
|
||||
else if (demo.recording)
|
||||
G_ResetDemoRecording();
|
||||
|
||||
if (modeattacking) // End the run.
|
||||
{
|
||||
@@ -3356,6 +3363,8 @@ void G_EndGame(void)
|
||||
{
|
||||
if (demo.recording && (modeattacking || demo.savemode != DSM_NOTSAVING))
|
||||
G_SaveDemo();
|
||||
else if (demo.recording)
|
||||
G_ResetDemoRecording();
|
||||
|
||||
// 1100 or competitive multiplayer, so go back to title screen.
|
||||
D_StartTitle();
|
||||
@@ -3952,8 +3961,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
|
||||
F_StartCustomCutscene(mapheaderinfo[gamemap-1]->precutscenenum-1, true, resetplayer);
|
||||
else
|
||||
{
|
||||
LUAh_MapChange(gamemap);
|
||||
S_CheckMap();
|
||||
LUA_HookInt(gamemap, HOOK(MapChange));
|
||||
G_DoLoadLevel(resetplayer);
|
||||
}
|
||||
|
||||
@@ -5883,11 +5891,8 @@ void G_RecordDemo(const char *name)
|
||||
{
|
||||
INT32 maxsize;
|
||||
|
||||
demobuf.p = NULL;
|
||||
demo.recording = false;
|
||||
if (demobuf.buffer)
|
||||
free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo_p = NULL;
|
||||
G_ResetDemoRecording();
|
||||
demoend = NULL;
|
||||
|
||||
if (cv_recordmultiplayerdemos.value)
|
||||
@@ -5899,8 +5904,8 @@ void G_RecordDemo(const char *name)
|
||||
|
||||
maxsize = cv_maxdemosize.value*1024*1024;
|
||||
|
||||
demobuf.buffer = malloc(maxsize);
|
||||
demoend = demobuf.buffer + maxsize;
|
||||
demobuffer = Z_Malloc(maxsize, PU_STATIC, NULL);
|
||||
demoend = demobuffer + maxsize;
|
||||
|
||||
if (demobuf.buffer)
|
||||
demo.recording = true;
|
||||
@@ -5913,12 +5918,12 @@ void G_RecordMetal(void)
|
||||
{
|
||||
INT32 maxsize;
|
||||
maxsize = cv_maxdemosize.value*1024*1024;
|
||||
if (demobuf.buffer)
|
||||
free(demobuf.buffer);
|
||||
demobuf.p = NULL;
|
||||
if (demobuffer)
|
||||
Z_Free(demobuffer);
|
||||
demo_p = NULL;
|
||||
metalrecording = false;
|
||||
demobuf.buffer = malloc(maxsize);
|
||||
demoend = demobuf.buffer + maxsize;
|
||||
demobuffer = Z_Malloc(maxsize, PU_STATIC, NULL);
|
||||
demoend = demobuffer + maxsize;
|
||||
|
||||
if (demobuf.buffer)
|
||||
metalrecording = true;
|
||||
@@ -6771,11 +6776,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
snprintf(msg, 1024, M_GetText("%s is not a SRB2Kart replay file.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
G_ResetDemoPlayback(pdemoname);
|
||||
return;
|
||||
}
|
||||
demobuf.p += 12; // DEMOHEADER
|
||||
@@ -6800,11 +6801,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
snprintf(msg, 1024, M_GetText("%s is an incompatible replay format and cannot be played.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
G_ResetDemoPlayback(pdemoname);
|
||||
return;
|
||||
}
|
||||
demobuf.p += 16; // demo checksum
|
||||
@@ -6813,11 +6810,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
snprintf(msg, 1024, M_GetText("%s is the wrong type of recording and cannot be played.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
G_ResetDemoPlayback(pdemoname);
|
||||
return;
|
||||
}
|
||||
demobuf.p += 4; // "PLAY"
|
||||
@@ -6833,11 +6826,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
snprintf(msg, 1024, M_GetText("%s is an alpha multiplayer replay and cannot be played.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
G_ResetDemoPlayback(pdemoname);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -6894,11 +6883,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
if (!CON_Ready()) // In the console they'll just see the notice there! No point pulling them out.
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
G_ResetDemoPlayback(pdemoname);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -6961,11 +6946,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
snprintf(msg, 1024, M_GetText("%s features a character that is not currently loaded.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
G_ResetDemoPlayback(pdemoname);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6975,11 +6956,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
G_ResetDemoPlayback(pdemoname);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7000,11 +6977,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
G_ResetDemoPlayback(pdemoname);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7044,11 +7017,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
G_ResetDemoPlayback(pdemoname);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7075,7 +7044,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
// didn't start recording right away.
|
||||
demo.deferstart = false;
|
||||
|
||||
//LUAh_MapChange(gamemap);
|
||||
//LUA_HookInt(gamemap, HOOK(MapChange));
|
||||
|
||||
displayplayers[0] = consoleplayer = 0;
|
||||
memset(playeringame,0,sizeof(playeringame));
|
||||
@@ -7099,11 +7068,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with spectators, and is thus invalid.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
G_ResetDemoPlayback(pdemoname);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -7114,11 +7079,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with multiple players, and is thus invalid.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
G_ResetDemoPlayback(pdemoname);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7761,8 +7722,8 @@ ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(void)
|
||||
#endif
|
||||
saved = FIL_WriteFile(va("%sMS.LMP", G_BuildMapName(gamemap)), demobuf.buffer, demobuf.p - demobuf.buffer); // finally output the file.
|
||||
}
|
||||
free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
Z_Free(demobuffer);
|
||||
demobuffer = NULL;
|
||||
metalrecording = false;
|
||||
if (saved)
|
||||
I_Error("Saved to %sMS.LMP", G_BuildMapName(gamemap));
|
||||
@@ -7866,7 +7827,10 @@ boolean G_CheckDemoStatus(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (demo.recording && (modeattacking || demo.savemode != DSM_NOTSAVING))
|
||||
if (!demo.recording)
|
||||
return false;
|
||||
|
||||
if (modeattacking || demo.savemode != DSM_NOTSAVING)
|
||||
{
|
||||
if (demobuf.p)
|
||||
{
|
||||
@@ -7875,14 +7839,41 @@ boolean G_CheckDemoStatus(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
demo.recording = false;
|
||||
G_ResetDemoRecording();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void G_ResetDemoRecording(void)
|
||||
{
|
||||
if (demobuffer)
|
||||
Z_Free(demobuffer);
|
||||
demobuffer = NULL;
|
||||
demo.recording = false;
|
||||
}
|
||||
|
||||
static void G_ResetDemoPlayback(char *pdemoname)
|
||||
{
|
||||
if (pdemoname)
|
||||
Z_Free(pdemoname);
|
||||
if (demobuffer)
|
||||
Z_Free(demobuffer);
|
||||
demobuffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
}
|
||||
|
||||
void G_SaveDemo(void)
|
||||
{
|
||||
UINT8 *p = demobuf.buffer+16; // after version
|
||||
if (!demo_p)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Failed to save Demo. No Demo pointer exists!\n");
|
||||
// reset the demo buffer
|
||||
G_ResetDemoRecording();
|
||||
return;
|
||||
}
|
||||
|
||||
UINT8 *p = demobuffer+16; // after version
|
||||
UINT32 length;
|
||||
#ifdef NOMD5
|
||||
UINT8 i;
|
||||
@@ -7951,9 +7942,8 @@ void G_SaveDemo(void)
|
||||
|
||||
if (FIL_WriteFile(va(pandf, srb2home, demoname), demobuf.buffer, demobuf.p - demobuf.buffer)) // finally output the file.
|
||||
demo.savemode = DSM_SAVED;
|
||||
free(demobuf.buffer);
|
||||
demobuf.buffer = NULL;
|
||||
demo.recording = false;
|
||||
|
||||
G_ResetDemoRecording();
|
||||
|
||||
if (modeattacking != ATTACKING_RECORD)
|
||||
{
|
||||
|
||||
+1
-2
@@ -176,7 +176,6 @@ extern consvar_t cv_saltysquish;
|
||||
extern consvar_t cv_driftsparkpulse;
|
||||
extern consvar_t cv_gravstretch;
|
||||
extern consvar_t cv_sloperoll;
|
||||
extern consvar_t cv_spriteroll;
|
||||
extern consvar_t cv_sliptideroll;
|
||||
extern consvar_t cv_slamsound;
|
||||
extern consvar_t cv_sloperolldist;
|
||||
@@ -276,7 +275,6 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost);
|
||||
// A normal game starts at map 1, but a warp test can start elsewhere
|
||||
void G_DeferedInitNew(boolean pencoremode, const char *mapname, INT32 pickedchar,
|
||||
UINT8 ssplayers, boolean FLS);
|
||||
void G_DoLoadLevel(boolean resetplayer);
|
||||
|
||||
void G_LoadDemoInfo(menudemo_t *pdemo);
|
||||
void G_LoadDemoTitle(menudemo_t *pdemo); // For use in replay search feature
|
||||
@@ -366,6 +364,7 @@ extern demoghost *ghosts;
|
||||
#define DFILE_ERROR_CANNOTLOAD 0x04 // Files are missing and cannot be loaded.
|
||||
#define DFILE_ERROR_EXTRAFILES 0x05 // Extra files outside of the replay's file list are loaded.
|
||||
|
||||
void G_ResetDemoRecording(void);
|
||||
void G_DoPlayDemo(char *defdemoname);
|
||||
void G_TimeDemo(const char *name);
|
||||
void G_AddGhost(char *defdemoname);
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include "../qs22j.h"
|
||||
|
||||
|
||||
// The texture for the next polygon given to HWR_ProcessPolygon.
|
||||
// Set with HWR_SetCurrentTexture.
|
||||
GLMipmap_t *current_texture = NULL;
|
||||
@@ -227,7 +226,7 @@ void HWR_RenderBatches(void)
|
||||
|
||||
int currentShader;
|
||||
int nextShader = 0;
|
||||
GLMipmap_t *currentTexture;
|
||||
GLMipmap_t *currentTexture = NULL;
|
||||
GLMipmap_t *nextTexture = NULL;
|
||||
FBITFIELD currentPolyFlags = 0;
|
||||
FBITFIELD nextPolyFlags = 0;
|
||||
|
||||
+67
-67
@@ -73,6 +73,9 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
|
||||
(void)patchheight; // This parameter is unused
|
||||
|
||||
if (!mipmap || mipmap == NULL)
|
||||
return;
|
||||
|
||||
if (originPatch) // originPatch can be NULL here, unlike in the software version
|
||||
originy = originPatch->originy;
|
||||
|
||||
@@ -333,8 +336,8 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
else
|
||||
gltex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
|
||||
|
||||
gltex->mipmap.width = (UINT16)texture->width;
|
||||
gltex->mipmap.height = (UINT16)texture->height;
|
||||
gltex->mipmap.width = SHORT(texture->width);
|
||||
gltex->mipmap.height = SHORT(texture->height);
|
||||
|
||||
if (skyspecial)
|
||||
gltex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
|
||||
@@ -413,14 +416,13 @@ void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, bo
|
||||
glPatch->leftoffset = SHORT(patch->leftoffset);
|
||||
glPatch->topoffset = SHORT(patch->topoffset);
|
||||
|
||||
//glMipmap->width = (UINT16)SHORT(patch->width);
|
||||
//glMipmap->height = (UINT16)SHORT(patch->height);
|
||||
glMipmap->width = glMipmap->height = 1;
|
||||
while (glMipmap->width < glPatch->width) glMipmap->width <<= 1;
|
||||
while (glMipmap->height < glPatch->height) glMipmap->height <<= 1;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
glMipmap->flags = 0;
|
||||
|
||||
// setup the texture info
|
||||
glMipmap->format = patchformat;
|
||||
|
||||
@@ -440,8 +442,6 @@ void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, bo
|
||||
glPatch->width, glPatch->height,
|
||||
patch);
|
||||
}
|
||||
|
||||
//glPatch->max_s = glPatch->max_t = 1.0f;
|
||||
}
|
||||
|
||||
// =================================================
|
||||
@@ -641,117 +641,117 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
|
||||
// Download a Doom 'flat' to the hardware cache and make it ready for use
|
||||
void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
|
||||
{
|
||||
GLMipmap_t *glmip;
|
||||
GLMipmap_t *glMipmap;
|
||||
|
||||
if (flatlumpnum == LUMPERROR)
|
||||
return;
|
||||
|
||||
glmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
glMipmap = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
|
||||
glmip->colormap = colormaps;
|
||||
glMipmap->colormap = colormaps;
|
||||
|
||||
#ifdef GLENCORE
|
||||
if (!noencoremap && encoremap)
|
||||
glmip->colormap += COLORMAP_REMAPOFFSET;
|
||||
glMipmap->colormap += COLORMAP_REMAPOFFSET;
|
||||
#endif
|
||||
|
||||
if (!glmip->downloaded && !glmip->data)
|
||||
HWR_CacheFlat(glmip, flatlumpnum);
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
HWR_CacheFlat(glMipmap, flatlumpnum);
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!glmip->downloaded)
|
||||
HWD.pfnSetTexture(glmip);
|
||||
HWR_SetCurrentTexture(glmip);
|
||||
if (!glMipmap->downloaded)
|
||||
HWD.pfnSetTexture(glMipmap);
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
//
|
||||
// HWR_LoadMappedPatch(): replace the skin color of the sprite in cache
|
||||
// : load it first in doom cache if not already
|
||||
//
|
||||
static void HWR_LoadMappedPatch(GLMipmap_t *glmip, GLPatch_t *gpatch)
|
||||
static void HWR_LoadMappedPatch(GLMipmap_t *glMipmap, GLPatch_t *glPatch)
|
||||
{
|
||||
if (!glmip->downloaded && !glmip->data)
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
{
|
||||
patch_t *patch = gpatch->rawpatch;
|
||||
patch_t *patch = glPatch->rawpatch;
|
||||
if (!patch)
|
||||
patch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(patch, gpatch, glmip, true);
|
||||
patch = W_CacheLumpNumPwad(glPatch->wadnum, glPatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(patch, glPatch, glMipmap, true);
|
||||
|
||||
// You can't free rawpatch for some reason?
|
||||
// (Obviously I can't, sprite rotation needs that...)
|
||||
|
||||
if (!gpatch->rawpatch)
|
||||
if (!glPatch->rawpatch)
|
||||
Z_Free(patch);
|
||||
}
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!glmip->downloaded)
|
||||
HWD.pfnSetTexture(glmip);
|
||||
HWR_SetCurrentTexture(glmip);
|
||||
if (!glMipmap->downloaded)
|
||||
HWD.pfnSetTexture(glMipmap);
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// HWR_GetPatch : Download a patch to the hardware cache and make it ready for use
|
||||
// HWR_GetPatch : Downloads a patch to the hardware cache and make it ready for use
|
||||
// -----------------+
|
||||
void HWR_GetPatch(GLPatch_t *gpatch)
|
||||
void HWR_GetPatch(GLPatch_t *glPatch)
|
||||
{
|
||||
// is it in hardware cache
|
||||
if (!gpatch->mipmap->downloaded && !gpatch->mipmap->data)
|
||||
if (!glPatch->mipmap->downloaded && !glPatch->mipmap->data)
|
||||
{
|
||||
// load the software patch, PU_STATIC or the Z_Malloc for hardware patch will
|
||||
// flush the software patch before the conversion! oh yeah I suffered
|
||||
patch_t *ptr = gpatch->rawpatch;
|
||||
patch_t *ptr = glPatch->rawpatch;
|
||||
if (!ptr)
|
||||
ptr = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(ptr, gpatch, gpatch->mipmap, true);
|
||||
ptr = W_CacheLumpNumPwad(glPatch->wadnum, glPatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(ptr, glPatch, glPatch->mipmap, true);
|
||||
|
||||
// this is inefficient.. but the hardware patch in heap is purgeable so it should
|
||||
// not fragment memory, and besides the REAL cache here is the hardware memory
|
||||
if (!gpatch->rawpatch)
|
||||
if (!glPatch->rawpatch)
|
||||
Z_Free(ptr);
|
||||
}
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!gpatch->mipmap->downloaded)
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
HWR_SetCurrentTexture(gpatch->mipmap);
|
||||
if (!glPatch->mipmap->downloaded)
|
||||
HWD.pfnSetTexture(glPatch->mipmap);
|
||||
HWR_SetCurrentTexture(glPatch->mipmap);
|
||||
|
||||
// The system-memory patch data can be purged now.
|
||||
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glPatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
||||
// -------------------+
|
||||
// HWR_GetMappedPatch : Same as HWR_GetPatch for sprite color
|
||||
// -------------------+
|
||||
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
||||
void HWR_GetMappedPatch(GLPatch_t *glPatch, const UINT8 *colormap)
|
||||
{
|
||||
GLMipmap_t *glmip, *newmip;
|
||||
GLMipmap_t *glMipmap, *newMipmap;
|
||||
|
||||
// Blatant hack for encore colormapping aside...
|
||||
if (colormap == colormaps || colormap == NULL || colormap == (const UINT8*)(COLORMAP_REMAPOFFSET))
|
||||
{
|
||||
// Load the default (green) color in doom cache (temporary?) AND hardware cache
|
||||
HWR_GetPatch(gpatch);
|
||||
HWR_GetPatch(glPatch);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mimmap
|
||||
// search for the mipmap
|
||||
// skip the first (no colormap translated)
|
||||
for (glmip = gpatch->mipmap; glmip->nextcolormap; )
|
||||
for (glMipmap = glPatch->mipmap; glMipmap->nextcolormap; )
|
||||
{
|
||||
glmip = glmip->nextcolormap;
|
||||
glMipmap = glMipmap->nextcolormap;
|
||||
|
||||
if (glmip->colormap != colormap)
|
||||
if (glMipmap->colormap != colormap)
|
||||
continue;
|
||||
|
||||
HWR_LoadMappedPatch(glmip, gpatch);
|
||||
HWR_LoadMappedPatch(glMipmap, glPatch);
|
||||
return;
|
||||
}
|
||||
// not found, create it!
|
||||
@@ -761,38 +761,38 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
||||
// (it have a liste of mipmap)
|
||||
// this malloc is cleared in HWR_FreeTextureCache
|
||||
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
|
||||
newmip = calloc(1, sizeof (*newmip));
|
||||
if (newmip == NULL)
|
||||
newMipmap = calloc(1, sizeof (*newMipmap));
|
||||
if (newMipmap == NULL)
|
||||
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||
glmip->nextcolormap = newmip;
|
||||
glMipmap->nextcolormap = newMipmap;
|
||||
|
||||
newmip->colormap = colormap;
|
||||
HWR_LoadMappedPatch(newmip, gpatch);
|
||||
newMipmap->colormap = colormap;
|
||||
HWR_LoadMappedPatch(newMipmap, glPatch);
|
||||
}
|
||||
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *glPatch)
|
||||
{
|
||||
if (!gpatch)
|
||||
if (!glPatch)
|
||||
return;
|
||||
|
||||
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glPatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
|
||||
{
|
||||
aatree_t *hwrcache = wadfiles[wadnum]->hwrcache;
|
||||
GLPatch_t *glpatch;
|
||||
GLPatch_t *glPatch;
|
||||
|
||||
if (!(glpatch = M_AATreeGet(hwrcache, lumpnum)))
|
||||
if (!(glPatch = M_AATreeGet(hwrcache, lumpnum)))
|
||||
{
|
||||
glpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
|
||||
glpatch->wadnum = wadnum;
|
||||
glpatch->lumpnum = lumpnum;
|
||||
glpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
M_AATreeSet(hwrcache, lumpnum, glpatch);
|
||||
glPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
|
||||
glPatch->wadnum = wadnum;
|
||||
glPatch->lumpnum = lumpnum;
|
||||
glPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
M_AATreeSet(hwrcache, lumpnum, glPatch);
|
||||
}
|
||||
|
||||
return glpatch;
|
||||
return glPatch;
|
||||
}
|
||||
|
||||
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum)
|
||||
@@ -887,17 +887,17 @@ static void HWR_CacheFadeMask(GLMipmap_t *glMipmap, lumpnum_t fademasklumpnum)
|
||||
|
||||
void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
||||
{
|
||||
GLMipmap_t *glmip;
|
||||
GLMipmap_t *glMipmap;
|
||||
|
||||
glmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
glMipmap = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
|
||||
if (!glmip->downloaded && !glmip->data)
|
||||
HWR_CacheFadeMask(glmip, fademasklumpnum);
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
HWR_CacheFadeMask(glMipmap, fademasklumpnum);
|
||||
|
||||
HWD.pfnSetTexture(glmip);
|
||||
HWD.pfnSetTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
// =================================================
|
||||
|
||||
@@ -333,11 +333,11 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
|
||||
|
||||
// ok, this is a gross hack that barely works...
|
||||
// but at least it doesn't overestimate too much...
|
||||
clipfov = atan(1 / projMatrix[0]) * 360 / M_PI;
|
||||
clipfov = atan(1 / projMatrix[0]) * 360 / M_PIl;
|
||||
floatangle = 2.0f + (45.0f + (tilt / 1.9f)) * clipfov / 90.0f;
|
||||
if (floatangle >= 180.0)
|
||||
return 0xffffffff;
|
||||
a1 = (angle_t)(ANG1 * (int)floatangle);
|
||||
a1 = (angle_t)xs_CRoundToInt(ANG1 * floatangle);
|
||||
return a1;
|
||||
}
|
||||
|
||||
@@ -458,4 +458,4 @@ boolean gld_SphereInFrustum(float x, float y, float z, float radius)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -33,16 +33,18 @@ typedef enum GLTextureFormat_e
|
||||
GL_TEXFMT_ALPHA_INTENSITY_88 = 0x22,
|
||||
} GLTextureFormat_t;
|
||||
|
||||
// data holds the address of the graphics data cached in heap memory
|
||||
// NULL if the texture is not in Doom heap cache.
|
||||
// Texture information (misleadingly named "mipmap" all over the code.)
|
||||
// The *data pointer holds the address of the graphics data cached in heap memory.
|
||||
// NULL if the texture is not in SRB2's heap cache.
|
||||
struct GLMipmap_s
|
||||
{
|
||||
// for UpdateTexture
|
||||
GLTextureFormat_t format;
|
||||
void *data;
|
||||
|
||||
UINT32 flags;
|
||||
UINT16 width, height;
|
||||
UINT32 downloaded; // tex_downloaded
|
||||
UINT32 downloaded; // The GPU has this texture.
|
||||
|
||||
struct GLMipmap_s *nextcolormap;
|
||||
const UINT8 *colormap;
|
||||
@@ -50,12 +52,12 @@ struct GLMipmap_s
|
||||
typedef struct GLMipmap_s GLMipmap_t;
|
||||
|
||||
//
|
||||
// Doom texture info, as cached for hardware rendering
|
||||
// Level textures, as cached for hardware rendering.
|
||||
//
|
||||
struct GLMapTexture_s
|
||||
{
|
||||
GLMipmap_t mipmap;
|
||||
float scaleX; //used for scaling textures on walls
|
||||
float scaleX; //used for scaling textures on walls
|
||||
float scaleY;
|
||||
};
|
||||
typedef struct GLMapTexture_s GLMapTexture_t;
|
||||
|
||||
+41
-7
@@ -132,14 +132,14 @@ typedef struct
|
||||
{
|
||||
FLOAT x,y,z; // position
|
||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
||||
FLOAT anglex,angley,anglez; // aimingangle / viewangle
|
||||
FLOAT anglex2,anglez2; // secondaries
|
||||
FLOAT anglex, angley, anglez; // aimingangle / viewangle
|
||||
FLOAT anglex2, anglez2; // secondaries
|
||||
#else
|
||||
FLOAT anglex,angley; // aimingangle / viewangle
|
||||
FLOAT anglex, angley; // aimingangle / viewangle
|
||||
FLOAT anglex2; // secondaries
|
||||
#endif
|
||||
FLOAT scalex,scaley,scalez;
|
||||
FLOAT spritexscale,spriteyscale;
|
||||
FLOAT scalex, scaley, scalez;
|
||||
FLOAT spritexscale, spriteyscale;
|
||||
FLOAT fovxangle, fovyangle;
|
||||
UINT8 splitscreen;
|
||||
boolean flip; // screenflip
|
||||
@@ -164,6 +164,41 @@ typedef struct
|
||||
FLOAT s,t;
|
||||
} FOutVector;
|
||||
|
||||
typedef struct vbo_vertex_s
|
||||
{
|
||||
float x, y, z;
|
||||
float u, v;
|
||||
unsigned char r, g, b, a;
|
||||
} gl_skyvertex_t;
|
||||
|
||||
typedef enum gl_skyloopmode_e
|
||||
{
|
||||
HWD_SKYLOOP_FAN,
|
||||
HWD_SKYLOOP_STRIP
|
||||
} gl_skyloopmode_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gl_skyloopmode_t mode;
|
||||
int vertexcount;
|
||||
int vertexindex;
|
||||
boolean use_texture;
|
||||
} gl_skyloopdef_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int vbo;
|
||||
int rows, columns;
|
||||
int loopcount;
|
||||
|
||||
int detail, vertex_count;
|
||||
int texture, width, height;
|
||||
boolean rebuild; // VBO needs to be rebuilt
|
||||
|
||||
gl_skyloopdef_t *loops;
|
||||
gl_skyvertex_t *data;
|
||||
} gl_sky_t;
|
||||
|
||||
// Shader targets used to render specific types of geometry.
|
||||
// A shader target is resolved to an actual shader with HWR_GetShaderFromTarget.
|
||||
// The shader returned may be a base shader or a custom shader.
|
||||
@@ -171,7 +206,6 @@ enum
|
||||
{
|
||||
SHADER_NONE = -1,
|
||||
SHADER_FLOOR = 0,
|
||||
SHADER_SHADOW,
|
||||
SHADER_WALL,
|
||||
SHADER_SPRITE,
|
||||
SHADER_MODEL,
|
||||
@@ -202,7 +236,6 @@ enum hwdshaderstage
|
||||
|
||||
typedef enum hwdshaderstage hwdshaderstage_t;
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// RENDER MODES
|
||||
// ==========================================================================
|
||||
@@ -341,6 +374,7 @@ enum hwdscreentexture
|
||||
HWD_SCREENTEXTURE_WIPE_END, // destination image for the wipe/fade effect
|
||||
HWD_SCREENTEXTURE_GENERIC1, // underwater/heat effect, intermission background
|
||||
HWD_SCREENTEXTURE_GENERIC2, // palette-based colormap fade, final screen texture
|
||||
HWD_SCREENTEXTURE_VHS,
|
||||
NUMSCREENTEXTURES, // (generic3 is unused if palette rendering is disabled)
|
||||
};
|
||||
typedef enum hwdscreentexture hwdscreentexture_t;
|
||||
|
||||
+17
-17
@@ -552,23 +552,23 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
||||
// 0--1
|
||||
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
{
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
FBITFIELD poly_flags = PF_NoTexture|PF_Modulated|PF_NoDepthTest;
|
||||
|
||||
v[0].x = v[3].x = -1.0f;
|
||||
v[2].x = v[1].x = 1.0f;
|
||||
v[0].y = v[1].y = -1.0f;
|
||||
v[2].y = v[3].y = 1.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
v[0].x = v[3].x = -1.0f;
|
||||
v[2].x = v[1].x = 1.0f;
|
||||
v[0].y = v[1].y = -1.0f;
|
||||
v[2].y = v[3].y = 1.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 1.0f;
|
||||
v[2].t = v[3].t = 0.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 1.0f;
|
||||
v[2].t = v[3].t = 0.0f;
|
||||
|
||||
if (color & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
if (color & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
if (HWR_ShouldUsePaletteRendering() && cv_glscreentextures.value)
|
||||
{
|
||||
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
|
||||
@@ -588,9 +588,9 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
Surf.PolyColor.s.alpha = (strength*8);
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
Surf.PolyColor.rgba = palette[color&0xFF].rgba;
|
||||
|
||||
@@ -600,7 +600,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f);
|
||||
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, poly_flags);
|
||||
}
|
||||
|
||||
@@ -54,13 +54,13 @@ EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *stransform);
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
||||
|
||||
EXPORT void HWRAPI(RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform);
|
||||
EXPORT void HWRAPI(RenderSkyDome) (gl_sky_t *sky);
|
||||
|
||||
EXPORT void HWRAPI(FlushScreenTextures) (void);
|
||||
EXPORT void HWRAPI(DoScreenWipe) (int wipeStart, int wipeEnd);
|
||||
EXPORT void HWRAPI(DrawScreenTexture) (int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
EXPORT void HWRAPI(MakeScreenTexture) (int tex);
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height);
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height, boolean useshader);
|
||||
|
||||
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
|
||||
|
||||
+321
-159
@@ -3106,11 +3106,8 @@ static void HWR_RenderBSPNode(INT32 bspnum)
|
||||
{
|
||||
ps_numbspcalls.value.i++;
|
||||
|
||||
// Front sides.
|
||||
while ((short)bspnum >= 0)
|
||||
{
|
||||
if (sp == MAX_BSP_DEPTH)
|
||||
break;
|
||||
// Decide which side the view point is on.
|
||||
side = R_PointOnSideFast(viewx, viewy, bsp);
|
||||
|
||||
bsp = &nodes[bspnum];
|
||||
|
||||
@@ -3217,7 +3214,7 @@ static gl_vissprite_t *HWR_NewVisSprite(void)
|
||||
// Finds a floor through which light does not pass.
|
||||
static fixed_t HWR_OpaqueFloorAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
|
||||
{
|
||||
const sector_t *sec = R_PointInSubsector(x, y)->sector;
|
||||
const sector_t *sec = R_PointInSubsectorFast(x, y)->sector;
|
||||
fixed_t floorz = sec->floorheight;
|
||||
|
||||
if (sec->ffloors)
|
||||
@@ -3258,8 +3255,6 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, GLPatch_t *gpatch)
|
||||
pslope_t *floorslope;
|
||||
fixed_t slopez;
|
||||
float offset = 0;
|
||||
|
||||
INT32 shader = SHADER_NONE;
|
||||
|
||||
// technically this_scale gets multiplied and added to sprite y/x scale, but this thing needs it for some crap so ill just throw it in here again
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->flags & SF_HIRES);
|
||||
@@ -3267,7 +3262,7 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, GLPatch_t *gpatch)
|
||||
this_scale = FIXED_TO_FLOAT(spr->mobj->scale);
|
||||
if (hires)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->highresscale);
|
||||
|
||||
|
||||
R_GetShadowZ(spr->mobj, &floorslope);
|
||||
|
||||
mobjfloor = HWR_OpaqueFloorAtPos(
|
||||
@@ -3363,7 +3358,7 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, GLPatch_t *gpatch)
|
||||
swallVerts[0].z = spr->z1 + offset * gl_viewsin;
|
||||
swallVerts[1].z = spr->z2 + offset * gl_viewsin;
|
||||
}
|
||||
|
||||
|
||||
if (floorslope)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
@@ -3416,86 +3411,113 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, GLPatch_t *gpatch)
|
||||
if (sSurf.PolyColor.s.alpha > floorheight/4)
|
||||
{
|
||||
sSurf.PolyColor.s.alpha = (UINT8)(sSurf.PolyColor.s.alpha - floorheight/4);
|
||||
|
||||
if (HWR_UseShader())
|
||||
{
|
||||
shader = SHADER_SHADOW;
|
||||
blendmode |= PF_ColorMapped;
|
||||
}
|
||||
|
||||
HWR_ProcessPolygon(&sSurf, swallVerts, 4, blendmode|PF_Translucent|PF_Modulated, shader, false);
|
||||
HWR_ProcessPolygon(&sSurf, swallVerts, 4, blendmode|PF_Translucent|PF_Modulated, SHADER_NONE, false);
|
||||
}
|
||||
}
|
||||
|
||||
// This is expecting a pointer to an array containing 4 wallVerts for a sprite
|
||||
static void HWR_RotateSpritePolyToAim(gl_vissprite_t *spr, FOutVector *wallVerts, const boolean precip)
|
||||
{
|
||||
if (cv_glspritebillboarding.value && spr && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE) && wallVerts)
|
||||
if (!cv_glspritebillboarding.value || !spr || !spr->mobj || !wallVerts)
|
||||
{
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
float basey, lowy;
|
||||
INT32 dist = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cv_maxinterpdist.value)
|
||||
dist = R_QuickCamDist(spr->mobj->x, spr->mobj->y);
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
float basey, lowy;
|
||||
INT32 dist = -1;
|
||||
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
|
||||
if (cv_maxinterpdist.value)
|
||||
dist = R_QuickCamDist(spr->mobj->x, spr->mobj->y);
|
||||
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
|
||||
{
|
||||
if (precip)
|
||||
{
|
||||
if (precip)
|
||||
{
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (precip)
|
||||
{
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
R_InterpolateMobjState(spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
|
||||
if (!precip && P_MobjFlip(spr->mobj) == -1) // precip doesn't have eflags so they can't flip
|
||||
}
|
||||
else
|
||||
{
|
||||
if (precip)
|
||||
{
|
||||
basey = FIXED_TO_FLOAT(interp.z + spr->mobj->height);
|
||||
R_InterpolatePrecipMobjState((precipmobj_t *)spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
else
|
||||
{
|
||||
basey = FIXED_TO_FLOAT(interp.z);
|
||||
R_InterpolateMobjState(spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
lowy = wallVerts[0].y;
|
||||
}
|
||||
|
||||
// Rotate sprites to fully billboard with the camera
|
||||
// X, Y, AND Z need to be manipulated for the polys to rotate around the
|
||||
// origin, because of how the origin setting works I believe that should
|
||||
// be mobj->z or mobj->z + mobj->height
|
||||
wallVerts[2].y = wallVerts[3].y = (spr->gzt - basey) * gl_viewludsin + basey;
|
||||
wallVerts[0].y = wallVerts[1].y = (lowy - basey) * gl_viewludsin + basey;
|
||||
// translate back to be around 0 before translating back
|
||||
wallVerts[3].x += ((spr->gzt - basey) * gl_viewludcos) * gl_viewcos;
|
||||
wallVerts[2].x += ((spr->gzt - basey) * gl_viewludcos) * gl_viewcos;
|
||||
if (!precip && P_MobjFlip(spr->mobj) == -1) // precip doesn't have eflags so they can't flip
|
||||
{
|
||||
basey = FIXED_TO_FLOAT(interp.z + spr->mobj->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
basey = FIXED_TO_FLOAT(interp.z);
|
||||
}
|
||||
lowy = wallVerts[0].y;
|
||||
|
||||
wallVerts[0].x += ((lowy - basey) * gl_viewludcos) * gl_viewcos;
|
||||
wallVerts[1].x += ((lowy - basey) * gl_viewludcos) * gl_viewcos;
|
||||
// Rotate sprites to fully billboard with the camera
|
||||
// X, Y, AND Z need to be manipulated for the polys to rotate around the
|
||||
// origin, because of how the origin setting works I believe that should
|
||||
// be mobj->z or mobj->z + mobj->height
|
||||
wallVerts[2].y = wallVerts[3].y = (spr->gzt - basey) * gl_viewludsin + basey;
|
||||
wallVerts[0].y = wallVerts[1].y = (lowy - basey) * gl_viewludsin + basey;
|
||||
// translate back to be around 0 before translating back
|
||||
wallVerts[3].x += ((spr->gzt - basey) * gl_viewludcos) * gl_viewcos;
|
||||
wallVerts[2].x += ((spr->gzt - basey) * gl_viewludcos) * gl_viewcos;
|
||||
|
||||
wallVerts[3].z += ((spr->gzt - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[2].z += ((spr->gzt - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[0].x += ((lowy - basey) * gl_viewludcos) * gl_viewcos;
|
||||
wallVerts[1].x += ((lowy - basey) * gl_viewludcos) * gl_viewcos;
|
||||
|
||||
wallVerts[0].z += ((lowy - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[1].z += ((lowy - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[3].z += ((spr->gzt - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[2].z += ((spr->gzt - basey) * gl_viewludcos) * gl_viewsin;
|
||||
|
||||
wallVerts[0].z += ((lowy - basey) * gl_viewludcos) * gl_viewsin;
|
||||
wallVerts[1].z += ((lowy - basey) * gl_viewludcos) * gl_viewsin;
|
||||
}
|
||||
|
||||
static inline void HWR_ApplyDispoffset(gl_vissprite_t *spr, FOutVector *wallVerts, const boolean papersprite)
|
||||
{
|
||||
// dont push papersprites near the cam unless they have a dispoffset
|
||||
if (papersprite)
|
||||
{
|
||||
// if it has a dispoffset, push it a little towards the camera
|
||||
if (spr->dispoffset)
|
||||
{
|
||||
float co = -gl_viewcos*(0.05f*spr->dispoffset);
|
||||
float si = -gl_viewsin*(0.05f*spr->dispoffset);
|
||||
wallVerts[0].z = wallVerts[3].z = wallVerts[0].z+si;
|
||||
wallVerts[1].z = wallVerts[2].z = wallVerts[1].z+si;
|
||||
wallVerts[0].x = wallVerts[3].x = wallVerts[0].x+co;
|
||||
wallVerts[1].x = wallVerts[2].x = wallVerts[1].x+co;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts, false);
|
||||
|
||||
float sprdist = sqrtf((spr->x1 - gl_viewx)*(spr->x1 - gl_viewx) + (spr->z1 - gl_viewy)*(spr->z1 - gl_viewy) + (spr->gzt - gl_viewz)*(spr->gzt - gl_viewz));
|
||||
float distfact = ((2.0f*spr->dispoffset) + 20.0f) / sprdist;
|
||||
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
{
|
||||
wallVerts[i].x += (gl_viewx - wallVerts[i].x)*distfact;
|
||||
wallVerts[i].z += (gl_viewy - wallVerts[i].z)*distfact;
|
||||
wallVerts[i].y += (gl_viewz - wallVerts[i].y)*distfact;
|
||||
}
|
||||
}
|
||||
|
||||
static void HWR_SplitSprite(gl_vissprite_t *spr)
|
||||
static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
||||
{
|
||||
FOutVector wallVerts[4];
|
||||
FOutVector baseWallVerts[4]; // This is what the verts should end up as
|
||||
@@ -3577,25 +3599,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
|
||||
}
|
||||
|
||||
// push it toward the camera to mitigate floor-clipping sprites
|
||||
if (papersprite)
|
||||
{
|
||||
// if it has a dispoffset, push it a little towards the camera
|
||||
if (spr->dispoffset) {
|
||||
float co = -gl_viewcos*(0.05f*spr->dispoffset);
|
||||
float si = -gl_viewsin*(0.05f*spr->dispoffset);
|
||||
baseWallVerts[0].z = baseWallVerts[3].z = baseWallVerts[0].z+si;
|
||||
baseWallVerts[1].z = baseWallVerts[2].z = baseWallVerts[1].z+si;
|
||||
baseWallVerts[0].x = baseWallVerts[3].x = baseWallVerts[0].x+co;
|
||||
baseWallVerts[1].x = baseWallVerts[2].x = baseWallVerts[1].x+co;
|
||||
}
|
||||
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
HWR_RotateSpritePolyToAim(spr, baseWallVerts, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
HWR_RotateSpritePolyToAim(spr, baseWallVerts, false);
|
||||
HWR_ApplyDispoffset(spr, baseWallVerts, papersprite);
|
||||
|
||||
float sprdist = sqrtf((spr->x1 - gl_viewx)*(spr->x1 - gl_viewx) + (spr->z1 - gl_viewy)*(spr->z1 - gl_viewy) + (spr->gzt - gl_viewz)*(spr->gzt - gl_viewz));
|
||||
float distfact = ((2.0f*spr->dispoffset) + 20.0f) / sprdist;
|
||||
@@ -3724,7 +3728,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
|
||||
wallVerts[1].y = endbot;
|
||||
|
||||
// The x and y only need to be adjusted in the case that it's not a papersprite
|
||||
if (cv_glspritebillboarding.value && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE))
|
||||
if (cv_glspritebillboarding.value && spr->mobj && !papersprite)
|
||||
{
|
||||
// Get the x and z of the vertices so billboarding draws correctly
|
||||
realheight = realbot - realtop;
|
||||
@@ -3800,9 +3804,11 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||
if (!spr->mobj->subsector)
|
||||
return;
|
||||
|
||||
const boolean papersprite = (spr->mobj->frame & FF_PAPERSPRITE);
|
||||
|
||||
if (spr->mobj->subsector->sector->numlights)
|
||||
{
|
||||
HWR_SplitSprite(spr);
|
||||
HWR_SplitSprite(spr, papersprite);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3871,26 +3877,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
|
||||
}
|
||||
|
||||
// push it toward the camera to mitigate floor-clipping sprites
|
||||
if (papersprite) // but not for papersprites
|
||||
{
|
||||
// if it has a dispoffset, push it a little towards the camera
|
||||
if (spr->dispoffset) {
|
||||
float co = -gl_viewcos*(0.05f*spr->dispoffset);
|
||||
float si = -gl_viewsin*(0.05f*spr->dispoffset);
|
||||
wallVerts[0].z = wallVerts[3].z = wallVerts[0].z+si;
|
||||
wallVerts[1].z = wallVerts[2].z = wallVerts[1].z+si;
|
||||
wallVerts[0].x = wallVerts[3].x = wallVerts[0].x+co;
|
||||
wallVerts[1].x = wallVerts[2].x = wallVerts[1].x+co;
|
||||
}
|
||||
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
// ...nah
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts, false);
|
||||
HWR_ApplyDispoffset(spr, wallVerts, papersprite);
|
||||
|
||||
float sprdist = sqrtf((spr->x1 - gl_viewx)*(spr->x1 - gl_viewx) + (spr->z1 - gl_viewy)*(spr->z1 - gl_viewy) + (spr->gzt - gl_viewz)*(spr->gzt - gl_viewz));
|
||||
float distfact = ((2.0f*spr->dispoffset) + 20.0f) / sprdist;
|
||||
@@ -3983,7 +3970,6 @@ static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
|
||||
wallVerts[0].z = wallVerts[3].z = spr->z1;
|
||||
wallVerts[1].z = wallVerts[2].z = spr->z2;
|
||||
|
||||
// Let dispoffset work first since this adjust each vertex
|
||||
HWR_RotateSpritePolyToAim(spr, wallVerts, true);
|
||||
|
||||
wallVerts[0].s = wallVerts[3].s = 0;
|
||||
@@ -4510,12 +4496,11 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
size_t lumpoff;
|
||||
unsigned rot;
|
||||
UINT8 flip;
|
||||
boolean vflip;
|
||||
boolean mirrored;
|
||||
boolean hflip;
|
||||
|
||||
angle_t ang, camang;
|
||||
boolean papersprite;
|
||||
angle_t ang = 0;
|
||||
#ifdef ROTSPRITE
|
||||
angle_t camang = 0;
|
||||
#endif
|
||||
INT32 heightsec, phs;
|
||||
INT32 dist = -1;
|
||||
|
||||
@@ -4524,7 +4509,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
#ifdef ROTSPRITE
|
||||
patch_t *rotsprite = NULL;
|
||||
INT32 rollangle = 0;
|
||||
angle_t rollsum = 0;
|
||||
angle_t pitchnroll = 0;
|
||||
angle_t sliptiderollangle = 0;
|
||||
#endif
|
||||
|
||||
@@ -4534,10 +4519,10 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
|
||||
vflip = (thing->eflags & MFE_VERTICALFLIP);
|
||||
mirrored = thing->mirrored;
|
||||
hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
|
||||
papersprite = (thing->frame & FF_PAPERSPRITE);
|
||||
const boolean mirrored = thing->mirrored;
|
||||
const boolean vflip = (thing->eflags & MFE_VERTICALFLIP);
|
||||
const boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
|
||||
const boolean papersprite = (thing->frame & FF_PAPERSPRITE);
|
||||
|
||||
if (cv_maxinterpdist.value)
|
||||
dist = R_QuickCamDist(thing->x, thing->y);
|
||||
@@ -4579,7 +4564,13 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
I_Error("HWR_ProjectSprite: invalid sprite number %i ", thing->sprite);
|
||||
#endif
|
||||
|
||||
rot = thing->frame&FF_FRAMEMASK;
|
||||
rot = (thing->frame & FF_FRAMEMASK);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// determine here if sprite should rotate for optimization
|
||||
const boolean sliprollrotate = (cv_sloperoll.value && cv_sliptideroll.value && (thing->player && thing->player->sliproll));
|
||||
const boolean shouldrotate = (cv_sloperoll.value && (interp.roll || interp.pitch || interp.sloperoll || interp.slopepitch || thing->rollangle || sliprollrotate));
|
||||
#endif
|
||||
|
||||
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
|
||||
if ((thing->skin || thing->localskin) && thing->sprite == SPR_PLAY)
|
||||
@@ -4607,7 +4598,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &spriteinfo[thing->sprite];
|
||||
#endif
|
||||
rot = thing->frame&FF_FRAMEMASK;
|
||||
rot = (thing->frame & FF_FRAMEMASK);
|
||||
thing->state->sprite = thing->sprite;
|
||||
thing->state->frame = thing->frame;
|
||||
}
|
||||
@@ -4619,11 +4610,23 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
I_Error("sprframes NULL for sprite %d\n", thing->sprite);
|
||||
#endif
|
||||
|
||||
ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
|
||||
camang = R_PointToAngle (interp.x, interp.y);
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite ||
|
||||
#ifdef ROTSPRITE
|
||||
(shouldrotate)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
ang = R_PointToAngle(interp.x, interp.y);
|
||||
|
||||
if (mirrored)
|
||||
ang = InvAngle(ang);
|
||||
#ifdef ROTSPRITE
|
||||
camang = ang;
|
||||
#endif
|
||||
|
||||
ang -= interp.angle;
|
||||
|
||||
if (mirrored)
|
||||
ang = InvAngle(ang);
|
||||
}
|
||||
|
||||
if (sprframe->rotate == SRF_SINGLE)
|
||||
{
|
||||
@@ -4662,25 +4665,32 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
spr_topoffset = spritecachedinfo[lumpoff].topoffset;
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (cv_spriteroll.value)
|
||||
if (shouldrotate)
|
||||
{
|
||||
rollangle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), interp.roll)
|
||||
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), interp.pitch)
|
||||
+ FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), interp.sloperoll)
|
||||
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), interp.slopepitch)
|
||||
+ thing->rollangle;
|
||||
|
||||
if ((rollangle)||(thing->player && thing->player->sliproll))
|
||||
if (papersprite)
|
||||
{
|
||||
if (thing->player)
|
||||
// a positive rollangle should should pitch papersprites upwards relative to their facing angle
|
||||
rollangle = InvAngle(thing->rollangle);
|
||||
}
|
||||
else
|
||||
{
|
||||
// this is very messy, but it on-the-fly calculates rotations for all the
|
||||
// pitch and roll variables
|
||||
pitchnroll = R_RotationAngle(ang, camang, &interp);
|
||||
rollangle = thing->rollangle;
|
||||
}
|
||||
|
||||
if (rollangle || pitchnroll || sliprollrotate)
|
||||
{
|
||||
if (sliprollrotate)
|
||||
{
|
||||
sliptiderollangle = cv_sliptideroll.value ? thing->player->sliproll*(thing->player->sliptidemem) : 0;
|
||||
rollsum = rollangle+FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), sliptiderollangle);
|
||||
sliptiderollangle = thing->player->sliproll * thing->player->kartstuff[k_aizdriftstrat];
|
||||
pitchnroll += rollangle + FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), sliptiderollangle);
|
||||
}
|
||||
else
|
||||
rollsum = rollangle;
|
||||
pitchnroll += rollangle;
|
||||
|
||||
rollangle = R_GetRollAngle(rollsum);
|
||||
rollangle = R_GetRollAngle(pitchnroll);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
|
||||
|
||||
if (rotsprite != NULL)
|
||||
@@ -4787,7 +4797,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||
vis->spriteyoffset = FIXED_TO_FLOAT(spr_topoffset);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if ((rotsprite) && (cv_spriteroll.value))
|
||||
if (rotsprite != NULL)
|
||||
vis->gpatch = (GLPatch_t *)rotsprite;
|
||||
else
|
||||
#endif
|
||||
@@ -4913,7 +4923,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
return;
|
||||
#endif
|
||||
|
||||
sprframe = &sprdef->spriteframes[ thing->frame & FF_FRAMEMASK];
|
||||
sprframe = &sprdef->spriteframes[thing->frame & FF_FRAMEMASK];
|
||||
|
||||
// use single rotation for all views
|
||||
lumpoff = sprframe->lumpid[0];
|
||||
@@ -4968,40 +4978,188 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
vis->precip = true;
|
||||
}
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// Sky dome rendering, ported from PrBoom+
|
||||
// ==========================================================================
|
||||
|
||||
static gl_sky_t gl_sky;
|
||||
|
||||
static void HWR_SkyDomeVertex(gl_sky_t *sky, gl_skyvertex_t *vbo, int r, int c, signed char yflip, float delta, boolean foglayer)
|
||||
{
|
||||
const float radians = (float)(M_PIl / 180.0f);
|
||||
const float scale = 10000.0f;
|
||||
const float maxSideAngle = 60.0f;
|
||||
|
||||
float topAngle = (c / (float)sky->columns * 360.0f);
|
||||
float sideAngle = (maxSideAngle * (sky->rows - r) / sky->rows);
|
||||
float height = (float)(sin(sideAngle * radians));
|
||||
float realRadius = (float)(scale * cos(sideAngle * radians));
|
||||
float x = (float)(realRadius * cos(topAngle * radians));
|
||||
float y = (!yflip) ? scale * height : -scale * height;
|
||||
float z = (float)(realRadius * sin(topAngle * radians));
|
||||
float timesRepeat = (4 * (256.0f / sky->width));
|
||||
if (fpclassify(timesRepeat) == FP_ZERO)
|
||||
timesRepeat = 1.0f;
|
||||
|
||||
if (!foglayer)
|
||||
{
|
||||
vbo->r = 255;
|
||||
vbo->g = 255;
|
||||
vbo->b = 255;
|
||||
vbo->a = (r == 0 ? 0 : 255);
|
||||
|
||||
// And the texture coordinates.
|
||||
vbo->u = (-timesRepeat * c / (float)sky->columns);
|
||||
if (!yflip) // Flipped Y is for the lower hemisphere.
|
||||
vbo->v = (r / (float)sky->rows) + 0.5f;
|
||||
else
|
||||
vbo->v = 1.0f + ((sky->rows - r) / (float)sky->rows) + 0.5f;
|
||||
}
|
||||
|
||||
if (r != 4)
|
||||
y += 300.0f;
|
||||
|
||||
// And finally the vertex.
|
||||
vbo->x = x;
|
||||
vbo->y = y + delta;
|
||||
vbo->z = z;
|
||||
}
|
||||
|
||||
// Clears the sky dome.
|
||||
void HWR_ClearSkyDome(void)
|
||||
{
|
||||
gl_sky_t *sky = &gl_sky;
|
||||
|
||||
if (sky->loops)
|
||||
free(sky->loops);
|
||||
if (sky->data)
|
||||
free(sky->data);
|
||||
|
||||
sky->loops = NULL;
|
||||
sky->data = NULL;
|
||||
|
||||
sky->vbo = 0;
|
||||
sky->rows = sky->columns = 0;
|
||||
sky->loopcount = 0;
|
||||
|
||||
sky->detail = 0;
|
||||
sky->texture = -1;
|
||||
sky->width = sky->height = 0;
|
||||
|
||||
sky->rebuild = true;
|
||||
}
|
||||
|
||||
void HWR_BuildSkyDome(void)
|
||||
{
|
||||
int c, r;
|
||||
signed char yflip;
|
||||
int row_count = 4;
|
||||
int col_count = 4;
|
||||
float delta;
|
||||
|
||||
gl_sky_t *sky = &gl_sky;
|
||||
gl_skyvertex_t *vertex_p;
|
||||
texture_t *texture = textures[texturetranslation[skytexture]];
|
||||
|
||||
sky->detail = 16;
|
||||
col_count *= sky->detail;
|
||||
|
||||
if ((sky->columns != col_count) || (sky->rows != row_count))
|
||||
HWR_ClearSkyDome();
|
||||
|
||||
sky->columns = col_count;
|
||||
sky->rows = row_count;
|
||||
sky->vertex_count = 2 * sky->rows * (sky->columns * 2 + 2) + sky->columns * 2;
|
||||
|
||||
if (!sky->loops)
|
||||
sky->loops = malloc((sky->rows * 2 + 2) * sizeof(sky->loops[0]));
|
||||
|
||||
// create vertex array
|
||||
if (!sky->data)
|
||||
sky->data = malloc(sky->vertex_count * sizeof(sky->data[0]));
|
||||
|
||||
sky->texture = texturetranslation[skytexture];
|
||||
sky->width = texture->width;
|
||||
sky->height = texture->height;
|
||||
|
||||
vertex_p = &sky->data[0];
|
||||
sky->loopcount = 0;
|
||||
|
||||
for (yflip = 0; yflip < 2; yflip++)
|
||||
{
|
||||
sky->loops[sky->loopcount].mode = HWD_SKYLOOP_FAN;
|
||||
sky->loops[sky->loopcount].vertexindex = vertex_p - &sky->data[0];
|
||||
sky->loops[sky->loopcount].vertexcount = col_count;
|
||||
sky->loops[sky->loopcount].use_texture = false;
|
||||
sky->loopcount++;
|
||||
|
||||
delta = 0.0f;
|
||||
|
||||
for (c = 0; c < col_count; c++)
|
||||
{
|
||||
HWR_SkyDomeVertex(sky, vertex_p, 1, c, yflip, 0.0f, true);
|
||||
vertex_p->r = 255;
|
||||
vertex_p->g = 255;
|
||||
vertex_p->b = 255;
|
||||
vertex_p->a = 255;
|
||||
vertex_p++;
|
||||
}
|
||||
|
||||
delta = (yflip ? 5.0f : -5.0f) / 128.0f;
|
||||
|
||||
for (r = 0; r < row_count; r++)
|
||||
{
|
||||
sky->loops[sky->loopcount].mode = HWD_SKYLOOP_STRIP;
|
||||
sky->loops[sky->loopcount].vertexindex = vertex_p - &sky->data[0];
|
||||
sky->loops[sky->loopcount].vertexcount = 2 * col_count + 2;
|
||||
sky->loops[sky->loopcount].use_texture = true;
|
||||
sky->loopcount++;
|
||||
|
||||
for (c = 0; c <= col_count; c++)
|
||||
{
|
||||
HWR_SkyDomeVertex(sky, vertex_p++, r + (yflip ? 1 : 0), (c ? c : 0), yflip, delta, false);
|
||||
HWR_SkyDomeVertex(sky, vertex_p++, r + (yflip ? 0 : 1), (c ? c : 0), yflip, delta, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static boolean drewsky = false;
|
||||
|
||||
static void HWR_DrawSkyBackground(float fpov)
|
||||
static void HWR_DrawSkyBackground(void)
|
||||
{
|
||||
FTransform dometransform;
|
||||
|
||||
if (drewsky)
|
||||
return;
|
||||
|
||||
memset(&dometransform, 0x00, sizeof(FTransform));
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||
|
||||
memcpy(&dometransform, &atransform, sizeof(FTransform));
|
||||
|
||||
dometransform.x = 0.0;
|
||||
dometransform.y = 0.0;
|
||||
dometransform.z = 0.0;
|
||||
|
||||
//04/01/2000: Hurdler: added for T&L
|
||||
// It should replace all other gl_viewxxx when finished
|
||||
HWR_SetTransformAiming(&dometransform);
|
||||
dometransform.angley = (float)((viewangle-ANGLE_270)>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
|
||||
|
||||
dometransform.flip = atransform.flip;
|
||||
dometransform.mirror = atransform.mirror;
|
||||
dometransform.mirrorflip = atransform.mirrorflip;
|
||||
|
||||
dometransform.scalex = 1;
|
||||
dometransform.scaley = (float)vid.width/vid.height;
|
||||
dometransform.scalez = 1;
|
||||
dometransform.fovxangle = fpov; // Tails
|
||||
dometransform.fovyangle = fpov; // Tails
|
||||
HWR_RollTransform(&dometransform, viewroll);
|
||||
dometransform.splitscreen = splitscreen;
|
||||
|
||||
HWR_GetTexture(texturetranslation[skytexture], false);
|
||||
if (HWR_UseShader())
|
||||
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_SKY));// sky shader
|
||||
HWD.pfnRenderSkyDome(skytexture, textures[skytexture]->width, textures[skytexture]->height, dometransform);
|
||||
}
|
||||
|
||||
if (gl_sky.texture != texturetranslation[skytexture])
|
||||
{
|
||||
HWR_ClearSkyDome();
|
||||
HWR_BuildSkyDome();
|
||||
}
|
||||
|
||||
if (HWR_UseShader())
|
||||
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_SKY));
|
||||
HWD.pfnSetTransform(&dometransform);
|
||||
HWD.pfnRenderSkyDome(&gl_sky);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// HWR_ClearView : clear the viewwindow, with maximum z value. also clears stencil buffer.
|
||||
@@ -5216,7 +5374,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
HWR_SkyWallList_Clear();
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, 1);
|
||||
drewsky = false;
|
||||
HWR_DrawSkyBackground(fpov);
|
||||
HWR_DrawSkyBackground();
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, 0);
|
||||
HWD.pfnClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
|
||||
HWR_SetTransform(fpov, player);// restore transform
|
||||
@@ -5281,7 +5439,7 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
ST_doPaletteStuff();
|
||||
|
||||
// Draw the sky background.
|
||||
HWR_DrawSkyBackground(fpov);
|
||||
HWR_DrawSkyBackground();
|
||||
if (skybox)
|
||||
drewsky = true;
|
||||
|
||||
@@ -5379,6 +5537,10 @@ void HWR_LoadLevel(void)
|
||||
|
||||
HWR_CreatePlanePolygons((INT32)numnodes - 1);
|
||||
|
||||
// Build the sky dome
|
||||
HWR_ClearSkyDome();
|
||||
HWR_BuildSkyDome();
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
HWR_SetMapPalette();
|
||||
}
|
||||
@@ -5695,9 +5857,9 @@ void HWR_MakeScreenFinalTexture(void)
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
|
||||
}
|
||||
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height)
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader)
|
||||
{
|
||||
HWD.pfnDrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height);
|
||||
HWD.pfnDrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader);
|
||||
}
|
||||
|
||||
#endif // HWRENDER
|
||||
@@ -105,6 +105,9 @@ void HWR_AddCommands(void);
|
||||
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
|
||||
void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals);
|
||||
|
||||
void HWR_ClearSkyDome(void);
|
||||
void HWR_BuildSkyDome(void);
|
||||
|
||||
void HWR_SetTransform(float fpov, player_t *player);
|
||||
void HWR_ClearClipper(void);
|
||||
void HWR_SetStencilState(int state, int level);
|
||||
@@ -131,7 +134,7 @@ void HWR_DrawIntermissionBG(void);
|
||||
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum);
|
||||
void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void HWR_MakeScreenFinalTexture(void);
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height);
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader);
|
||||
|
||||
// hw_main.c: Segs
|
||||
void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
+34
-38
@@ -680,7 +680,7 @@ spritemd2found:
|
||||
#define SETBRIGHTNESS(brightness,r,g,b) \
|
||||
brightness = (UINT8)(((1063*(UINT32)(r))/5000) + ((3576*(UINT32)(g))/5000) + ((361*(UINT32)(b))/5000))
|
||||
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *glmip, INT32 skinnum, skincolors_t color)
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *glMipmap, INT32 skinnum, skincolors_t color)
|
||||
{
|
||||
UINT16 w = gpatch->width, h = gpatch->height;
|
||||
UINT32 size = w*h;
|
||||
@@ -696,24 +696,24 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
||||
memset(translation, 0, sizeof(translation));
|
||||
memset(cutoff, 0, sizeof(cutoff));
|
||||
|
||||
if (glmip->width == 0)
|
||||
if (glMipmap->width == 0)
|
||||
{
|
||||
glmip->width = gpatch->width;
|
||||
glmip->height = gpatch->height;
|
||||
glMipmap->width = gpatch->width;
|
||||
glMipmap->height = gpatch->height;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
glmip->flags = 0;
|
||||
glMipmap->flags = 0;
|
||||
// setup the texture info
|
||||
glmip->format = GL_TEXFMT_RGBA;
|
||||
glMipmap->format = GL_TEXFMT_RGBA;
|
||||
}
|
||||
|
||||
if (glmip->data)
|
||||
if (glMipmap->data)
|
||||
{
|
||||
Z_Free(glmip->data);
|
||||
glmip->data = NULL;
|
||||
Z_Free(glMipmap->data);
|
||||
glMipmap->data = NULL;
|
||||
}
|
||||
|
||||
cur = Z_Malloc(size*4, PU_HWRCACHE, &glmip->data);
|
||||
cur = Z_Malloc(size*4, PU_HWRCACHE, &glMipmap->data);
|
||||
memset(cur, 0x00, size*4);
|
||||
|
||||
image = gpatch->mipmap->data;
|
||||
@@ -794,10 +794,9 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (translen > 0)
|
||||
colorbrightnesses[translen] = colorbrightnesses[translen-1];
|
||||
}
|
||||
|
||||
while (size--)
|
||||
{
|
||||
@@ -1044,7 +1043,7 @@ skippixel:
|
||||
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolors_t color)
|
||||
{
|
||||
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
|
||||
GLMipmap_t *glmip, *newmip;
|
||||
GLMipmap_t *glMipmap, *newMipmap;
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
@@ -1053,19 +1052,20 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mimmap
|
||||
// search for the Mipmap
|
||||
// skip the first (no colormap translated)
|
||||
for (glmip = gpatch->mipmap; glmip->nextcolormap; )
|
||||
for (glMipmap = gpatch->mipmap; glMipmap->nextcolormap; )
|
||||
{
|
||||
glmip = glmip->nextcolormap;
|
||||
if (glmip->colormap == colormap)
|
||||
glMipmap = glMipmap->nextcolormap;
|
||||
|
||||
if (glMipmap->colormap != colormap)
|
||||
continue;
|
||||
|
||||
if (glMipmap->downloaded && glMipmap->data)
|
||||
{
|
||||
if (glmip->downloaded && glmip->data)
|
||||
{
|
||||
HWD.pfnSetTexture(glmip); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
HWD.pfnSetTexture(glMipmap); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1076,19 +1076,18 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
// (it have a liste of mipmap)
|
||||
// this malloc is cleared in HWR_FreeTextureCache
|
||||
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
|
||||
newmip = calloc(1, sizeof (*newmip));
|
||||
if (newmip == NULL)
|
||||
newMipmap = calloc(1, sizeof (*newMipmap));
|
||||
if (newMipmap == NULL)
|
||||
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||
glmip->nextcolormap = newmip;
|
||||
newmip->colormap = colormap;
|
||||
glMipmap->nextcolormap = newMipmap;
|
||||
newMipmap->colormap = colormap;
|
||||
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newMipmap, skinnum, color);
|
||||
|
||||
HWD.pfnSetTexture(newmip);
|
||||
Z_ChangeTag(newmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
HWD.pfnSetTexture(newMipmap);
|
||||
Z_ChangeTag(newMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// HWR_DrawMD2 : Draw MD2
|
||||
// :
|
||||
@@ -1370,19 +1369,16 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
|
||||
p.spritexscale = FIXED_TO_FLOAT(spr->mobj->spritexscale);
|
||||
p.spriteyscale = FIXED_TO_FLOAT(spr->mobj->spriteyscale);
|
||||
|
||||
angle_t sliptideroll = 0;
|
||||
|
||||
if (spr->mobj->player)
|
||||
sliptideroll = ((cv_sloperoll.value && cv_sliptideroll.value) ? spr->mobj->player->sliproll : 0);
|
||||
angle_t sliptideroll = ((cv_sloperoll.value && cv_sliptideroll.value && spr->mobj->player) ? spr->mobj->player->sliproll : 0);
|
||||
|
||||
if ((spr->mobj->rollangle)||(sliptideroll && cv_sliptideroll.value))
|
||||
if (spr->mobj->rollangle || sliptideroll)
|
||||
{
|
||||
angle_t rollang = 0;
|
||||
rollfactor = ((spr->mobj->rollmodel == true) ? 1 : 0);
|
||||
|
||||
rollang = (spr->mobj->player && sliptideroll && cv_sliptideroll.value)
|
||||
? (spr->mobj->rollangle * rollfactor) + (sliptideroll * spr->mobj->player->sliptidemem)
|
||||
rollang = sliptideroll
|
||||
? (spr->mobj->rollangle * rollfactor) + (sliptideroll * spr->mobj->player->kartstuff[k_aizdriftstrat])
|
||||
: (spr->mobj->rollangle * rollfactor);
|
||||
|
||||
fixed_t anglef = AngleFixed(rollang);
|
||||
|
||||
@@ -132,7 +132,7 @@ void HWR_PortalFrame(gl_portal_t* portal)
|
||||
{
|
||||
portalclipline = NULL;
|
||||
portalcullsector = NULL;
|
||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
viewsector = R_PointInSubsectorFast(viewx, viewy)->sector;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,13 +140,17 @@ void HWR_PortalFrame(gl_portal_t* portal)
|
||||
static void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
|
||||
{
|
||||
gl_drawing_stencil = true; // do not draw outside of the stencil buffer, idiot.
|
||||
|
||||
// set our portal state and prepare to render the seg
|
||||
HWR_SetPortalState(state);
|
||||
|
||||
gl_curline = portal->seg;
|
||||
gl_frontsector = portal->seg->frontsector;
|
||||
gl_backsector = portal->seg->backsector;
|
||||
|
||||
HWR_ProcessSeg();
|
||||
gl_drawing_stencil = false;
|
||||
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
|
||||
@@ -29,9 +29,6 @@ static struct {
|
||||
// Floor shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_FLOOR_FRAGMENT_SHADER},
|
||||
|
||||
// Shadow shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_SHADOW_FRAGMENT_SHADER},
|
||||
|
||||
// Wall shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
|
||||
|
||||
@@ -432,7 +429,6 @@ static inline UINT16 HWR_FindShaderDefs(UINT16 wadnum)
|
||||
customshaderxlat_t shaderxlat[] =
|
||||
{
|
||||
{"Flat", SHADER_FLOOR},
|
||||
{"Shadow", SHADER_SHADOW},
|
||||
{"WallTexture", SHADER_WALL},
|
||||
{"Sprite", SHADER_SPRITE},
|
||||
{"Model", SHADER_MODEL},
|
||||
|
||||
@@ -211,10 +211,6 @@
|
||||
GLSL_WALL_FUDGES \
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER
|
||||
|
||||
#define GLSL_SHADOW_FRAGMENT_SHADER \
|
||||
GLSL_FLOOR_FUDGES \
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL
|
||||
|
||||
//
|
||||
// Water surface shader
|
||||
//
|
||||
|
||||
@@ -23,20 +23,25 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <math.h>
|
||||
#include "../../r_local.h" // For rendertimefrac, used for the leveltime shader uniform
|
||||
#include "../../i_video.h" // for UseScreenFBO
|
||||
#include "r_opengl.h"
|
||||
#include "r_vbo.h"
|
||||
#include "../hw_shaders.h"
|
||||
#include "../hw_main.h"
|
||||
#include "../hw_clip.h"
|
||||
|
||||
// Eeeeh not sure is this right way, but it works < sry :c < sry again it had to go :c
|
||||
|
||||
extern fixed_t fovtan; // also extremely bad, I'm just too lazy!!!
|
||||
|
||||
#if defined (HWRENDER) && !defined (NOROPENGL)
|
||||
|
||||
#include "r_opengl.h"
|
||||
#include "r_vbo.h"
|
||||
|
||||
#include "../hw_batching.h"
|
||||
#include "../hw_clip.h"
|
||||
#include "../hw_main.h"
|
||||
#include "../hw_shaders.h"
|
||||
|
||||
#include "../../f_finale.h"
|
||||
#include "../../r_local.h" // For rendertimefrac, used for the leveltime shader uniform
|
||||
#include "../../i_video.h"
|
||||
|
||||
extern fixed_t fovtan; // also extremely bad, I'm just too lazy!!!
|
||||
|
||||
struct GLRGBAFloat
|
||||
{
|
||||
GLfloat red;
|
||||
@@ -932,23 +937,19 @@ static void GLPerspective(GLfloat fovy, GLfloat aspect)
|
||||
{ 0.0f, 0.0f, 1.0f,-1.0f},
|
||||
{ 0.0f, 0.0f, 0.0f, 0.0f},
|
||||
};
|
||||
const GLfloat zNear = NEAR_CLIPPING_PLANE;
|
||||
const GLfloat zFar = FAR_CLIPPING_PLANE;
|
||||
const GLfloat radians = (GLfloat)(fovy / 2.0f * M_PIl / 180.0f);
|
||||
const GLfloat sine = (GLfloat)sin(radians);
|
||||
const GLfloat deltaZ = zFar - zNear;
|
||||
GLfloat cotangent;
|
||||
|
||||
if ((fabsf((float)deltaZ) < 1.0E-36f) || fpclassify(sine) == FP_ZERO || fpclassify(aspect) == FP_ZERO)
|
||||
const GLfloat focallength = (GLfloat)(1.0f / (GLfloat)tan(fovy * (GLfloat)M_PIl / 360.0f));
|
||||
const GLfloat deltaZ = FAR_CLIPPING_PLANE - NEAR_CLIPPING_PLANE;
|
||||
|
||||
if ((fabsf((float)deltaZ) < 1.0E-36f) || fpclassify(aspect) == FP_ZERO)
|
||||
{
|
||||
return;
|
||||
}
|
||||
cotangent = cosf(radians) / sine;
|
||||
|
||||
m[0][0] = cotangent / aspect;
|
||||
m[1][1] = cotangent;
|
||||
m[2][2] = -(zFar + zNear) / deltaZ;
|
||||
m[3][2] = -2.0f * zNear * zFar / deltaZ;
|
||||
m[0][0] = focallength / aspect;
|
||||
m[1][1] = focallength;
|
||||
m[2][2] = -(FAR_CLIPPING_PLANE + NEAR_CLIPPING_PLANE) / deltaZ;
|
||||
m[3][2] = -2.0f * NEAR_CLIPPING_PLANE * FAR_CLIPPING_PLANE / deltaZ;
|
||||
|
||||
pglMultMatrixf(&m[0][0]);
|
||||
}
|
||||
@@ -1010,6 +1011,7 @@ void SetStates(void)
|
||||
pglScalef(1.0f, 1.0f, -1.0f);
|
||||
pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// DeleteTexture : Deletes a texture from the GPU and frees its data
|
||||
// -----------------+
|
||||
@@ -2093,230 +2095,83 @@ EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutV
|
||||
// the DrawPolygon variant of this has some code about polyflags and wrapping here but havent noticed any problems from omitting it?
|
||||
}
|
||||
|
||||
// Sky dome code, taken/backported from SRB2
|
||||
|
||||
typedef struct vbo_vertex_s
|
||||
{
|
||||
float x, y, z;
|
||||
float u, v;
|
||||
unsigned char r, g, b, a;
|
||||
} vbo_vertex_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int mode;
|
||||
int vertexcount;
|
||||
int vertexindex;
|
||||
int use_texture;
|
||||
} GLSkyLoopDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int id;
|
||||
int rows, columns;
|
||||
int loopcount;
|
||||
GLSkyLoopDef *loops;
|
||||
vbo_vertex_t *data;
|
||||
} GLSkyVBO;
|
||||
|
||||
static const boolean gl_ext_arb_vertex_buffer_object = true;
|
||||
|
||||
#define NULL_VBO_VERTEX ((vbo_vertex_t*)NULL)
|
||||
#define sky_vbo_x (gl_ext_arb_vertex_buffer_object ? &NULL_VBO_VERTEX->x : &vbo->data[0].x)
|
||||
#define sky_vbo_u (gl_ext_arb_vertex_buffer_object ? &NULL_VBO_VERTEX->u : &vbo->data[0].u)
|
||||
#define sky_vbo_r (gl_ext_arb_vertex_buffer_object ? &NULL_VBO_VERTEX->r : &vbo->data[0].r)
|
||||
#define NULL_VBO_VERTEX ((gl_skyvertex_t*)NULL)
|
||||
#define sky_vbo_x (gl_ext_arb_vertex_buffer_object ? &NULL_VBO_VERTEX->x : &sky->data[0].x)
|
||||
#define sky_vbo_u (gl_ext_arb_vertex_buffer_object ? &NULL_VBO_VERTEX->u : &sky->data[0].u)
|
||||
#define sky_vbo_r (gl_ext_arb_vertex_buffer_object ? &NULL_VBO_VERTEX->r : &sky->data[0].r)
|
||||
|
||||
// The texture offset to be applied to the texture coordinates in SkyVertex().
|
||||
static int rows, columns;
|
||||
static signed char yflip;
|
||||
static int texw, texh;
|
||||
static boolean foglayer;
|
||||
static float delta = 0.0f;
|
||||
|
||||
static int gl_sky_detail = 16;
|
||||
|
||||
static INT32 lasttex = -1;
|
||||
|
||||
#define MAP_COEFF 128.0f
|
||||
|
||||
static void SkyVertex(vbo_vertex_t *vbo, int r, int c)
|
||||
{
|
||||
const float radians = (float)(M_PIl / 180.0f);
|
||||
const float scale = 10000.0f;
|
||||
const float maxSideAngle = 60.0f;
|
||||
|
||||
float topAngle = (c / (float)columns * 360.0f);
|
||||
float sideAngle = (maxSideAngle * (rows - r) / rows);
|
||||
float height = (float)(sin(sideAngle * radians));
|
||||
float realRadius = (float)(scale * cos(sideAngle * radians));
|
||||
float x = (float)(realRadius * cos(topAngle * radians));
|
||||
float y = (!yflip) ? scale * height : -scale * height;
|
||||
float z = (float)(realRadius * sin(topAngle * radians));
|
||||
float timesRepeat = (4 * (256.0f / texw));
|
||||
if (fpclassify(timesRepeat) == FP_ZERO)
|
||||
timesRepeat = 1.0f;
|
||||
|
||||
if (!foglayer)
|
||||
{
|
||||
vbo->r = 255;
|
||||
vbo->g = 255;
|
||||
vbo->b = 255;
|
||||
vbo->a = (r == 0 ? 0 : 255);
|
||||
|
||||
// And the texture coordinates.
|
||||
//vbo->u = (-timesRepeat * c / (float)columns);
|
||||
vbo->u = (timesRepeat * c / (float)columns);// TEST
|
||||
if (!yflip) // Flipped Y is for the lower hemisphere.
|
||||
vbo->v = (r / (float)rows) + 0.5f;
|
||||
else
|
||||
vbo->v = 1.0f + ((rows - r) / (float)rows) + 0.5f;
|
||||
}
|
||||
|
||||
if (r != 4)
|
||||
{
|
||||
y += 300.0f;
|
||||
}
|
||||
|
||||
// And finally the vertex.
|
||||
vbo->x = x;
|
||||
vbo->y = y + delta;
|
||||
vbo->z = z;
|
||||
}
|
||||
|
||||
static GLSkyVBO sky_vbo;
|
||||
|
||||
static void gld_BuildSky(int row_count, int col_count)
|
||||
{
|
||||
int c, r;
|
||||
vbo_vertex_t *vertex_p;
|
||||
int vertex_count = 2 * row_count * (col_count * 2 + 2) + col_count * 2;
|
||||
|
||||
GLSkyVBO *vbo = &sky_vbo;
|
||||
|
||||
if ((vbo->columns != col_count) || (vbo->rows != row_count))
|
||||
{
|
||||
free(vbo->loops);
|
||||
free(vbo->data);
|
||||
memset(vbo, 0, sizeof(&vbo));
|
||||
}
|
||||
|
||||
if (!vbo->data)
|
||||
{
|
||||
memset(vbo, 0, sizeof(&vbo));
|
||||
vbo->loops = malloc((row_count * 2 + 2) * sizeof(vbo->loops[0]));
|
||||
// create vertex array
|
||||
vbo->data = malloc(vertex_count * sizeof(vbo->data[0]));
|
||||
}
|
||||
|
||||
vbo->columns = col_count;
|
||||
vbo->rows = row_count;
|
||||
|
||||
vertex_p = &vbo->data[0];
|
||||
vbo->loopcount = 0;
|
||||
|
||||
for (yflip = 0; yflip < 2; yflip++)
|
||||
{
|
||||
vbo->loops[vbo->loopcount].mode = GL_TRIANGLE_FAN;
|
||||
vbo->loops[vbo->loopcount].vertexindex = vertex_p - &vbo->data[0];
|
||||
vbo->loops[vbo->loopcount].vertexcount = col_count;
|
||||
vbo->loops[vbo->loopcount].use_texture = false;
|
||||
vbo->loopcount++;
|
||||
|
||||
delta = 0.0f;
|
||||
foglayer = true;
|
||||
for (c = 0; c < col_count; c++)
|
||||
{
|
||||
SkyVertex(vertex_p, 1, c);
|
||||
vertex_p->r = 255;
|
||||
vertex_p->g = 255;
|
||||
vertex_p->b = 255;
|
||||
vertex_p->a = 255;
|
||||
vertex_p++;
|
||||
}
|
||||
foglayer = false;
|
||||
|
||||
delta = (yflip ? 5.0f : -5.0f) / MAP_COEFF;
|
||||
|
||||
for (r = 0; r < row_count; r++)
|
||||
{
|
||||
vbo->loops[vbo->loopcount].mode = GL_TRIANGLE_STRIP;
|
||||
vbo->loops[vbo->loopcount].vertexindex = vertex_p - &vbo->data[0];
|
||||
vbo->loops[vbo->loopcount].vertexcount = 2 * col_count + 2;
|
||||
vbo->loops[vbo->loopcount].use_texture = true;
|
||||
vbo->loopcount++;
|
||||
|
||||
for (c = 0; c <= col_count; c++)
|
||||
{
|
||||
SkyVertex(vertex_p++, r + (yflip ? 1 : 0), (c ? c : 0));
|
||||
SkyVertex(vertex_p++, r + (yflip ? 0 : 1), (c ? c : 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void RenderDome(INT32 skytexnum)
|
||||
EXPORT void HWRAPI(RenderSkyDome) (gl_sky_t *sky)
|
||||
{
|
||||
int i, j;
|
||||
int vbosize;
|
||||
GLSkyVBO *vbo = &sky_vbo;
|
||||
|
||||
rows = 4;
|
||||
columns = 4 * gl_sky_detail;
|
||||
|
||||
vbosize = 2 * rows * (columns * 2 + 2) + columns * 2;
|
||||
Shader_SetUniforms(NULL, NULL, NULL, NULL);
|
||||
|
||||
// Build the sky dome! Yes!
|
||||
if (lasttex != skytexnum)
|
||||
if (sky->rebuild)
|
||||
{
|
||||
// delete VBO when already exists
|
||||
if (gl_ext_arb_vertex_buffer_object)
|
||||
{
|
||||
if (vbo->id)
|
||||
pglDeleteBuffers(1, &vbo->id);
|
||||
if (sky->vbo)
|
||||
pglDeleteBuffers(1, &sky->vbo);
|
||||
}
|
||||
|
||||
lasttex = skytexnum;
|
||||
gld_BuildSky(rows, columns);
|
||||
|
||||
if (gl_ext_arb_vertex_buffer_object)
|
||||
{
|
||||
// generate a new VBO and get the associated ID
|
||||
pglGenBuffers(1, &vbo->id);
|
||||
pglGenBuffers(1, &sky->vbo);
|
||||
|
||||
// bind VBO in order to use
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, vbo->id);
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, sky->vbo);
|
||||
|
||||
// upload data to VBO
|
||||
pglBufferData(GL_ARRAY_BUFFER, vbosize * sizeof(vbo->data[0]), vbo->data, GL_STATIC_DRAW);
|
||||
pglBufferData(GL_ARRAY_BUFFER, sky->vertex_count * sizeof(sky->data[0]), sky->data, GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
sky->rebuild = false;
|
||||
}
|
||||
|
||||
// bind VBO in order to use
|
||||
if (gl_ext_arb_vertex_buffer_object)
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, vbo->id);
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, sky->vbo);
|
||||
|
||||
// activate and specify pointers to arrays
|
||||
pglVertexPointer(3, GL_FLOAT, sizeof(vbo->data[0]), sky_vbo_x);
|
||||
pglTexCoordPointer(2, GL_FLOAT, sizeof(vbo->data[0]), sky_vbo_u);
|
||||
pglColorPointer(4, GL_UNSIGNED_BYTE, sizeof(vbo->data[0]), sky_vbo_r);
|
||||
pglVertexPointer(3, GL_FLOAT, sizeof(sky->data[0]), sky_vbo_x);
|
||||
pglTexCoordPointer(2, GL_FLOAT, sizeof(sky->data[0]), sky_vbo_u);
|
||||
pglColorPointer(4, GL_UNSIGNED_BYTE, sizeof(sky->data[0]), sky_vbo_r);
|
||||
|
||||
// activate color arrays
|
||||
pglEnableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
// set transforms
|
||||
pglScalef(1.0f, (float)texh / 230.0f, 1.0f);
|
||||
pglScalef(1.0f, (float)sky->height / 200.0f, 1.0f);
|
||||
pglRotatef(270.0f, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
for (i = 0; i < vbo->loopcount; i++)
|
||||
for (i = 0; i < sky->loopcount; i++)
|
||||
{
|
||||
GLSkyLoopDef *loop = &vbo->loops[i];
|
||||
gl_skyloopdef_t *loop = &sky->loops[i];
|
||||
unsigned int mode = 0;
|
||||
|
||||
if (j == 0 ? loop->use_texture : !loop->use_texture)
|
||||
continue;
|
||||
|
||||
pglDrawArrays(loop->mode, loop->vertexindex, loop->vertexcount);
|
||||
switch (loop->mode)
|
||||
{
|
||||
case HWD_SKYLOOP_FAN:
|
||||
mode = GL_TRIANGLE_FAN;
|
||||
break;
|
||||
case HWD_SKYLOOP_STRIP:
|
||||
mode = GL_TRIANGLE_STRIP;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
pglDrawArrays(mode, loop->vertexindex, loop->vertexcount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2331,16 +2186,6 @@ static void RenderDome(INT32 skytexnum)
|
||||
pglDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform)
|
||||
{
|
||||
SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||
SetTransform(&transform);
|
||||
texw = texture_width;
|
||||
texh = texture_height;
|
||||
RenderDome(tex);
|
||||
SetBlend(0);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
//
|
||||
// ==========================================================================
|
||||
@@ -2982,7 +2827,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||
|
||||
if (special_splitscreen)
|
||||
{
|
||||
used_fov = (float)(atan(tan(used_fov*M_PI/360)*0.8)*360/M_PI);
|
||||
used_fov = (float)(atan(tan(used_fov * M_PIl / 360) * 0.8) * 360 / M_PIl);
|
||||
GLPerspective((GLfloat)used_fov, 2*ASPECT_RATIO);
|
||||
}
|
||||
else
|
||||
@@ -3109,10 +2954,8 @@ EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2])
|
||||
// a new size
|
||||
EXPORT void HWRAPI(FlushScreenTextures) (void)
|
||||
{
|
||||
int i;
|
||||
pglDeleteTextures(NUMSCREENTEXTURES, screenTextures);
|
||||
for (i = 0; i < NUMSCREENTEXTURES; i++)
|
||||
screenTextures[i] = 0;
|
||||
memset(screenTextures, 0 , sizeof(screenTextures));
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
@@ -3263,6 +3106,7 @@ EXPORT void HWRAPI(DoScreenWipe)(int wipeStart, int wipeEnd)
|
||||
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
{
|
||||
INT32 texsize = 512;
|
||||
int tex = HWD_SCREENTEXTURE_VHS;
|
||||
float xfix, yfix;
|
||||
float fix[8];
|
||||
GLubyte color[4] = {255, 255, 255, 255};
|
||||
@@ -3287,9 +3131,9 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
yfix = 1/((float)(texsize)/((float)((screen_height))));
|
||||
|
||||
// Slight fuzziness
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
MakeScreenTexture(tex);
|
||||
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
for (i = 0; i < 1; i += 2.f/vid.height)
|
||||
{
|
||||
@@ -3311,8 +3155,9 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
}
|
||||
|
||||
// Upward bar
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
MakeScreenTexture(tex);
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
color[0] = color[1] = color[2] = 190;
|
||||
color[3] = 250;
|
||||
pglColor4ubv(color);
|
||||
@@ -3339,8 +3184,8 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
// Downward bar
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
MakeScreenTexture(tex);
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
fix[0] = 0.0f;
|
||||
fix[6] = xfix;
|
||||
@@ -3396,7 +3241,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (int tex)
|
||||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height)
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height, boolean useshader)
|
||||
{
|
||||
float xfix, yfix;
|
||||
float origaspect, newaspect;
|
||||
@@ -3463,7 +3308,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height)
|
||||
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (useshader)
|
||||
pglUseProgram(gl_shaders[SHADER_PALETTE_POSTPROCESS].program); // palette postprocess shader
|
||||
|
||||
pglColor4ubv(white);
|
||||
@@ -3473,7 +3318,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height)
|
||||
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
if (useshader)
|
||||
pglUseProgram(0);
|
||||
|
||||
tex_downloaded = screenTextures[tex];
|
||||
|
||||
+18
-18
@@ -289,7 +289,7 @@ int
|
||||
HMS_register (void)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
char post[256];
|
||||
|
||||
@@ -316,23 +316,23 @@ HMS_register (void)
|
||||
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
|
||||
|
||||
ok = HMS_do(hms);
|
||||
okay = HMS_do(hms);
|
||||
|
||||
if (ok)
|
||||
if (okay)
|
||||
{
|
||||
hms_server_token = strdup(strtok(hms->buffer, "\n"));
|
||||
}
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
int
|
||||
HMS_unlist (void)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
hms = HMS_connect("servers/%s/unlist", hms_server_token);
|
||||
|
||||
@@ -342,19 +342,19 @@ HMS_unlist (void)
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POST, 1);
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, 0);
|
||||
|
||||
ok = HMS_do(hms);
|
||||
okay = HMS_do(hms);
|
||||
HMS_end(hms);
|
||||
|
||||
free(hms_server_token);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
int
|
||||
HMS_update (void)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
char post[256];
|
||||
|
||||
@@ -376,10 +376,10 @@ HMS_update (void)
|
||||
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
|
||||
|
||||
ok = HMS_do(hms);
|
||||
okay = HMS_do(hms);
|
||||
HMS_end(hms);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -488,7 +488,7 @@ int
|
||||
HMS_compare_mod_version (char *buffer, size_t buffer_size)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
char *version;
|
||||
char *version_name;
|
||||
@@ -498,7 +498,7 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
|
||||
if (! hms)
|
||||
return 0;
|
||||
|
||||
ok = 0;
|
||||
okay = 0;
|
||||
|
||||
if (HMS_do(hms))
|
||||
{
|
||||
@@ -510,16 +510,16 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
|
||||
if (atoi(version) != MODVERSION)
|
||||
{
|
||||
strlcpy(buffer, version_name, buffer_size);
|
||||
ok = 1;
|
||||
okay = 1;
|
||||
}
|
||||
else
|
||||
ok = -1;
|
||||
okay = -1;
|
||||
}
|
||||
}
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
const char *
|
||||
@@ -532,9 +532,9 @@ HMS_fetch_rules (char *buffer, size_t buffer_size)
|
||||
if (! hms)
|
||||
return NULL;
|
||||
|
||||
boolean ok = HMS_do(hms);
|
||||
boolean okay = HMS_do(hms);
|
||||
|
||||
if (ok)
|
||||
if (okay)
|
||||
{
|
||||
char *p = strstr(hms->buffer, "\n\n");
|
||||
|
||||
@@ -552,7 +552,7 @@ HMS_fetch_rules (char *buffer, size_t buffer_size)
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
if (!ok)
|
||||
if (!okay)
|
||||
return NULL;
|
||||
|
||||
return buffer;
|
||||
|
||||
+2
-2
@@ -1000,7 +1000,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||
|
||||
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
|
||||
|
||||
if (LUAh_PlayerMsg(playernum, target, flags, msg, spam_eatmsg))
|
||||
if (LUA_HookPlayerMsg(playernum, target, flags, msg, spam_eatmsg))
|
||||
return;
|
||||
|
||||
if (spam_eatmsg)
|
||||
@@ -2271,7 +2271,7 @@ void HU_Drawer(void)
|
||||
if (renderisnewtic)
|
||||
{
|
||||
LUA_HUD_ClearDrawList(luahuddrawlist_scores);
|
||||
LUAh_ScoresHUD(luahuddrawlist_scores);
|
||||
LUA_HUDHOOK(scores, luahuddrawlist_scores);
|
||||
}
|
||||
|
||||
LUA_HUD_DrawList(luahuddrawlist_scores);
|
||||
|
||||
@@ -1357,9 +1357,7 @@ static void rendezvous(int size)
|
||||
|
||||
if (tic == refreshtic)
|
||||
{
|
||||
#ifdef HOLEPUNCH
|
||||
holepunchpacket->magic = hole_punch_magic;
|
||||
#endif
|
||||
sendto(mysockets[0], doomcom->data, size, 0, &rzv.any, sizeof rzv.ip4);
|
||||
}
|
||||
|
||||
|
||||
@@ -139,6 +139,8 @@ UINT32 I_GetRefreshRate(void);
|
||||
|
||||
boolean I_UseNativeKeyboard(void);
|
||||
|
||||
boolean I_CheckNativeRes(void);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
#if defined (__unix__)
|
||||
extern boolean xwaylandcrap;
|
||||
|
||||
@@ -159,9 +159,6 @@ enum actionnum
|
||||
A_SPAWNOBJECTRELATIVE,
|
||||
A_CHANGEANGLERELATIVE,
|
||||
A_CHANGEANGLEABSOLUTE,
|
||||
A_ROLLANGLE,
|
||||
A_CHANGEROLLANGLERELATIVE,
|
||||
A_CHANGEROLLANGLEABSOLUTE,
|
||||
A_PLAYSOUND,
|
||||
A_FINDTARGET,
|
||||
A_FINDTRACER,
|
||||
|
||||
+60
-78
@@ -497,10 +497,9 @@ UINT8 colortranslations[MAXTRANSLATIONS][16] = {
|
||||
*/
|
||||
void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 i, j;
|
||||
RGBA_t color;
|
||||
UINT8 brightness;
|
||||
INT32 j;
|
||||
UINT8 colorbrightnesses[16];
|
||||
UINT16 brightdif;
|
||||
INT32 temp;
|
||||
@@ -523,6 +522,7 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor)
|
||||
color = V_GetColor(i);
|
||||
SETBRIGHTNESS(brightness, color.s.red, color.s.green, color.s.blue);
|
||||
brightdif = 256;
|
||||
|
||||
for (j = 0; j < 16; j++)
|
||||
{
|
||||
temp = abs((INT16)brightness - (INT16)colorbrightnesses[j]);
|
||||
@@ -2060,6 +2060,38 @@ void K_MomentumToFacing(player_t *player)
|
||||
player->mo->momy = FixedMul(player->mo->momy - player->cmomy, player->mo->friction) + player->cmomy;
|
||||
}
|
||||
|
||||
static inline fixed_t K_GetProjectileSpeed(void)
|
||||
{
|
||||
switch (gamespeed)
|
||||
{
|
||||
case 0:
|
||||
return 68*mapobjectscale; // Avg Speed is 34
|
||||
break;
|
||||
case 2:
|
||||
return 96*mapobjectscale; // Avg Speed is 48
|
||||
break;
|
||||
default:
|
||||
return 82*mapobjectscale; // Avg Speed is 41
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline fixed_t K_GetSneakerBoostSpeed(void)
|
||||
{
|
||||
switch (gamespeed)
|
||||
{
|
||||
case 0:
|
||||
return 53740+768;
|
||||
break;
|
||||
case 2:
|
||||
return 17294+768;
|
||||
break;
|
||||
default:
|
||||
return 32768;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// sets k_boostpower, k_speedboost, and k_accelboost to whatever we need it to be
|
||||
static void K_GetKartBoostPower(player_t *player)
|
||||
{
|
||||
@@ -2093,18 +2125,7 @@ static void K_GetKartBoostPower(player_t *player)
|
||||
|
||||
if (player->kartstuff[k_sneakertimer]) // Sneaker
|
||||
{
|
||||
switch (gamespeed)
|
||||
{
|
||||
case 0:
|
||||
speedboost = max(speedboost, 53740+768);
|
||||
break;
|
||||
case 2:
|
||||
speedboost = max(speedboost, 17294+768);
|
||||
break;
|
||||
default:
|
||||
speedboost = max(speedboost, 32768);
|
||||
break;
|
||||
}
|
||||
speedboost = max(speedboost, K_GetSneakerBoostSpeed());
|
||||
accelboost = max(accelboost, 8*FRACUNIT); // + 800%
|
||||
}
|
||||
|
||||
@@ -2312,7 +2333,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
|
||||
UINT8 scoremultiply = 1;
|
||||
// PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too.
|
||||
boolean force = false; // Used to check if Lua ShouldSpin should get us damaged reguardless of flashtics or heck knows what.
|
||||
UINT8 shouldForce = LUAh_ShouldSpin(player, inflictor, source);
|
||||
UINT8 shouldForce = LUA_HookShouldSpin(player, inflictor, source);
|
||||
|
||||
if (P_MobjWasRemoved(player->mo))
|
||||
return; // mobj was removed (in theory that shouldn't happen)
|
||||
@@ -2345,7 +2366,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
|
||||
}
|
||||
}
|
||||
|
||||
if (LUAh_PlayerSpin(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case.
|
||||
if (LUA_HookPlayerSpin(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case.
|
||||
return;
|
||||
|
||||
if (source && source != player->mo && source->player)
|
||||
@@ -2453,7 +2474,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
|
||||
UINT8 scoremultiply = 1;
|
||||
// PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too.
|
||||
boolean force = false; // Used to check if Lua ShouldSquish should get us damaged reguardless of flashtics or heck knows what.
|
||||
UINT8 shouldForce = LUAh_ShouldSquish(player, inflictor, source);
|
||||
UINT8 shouldForce = LUA_HookShouldSquish(player, inflictor, source);
|
||||
if (P_MobjWasRemoved(player->mo))
|
||||
return; // mobj was removed (in theory that shouldn't happen)
|
||||
if (shouldForce == 1)
|
||||
@@ -2483,7 +2504,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
|
||||
}
|
||||
}
|
||||
|
||||
if (LUAh_PlayerSquish(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case.
|
||||
if (LUA_HookPlayerSquish(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case.
|
||||
return;
|
||||
|
||||
player->kartstuff[k_sneakertimer] = 0;
|
||||
@@ -2564,7 +2585,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
|
||||
fixed_t upgoer;
|
||||
UINT8 scoremultiply = 1;
|
||||
boolean force = false; // Used to check if Lua ShouldExplode should get us damaged reguardless of flashtics or heck knows what.
|
||||
UINT8 shouldForce = LUAh_ShouldExplode(player, inflictor, source);
|
||||
UINT8 shouldForce = LUA_HookShouldExplode(player, inflictor, source);
|
||||
|
||||
if (P_MobjWasRemoved(player->mo))
|
||||
return; // mobj was removed (in theory that shouldn't happen)
|
||||
@@ -2597,7 +2618,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
|
||||
}
|
||||
}
|
||||
|
||||
if (LUAh_PlayerExplode(player, inflictor, source)) // Same thing. Also make sure to let Instashield happen blah blah
|
||||
if (LUA_HookPlayerExplode(player, inflictor, source)) // Same thing. Also make sure to let Instashield happen blah blah
|
||||
return;
|
||||
|
||||
if (source && source != player->mo && source->player)
|
||||
@@ -3082,7 +3103,7 @@ static void K_SpawnDriftSparks(player_t *player)
|
||||
//spark->momz = player->mo->momz/2;
|
||||
|
||||
// rotate the sparks based on pitch and roll; it just looks neat
|
||||
if (cv_sparkroll.value == 1)
|
||||
if (cv_sparkroll.value)
|
||||
{
|
||||
spark->slopepitch = player->mo->slopepitch;
|
||||
spark->sloperoll = player->mo->sloperoll;
|
||||
@@ -3296,20 +3317,22 @@ static void K_QuiteSaltyHop(player_t *p)
|
||||
}
|
||||
|
||||
#define SLOPEROLL_DIV 3
|
||||
|
||||
void K_RollMobjBySlopes(mobj_t* mo, boolean usedistance)
|
||||
{
|
||||
if (P_MobjWasRemoved(mo))
|
||||
return;
|
||||
|
||||
I_Assert(mo->subsector != NULL);
|
||||
I_Assert(mo->subsector->sector != NULL);
|
||||
|
||||
angle_t an;
|
||||
const boolean flip = mo->eflags & MFE_VERTICALFLIP;
|
||||
const fixed_t m_dist = usedistance ? R_PointToDist(mo->x, mo->y) : 0;
|
||||
const fixed_t rolldist = cv_sloperolldist.value * mapobjectscale;
|
||||
|
||||
// lifted from hw_md2
|
||||
if (mo->standingslope)
|
||||
{
|
||||
angle_t an;
|
||||
const boolean flip = (mo->eflags & MFE_VERTICALFLIP);
|
||||
const fixed_t m_dist = usedistance ? R_PointToDist(mo->x, mo->y) : 0;
|
||||
const fixed_t rolldist = cv_sloperolldist.value * mapobjectscale;
|
||||
|
||||
fixed_t tempz = mo->standingslope->normal.z;
|
||||
fixed_t tempy = mo->standingslope->normal.y;
|
||||
fixed_t tempx = mo->standingslope->normal.x;
|
||||
@@ -3318,7 +3341,7 @@ void K_RollMobjBySlopes(mobj_t* mo, boolean usedistance)
|
||||
// admittedly this is a very hacky way to do the pitch and roll easing
|
||||
|
||||
// pitch
|
||||
if ((!usedistance) || (m_dist <= (rolldist)))
|
||||
if (!usedistance || (m_dist <= (rolldist)))
|
||||
{
|
||||
an = (INT32)((angle_t)tempangle - mo->pitch_sprite) / SLOPEROLL_DIV;
|
||||
|
||||
@@ -3401,7 +3424,7 @@ void K_SpawnBoostTrail(player_t *player)
|
||||
flame->momx = 8;
|
||||
|
||||
// since you have to be on the ground for sneaker trails, this should be fine(?)
|
||||
if (cv_sparkroll.value == 1)
|
||||
if (cv_sparkroll.value)
|
||||
{
|
||||
flame->slopepitch = player->mo->slopepitch;
|
||||
flame->sloperoll = player->mo->sloperoll;
|
||||
@@ -3593,18 +3616,7 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (gamespeed)
|
||||
{
|
||||
case 0:
|
||||
PROJSPEED = 68*mapobjectscale; // Avg Speed is 34
|
||||
break;
|
||||
case 2:
|
||||
PROJSPEED = 96*mapobjectscale; // Avg Speed is 48
|
||||
break;
|
||||
default:
|
||||
PROJSPEED = 82*mapobjectscale; // Avg Speed is 41
|
||||
break;
|
||||
}
|
||||
PROJSPEED = K_GetProjectileSpeed();
|
||||
}
|
||||
|
||||
if (altthrow)
|
||||
@@ -3832,18 +3844,7 @@ void K_PuntMine(mobj_t *thismine, mobj_t *punter)
|
||||
if (!mine || P_MobjWasRemoved(mine))
|
||||
return;
|
||||
|
||||
switch (gamespeed)
|
||||
{
|
||||
case 0:
|
||||
spd = 68*mapobjectscale; // Avg Speed is 34
|
||||
break;
|
||||
case 2:
|
||||
spd = 96*mapobjectscale; // Avg Speed is 48
|
||||
break;
|
||||
default:
|
||||
spd = 82*mapobjectscale; // Avg Speed is 41
|
||||
break;
|
||||
}
|
||||
spd = K_GetProjectileSpeed();
|
||||
|
||||
mine->flags |= MF_NOCLIPTHING;
|
||||
|
||||
@@ -3990,20 +3991,7 @@ static void K_DoHyudoroSteal(player_t *player)
|
||||
|
||||
void K_DoSneaker(player_t *player, INT32 type)
|
||||
{
|
||||
fixed_t intendedboost;
|
||||
|
||||
switch (gamespeed)
|
||||
{
|
||||
case 0:
|
||||
intendedboost = 53740+768;
|
||||
break;
|
||||
case 2:
|
||||
intendedboost = 17294+768;
|
||||
break;
|
||||
default:
|
||||
intendedboost = 32768;
|
||||
break;
|
||||
}
|
||||
const fixed_t intendedboost = K_GetSneakerBoostSpeed();
|
||||
|
||||
if (!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3)
|
||||
{
|
||||
@@ -5346,7 +5334,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
||||
|
||||
// Plays the music during and after the starting countdown.
|
||||
if (P_IsLocalPlayer(player))
|
||||
S_StartMapMusic(false);
|
||||
S_StartMapMusic();
|
||||
}
|
||||
|
||||
void K_KartPlayerAfterThink(player_t *player)
|
||||
@@ -5674,7 +5662,6 @@ static void K_KartDrift(player_t *player, boolean onground)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Stop drifting
|
||||
if (player->kartstuff[k_spinouttimer] > 0 || player->speed < minspeed)
|
||||
{
|
||||
@@ -5683,7 +5670,6 @@ static void K_KartDrift(player_t *player, boolean onground)
|
||||
|
||||
if (!player->sliproll)
|
||||
{
|
||||
player->sliptidemem = 0;
|
||||
player->sliproll = 0;
|
||||
}
|
||||
|
||||
@@ -5706,8 +5692,6 @@ static void K_KartDrift(player_t *player, boolean onground)
|
||||
|
||||
if (player->sliproll < (32*ANG1))
|
||||
player->sliproll += (4*ANG1);
|
||||
|
||||
player->sliptidemem = player->kartstuff[k_aizdriftstrat];
|
||||
}
|
||||
|
||||
if (player->kartstuff[k_drift]
|
||||
@@ -6475,7 +6459,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
|
||||
K_KartDrift(player, onground);
|
||||
|
||||
if ((!player->kartstuff[k_aizdriftstrat])||(!P_IsObjectOnGround(player->mo))||(player->kartstuff[k_drift]))
|
||||
if ((!player->kartstuff[k_aizdriftstrat]) || (!P_IsObjectOnGround(player->mo)) || (player->kartstuff[k_drift]))
|
||||
{
|
||||
if (player->sliproll && (player->sliproll > 0))
|
||||
player->sliproll -= (4*ANG1);
|
||||
@@ -6489,10 +6473,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
player->mo->spriteyscale = player->mo->realyscale;
|
||||
}
|
||||
|
||||
if (cv_spriteroll.value && cv_sloperoll.value)
|
||||
if (cv_sloperoll.value && !player->mo->salty_jump) // seeing a character rotate mid-hop looks really janky
|
||||
{
|
||||
if ((!player->mo->salty_jump)) // seeing a character rotate mid-hop looks really janky
|
||||
K_RollMobjBySlopes(player->mo, (cv_sloperolldist.value && !splitscreen));
|
||||
K_RollMobjBySlopes(player->mo, (cv_sloperolldist.value && !splitscreen));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6500,7 +6483,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||
player->mo->slopepitch = FixedAngle(0);
|
||||
}
|
||||
|
||||
|
||||
// Quick Turning
|
||||
// You can't turn your kart when you're not moving.
|
||||
// So now it's time to burn some rubber!
|
||||
@@ -9136,7 +9118,7 @@ static void K_drawNameTags(void)
|
||||
distance = R_PointToDist(players[i].mo->x, players[i].mo->y);
|
||||
if (distance > maxdistance)
|
||||
continue;
|
||||
if (!P_CheckSight(stplyr->mo, players[i].mo))
|
||||
if (!P_CheckSightFast(stplyr->mo, players[i].mo))
|
||||
continue;
|
||||
|
||||
switch (cv_nametagtrans.value)
|
||||
|
||||
@@ -169,7 +169,7 @@ void COM_Lua_f(void)
|
||||
for (i = 0; i < argc; i++)
|
||||
WRITESTRINGN(p, COM_Argv(i), 255);
|
||||
if (flags & 2)
|
||||
SendNetXCmd2(XD_LUACMD, buf, p-buf);
|
||||
SendNetXCmdForPlayer(1, XD_LUACMD, buf, p-buf);
|
||||
else
|
||||
SendNetXCmd(XD_LUACMD, buf, p-buf);
|
||||
free(buf);
|
||||
|
||||
+116
-92
@@ -12,105 +12,129 @@
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "d_player.h"
|
||||
#include "s_sound.h"
|
||||
#include "lua_hudlib_drawlist.h"
|
||||
|
||||
enum hook {
|
||||
hook_NetVars=0,
|
||||
hook_MapChange,
|
||||
hook_MapLoad,
|
||||
hook_PlayerJoin,
|
||||
hook_PreThinkFrame,
|
||||
hook_ThinkFrame,
|
||||
hook_PostThinkFrame,
|
||||
hook_MobjSpawn,
|
||||
hook_MobjCollide,
|
||||
hook_MobjMoveCollide,
|
||||
hook_TouchSpecial,
|
||||
hook_MobjFuse,
|
||||
hook_MobjThinker,
|
||||
hook_BossThinker,
|
||||
hook_ShouldDamage,
|
||||
hook_MobjDamage,
|
||||
hook_MobjDeath,
|
||||
hook_BossDeath,
|
||||
hook_MobjRemoved,
|
||||
hook_JumpSpecial,
|
||||
hook_AbilitySpecial,
|
||||
hook_SpinSpecial,
|
||||
hook_JumpSpinSpecial,
|
||||
hook_BotTiccmd,
|
||||
hook_BotAI,
|
||||
hook_LinedefExecute,
|
||||
hook_PlayerMsg,
|
||||
hook_HurtMsg,
|
||||
hook_PlayerSpawn,
|
||||
hook_PlayerQuit,
|
||||
hook_PlayerThink,
|
||||
hook_MusicChange,
|
||||
hook_ShouldSpin, //SRB2KART
|
||||
hook_ShouldExplode, //SRB2KART
|
||||
hook_ShouldSquish, //SRB2KART
|
||||
hook_PlayerSpin, //SRB2KART
|
||||
hook_PlayerExplode, //SRB2KART
|
||||
hook_PlayerSquish, //SRB2KART
|
||||
hook_PlayerCmd, //SRB2KART
|
||||
hook_IntermissionThinker, //SRB2KART
|
||||
hook_VoteThinker, //SRB2KART
|
||||
hook_ServerJoin, // SRB2KART - Saturn 32p
|
||||
/*
|
||||
* Do you know what an 'X Macro' is? Such a macro is called over each element of
|
||||
* a list and expands the input. I use it for the hook lists because both an enum
|
||||
* and array of hook names need to be kept in order. The X Macro handles this
|
||||
* automatically.
|
||||
*/
|
||||
|
||||
hook_MAX // last hook
|
||||
};
|
||||
extern const char *const hookNames[];
|
||||
#define MOBJ_HOOK_LIST(X) \
|
||||
X (MobjSpawn),/* P_SpawnMobj */\
|
||||
X (MobjCollide),/* PIT_CheckThing */\
|
||||
X (MobjMoveCollide),/* tritto */\
|
||||
X (TouchSpecial),/* P_TouchSpecialThing */\
|
||||
X (MobjFuse),/* when mobj->fuse runs out */\
|
||||
X (MobjThinker),/* P_MobjThinker, P_SceneryThinker */\
|
||||
X (BossThinker),/* P_GenericBossThinker */\
|
||||
X (ShouldDamage),/* P_DamageMobj (Should mobj take damage?) */\
|
||||
X (MobjDamage),/* P_DamageMobj (Mobj actually takes damage!) */\
|
||||
X (MobjDeath),/* P_KillMobj */\
|
||||
X (BossDeath),/* A_BossDeath */\
|
||||
X (MobjRemoved),/* P_RemoveMobj */\
|
||||
X (HurtMsg),/* imhurttin */\
|
||||
|
||||
#define HOOK_LIST(X) \
|
||||
X (NetVars),/* add to archive table (netsave) */\
|
||||
X (MapChange),/* (before map load) */\
|
||||
X (MapLoad),\
|
||||
X (PlayerJoin),/* Got_AddPlayer */\
|
||||
X (PreThinkFrame)/* frame (before mobj and player thinkers) */,\
|
||||
X (ThinkFrame),/* frame (after mobj and player thinkers) */\
|
||||
X (PostThinkFrame),/* frame (at end of tick, ie after overlays, precipitation, specials) */\
|
||||
X (JumpSpecial),/* P_DoJumpStuff (Any-jumping) */\
|
||||
X (AbilitySpecial),/* P_DoJumpStuff (Double-jumping) */\
|
||||
X (SpinSpecial),/* P_DoSpinAbility (Spin button effect) */\
|
||||
X (JumpSpinSpecial),/* P_DoJumpStuff (Spin button effect (mid-air)) */\
|
||||
X (BotTiccmd),/* B_BuildTiccmd */\
|
||||
X (PlayerMsg),/* chat messages */\
|
||||
X (PlayerSpawn),/* G_SpawnPlayer */\
|
||||
X (PlayerQuit),\
|
||||
X (PlayerThink),/* P_PlayerThink */\
|
||||
X (MusicChange),\
|
||||
X (ShouldSpin),/*SRB2KART*/\
|
||||
X (ShouldExplode),/*SRB2KART*/\
|
||||
X (ShouldSquish),/*SRB2KART*/\
|
||||
X (PlayerSpin),/*SRB2KART*/\
|
||||
X (PlayerExplode),/*SRB2KART*/\
|
||||
X (PlayerSquish),/*SRB2KART*/\
|
||||
X (PlayerCmd),/* building the player's ticcmd struct (Ported from SRB2Kart) */\
|
||||
X (IntermissionThinker),/* Y_Ticker */\
|
||||
X (VoteThinker),/*SRB2KART*/\
|
||||
X (ServerJoin),/* SRB2KART - Saturn 32p*/\
|
||||
|
||||
#define STRING_HOOK_LIST(X) \
|
||||
X (BotAI),/* B_BuildTailsTiccmd by skin name */\
|
||||
X (LinedefExecute),\
|
||||
|
||||
#define HUD_HOOK_LIST(X) \
|
||||
X (game),\
|
||||
X (scores),/* emblems/multiplayer list */\
|
||||
X (intermission),\
|
||||
X (vote),\
|
||||
|
||||
/*
|
||||
* I chose to access the hook enums through a macro as well. This could provide
|
||||
* a hint to lookup the macro's definition instead of the enum's definition.
|
||||
* (Since each enumeration is not defined in the source code, but by the list
|
||||
* macros above, it is not greppable.) The name passed to the macro can also be
|
||||
* grepped and found in the lists above.
|
||||
*/
|
||||
|
||||
#define MOBJ_HOOK(name) mobjhook_ ## name
|
||||
#define HOOK(name) hook_ ## name
|
||||
#define HUD_HOOK(name) hudhook_ ## name
|
||||
#define STRING_HOOK(name) stringhook_ ## name
|
||||
|
||||
#define ENUM(X) enum { X ## _LIST (X) X(MAX) }
|
||||
|
||||
ENUM (MOBJ_HOOK);
|
||||
ENUM (HOOK);
|
||||
ENUM (HUD_HOOK);
|
||||
ENUM (STRING_HOOK);
|
||||
|
||||
#undef ENUM
|
||||
|
||||
/* dead simple, LUA_HOOK(GameQuit) */
|
||||
#define LUA_HOOK(type) LUA_HookVoid(HOOK(type))
|
||||
#define LUA_HUDHOOK(type,drawlist) LUA_HookHUD(HUD_HOOK(type),(drawlist))
|
||||
|
||||
extern boolean hook_cmd_running; // This is used by PlayerCmd and lua_playerlib to prevent anything from being wirtten to player while we run PlayerCmd.
|
||||
extern int hook_defrosting;
|
||||
|
||||
void LUAh_MapChange(INT16 mapnumber); // Hook for map change (before load)
|
||||
void LUAh_MapLoad(void); // Hook for map load
|
||||
void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer
|
||||
void LUAh_PreThinkFrame(void); // Hook for frame (before mobj and player thinkers)
|
||||
void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers)
|
||||
void LUAh_PostThinkFrame(void); // Hook for frame (at end of tick, ie after overlays, precipitation, specials)
|
||||
boolean LUAh_MobjHook(mobj_t *mo, enum hook which);
|
||||
boolean LUAh_PlayerHook(player_t *plr, enum hook which);
|
||||
#define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type
|
||||
UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which);
|
||||
#define LUAh_MobjCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjCollide) // Hook for PIT_CheckThing by (thing) mobj type
|
||||
#define LUAh_MobjMoveCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjMoveCollide) // Hook for PIT_CheckThing by (tmthing) mobj type
|
||||
boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_TouchSpecialThing by mobj type
|
||||
#define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type
|
||||
boolean LUAh_MobjThinker(mobj_t *mo); // Hook for P_MobjThinker or P_SceneryThinker by mobj type
|
||||
#define LUAh_BossThinker(mo) LUAh_MobjHook(mo, hook_BossThinker) // Hook for P_GenericBossThinker by mobj type
|
||||
UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Should mobj take damage?)
|
||||
boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Mobj actually takes damage!)
|
||||
boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source); // Hook for P_KillMobj by mobj type
|
||||
#define LUAh_BossDeath(mo) LUAh_MobjHook(mo, hook_BossDeath) // Hook for A_BossDeath by mobj type
|
||||
#define LUAh_MobjRemoved(mo) LUAh_MobjHook(mo, hook_MobjRemoved) // Hook for P_RemoveMobj by mobj type
|
||||
#define LUAh_JumpSpecial(player) LUAh_PlayerHook(player, hook_JumpSpecial) // Hook for P_DoJumpStuff (Any-jumping)
|
||||
#define LUAh_AbilitySpecial(player) LUAh_PlayerHook(player, hook_AbilitySpecial) // Hook for P_DoJumpStuff (Double-jumping)
|
||||
#define LUAh_SpinSpecial(player) LUAh_PlayerHook(player, hook_SpinSpecial) // Hook for P_DoSpinDash (Spin button effect)
|
||||
#define LUAh_JumpSpinSpecial(player) LUAh_PlayerHook(player, hook_JumpSpinSpecial) // Hook for P_DoJumpStuff (Spin button effect (mid-air))
|
||||
boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
|
||||
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
|
||||
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
|
||||
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute); // Hook for chat messages
|
||||
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
|
||||
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
|
||||
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
|
||||
boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boolean *looping,
|
||||
UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms); // Hook for music changes
|
||||
void LUA_HookVoid(int hook);
|
||||
void LUA_HookHUD(int hook, huddrawlist_h drawlist);
|
||||
|
||||
UINT8 LUAh_ShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
|
||||
UINT8 LUAh_ShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
|
||||
UINT8 LUAh_ShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be squished?
|
||||
int LUA_HookMobj(mobj_t *, int hook);
|
||||
int LUA_Hook2Mobj(mobj_t *, mobj_t *, int hook);
|
||||
void LUA_HookInt(INT32 integer, int hook);
|
||||
//void LUA_HookBool(boolean value, int hook);
|
||||
int LUA_HookPlayer(player_t *, int hook);
|
||||
int LUA_HookTiccmd(player_t *, ticcmd_t *, int hook);
|
||||
|
||||
boolean LUAh_PlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SpinPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
boolean LUAh_PlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_ExplodePlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
boolean LUAh_PlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
void LUA_HookPreThinkFrame(void);
|
||||
void LUA_HookThinkFrame(void);
|
||||
void LUA_HookPostThinkFrame(void);
|
||||
int LUA_HookTouchSpecial(mobj_t *special, mobj_t *toucher);
|
||||
int LUA_HookShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage);
|
||||
int LUA_HookMobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage);
|
||||
int LUA_HookMobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source);
|
||||
int LUA_HookBotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd);
|
||||
void LUA_HookLinedefExecute(line_t *, mobj_t *, sector_t *);
|
||||
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg, int mute);
|
||||
int LUA_HookHurtMsg(player_t *, mobj_t *inflictor, mobj_t *source);
|
||||
int LUA_HookPlayerCanDamage(player_t *, mobj_t *);
|
||||
void LUA_HookPlayerQuit(player_t *, int);
|
||||
int LUA_HookPlayerCmd(player_t *, ticcmd_t *);
|
||||
int LUA_HookMusicChange(const char *oldname, struct MusicChange *);
|
||||
|
||||
void LUAh_ServerJoin(void); // SRB2KART - Saturn 32p: called by client when joining a server, allows lua to load any sort of config file
|
||||
int LUA_HookShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
|
||||
int LUA_HookShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
|
||||
int LUA_HookShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be squished?
|
||||
|
||||
boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Allows to write to player cmd before the game does anything with them.
|
||||
|
||||
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
|
||||
void LUAh_VoteThinker(void); // Hook for Y_VoteTicker
|
||||
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
|
||||
boolean LUA_HookPlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SpinPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
boolean LUA_HookPlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_ExplodePlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
boolean LUA_HookPlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
+974
-1828
File diff suppressed because it is too large.
Load diff
+1
-4
@@ -50,9 +50,6 @@ extern boolean hud_interplatch; // string mode was toggled
|
||||
|
||||
boolean LUA_HudEnabled(enum hud option);
|
||||
|
||||
void LUAh_GameHUD(huddrawlist_h list);
|
||||
void LUAh_ScoresHUD(huddrawlist_h list);
|
||||
void LUAh_IntermissionHUD(huddrawlist_h list);
|
||||
void LUAh_VoteHUD(huddrawlist_h list);
|
||||
void LUA_SetHudHook(int hook, huddrawlist_h list);
|
||||
|
||||
#endif // __LUA_HUD_H__
|
||||
+17
-195
@@ -28,6 +28,7 @@
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
#include "lua_hud.h"
|
||||
#include "lua_hook.h"
|
||||
|
||||
#define HUDONLY if (!hud_running) return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!");
|
||||
|
||||
@@ -40,8 +41,6 @@ boolean hud_interpstring = false;
|
||||
boolean hud_interplatch = false;
|
||||
static UINT8 hud_enabled[(hud_MAX/8)+1];
|
||||
|
||||
static UINT8 hudAvailable; // hud hooks field
|
||||
|
||||
static UINT8 camnum = 1;
|
||||
|
||||
// must match enum hud in lua_hud.h
|
||||
@@ -93,19 +92,6 @@ static const char *const patch_opt[] = {
|
||||
"topoffset",
|
||||
NULL};
|
||||
|
||||
enum hudhook {
|
||||
hudhook_game = 0,
|
||||
hudhook_scores = 1,
|
||||
hudhook_intermission = 2,
|
||||
hudhook_vote = 3,
|
||||
};
|
||||
static const char *const hudhook_opt[] = {
|
||||
"game",
|
||||
"scores",
|
||||
"intermission",
|
||||
"vote",
|
||||
NULL};
|
||||
|
||||
static int patch_fields_ref = LUA_NOREF;
|
||||
|
||||
// alignment types for v.drawString
|
||||
@@ -503,7 +489,7 @@ static int libd_getSpritePatch(lua_State *L)
|
||||
angle = (angle & 7); // modulus angle by 8
|
||||
|
||||
// rotsprite?????
|
||||
if (lua_isnumber(L, 4) && (cv_spriteroll.value))
|
||||
if (lua_isnumber(L, 4) && cv_sloperoll.value)
|
||||
{
|
||||
angle_t rollangle = luaL_checkangle(L, 4);
|
||||
INT32 rot = R_GetRollAngle(rollangle);
|
||||
@@ -1215,6 +1201,8 @@ static luaL_Reg lib_draw[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static int lib_draw_ref;
|
||||
|
||||
//
|
||||
// lib_hud
|
||||
//
|
||||
@@ -1248,25 +1236,7 @@ static int lib_hudenabled(lua_State *L)
|
||||
}
|
||||
|
||||
// add a HUD element for rendering
|
||||
static int lib_hudadd(lua_State *L)
|
||||
{
|
||||
enum hudhook field;
|
||||
|
||||
luaL_checktype(L, 1, LUA_TFUNCTION);
|
||||
field = luaL_checkoption(L, 2, "game", hudhook_opt);
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(L, -1));
|
||||
lua_rawgeti(L, -1, field+2); // HUD[2+]
|
||||
I_Assert(lua_istable(L, -1));
|
||||
lua_remove(L, -2);
|
||||
|
||||
lua_pushvalue(L, 1);
|
||||
lua_rawseti(L, -2, (int)(lua_objlen(L, -2) + 1));
|
||||
|
||||
hudAvailable |= 1<<field;
|
||||
return 0;
|
||||
}
|
||||
extern int lib_hudadd(lua_State *L);
|
||||
|
||||
static int lib_hudsetvotebackground(lua_State *L)
|
||||
{
|
||||
@@ -1351,23 +1321,9 @@ int LUA_HudLib(lua_State *L)
|
||||
{
|
||||
memset(hud_enabled, 0xff, (hud_MAX/8)+1);
|
||||
|
||||
lua_newtable(L); // HUD registry table
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, lib_draw);
|
||||
lua_rawseti(L, -2, 1); // HUD[1] = lib_draw
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 2); // HUD[2] = game rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 3); // HUD[3] = scores rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 4); // HUD[4] = intermission rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 5); // HUD[5] = vote rendering functions array
|
||||
lua_setfield(L, LUA_REGISTRYINDEX, "HUD");
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, lib_draw);
|
||||
lib_draw_ref = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
|
||||
luaL_newmetatable(L, META_HUDINFO);
|
||||
lua_pushcfunction(L, hudinfo_get);
|
||||
@@ -1423,153 +1379,19 @@ boolean LUA_HudEnabled(enum hud option)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Hook for HUD rendering
|
||||
void LUAh_GameHUD(huddrawlist_h list)
|
||||
void LUA_SetHudHook(int hook, huddrawlist_h list)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_game)))
|
||||
return;
|
||||
|
||||
lua_getref(gL, lib_draw_ref);
|
||||
|
||||
lua_pushlightuserdata(gL, list);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
|
||||
hud_running = true;
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, hudhook_game+2); // HUD[2] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
LUA_PushUserdata(gL, stplyr, META_PLAYER);
|
||||
LUA_PushUserdata(gL, &camera[stplyrnum], META_CAMERA);
|
||||
camnum = stplyrnum + 1;
|
||||
|
||||
hud_interpcounter = 0;
|
||||
lua_pushnil(gL);
|
||||
while (lua_next(gL, -5) != 0) {
|
||||
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
||||
hud_interpcounter++;
|
||||
lua_pushvalue(gL, -5); // graphics library (HUD[1])
|
||||
lua_pushvalue(gL, -5); // stplyr
|
||||
lua_pushvalue(gL, -5); // camera
|
||||
LUA_Call(gL, 3, 0, 1);
|
||||
// there used to be a switch statement here, its gone now.
|
||||
if (hook == HUD_HOOK(game))
|
||||
{
|
||||
LUA_PushUserdata(gL, stplyr, META_PLAYER);
|
||||
LUA_PushUserdata(gL, &camera[stplyrnum], META_CAMERA);
|
||||
camnum = stplyrnum + 1; // for compatibility
|
||||
}
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushlightuserdata(gL, NULL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
|
||||
void LUAh_ScoresHUD(huddrawlist_h list)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_scores)))
|
||||
return;
|
||||
|
||||
lua_pushlightuserdata(gL, list);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
|
||||
hud_running = true;
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, hudhook_scores+2); // HUD[3] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
lua_pushnil(gL);
|
||||
hud_interpcounter = 0;
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
||||
hud_interpcounter++;
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1, 0, 1);
|
||||
}
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushlightuserdata(gL, NULL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
|
||||
void LUAh_IntermissionHUD(huddrawlist_h list)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_intermission)))
|
||||
return;
|
||||
|
||||
lua_pushlightuserdata(gL, list);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
|
||||
hud_running = true;
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, hudhook_intermission+2); // HUD[4] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
lua_pushnil(gL);
|
||||
hud_interpcounter = 0;
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
||||
hud_interpcounter++;
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1, 0, 1);
|
||||
}
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushlightuserdata(gL, NULL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
|
||||
void LUAh_VoteHUD(huddrawlist_h list)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_vote)))
|
||||
return;
|
||||
|
||||
lua_pushlightuserdata(gL, list);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
|
||||
hud_running = true;
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, hudhook_vote+2); // HUD[5] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
lua_pushnil(gL);
|
||||
hud_interpcounter = 0;
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
||||
hud_interpcounter++;
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1, 0, 1);
|
||||
}
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushlightuserdata(gL, NULL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
+30
-2
@@ -1312,7 +1312,8 @@ void LUA_Archive(savebuffer_t *save, boolean network)
|
||||
LUAh_NetArchiveHook(NetArchive, save); // call the NetArchive hook in archive mode
|
||||
}
|
||||
|
||||
ArchiveTables(&save->p);
|
||||
LUA_HookNetArchive(NetArchive); // call the NetArchive hook in archive mode
|
||||
ArchiveTables();
|
||||
|
||||
if (gL)
|
||||
lua_pop(gL, 1); // pop tables
|
||||
@@ -1335,7 +1336,34 @@ void LUA_UnArchive(savebuffer_t *save, boolean network)
|
||||
UnArchiveExtVars(&save->p, &players[i], network);
|
||||
}
|
||||
|
||||
if (network == true)
|
||||
do {
|
||||
mobjnum = READUINT32(save_p); // read a mobjnum
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
if (((mobj_t *)th)->mobjnum != mobjnum) // find matching mobj
|
||||
continue;
|
||||
UnArchiveExtVars(th); // apply variables
|
||||
}
|
||||
} while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
|
||||
|
||||
LUA_HookNetArchive(NetUnArchive); // call the NetArchive hook in unarchive mode
|
||||
UnArchiveTables();
|
||||
|
||||
if (gL)
|
||||
lua_pop(gL, 1); // pop tables
|
||||
}
|
||||
|
||||
// simplified versions of LUA_Archive for demos
|
||||
void LUA_ArchiveDemo(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
if (gL)
|
||||
lua_newtable(gL); // tables to be archived.
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
do {
|
||||
mobjnum = READUINT32(save->p); // read a mobjnum
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
|
||||
void LUA_CVarChanged(const char *name); // lua_consolelib.c
|
||||
int Lua_optoption(lua_State *L, int narg, int def, int list_ref);
|
||||
int Lua_CreateFieldTable(lua_State *L, const char *const lst[]);
|
||||
void LUAh_NetArchiveHook(lua_CFunction archFunc, savebuffer_t *save);
|
||||
void LUA_HookNetArchive(lua_CFunction archFunc);
|
||||
|
||||
// Console wrapper
|
||||
void COM_Lua_f(void);
|
||||
|
||||
@@ -247,6 +247,35 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x)
|
||||
return INT32_MAX;
|
||||
}
|
||||
|
||||
/** \brief The xs_CRoundToInt function
|
||||
|
||||
\param val double number
|
||||
|
||||
\return Round toward nearest, but ties round toward even
|
||||
*/
|
||||
#if defined(SRB2_BIG_ENDIAN)
|
||||
#define _xs_iexp_ 0
|
||||
#define _xs_iman_ 1
|
||||
#else
|
||||
#define _xs_iexp_ 1 //intel is little endian
|
||||
#define _xs_iman_ 0
|
||||
#endif //BigEndian_
|
||||
|
||||
typedef double real64;
|
||||
|
||||
typedef union _xs_doubleints
|
||||
{
|
||||
real64 val;
|
||||
unsigned ival[2];
|
||||
} _xs_doubleints;
|
||||
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE int xs_CRoundToInt(real64 val)
|
||||
{
|
||||
_xs_doubleints uval;
|
||||
uval.val = val + 6755399441055744.0;
|
||||
return uval.ival[_xs_iman_];
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t x;
|
||||
|
||||
+92
-148
@@ -2224,22 +2224,20 @@ static menuitem_t OP_PlayerDistortMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Sprite Distortion", NULL, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Sprite Rotation", &cv_spriteroll, 15},
|
||||
{IT_STRING | IT_CVAR, NULL, "Sprite Slope Rotation", &cv_sloperoll, 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Slope Rotation Distance", &cv_sloperolldist, 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Rotate Players when Sliptiding", &cv_sliptideroll, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Rotate Sparks and Boost Trails", &cv_sparkroll, 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Player Stretch Factor", &cv_gravstretch, 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Squish Sound Effect", &cv_slamsound, 105},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop", &cv_saltyhop, 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop Sound Effect", &cv_saltyhopsfx, 135},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop Squish", &cv_saltysquish, 150},
|
||||
{IT_STRING | IT_CVAR, NULL, "Sprite Slope Rotation", &cv_sloperoll, 15},
|
||||
{IT_STRING | IT_CVAR, NULL, "Slope Rotation Distance", &cv_sloperolldist, 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Rotate Players when Sliptiding", &cv_sliptideroll, 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Rotate Sparks and Boost Trails", &cv_sparkroll, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Player Stretch Factor", &cv_gravstretch, 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Squish Sound Effect", &cv_slamsound, 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop", &cv_saltyhop, 105},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop Sound Effect", &cv_saltyhopsfx, 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Saltyhop Squish", &cv_saltysquish, 135},
|
||||
};
|
||||
|
||||
static const char* OP_PlayerDistortTooltips[] =
|
||||
{
|
||||
NULL,
|
||||
"Sprite rotation features.",
|
||||
"Sprite rotation on slopes. Can either be just players or all objects.",
|
||||
"Distance object rotation should be visable.",
|
||||
"Player rotation when sliptiding.",
|
||||
@@ -2254,7 +2252,6 @@ static const char* OP_PlayerDistortTooltips[] =
|
||||
enum
|
||||
{
|
||||
spriteheader,
|
||||
spriterotate,
|
||||
sloperotate,
|
||||
slrotatedist,
|
||||
sliptide,
|
||||
@@ -3382,7 +3379,7 @@ void Addons_option_Onchange(void)
|
||||
|
||||
void PDistort_menu_Onchange(void)
|
||||
{
|
||||
if (!cv_spriteroll.value)
|
||||
if (!cv_sloperoll.value)
|
||||
{
|
||||
OP_PlayerDistortMenu[sloperotate].status = IT_GRAYEDOUT;
|
||||
OP_PlayerDistortMenu[sliptide].status = IT_GRAYEDOUT;
|
||||
@@ -3393,15 +3390,10 @@ void PDistort_menu_Onchange(void)
|
||||
OP_PlayerDistortMenu[sliptide].status = IT_STRING | IT_CVAR;
|
||||
}
|
||||
|
||||
if ((cv_sloperoll.value) && (cv_spriteroll.value)) //enable/disable sloperotate distance
|
||||
if (cv_sloperoll.value) //enable/disable sloperotate distance
|
||||
OP_PlayerDistortMenu[slrotatedist].status = IT_STRING | IT_CVAR;
|
||||
else
|
||||
OP_PlayerDistortMenu[slrotatedist].status = IT_GRAYEDOUT;
|
||||
|
||||
if ((cv_sloperoll.value == 2) && (cv_spriteroll.value)) //enable/disable sparkroll depending on which setting
|
||||
OP_PlayerDistortMenu[sparkrotate].status = IT_STRING | IT_CVAR;
|
||||
else
|
||||
OP_PlayerDistortMenu[sparkrotate].status = IT_GRAYEDOUT;
|
||||
}
|
||||
|
||||
void Bird_menu_Onchange(void)
|
||||
@@ -4994,7 +4986,7 @@ static void M_CentreText(INT32 y, const char *string)
|
||||
INT32 x;
|
||||
//added : 02-02-98 : centre on 320, because V_DrawString centers on vid.width...
|
||||
x = (BASEVIDWIDTH - V_StringWidth(string, V_OLDSPACING))>>1;
|
||||
V_DrawString(x,y,V_OLDSPACING,string);
|
||||
V_DrawString(x,y,V_OLDSPACING|MENUCAPS,string);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -5124,8 +5116,6 @@ static void M_DrawGenericMenu(void)
|
||||
{
|
||||
INT32 x, y, w, i, cursory = 0;
|
||||
|
||||
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
|
||||
|
||||
// DRAW MENU
|
||||
x = currentMenu->x;
|
||||
y = currentMenu->y;
|
||||
@@ -5171,9 +5161,9 @@ static void M_DrawGenericMenu(void)
|
||||
cursory = y;
|
||||
|
||||
if ((currentMenu->menuitems[i].status & IT_DISPLAY)==IT_STRING)
|
||||
V_DrawString(x, y, lowercase, currentMenu->menuitems[i].text);
|
||||
V_DrawString(x, y, MENUCAPS, currentMenu->menuitems[i].text);
|
||||
else
|
||||
V_DrawString(x, y, lowercase|highlightflags, currentMenu->menuitems[i].text);
|
||||
V_DrawString(x, y, MENUCAPS|highlightflags, currentMenu->menuitems[i].text);
|
||||
|
||||
// Cvar specific handling
|
||||
switch (currentMenu->menuitems[i].status & IT_TYPE)
|
||||
@@ -5200,7 +5190,7 @@ static void M_DrawGenericMenu(void)
|
||||
default:
|
||||
w = V_StringWidth(cv->string, 0);
|
||||
V_DrawString(BASEVIDWIDTH - x - w, y,
|
||||
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? warningflags : highlightflags)|lowercase, cv->string);
|
||||
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? warningflags : highlightflags)|MENUCAPS, cv->string);
|
||||
if (i == itemOn)
|
||||
{
|
||||
V_DrawCharacter(BASEVIDWIDTH - x - 10 - w - (skullAnimCounter/5), y,
|
||||
@@ -5215,7 +5205,7 @@ static void M_DrawGenericMenu(void)
|
||||
y += STRINGHEIGHT;
|
||||
break;
|
||||
case IT_STRING2:
|
||||
V_DrawString(((BASEVIDWIDTH - V_StringWidth(currentMenu->menuitems[i].text, 0))>>1), y, lowercase, currentMenu->menuitems[i].text);
|
||||
V_DrawString(((BASEVIDWIDTH - V_StringWidth(currentMenu->menuitems[i].text, 0))>>1), y, MENUCAPS, currentMenu->menuitems[i].text);
|
||||
/* FALLTHRU */
|
||||
case IT_DYLITLSPACE:
|
||||
y += SMALLLINEHEIGHT;
|
||||
@@ -5231,21 +5221,21 @@ static void M_DrawGenericMenu(void)
|
||||
y = currentMenu->y+currentMenu->menuitems[i].alphaKey;
|
||||
/* FALLTHRU */
|
||||
case IT_TRANSTEXT2:
|
||||
V_DrawString(x, y, V_TRANSLUCENT|lowercase, currentMenu->menuitems[i].text);
|
||||
V_DrawString(x, y, V_TRANSLUCENT|MENUCAPS, currentMenu->menuitems[i].text);
|
||||
y += SMALLLINEHEIGHT;
|
||||
break;
|
||||
case IT_QUESTIONMARKS:
|
||||
if (currentMenu->menuitems[i].alphaKey)
|
||||
y = currentMenu->y+currentMenu->menuitems[i].alphaKey;
|
||||
|
||||
V_DrawString(x, y, V_TRANSLUCENT|V_OLDSPACING|lowercase, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
|
||||
V_DrawString(x, y, V_TRANSLUCENT|V_OLDSPACING|MENUCAPS, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
|
||||
y += SMALLLINEHEIGHT;
|
||||
break;
|
||||
case IT_HEADERTEXT: // draws 16 pixels to the left, in yellow text
|
||||
if (currentMenu->menuitems[i].alphaKey)
|
||||
y = currentMenu->y+currentMenu->menuitems[i].alphaKey;
|
||||
|
||||
V_DrawString(x-16, y, highlightflags|lowercase, currentMenu->menuitems[i].text);
|
||||
V_DrawString(x-16, y, highlightflags|MENUCAPS, currentMenu->menuitems[i].text);
|
||||
y += SMALLLINEHEIGHT;
|
||||
break;
|
||||
}
|
||||
@@ -5262,7 +5252,7 @@ static void M_DrawGenericMenu(void)
|
||||
{
|
||||
V_DrawScaledPatch(currentMenu->x - 24, cursory, 0,
|
||||
W_CachePatchName("M_CURSOR", PU_CACHE));
|
||||
V_DrawString(currentMenu->x, cursory, lowercase|highlightflags, currentMenu->menuitems[itemOn].text);
|
||||
V_DrawString(currentMenu->x, cursory, MENUCAPS|highlightflags, currentMenu->menuitems[itemOn].text);
|
||||
}
|
||||
|
||||
// dumb hack
|
||||
@@ -5340,8 +5330,6 @@ static void M_DrawGenericScrollMenu(void)
|
||||
// draw title (or big pic)
|
||||
M_DrawMenuTitle();
|
||||
|
||||
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
|
||||
|
||||
for (; i < max; i++)
|
||||
{
|
||||
y = currentMenu->menuitems[i].alphaKey*2 + tempcentery;
|
||||
@@ -5358,9 +5346,9 @@ static void M_DrawGenericScrollMenu(void)
|
||||
case IT_STRING:
|
||||
case IT_WHITESTRING:
|
||||
if (i != itemOn && (currentMenu->menuitems[i].status & IT_DISPLAY)==IT_STRING)
|
||||
V_DrawString(x, y, lowercase, currentMenu->menuitems[i].text);
|
||||
V_DrawString(x, y, MENUCAPS, currentMenu->menuitems[i].text);
|
||||
else
|
||||
V_DrawString(x, y, lowercase|highlightflags, currentMenu->menuitems[i].text);
|
||||
V_DrawString(x, y, MENUCAPS|highlightflags, currentMenu->menuitems[i].text);
|
||||
|
||||
// Cvar specific handling
|
||||
switch (currentMenu->menuitems[i].status & IT_TYPE)
|
||||
@@ -5382,12 +5370,12 @@ static void M_DrawGenericScrollMenu(void)
|
||||
if (itemOn == i)
|
||||
M_DrawTextInput(x + 8, y + 12, &menuinput, 0);
|
||||
else
|
||||
V_DrawString(x + 8, y + 12, lowercase, cv->string);
|
||||
V_DrawString(x + 8, y + 12, MENUCAPS, cv->string);
|
||||
|
||||
break;
|
||||
default:
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH - x, y,
|
||||
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? V_REDMAP : highlightflags)|lowercase, cv->string);
|
||||
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? V_REDMAP : highlightflags)|MENUCAPS, cv->string);
|
||||
if (i == itemOn)
|
||||
{
|
||||
V_DrawCharacter(BASEVIDWIDTH - x - 10 - V_StringWidth(cv->string, 0) - (skullAnimCounter/5), y,
|
||||
@@ -5401,13 +5389,13 @@ static void M_DrawGenericScrollMenu(void)
|
||||
}
|
||||
break;
|
||||
case IT_TRANSTEXT:
|
||||
V_DrawString(x, y, V_TRANSLUCENT|lowercase, currentMenu->menuitems[i].text);
|
||||
V_DrawString(x, y, V_TRANSLUCENT|MENUCAPS, currentMenu->menuitems[i].text);
|
||||
break;
|
||||
case IT_QUESTIONMARKS:
|
||||
V_DrawString(x, y, lowercase|V_TRANSLUCENT|V_OLDSPACING, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
|
||||
V_DrawString(x, y, MENUCAPS|V_TRANSLUCENT|V_OLDSPACING, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
|
||||
break;
|
||||
case IT_HEADERTEXT:
|
||||
V_DrawString(x-16, y, highlightflags|lowercase, currentMenu->menuitems[i].text);
|
||||
V_DrawString(x-16, y, highlightflags|MENUCAPS, currentMenu->menuitems[i].text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -5462,8 +5450,6 @@ static void M_DrawCenteredMenu(void)
|
||||
// draw title (or big pic)
|
||||
M_DrawMenuTitle();
|
||||
|
||||
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
|
||||
|
||||
for (i = 0; i < currentMenu->numitems; i++)
|
||||
{
|
||||
if (i == itemOn)
|
||||
@@ -5502,9 +5488,9 @@ static void M_DrawCenteredMenu(void)
|
||||
cursory = y;
|
||||
|
||||
if ((currentMenu->menuitems[i].status & IT_DISPLAY)==IT_STRING)
|
||||
V_DrawCenteredString(x, y, lowercase, currentMenu->menuitems[i].text);
|
||||
V_DrawCenteredString(x, y, MENUCAPS, currentMenu->menuitems[i].text);
|
||||
else
|
||||
V_DrawCenteredString(x, y, highlightflags|lowercase, currentMenu->menuitems[i].text);
|
||||
V_DrawCenteredString(x, y, highlightflags|MENUCAPS, currentMenu->menuitems[i].text);
|
||||
|
||||
// Cvar specific handling
|
||||
switch(currentMenu->menuitems[i].status & IT_TYPE)
|
||||
@@ -5529,7 +5515,7 @@ static void M_DrawCenteredMenu(void)
|
||||
break;
|
||||
default:
|
||||
V_DrawString(BASEVIDWIDTH - x - V_StringWidth(cv->string, 0), y,
|
||||
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? warningflags : highlightflags)|lowercase, cv->string);
|
||||
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? warningflags : highlightflags)|MENUCAPS, cv->string);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -5537,7 +5523,7 @@ static void M_DrawCenteredMenu(void)
|
||||
y += STRINGHEIGHT;
|
||||
break;
|
||||
case IT_STRING2:
|
||||
V_DrawCenteredString(x, y, lowercase, currentMenu->menuitems[i].text);
|
||||
V_DrawCenteredString(x, y, MENUCAPS, currentMenu->menuitems[i].text);
|
||||
/* FALLTHRU */
|
||||
case IT_DYLITLSPACE:
|
||||
y += SMALLLINEHEIGHT;
|
||||
@@ -5546,7 +5532,7 @@ static void M_DrawCenteredMenu(void)
|
||||
if (currentMenu->menuitems[i].alphaKey)
|
||||
y = currentMenu->y+currentMenu->menuitems[i].alphaKey;
|
||||
|
||||
V_DrawCenteredString(x, y, V_TRANSLUCENT|V_OLDSPACING|lowercase, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
|
||||
V_DrawCenteredString(x, y, V_TRANSLUCENT|V_OLDSPACING|MENUCAPS, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
|
||||
y += SMALLLINEHEIGHT;
|
||||
break;
|
||||
case IT_GRAYPATCH:
|
||||
@@ -5569,7 +5555,7 @@ static void M_DrawCenteredMenu(void)
|
||||
{
|
||||
V_DrawScaledPatch(x - V_StringWidth(currentMenu->menuitems[itemOn].text, 0)/2 - 24, cursory, 0,
|
||||
W_CachePatchName("M_CURSOR", PU_CACHE));
|
||||
V_DrawCenteredString(x, cursory, highlightflags|lowercase, currentMenu->menuitems[itemOn].text);
|
||||
V_DrawCenteredString(x, cursory, highlightflags|MENUCAPS, currentMenu->menuitems[itemOn].text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5945,12 +5931,12 @@ static void M_DrawImageDef(void)
|
||||
{
|
||||
INT32 x = BASEVIDWIDTH>>1, y = (BASEVIDHEIGHT>>1) - 4;
|
||||
x += (itemOn ? 1 : -1)*((BASEVIDWIDTH>>2) + 10);
|
||||
V_DrawCenteredString(x, y-10, highlightflags, "USE ARROW KEYS");
|
||||
V_DrawCenteredString(x, y-10, highlightflags|MENUCAPS, "Use arrow keys");
|
||||
V_DrawCharacter(x - 10 - (skullAnimCounter/5), y,
|
||||
'\x1C' | highlightflags, false); // left arrow
|
||||
V_DrawCharacter(x + 2 + (skullAnimCounter/5), y,
|
||||
'\x1D' | highlightflags, false); // right arrow
|
||||
V_DrawCenteredString(x, y+10, highlightflags, "TO LEAF THROUGH");
|
||||
V_DrawCenteredString(x, y+10, highlightflags|MENUCAPS, "to leaf through");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6348,16 +6334,14 @@ static void M_DrawAddons(void)
|
||||
y = BASEVIDHEIGHT - currentMenu->y + 1;
|
||||
|
||||
M_DrawTextBox(x - (21 + 5), y, MAXSTRINGLENGTH, 1);
|
||||
if (menusearch[0])
|
||||
V_DrawString(x - 18, y + 8, V_ALLOWLOWERCASE, menusearch+1);
|
||||
|
||||
if (menusearch.length)
|
||||
M_DrawTextInput(x - 18, y + 8, &menusearch, 0);
|
||||
else
|
||||
V_DrawString(x - 18, y + 8, V_ALLOWLOWERCASE|V_TRANSLUCENT, "Type to search...");
|
||||
if (skullAnimCounter < 4)
|
||||
V_DrawCharacter(x - 18 + V_StringWidth(menusearch+1, 0), y + 8,
|
||||
'_' | 0x80, false);
|
||||
|
||||
x -= (21 + 5 + 16);
|
||||
V_DrawSmallScaledPatch(x, y + 4, (menusearch[0] ? 0 : V_TRANSLUCENT), addonsp[NUM_EXT+3]);
|
||||
V_DrawSmallScaledPatch(x, y + 4, (menusearch.length ? 0 : V_TRANSLUCENT), addonsp[NUM_EXT+3]);
|
||||
|
||||
x = BASEVIDWIDTH - x - 16;
|
||||
V_DrawSmallScaledPatch(x, y + 4, ((!majormods) ? 0 : V_TRANSLUCENT), addonsp[NUM_EXT+4]);
|
||||
@@ -6433,43 +6417,6 @@ static void M_AddonAutoLoad(INT32 ch)
|
||||
fclose(autoloadconfigfile);
|
||||
}
|
||||
|
||||
#define len menusearch[0]
|
||||
static boolean M_ChangeStringAddons(INT32 choice)
|
||||
{
|
||||
choice = M_ShiftChar(choice);
|
||||
|
||||
switch (choice)
|
||||
{
|
||||
case KEY_DEL:
|
||||
if (len)
|
||||
{
|
||||
len = menusearch[1] = 0;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case KEY_BACKSPACE:
|
||||
if (len)
|
||||
{
|
||||
menusearch[1+--len] = 0;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (choice >= 32 && choice <= 127)
|
||||
{
|
||||
if (len < MAXSTRINGLENGTH - 1)
|
||||
{
|
||||
menusearch[1+len++] = (char)choice;
|
||||
menusearch[1+len] = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#undef len
|
||||
|
||||
// i hate myself
|
||||
static boolean DumbStartsWith(const char *pre, const char *str)
|
||||
{
|
||||
@@ -6482,8 +6429,10 @@ static void M_HandleAddons(INT32 choice)
|
||||
{
|
||||
boolean exitmenu = false; // exit to previous menu
|
||||
|
||||
if (M_ChangeStringAddons(choice))
|
||||
if (M_TextInputHandle(&menusearch, choice))
|
||||
{
|
||||
S_StartSound(NULL,sfx_menu1);
|
||||
|
||||
char *tempname = NULL;
|
||||
if (dirmenu && dirmenu[dir_on[menudepthleft]])
|
||||
tempname = Z_StrDup(dirmenu[dir_on[menudepthleft]]+DIR_STRING); // don't need to I_Error if can't make - not important, just QoL
|
||||
@@ -7075,11 +7024,11 @@ static void DrawReplayHutReplayInfo(void)
|
||||
switch (demolist[dir_on[menudepthleft]].type)
|
||||
{
|
||||
case MD_NOTLOADED:
|
||||
V_DrawCenteredString(160, 40, V_SNAPTOTOP, "Loading replay information...");
|
||||
V_DrawCenteredString(160, 40, V_SNAPTOTOP|MENUCAPS, "Loading replay information...");
|
||||
break;
|
||||
|
||||
case MD_INVALID:
|
||||
V_DrawCenteredString(160, 40, V_SNAPTOTOP|warningflags, "This replay cannot be played.");
|
||||
V_DrawCenteredString(160, 40, V_SNAPTOTOP|warningflags|MENUCAPS, "This replay cannot be played.");
|
||||
break;
|
||||
|
||||
case MD_SUBDIR:
|
||||
@@ -7121,7 +7070,7 @@ static void DrawReplayHutReplayInfo(void)
|
||||
if (mapheaderinfo[demolist[dir_on[menudepthleft]].map-1])
|
||||
{
|
||||
char *title = G_BuildMapTitle(demolist[dir_on[menudepthleft]].map);
|
||||
V_DrawString(x, y, V_SNAPTOTOP, title);
|
||||
V_DrawString(x, y, V_SNAPTOTOP|MENUCAPS, title);
|
||||
Z_Free(title);
|
||||
}
|
||||
else
|
||||
@@ -7138,26 +7087,24 @@ static void DrawReplayHutReplayInfo(void)
|
||||
{
|
||||
// No standings were loaded!
|
||||
V_DrawString(x, y+39, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "No standings available.");
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
V_DrawThinString(x, y+29, V_SNAPTOTOP|highlightflags, "WINNER");
|
||||
V_DrawThinString(x, y+29, V_SNAPTOTOP|highlightflags|MENUCAPS, "Winner");
|
||||
V_DrawString(x+38, y+30, V_SNAPTOTOP|V_ALLOWLOWERCASE, demolist[dir_on[menudepthleft]].standings[0].name);
|
||||
|
||||
if (demolist[dir_on[menudepthleft]].gametype == GT_RACE)
|
||||
{
|
||||
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags, "TIME");
|
||||
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Time");
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags, "SCORE");
|
||||
V_DrawThinString(x, y+39, V_SNAPTOTOP|highlightflags|MENUCAPS, "Score");
|
||||
}
|
||||
|
||||
if (demolist[dir_on[menudepthleft]].standings[0].timeorscore == (UINT32_MAX-1))
|
||||
{
|
||||
V_DrawThinString(x+32, y+40-1, V_SNAPTOTOP, "NO CONTEST");
|
||||
V_DrawThinString(x+32, y+40-1, V_SNAPTOTOP|MENUCAPS, "No Contest");
|
||||
}
|
||||
else if (demolist[dir_on[menudepthleft]].gametype == GT_RACE)
|
||||
{
|
||||
@@ -7365,7 +7312,7 @@ static void M_DrawReplayHut(void)
|
||||
|
||||
static void M_DrawReplayStartMenu(void)
|
||||
{
|
||||
const char *warning;
|
||||
const char *warning = "";
|
||||
UINT8 i;
|
||||
|
||||
M_DrawGenericBackgroundMenu();
|
||||
@@ -7468,7 +7415,8 @@ static void M_DrawReplayStartMenu(void)
|
||||
return;
|
||||
}
|
||||
|
||||
V_DrawSmallString(4, BASEVIDHEIGHT-14, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, warning);
|
||||
if (warning)
|
||||
V_DrawSmallString(4, BASEVIDHEIGHT-14, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, warning);
|
||||
}
|
||||
|
||||
static boolean M_QuitReplayHut(void)
|
||||
@@ -8163,7 +8111,7 @@ static void M_DrawChecklist(void)
|
||||
++line;
|
||||
secretname = M_CreateSecretMenuOption(unlockables[i].name);
|
||||
|
||||
V_DrawString(8, (line*8), V_RETURN8|(unlockables[i].unlocked ? recommendedflags : warningflags), (secret ? secretname : unlockables[i].name));
|
||||
V_DrawString(8, (line*8), V_RETURN8|MENUCAPS|(unlockables[i].unlocked ? recommendedflags : warningflags), (secret ? secretname : unlockables[i].name));
|
||||
|
||||
if (conditionSets[unlockables[i].conditionset - 1].numconditions)
|
||||
{
|
||||
@@ -8721,8 +8669,8 @@ static void M_DrawStatsMaps(int location)
|
||||
}
|
||||
else if (dotopname)
|
||||
{
|
||||
V_DrawString(20, y, highlightflags, "LEVEL NAME");
|
||||
V_DrawString(256, y, highlightflags, "MEDALS");
|
||||
V_DrawString(20, y, highlightflags|MENUCAPS, "Level name");
|
||||
V_DrawString(256, y, highlightflags|MENUCAPS, "Medals");
|
||||
y += 8;
|
||||
dotopname = false;
|
||||
}
|
||||
@@ -8731,11 +8679,11 @@ static void M_DrawStatsMaps(int location)
|
||||
M_DrawMapEmblems(mnum+1, 295, y);
|
||||
|
||||
if (mapheaderinfo[mnum]->levelflags & LF_NOZONE)
|
||||
V_DrawString(20, y, 0, va("%s %s",
|
||||
V_DrawString(20, y, MENUCAPS, va("%s %s",
|
||||
mapheaderinfo[mnum]->lvlttl,
|
||||
mapheaderinfo[mnum]->actnum));
|
||||
else
|
||||
V_DrawString(20, y, 0, va("%s %s %s",
|
||||
V_DrawString(20, y, MENUCAPS, va("%s %s %s",
|
||||
mapheaderinfo[mnum]->lvlttl,
|
||||
(mapheaderinfo[mnum]->zonttl[0] ? mapheaderinfo[mnum]->zonttl : "Zone"),
|
||||
mapheaderinfo[mnum]->actnum));
|
||||
@@ -8747,8 +8695,8 @@ static void M_DrawStatsMaps(int location)
|
||||
}
|
||||
if (dotopname && !location)
|
||||
{
|
||||
V_DrawString(20, y, highlightflags, "LEVEL NAME");
|
||||
V_DrawString(256, y, highlightflags, "MEDALS");
|
||||
V_DrawString(20, y, highlightflags|MENUCAPS, "Level name");
|
||||
V_DrawString(256, y, highlightflags|MENUCAPS, "Medals");
|
||||
y += 8;
|
||||
}
|
||||
else if (location)
|
||||
@@ -8759,7 +8707,7 @@ static void M_DrawStatsMaps(int location)
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
V_DrawString(20, y, highlightflags, "EXTRA MEDALS");
|
||||
V_DrawString(20, y, highlightflags|MENUCAPS, "Extra medals");
|
||||
if (location)
|
||||
{
|
||||
y += 8;
|
||||
@@ -8782,7 +8730,7 @@ static void M_DrawStatsMaps(int location)
|
||||
else
|
||||
V_DrawSmallScaledPatch(295, y, 0, W_CachePatchName("NEEDIT", PU_CACHE));
|
||||
|
||||
V_DrawString(20, y, 0, va("%s", exemblem->description));
|
||||
V_DrawString(20, y, MENUCAPS, va("%s", exemblem->description));
|
||||
}
|
||||
|
||||
y += 8;
|
||||
@@ -8807,13 +8755,13 @@ static void M_DrawLevelStats(void)
|
||||
|
||||
M_DrawMenuTitle();
|
||||
|
||||
V_DrawString(20, 24, highlightflags, "Total Play Time:");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 32, 0, va("%i hours, %i minutes, %i seconds",
|
||||
V_DrawString(20, 24, highlightflags|MENUCAPS, "Total Play Time:");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 32, MENUCAPS, va("%i hours, %i minutes, %i seconds",
|
||||
G_TicsToHours(totalplaytime),
|
||||
G_TicsToMinutes(totalplaytime, false),
|
||||
G_TicsToSeconds(totalplaytime)));
|
||||
V_DrawString(20, 42, highlightflags, "Total Matches:");
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-16, 42, 0, va("%i played", matchesplayed));
|
||||
V_DrawString(20, 42, highlightflags|MENUCAPS, "Total Matches:");
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-16, 42, MENUCAPS, va("%i played", matchesplayed));
|
||||
|
||||
for (i = 0; i < NUMMAPS; i++)
|
||||
{
|
||||
@@ -8829,17 +8777,17 @@ static void M_DrawLevelStats(void)
|
||||
besttime += mainrecords[i]->time;
|
||||
}
|
||||
|
||||
V_DrawString(20, 62, highlightflags, "Combined time records:");
|
||||
V_DrawString(20, 62, highlightflags|MENUCAPS, "Combined time records:");
|
||||
|
||||
sprintf(beststr, "%i:%02i:%02i.%02i", G_TicsToHours(besttime), G_TicsToMinutes(besttime, false), G_TicsToSeconds(besttime), G_TicsToCentiseconds(besttime));
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-16, 62, (mapsunfinished ? warningflags : 0), beststr);
|
||||
|
||||
if (mapsunfinished)
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-16, 70, warningflags, va("(%d unfinished)", mapsunfinished));
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-16, 70, warningflags|MENUCAPS, va("(%d unfinished)", mapsunfinished));
|
||||
else
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-16, 70, recommendedflags, "(complete)");
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-16, 70, recommendedflags|MENUCAPS, "(complete)");
|
||||
|
||||
V_DrawString(32, 70, 0, va("x %d/%d", M_CountEmblems(), numemblems+numextraemblems));
|
||||
V_DrawString(32, 70, MENUCAPS, va("x %d/%d", M_CountEmblems(), numemblems+numextraemblems));
|
||||
V_DrawSmallScaledPatch(20, 70, 0, W_CachePatchName("GOTITA", PU_STATIC));
|
||||
|
||||
M_DrawStatsMaps(statsLocation);
|
||||
@@ -8927,7 +8875,7 @@ void M_DrawTimeAttackMenu(void)
|
||||
if (i == itemOn)
|
||||
cursory = y;
|
||||
|
||||
V_DrawString(x, y, (dispstatus == IT_WHITESTRING) ? highlightflags : 0 , currentMenu->menuitems[i].text);
|
||||
V_DrawString(x, y, ((dispstatus == IT_WHITESTRING) ? highlightflags : 0)|MENUCAPS, currentMenu->menuitems[i].text);
|
||||
|
||||
// Cvar specific handling
|
||||
if ((currentMenu->menuitems[i].status & IT_TYPE) == IT_CVAR)
|
||||
@@ -8952,7 +8900,7 @@ void M_DrawTimeAttackMenu(void)
|
||||
soffset = 0;
|
||||
|
||||
// Should see nothing but strings
|
||||
V_DrawString(BASEVIDWIDTH - x - soffset - strw, y, highlightflags, str);
|
||||
V_DrawString(BASEVIDWIDTH - x - soffset - strw, y, highlightflags|MENUCAPS, str);
|
||||
|
||||
if (i == itemOn)
|
||||
{
|
||||
@@ -8982,7 +8930,7 @@ void M_DrawTimeAttackMenu(void)
|
||||
|
||||
// DRAW THE SKULL CURSOR
|
||||
V_DrawScaledPatch(x - 24, cursory, 0, W_CachePatchName("M_CURSOR", PU_CACHE));
|
||||
V_DrawString(x, cursory, highlightflags, currentMenu->menuitems[itemOn].text);
|
||||
V_DrawString(x, cursory, highlightflags|MENUCAPS, currentMenu->menuitems[itemOn].text);
|
||||
|
||||
// Level record list
|
||||
if (cv_nextmap.value)
|
||||
@@ -8997,10 +8945,10 @@ void M_DrawTimeAttackMenu(void)
|
||||
|
||||
V_DrawFill((BASEVIDWIDTH - dupadjust)>>1, 78, dupadjust, 36, 239);
|
||||
|
||||
V_DrawRightAlignedString(149, 80, highlightflags, "BEST LAP:");
|
||||
V_DrawRightAlignedString(149, 80, highlightflags|MENUCAPS, "Best Lap:");
|
||||
K_drawKartTimestamp(lap, 19, 86, 0, 2);
|
||||
|
||||
V_DrawRightAlignedString(292, 80, highlightflags, "BEST TIME:");
|
||||
V_DrawRightAlignedString(292, 80, highlightflags|MENUCAPS, "Best Time:");
|
||||
K_drawKartTimestamp(time, 162, 86, cv_nextmap.value, 1);
|
||||
}
|
||||
|
||||
@@ -9012,7 +8960,7 @@ void M_DrawTimeAttackMenu(void)
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
y = currentMenu->y+SP_TimeAttackMenu[i].alphaKey;
|
||||
V_DrawString(x, y, V_TRANSLUCENT, SP_TimeAttackMenu[i].text);
|
||||
V_DrawString(x, y, V_TRANSLUCENT|MENUCAPS, SP_TimeAttackMenu[i].text);
|
||||
ncv = (consvar_t *)SP_TimeAttackMenu[i].itemaction;
|
||||
if (SP_TimeAttackMenu[i].status & IT_CV_STRING)
|
||||
{
|
||||
@@ -9029,7 +8977,7 @@ void M_DrawTimeAttackMenu(void)
|
||||
soffset = 0;
|
||||
|
||||
// Should see nothing but strings
|
||||
V_DrawString(BASEVIDWIDTH - x - soffset - strw, y, highlightflags|V_TRANSLUCENT, str);
|
||||
V_DrawString(BASEVIDWIDTH - x - soffset - strw, y, highlightflags|V_TRANSLUCENT|MENUCAPS, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10059,10 +10007,10 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
||||
len = strlen(addonname);
|
||||
#define charsonside 14
|
||||
if (len > charlimit)
|
||||
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT, va("%.*s...%s", charsonside, addonname, addonname+((len-charlimit) + charsonside))); // variable reuse...
|
||||
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT|MENUCAPS, va("%.*s...%s", charsonside, addonname, addonname+((len-charlimit) + charsonside))); // variable reuse...
|
||||
#undef charsonside
|
||||
else
|
||||
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT, addonname); // variable reuse...
|
||||
V_DrawThinString(x+w+5, y+i-8, V_TRANSLUCENT|MENUCAPS, addonname); // variable reuse...
|
||||
}
|
||||
|
||||
if (!cv_kartencore.value || gamestate == GS_TIMEATTACK || cv_newgametype.value != GT_RACE)
|
||||
@@ -10245,18 +10193,16 @@ static void M_DrawMPMainMenu(void)
|
||||
// use generic drawer for cursor, items and title
|
||||
M_DrawGenericMenu();
|
||||
|
||||
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
|
||||
|
||||
#ifndef NONET
|
||||
#if MAXPLAYERS != 16
|
||||
Update the maxplayers label...
|
||||
#endif
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-x, y+MP_MainMenu[4].alphaKey,
|
||||
((itemOn == 4) ? highlightflags : 0)|lowercase, "(2-16 Players)");
|
||||
((itemOn == 4) ? highlightflags : 0)|MENUCAPS, "(2-16 Players)");
|
||||
#endif
|
||||
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-x, y+MP_MainMenu[5].alphaKey,
|
||||
((itemOn == 5) ? highlightflags : 0)|lowercase,
|
||||
((itemOn == 5) ? highlightflags : 0)|MENUCAPS,
|
||||
"(2-4 players)"
|
||||
);
|
||||
|
||||
@@ -12603,10 +12549,8 @@ static void M_DrawVideoMenu(void)
|
||||
{
|
||||
M_DrawGenericMenu();
|
||||
|
||||
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
|
||||
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + OP_VideoOptionsMenu[0].alphaKey,
|
||||
(SCR_IsAspectCorrect(vid.width, vid.height) ? recommendedflags : highlightflags)|lowercase,
|
||||
(SCR_IsAspectCorrect(vid.width, vid.height) ? recommendedflags : highlightflags)|MENUCAPS,
|
||||
va("%dx%d", vid.width, vid.height));
|
||||
}
|
||||
|
||||
@@ -12771,17 +12715,17 @@ static void M_DrawVideoMode(void)
|
||||
M_DrawMenuTitle();
|
||||
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y,
|
||||
highlightflags, "Choose mode, reselect to change default");
|
||||
highlightflags|MENUCAPS, "Choose mode, reselect to change default");
|
||||
|
||||
row = 41;
|
||||
col = OP_VideoModeDef.y + 14;
|
||||
for (i = 0; i < vidm_nummodes; i++)
|
||||
{
|
||||
if (i == vidm_selected)
|
||||
V_DrawString(row, col, highlightflags, modedescs[i].desc);
|
||||
V_DrawString(row, col, highlightflags|MENUCAPS, modedescs[i].desc);
|
||||
// Show multiples of 320x200 as green.
|
||||
else
|
||||
V_DrawString(row, col, (modedescs[i].goodratio) ? recommendedflags : 0, modedescs[i].desc);
|
||||
V_DrawString(row, col, ((modedescs[i].goodratio) ? recommendedflags : 0)|MENUCAPS, modedescs[i].desc);
|
||||
|
||||
col += 8;
|
||||
if ((i % vidm_column_size) == (vidm_column_size-1))
|
||||
@@ -12819,11 +12763,11 @@ static void M_DrawVideoMode(void)
|
||||
cv_scr_width.value, cv_scr_height.value));
|
||||
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 138,
|
||||
recommendedflags, "Marked modes are recommended.");
|
||||
recommendedflags|MENUCAPS, "Marked modes are recommended.");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 146,
|
||||
highlightflags, "Other modes may have visual errors.");
|
||||
highlightflags|MENUCAPS, "Other modes may have visual errors.");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, OP_VideoModeDef.y + 158,
|
||||
highlightflags, "Larger modes may have performance issues.");
|
||||
highlightflags|MENUCAPS, "Larger modes may have performance issues.");
|
||||
}
|
||||
|
||||
// Draw the cursor for the VidMode menu
|
||||
@@ -12891,9 +12835,9 @@ static void M_DrawColorMenu(void)
|
||||
case IT_STRING:
|
||||
case IT_WHITESTRING:
|
||||
if (i != itemOn && (currentMenu->menuitems[i].status & IT_DISPLAY)==IT_STRING)
|
||||
V_DrawString(x, y, 0, currentMenu->menuitems[i].text);
|
||||
V_DrawString(x, y, MENUCAPS, currentMenu->menuitems[i].text);
|
||||
else
|
||||
V_DrawString(x, y, V_YELLOWMAP, currentMenu->menuitems[i].text);
|
||||
V_DrawString(x, y, V_YELLOWMAP|MENUCAPS, currentMenu->menuitems[i].text);
|
||||
|
||||
// Cvar specific handling
|
||||
switch (currentMenu->menuitems[i].status & IT_TYPE)
|
||||
@@ -12928,13 +12872,13 @@ static void M_DrawColorMenu(void)
|
||||
}
|
||||
break;
|
||||
case IT_TRANSTEXT:
|
||||
V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text);
|
||||
V_DrawString(x, y, V_TRANSLUCENT|MENUCAPS, currentMenu->menuitems[i].text);
|
||||
break;
|
||||
case IT_QUESTIONMARKS:
|
||||
V_DrawString(x, y, V_TRANSLUCENT|V_OLDSPACING, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
|
||||
V_DrawString(x, y, V_TRANSLUCENT|V_OLDSPACING|MENUCAPS, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
|
||||
break;
|
||||
case IT_HEADERTEXT:
|
||||
V_DrawString(x-16, y, V_YELLOWMAP, currentMenu->menuitems[i].text);
|
||||
V_DrawString(x-16, y, V_YELLOWMAP|MENUCAPS, currentMenu->menuitems[i].text);
|
||||
//V_DrawFill(19, y, 281, 9, currentMenu->menuitems[i+1].alphaKey);
|
||||
//V_DrawFill(300, y, 1, 9, 26);
|
||||
//M_DrawLevelPlatterHeader(y - (lsheadingheight - 12), currentMenu->menuitems[i].text, false);
|
||||
|
||||
@@ -140,6 +140,8 @@ void M_TextInputClear(textinput_t *input)
|
||||
input->cursor = 0;
|
||||
input->select = 0;
|
||||
input->length = 0;
|
||||
|
||||
input->buffer[0] = 0;
|
||||
}
|
||||
|
||||
void M_TextInputSetString(textinput_t *input, const char *c)
|
||||
|
||||
+1
-78
@@ -165,9 +165,6 @@ void A_SpawnObjectAbsolute(mobj_t *actor);
|
||||
void A_SpawnObjectRelative(mobj_t *actor);
|
||||
void A_ChangeAngleRelative(mobj_t *actor);
|
||||
void A_ChangeAngleAbsolute(mobj_t *actor);
|
||||
void A_RollAngle(mobj_t *actor);
|
||||
void A_ChangeRollAngleRelative(mobj_t *actor);
|
||||
void A_ChangeRollAngleAbsolute(mobj_t *actor);
|
||||
void A_PlaySound(mobj_t *actor);
|
||||
void A_FindTarget(mobj_t *actor);
|
||||
void A_FindTracer(mobj_t *actor);
|
||||
@@ -2653,7 +2650,7 @@ void A_BossDeath(mobj_t *mo)
|
||||
}
|
||||
|
||||
bossjustdie:
|
||||
if (LUAh_BossDeath(mo))
|
||||
if (LUA_HookMobj(mo, MOBJ_HOOK(BossDeath)))
|
||||
return;
|
||||
else if (P_MobjWasRemoved(mo))
|
||||
return;
|
||||
@@ -7158,80 +7155,6 @@ void A_ChangeAngleAbsolute(mobj_t *actor)
|
||||
actor->angle = FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
||||
// Function: A_RollAngle
|
||||
//
|
||||
// Description: Changes the roll angle.
|
||||
//
|
||||
// var1 = angle
|
||||
// var2 = relative? (default)
|
||||
//
|
||||
void A_RollAngle(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
const angle_t angle = FixedAngle(locvar1*FRACUNIT);
|
||||
|
||||
if (LUA_CallAction(A_ROLLANGLE, actor))
|
||||
return;
|
||||
|
||||
// relative (default)
|
||||
if (!locvar2)
|
||||
actor->rollangle += angle;
|
||||
// absolute
|
||||
else
|
||||
actor->rollangle = angle;
|
||||
}
|
||||
|
||||
// Function: A_ChangeRollAngleRelative
|
||||
//
|
||||
// Description: Changes the roll angle to a random relative value between the min and max. Set min and max to the same value to eliminate randomness
|
||||
//
|
||||
// var1 = min
|
||||
// var2 = max
|
||||
//
|
||||
void A_ChangeRollAngleRelative(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
const fixed_t amin = locvar1*FRACUNIT;
|
||||
const fixed_t amax = locvar2*FRACUNIT;
|
||||
|
||||
if (LUA_CallAction(A_CHANGEROLLANGLERELATIVE, actor))
|
||||
return;
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (amin > amax)
|
||||
I_Error("A_ChangeRollAngleRelative: var1 is greater than var2");
|
||||
#endif
|
||||
|
||||
actor->rollangle += FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
||||
// Function: A_ChangeRollAngleAbsolute
|
||||
//
|
||||
// Description: Changes the roll angle to a random absolute value between the min and max. Set min and max to the same value to eliminate randomness
|
||||
//
|
||||
// var1 = min
|
||||
// var2 = max
|
||||
//
|
||||
void A_ChangeRollAngleAbsolute(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
const fixed_t amin = locvar1*FRACUNIT;
|
||||
const fixed_t amax = locvar2*FRACUNIT;
|
||||
|
||||
if (LUA_CallAction(A_CHANGEROLLANGLEABSOLUTE, actor))
|
||||
return;
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (amin > amax)
|
||||
I_Error("A_ChangeRollAngleAbsolute: var1 is greater than var2");
|
||||
#endif
|
||||
|
||||
actor->rollangle = FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
||||
// Function: A_PlaySound
|
||||
//
|
||||
// Description: Plays a sound
|
||||
|
||||
+10
-6
@@ -2119,10 +2119,11 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
sec = §ors[secnum];
|
||||
|
||||
FOFsector = false;
|
||||
INT32 special = GETSECSPECIAL(sec->special, 2);
|
||||
|
||||
if (GETSECSPECIAL(sec->special, 2) == 3 || GETSECSPECIAL(sec->special, 2) == 5)
|
||||
if (special == 3 || special == 5)
|
||||
floortouch = true;
|
||||
else if (GETSECSPECIAL(sec->special, 2) >= 1 && GETSECSPECIAL(sec->special, 2) <= 8)
|
||||
else if (special >= 1 && special <= 8)
|
||||
floortouch = false;
|
||||
else
|
||||
continue;
|
||||
@@ -2254,7 +2255,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
continue;
|
||||
|
||||
if (!(players[i].mo->subsector->sector == sec
|
||||
|| P_PlayerTouchingSectorSpecial(&players[i], 2, (GETSECSPECIAL(sec->special, 2))) == sec))
|
||||
|| P_PlayerTouchingSectorSpecial(&players[i], 2, special) == sec))
|
||||
continue;
|
||||
|
||||
if (floortouch == true && P_IsObjectOnRealGround(players[i].mo, sec))
|
||||
@@ -2298,7 +2299,9 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
|
||||
while ((affectPlayer = P_HavePlayersEnteredArea(playersArea, oldPlayersArea, inAndOut)) != -1)
|
||||
{
|
||||
if (GETSECSPECIAL(sec->special, 2) == 2 || GETSECSPECIAL(sec->special, 2) == 3)
|
||||
INT32 special = GETSECSPECIAL(sec->special, 2);
|
||||
|
||||
if (special == 2 || special == 3)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
@@ -2917,11 +2920,12 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
|
||||
fixed_t a, b, c;
|
||||
mobjtype_t type = MT_ROCKCRUMBLE1;
|
||||
const fixed_t spacing = 48*mapobjectscale;
|
||||
INT32 special = GETSECSPECIAL(rover->master->frontsector->special, 3);
|
||||
|
||||
// If the control sector has a special
|
||||
// of Section3:7-15, use the custom debris.
|
||||
if (GETSECSPECIAL(rover->master->frontsector->special, 3) >= 8)
|
||||
type = MT_ROCKCRUMBLE1+(GETSECSPECIAL(rover->master->frontsector->special, 3)-7);
|
||||
if (special >= 8)
|
||||
type = MT_ROCKCRUMBLE1+(special-7);
|
||||
|
||||
sec->soundorg.z = (rover->master->frontsector->floorheight + rover->master->frontsector->ceilingheight)/2;
|
||||
S_StartSound(&sec->soundorg, sfx_crumbl);
|
||||
|
||||
+10
-11
@@ -284,7 +284,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
if (special->flags & MF_BOSS && special->flags2 & MF2_FRET)
|
||||
return;
|
||||
|
||||
if (LUAh_TouchSpecial(special, toucher) || P_MobjWasRemoved(special))
|
||||
if (LUA_HookTouchSpecial(special, toucher) || P_MobjWasRemoved(special))
|
||||
return;
|
||||
|
||||
if (special->flags & MF_BOSS)
|
||||
@@ -965,11 +965,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
break;
|
||||
case MT_HOOPCOLLIDE:
|
||||
// This produces a kind of 'domino effect' with the hoop's pieces.
|
||||
if (!midgamejoin)
|
||||
for (; special->hprev != NULL; special = special->hprev); // Move to the first sprite in the hoop
|
||||
for (; !P_MobjWasRemoved(special->hprev); special = special->hprev); // Move to the first sprite in the hoop
|
||||
|
||||
i = 0;
|
||||
for (; special->type == MT_HOOP; special = special->hnext)
|
||||
for (; !P_MobjWasRemoved(special->hnext) && special->type == MT_HOOP; special = special->hnext)
|
||||
{
|
||||
special->fuse = 11;
|
||||
special->movedir = i;
|
||||
@@ -1616,7 +1615,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
target->flags2 &= ~(MF2_SKULLFLY|MF2_NIGHTSPULL);
|
||||
target->health = 0; // This makes it easy to check if something's dead elsewhere.
|
||||
|
||||
if (LUAh_MobjDeath(target, inflictor, source) || P_MobjWasRemoved(target))
|
||||
if (LUA_HookMobjDeath(target, inflictor, source) || P_MobjWasRemoved(target))
|
||||
return;
|
||||
|
||||
// SRB2kart
|
||||
@@ -2275,7 +2274,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
// Everything above here can't be forced.
|
||||
if (!metalrecording)
|
||||
{
|
||||
UINT8 shouldForce = LUAh_ShouldDamage(target, inflictor, source, damage);
|
||||
UINT8 shouldForce = LUA_HookShouldDamage(target, inflictor, source, damage);
|
||||
if (P_MobjWasRemoved(target))
|
||||
return (shouldForce == 1); // mobj was removed
|
||||
if (shouldForce == 1)
|
||||
@@ -2316,7 +2315,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
if (!force && target->fuse) // Invincible
|
||||
return false;
|
||||
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
return true;
|
||||
|
||||
if (target->health > 1)
|
||||
@@ -2342,7 +2341,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
if (!force && target->flags2 & MF2_FRET) // Currently flashing from being hit
|
||||
return false;
|
||||
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
return true;
|
||||
|
||||
if (target->health > 1)
|
||||
@@ -2350,7 +2349,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
}
|
||||
else if (target->flags & MF_ENEMY)
|
||||
{
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2372,14 +2371,14 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
return false; // Don't hit yourself with your own paraloop, baka
|
||||
}
|
||||
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage))
|
||||
return true;
|
||||
|
||||
P_NiGHTSDamage(target, source); // -5s :(
|
||||
return true;
|
||||
}
|
||||
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage))
|
||||
return true;
|
||||
|
||||
if (!force && inflictor && (inflictor->flags & MF_FIRE))
|
||||
|
||||
+7
-2
@@ -63,6 +63,7 @@
|
||||
|
||||
// both the head and tail of the thinker list
|
||||
extern thinker_t thinkercap;
|
||||
extern mobj_t *mobjcache;
|
||||
|
||||
void P_InitThinkers(void);
|
||||
void P_AddThinker(thinker_t *thinker);
|
||||
@@ -254,7 +255,7 @@ void P_SceneryThinker(mobj_t *mobj);
|
||||
// To test it in Lua, check mobj.valid
|
||||
FUNCINLINE static ATTRINLINE boolean P_MobjWasRemoved(const mobj_t *mobj)
|
||||
{
|
||||
return !(mobj && mobj->thinker.function.acp1 == (actionf_p1)P_MobjThinker);
|
||||
return (!mobj || mobj->thinker.function.acp1 != (actionf_p1)P_MobjThinker);
|
||||
}
|
||||
|
||||
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
||||
@@ -363,7 +364,11 @@ boolean P_MoveOrigin(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z);
|
||||
void P_SlideMove(mobj_t *mo, boolean forceslide);
|
||||
void P_BouncePlayerMove(mobj_t *mo);
|
||||
void P_BounceMove(mobj_t *mo);
|
||||
boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
|
||||
|
||||
#define P_CheckSight(t1, t2) P_CheckSight2(t1, t2, false)
|
||||
#define P_CheckSightFast(t1, t2) P_CheckSight2(t1, t2, true)
|
||||
boolean P_CheckSight2(mobj_t *t1, mobj_t *t2, boolean fast);
|
||||
|
||||
void P_CheckHoopPosition(mobj_t *hoopthing, fixed_t x, fixed_t y, fixed_t z, fixed_t radius);
|
||||
|
||||
boolean P_CheckSector(sector_t *sector, boolean crunch);
|
||||
|
||||
+9
-5
@@ -444,7 +444,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
}
|
||||
|
||||
{
|
||||
UINT8 shouldCollide = LUAh_MobjCollide(thing, tmthing); // checks hook for thing's type
|
||||
UINT8 shouldCollide = LUA_Hook2Mobj(thing, tmthing, MOBJ_HOOK(MobjCollide)); // checks hook for thing's type
|
||||
if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing))
|
||||
return true; // one of them was removed???
|
||||
if (shouldCollide == 1)
|
||||
@@ -453,7 +453,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
return true; // force no collide
|
||||
}
|
||||
{
|
||||
UINT8 shouldCollide = LUAh_MobjMoveCollide(tmthing, thing); // checks hook for tmthing's type
|
||||
UINT8 shouldCollide = LUA_Hook2Mobj(tmthing, thing, MOBJ_HOOK(MobjMoveCollide)); // checks hook for tmthing's type
|
||||
if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing))
|
||||
return true; // one of them was removed???
|
||||
if (shouldCollide == 1)
|
||||
@@ -1722,6 +1722,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
tmbbox[BOXLEFT] = x - tmthing->radius;
|
||||
|
||||
newsubsec = R_PointInSubsector(x, y);
|
||||
|
||||
ceilingline = blockingline = NULL;
|
||||
|
||||
// The base floor / ceiling is from the subsector
|
||||
@@ -2370,16 +2371,19 @@ 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)
|
||||
{
|
||||
special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1);
|
||||
|
||||
// If using type Section1:13, double the maxstep.
|
||||
if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 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)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 12)
|
||||
|| special == 12)
|
||||
maxstep = 0;
|
||||
}
|
||||
|
||||
@@ -2425,7 +2429,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
else if (maxstep > 0 && !(
|
||||
thing->player && (
|
||||
P_PlayerTouchingSectorSpecial(thing->player, 1, 14)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14)
|
||||
|| special == 14)
|
||||
)) // Step down
|
||||
{
|
||||
// If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS
|
||||
|
||||
+72
-64
@@ -48,6 +48,7 @@ actioncache_t actioncachehead;
|
||||
static mobj_t *overlaycap = NULL;
|
||||
static mobj_t *shadowcap = NULL;
|
||||
mobj_t *waypointcap = NULL;
|
||||
mobj_t *mobjcache = NULL;
|
||||
|
||||
void P_InitCachedActions(void)
|
||||
{
|
||||
@@ -1881,12 +1882,13 @@ boolean P_CheckDeathPitCollide(mobj_t *mo)
|
||||
I_Assert(mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mo));
|
||||
|
||||
INT32 special = GETSECSPECIAL(mo->subsector->sector->special, 1);
|
||||
|
||||
if (((mo->z <= mo->subsector->sector->floorheight
|
||||
&& !(mo->eflags & MFE_VERTICALFLIP) && (mo->subsector->sector->flags & SF_FLIPSPECIAL_FLOOR))
|
||||
|| (mo->z + mo->height >= mo->subsector->sector->ceilingheight
|
||||
&& (mo->eflags & MFE_VERTICALFLIP) && (mo->subsector->sector->flags & SF_FLIPSPECIAL_CEILING)))
|
||||
&& (GETSECSPECIAL(mo->subsector->sector->special, 1) == 6
|
||||
|| GETSECSPECIAL(mo->subsector->sector->special, 1) == 7))
|
||||
&& (special == 6 || special == 7))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -1897,16 +1899,14 @@ boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover)
|
||||
I_Assert(mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mo));
|
||||
|
||||
{
|
||||
fixed_t topheight =
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) :
|
||||
*rover->topheight;
|
||||
fixed_t topheight =
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) :
|
||||
*rover->topheight;
|
||||
|
||||
if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3
|
||||
&& !(rover->master->flags & ML_BLOCKMONSTERS)
|
||||
&& ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > topheight - FixedMul(16*FRACUNIT, mo->scale)))
|
||||
return true;
|
||||
}
|
||||
if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3
|
||||
&& !(rover->master->flags & ML_BLOCKMONSTERS)
|
||||
&& ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > topheight - FixedMul(16*FRACUNIT, mo->scale)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -3294,7 +3294,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||
if (player->pflags & PF_TIMEOVER)
|
||||
player->kartstuff[k_timeovercam] = (2*TICRATE)+1;
|
||||
|
||||
if (!resetcalled && !(player->pflags & PF_NOCLIP || leveltime < introtime) && !P_CheckSight(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead.
|
||||
if (!resetcalled && !(player->pflags & PF_NOCLIP || leveltime < introtime) && !P_CheckSightFast(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead.
|
||||
P_ResetCamera(player, thiscam);
|
||||
else
|
||||
P_SlideCameraMove(thiscam);
|
||||
@@ -3304,9 +3304,11 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NOCLIPCAM
|
||||
P_CheckCameraPosition(thiscam->x, thiscam->y, thiscam);
|
||||
#endif
|
||||
|
||||
thiscam->subsector = R_PointInSubsector(thiscam->x, thiscam->y);
|
||||
thiscam->subsector = R_PointInSubsectorFast(thiscam->x, thiscam->y);
|
||||
thiscam->floorz = tmfloorz;
|
||||
thiscam->ceilingz = tmceilingz;
|
||||
|
||||
@@ -5999,18 +6001,17 @@ static void P_KoopaThinker(mobj_t *koopa)
|
||||
//
|
||||
void P_RollPitchMobj(mobj_t* mobj)
|
||||
{
|
||||
if (!mobj || P_MobjWasRemoved(mobj))
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return;
|
||||
|
||||
if (cv_spriteroll.value && cv_sloperoll.value == 2)
|
||||
{
|
||||
K_RollMobjBySlopes(mobj, cv_sloperolldist.value && !splitscreen);
|
||||
}
|
||||
else
|
||||
if (cv_sloperoll.value != 2)
|
||||
{
|
||||
mobj->sloperoll = FixedAngle(0);
|
||||
mobj->slopepitch = FixedAngle(0);
|
||||
return;
|
||||
}
|
||||
|
||||
K_RollMobjBySlopes(mobj, cv_sloperolldist.value && !splitscreen);
|
||||
}
|
||||
|
||||
angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
@@ -6021,14 +6022,17 @@ angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
angle_t camang = 0;
|
||||
angle_t return_angle = 0;
|
||||
|
||||
if (!cv_spriteroll.value)
|
||||
if (!cv_sloperoll.value)
|
||||
return 0;
|
||||
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return 0;
|
||||
|
||||
size_t rot = mobj->frame & FF_FRAMEMASK;
|
||||
boolean papersprite = (mobj->frame & FF_PAPERSPRITE);
|
||||
// if mobj doesent have any of those, no need to do the rest
|
||||
if (mobj->roll == 0 && mobj->pitch == 0 && mobj->sloperoll == 0 && mobj->slopepitch == 0)
|
||||
return 0;
|
||||
|
||||
size_t rot = (mobj->frame & FF_FRAMEMASK);
|
||||
|
||||
if (mobj->skin && mobj->sprite == SPR_PLAY)
|
||||
{
|
||||
@@ -6045,7 +6049,7 @@ angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
if (rot >= sprdef->numframes)
|
||||
{
|
||||
sprdef = &sprites[states[S_UNKNOWN].sprite];
|
||||
rot = states[S_UNKNOWN].frame&FF_FRAMEMASK;
|
||||
rot = (states[S_UNKNOWN].frame & FF_FRAMEMASK);
|
||||
}
|
||||
|
||||
sprframe = &sprdef->spriteframes[rot];
|
||||
@@ -6053,20 +6057,16 @@ angle_t P_MobjPitchAndRoll(mobj_t *mobj)
|
||||
// No sprite frame? I guess it is possible
|
||||
if (!sprframe) return 0;
|
||||
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite)
|
||||
if (sprframe->rotate != SRF_SINGLE || (mobj->frame & FF_PAPERSPRITE))
|
||||
{
|
||||
ang = R_PointToAngle(mobj->x, mobj->y) - mobj->angle;
|
||||
camang = R_PointToAngle(mobj->x, mobj->y);
|
||||
}
|
||||
|
||||
return_angle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mobj->roll)
|
||||
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), mobj->pitch);
|
||||
|
||||
if (cv_sloperoll.value)
|
||||
{
|
||||
return_angle += FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), mobj->sloperoll)
|
||||
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), mobj->slopepitch);
|
||||
}
|
||||
+ FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), mobj->pitch)
|
||||
+ FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), mobj->sloperoll)
|
||||
+ FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), mobj->slopepitch);
|
||||
|
||||
return return_angle;
|
||||
}
|
||||
@@ -6153,7 +6153,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
// Special thinker for scenery objects
|
||||
if (mobj->flags & MF_SCENERY)
|
||||
{
|
||||
if (LUAh_MobjThinker(mobj))
|
||||
if (LUA_HookMobj(mobj, MOBJ_HOOK(MobjThinker)))
|
||||
return;
|
||||
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
@@ -6851,7 +6851,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
mobj->fuse--;
|
||||
if (!mobj->fuse)
|
||||
{
|
||||
if (!LUAh_MobjFuse(mobj))
|
||||
if (!LUA_HookMobj(mobj, MOBJ_HOOK(MobjFuse)))
|
||||
P_RemoveMobj(mobj);
|
||||
return;
|
||||
}
|
||||
@@ -6866,13 +6866,13 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
// Check for a Lua thinker first
|
||||
if (!mobj->player)
|
||||
{
|
||||
if (LUAh_MobjThinker(mobj) || P_MobjWasRemoved(mobj))
|
||||
if (LUA_HookMobj(mobj, MOBJ_HOOK(MobjThinker)) || P_MobjWasRemoved(mobj))
|
||||
return;
|
||||
}
|
||||
else if (!mobj->player->spectator)
|
||||
{
|
||||
// You cannot short-circuit the player thinker like you can other thinkers.
|
||||
LUAh_MobjThinker(mobj);
|
||||
LUA_HookMobj(mobj, MOBJ_HOOK(MobjThinker));
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return;
|
||||
}
|
||||
@@ -6897,7 +6897,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
}
|
||||
else if (mobj->flags & MF_BOSS)
|
||||
{
|
||||
if (LUAh_BossThinker(mobj))
|
||||
if (LUA_HookMobj(mobj, MOBJ_HOOK(BossThinker)))
|
||||
{
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return;
|
||||
@@ -8864,7 +8864,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
fixed_t x, y, z;
|
||||
mobj_t *flagmo, *newmobj;
|
||||
|
||||
if (!LUAh_MobjFuse(mobj) && !P_MobjWasRemoved(mobj))
|
||||
if (!LUA_HookMobj(mobj, MOBJ_HOOK(MobjFuse)) && !P_MobjWasRemoved(mobj))
|
||||
{
|
||||
switch (mobj->type)
|
||||
{
|
||||
@@ -9199,7 +9199,6 @@ void P_PushableThinker(mobj_t *mobj)
|
||||
|
||||
if (GETSECSPECIAL(sec->special, 2) == 1 && mobj->z == sec->floorheight)
|
||||
P_LinedefExecute(sec->tag, mobj, sec);
|
||||
// else if (GETSECSPECIAL(sec->special, 2) == 8)
|
||||
{
|
||||
sector_t *sec2;
|
||||
|
||||
@@ -9350,7 +9349,18 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||
{
|
||||
const mobjinfo_t *info = &mobjinfo[type];
|
||||
state_t *st;
|
||||
mobj_t *mobj = Z_Calloc(sizeof (*mobj), PU_LEVEL, NULL);
|
||||
mobj_t *mobj;
|
||||
|
||||
if (mobjcache != NULL)
|
||||
{
|
||||
mobj = mobjcache;
|
||||
mobjcache = mobjcache->hnext;
|
||||
memset(mobj, 0, sizeof(*mobj));
|
||||
}
|
||||
else
|
||||
{
|
||||
mobj = Z_Calloc(sizeof (*mobj), PU_LEVEL, NULL);
|
||||
}
|
||||
|
||||
// this is officially a mobj, declared as soon as possible.
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker;
|
||||
@@ -9455,7 +9465,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||
|
||||
// DANGER! This can cause P_SpawnMobj to return NULL!
|
||||
// Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks!
|
||||
if (LUAh_MobjSpawn(mobj))
|
||||
if (LUA_HookMobj(mobj, MOBJ_HOOK(MobjSpawn)))
|
||||
{
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return NULL;
|
||||
@@ -9811,7 +9821,18 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster)
|
||||
{
|
||||
const mobjinfo_t *info = &mobjinfo[MT_SHADOW];
|
||||
state_t *st;
|
||||
mobj_t *mobj = Z_Calloc(sizeof (*mobj), PU_LEVEL, NULL);
|
||||
mobj_t *mobj;
|
||||
|
||||
if (mobjcache != NULL)
|
||||
{
|
||||
mobj = mobjcache;
|
||||
mobjcache = mobjcache->hnext;
|
||||
memset(mobj, 0, sizeof(*mobj));
|
||||
}
|
||||
else
|
||||
{
|
||||
mobj = Z_Calloc(sizeof (*mobj), PU_LEVEL, NULL);
|
||||
}
|
||||
|
||||
// this is officially a mobj, declared as soon as possible.
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker;
|
||||
@@ -9990,7 +10011,7 @@ void P_RemoveMobj(mobj_t *mobj)
|
||||
return; // something already removing this mobj.
|
||||
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_RemoveThinkerDelayed; // shh. no recursing.
|
||||
LUAh_MobjRemoved(mobj);
|
||||
LUA_HookMobj(mobj, MOBJ_HOOK(MobjRemoved));
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker; // needed for P_UnsetThingPosition, etc. to work.
|
||||
|
||||
// Rings only, please!
|
||||
@@ -10085,7 +10106,9 @@ void P_RemoveMobj(mobj_t *mobj)
|
||||
// Invalidate mobj_t data to cause crashes if accessed!
|
||||
memset(mobj, 0xff, sizeof(mobj_t));
|
||||
#endif
|
||||
Z_Free(mobj); // No refrences? Can be removed immediately! :D
|
||||
// no references, dump it directly in the mobj cache
|
||||
mobj->hnext = mobjcache;
|
||||
mobjcache = mobj;
|
||||
}
|
||||
else
|
||||
{ // Add thinker just to delay removing it until refrences are gone.
|
||||
@@ -10356,7 +10379,7 @@ void P_PrecipitationEffects(void)
|
||||
for (y = yl; y <= yh; y += RADIUSSTEP)
|
||||
for (x = xl; x <= xh; x += RADIUSSTEP)
|
||||
{
|
||||
if (R_PointInSubsector((fixed_t)x, (fixed_t)y)->sector->ceilingpic != skyflatnum) // Found the outdoors!
|
||||
if (R_PointInSubsectorFast((fixed_t)x, (fixed_t)y)->sector->ceilingpic != skyflatnum) // Found the outdoors!
|
||||
continue;
|
||||
|
||||
newdist = S_CalculateSoundDistance(players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y, 0, (fixed_t)x, (fixed_t)y, 0);
|
||||
@@ -10553,7 +10576,8 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
}
|
||||
|
||||
// spawn as spectator determination
|
||||
if (multiplayer && demo.playback); // Don't mess with spectator values since the demo setup handles them already.
|
||||
if (multiplayer && demo.playback)
|
||||
; // Don't mess with spectator values since the demo setup handles them already.
|
||||
else if (!G_GametypeHasSpectators())
|
||||
p->spectator = false;
|
||||
else if (netgame && p->jointime <= 1 && pcount)
|
||||
@@ -10579,15 +10603,8 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
// (usefulness: when body mobj is detached from player (who respawns),
|
||||
// the dead body mobj retains the skin through the 'spritedef' override).
|
||||
mobj->skin = &skins[p->skin];
|
||||
if (p->localskin > 0)
|
||||
{
|
||||
if (p->skinlocal)
|
||||
mobj->localskin = &localskins[p->localskin - 1];
|
||||
else
|
||||
mobj->localskin = & skins[p->localskin - 1];
|
||||
}
|
||||
else
|
||||
mobj->localskin = 0;
|
||||
|
||||
mobj->localskin = ((p->localskin > 0) ? (p->skinlocal ? &localskins[p->localskin - 1] : &skins[p->localskin - 1]) : 0);
|
||||
mobj->skinlocal = p->skinlocal;
|
||||
|
||||
mobj->health = p->health;
|
||||
@@ -11680,12 +11697,8 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||
z = mthing->options << FRACBITS;
|
||||
|
||||
hoopcenter = P_SpawnMobj(x, y, z, MT_HOOPCENTER);
|
||||
|
||||
hoopcenter->spawnpoint = mthing;
|
||||
|
||||
// Screw these damn hoops, I need this thinker.
|
||||
//hoopcenter->flags |= MF_NOTHINK;
|
||||
|
||||
z +=
|
||||
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||
sec->floorheight;
|
||||
@@ -11731,10 +11744,8 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||
|
||||
mobj = P_SpawnMobj(finalx, finaly, finalz, MT_HOOP);
|
||||
|
||||
//if (maptol & TOL_XMAS)
|
||||
//P_SetMobjState(mobj, mobj->info->seestate + (i & 1));
|
||||
|
||||
mobj->z -= mobj->height/2;
|
||||
|
||||
P_SetTarget(&mobj->target, hoopcenter); // Link the sprite to the center.
|
||||
mobj->fuse = 0;
|
||||
|
||||
@@ -11871,9 +11882,6 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||
|
||||
mobj = P_SpawnMobj(finalx, finaly, finalz, MT_HOOP);
|
||||
|
||||
//if (maptol & TOL_XMAS)
|
||||
//P_SetMobjState(mobj, mobj->info->seestate + (i & 1));
|
||||
|
||||
mobj->z -= mobj->height/2;
|
||||
P_SetTarget(&mobj->target, hoopcenter); // Link the sprite to the center.
|
||||
mobj->fuse = 0;
|
||||
|
||||
@@ -153,6 +153,9 @@ FUNCINLINE static ATTRINLINE void PolyObj_AddThinker(thinker_t *th)
|
||||
th->next = thinkercap.next;
|
||||
th->prev = &thinkercap;
|
||||
thinkercap.next = th;
|
||||
|
||||
th->references = 0;
|
||||
th->cachable = false; // not initialising this made the mobjcache die thx!
|
||||
}
|
||||
|
||||
static void FreeSideLists(void)
|
||||
|
||||
+6
-11
@@ -296,7 +296,7 @@ static void P_NetArchivePlayers(savebuffer_t *save, boolean resending)
|
||||
//
|
||||
// P_NetUnArchivePlayers
|
||||
//
|
||||
static void P_NetUnArchivePlayers(savebuffer_t *save, boolean resending)
|
||||
static void P_NetUnArchivePlayers(boolean reloading)
|
||||
{
|
||||
INT32 i, j;
|
||||
UINT16 flags;
|
||||
@@ -306,8 +306,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean resending)
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (resending)
|
||||
adminplayers[i] = (INT32)READSINT8(save->p);
|
||||
if (reloading)
|
||||
adminplayers[i] = (INT32)READSINT8(save_p);
|
||||
|
||||
// Do NOT memset player struct to 0
|
||||
// other areas may initialize data elsewhere
|
||||
@@ -317,8 +317,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean resending)
|
||||
|
||||
// NOTE: sending tics should (hopefully) no longer be necessary
|
||||
|
||||
if (resending)
|
||||
READSTRINGN(save->p, player_names[i], MAXPLAYERNAME);
|
||||
if (reloading)
|
||||
READSTRINGN(save_p, player_names[i], MAXPLAYERNAME);
|
||||
|
||||
players[i].aiming = READANGLE(save->p);
|
||||
players[i].awayviewaiming = READANGLE(save->p);
|
||||
@@ -344,7 +344,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean resending)
|
||||
players[i].flashpal = READUINT16(save->p);
|
||||
players[i].flashcount = READUINT16(save->p);
|
||||
|
||||
if (resending)
|
||||
if (reloading)
|
||||
{
|
||||
players[i].skincolor = READUINT8(save->p);
|
||||
players[i].skin = READINT32(save->p);
|
||||
@@ -2159,11 +2159,6 @@ static void LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||
mobj->realyscale = FRACUNIT;
|
||||
mobj->stretchslam = 0;
|
||||
|
||||
mobj->stretchslam = 0;
|
||||
mobj->slamsoundtimer = 0;
|
||||
|
||||
mobj->mirrored = 0;
|
||||
|
||||
// Timer for slam sound effect
|
||||
mobj->slamsoundtimer = 0;
|
||||
|
||||
|
||||
+25
-12
@@ -63,7 +63,7 @@
|
||||
|
||||
#include "md5.h" // map MD5
|
||||
|
||||
// for LUAh_MapLoad
|
||||
// for MapLoad hook
|
||||
#include "lua_script.h"
|
||||
#include "lua_hook.h"
|
||||
|
||||
@@ -361,7 +361,11 @@ FUNCINLINE static ATTRINLINE void P_LoadRawVertexes(UINT8 *data)
|
||||
* \param seg Seg to compute length for.
|
||||
* \return Length in fracunits.
|
||||
*/
|
||||
#if defined (WALLSPLATS) || defined (FLOORSPLATS)
|
||||
fixed_t P_SegLength(seg_t *seg)
|
||||
#else
|
||||
static inline fixed_t P_SegLength(seg_t *seg)
|
||||
#endif
|
||||
{
|
||||
INT64 dx = (seg->v2->x - seg->v1->x)>>1;
|
||||
INT64 dy = (seg->v2->y - seg->v1->y)>>1;
|
||||
@@ -1443,16 +1447,23 @@ static void P_CreateBlockMap(void)
|
||||
// First find limits of map
|
||||
for (i = 0; i < numvertexes; i++)
|
||||
{
|
||||
if (vertexes[i].x>>FRACBITS < minx)
|
||||
minx = vertexes[i].x>>FRACBITS;
|
||||
else if (vertexes[i].x>>FRACBITS > maxx)
|
||||
maxx = vertexes[i].x>>FRACBITS;
|
||||
if (vertexes[i].y>>FRACBITS < miny)
|
||||
miny = vertexes[i].y>>FRACBITS;
|
||||
else if (vertexes[i].y>>FRACBITS > maxy)
|
||||
maxy = vertexes[i].y>>FRACBITS;
|
||||
fixed_t t;
|
||||
|
||||
if ((t = vertexes[i].x) < minx)
|
||||
minx = t;
|
||||
else if (t > maxx)
|
||||
maxx = t;
|
||||
if ((t = vertexes[i].y) < miny)
|
||||
miny = t;
|
||||
else if (t > maxy)
|
||||
maxy = t;
|
||||
}
|
||||
|
||||
minx >>= FRACBITS;
|
||||
maxx >>= FRACBITS;
|
||||
miny >>= FRACBITS;
|
||||
maxy >>= FRACBITS;
|
||||
|
||||
// Save blockmap parameters
|
||||
bmaporgx = minx << FRACBITS;
|
||||
bmaporgy = miny << FRACBITS;
|
||||
@@ -2327,7 +2338,7 @@ static void P_SetupCamera(UINT8 pnum, camera_t *cam)
|
||||
cam->y = players[pnum].mo->y;
|
||||
cam->z = players[pnum].mo->z;
|
||||
cam->angle = players[pnum].mo->angle;
|
||||
cam->subsector = R_PointInSubsector(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
cam->subsector = R_PointInSubsectorFast(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2351,7 +2362,7 @@ static void P_SetupCamera(UINT8 pnum, camera_t *cam)
|
||||
cam->y = thing->y;
|
||||
cam->z = thing->z;
|
||||
cam->angle = FixedAngle((fixed_t)thing->angle << FRACBITS);
|
||||
cam->subsector = R_PointInSubsector(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
cam->subsector = R_PointInSubsectorFast(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2636,6 +2647,8 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
R_ClearLevelSplats();
|
||||
#endif
|
||||
|
||||
mobjcache = NULL;
|
||||
|
||||
R_InitializeLevelInterpolators();
|
||||
|
||||
P_InitThinkers();
|
||||
@@ -2863,7 +2876,7 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
}
|
||||
P_PreTicker(2);
|
||||
if (!reloadinggamestate)
|
||||
LUAh_MapLoad();
|
||||
LUA_HookInt(gamemap, HOOK(MapLoad));
|
||||
}
|
||||
|
||||
if (rendermode != render_none && !reloadinggamestate)
|
||||
|
||||
@@ -88,6 +88,11 @@ SINT8 P_PartialAddGetStage(void);
|
||||
|
||||
boolean P_RunSOC(const char *socfilename);
|
||||
void P_WriteThings(lumpnum_t lump);
|
||||
|
||||
#if defined (WALLSPLATS) || defined (FLOORSPLATS)
|
||||
fixed_t P_SegLength(seg_t *seg);
|
||||
#endif
|
||||
|
||||
void P_UpdateSegLightOffset(seg_t *li);
|
||||
size_t P_PrecacheLevelFlats(void);
|
||||
void P_AllocMapHeader(INT16 i);
|
||||
|
||||
+40
-80
@@ -38,66 +38,21 @@ static INT32 sightcounts[2];
|
||||
//
|
||||
// Returns side 0 (front), 1 (back), or 2 (on).
|
||||
//
|
||||
static INT32 P_DivlineSide(fixed_t x, fixed_t y, divline_t *node)
|
||||
// killough 4/19/98: made static, cleaned up
|
||||
static INT32 P_DivlineSide(fixed_t x, fixed_t y, const divline_t *node)
|
||||
{
|
||||
fixed_t dx, dy, left, right;
|
||||
|
||||
if (!node->dx)
|
||||
{
|
||||
if (x == node->x)
|
||||
return 2;
|
||||
|
||||
if (x <= node->x)
|
||||
return (node->dy > 0);
|
||||
|
||||
return (node->dy < 0);
|
||||
}
|
||||
|
||||
if (!node->dy)
|
||||
{
|
||||
if (y == node->y)
|
||||
return 2;
|
||||
|
||||
if (y <= node->y)
|
||||
return (node->dx < 0);
|
||||
|
||||
return (node->dx > 0);
|
||||
}
|
||||
|
||||
dx = x - node->x;
|
||||
dy = y - node->y;
|
||||
|
||||
left = (node->dy>>FRACBITS) * (dx>>FRACBITS);
|
||||
right = (dy>>FRACBITS) * (node->dx>>FRACBITS);
|
||||
|
||||
if (right < left)
|
||||
return 0; // front side
|
||||
|
||||
if (left == right)
|
||||
return 2;
|
||||
|
||||
return 1; // back side
|
||||
fixed_t left, right;
|
||||
return
|
||||
!node->dx ? x == node->x ? 2 : x <= node->x ? node->dy > 0 : node->dy < 0 :
|
||||
!node->dy ? y == node->y ? 2 : y <= node->y ? node->dx < 0 : node->dx > 0 :
|
||||
(right = ((y - node->y) >> FRACBITS) * (node->dx >> FRACBITS)) <
|
||||
(left = ((x - node->x) >> FRACBITS) * (node->dy >> FRACBITS)) ? 0 :
|
||||
right == left ? 2 : 1;
|
||||
}
|
||||
|
||||
//
|
||||
// P_InterceptVector2
|
||||
//
|
||||
// Returns the fractional intercept point along the first divline.
|
||||
// This is only called by the addthings and addlines traversers.
|
||||
//
|
||||
static fixed_t P_InterceptVector2(divline_t *v2, divline_t *v1)
|
||||
static INT32 P_DivlineCrossed(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, const divline_t *node)
|
||||
{
|
||||
fixed_t frac, num, den;
|
||||
|
||||
den = FixedMul(v1->dy>>8, v2->dx) - FixedMul(v1->dx>>8, v2->dy);
|
||||
|
||||
if (!den)
|
||||
return 0;
|
||||
|
||||
num = FixedMul((v1->x - v2->x)>>8, v1->dy) + FixedMul((v2->y - v1->y)>>8, v1->dx);
|
||||
frac = FixedDiv(num, den);
|
||||
|
||||
return frac;
|
||||
return (P_DivlineSide(x1, y1, node) == P_DivlineSide(x2, y2, node));
|
||||
}
|
||||
|
||||
static boolean P_CrossSubsecPolyObj(polyobj_t *po, register los_t *los)
|
||||
@@ -135,23 +90,21 @@ static boolean P_CrossSubsecPolyObj(polyobj_t *po, register los_t *los)
|
||||
v2 = line->v2;
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(v1->x, v1->y, &los->strace) ==
|
||||
P_DivlineSide(v2->x, v2->y, &los->strace))
|
||||
if (P_DivlineCrossed(v1->x, v1->y, v2->x, v2->y, &los->strace))
|
||||
continue;
|
||||
|
||||
divl.dx = v2->x - (divl.x = v1->x);
|
||||
divl.dy = v2->y - (divl.y = v1->y);
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(los->strace.x, los->strace.y, &divl) ==
|
||||
P_DivlineSide(los->t2x, los->t2y, &divl))
|
||||
if (P_DivlineCrossed(los->strace.x, los->strace.y, los->t2x, los->t2y, &divl))
|
||||
continue;
|
||||
|
||||
// stop because it is not two sided
|
||||
//if (!(po->flags & POF_TESTHEIGHT))
|
||||
//return false;
|
||||
|
||||
frac = P_InterceptVector2(&los->strace, &divl);
|
||||
frac = P_InterceptVector(&los->strace, &divl);
|
||||
|
||||
// get slopes of top and bottom of this polyobject line
|
||||
topslope = FixedDiv(polysec->ceilingheight - los->sightzstart , frac);
|
||||
@@ -232,16 +185,14 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
||||
v2 = line->v2;
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(v1->x, v1->y, &los->strace) ==
|
||||
P_DivlineSide(v2->x, v2->y, &los->strace))
|
||||
if (P_DivlineCrossed(v1->x, v1->y, v2->x, v2->y, &los->strace))
|
||||
continue;
|
||||
|
||||
divl.dx = v2->x - (divl.x = v1->x);
|
||||
divl.dy = v2->y - (divl.y = v1->y);
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(los->strace.x, los->strace.y, &divl) ==
|
||||
P_DivlineSide(los->t2x, los->t2y, &divl))
|
||||
if (P_DivlineCrossed(los->strace.x, los->strace.y, los->t2x, los->t2y, &divl))
|
||||
continue;
|
||||
|
||||
// stop because it is not two sided anyway
|
||||
@@ -249,7 +200,7 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
||||
return false;
|
||||
|
||||
// calculate fractional intercept (how far along we are divided by how far we are from t2)
|
||||
frac = P_InterceptVector2(&los->strace, &divl);
|
||||
frac = P_InterceptVector(&los->strace, &divl);
|
||||
|
||||
front = seg->frontsector;
|
||||
back = seg->backsector;
|
||||
@@ -348,25 +299,34 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
||||
// if strace crosses the given node successfully.
|
||||
//
|
||||
// killough 4/20/98: rewritten to remove tail recursion, clean up, and optimize
|
||||
|
||||
static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los)
|
||||
static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los, boolean fast)
|
||||
{
|
||||
while (!(bspnum & NF_SUBSECTOR))
|
||||
{
|
||||
register node_t *bsp = nodes + bspnum;
|
||||
INT32 side = P_DivlineSide(los->strace.x,los->strace.y,(divline_t *)bsp)&1;
|
||||
if (side == P_DivlineSide(los->t2x, los->t2y, (divline_t *) bsp))
|
||||
bspnum = bsp->children[side]; // doesn't touch the other side
|
||||
else // the partition plane is crossed here
|
||||
|
||||
INT32 side = fast ? R_PointOnSideFast(los->strace.x, los->strace.y, bsp) : (P_DivlineSide(los->strace.x,los->strace.y,(divline_t *)bsp) & 1);
|
||||
INT32 side2 = fast ? R_PointOnSideFast(los->t2x, los->t2y, bsp) : P_DivlineSide(los->t2x, los->t2y, (divline_t *) bsp);
|
||||
|
||||
if (side == side2)
|
||||
{
|
||||
if (!P_CrossBSPNode(bsp->children[side], los))
|
||||
return 0; // cross the starting side
|
||||
bspnum = bsp->children[side]; // doesn't touch the other side
|
||||
}
|
||||
else
|
||||
{
|
||||
// the partition plane is crossed here
|
||||
if (!P_CrossBSPNode(bsp->children[side], los, fast))
|
||||
{
|
||||
return false; // cross the starting side
|
||||
}
|
||||
else
|
||||
bspnum = bsp->children[side^1]; // cross the ending side
|
||||
{
|
||||
bspnum = bsp->children[side ^ 1]; // cross the ending side
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
P_CrossSubsector((bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR), los);
|
||||
|
||||
return P_CrossSubsector((bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR), los);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -375,7 +335,7 @@ static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los)
|
||||
// Returns true if a straight line between t1 and t2 is unobstructed.
|
||||
// Uses REJECT.
|
||||
//
|
||||
boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
|
||||
boolean P_CheckSight2(mobj_t *t1, mobj_t *t2, boolean fast)
|
||||
{
|
||||
const sector_t *s1, *s2;
|
||||
size_t pnum;
|
||||
@@ -492,5 +452,5 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
|
||||
}
|
||||
|
||||
// the head node is the last node output
|
||||
return P_CrossBSPNode((INT32)numnodes - 1, &los);
|
||||
}
|
||||
return (P_CrossBSPNode((INT32)numnodes - 1, &los, fast));
|
||||
}
|
||||
+7
-5
@@ -35,7 +35,7 @@
|
||||
#include "hu_stuff.h"
|
||||
#include "m_misc.h"
|
||||
#include "m_cond.h" //unlock triggers
|
||||
#include "lua_hook.h" // LUAh_LinedefExecute
|
||||
#include "lua_hook.h" // LUA_HookLinedefExecute
|
||||
|
||||
#include "k_kart.h" // SRB2kart
|
||||
#include "console.h" // CON_LogMessage
|
||||
@@ -1431,12 +1431,14 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
||||
}
|
||||
else if (caller)
|
||||
{
|
||||
if (GETSECSPECIAL(caller->special, 2) == 6)
|
||||
INT32 special = GETSECSPECIAL(caller->special, 2);
|
||||
|
||||
if (special == 6)
|
||||
{
|
||||
if (!(ALL7EMERALDS(emeralds)))
|
||||
return false;
|
||||
}
|
||||
else if (GETSECSPECIAL(caller->special, 2) == 7) // SRB2Kart: reusing for Race Lap executor
|
||||
else if (special == 7) // SRB2Kart: reusing for Race Lap executor
|
||||
{
|
||||
UINT8 lap;
|
||||
|
||||
@@ -1470,7 +1472,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
||||
// If we were not triggered by a sector type especially for the purpose,
|
||||
// a Linedef Executor linedef trigger is not handling sector triggers properly, return.
|
||||
|
||||
else if ((!GETSECSPECIAL(caller->special, 2) || GETSECSPECIAL(caller->special, 2) > 7) && (specialtype > 322))
|
||||
else if ((!special || special > 7) && (specialtype > 322))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING,
|
||||
M_GetText("Linedef executor trigger isn't handling sector triggers properly!\nspecialtype = %d, if you are not a dev, report this warning instance\nalong with the wad that caused it!\n"),
|
||||
@@ -2848,7 +2850,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
|
||||
case 443: // Calls a named Lua function
|
||||
if (line->text)
|
||||
LUAh_LinedefExecute(line, mo, callsec);
|
||||
LUA_HookLinedefExecute(line, mo, callsec);
|
||||
else
|
||||
CONS_Alert(CONS_WARNING, "Linedef %s is missing the hook name of the Lua function to call! (This should be given in the front texture fields)\n", sizeu1(line-lines));
|
||||
break;
|
||||
|
||||
+49
-21
@@ -196,6 +196,8 @@ void P_AddThinker(thinker_t *thinker)
|
||||
thinkercap.prev = thinker;
|
||||
|
||||
thinker->references = 0; // killough 11/98: init reference counter to 0
|
||||
|
||||
thinker->cachable = (thinker->function.acp1 == (actionf_p1)P_MobjThinker);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -235,7 +237,17 @@ void P_RemoveThinkerDelayed(thinker_t *thinker)
|
||||
* thinker->prev->next = thinker->next */
|
||||
(next->prev = currentthinker = thinker->prev)->next = next;
|
||||
R_DestroyLevelInterpolators(thinker);
|
||||
Z_Free(thinker);
|
||||
|
||||
if (thinker->cachable == true)
|
||||
{
|
||||
// put cachable thinkers in the mobj cache, so we can avoid allocations
|
||||
((mobj_t *)thinker)->hnext = mobjcache;
|
||||
mobjcache = (mobj_t *)thinker;
|
||||
}
|
||||
else
|
||||
{
|
||||
Z_Free(thinker);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -250,9 +262,20 @@ void P_UnlinkThinker(thinker_t *thinker)
|
||||
I_Assert(thinker->references == 0);
|
||||
|
||||
(next->prev = thinker->prev)->next = next;
|
||||
Z_Free(thinker);
|
||||
|
||||
if (thinker->cachable == true)
|
||||
{
|
||||
// put cachable thinkers in the mobj cache, so we can avoid allocations
|
||||
((mobj_t *)thinker)->hnext = mobjcache;
|
||||
mobjcache = (mobj_t *)thinker;
|
||||
}
|
||||
else
|
||||
{
|
||||
Z_Free(thinker);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// P_RemoveThinker
|
||||
//
|
||||
@@ -327,7 +350,7 @@ static inline void P_RunThinkers(void)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void P_DeviceRumbleTick(void)
|
||||
static void P_DeviceRumbleTick(void)
|
||||
{
|
||||
UINT8 i;
|
||||
|
||||
@@ -397,7 +420,7 @@ void P_RunChaseCameras(void)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void P_RunQuakes(void)
|
||||
static void P_RunQuakes(void)
|
||||
{
|
||||
fixed_t ir;
|
||||
|
||||
@@ -434,7 +457,7 @@ void P_Ticker(boolean run)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
// Increment jointime and quittime even if paused
|
||||
// Increment jointime even if paused
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
@@ -528,7 +551,7 @@ void P_Ticker(boolean run)
|
||||
ps_checkposition_calls.value.i = 0;
|
||||
|
||||
PS_START_TIMING(ps_lua_prethinkframe_time);
|
||||
LUAh_PreThinkFrame();
|
||||
LUA_HookPreThinkFrame();
|
||||
PS_STOP_TIMING(ps_lua_prethinkframe_time);
|
||||
|
||||
PS_START_TIMING(ps_playerthink_time);
|
||||
@@ -564,7 +587,7 @@ void P_Ticker(boolean run)
|
||||
}
|
||||
|
||||
PS_START_TIMING(ps_lua_thinkframe_time);
|
||||
LUAh_ThinkFrame();
|
||||
LUA_HookThinkFrame();
|
||||
PS_STOP_TIMING(ps_lua_thinkframe_time);
|
||||
}
|
||||
|
||||
@@ -640,14 +663,17 @@ void P_Ticker(boolean run)
|
||||
|
||||
G_WriteAllGhostTics();
|
||||
|
||||
if (cv_recordmultiplayerdemos.value && (demo.savemode == DSM_NOTSAVING || demo.savemode == DSM_WILLAUTOSAVE))
|
||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && (InputDown(gc_lookback, 1) || (cv_usejoystick[0].value && axis > 0)))
|
||||
demo.savemode = DSM_TITLEENTRY;
|
||||
if (cv_recordmultiplayerdemos.value)
|
||||
{
|
||||
if (demo.savemode == DSM_NOTSAVING || demo.savemode == DSM_WILLAUTOSAVE)
|
||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && (InputDown(gc_lookback, 1) || (cv_usejoystick[0].value && axis > 0)))
|
||||
demo.savemode = DSM_TITLEENTRY;
|
||||
|
||||
//if there are no players left at all, stop demo recording
|
||||
//Demos that that dont have any players crash during playback, which can happen with dedicated servers
|
||||
if (cv_recordmultiplayerdemos.value && demo.savemode == DSM_WILLAUTOSAVE && !D_NumPlayers())
|
||||
G_SaveDemo();
|
||||
// if there are no players left at all, stop demo recording
|
||||
// Demos that that dont have any players crash during playback, which can happen with dedicated servers
|
||||
if (demo.savemode == DSM_WILLAUTOSAVE && !D_NumPlayers())
|
||||
G_ResetDemoRecording();
|
||||
}
|
||||
}
|
||||
else if (demo.playback) // Use Ghost data for consistency checks.
|
||||
{
|
||||
@@ -668,7 +694,7 @@ void P_Ticker(boolean run)
|
||||
D_MapChange(gamemap, gametype, encoremode, true, 0, false, false);
|
||||
|
||||
PS_START_TIMING(ps_lua_postthinkframe_time);
|
||||
LUAh_PostThinkFrame();
|
||||
LUA_HookPostThinkFrame();
|
||||
PS_STOP_TIMING(ps_lua_postthinkframe_time);
|
||||
}
|
||||
|
||||
@@ -689,16 +715,18 @@ void P_Ticker(boolean run)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
player_t *player = &players[displayplayers[i]];
|
||||
boolean isSkyVisibleForPlayer = skyVisiblePerPlayer[i];
|
||||
|
||||
if (!player->mo)
|
||||
continue;
|
||||
|
||||
if (isSkyVisibleForPlayer && skyboxmo[0] && cv_skybox.value)
|
||||
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
|
||||
boolean isSkyVisibleForPlayer = skyVisiblePerPlayer[i];
|
||||
|
||||
if (isSkyVisibleForPlayer && skybox)
|
||||
{
|
||||
R_SkyboxFrame(i);
|
||||
}
|
||||
R_SetupFrame(i, (skyboxmo[0] && cv_skybox.value));
|
||||
R_SetupFrame(i, skybox);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -723,7 +751,7 @@ void P_PreTicker(INT32 frames)
|
||||
|
||||
R_UpdateMobjInterpolators();
|
||||
|
||||
LUAh_PreThinkFrame();
|
||||
LUA_HOOK(PreThinkFrame);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
|
||||
@@ -752,7 +780,7 @@ void P_PreTicker(INT32 frames)
|
||||
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
|
||||
P_PlayerAfterThink(&players[i]);
|
||||
|
||||
LUAh_ThinkFrame();
|
||||
LUA_HookThinkFrame();
|
||||
|
||||
P_RunOverlays();
|
||||
P_RunShadows();
|
||||
@@ -760,7 +788,7 @@ void P_PreTicker(INT32 frames)
|
||||
P_UpdateSpecials();
|
||||
P_RespawnSpecials();
|
||||
|
||||
LUAh_PostThinkFrame();
|
||||
LUA_HOOK(PostThinkFrame);
|
||||
|
||||
R_UpdateLevelInterpolators();
|
||||
R_UpdateViewInterpolation();
|
||||
|
||||
+10
-8
@@ -704,7 +704,7 @@ void P_RestoreMusic(player_t *player)
|
||||
return;
|
||||
|
||||
if (leveltime < MUSICSTARTTIME)
|
||||
S_StartMapMusic(true);
|
||||
S_StartMapMusic();
|
||||
else // see also where time overs are handled - search for "lives = 2" in this file
|
||||
{
|
||||
INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow
|
||||
@@ -3228,7 +3228,7 @@ void P_DemoCameraMovement(camera_t *cam)
|
||||
democam.soundmobj = awayviewmobj_hack;
|
||||
|
||||
// update subsector to avoid crashes;
|
||||
cam->subsector = R_PointInSubsector(cam->x, cam->y);
|
||||
cam->subsector = R_PointInSubsectorFast(cam->x, cam->y);
|
||||
}
|
||||
|
||||
void P_ResetCamera(player_t *player, camera_t *thiscam)
|
||||
@@ -3263,7 +3263,7 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
|
||||
thiscam->aiming = 0;
|
||||
thiscam->relativex = 0;
|
||||
|
||||
thiscam->subsector = R_PointInSubsector(thiscam->x,thiscam->y);
|
||||
thiscam->subsector = R_PointInSubsectorFast(thiscam->x,thiscam->y);
|
||||
|
||||
thiscam->radius = 20*FRACUNIT;
|
||||
thiscam->height = 16*FRACUNIT;
|
||||
@@ -3982,6 +3982,8 @@ void P_DoTimeOver(player_t *player)
|
||||
|
||||
player->pflags |= PF_TIMEOVER;
|
||||
|
||||
demo.savebutton = leveltime;
|
||||
|
||||
if (P_IsLocalPlayer(player) && !demo.playback)
|
||||
legitimateexit = true; // SRB2kart: losing a race is still seeing it through to the end :p
|
||||
|
||||
@@ -4135,7 +4137,7 @@ void P_PlayerThink(player_t *player)
|
||||
}
|
||||
if (player->playerstate == PST_REBORN)
|
||||
{
|
||||
LUAh_PlayerThink(player);
|
||||
LUA_HookPlayer(player, HOOK(PlayerThink));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -4241,7 +4243,7 @@ void P_PlayerThink(player_t *player)
|
||||
|
||||
if (player->playerstate == PST_DEAD)
|
||||
{
|
||||
LUAh_PlayerThink(player);
|
||||
LUA_HookPlayer(player, HOOK(PlayerThink));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -4307,7 +4309,7 @@ void P_PlayerThink(player_t *player)
|
||||
else
|
||||
player->mo->flags2 &= ~MF2_SHADOW;
|
||||
P_DeathThink(player);
|
||||
LUAh_PlayerThink(player);
|
||||
LUA_HookPlayer(player, HOOK(PlayerThink));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4446,7 +4448,7 @@ void P_PlayerThink(player_t *player)
|
||||
|
||||
if (!player->mo)
|
||||
{
|
||||
LUAh_PlayerThink(player);
|
||||
LUA_HookPlayer(player, HOOK(PlayerThink));
|
||||
return; // P_MovePlayer removed player->mo.
|
||||
}
|
||||
|
||||
@@ -4623,7 +4625,7 @@ void P_PlayerThink(player_t *player)
|
||||
if (rendermode != render_none)
|
||||
DoABarrelRoll(player);
|
||||
|
||||
LUAh_PlayerThink(player);
|
||||
LUA_HookPlayer(player, HOOK(PlayerThink));
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+22
-3
@@ -627,7 +627,21 @@ static boolean R_CheckBBox(const fixed_t *bspcoord)
|
||||
cliprange_t *start;
|
||||
|
||||
// Find the corners of the box that define the edges from current viewpoint.
|
||||
if ((boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT] ? 1 : 2) + (viewy >= bspcoord[BOXTOP] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8)) == 5)
|
||||
if (viewx <= bspcoord[BOXLEFT])
|
||||
boxpos = 0;
|
||||
else if (viewx < bspcoord[BOXRIGHT])
|
||||
boxpos = 1;
|
||||
else
|
||||
boxpos = 2;
|
||||
|
||||
if (viewy >= bspcoord[BOXTOP])
|
||||
boxpos |= 0;
|
||||
else if (viewy > bspcoord[BOXBOTTOM])
|
||||
boxpos |= 1<<2;
|
||||
else
|
||||
boxpos |= 2<<2;
|
||||
|
||||
if (boxpos == 5)
|
||||
return true;
|
||||
|
||||
check = checkcoord[boxpos];
|
||||
@@ -656,7 +670,8 @@ static boolean R_CheckBBox(const fixed_t *bspcoord)
|
||||
sx2 = viewangletox[angle2];
|
||||
|
||||
// Does not cross a pixel.
|
||||
if (sx1 >= sx2) return false;
|
||||
if (sx1 >= sx2)
|
||||
return false;
|
||||
|
||||
start = solidsegs;
|
||||
while (start->last < sx2)
|
||||
@@ -1323,7 +1338,11 @@ void R_RenderBSPNode(INT32 bspnum)
|
||||
if (sp == MAX_BSP_DEPTH)
|
||||
break;
|
||||
|
||||
bsp = &nodes[bspnum];
|
||||
// Decide which side the view point is on.
|
||||
side = R_PointOnSideFast(viewx, viewy, bsp);
|
||||
|
||||
// Recursively divide front space.
|
||||
R_RenderBSPNode(bsp->children[side]);
|
||||
|
||||
// Decide which side the view point is on.
|
||||
const INT32 side = R_PointOnSide(viewx, viewy, bsp);
|
||||
|
||||
+2
-2
@@ -193,7 +193,7 @@ void R_InterpolateView(fixed_t frac, boolean forceinvalid)
|
||||
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||
|
||||
viewplayer = newview->player;
|
||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||
viewsector = R_PointInSubsectorFast(viewx, viewy)->sector;
|
||||
|
||||
R_SetupFreelook();
|
||||
}
|
||||
@@ -331,7 +331,7 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
out->angle = mobj->resetinterp ? mobj->angle : R_LerpAngle(mobj->old_angle, mobj->angle, frac);
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (cv_glmdls.value)
|
||||
if (rendermode == render_opengl && cv_glmdls.value)
|
||||
{
|
||||
// pitch roll stuff
|
||||
out->pitch = mobj->resetinterp ? mobj->pitch : R_LerpAngle(mobj->old_pitch, mobj->pitch, frac);
|
||||
|
||||
+15
-56
@@ -298,32 +298,6 @@ static void Precipstuff_OnChange(void)
|
||||
P_SpawnPrecipitation();
|
||||
}
|
||||
|
||||
//
|
||||
// R_PointOnSide
|
||||
// Traverse BSP (sub) tree,
|
||||
// check point against partition plane.
|
||||
// Returns side 0 (front) or 1 (back).
|
||||
//
|
||||
// killough 5/2/98: reformatted
|
||||
//
|
||||
PUREFUNC INT32 R_PointOnSide(fixed_t x, fixed_t y, const node_t *restrict node)
|
||||
{
|
||||
if (!node->dx)
|
||||
return x <= node->x ? node->dy > 0 : node->dy < 0;
|
||||
|
||||
if (!node->dy)
|
||||
return y <= node->y ? node->dx < 0 : node->dx > 0;
|
||||
|
||||
x -= node->x;
|
||||
y -= node->y;
|
||||
|
||||
// Try to quickly decide by looking at sign bits.
|
||||
// also use a mask to avoid branch prediction
|
||||
INT32 mask = (node->dy ^ node->dx ^ x ^ y) >> 31;
|
||||
return (mask & ((node->dy ^ x) < 0)) | // (left is negative)
|
||||
(~mask & (FixedMul(y, node->dx>>FRACBITS) >= FixedMul(node->dy>>FRACBITS, x)));
|
||||
}
|
||||
|
||||
//
|
||||
// R_PointToAngle
|
||||
// To get a global angle from cartesian coordinates,
|
||||
@@ -389,17 +363,19 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y)
|
||||
angle_t R_PlayerSliptideAngle(player_t *player)
|
||||
{
|
||||
mobj_t *mo;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
angle_t ang = 0;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
angle_t ang = 0;
|
||||
|
||||
if (!cv_sliptideroll.value || !player || P_MobjWasRemoved(player->mo))
|
||||
return 0;
|
||||
if (!cv_sloperoll.value || !cv_sliptideroll.value || !player || P_MobjWasRemoved(player->mo))
|
||||
return 0;
|
||||
|
||||
mo = player->mo;
|
||||
mo = player->mo;
|
||||
|
||||
size_t rot = mo->frame & FF_FRAMEMASK;
|
||||
boolean papersprite = (mo->frame & FF_PAPERSPRITE);
|
||||
if (mo->player->sliproll == 0 || mo->player->kartstuff[k_aizdriftstrat] == 0)
|
||||
return 0;
|
||||
|
||||
size_t rot = (mo->frame & FF_FRAMEMASK);
|
||||
|
||||
if (mo->skin && mo->sprite == SPR_PLAY)
|
||||
{
|
||||
@@ -416,7 +392,7 @@ angle_t R_PlayerSliptideAngle(player_t *player)
|
||||
if (rot >= sprdef->numframes)
|
||||
{
|
||||
sprdef = &sprites[states[S_UNKNOWN].sprite];
|
||||
rot = states[S_UNKNOWN].frame&FF_FRAMEMASK;
|
||||
rot = (states[S_UNKNOWN].frame & FF_FRAMEMASK);
|
||||
}
|
||||
|
||||
sprframe = &sprdef->spriteframes[rot];
|
||||
@@ -424,10 +400,10 @@ angle_t R_PlayerSliptideAngle(player_t *player)
|
||||
// No sprite frame? I guess it is possible
|
||||
if (!sprframe) return 0;
|
||||
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite)
|
||||
if (sprframe->rotate != SRF_SINGLE || (mo->frame & FF_PAPERSPRITE))
|
||||
ang = R_PointToAngle(mo->x, mo->y) - mo->angle;
|
||||
|
||||
return FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mo->player->sliproll*(mo->player->sliptidemem));
|
||||
return FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mo->player->sliproll * mo->player->kartstuff[k_aizdriftstrat]);
|
||||
}
|
||||
|
||||
INT32 R_GetHudUncap(void)
|
||||
@@ -1050,19 +1026,6 @@ void R_Init(void)
|
||||
framecount = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// R_PointInSubsector
|
||||
//
|
||||
subsector_t *R_PointInSubsector(fixed_t x, fixed_t y)
|
||||
{
|
||||
size_t nodenum = numnodes-1;
|
||||
|
||||
while (!(nodenum & NF_SUBSECTOR))
|
||||
nodenum = nodes[nodenum].children[R_PointOnSide(x, y, nodes+nodenum)];
|
||||
|
||||
return &subsectors[nodenum & ~NF_SUBSECTOR];
|
||||
}
|
||||
|
||||
//
|
||||
// R_IsPointInSubsector, same as above but returns 0 if not in subsector
|
||||
//
|
||||
@@ -1073,16 +1036,13 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
|
||||
size_t nodenum;
|
||||
subsector_t *ret;
|
||||
|
||||
// single subsector is a special case
|
||||
//if (numnodes == 0)
|
||||
//return subsectors;
|
||||
|
||||
nodenum = numnodes - 1;
|
||||
|
||||
while (!(nodenum & NF_SUBSECTOR))
|
||||
{
|
||||
node = &nodes[nodenum];
|
||||
side = R_PointOnSide(x, y, node);
|
||||
//side = R_PointOnSide(x, y, node);
|
||||
side = R_PointOnSideFast(x, y, node); // this is fine since R_IsPointInSubsector is only used for precip spawn unless you disable noclipcam lol
|
||||
nodenum = node->children[side];
|
||||
}
|
||||
|
||||
@@ -1570,7 +1530,6 @@ void R_RegisterEngineStuff(void)
|
||||
CV_RegisterVar(&cv_driftsparkpulse);
|
||||
CV_RegisterVar(&cv_gravstretch);
|
||||
CV_RegisterVar(&cv_sloperoll);
|
||||
CV_RegisterVar(&cv_spriteroll);
|
||||
CV_RegisterVar(&cv_sliptideroll);
|
||||
CV_RegisterVar(&cv_sloperolldist);
|
||||
CV_RegisterVar(&cv_sparkroll);
|
||||
|
||||
+61
-4
@@ -72,7 +72,40 @@ extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
|
||||
#define COLORMAP_REMAPOFFSET COLORMAP_SIZE
|
||||
|
||||
// Utility functions.
|
||||
INT32 R_PointOnSide(fixed_t x, fixed_t y, const node_t *node);
|
||||
|
||||
//
|
||||
// R_PointOnSide
|
||||
// Traverse BSP (sub) tree,
|
||||
// check point against partition plane.
|
||||
// Returns side 0 (front) or 1 (back).
|
||||
//
|
||||
// killough 5/2/98: reformatted
|
||||
//
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSide(fixed_t x, fixed_t y, const node_t *restrict node)
|
||||
{
|
||||
if (!node->dx)
|
||||
return x <= node->x ? node->dy > 0 : node->dy < 0;
|
||||
|
||||
if (!node->dy)
|
||||
return y <= node->y ? node->dx < 0 : node->dx > 0;
|
||||
|
||||
x -= node->x;
|
||||
y -= node->y;
|
||||
|
||||
// Try to quickly decide by looking at sign bits.
|
||||
// also use a mask to avoid branch prediction
|
||||
INT32 mask = (node->dy ^ node->dx ^ x ^ y) >> 31;
|
||||
return (mask & ((node->dy ^ x) < 0)) | // (left is negative)
|
||||
(~mask & (FixedMul(y, node->dx>>FRACBITS) >= FixedMul(node->dy>>FRACBITS, x)));
|
||||
}
|
||||
|
||||
// This is not as accurate
|
||||
// SHOULD NOT BE USED FOR ANYTHING GAMEPLAY RELATED!!
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSideFast(fixed_t x, fixed_t y, const node_t *node)
|
||||
{
|
||||
// use cross product to determine side quickly
|
||||
return ((INT64)y - node->y) * node->dx - ((INT64)x - node->x) * node->dy > 0;
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line)
|
||||
{
|
||||
@@ -82,7 +115,7 @@ FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSegSide(fixed_t x, fixed_t
|
||||
fixed_t ldy = line->v2->y - ly;
|
||||
|
||||
// use cross product to determine side quickly
|
||||
return (INT64)(y - ly) * ldx - (INT64)(x - lx) * ldy > 0;
|
||||
return ((INT64)y - ly) * ldx - ((INT64)x - lx) * ldy > 0;
|
||||
}
|
||||
|
||||
angle_t R_PointToAngle(fixed_t x, fixed_t y);
|
||||
@@ -91,13 +124,37 @@ angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
||||
angle_t R_PlayerSliptideAngle(player_t *player);
|
||||
|
||||
fixed_t R_ScaleFromGlobalAngle(angle_t visangle);
|
||||
subsector_t *R_PointInSubsector(fixed_t x, fixed_t y);
|
||||
|
||||
subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y);
|
||||
|
||||
//
|
||||
// R_PointInSubsector
|
||||
//
|
||||
FUNCINLINE static ATTRINLINE subsector_t *R_PointInSubsector(fixed_t x, fixed_t y)
|
||||
{
|
||||
size_t nodenum = numnodes-1;
|
||||
|
||||
while (!(nodenum & NF_SUBSECTOR))
|
||||
nodenum = nodes[nodenum].children[R_PointOnSide(x, y, nodes+nodenum)];
|
||||
|
||||
return &subsectors[nodenum & ~NF_SUBSECTOR];
|
||||
}
|
||||
|
||||
// uses R_PointOnSideFast
|
||||
// SHOULD NOT BE USED FOR ANYTHING GAMEPLAY RELATED!!
|
||||
FUNCINLINE static ATTRINLINE subsector_t *R_PointInSubsectorFast(fixed_t x, fixed_t y)
|
||||
{
|
||||
size_t nodenum = numnodes-1;
|
||||
|
||||
while (!(nodenum & NF_SUBSECTOR))
|
||||
nodenum = nodes[nodenum].children[R_PointOnSideFast(x, y, nodes+nodenum)];
|
||||
|
||||
return &subsectors[nodenum & ~NF_SUBSECTOR];
|
||||
}
|
||||
|
||||
#define R_PointToDist(x, y) R_PointToDist2(viewx, viewy, x, y)
|
||||
#define R_PointToDist2(px2, py2, px1, py1) FixedHypot((px1) - (px2), (py1) - (py2))
|
||||
|
||||
|
||||
boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixed_t bottomh, fixed_t toph);
|
||||
void R_GetRenderBlockMapDimensions(fixed_t drawdist, INT32 *xl, INT32 *xh, INT32 *yl, INT32 *yh);
|
||||
|
||||
|
||||
+16
-6
@@ -14,9 +14,11 @@
|
||||
|
||||
#include "byteptr.h"
|
||||
#include "dehacked.h"
|
||||
#include "doomdef.h"
|
||||
#include "i_video.h"
|
||||
#include "r_data.h"
|
||||
#include "r_draw.h"
|
||||
#include "r_fps.h"
|
||||
#include "r_patch.h"
|
||||
#include "r_things.h"
|
||||
#include "z_zone.h"
|
||||
@@ -803,6 +805,14 @@ INT32 R_GetRollAngle(angle_t rollangle)
|
||||
return ra;
|
||||
}
|
||||
|
||||
angle_t R_RotationAngle(angle_t ang, angle_t camang, interpmobjstate_t *interp)
|
||||
{
|
||||
return FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), interp->roll) +
|
||||
FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), interp->pitch) +
|
||||
FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), interp->sloperoll) +
|
||||
FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), interp->slopepitch);
|
||||
}
|
||||
|
||||
patch_t *Patch_GetRotatedSprite(spriteframe_t *sprite, size_t frame, size_t spriteangle, boolean flip, boolean adjustfeet, void *info, INT32 rotationangle)
|
||||
{
|
||||
rotsprite_t *rotsprite;
|
||||
@@ -842,8 +852,8 @@ patch_t *Patch_GetRotatedSprite(spriteframe_t *sprite, size_t frame, size_t spri
|
||||
}
|
||||
else
|
||||
{
|
||||
xpivot = patch->leftoffset;
|
||||
ypivot = patch->height / 2;
|
||||
xpivot = SHORT(patch->leftoffset);
|
||||
ypivot = SHORT(patch->height) / 2;
|
||||
}
|
||||
|
||||
RotatedPatch_DoRotation(rotsprite, patch, rotationangle, xpivot, ypivot, flip);
|
||||
@@ -902,9 +912,9 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
|
||||
size_t size;
|
||||
INT32 bflip = (flip != 0x00);
|
||||
|
||||
INT32 width = patch->width;
|
||||
INT32 height = patch->height;
|
||||
INT32 leftoffset = patch->leftoffset;
|
||||
INT32 width = SHORT(patch->width);
|
||||
INT32 height = SHORT(patch->height);
|
||||
INT32 leftoffset = SHORT(patch->leftoffset);
|
||||
INT32 newwidth, newheight;
|
||||
|
||||
fixed_t ca = rollcosang[angle];
|
||||
@@ -975,7 +985,7 @@ void RotatedPatch_DoRotation(rotsprite_t *rotsprite, patch_t *patch, INT32 angle
|
||||
}
|
||||
|
||||
ox = (newwidth / 2) + (leftoffset - xpivot);
|
||||
oy = (newheight / 2) + (patch->topoffset - ypivot);
|
||||
oy = (newheight / 2) + (SHORT(patch->topoffset) - ypivot);
|
||||
width = (maxx - minx);
|
||||
height = (maxy - miny);
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#define __R_PATCH__
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "r_fps.h"
|
||||
#include "doomdef.h"
|
||||
|
||||
// Structs
|
||||
@@ -53,6 +54,8 @@ void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum);
|
||||
// Sprite rotation
|
||||
#ifdef ROTSPRITE
|
||||
INT32 R_GetRollAngle(angle_t rollangle);
|
||||
angle_t R_RotationAngle(angle_t ang, angle_t camang, interpmobjstate_t *interp);
|
||||
|
||||
patch_t *Patch_GetRotatedSprite(
|
||||
spriteframe_t *sprite,
|
||||
size_t frame, size_t spriteangle,
|
||||
|
||||
+23
-29
@@ -661,13 +661,13 @@ static boolean R_IsFFloorTranslucent(visffloor_t *pfloor)
|
||||
// Renders all the thick sides in the given range.
|
||||
void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||
{
|
||||
size_t pindex;
|
||||
size_t pindex = 0;
|
||||
column_t * col;
|
||||
INT32 lightnum;
|
||||
INT32 texnum;
|
||||
INT32 lightnum;
|
||||
INT32 texnum;
|
||||
sector_t tempsec;
|
||||
INT32 templight;
|
||||
INT32 i, p;
|
||||
INT32 templight;
|
||||
INT32 i, p;
|
||||
fixed_t bottombounds = viewheight << FRACBITS;
|
||||
fixed_t topbounds = (con_clipviewtop - 1) << FRACBITS;
|
||||
fixed_t offsetvalue = 0;
|
||||
@@ -1036,6 +1036,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||
// Check if the current light effects the colormap/lightlevel
|
||||
rlight = &dc_lightlist[i];
|
||||
lighteffect = !(dc_lightlist[i].flags & FF_NOSHADE);
|
||||
|
||||
if (lighteffect)
|
||||
{
|
||||
lightnum = rlight->lightnum;
|
||||
@@ -1233,7 +1234,6 @@ static void R_RenderSegLoop (void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
yh = bottomfrac>>HEIGHTBITS;
|
||||
|
||||
bottom = floorclip[rw_x]-1;
|
||||
@@ -1244,13 +1244,14 @@ static void R_RenderSegLoop (void)
|
||||
if (markfloor)
|
||||
{
|
||||
top = yh < ceilingclip[rw_x] ? ceilingclip[rw_x] : yh;
|
||||
|
||||
if (++top <= bottom && floorplane)
|
||||
{
|
||||
floorplane->top[rw_x] = (INT16)top;
|
||||
floorplane->bottom[rw_x] = (INT16)bottom;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rw_floormarked = false;
|
||||
rw_ceilingmarked = false;
|
||||
|
||||
@@ -1591,6 +1592,8 @@ static void R_RenderSegLoop (void)
|
||||
topfrac += topstep;
|
||||
bottomfrac += bottomstep;
|
||||
}
|
||||
|
||||
//colfunc = wallcolfunc;
|
||||
}
|
||||
|
||||
// Uses precalculated seg->length
|
||||
@@ -1853,21 +1856,19 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
rw_toptextureslide = rw_midtextureslide = rw_bottomtextureslide = 0;
|
||||
ceilingfrontslide = floorfrontslide = ceilingbackslide = floorbackslide = 0;
|
||||
|
||||
{
|
||||
angle_t lineangle = R_PointToAngle2(curline->v1->x, curline->v1->y, curline->v2->x, curline->v2->y);
|
||||
angle_t lineangle = R_PointToAngle2(curline->v1->x, curline->v1->y, curline->v2->x, curline->v2->y);
|
||||
|
||||
if (frontsector->f_slope)
|
||||
floorfrontslide = FixedMul(frontsector->f_slope->zdelta, FINECOSINE((lineangle-frontsector->f_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
if (frontsector->f_slope)
|
||||
floorfrontslide = FixedMul(frontsector->f_slope->zdelta, FINECOSINE((lineangle-frontsector->f_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
|
||||
if (frontsector->c_slope)
|
||||
ceilingfrontslide = FixedMul(frontsector->c_slope->zdelta, FINECOSINE((lineangle-frontsector->c_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
if (frontsector->c_slope)
|
||||
ceilingfrontslide = FixedMul(frontsector->c_slope->zdelta, FINECOSINE((lineangle-frontsector->c_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
|
||||
if (backsector && backsector->f_slope)
|
||||
floorbackslide = FixedMul(backsector->f_slope->zdelta, FINECOSINE((lineangle-backsector->f_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
if (backsector && backsector->f_slope)
|
||||
floorbackslide = FixedMul(backsector->f_slope->zdelta, FINECOSINE((lineangle-backsector->f_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
|
||||
if (backsector && backsector->c_slope)
|
||||
ceilingbackslide = FixedMul(backsector->c_slope->zdelta, FINECOSINE((lineangle-backsector->c_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
}
|
||||
if (backsector && backsector->c_slope)
|
||||
ceilingbackslide = FixedMul(backsector->c_slope->zdelta, FINECOSINE((lineangle-backsector->c_slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
|
||||
if (!backsector)
|
||||
{
|
||||
@@ -1936,9 +1937,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
ds_p->sprtopclip = ds_p->sprbottomclip = NULL;
|
||||
ds_p->silhouette = 0;
|
||||
|
||||
if (
|
||||
worldbottomslope > worldlowslope ||
|
||||
worldbottom > worldlow)
|
||||
if (worldbottomslope > worldlowslope || worldbottom > worldlow)
|
||||
{
|
||||
ds_p->silhouette = SIL_BOTTOM;
|
||||
if ((backsector->f_slope ? P_GetZAt(backsector->f_slope, viewx, viewy) : backsector->floorheight) > viewz)
|
||||
@@ -1953,9 +1952,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
// ds_p->sprbottomclip = negonearray;
|
||||
}
|
||||
|
||||
if (
|
||||
worldtopslope < worldhighslope ||
|
||||
worldtop < worldhigh)
|
||||
if (worldtopslope < worldhighslope || worldtop < worldhigh)
|
||||
{
|
||||
ds_p->silhouette |= SIL_TOP;
|
||||
if ((backsector->c_slope ? P_GetZAt(backsector->c_slope, viewx, viewy) : backsector->ceilingheight) < viewz)
|
||||
@@ -2029,7 +2026,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
|| frontsector->extra_colormap != backsector->extra_colormap
|
||||
|| (frontsector->ffloors != backsector->ffloors && frontsector->tag != backsector->tag))
|
||||
{
|
||||
markceiling = true;
|
||||
markceiling = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2045,9 +2042,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
}
|
||||
|
||||
// check TOP TEXTURE
|
||||
if (worldhigh < worldtop
|
||||
|| worldhighslope < worldtopslope
|
||||
)
|
||||
if (worldhigh < worldtop || worldhighslope < worldtopslope)
|
||||
{
|
||||
fixed_t texheight;
|
||||
// top texture
|
||||
@@ -2124,7 +2119,6 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
// Used for height comparisons and etc across FOFs and slopes
|
||||
fixed_t high1, highslope1, low1, lowslope1, high2, highslope2, low2, lowslope2;
|
||||
|
||||
//markceiling = markfloor = true;
|
||||
maskedtexture = true;
|
||||
|
||||
ds_p->thicksidecol = maskedtexturecol = lastopening - rw_x;
|
||||
|
||||
@@ -59,9 +59,6 @@ typedef struct floorsplat_s
|
||||
struct floorsplat_s *nextvis;
|
||||
} floorsplat_t;
|
||||
|
||||
// p_setup.c
|
||||
fixed_t P_SegLength(seg_t *seg);
|
||||
|
||||
// call at P_SetupLevel()
|
||||
void R_ClearLevelSplats(void);
|
||||
|
||||
|
||||
+32
-27
@@ -965,7 +965,8 @@ static void R_DrawPrecipitationVisSprite(vissprite_t *vis)
|
||||
|
||||
//
|
||||
// R_SplitSprite
|
||||
// runs through a sector's lightlist and
|
||||
// runs through a sector's lightlist and splits the sprite according to the heights
|
||||
//
|
||||
static void R_SplitSprite(vissprite_t *sprite, mobj_t *thing)
|
||||
{
|
||||
INT32 i, lightnum, lindex;
|
||||
@@ -1142,7 +1143,9 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
vissprite_t *vis;
|
||||
|
||||
angle_t ang = 0; // gcc 4.6 and lower fix
|
||||
#ifdef ROTSPRITE
|
||||
angle_t camang = 0;
|
||||
#endif
|
||||
fixed_t iscale;
|
||||
fixed_t scalestep; // toast '16
|
||||
fixed_t offset, offset2;
|
||||
@@ -1163,7 +1166,6 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
#ifdef ROTSPRITE
|
||||
patch_t *rotsprite = NULL;
|
||||
INT32 rollangle = 0;
|
||||
angle_t rollsum = 0;
|
||||
angle_t pitchnroll = 0;
|
||||
angle_t sliptiderollangle = 0;
|
||||
#endif
|
||||
@@ -1206,7 +1208,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
tx = -(gyt + gxt);
|
||||
|
||||
// too far off the side?
|
||||
if (!papersprite && abs(tx) > tz<<2) // papersprite clipping is handled later
|
||||
if (!papersprite && abs(tx) > (INT64)tz<<2) // papersprite clipping is handled later
|
||||
return;
|
||||
|
||||
// aspect ratio stuff
|
||||
@@ -1219,7 +1221,13 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
I_Error("R_ProjectSprite: invalid sprite number %d ", thing->sprite);
|
||||
#endif
|
||||
|
||||
rot = thing->frame&FF_FRAMEMASK;
|
||||
rot = (thing->frame & FF_FRAMEMASK);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// determine here if sprite should rotate for optimization
|
||||
const boolean sliprollrotate = (cv_sloperoll.value && cv_sliptideroll.value && (thing->player && thing->player->sliproll));
|
||||
const boolean shouldrotate = (cv_sloperoll.value && (interp.roll || interp.pitch || interp.sloperoll || interp.slopepitch || thing->rollangle || sliprollrotate));
|
||||
#endif
|
||||
|
||||
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
|
||||
if ((thing->skin || thing->localskin) && thing->sprite == SPR_PLAY)
|
||||
@@ -1250,7 +1258,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &spriteinfo[thing->sprite];
|
||||
#endif
|
||||
rot = thing->frame&FF_FRAMEMASK;
|
||||
rot = (thing->frame & FF_FRAMEMASK);
|
||||
if (!thing->skin)
|
||||
{
|
||||
thing->state->sprite = thing->sprite;
|
||||
@@ -1265,10 +1273,17 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
I_Error("R_ProjectSprite: sprframes NULL for sprite %d\n", thing->sprite);
|
||||
#endif
|
||||
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite || (cv_sloperoll.value == 2 && cv_spriteroll.value))
|
||||
if (sprframe->rotate != SRF_SINGLE || papersprite ||
|
||||
#ifdef ROTSPRITE
|
||||
(shouldrotate)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
|
||||
camang = R_PointToAngle (interp.x, interp.y);
|
||||
ang = R_PointToAngle(interp.x, interp.y);
|
||||
#ifdef ROTSPRITE
|
||||
camang = ang;
|
||||
#endif
|
||||
ang -= interp.angle;
|
||||
|
||||
if (mirrored)
|
||||
ang = InvAngle(ang);
|
||||
@@ -1311,9 +1326,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
spr_topoffset = spritecachedinfo[lump].topoffset;
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
pitchnroll = 0; // set this to 0, non-paper sprites will affect this value
|
||||
|
||||
if (cv_spriteroll.value)
|
||||
if (shouldrotate)
|
||||
{
|
||||
if (papersprite)
|
||||
{
|
||||
@@ -1331,29 +1344,21 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
{
|
||||
// this is very messy, but it on-the-fly calculates rotations for all the
|
||||
// pitch and roll variables
|
||||
pitchnroll = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), interp.roll) +
|
||||
FixedMul(FINESINE((ang) >> ANGLETOFINESHIFT), interp.pitch) +
|
||||
FixedMul(FINECOSINE((camang) >> ANGLETOFINESHIFT), interp.sloperoll) +
|
||||
FixedMul(FINESINE((camang) >> ANGLETOFINESHIFT), interp.slopepitch);
|
||||
|
||||
pitchnroll = R_RotationAngle(ang, camang, &interp);
|
||||
rollangle = thing->rollangle;
|
||||
}
|
||||
|
||||
if (rollangle || pitchnroll || (thing->player && thing->player->sliproll))
|
||||
if (rollangle || pitchnroll || sliprollrotate)
|
||||
{
|
||||
rollsum = pitchnroll;
|
||||
|
||||
if (thing->player)
|
||||
if (sliprollrotate)
|
||||
{
|
||||
sliptiderollangle =
|
||||
cv_sliptideroll.value ? thing->player->sliproll * (thing->player->sliptidemem) : 0;
|
||||
rollsum += thing->rollangle +
|
||||
FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), sliptiderollangle);
|
||||
sliptiderollangle = thing->player->sliproll * thing->player->kartstuff[k_aizdriftstrat];
|
||||
pitchnroll += rollangle + FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), sliptiderollangle);
|
||||
}
|
||||
else
|
||||
rollsum += thing->rollangle;
|
||||
pitchnroll += rollangle;
|
||||
|
||||
rollangle = R_GetRollAngle(rollsum);
|
||||
rollangle = R_GetRollAngle(pitchnroll);
|
||||
rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, false, sprinfo, rollangle);
|
||||
|
||||
if (rotsprite != NULL)
|
||||
@@ -1664,7 +1669,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
//Fab: lumppat is the lump number of the patch to use, this is different
|
||||
// than lumpid for sprites-in-pwad : the graphics are patched
|
||||
#ifdef ROTSPRITE
|
||||
if ((rotsprite != NULL) && (cv_spriteroll.value))
|
||||
if (rotsprite != NULL)
|
||||
vis->patch = rotsprite;
|
||||
else
|
||||
#endif
|
||||
|
||||
+49
-22
@@ -987,7 +987,7 @@ boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32
|
||||
INT64 x, y, yl, yh, xl, xh;
|
||||
fixed_t newdist;
|
||||
|
||||
if (R_PointInSubsector(listensource.x, listensource.y)->sector->ceilingpic == skyflatnum)
|
||||
if (R_PointInSubsectorFast(listensource.x, listensource.y)->sector->ceilingpic == skyflatnum)
|
||||
approx_dist = 0;
|
||||
else
|
||||
{
|
||||
@@ -1000,7 +1000,7 @@ boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32
|
||||
for (y = yl; y <= yh; y += FRACUNIT*64)
|
||||
for (x = xl; x <= xh; x += FRACUNIT*64)
|
||||
{
|
||||
if (R_PointInSubsector(x, y)->sector->ceilingpic == skyflatnum)
|
||||
if (R_PointInSubsectorFast(x, y)->sector->ceilingpic == skyflatnum)
|
||||
{
|
||||
// Found the outdoors!
|
||||
newdist = S_CalculateSoundDistance(listensource.x, listensource.y, 0, x, y, 0);
|
||||
@@ -1763,6 +1763,15 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
|
||||
{
|
||||
char newmusic[7] = {0};
|
||||
|
||||
struct MusicChange hook_param = {
|
||||
newmusic,
|
||||
&mflags,
|
||||
&looping,
|
||||
&position,
|
||||
&prefadems,
|
||||
&fadeinms
|
||||
};
|
||||
|
||||
if (S_MusicDisabled()
|
||||
|| demo.rewinding // Don't mess with music while rewinding!
|
||||
|| demo.title) // SRB2Kart: Demos don't interrupt title screen music
|
||||
@@ -1772,7 +1781,7 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
|
||||
|
||||
S_CheckEventMus(newmusic);
|
||||
|
||||
if (LUAh_MusicChange(music_name, newmusic, &mflags, &looping, &position, &prefadems, &fadeinms))
|
||||
if (LUA_HookMusicChange(music_name, &hook_param))
|
||||
return;
|
||||
|
||||
// No Music (empty string)
|
||||
@@ -1983,18 +1992,21 @@ boolean S_FadeOutStopMusic(UINT32 ms)
|
||||
return false;
|
||||
}*/
|
||||
|
||||
static INT16 oldmap = 0;
|
||||
static boolean oldencore = false;
|
||||
static boolean skipmusic = false;
|
||||
boolean skipintromus = false;
|
||||
|
||||
static const char *musicexception_list[16] = {
|
||||
static const char *musicexception_list[17] = {
|
||||
"vote", "voteea", "voteeb", "racent", "krwin",
|
||||
"krok", "krlose", "krfail", "kbwin", "kbok",
|
||||
"kblose", "kstart", "estart", "wait2j", "CHRSHP",
|
||||
"CHRSHF"
|
||||
"kblose", "kstart", "estart", "wait2j", "titles",
|
||||
"CHRSHF", "CHRSHP" // no clue what those are tbh
|
||||
};
|
||||
|
||||
void S_ResetKeepAndSpecialMus(void)
|
||||
{
|
||||
keepmusic = skipintromus = false;
|
||||
}
|
||||
|
||||
//checks for any kind of event music like intermission, vote etc.
|
||||
//always runs when musicchange gets invoked
|
||||
static void S_CheckEventMus(const char *newmus)
|
||||
@@ -2004,22 +2016,25 @@ static void S_CheckEventMus(const char *newmus)
|
||||
if (!cv_keepmusic.value)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
for (int i = 0; i < 17; i++)
|
||||
if (stricmp(music_name, musicexception_list[i]) == 0 || stricmp(newmus, musicexception_list[i]) == 0) // weird? sure! but were lucky enough newmus reflects whats being replaced
|
||||
{
|
||||
skipmusic = true;
|
||||
break;
|
||||
}
|
||||
|
||||
//CONS_Printf("musname = %s\n", music_name);
|
||||
//CONS_Printf("music_name = %s\n", music_name);
|
||||
//CONS_Printf("newmus = %s\n", newmus);
|
||||
//CONS_Printf("newmus = %d\n", skipmusic);
|
||||
//CONS_Printf("skipmusic = %d\n", skipmusic);
|
||||
}
|
||||
|
||||
//this one compares map and encoremode instead of the music itself
|
||||
//makes tunes work and stuff
|
||||
void S_CheckMap(void)
|
||||
{
|
||||
static INT16 oldmap = 0;
|
||||
static boolean oldencore = false;
|
||||
|
||||
if (!cv_keepmusic.value)
|
||||
{
|
||||
keepmusic = false;
|
||||
@@ -2028,6 +2043,8 @@ void S_CheckMap(void)
|
||||
|
||||
keepmusic = (!skipmusic && gamestate == GS_LEVEL && oldmap == gamemap && oldencore == encoremode);
|
||||
|
||||
//CONS_Printf("keepmusic = %s\n", keepmusic);
|
||||
|
||||
oldencore = encoremode;
|
||||
oldmap = gamemap;
|
||||
}
|
||||
@@ -2039,15 +2056,7 @@ void S_CheckMap(void)
|
||||
//
|
||||
void S_InitMapMusic(void)
|
||||
{
|
||||
if (!cv_skipintromusic.value)
|
||||
skipintromus = false;
|
||||
else
|
||||
{
|
||||
char *maptitle = G_BuildMapTitle(gamemap);
|
||||
skipintromus = cv_skipintromusic.value && stricmp(maptitle, "Wandering Falls") != 0; // thanks diggle!
|
||||
if (maptitle)
|
||||
Z_Free(maptitle);
|
||||
}
|
||||
skipintromus = false;
|
||||
|
||||
if (mapmusflags & MUSIC_RELOADRESET)
|
||||
{
|
||||
@@ -2065,6 +2074,15 @@ void S_InitMapMusic(void)
|
||||
// lug: but not when we keep the map music lol
|
||||
S_StopMusic();
|
||||
|
||||
if (cv_skipintromusic.value)
|
||||
{
|
||||
char *maptitle = G_BuildMapTitle(gamemap);
|
||||
// for some reason, occasionally the title screen music doesent seem to be reset in time, so skipping the intro may make it just continue playing it instead, weird..
|
||||
skipintromus = (stricmp(music_name, "titles") != 0) && (maptitle && (stricmp(maptitle, "Wandering Falls") != 0)); // thanks diggle!
|
||||
if (maptitle)
|
||||
Z_Free(maptitle);
|
||||
}
|
||||
|
||||
if (skipintromus)
|
||||
return;
|
||||
|
||||
@@ -2073,13 +2091,13 @@ void S_InitMapMusic(void)
|
||||
//S_ChangeMusicEx((encoremode ? "estart" : "kstart"), 0, false, mapmusposition, 0, 0);
|
||||
}
|
||||
|
||||
void S_StartMapMusic(boolean restore)
|
||||
void S_StartMapMusic(void)
|
||||
{
|
||||
//no need to constantly run this after race has started
|
||||
if (leveltime > MUSICSTARTTIME)
|
||||
return;
|
||||
|
||||
if (keepmusic && !restore) // make sure this doesent kill the music when its called from P_RestoreMusic in some cases
|
||||
if (keepmusic)
|
||||
return;
|
||||
|
||||
if (skipintromus)
|
||||
@@ -2114,6 +2132,8 @@ void S_RestartMusic(void)
|
||||
S_SetMusicVolume(cv_digmusicvolume.value, cv_midimusicvolume.value);
|
||||
#endif
|
||||
|
||||
S_ResetKeepAndSpecialMus();
|
||||
|
||||
if (Playing()) // Gotta make sure the player is in a level
|
||||
P_RestoreMusic(&players[consoleplayer]);
|
||||
else
|
||||
@@ -2218,6 +2238,8 @@ static void Command_RestartAudio_f(void)
|
||||
|
||||
S_StartSound(NULL, sfx_strpst);
|
||||
|
||||
S_ResetKeepAndSpecialMus();
|
||||
|
||||
if (Playing()) // Gotta make sure the player is in a level
|
||||
P_RestoreMusic(&players[consoleplayer]);
|
||||
else
|
||||
@@ -2295,6 +2317,8 @@ static void GameDigiMusic_OnChange(void)
|
||||
I_StartupSound(); // will return early if initialised
|
||||
I_InitMusic();
|
||||
|
||||
S_ResetKeepAndSpecialMus();
|
||||
|
||||
if (Playing())
|
||||
P_RestoreMusic(&players[consoleplayer]);
|
||||
else
|
||||
@@ -2380,6 +2404,9 @@ static void GameMIDIMusic_OnChange(void)
|
||||
{
|
||||
midi_disabled = false;
|
||||
I_InitMusic();
|
||||
|
||||
S_ResetKeepAndSpecialMus();
|
||||
|
||||
if (Playing())
|
||||
P_RestoreMusic(&players[consoleplayer]);
|
||||
else
|
||||
|
||||
+13
-1
@@ -109,8 +109,10 @@ void S_InitSfxChannels(INT32 sfxVolume);
|
||||
void S_StopSounds(void);
|
||||
void S_ClearSfx(void);
|
||||
|
||||
void S_ResetKeepAndSpecialMus(void);
|
||||
|
||||
void S_InitMapMusic(void);
|
||||
void S_StartMapMusic(boolean restore);
|
||||
void S_StartMapMusic(void);
|
||||
|
||||
void S_CheckMap(void);
|
||||
|
||||
@@ -229,6 +231,16 @@ UINT32 S_GetMusicPosition(void);
|
||||
// Music Playback
|
||||
//
|
||||
|
||||
/* this is for the sake of the hook */
|
||||
struct MusicChange {
|
||||
char * newname;
|
||||
UINT16 * mflags;
|
||||
boolean * looping;
|
||||
UINT32 * position;
|
||||
UINT32 * prefadems;
|
||||
UINT32 * fadeinms;
|
||||
};
|
||||
|
||||
// Start music track, arbitrary, given its name, and set whether looping
|
||||
// note: music flags 12 bits for tracknum (gme, other formats with more than one track)
|
||||
// 13-15 aren't used yet
|
||||
|
||||
+91
-65
@@ -702,10 +702,35 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
|
||||
return raxis;
|
||||
}
|
||||
|
||||
boolean I_CheckNativeRes(void)
|
||||
{
|
||||
static int oldwidth = 0, oldheight = 0;
|
||||
static boolean resstate = false;
|
||||
int currentDisplayIndex = 0;
|
||||
SDL_DisplayMode curmode;
|
||||
|
||||
if (oldwidth == vid.width && oldheight == vid.height)
|
||||
{
|
||||
return resstate;
|
||||
}
|
||||
|
||||
currentDisplayIndex = SDL_GetWindowDisplayIndex(window);
|
||||
|
||||
if (SDL_GetCurrentDisplayMode(currentDisplayIndex, &curmode) != 0)
|
||||
{
|
||||
return resstate;
|
||||
}
|
||||
|
||||
resstate = ((vid.width == curmode.w) && (vid.height == curmode.h));
|
||||
oldwidth = vid.width;
|
||||
oldheight = vid.height;
|
||||
return resstate;
|
||||
}
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
void I_DownSample(void)
|
||||
{
|
||||
if (!cv_glframebuffer.value || !supportFBO) //no sense to do this crap if we cant benefit from it
|
||||
if (!cv_glframebuffer.value || !supportFBO || I_CheckNativeRes()) //no sense to do this crap if we cant benefit from it
|
||||
{
|
||||
downsample = false;
|
||||
return;
|
||||
@@ -756,7 +781,7 @@ static void I_FixXwaylandNvidia(void) //dumbass crap, fix ur shit nvidia
|
||||
|
||||
static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||
{
|
||||
#define FOCUSUNION (mousefocus | (kbfocus << 1))
|
||||
#define FOCUSUNION (mousefocus | (kbfocus << 1) | (windowmoved << 2))
|
||||
static SDL_bool firsttimeonmouse = SDL_TRUE;
|
||||
static SDL_bool mousefocus = SDL_TRUE;
|
||||
static SDL_bool kbfocus = SDL_TRUE;
|
||||
@@ -1999,27 +2024,27 @@ void I_StartupGraphics(void)
|
||||
else if (M_CheckParm("-opengl"))
|
||||
rendermode = render_opengl;
|
||||
|
||||
msaa = 0; boolean msaa_set = false;
|
||||
a2c = false; boolean a2c_set = false;
|
||||
msaa = 0; boolean msaa_set = false;
|
||||
a2c = false; boolean a2c_set = false;
|
||||
|
||||
if (M_CheckParm("-msaa") && M_IsNextParm())
|
||||
{
|
||||
const char* str = M_GetNextParm();
|
||||
if (sscanf(str, "%u", &msaa))
|
||||
{
|
||||
msaa_set = true;
|
||||
}
|
||||
}
|
||||
if (M_CheckParm("-msaa") && M_IsNextParm())
|
||||
{
|
||||
const char* str = M_GetNextParm();
|
||||
if (sscanf(str, "%u", &msaa))
|
||||
{
|
||||
msaa_set = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (M_CheckParm("-a2c"))
|
||||
{
|
||||
a2c = true;
|
||||
a2c_set = true;
|
||||
}
|
||||
else if (M_CheckParm("-noa2c"))
|
||||
{
|
||||
a2c_set = true;
|
||||
}
|
||||
if (M_CheckParm("-a2c"))
|
||||
{
|
||||
a2c = true;
|
||||
a2c_set = true;
|
||||
}
|
||||
else if (M_CheckParm("-noa2c"))
|
||||
{
|
||||
a2c_set = true;
|
||||
}
|
||||
|
||||
{
|
||||
char line[16];
|
||||
@@ -2029,52 +2054,52 @@ void I_StartupGraphics(void)
|
||||
{
|
||||
while (fgets(line, sizeof line, file) != NULL)
|
||||
{
|
||||
word = strtok(line, " \n");
|
||||
word = strtok(line, " \n");
|
||||
|
||||
if (rendermode == render_none)
|
||||
{
|
||||
if (strcasecmp(word, "software") == 0)
|
||||
{
|
||||
rendermode = render_soft;
|
||||
}
|
||||
else if (strcasecmp(word, "opengl") == 0)
|
||||
{
|
||||
rendermode = render_opengl;
|
||||
}
|
||||
if (rendermode == render_none)
|
||||
{
|
||||
if (strcasecmp(word, "software") == 0)
|
||||
{
|
||||
rendermode = render_soft;
|
||||
}
|
||||
else if (strcasecmp(word, "opengl") == 0)
|
||||
{
|
||||
rendermode = render_opengl;
|
||||
}
|
||||
|
||||
if (rendermode != render_none)
|
||||
{
|
||||
CONS_Printf("Using last known renderer: %s\n", line);
|
||||
}
|
||||
if (rendermode != render_none)
|
||||
{
|
||||
CONS_Printf("Using last known renderer: %s\n", line);
|
||||
}
|
||||
}
|
||||
|
||||
if (!msaa_set)
|
||||
{
|
||||
if (strcasecmp(word, "msaa") == 0)
|
||||
{
|
||||
const char *nextword = strtok(NULL, " \n");
|
||||
if (!msaa_set)
|
||||
{
|
||||
if (strcasecmp(word, "msaa") == 0)
|
||||
{
|
||||
const char *nextword = strtok(NULL, " \n");
|
||||
|
||||
if (!nextword || !sscanf(nextword, "%u", &msaa))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Malformed MSAA entry in renderer.txt\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("Using last know MSAA value: %u\n", msaa);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!nextword || !sscanf(nextword, "%u", &msaa))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Malformed MSAA entry in renderer.txt\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("Using last know MSAA value: %u\n", msaa);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!a2c_set)
|
||||
{
|
||||
if (strcasecmp(word, "a2c") == 0)
|
||||
{
|
||||
a2c = true;
|
||||
if (!a2c_set)
|
||||
{
|
||||
if (strcasecmp(word, "a2c") == 0)
|
||||
{
|
||||
a2c = true;
|
||||
|
||||
CONS_Printf("Using a2c because it was specified to be used earlier\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
CONS_Printf("Using a2c because it was specified to be used earlier\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
@@ -2106,13 +2131,13 @@ void I_StartupGraphics(void)
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
fprintf(file, "msaa %u\n", msaa);
|
||||
fprintf(file, "msaa %u\n", msaa);
|
||||
|
||||
if (a2c)
|
||||
fputs("a2c\n", file);
|
||||
if (a2c)
|
||||
fputs("a2c\n", file);
|
||||
#endif
|
||||
|
||||
fclose(file);
|
||||
fclose(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2123,8 +2148,8 @@ void I_StartupGraphics(void)
|
||||
usesdl2soft = M_CheckParm("-softblit");
|
||||
borderlesswindow = M_CheckParm("-borderless");
|
||||
|
||||
//SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2);
|
||||
VID_Command_ModeList_f();
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
@@ -2297,4 +2322,5 @@ static void Impl_SetVsync(void)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
+7
-2
@@ -258,7 +258,7 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
GLFramebuffer_Unbind();
|
||||
#endif
|
||||
|
||||
HWR_DrawScreenFinalTexture(sdlw, sdlh);
|
||||
HWR_DrawScreenFinalTexture(sdlw, sdlh, HWR_ShouldUsePaletteRendering());
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (UseScreenFBO())
|
||||
@@ -271,7 +271,12 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
|
||||
// Sryder: We need to draw the final screen texture again into the other buffer in the original position so that
|
||||
// effects that want to take the old screen can do so after this
|
||||
HWR_DrawScreenFinalTexture(realwidth, realheight);
|
||||
if ((!I_CheckNativeRes()) // well we dont need it on native res it seems
|
||||
#ifdef USE_FBO_OGL
|
||||
&& (!UseScreenFBO())
|
||||
#endif
|
||||
)
|
||||
HWR_DrawScreenFinalTexture(realwidth, realheight, false);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(OglSdlSetPalette) (RGBA_t *palette)
|
||||
|
||||
+1
-1
@@ -725,7 +725,7 @@ static void ST_overlayDrawer(void)
|
||||
{
|
||||
if (renderisnewtic)
|
||||
{
|
||||
LUAh_GameHUD(luahuddrawlist_game[stplyrnum]);
|
||||
LUA_HUDHOOK(game, luahuddrawlist_game[stplyrnum]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -182,6 +182,9 @@ void V_DrawFadeScreen(UINT16 color, UINT8 strength);
|
||||
|
||||
void V_DrawFadeConsBack(INT32 plines);
|
||||
|
||||
// allow menu text to be displayed in lowercase
|
||||
#define MENUCAPS (!cv_menucaps.value ? V_ALLOWLOWERCASE : 0)
|
||||
|
||||
// draw a single character
|
||||
void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed);
|
||||
// draw a single character, but for the chat
|
||||
|
||||
+6
-4
@@ -592,7 +592,7 @@ void Y_IntermissionDrawer(void)
|
||||
if (renderisnewtic)
|
||||
{
|
||||
LUA_HUD_ClearDrawList(luahuddrawlist_intermission);
|
||||
LUAh_IntermissionHUD(luahuddrawlist_intermission);
|
||||
LUA_HUDHOOK(intermission, luahuddrawlist_intermission);
|
||||
}
|
||||
LUA_HUD_DrawList(luahuddrawlist_intermission);
|
||||
}
|
||||
@@ -616,13 +616,15 @@ void Y_Ticker(void)
|
||||
|
||||
if (demo.savemode == DSM_WILLSAVE || demo.savemode == DSM_WILLAUTOSAVE)
|
||||
G_SaveDemo();
|
||||
else
|
||||
G_ResetDemoRecording();
|
||||
}
|
||||
|
||||
// Check for pause or menu up in single player
|
||||
if (paused || P_AutoPause())
|
||||
return;
|
||||
|
||||
LUAh_IntermissionThinker();
|
||||
LUA_HookVoid(HOOK(IntermissionThinker));
|
||||
|
||||
intertic++;
|
||||
|
||||
@@ -1211,7 +1213,7 @@ void Y_VoteDrawer(void)
|
||||
if (renderisnewtic)
|
||||
{
|
||||
LUA_HUD_ClearDrawList(luahuddrawlist_vote);
|
||||
LUAh_VoteHUD(luahuddrawlist_vote);
|
||||
LUA_HUDHOOK(vote, luahuddrawlist_vote);
|
||||
}
|
||||
LUA_HUD_DrawList(luahuddrawlist_vote);
|
||||
}
|
||||
@@ -1258,7 +1260,7 @@ void Y_VoteTicker(void)
|
||||
if (paused || P_AutoPause() || !voteclient.loaded)
|
||||
return;
|
||||
|
||||
LUAh_VoteThinker();
|
||||
LUA_HOOK(VoteThinker);
|
||||
|
||||
votetic++;
|
||||
|
||||
|
||||
Reference in new issue
Block a user