Compare commits
157 Commits
v1.2-patch
...
srb2-merge
Author | SHA1 | Date |
---|---|---|
James R | de37af7d1d | |
James R | 34bddc1ce7 | |
James R | 91d3f7e2cc | |
James R | b32a0315eb | |
James R | 88615f58cf | |
Alam Ed Arias | bf28a7f5bc | |
Alam Ed Arias | 92779487a4 | |
James R | 4eae79bdb4 | |
James R | 5ef48c186f | |
James R | 03a590ad98 | |
James R | fc2f130a70 | |
Alam Ed Arias | 062f0278bc | |
Alam Ed Arias | 78075ecd89 | |
GoldenTails | 14cd7a5a0c | |
Alam Ed Arias | 028996915d | |
Alam Ed Arias | dadec1196b | |
Steel Titanium | 13d627ee7f | |
Monster Iestyn | 964693d542 | |
Steel Titanium | 08808e2200 | |
Steel Titanium | 9f7613ef6d | |
Monster Iestyn | 7a199748b9 | |
Monster Iestyn | 7090413417 | |
James R | e5071bb605 | |
GoldenTails | 74de804817 | |
Steel Titanium | 7731bf6b09 | |
Steel Titanium | 6ef9ee5467 | |
Monster Iestyn | 2dd5f1abe3 | |
James R | 4c5ad4bb42 | |
James R | ed6dcf0b84 | |
GoldenTails | ac7db85149 | |
Monster Iestyn | c50831f875 | |
Monster Iestyn | 9a4a90c9cb | |
James R | 9c1fa867fa | |
James R | c1ba72ead8 | |
James R | 19dd9a3c14 | |
Monster Iestyn | 0949406b9c | |
Monster Iestyn | 450ea0cc43 | |
Monster Iestyn | e52a314ddb | |
Monster Iestyn | 99f04f1d89 | |
Monster Iestyn | ae9ecef592 | |
Monster Iestyn | 392cb89ff4 | |
Monster Iestyn | bbefc3b7f4 | |
Monster Iestyn | cda81cc166 | |
Monster Iestyn | c8d1dd3be8 | |
Monster Iestyn | 27dd99ae72 | |
Monster Iestyn | 8fa54c1ab4 | |
James R | d9e29f15cd | |
GoldenTails | aa165f4f19 | |
Alam Ed Arias | 81b294eec1 | |
Alam Ed Arias | 0c2b300294 | |
Alam Ed Arias | 33c0b825a7 | |
Alam Ed Arias | 268b5a09d9 | |
Alam Ed Arias | eacf89e309 | |
Alam Ed Arias | b773b61b8c | |
Alam Ed Arias | 749c2753e4 | |
Alam Ed Arias | 5a79a446df | |
Alam Ed Arias | d5cc3ce48d | |
Alam Ed Arias | 07f89fd6b5 | |
Alam Ed Arias | 963d2f5da3 | |
Alam Ed Arias | 66f84efd02 | |
Monster Iestyn | 6eaf7625a9 | |
Monster Iestyn | 3e708e62e8 | |
James R | 91502f1499 | |
Steel Titanium | 4e839596a1 | |
GoldenTails | cfc9e23c43 | |
GoldenTails | e9771cd7d0 | |
Monster Iestyn | 3a9ce483f5 | |
Steel Titanium | 2c906e9c29 | |
Steel Titanium | 47eb711097 | |
Steel Titanium | f7357a02ae | |
Steel Titanium | 016f1fe533 | |
Monster Iestyn | 826e8e1aaf | |
Monster Iestyn | d9ca8b45d3 | |
Sryder | 8a778a4070 | |
Sryder | 5f339fc2a9 | |
Sryder | bb9b1b3b1f | |
Sryder | bc254d9cf7 | |
Sryder | 45922f80d1 | |
Monster Iestyn | c9456e141d | |
Monster Iestyn | 755e4a8b2c | |
Monster Iestyn | 1af969d579 | |
Sryder13 | 8444379d53 | |
Sryder13 | 83da71f809 | |
Sryder13 | dcd4995eb3 | |
Monster Iestyn | f84c898040 | |
Monster Iestyn | fb182369f6 | |
Monster Iestyn | 04215b732e | |
Monster Iestyn | bc2804d383 | |
Monster Iestyn | 62ed90b252 | |
Monster Iestyn | 1638fad75e | |
Monster Iestyn | 50e8f13c03 | |
Monster Iestyn | 96b12f098b | |
Jaime Passos | c591633733 | |
Steel Titanium | bfa7325295 | |
Monster Iestyn | f5d883bd12 | |
Alam Ed Arias | ea08ba3fba | |
Alam Ed Arias | 83b8a98df4 | |
Steel Titanium | c0c1e5416f | |
Alam Ed Arias | 3edf73f181 | |
Steel Titanium | 3c08ee1313 | |
Steel Titanium | e1d025cd2b | |
Steel Titanium | eb99ad0437 | |
Monster Iestyn | 6f6d912fa6 | |
Steel Titanium | d4dac52766 | |
Steel Titanium | 34ce368895 | |
Steel Titanium | dc273d3f23 | |
Monster Iestyn | 600a373739 | |
Monster Iestyn | 2a9019c15e | |
Alam Ed Arias | addf2bb3c4 | |
Steel Titanium | 8a14427420 | |
Steel Titanium | 06961a8f5e | |
Steel Titanium | cad65ad5e9 | |
Steel Titanium | 4e0cc2505a | |
James R | 7ac0a8b4d2 | |
Monster Iestyn | f0e16cad32 | |
Monster Iestyn | 8ea9d0e95c | |
wolfy852 | 8f05d75926 | |
Monster Iestyn | 797ca99f42 | |
James R | d00cc7cddb | |
Jimita | 6e4b42fc97 | |
mazmazz | f18103a473 | |
mazmazz | 587a51a957 | |
mazmazz | a1ccb8512d | |
mazmazz | e098d6a8b8 | |
mazmazz | ba77dfd546 | |
mazmazz | b5fc27c545 | |
mazmazz | 773f9dc2ba | |
Jimita the Cat | 0186f6784b | |
Steel Titanium | 34645238d4 | |
james | 356249dade | |
Jimita | 424b2b1aaf | |
mazmazz | 2592f42a17 | |
mazmazz | 20879f1f40 | |
mazmazz | 17cde328c1 | |
mazmazz | 9ef7d2e6ba | |
mazmazz | 0834dbc194 | |
mazmazz | 97f8448b72 | |
mazmazz | abaa8730a5 | |
mazmazz | 578a4fe80d | |
Marco Z | 882355d24b | |
Marco Z | 09ed8bd046 | |
Marco Z | 88c4a54cea | |
mazmazz | ac7b29eb2d | |
mazmazz | 9b3174c4f4 | |
Jimita the Cat | c3d69a8a04 | |
Jimita the Cat | 892e650712 | |
Jimita | 8fdff96733 | |
Jimita the Cat | e765b9400c | |
mazmazz | 4d4b048ead | |
mazmazz | 78fa72514f | |
mazmazz | 0bc6b2e4d8 | |
mazmazz | be5555d393 | |
mazmazz | 75558c40a2 | |
mazmazz | 481c0d7623 | |
mazmazz | b057b2932d | |
mazmazz | 1dd47e850b | |
mazmazz | d542c2440d |
|
@ -1,3 +1,12 @@
|
|||
#Source code
|
||||
/src/*.c text=auto
|
||||
/src/*.h text=auto
|
||||
/src/*.s text=auto
|
||||
/src/*.m text=auto
|
||||
/src/*.xpm text=auto
|
||||
/src/Makefile text=auto
|
||||
/src/Make*.cfg text=auto
|
||||
/src/CMakeLists.txt text=auto
|
||||
# Windows EOL
|
||||
*.cs -crlf -whitespace
|
||||
*.mk -crlf -whitespace
|
||||
|
|
|
@ -92,8 +92,8 @@ before_build:
|
|||
- ccache -V
|
||||
- ccache -s
|
||||
- if [%NOUPX%] == [1] ( set "NOUPX=NOUPX=1" ) else ( set "NOUPX=" )
|
||||
- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 GCC72=1 NOOBJDUMP=1 %NOUPX%"
|
||||
- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1" ) else ( set "MINGW_FLAGS=MINGW=1" )
|
||||
- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 GCC73=1 NOOBJDUMP=1 %NOUPX%"
|
||||
- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1" ) else ( set "MINGW_FLAGS=MINGW=1 GCC91=1" )
|
||||
- set "SRB2_MFLAGS=%SRB2_MFLAGS% %MINGW_FLAGS% %CONFIGURATION%=1"
|
||||
|
||||
build_script:
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Platform)' == 'Win32' OR '$(Platform)' == 'x64'">
|
||||
<IncludePath>$(SolutionDir)libs\gme\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath Condition="'$(Platform)' == 'Win32'">$(SolutionDir)libs\gme\win32;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath Condition="'$(Platform)' == 'x64'">$(SolutionDir)libs\gme\win64;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' OR '$(Platform)' == 'x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>libgme.dll.a;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
</Project>
|
|
@ -7,11 +7,19 @@
|
|||
# and other things
|
||||
#
|
||||
|
||||
ifdef GCC81
|
||||
GCC80=1
|
||||
ifdef GCC91
|
||||
GCC83=1
|
||||
endif
|
||||
|
||||
ifdef GCC80
|
||||
ifdef GCC83
|
||||
GCC82=1
|
||||
endif
|
||||
|
||||
ifdef GCC82
|
||||
GCC81=1
|
||||
endif
|
||||
|
||||
ifdef GCC81
|
||||
GCC72=1
|
||||
endif
|
||||
|
||||
|
@ -146,6 +154,9 @@ ifdef GCC43
|
|||
endif
|
||||
endif
|
||||
WFLAGS+=-Wsign-compare
|
||||
ifdef GCC91
|
||||
WFLAGS+=-Wno-error=address-of-packed-member
|
||||
endif
|
||||
ifdef GCC45
|
||||
WFLAGS+=-Wlogical-op
|
||||
endif
|
||||
|
@ -186,6 +197,9 @@ ifndef GCC295
|
|||
endif
|
||||
endif
|
||||
WFLAGS+=-Wformat-y2k
|
||||
ifdef GCC71
|
||||
WFLAGS+=-Wno-error=format-overflow=2
|
||||
endif
|
||||
WFLAGS+=-Wformat-security
|
||||
ifndef GCC29
|
||||
#WFLAGS+=-Winit-self
|
||||
|
@ -220,11 +234,10 @@ ifdef GCC61
|
|||
WFLAGS+=-Wno-tautological-compare -Wno-error=tautological-compare
|
||||
endif
|
||||
ifdef GCC71
|
||||
WFLAGS+=-Wno-error=implicit-fallthrough
|
||||
WFLAGS+=-Wno-implicit-fallthrough
|
||||
WFLAGS+=-Wimplicit-fallthrough=4
|
||||
WFLAGS+=-Wno-error=format-truncation
|
||||
endif
|
||||
ifdef GCC80
|
||||
ifdef GCC81
|
||||
WFLAGS+=-Wno-error=format-overflow
|
||||
WFLAGS+=-Wno-error=stringop-truncation
|
||||
WFLAGS+=-Wno-error=stringop-overflow
|
||||
|
|
|
@ -532,7 +532,6 @@ static void COM_ExecuteString(char *ptext)
|
|||
{
|
||||
if (!stricmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase!
|
||||
{
|
||||
recursion = 0;
|
||||
cmd->function();
|
||||
return;
|
||||
}
|
||||
|
@ -544,10 +543,7 @@ static void COM_ExecuteString(char *ptext)
|
|||
if (!stricmp(com_argv[0], a->name))
|
||||
{
|
||||
if (recursion > MAX_ALIAS_RECURSION)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n"));
|
||||
recursion = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[1024];
|
||||
|
@ -581,13 +577,12 @@ static void COM_ExecuteString(char *ptext)
|
|||
|
||||
recursion++;
|
||||
COM_BufInsertText(buf);
|
||||
recursion--;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
recursion = 0;
|
||||
|
||||
// check cvars
|
||||
// Hurdler: added at Ebola's request ;)
|
||||
// (don't flood the console in software mode with bad gr_xxx command)
|
||||
|
|
|
@ -1112,17 +1112,7 @@ boolean CON_Responder(event_t *ev)
|
|||
else if (key == KEY_KPADSLASH)
|
||||
key = '/';
|
||||
|
||||
// same capslock code as hu_stuff.c's HU_responder. Check there for details.
|
||||
if ((key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z'))
|
||||
{
|
||||
if (shiftdown ^ capslock)
|
||||
key = shiftxform[key];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (shiftdown)
|
||||
key = shiftxform[key];
|
||||
}
|
||||
key = CON_ShiftChar(key);
|
||||
|
||||
// enter a char into the command prompt
|
||||
if (key < 32 || key > 127)
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "lua_script.h"
|
||||
#include "lua_hook.h"
|
||||
#include "k_kart.h"
|
||||
#include "md5.h"
|
||||
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
// cl loading screen
|
||||
|
@ -124,6 +125,9 @@ UINT8 hu_resynching = 0;
|
|||
// kart, true when a player is connecting or disconnecting so that the gameplay has stopped in its tracks
|
||||
UINT8 hu_stopped = 0;
|
||||
|
||||
UINT8 adminpassmd5[16];
|
||||
boolean adminpasswordset = false;
|
||||
|
||||
// Client specific
|
||||
static ticcmd_t localcmds;
|
||||
static ticcmd_t localcmds2;
|
||||
|
@ -1240,6 +1244,7 @@ static inline void CL_DrawConnectionStatus(void)
|
|||
case CL_ASKDOWNLOADFILES:
|
||||
case CL_WAITDOWNLOADFILESRESPONSE:
|
||||
cltext = M_GetText("Waiting to download files...");
|
||||
/* FALLTHRU */
|
||||
default:
|
||||
cltext = M_GetText("Connecting to server...");
|
||||
break;
|
||||
|
@ -4229,6 +4234,7 @@ static void HandlePacketFromPlayer(SINT8 node)
|
|||
XBOXSTATIC INT32 netconsole;
|
||||
XBOXSTATIC tic_t realend, realstart;
|
||||
XBOXSTATIC UINT8 *pak, *txtpak, numtxtpak;
|
||||
XBOXSTATIC UINT8 finalmd5[16];/* Well, it's the cool thing to do? */
|
||||
FILESTAMP
|
||||
|
||||
txtpak = NULL;
|
||||
|
@ -4477,6 +4483,32 @@ FILESTAMP
|
|||
textcmd[0] += (UINT8)netbuffer->u.textcmd[0];
|
||||
}
|
||||
break;
|
||||
case PT_LOGIN:
|
||||
if (client)
|
||||
break;
|
||||
|
||||
#ifndef NOMD5
|
||||
if (doomcom->datalength < 16)/* ignore partial sends */
|
||||
break;
|
||||
|
||||
if (!adminpasswordset)
|
||||
{
|
||||
CONS_Printf(M_GetText("Password from %s failed (no password set).\n"), player_names[netconsole]);
|
||||
break;
|
||||
}
|
||||
|
||||
// Do the final pass to compare with the sent md5
|
||||
D_MD5PasswordPass(adminpassmd5, 16, va("PNUM%02d", netconsole), &finalmd5);
|
||||
|
||||
if (!memcmp(netbuffer->u.md5sum, finalmd5, 16))
|
||||
{
|
||||
CONS_Printf(M_GetText("%s passed authentication.\n"), player_names[netconsole]);
|
||||
COM_BufInsertText(va("promote %d\n", netconsole)); // do this immediately
|
||||
}
|
||||
else
|
||||
CONS_Printf(M_GetText("Password from %s failed.\n"), player_names[netconsole]);
|
||||
#endif
|
||||
break;
|
||||
case PT_NODETIMEOUT:
|
||||
case PT_CLIENTQUIT:
|
||||
if (client)
|
||||
|
@ -5567,3 +5599,29 @@ tic_t GetLag(INT32 node)
|
|||
{
|
||||
return gametic - nettics[node];
|
||||
}
|
||||
|
||||
void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt, void *dest)
|
||||
{
|
||||
#ifdef NOMD5
|
||||
(void)buffer;
|
||||
(void)len;
|
||||
(void)salt;
|
||||
memset(dest, 0, 16);
|
||||
#else
|
||||
XBOXSTATIC char tmpbuf[256];
|
||||
const size_t sl = strlen(salt);
|
||||
|
||||
if (len > 256-sl)
|
||||
len = 256-sl;
|
||||
|
||||
memcpy(tmpbuf, buffer, len);
|
||||
memmove(&tmpbuf[len], salt, sl);
|
||||
//strcpy(&tmpbuf[len], salt);
|
||||
len += strlen(salt);
|
||||
if (len < 256)
|
||||
memset(&tmpbuf[len],0,256-len);
|
||||
|
||||
// Yes, we intentionally md5 the ENTIRE buffer regardless of size...
|
||||
md5_buffer(tmpbuf, 256, dest);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -97,6 +97,8 @@ typedef enum
|
|||
PT_TELLFILESNEEDED, // Client, to server: "what other files do I need starting from this number?"
|
||||
PT_MOREFILESNEEDED, // Server, to client: "you need these (+ more on top of those)"
|
||||
|
||||
PT_LOGIN, // Login attempt from the client.
|
||||
|
||||
PT_PING, // Packet sent to tell clients the other client's latency to server.
|
||||
NUMPACKETTYPE
|
||||
} packettype_t;
|
||||
|
@ -464,6 +466,7 @@ typedef struct
|
|||
filetx_pak filetxpak; // 139 bytes
|
||||
clientconfig_pak clientcfg; // 153 bytes
|
||||
joinchallenge_pak joinchallenge; // 17 bytes
|
||||
UINT8 md5sum[16];
|
||||
serverinfo_pak serverinfo; // 1024 bytes
|
||||
serverrefuse_pak serverrefuse; // 65025 bytes (somehow I feel like those values are garbage...)
|
||||
askinfo_pak askinfo; // 61 bytes
|
||||
|
@ -600,6 +603,11 @@ void D_ResetTiccmds(void);
|
|||
tic_t GetLag(INT32 node);
|
||||
UINT8 GetFreeXCmdSize(void);
|
||||
|
||||
void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt, void *dest);
|
||||
|
||||
extern UINT8 hu_resynching;
|
||||
extern UINT8 hu_stopped; // kart, true when the game is stopped for players due to a disconnecting or connecting player
|
||||
|
||||
extern UINT8 adminpassmd5[16];
|
||||
extern boolean adminpasswordset;
|
||||
#endif
|
||||
|
|
33
src/d_main.c
33
src/d_main.c
|
@ -180,39 +180,11 @@ void D_PostEvent_end(void) {};
|
|||
#endif
|
||||
|
||||
// modifier keys
|
||||
// Now handled in I_OsPolling
|
||||
UINT8 shiftdown = 0; // 0x1 left, 0x2 right
|
||||
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
|
||||
UINT8 altdown = 0; // 0x1 left, 0x2 right
|
||||
boolean capslock = 0; // gee i wonder what this does.
|
||||
//
|
||||
// D_ModifierKeyResponder
|
||||
// Sets global shift/ctrl/alt variables, never actually eats events
|
||||
//
|
||||
static inline void D_ModifierKeyResponder(event_t *ev)
|
||||
{
|
||||
if (ev->type == ev_keydown || ev->type == ev_console) switch (ev->data1)
|
||||
{
|
||||
case KEY_LSHIFT: shiftdown |= 0x1; return;
|
||||
case KEY_RSHIFT: shiftdown |= 0x2; return;
|
||||
case KEY_LCTRL: ctrldown |= 0x1; return;
|
||||
case KEY_RCTRL: ctrldown |= 0x2; return;
|
||||
case KEY_LALT: altdown |= 0x1; return;
|
||||
case KEY_RALT: altdown |= 0x2; return;
|
||||
case KEY_CAPSLOCK: capslock = !capslock; return;
|
||||
|
||||
default: return;
|
||||
}
|
||||
else if (ev->type == ev_keyup) switch (ev->data1)
|
||||
{
|
||||
case KEY_LSHIFT: shiftdown &= ~0x1; return;
|
||||
case KEY_RSHIFT: shiftdown &= ~0x2; return;
|
||||
case KEY_LCTRL: ctrldown &= ~0x1; return;
|
||||
case KEY_RCTRL: ctrldown &= ~0x2; return;
|
||||
case KEY_LALT: altdown &= ~0x1; return;
|
||||
case KEY_RALT: altdown &= ~0x2; return;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// D_ProcessEvents
|
||||
|
@ -226,9 +198,6 @@ void D_ProcessEvents(void)
|
|||
{
|
||||
ev = &events[eventtail];
|
||||
|
||||
// Set global shift/ctrl/alt down variables
|
||||
D_ModifierKeyResponder(ev); // never eats events
|
||||
|
||||
// Screenshots over everything so that they can be taken anywhere.
|
||||
if (M_ScreenshotResponder(ev))
|
||||
continue; // ate the event
|
||||
|
|
|
@ -34,13 +34,13 @@
|
|||
#include "p_spec.h"
|
||||
#include "m_cheat.h"
|
||||
#include "d_clisrv.h"
|
||||
#include "d_net.h"
|
||||
#include "v_video.h"
|
||||
#include "d_main.h"
|
||||
#include "m_random.h"
|
||||
#include "f_finale.h"
|
||||
#include "filesrch.h"
|
||||
#include "mserv.h"
|
||||
#include "md5.h"
|
||||
#include "z_zone.h"
|
||||
#include "lua_script.h"
|
||||
#include "lua_hook.h"
|
||||
|
@ -48,6 +48,7 @@
|
|||
#include "m_anigif.h"
|
||||
#include "k_kart.h" // SRB2kart
|
||||
#include "y_inter.h"
|
||||
#include "md5.h"
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
#define CV_RESTRICT CV_NETVAR
|
||||
|
@ -167,7 +168,6 @@ static void Command_Clearscores_f(void);
|
|||
// Remote Administration
|
||||
static void Command_Changepassword_f(void);
|
||||
static void Command_Login_f(void);
|
||||
static void Got_Login(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Verification(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Removal(UINT8 **cp, INT32 playernum);
|
||||
static void Command_Verify_f(void);
|
||||
|
@ -557,7 +557,6 @@ void D_RegisterServerCommands(void)
|
|||
CV_RegisterVar(&cv_dummyjoinpassword);
|
||||
COM_AddCommand("joinpassword", Command_ChangeJoinPassword_f);
|
||||
COM_AddCommand("password", Command_Changepassword_f);
|
||||
RegisterNetXCmd(XD_LOGIN, Got_Login);
|
||||
COM_AddCommand("login", Command_Login_f); // useful in dedicated to kick off remote admin
|
||||
COM_AddCommand("promote", Command_Verify_f);
|
||||
RegisterNetXCmd(XD_VERIFIED, Got_Verification);
|
||||
|
@ -3666,36 +3665,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
// Attempts to make password system a little sane without
|
||||
// rewriting the entire goddamn XD_file system
|
||||
//
|
||||
#include "md5.h"
|
||||
static void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt, void *dest)
|
||||
{
|
||||
#ifdef NOMD5
|
||||
(void)buffer;
|
||||
(void)len;
|
||||
(void)salt;
|
||||
memset(dest, 0, 16);
|
||||
#else
|
||||
XBOXSTATIC char tmpbuf[256];
|
||||
const size_t sl = strlen(salt);
|
||||
|
||||
if (len > 256-sl)
|
||||
len = 256-sl;
|
||||
|
||||
memcpy(tmpbuf, buffer, len);
|
||||
memmove(&tmpbuf[len], salt, sl);
|
||||
//strcpy(&tmpbuf[len], salt);
|
||||
len += strlen(salt);
|
||||
if (len < 256)
|
||||
memset(&tmpbuf[len],0,256-len);
|
||||
|
||||
// Yes, we intentionally md5 the ENTIRE buffer regardless of size...
|
||||
md5_buffer(tmpbuf, 256, dest);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define BASESALT "basepasswordstorage"
|
||||
static UINT8 adminpassmd5[MD5_LEN];
|
||||
static boolean adminpasswordset = false;
|
||||
|
||||
void D_SetPassword(const char *pw)
|
||||
{
|
||||
|
@ -3733,7 +3703,6 @@ static void Command_Login_f(void)
|
|||
// If we have no MD5 support then completely disable XD_LOGIN responses for security.
|
||||
CONS_Alert(CONS_NOTICE, "Remote administration commands are not supported in this build.\n");
|
||||
#else
|
||||
XBOXSTATIC UINT8 finalmd5[MD5_LEN];
|
||||
const char *pw;
|
||||
|
||||
if (!netgame)
|
||||
|
@ -3753,47 +3722,15 @@ static void Command_Login_f(void)
|
|||
pw = COM_Argv(1);
|
||||
|
||||
// Do the base pass to get what the server has (or should?)
|
||||
D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &finalmd5);
|
||||
D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &netbuffer->u.md5sum);
|
||||
|
||||
// Do the final pass to get the comparison the server will come up with
|
||||
D_MD5PasswordPass(finalmd5, MD5_LEN, va("PNUM%02d", consoleplayer), &finalmd5);
|
||||
D_MD5PasswordPass(netbuffer->u.md5sum, 16, va("PNUM%02d", consoleplayer), &netbuffer->u.md5sum);
|
||||
|
||||
CONS_Printf(M_GetText("Sending login... (Notice only given if password is correct.)\n"));
|
||||
|
||||
SendNetXCmd(XD_LOGIN, finalmd5, MD5_LEN);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Got_Login(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
#ifdef NOMD5
|
||||
// If we have no MD5 support then completely disable XD_LOGIN responses for security.
|
||||
(void)cp;
|
||||
(void)playernum;
|
||||
#else
|
||||
UINT8 sentmd5[MD5_LEN], finalmd5[MD5_LEN];
|
||||
|
||||
READMEM(*cp, sentmd5, MD5_LEN);
|
||||
|
||||
if (client)
|
||||
return;
|
||||
|
||||
if (!adminpasswordset)
|
||||
{
|
||||
CONS_Printf(M_GetText("Password from %s failed (no password set).\n"), player_names[playernum]);
|
||||
return;
|
||||
}
|
||||
|
||||
// Do the final pass to compare with the sent md5
|
||||
D_MD5PasswordPass(adminpassmd5, MD5_LEN, va("PNUM%02d", playernum), &finalmd5);
|
||||
|
||||
if (!memcmp(sentmd5, finalmd5, MD5_LEN))
|
||||
{
|
||||
CONS_Printf(M_GetText("%s passed authentication.\n"), player_names[playernum]);
|
||||
COM_BufInsertText(va("promote %d\n", playernum)); // do this immediately
|
||||
}
|
||||
else
|
||||
CONS_Printf(M_GetText("Password from %s failed.\n"), player_names[playernum]);
|
||||
netbuffer->packettype = PT_LOGIN;
|
||||
HSendPacket(servernode, true, 0, 16);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -165,8 +165,8 @@ typedef enum
|
|||
XD_ADDPLAYER, // 10
|
||||
XD_TEAMCHANGE, // 11
|
||||
XD_CLEARSCORES, // 12
|
||||
XD_LOGIN, // 13
|
||||
XD_VERIFIED, // 14
|
||||
// UNUSED 13 (Because I don't want to change these comments)
|
||||
XD_VERIFIED = 14,//14
|
||||
XD_RANDOMSEED, // 15
|
||||
XD_RUNSOC, // 16
|
||||
XD_REQADDFILE, // 17
|
||||
|
|
|
@ -772,9 +772,12 @@ void Got_Filetxpak(void)
|
|||
{
|
||||
INT32 filenum = netbuffer->u.filetxpak.fileid;
|
||||
fileneeded_t *file = &fileneeded[filenum];
|
||||
char *filename = file->filename;
|
||||
char *filename;
|
||||
static INT32 filetime = 0;
|
||||
|
||||
filename = va("%s", file->filename);
|
||||
nameonly(filename);
|
||||
|
||||
if (!(strcmp(filename, "srb2.srb")
|
||||
&& strcmp(filename, "srb2.wad")
|
||||
&& strcmp(filename, "patch.dta")
|
||||
|
@ -789,6 +792,8 @@ void Got_Filetxpak(void)
|
|||
))
|
||||
I_Error("Tried to download \"%s\"", filename);
|
||||
|
||||
filename = file->filename;
|
||||
|
||||
if (filenum >= fileneedednum)
|
||||
{
|
||||
DEBFILE(va("fileframent not needed %d>%d\n", filenum, fileneedednum));
|
||||
|
|
|
@ -136,6 +136,7 @@ extern UINT8 skincolor_redteam, skincolor_blueteam, skincolor_redring, skincolor
|
|||
|
||||
extern tic_t countdowntimer;
|
||||
extern boolean countdowntimeup;
|
||||
extern boolean exitfadestarted;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
12
src/g_game.c
12
src/g_game.c
|
@ -16,6 +16,7 @@
|
|||
#include "d_main.h"
|
||||
#include "d_clisrv.h"
|
||||
#include "d_player.h"
|
||||
#include "d_clisrv.h"
|
||||
#include "f_finale.h"
|
||||
#include "filesrch.h" // for refreshdirmenu
|
||||
#include "p_setup.h"
|
||||
|
@ -135,6 +136,7 @@ UINT8 skincolor_bluering = SKINCOLOR_STEEL;
|
|||
|
||||
tic_t countdowntimer = 0;
|
||||
boolean countdowntimeup = false;
|
||||
boolean exitfadestarted = false;
|
||||
|
||||
cutscene_t *cutscenes[128];
|
||||
|
||||
|
@ -1848,7 +1850,9 @@ boolean G_Responder(event_t *ev)
|
|||
|
||||
if (F_CreditResponder(ev))
|
||||
{
|
||||
F_StartGameEvaluation();
|
||||
// Skip credits for everyone
|
||||
if (!netgame || server || IsPlayerAdmin(consoleplayer))
|
||||
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3266,6 +3270,10 @@ void G_ExitLevel(void)
|
|||
|
||||
// Don't save demos immediately here! Let standings write first
|
||||
}
|
||||
else if (gamestate == GS_CREDITS)
|
||||
{
|
||||
F_StartGameEvaluation();
|
||||
}
|
||||
}
|
||||
|
||||
// See also the enum GameType in doomstat.h
|
||||
|
@ -4583,7 +4591,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
|
|||
{
|
||||
// Clear a bunch of variables
|
||||
tokenlist = token = sstimer = redscore = bluescore = lastmap = 0;
|
||||
countdown = countdown2 = mapreset = 0;
|
||||
countdown = countdown2 = mapreset = exitfadestarted = 0;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
|
|
|
@ -1196,21 +1196,24 @@ UINT8 *HWR_GetScreenshot(void)
|
|||
return buf;
|
||||
}
|
||||
|
||||
boolean HWR_Screenshot(const char *lbmname)
|
||||
boolean HWR_Screenshot(const char *pathname)
|
||||
{
|
||||
boolean ret;
|
||||
UINT8 *buf = malloc(vid.width * vid.height * 3 * sizeof (*buf));
|
||||
|
||||
if (!buf)
|
||||
{
|
||||
CONS_Debug(DBG_RENDER, "HWR_Screenshot: Failed to allocate memory\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// returns 24bit 888 RGB
|
||||
HWD.pfnReadRect(0, 0, vid.width, vid.height, vid.width * 3, (void *)buf);
|
||||
|
||||
#ifdef USE_PNG
|
||||
ret = M_SavePNG(lbmname, buf, vid.width, vid.height, NULL);
|
||||
ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL);
|
||||
#else
|
||||
ret = saveTGA(lbmname, buf, vid.width, vid.height);
|
||||
ret = saveTGA(pathname, buf, vid.width, vid.height);
|
||||
#endif
|
||||
free(buf);
|
||||
return ret;
|
||||
|
|
|
@ -38,8 +38,6 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player);
|
|||
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
|
||||
void HWR_DrawViewBorder(INT32 clearlines);
|
||||
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum);
|
||||
UINT8 *HWR_GetScreenshot(void);
|
||||
boolean HWR_Screenshot(const char *lbmname);
|
||||
void HWR_InitTextureMapping(void);
|
||||
void HWR_SetViewSize(void);
|
||||
void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option);
|
||||
|
@ -54,6 +52,9 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
|||
void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color);
|
||||
void HWR_DrawPic(INT32 x,INT32 y,lumpnum_t lumpnum);
|
||||
|
||||
UINT8 *HWR_GetScreenshot(void);
|
||||
boolean HWR_Screenshot(const char *pathname);
|
||||
|
||||
void HWR_AddCommands(void);
|
||||
void HWR_CorrectSWTricks(void);
|
||||
void transform(float *cx, float *cy, float *cz);
|
||||
|
|
|
@ -74,10 +74,10 @@ static int inet_aton(const char *cp, struct in_addr *addr)
|
|||
|
||||
#ifdef USE_WINSOCK2
|
||||
static HMODULE ipv6dll = NULL;
|
||||
typedef int (WSAAPI *p_getaddrinfo) (const char *node, const char *service,
|
||||
const struct my_addrinfo *hints,
|
||||
struct my_addrinfo **res);
|
||||
typedef void (WSAAPI *p_freeaddrinfo) (struct my_addrinfo *res);
|
||||
typedef int (WSAAPI *p_getaddrinfo) (const char *, const char *,
|
||||
const struct my_addrinfo *,
|
||||
struct my_addrinfo **);
|
||||
typedef void (WSAAPI *p_freeaddrinfo) (struct my_addrinfo *);
|
||||
|
||||
static p_getaddrinfo WS_getaddrinfo = NULL;
|
||||
static p_freeaddrinfo WS_freeaddrinfo = NULL;
|
||||
|
@ -86,10 +86,10 @@ static HMODULE WS_getfunctions(HMODULE tmp)
|
|||
{
|
||||
if (tmp != NULL)
|
||||
{
|
||||
WS_getaddrinfo = (p_getaddrinfo)((void *)GetProcAddress(tmp, "getaddrinfo"));
|
||||
WS_getaddrinfo = (p_getaddrinfo)(LPVOID)GetProcAddress(tmp, "getaddrinfo");
|
||||
if (WS_getaddrinfo == NULL)
|
||||
return NULL;
|
||||
WS_freeaddrinfo = (p_freeaddrinfo)((void *)GetProcAddress(tmp, "freeaddrinfo"));
|
||||
WS_freeaddrinfo = (p_freeaddrinfo)(LPVOID)GetProcAddress(tmp, "freeaddrinfo");
|
||||
if (WS_freeaddrinfo == NULL)
|
||||
{
|
||||
WS_getaddrinfo = NULL;
|
||||
|
|
|
@ -226,7 +226,7 @@ void A_NapalmScatter();
|
|||
void A_SpawnFreshCopy();
|
||||
|
||||
// ratio of states to sprites to mobj types is roughly 6 : 1 : 1
|
||||
#define NUMMOBJFREESLOTS 256
|
||||
#define NUMMOBJFREESLOTS 512
|
||||
#define NUMSPRITEFREESLOTS NUMMOBJFREESLOTS
|
||||
#define NUMSTATEFREESLOTS (NUMMOBJFREESLOTS*8)
|
||||
|
||||
|
|
|
@ -898,6 +898,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp
|
|||
newodds = 0;
|
||||
else
|
||||
POWERITEMODDS(newodds);
|
||||
/* FALLTHRU */
|
||||
case KITEM_HYUDORO:
|
||||
if ((hyubgone > 0) || COOLDOWNONSTART)
|
||||
newodds = 0;
|
||||
|
|
|
@ -303,6 +303,8 @@ static int lib_cvRegisterVar(lua_State *L)
|
|||
#define FIELDERROR(f, e) luaL_error(L, "bad value for " LUA_QL(f) " in table passed to " LUA_QL("CV_RegisterVar") " (%s)", e);
|
||||
#define TYPEERROR(f, t) FIELDERROR(f, va("%s expected, got %s", lua_typename(L, t), luaL_typename(L, -1)))
|
||||
|
||||
memset(cvar, 0x00, sizeof(consvar_t)); // zero everything by default
|
||||
|
||||
lua_pushnil(L);
|
||||
while (lua_next(L, 1)) {
|
||||
// stack: cvar table, cvar userdata, key/index, value
|
||||
|
@ -390,6 +392,13 @@ static int lib_cvRegisterVar(lua_State *L)
|
|||
#undef FIELDERROR
|
||||
#undef TYPEERROR
|
||||
|
||||
if (!cvar->name)
|
||||
return luaL_error(L, M_GetText("Variable has no name!\n"));
|
||||
if ((cvar->flags & CV_NOINIT) && !(cvar->flags & CV_CALL))
|
||||
return luaL_error(L, M_GetText("Variable %s has CV_NOINIT without CV_CALL\n"), cvar->name);
|
||||
if ((cvar->flags & CV_CALL) && !cvar->func)
|
||||
return luaL_error(L, M_GetText("Variable %s has CV_CALL without a function\n"), cvar->name);
|
||||
|
||||
// stack: cvar table, cvar userdata
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "CV_Vars");
|
||||
I_Assert(lua_istable(L, 3));
|
||||
|
|
|
@ -604,7 +604,7 @@ static int power_get(lua_State *L)
|
|||
UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS));
|
||||
powertype_t p = luaL_checkinteger(L, 2);
|
||||
if (p >= NUMPOWERS)
|
||||
return luaL_error(L, LUA_QL("powertype_t") " cannot be %u", p);
|
||||
return luaL_error(L, LUA_QL("powertype_t") " cannot be %d", (INT16)p);
|
||||
lua_pushinteger(L, powers[p]);
|
||||
return 1;
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ static int power_set(lua_State *L)
|
|||
powertype_t p = luaL_checkinteger(L, 2);
|
||||
UINT16 i = (UINT16)luaL_checkinteger(L, 3);
|
||||
if (p >= NUMPOWERS)
|
||||
return luaL_error(L, LUA_QL("powertype_t") " cannot be %u", p);
|
||||
return luaL_error(L, LUA_QL("powertype_t") " cannot be %d", (INT16)p);
|
||||
if (hud_running)
|
||||
return luaL_error(L, "Do not alter player_t in HUD rendering code!");
|
||||
if (hook_cmd_running)
|
||||
|
|
|
@ -206,14 +206,7 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedDiv(fixed_t a, fixed_t b)
|
|||
*/
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRem(fixed_t x, fixed_t y)
|
||||
{
|
||||
const boolean n = x < 0;
|
||||
x = abs(x);
|
||||
while (x >= y)
|
||||
x -= y;
|
||||
if (n)
|
||||
return -x;
|
||||
else
|
||||
return x;
|
||||
return x % y;
|
||||
}
|
||||
|
||||
/** \brief The FixedSqrt function
|
||||
|
|
|
@ -3751,7 +3751,7 @@ static void M_DrawGenericMenu(void)
|
|||
y += 16;
|
||||
break;
|
||||
}
|
||||
/* fallthru */
|
||||
/* FALLTHRU */
|
||||
case IT_CV_STRING:
|
||||
M_DrawTextBox(x, y + 4, MAXSTRINGLENGTH, 1);
|
||||
V_DrawString(x + 8, y + 12, V_ALLOWLOWERCASE, cv->string);
|
||||
|
@ -5340,7 +5340,7 @@ static void DrawReplayHutReplayInfo(void)
|
|||
|
||||
case MD_OUTDATED:
|
||||
V_DrawThinString(17, 64, V_SNAPTOTOP|V_ALLOWLOWERCASE|V_TRANSLUCENT|highlightflags, "Recorded on an outdated version.");
|
||||
/*fallthru*/
|
||||
/*FALLTHRU*/
|
||||
default:
|
||||
// Draw level stuff
|
||||
x = 15; y = 15;
|
||||
|
|
65
src/m_misc.c
65
src/m_misc.c
|
@ -30,6 +30,7 @@
|
|||
#include "g_game.h"
|
||||
#include "m_misc.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "st_stuff.h"
|
||||
#include "v_video.h"
|
||||
#include "z_zone.h"
|
||||
#include "g_input.h"
|
||||
|
@ -57,7 +58,7 @@ typedef off_t off64_t;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__MINGW32__) && ((__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3))
|
||||
#if defined(__MINGW32__) && ((__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3)) && (__GNUC__ < 8)
|
||||
#define PRIdS "u"
|
||||
#elif defined (_WIN32)
|
||||
#define PRIdS "Iu"
|
||||
|
@ -586,6 +587,21 @@ void M_SaveConfig(const char *filename)
|
|||
fclose(f);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// SCREENSHOTS
|
||||
// ==========================================================================
|
||||
static UINT8 screenshot_palette[768];
|
||||
static void M_CreateScreenShotPalette(void)
|
||||
{
|
||||
size_t i, j;
|
||||
for (i = 0, j = 0; i < 768; i += 3, j++)
|
||||
{
|
||||
RGBA_t locpal = pLocalPalette[(max(st_palette,0)*256)+j];
|
||||
screenshot_palette[i] = locpal.s.red;
|
||||
screenshot_palette[i+1] = locpal.s.green;
|
||||
screenshot_palette[i+2] = locpal.s.blue;
|
||||
}
|
||||
}
|
||||
|
||||
#if NUMSCREENS > 2
|
||||
static const char *Newsnapshotfile(const char *pathname, const char *ext)
|
||||
|
@ -1017,6 +1033,7 @@ static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal)
|
|||
static inline moviemode_t M_StartMovieAPNG(const char *pathname)
|
||||
{
|
||||
#ifdef USE_APNG
|
||||
UINT8 *palette = NULL;
|
||||
const char *freename = NULL;
|
||||
boolean ret = false;
|
||||
|
||||
|
@ -1033,9 +1050,12 @@ static inline moviemode_t M_StartMovieAPNG(const char *pathname)
|
|||
}
|
||||
|
||||
if (rendermode == render_soft)
|
||||
ret = M_SetupaPNG(va(pandf,pathname,freename), W_CacheLumpName(GetPalette(), PU_CACHE));
|
||||
else
|
||||
ret = M_SetupaPNG(va(pandf,pathname,freename), NULL);
|
||||
{
|
||||
M_CreateScreenShotPalette();
|
||||
palette = screenshot_palette;
|
||||
}
|
||||
|
||||
ret = M_SetupaPNG(va(pandf,pathname,freename), palette);
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
|
@ -1238,7 +1258,7 @@ void M_StopMovie(void)
|
|||
* \param data The image data.
|
||||
* \param width Width of the picture.
|
||||
* \param height Height of the picture.
|
||||
* \param palette Palette of image data
|
||||
* \param palette Palette of image data.
|
||||
* \note if palette is NULL, BGR888 format
|
||||
*/
|
||||
boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette)
|
||||
|
@ -1260,8 +1280,7 @@ boolean M_SavePNG(const char *filename, void *data, int width, int height, const
|
|||
return false;
|
||||
}
|
||||
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,
|
||||
PNG_error, PNG_warn);
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, PNG_error, PNG_warn);
|
||||
if (!png_ptr)
|
||||
{
|
||||
CONS_Debug(DBG_RENDER, "M_SavePNG: Error on initialize libpng\n");
|
||||
|
@ -1415,9 +1434,8 @@ void M_ScreenShot(void)
|
|||
}
|
||||
|
||||
/** Takes a screenshot.
|
||||
* The screenshot is saved as "kartxxxx.pcx" (or "kartxxxx.tga" in hardware
|
||||
* rendermode) where xxxx is the lowest four-digit number for which a file
|
||||
* does not already exist.
|
||||
* The screenshot is saved as "srb2xxxx.png" where xxxx is the lowest
|
||||
* four-digit number for which a file does not already exist.
|
||||
*
|
||||
* \sa HWR_ScreenShot
|
||||
*/
|
||||
|
@ -1431,6 +1449,10 @@ void M_DoScreenShot(void)
|
|||
// Don't take multiple screenshots, obviously
|
||||
takescreenshot = false;
|
||||
|
||||
// how does one take a screenshot without a render system?
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
|
||||
if (cv_screenshot_option.value == 0)
|
||||
pathname = usehome ? srb2home : srb2path;
|
||||
else if (cv_screenshot_option.value == 1)
|
||||
|
@ -1441,16 +1463,13 @@ void M_DoScreenShot(void)
|
|||
pathname = cv_screenshot_folder.string;
|
||||
|
||||
#ifdef USE_PNG
|
||||
if (rendermode != render_none)
|
||||
freename = Newsnapshotfile(pathname,"png");
|
||||
freename = Newsnapshotfile(pathname,"png");
|
||||
#else
|
||||
if (rendermode == render_soft)
|
||||
freename = Newsnapshotfile(pathname,"pcx");
|
||||
else if (rendermode != render_none)
|
||||
else if (rendermode == render_opengl)
|
||||
freename = Newsnapshotfile(pathname,"tga");
|
||||
#endif
|
||||
else
|
||||
I_Error("Can't take a screenshot without a render system");
|
||||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
|
@ -1464,18 +1483,16 @@ void M_DoScreenShot(void)
|
|||
|
||||
// save the pcx file
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft)
|
||||
if (rendermode == render_opengl)
|
||||
ret = HWR_Screenshot(va(pandf,pathname,freename));
|
||||
else
|
||||
#endif
|
||||
if (rendermode != render_none)
|
||||
{
|
||||
M_CreateScreenShotPalette();
|
||||
#ifdef USE_PNG
|
||||
ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height,
|
||||
W_CacheLumpName(GetPalette(), PU_CACHE));
|
||||
ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette);
|
||||
#else
|
||||
ret = WritePCXfile(va(pandf,pathname,freename), linear, vid.width, vid.height,
|
||||
W_CacheLumpName(GetPalette(), PU_CACHE));
|
||||
ret = WritePCXfile(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1483,14 +1500,14 @@ failure:
|
|||
if (ret)
|
||||
{
|
||||
if (moviemode != MM_SCREENSHOT)
|
||||
CONS_Printf(M_GetText("screen shot %s saved in %s\n"), freename, pathname);
|
||||
CONS_Printf(M_GetText("Screen shot %s saved in %s\n"), freename, pathname);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (freename)
|
||||
CONS_Printf(M_GetText("Couldn't create screen shot %s in %s\n"), freename, pathname);
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create screen shot %s in %s\n"), freename, pathname);
|
||||
else
|
||||
CONS_Printf(M_GetText("Couldn't create screen shot (all 10000 slots used!) in %s\n"), pathname);
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create screen shot in %s (all 10000 slots used!)\n"), pathname);
|
||||
|
||||
if (moviemode == MM_SCREENSHOT)
|
||||
M_StopMovie();
|
||||
|
|
97
src/p_map.c
97
src/p_map.c
|
@ -4050,6 +4050,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
|||
boolean P_CheckSector(sector_t *sector, boolean crunch)
|
||||
{
|
||||
msecnode_t *n;
|
||||
size_t i;
|
||||
|
||||
nofit = false;
|
||||
crushchange = crunch;
|
||||
|
@ -4064,9 +4065,57 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
|
|||
|
||||
|
||||
// First, let's see if anything will keep it from crushing.
|
||||
|
||||
// Sal: This stupid function chain is required to fix polyobjects not being able to crush.
|
||||
// Monster Iestyn: don't use P_CheckSector actually just look for objects in the blockmap instead
|
||||
validcount++;
|
||||
|
||||
for (i = 0; i < sector->linecount; i++)
|
||||
{
|
||||
if (sector->lines[i]->polyobj)
|
||||
{
|
||||
polyobj_t *po = sector->lines[i]->polyobj;
|
||||
if (po->validcount == validcount)
|
||||
continue; // skip if already checked
|
||||
if (!(po->flags & POF_SOLID))
|
||||
continue;
|
||||
if (po->lines[0]->backsector == sector) // Make sure you're currently checking the control sector
|
||||
{
|
||||
INT32 x, y;
|
||||
po->validcount = validcount;
|
||||
|
||||
for (y = po->blockbox[BOXBOTTOM]; y <= po->blockbox[BOXTOP]; ++y)
|
||||
{
|
||||
for (x = po->blockbox[BOXLEFT]; x <= po->blockbox[BOXRIGHT]; ++x)
|
||||
{
|
||||
mobj_t *mo;
|
||||
|
||||
if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
|
||||
continue;
|
||||
|
||||
mo = blocklinks[y * bmapwidth + x];
|
||||
|
||||
for (; mo; mo = mo->bnext)
|
||||
{
|
||||
// Monster Iestyn: do we need to check if a mobj has already been checked? ...probably not I suspect
|
||||
|
||||
if (!P_MobjInsidePolyobj(po, mo))
|
||||
continue;
|
||||
|
||||
if (!PIT_ChangeSector(mo, false))
|
||||
{
|
||||
nofit = true;
|
||||
return nofit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sector->numattached)
|
||||
{
|
||||
size_t i;
|
||||
sector_t *sec;
|
||||
for (i = 0; i < sector->numattached; i++)
|
||||
{
|
||||
|
@ -4126,9 +4175,53 @@ boolean P_CheckSector(sector_t *sector, boolean crunch)
|
|||
} while (n); // repeat from scratch until all things left are marked valid
|
||||
|
||||
// Nothing blocked us, so lets crush for real!
|
||||
|
||||
// Sal: This stupid function chain is required to fix polyobjects not being able to crush.
|
||||
// Monster Iestyn: don't use P_CheckSector actually just look for objects in the blockmap instead
|
||||
validcount++;
|
||||
|
||||
for (i = 0; i < sector->linecount; i++)
|
||||
{
|
||||
if (sector->lines[i]->polyobj)
|
||||
{
|
||||
polyobj_t *po = sector->lines[i]->polyobj;
|
||||
if (po->validcount == validcount)
|
||||
continue; // skip if already checked
|
||||
if (!(po->flags & POF_SOLID))
|
||||
continue;
|
||||
if (po->lines[0]->backsector == sector) // Make sure you're currently checking the control sector
|
||||
{
|
||||
INT32 x, y;
|
||||
po->validcount = validcount;
|
||||
|
||||
for (y = po->blockbox[BOXBOTTOM]; y <= po->blockbox[BOXTOP]; ++y)
|
||||
{
|
||||
for (x = po->blockbox[BOXLEFT]; x <= po->blockbox[BOXRIGHT]; ++x)
|
||||
{
|
||||
mobj_t *mo;
|
||||
|
||||
if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
|
||||
continue;
|
||||
|
||||
mo = blocklinks[y * bmapwidth + x];
|
||||
|
||||
for (; mo; mo = mo->bnext)
|
||||
{
|
||||
// Monster Iestyn: do we need to check if a mobj has already been checked? ...probably not I suspect
|
||||
|
||||
if (!P_MobjInsidePolyobj(po, mo))
|
||||
continue;
|
||||
|
||||
PIT_ChangeSector(mo, true);
|
||||
return nofit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sector->numattached)
|
||||
{
|
||||
size_t i;
|
||||
sector_t *sec;
|
||||
for (i = 0; i < sector->numattached; i++)
|
||||
{
|
||||
|
|
216
src/p_maputl.c
216
src/p_maputl.c
|
@ -418,10 +418,6 @@ void P_CameraLineOpening(line_t *linedef)
|
|||
if (front->ffloors || back->ffloors)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
fixed_t highestceiling = highceiling;
|
||||
fixed_t lowestceiling = opentop;
|
||||
fixed_t highestfloor = openbottom;
|
||||
fixed_t lowestfloor = lowfloor;
|
||||
fixed_t delta1, delta2;
|
||||
|
||||
// Check for frontsector's fake floors
|
||||
|
@ -437,15 +433,15 @@ void P_CameraLineOpening(line_t *linedef)
|
|||
|
||||
delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2)));
|
||||
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
|
||||
if (bottomheight < lowestceiling && delta1 >= delta2)
|
||||
lowestceiling = bottomheight;
|
||||
else if (bottomheight < highestceiling && delta1 >= delta2)
|
||||
highestceiling = bottomheight;
|
||||
if (bottomheight < opentop && delta1 >= delta2)
|
||||
opentop = bottomheight;
|
||||
else if (bottomheight < highceiling && delta1 >= delta2)
|
||||
highceiling = bottomheight;
|
||||
|
||||
if (topheight > highestfloor && delta1 < delta2)
|
||||
highestfloor = topheight;
|
||||
else if (topheight > lowestfloor && delta1 < delta2)
|
||||
lowestfloor = topheight;
|
||||
if (topheight > openbottom && delta1 < delta2)
|
||||
openbottom = topheight;
|
||||
else if (topheight > lowfloor && delta1 < delta2)
|
||||
lowfloor = topheight;
|
||||
}
|
||||
|
||||
// Check for backsectors fake floors
|
||||
|
@ -461,28 +457,16 @@ void P_CameraLineOpening(line_t *linedef)
|
|||
|
||||
delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2)));
|
||||
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
|
||||
if (bottomheight < lowestceiling && delta1 >= delta2)
|
||||
lowestceiling = bottomheight;
|
||||
else if (bottomheight < highestceiling && delta1 >= delta2)
|
||||
highestceiling = bottomheight;
|
||||
if (bottomheight < opentop && delta1 >= delta2)
|
||||
opentop = bottomheight;
|
||||
else if (bottomheight < highceiling && delta1 >= delta2)
|
||||
highceiling = bottomheight;
|
||||
|
||||
if (topheight > highestfloor && delta1 < delta2)
|
||||
highestfloor = topheight;
|
||||
else if (topheight > lowestfloor && delta1 < delta2)
|
||||
lowestfloor = topheight;
|
||||
if (topheight > openbottom && delta1 < delta2)
|
||||
openbottom = topheight;
|
||||
else if (topheight > lowfloor && delta1 < delta2)
|
||||
lowfloor = topheight;
|
||||
}
|
||||
|
||||
if (highestceiling < highceiling)
|
||||
highceiling = highestceiling;
|
||||
|
||||
if (highestfloor > openbottom)
|
||||
openbottom = highestfloor;
|
||||
|
||||
if (lowestceiling < opentop)
|
||||
opentop = lowestceiling;
|
||||
|
||||
if (lowestfloor > lowfloor)
|
||||
lowfloor = lowestfloor;
|
||||
}
|
||||
openrange = opentop - openbottom;
|
||||
return;
|
||||
|
@ -500,23 +484,26 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
return;
|
||||
}
|
||||
|
||||
// Treat polyobjects kind of like 3D Floors
|
||||
#ifdef POLYOBJECTS
|
||||
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT))
|
||||
{
|
||||
front = linedef->frontsector;
|
||||
back = linedef->frontsector;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
front = linedef->frontsector;
|
||||
back = linedef->backsector;
|
||||
}
|
||||
front = linedef->frontsector;
|
||||
back = linedef->backsector;
|
||||
|
||||
I_Assert(front != NULL);
|
||||
I_Assert(back != NULL);
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
if (linedef->polyobj)
|
||||
{
|
||||
// set these defaults so that polyobjects don't interfere with collision above or below them
|
||||
opentop = INT32_MAX;
|
||||
openbottom = INT32_MIN;
|
||||
highceiling = INT32_MIN;
|
||||
lowfloor = INT32_MAX;
|
||||
#ifdef ESLOPE
|
||||
opentopslope = openbottomslope = NULL;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{ // Set open and high/low values here
|
||||
fixed_t frontheight, backheight;
|
||||
|
||||
|
@ -622,25 +609,49 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for fake floors in the sector.
|
||||
if (front->ffloors || back->ffloors
|
||||
#ifdef POLYOBJECTS
|
||||
|| linedef->polyobj
|
||||
if (linedef->polyobj)
|
||||
{
|
||||
// Treat polyobj's backsector like a 3D Floor
|
||||
if (linedef->polyobj->flags & POF_TESTHEIGHT)
|
||||
{
|
||||
const sector_t *polysec = linedef->backsector;
|
||||
fixed_t polytop, polybottom;
|
||||
fixed_t delta1, delta2;
|
||||
|
||||
if (linedef->polyobj->flags & POF_CLIPPLANES)
|
||||
{
|
||||
polytop = polysec->ceilingheight;
|
||||
polybottom = polysec->floorheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
polytop = INT32_MAX;
|
||||
polybottom = INT32_MIN;
|
||||
}
|
||||
|
||||
delta1 = abs(mobj->z - (polybottom + ((polytop - polybottom)/2)));
|
||||
delta2 = abs(thingtop - (polybottom + ((polytop - polybottom)/2)));
|
||||
|
||||
if (polybottom < opentop && delta1 >= delta2)
|
||||
opentop = polybottom;
|
||||
else if (polybottom < highceiling && delta1 >= delta2)
|
||||
highceiling = polybottom;
|
||||
|
||||
if (polytop > openbottom && delta1 < delta2)
|
||||
openbottom = polytop;
|
||||
else if (polytop > lowfloor && delta1 < delta2)
|
||||
lowfloor = polytop;
|
||||
}
|
||||
// otherwise don't do anything special, pretend there's nothing else there
|
||||
}
|
||||
else
|
||||
#endif
|
||||
)
|
||||
// Check for fake floors in the sector.
|
||||
if (front->ffloors || back->ffloors)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
|
||||
fixed_t highestceiling = highceiling;
|
||||
fixed_t lowestceiling = opentop;
|
||||
fixed_t highestfloor = openbottom;
|
||||
fixed_t lowestfloor = lowfloor;
|
||||
fixed_t delta1, delta2;
|
||||
#ifdef ESLOPE
|
||||
pslope_t *ceilingslope = opentopslope;
|
||||
pslope_t *floorslope = openbottomslope;
|
||||
#endif
|
||||
|
||||
// Check for frontsector's fake floors
|
||||
for (rover = front->ffloors; rover; rover = rover->next)
|
||||
|
@ -663,26 +674,26 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
|
||||
if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF
|
||||
{
|
||||
if (bottomheight < lowestceiling) {
|
||||
lowestceiling = bottomheight;
|
||||
if (bottomheight < opentop) {
|
||||
opentop = bottomheight;
|
||||
#ifdef ESLOPE
|
||||
ceilingslope = *rover->b_slope;
|
||||
opentopslope = *rover->b_slope;
|
||||
#endif
|
||||
}
|
||||
else if (bottomheight < highestceiling)
|
||||
highestceiling = bottomheight;
|
||||
else if (bottomheight < highceiling)
|
||||
highceiling = bottomheight;
|
||||
}
|
||||
|
||||
if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF
|
||||
{
|
||||
if (topheight > highestfloor) {
|
||||
highestfloor = topheight;
|
||||
if (topheight > openbottom) {
|
||||
openbottom = topheight;
|
||||
#ifdef ESLOPE
|
||||
floorslope = *rover->t_slope;
|
||||
openbottomslope = *rover->t_slope;
|
||||
#endif
|
||||
}
|
||||
else if (topheight > lowestfloor)
|
||||
lowestfloor = topheight;
|
||||
else if (topheight > lowfloor)
|
||||
lowfloor = topheight;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -707,75 +718,28 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
|
||||
if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF
|
||||
{
|
||||
if (bottomheight < lowestceiling) {
|
||||
lowestceiling = bottomheight;
|
||||
if (bottomheight < opentop) {
|
||||
opentop = bottomheight;
|
||||
#ifdef ESLOPE
|
||||
ceilingslope = *rover->b_slope;
|
||||
opentopslope = *rover->b_slope;
|
||||
#endif
|
||||
}
|
||||
else if (bottomheight < highestceiling)
|
||||
highestceiling = bottomheight;
|
||||
else if (bottomheight < highceiling)
|
||||
highceiling = bottomheight;
|
||||
}
|
||||
|
||||
if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF
|
||||
{
|
||||
if (topheight > highestfloor) {
|
||||
highestfloor = topheight;
|
||||
if (topheight > openbottom) {
|
||||
openbottom = topheight;
|
||||
#ifdef ESLOPE
|
||||
floorslope = *rover->t_slope;
|
||||
openbottomslope = *rover->t_slope;
|
||||
#endif
|
||||
}
|
||||
else if (topheight > lowestfloor)
|
||||
lowestfloor = topheight;
|
||||
else if (topheight > lowfloor)
|
||||
lowfloor = topheight;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// Treat polyobj's backsector like a 3D Floor
|
||||
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT))
|
||||
{
|
||||
const sector_t *polysec = linedef->backsector;
|
||||
|
||||
delta1 = abs(mobj->z - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2)));
|
||||
delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2)));
|
||||
if (polysec->floorheight < lowestceiling && delta1 >= delta2) {
|
||||
lowestceiling = polysec->floorheight;
|
||||
#ifdef ESLOPE
|
||||
ceilingslope = NULL;
|
||||
#endif
|
||||
}
|
||||
else if (polysec->floorheight < highestceiling && delta1 >= delta2)
|
||||
highestceiling = polysec->floorheight;
|
||||
|
||||
if (polysec->ceilingheight > highestfloor && delta1 < delta2) {
|
||||
highestfloor = polysec->ceilingheight;
|
||||
#ifdef ESLOPE
|
||||
floorslope = NULL;
|
||||
#endif
|
||||
}
|
||||
else if (polysec->ceilingheight > lowestfloor && delta1 < delta2)
|
||||
lowestfloor = polysec->ceilingheight;
|
||||
}
|
||||
#endif
|
||||
if (highestceiling < highceiling)
|
||||
highceiling = highestceiling;
|
||||
|
||||
if (highestfloor > openbottom) {
|
||||
openbottom = highestfloor;
|
||||
#ifdef ESLOPE
|
||||
openbottomslope = floorslope;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (lowestceiling < opentop) {
|
||||
opentop = lowestceiling;
|
||||
#ifdef ESLOPE
|
||||
opentopslope = ceilingslope;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (lowestfloor > lowfloor)
|
||||
lowfloor = lowestfloor;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6083,7 +6083,7 @@ void P_RunOverlays(void)
|
|||
{
|
||||
angle_t viewingangle;
|
||||
|
||||
if (players[displayplayers[0]].awayviewtics)
|
||||
if (players[displayplayers[0]].awayviewtics && players[displayplayers[0]].awayviewmobj != NULL && !P_MobjWasRemoved(players[displayplayers[0]].awayviewmobj))
|
||||
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayers[0]].awayviewmobj->x, players[displayplayers[0]].awayviewmobj->y);
|
||||
else if (!camera[0].chase && players[displayplayers[0]].mo)
|
||||
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y);
|
||||
|
@ -7302,7 +7302,7 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
P_RemoveMobj(mobj);
|
||||
return;
|
||||
}
|
||||
// fallthru
|
||||
// FALLTHRU
|
||||
case MT_ORBINAUT_SHIELD:
|
||||
case MT_BANANA_SHIELD:
|
||||
case MT_EGGMANITEM_SHIELD:
|
||||
|
@ -7312,7 +7312,7 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
case MT_JAWZ_DUD:
|
||||
if (P_IsObjectOnGround(mobj))
|
||||
P_SetMobjState(mobj, mobj->info->xdeathstate);
|
||||
// fallthru
|
||||
// FALLTHRU
|
||||
case MT_JAWZ_SHIELD:
|
||||
mobj->flags2 ^= MF2_DONTDRAW;
|
||||
break;
|
||||
|
|
|
@ -1864,7 +1864,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
po->lines[0]->backsector->floorheight = target->z - amtz;
|
||||
po->lines[0]->backsector->ceilingheight = target->z + amtz;
|
||||
// Sal: Remember to check your sectors!
|
||||
P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage));
|
||||
// Monster Iestyn: we only need to bother with the back sector, now that P_CheckSector automatically checks the blockmap
|
||||
// updating objects in the front one too just added teleporting to ground bugs
|
||||
P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage));
|
||||
// Apply action to mirroring polyobjects as well
|
||||
start = 0;
|
||||
|
@ -1878,7 +1879,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
po->lines[0]->backsector->floorheight += diffz; // move up/down by same amount as the parent did
|
||||
po->lines[0]->backsector->ceilingheight += diffz;
|
||||
// Sal: Remember to check your sectors!
|
||||
P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage));
|
||||
// Monster Iestyn: we only need to bother with the back sector, now that P_CheckSector automatically checks the blockmap
|
||||
// updating objects in the front one too just added teleporting to ground bugs
|
||||
P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage));
|
||||
}
|
||||
|
||||
|
@ -2041,8 +2043,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
po->lines[0]->backsector->floorheight += momz;
|
||||
po->lines[0]->backsector->ceilingheight += momz;
|
||||
// Sal: Remember to check your sectors!
|
||||
P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); // frontsector is NEEDED for crushing
|
||||
P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); // backsector may not be necessary, but just in case
|
||||
// Monster Iestyn: we only need to bother with the back sector, now that P_CheckSector automatically checks the blockmap
|
||||
// updating objects in the front one too just added teleporting to ground bugs
|
||||
P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage));
|
||||
|
||||
// Apply action to mirroring polyobjects as well
|
||||
start = 0;
|
||||
|
@ -2056,7 +2059,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
po->lines[0]->backsector->floorheight += momz;
|
||||
po->lines[0]->backsector->ceilingheight += momz;
|
||||
// Sal: Remember to check your sectors!
|
||||
P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage));
|
||||
// Monster Iestyn: we only need to bother with the back sector, now that P_CheckSector automatically checks the blockmap
|
||||
// updating objects in the front one too just added teleporting to ground bugs
|
||||
P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1468,7 +1468,6 @@ static void P_LoadRawSideDefs2(void *data)
|
|||
else
|
||||
sd->bottomtexture = num;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifdef HWRENDER
|
||||
else
|
||||
|
@ -1541,9 +1540,9 @@ static void P_LoadRawSideDefs2(void *data)
|
|||
else
|
||||
sd->bottomtexture = num;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 413: // Change music
|
||||
{
|
||||
|
@ -2344,7 +2343,7 @@ static void P_LevelInitStuff(void)
|
|||
players[i].lives = 1; // SRB2Kart
|
||||
#endif
|
||||
|
||||
players[i].realtime = countdown = countdown2 = 0;
|
||||
players[i].realtime = countdown = countdown2 = exitfadestarted = 0;
|
||||
curlap = bestlap = 0; // SRB2Kart
|
||||
|
||||
players[i].gotcontinue = false;
|
||||
|
|
|
@ -584,23 +584,28 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
|
|||
//
|
||||
void P_CopySectorSlope(line_t *line)
|
||||
{
|
||||
sector_t *fsec = line->frontsector;
|
||||
int i, special = line->special;
|
||||
sector_t *fsec = line->frontsector;
|
||||
int i, special = line->special;
|
||||
|
||||
// Check for copy linedefs
|
||||
for(i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;)
|
||||
{
|
||||
sector_t *srcsec = sectors + i;
|
||||
// Check for copy linedefs
|
||||
for (i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;)
|
||||
{
|
||||
sector_t *srcsec = sectors + i;
|
||||
|
||||
if((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope)
|
||||
fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope);
|
||||
if((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope)
|
||||
fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope);
|
||||
}
|
||||
if ((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope)
|
||||
fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope);
|
||||
if ((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope)
|
||||
fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope);
|
||||
}
|
||||
|
||||
fsec->hasslope = true;
|
||||
fsec->hasslope = true;
|
||||
|
||||
line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef
|
||||
// if this is an FOF control sector, make sure any target sectors also are marked as having slopes
|
||||
if (fsec->numattached)
|
||||
for (i = 0; i < (int)fsec->numattached; i++)
|
||||
sectors[fsec->attached[i]].hasslope = true;
|
||||
|
||||
line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -5130,6 +5130,10 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
|||
// Add slopes
|
||||
ffloor->t_slope = &sec2->c_slope;
|
||||
ffloor->b_slope = &sec2->f_slope;
|
||||
// mark the target sector as having slopes, if the FOF has any of its own
|
||||
// (this fixes FOF slopes glitching initially at level load in software mode)
|
||||
if (sec2->hasslope)
|
||||
sec->hasslope = true;
|
||||
#endif
|
||||
|
||||
if ((flags & FF_SOLID) && (master->flags & ML_EFFECT1)) // Block player only
|
||||
|
|
53
src/p_user.c
53
src/p_user.c
|
@ -8139,14 +8139,8 @@ void P_PlayerThink(player_t *player)
|
|||
if (player->flashcount)
|
||||
player->flashcount--;
|
||||
|
||||
// Re-fixed by Jimita (11-12-2018)
|
||||
if (player->awayviewtics)
|
||||
{
|
||||
if (player->awayviewtics && player->awayviewtics != -1)
|
||||
player->awayviewtics--;
|
||||
if (!player->awayviewtics)
|
||||
player->awayviewtics = -1;
|
||||
// The timer might've reached zero, but we'll run the remote view camera anyway by setting it to -1.
|
||||
}
|
||||
|
||||
/// \note do this in the cheat code
|
||||
if (player->pflags & PF_NOCLIP)
|
||||
|
@ -8226,6 +8220,48 @@ void P_PlayerThink(player_t *player)
|
|||
if (player->exiting && countdown2)
|
||||
player->exiting = 99; // SRB2kart
|
||||
|
||||
// The following code is disabled for now as this causes the game to freeze sometimes
|
||||
// Monster Iestyn -- 16/08/19
|
||||
#if 0
|
||||
// Same check as below, just at 1 second before
|
||||
// so we can fade music
|
||||
if (!exitfadestarted &&
|
||||
player->exiting > 0 && player->exiting <= 1*TICRATE &&
|
||||
(!multiplayer || gametype == GT_COOP ? !mapheaderinfo[gamemap-1]->musinterfadeout : true) &&
|
||||
// don't fade if we're fading during intermission. follows Y_StartIntermission intertype = int_coop
|
||||
(gametype == GT_RACE || gametype == GT_COMPETITION ? countdown2 == 0 : true) && // don't fade on timeout
|
||||
player->lives > 0 && // don't fade on game over (competition)
|
||||
P_IsLocalPlayer(player))
|
||||
{
|
||||
if (cv_playersforexit.value)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator || players[i].bot)
|
||||
continue;
|
||||
if (players[i].lives <= 0)
|
||||
continue;
|
||||
|
||||
if (!players[i].exiting || players[i].exiting > 1*TICRATE)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == MAXPLAYERS)
|
||||
{
|
||||
exitfadestarted = true;
|
||||
S_FadeOutStopMusic(1*MUSICRATE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
exitfadestarted = true;
|
||||
S_FadeOutStopMusic(1*MUSICRATE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (player->exiting == 2 || countdown2 == 2)
|
||||
{
|
||||
if (cv_playersforexit.value) // Count to be sure everyone's exited
|
||||
|
@ -8979,9 +9015,6 @@ void P_PlayerAfterThink(player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
if (player->awayviewtics < 0)
|
||||
player->awayviewtics = 0;
|
||||
|
||||
// spectator invisibility and nogravity.
|
||||
if ((netgame || multiplayer) && player->spectator)
|
||||
{
|
||||
|
|
126
src/r_data.c
126
src/r_data.c
|
@ -408,16 +408,7 @@ void R_LoadTextures(void)
|
|||
// but the alternative is to spend a ton of time checking and re-checking all previous entries just to skip any potentially patched textures.
|
||||
for (w = 0, numtextures = 0; w < numwadfiles; w++)
|
||||
{
|
||||
if (wadfiles[w]->type == RET_PK3)
|
||||
{
|
||||
texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
|
||||
texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart);
|
||||
}
|
||||
else
|
||||
{
|
||||
texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1;
|
||||
texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
|
||||
}
|
||||
// Count the textures from TEXTURES lumps
|
||||
|
||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
||||
while (texturesLumpPos != INT16_MAX)
|
||||
|
@ -426,19 +417,43 @@ void R_LoadTextures(void)
|
|||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1);
|
||||
}
|
||||
|
||||
// Add all the textures between TX_START and TX_END
|
||||
if (texstart != INT16_MAX && texend != INT16_MAX)
|
||||
// Count single-patch textures
|
||||
|
||||
if (wadfiles[w]->type == RET_PK3)
|
||||
{
|
||||
texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
|
||||
texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart);
|
||||
}
|
||||
else
|
||||
{
|
||||
texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0);
|
||||
texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
|
||||
}
|
||||
|
||||
if (texstart == INT16_MAX || texend == INT16_MAX)
|
||||
continue;
|
||||
|
||||
texstart++; // Do not count the first marker
|
||||
|
||||
// PK3s have subfolders, so we can't just make a simple sum
|
||||
if (wadfiles[w]->type == RET_PK3)
|
||||
{
|
||||
for (j = texstart; j < texend; j++)
|
||||
{
|
||||
if (!W_IsLumpFolder((UINT16)w, j)) // Check if lump is a folder; if not, then count it
|
||||
numtextures++;
|
||||
}
|
||||
}
|
||||
else // Add all the textures between TX_START and TX_END
|
||||
{
|
||||
numtextures += (UINT32)(texend - texstart);
|
||||
}
|
||||
|
||||
// If no textures found by this point, bomb out
|
||||
if (!numtextures && w == (numwadfiles - 1))
|
||||
{
|
||||
I_Error("No textures detected in any WADs!\n");
|
||||
}
|
||||
}
|
||||
|
||||
// If no textures found by this point, bomb out
|
||||
if (!numtextures)
|
||||
I_Error("No textures detected in any WADs!\n");
|
||||
|
||||
// Allocate memory and initialize to 0 for all the textures we are initialising.
|
||||
// There are actually 5 buffers allocated in one for convenience.
|
||||
textures = Z_Calloc((numtextures * sizeof(void *)) * 5, PU_STATIC, NULL);
|
||||
|
@ -473,7 +488,7 @@ void R_LoadTextures(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1;
|
||||
texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0);
|
||||
texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
|
||||
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
|
||||
if (texturesLumpPos != INT16_MAX)
|
||||
|
@ -483,47 +498,43 @@ void R_LoadTextures(void)
|
|||
if (texstart == INT16_MAX || texend == INT16_MAX)
|
||||
continue;
|
||||
|
||||
texstart++; // Do not count the first marker
|
||||
|
||||
// Work through each lump between the markers in the WAD.
|
||||
for (j = 0; j < (texend - texstart); i++, j++)
|
||||
for (j = 0; j < (texend - texstart); j++)
|
||||
{
|
||||
if (wadfiles[w]->type == RET_PK3)
|
||||
{
|
||||
if (W_IsLumpFolder((UINT16)w, texstart + j)) // Check if lump is a folder
|
||||
continue; // If it is then SKIP IT
|
||||
}
|
||||
patchlump = W_CacheLumpNumPwad((UINT16)w, texstart + j, PU_CACHE);
|
||||
|
||||
// Then, check the lump directly to see if it's a texture SOC,
|
||||
// and if it is, load it using dehacked instead.
|
||||
if (strstr((const char *)patchlump, "TEXTURE"))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "%s is a Texture SOC.\n", W_CheckNameForNumPwad((UINT16)w,texstart+j));
|
||||
Z_Unlock(patchlump);
|
||||
DEH_LoadDehackedLumpPwad((UINT16)w, texstart + j);
|
||||
}
|
||||
else
|
||||
{
|
||||
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height);
|
||||
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height);
|
||||
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||
|
||||
// Set texture properties.
|
||||
M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name));
|
||||
texture->width = SHORT(patchlump->width);
|
||||
texture->height = SHORT(patchlump->height);
|
||||
texture->patchcount = 1;
|
||||
texture->holes = false;
|
||||
// Set texture properties.
|
||||
M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name));
|
||||
texture->width = SHORT(patchlump->width);
|
||||
texture->height = SHORT(patchlump->height);
|
||||
texture->patchcount = 1;
|
||||
texture->holes = false;
|
||||
|
||||
// Allocate information for the texture's patches.
|
||||
patch = &texture->patches[0];
|
||||
// Allocate information for the texture's patches.
|
||||
patch = &texture->patches[0];
|
||||
|
||||
patch->originx = patch->originy = 0;
|
||||
patch->wad = (UINT16)w;
|
||||
patch->lump = texstart + j;
|
||||
patch->originx = patch->originy = 0;
|
||||
patch->wad = (UINT16)w;
|
||||
patch->lump = texstart + j;
|
||||
|
||||
Z_Unlock(patchlump);
|
||||
Z_Unlock(patchlump);
|
||||
|
||||
k = 1;
|
||||
while (k << 1 <= texture->width)
|
||||
k <<= 1;
|
||||
|
||||
texturewidthmask[i] = k - 1;
|
||||
textureheight[i] = texture->height << FRACBITS;
|
||||
}
|
||||
k = 1;
|
||||
while (k << 1 <= texture->width)
|
||||
k <<= 1;
|
||||
texturewidthmask[i] = k - 1;
|
||||
textureheight[i] = texture->height << FRACBITS;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1076,6 +1087,7 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap)
|
|||
{
|
||||
char colormap[9] = "COLORMAP";
|
||||
lumpnum_t lump;
|
||||
const lumpnum_t basecolormaplump = W_GetNumForName(colormap);
|
||||
|
||||
if (num > 0 && num <= 10000)
|
||||
snprintf(colormap, 8, "CLM%04u", num-1);
|
||||
|
@ -1083,8 +1095,16 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap)
|
|||
// Load in the light tables, now 64k aligned for smokie...
|
||||
lump = W_GetNumForName(colormap);
|
||||
if (lump == LUMPERROR)
|
||||
lump = W_GetNumForName("COLORMAP");
|
||||
W_ReadLump(lump, colormaps);
|
||||
lump = basecolormaplump;
|
||||
else
|
||||
{
|
||||
if (W_LumpLength(lump) != W_LumpLength(basecolormaplump))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "%s lump size does not match COLORMAP, results may be unexpected.\n", colormap);
|
||||
}
|
||||
}
|
||||
|
||||
W_ReadLumpHeader(lump, colormaps, W_LumpLength(basecolormaplump), 0U);
|
||||
|
||||
// Encore mode.
|
||||
if (newencoremap != LUMPERROR)
|
||||
|
|
|
@ -93,6 +93,7 @@
|
|||
<Import Project="..\..\libs\libpng.props" />
|
||||
<Import Project="..\..\libs\SDL2.props" />
|
||||
<Import Project="..\..\libs\SDL_mixer.props" />
|
||||
<Import Project="..\..\libs\libgme.props" />
|
||||
<Import Project="Srb2SDL.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
<PropertyGroup />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;SDLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<!-- x86/x64 defines: has specific libraries that ARM does not -->
|
||||
<PreprocessorDefinitions Condition="'$(Platform)' == 'Win32' OR '$(Platform)' == 'x64'">HAVE_ZLIB;HAVE_LIBGME;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;SDLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<!-- ARM defines -->
|
||||
<PreprocessorDefinitions Condition="'$(Platform)' != 'Win32' AND '$(Platform)' != 'x64'">USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;SDLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
|
|
|
@ -547,7 +547,7 @@ static void Impl_HandleKeyboardConsoleEvent(KEY_EVENT_RECORD evt, HANDLE co)
|
|||
break;
|
||||
case VK_RETURN:
|
||||
entering_con_command = false;
|
||||
// Fall through.
|
||||
/* FALLTHRU */
|
||||
default:
|
||||
event.data1 = MapVirtualKey(evt.wVirtualKeyCode,2); // convert in to char
|
||||
}
|
||||
|
@ -2960,7 +2960,7 @@ static void I_ShutdownTimer(void)
|
|||
pfntimeGetTime = NULL;
|
||||
if (winmm)
|
||||
{
|
||||
p_timeEndPeriod pfntimeEndPeriod = (p_timeEndPeriod)GetProcAddress(winmm, "timeEndPeriod");
|
||||
p_timeEndPeriod pfntimeEndPeriod = (p_timeEndPeriod)(LPVOID)GetProcAddress(winmm, "timeEndPeriod");
|
||||
if (pfntimeEndPeriod)
|
||||
pfntimeEndPeriod(1);
|
||||
FreeLibrary(winmm);
|
||||
|
@ -3005,10 +3005,10 @@ void I_StartupTimer(void)
|
|||
winmm = LoadLibraryA("winmm.dll");
|
||||
if (winmm)
|
||||
{
|
||||
p_timeEndPeriod pfntimeBeginPeriod = (p_timeEndPeriod)GetProcAddress(winmm, "timeBeginPeriod");
|
||||
p_timeEndPeriod pfntimeBeginPeriod = (p_timeEndPeriod)(LPVOID)GetProcAddress(winmm, "timeBeginPeriod");
|
||||
if (pfntimeBeginPeriod)
|
||||
pfntimeBeginPeriod(1);
|
||||
pfntimeGetTime = (p_timeGetTime)GetProcAddress(winmm, "timeGetTime");
|
||||
pfntimeGetTime = (p_timeGetTime)(LPVOID)GetProcAddress(winmm, "timeGetTime");
|
||||
}
|
||||
I_AddExitFunc(I_ShutdownTimer);
|
||||
#endif
|
||||
|
@ -3307,7 +3307,7 @@ void I_GetDiskFreeSpace(INT64 *freespace)
|
|||
|
||||
if (!testwin95)
|
||||
{
|
||||
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
|
||||
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
|
||||
testwin95 = true;
|
||||
}
|
||||
if (pfnGetDiskFreeSpaceEx)
|
||||
|
@ -3331,7 +3331,7 @@ void I_GetDiskFreeSpace(INT64 *freespace)
|
|||
|
||||
char *I_GetUserName(void)
|
||||
{
|
||||
static char username[MAXPLAYERNAME];
|
||||
static char username[MAXPLAYERNAME+1];
|
||||
char *p;
|
||||
#ifdef _WIN32
|
||||
DWORD i = MAXPLAYERNAME;
|
||||
|
@ -3827,7 +3827,7 @@ const CPUInfoFlags *I_CPUInfo(void)
|
|||
#if defined (_WIN32)
|
||||
static CPUInfoFlags WIN_CPUInfo;
|
||||
SYSTEM_INFO SI;
|
||||
p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent");
|
||||
p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent");
|
||||
|
||||
ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo));
|
||||
if (pfnCPUID)
|
||||
|
|
|
@ -635,11 +635,6 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
|||
if (cv_usemouse.value) I_StartupMouse();
|
||||
}
|
||||
//else firsttimeonmouse = SDL_FALSE;
|
||||
|
||||
capslock = !!( SDL_GetModState() & KMOD_CAPS );// in case CL changes
|
||||
|
||||
if (USE_MOUSEINPUT)
|
||||
SDLdoGrabMouse();
|
||||
}
|
||||
else if (!mousefocus && !kbfocus)
|
||||
{
|
||||
|
@ -1296,6 +1291,8 @@ void I_StartupMouse(void)
|
|||
//
|
||||
void I_OsPolling(void)
|
||||
{
|
||||
SDL_Keymod mod;
|
||||
|
||||
if (consolevent)
|
||||
I_GetConsoleEvents();
|
||||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
|
||||
|
@ -1310,6 +1307,18 @@ void I_OsPolling(void)
|
|||
I_GetMouseEvents();
|
||||
|
||||
I_GetEvent();
|
||||
|
||||
mod = SDL_GetModState();
|
||||
/* Handle here so that our state is always synched with the system. */
|
||||
shiftdown = ctrldown = altdown = 0;
|
||||
capslock = false;
|
||||
if (mod & KMOD_LSHIFT) shiftdown |= 1;
|
||||
if (mod & KMOD_RSHIFT) shiftdown |= 2;
|
||||
if (mod & KMOD_LCTRL) ctrldown |= 1;
|
||||
if (mod & KMOD_RCTRL) ctrldown |= 2;
|
||||
if (mod & KMOD_LALT) altdown |= 1;
|
||||
if (mod & KMOD_RALT) altdown |= 2;
|
||||
if (mod & KMOD_CAPS) capslock = true;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -1219,7 +1219,7 @@
|
|||
C01FCF4B08A954540054247B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CURRENT_PROJECT_VERSION = 2.1.23;
|
||||
CURRENT_PROJECT_VERSION = 2.1.25;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
NORMALSRB2,
|
||||
|
@ -1231,7 +1231,7 @@
|
|||
C01FCF4C08A954540054247B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CURRENT_PROJECT_VERSION = 2.1.23;
|
||||
CURRENT_PROJECT_VERSION = 2.1.25;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
|
|
|
@ -98,8 +98,8 @@ static INT32 current_track;
|
|||
|
||||
static void var_cleanup(void)
|
||||
{
|
||||
loop_point = song_length =\
|
||||
music_bytes = fading_source = fading_target =\
|
||||
song_length = loop_point = 0.0f;
|
||||
music_bytes = fading_source = fading_target =\
|
||||
fading_timer = fading_duration = 0;
|
||||
|
||||
songpaused = is_looping =\
|
||||
|
@ -362,7 +362,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
|||
gme_track_info(emu, &info, 0);
|
||||
|
||||
len = (info->play_length * 441 / 10) << 2;
|
||||
mem = malloc(len);
|
||||
mem = Z_Malloc(len, PU_SOUND, 0);
|
||||
gme_play(emu, len >> 1, mem);
|
||||
gme_free_info(info);
|
||||
gme_delete(emu);
|
||||
|
@ -435,7 +435,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
|||
gme_track_info(emu, &info, 0);
|
||||
|
||||
len = (info->play_length * 441 / 10) << 2;
|
||||
mem = malloc(len);
|
||||
mem = Z_Malloc(len, PU_SOUND, 0);
|
||||
gme_play(emu, len >> 1, mem);
|
||||
gme_free_info(info);
|
||||
gme_delete(emu);
|
||||
|
@ -569,7 +569,7 @@ static void music_loop(void)
|
|||
{
|
||||
Mix_PlayMusic(music, 0);
|
||||
Mix_SetMusicPosition(loop_point);
|
||||
music_bytes = loop_point*44100.0L*4; //assume 44.1khz, 4-byte length (see I_GetSongPosition)
|
||||
music_bytes = (UINT32)(loop_point*44100.0L*4); //assume 44.1khz, 4-byte length (see I_GetSongPosition)
|
||||
}
|
||||
else
|
||||
I_StopSong();
|
||||
|
@ -842,7 +842,7 @@ boolean I_SetSongPosition(UINT32 position)
|
|||
|
||||
Mix_RewindMusic(); // needed for mp3
|
||||
if(Mix_SetMusicPosition((float)(position/1000.0L)) == 0)
|
||||
music_bytes = position/1000.0L*44100.0L*4; //assume 44.1khz, 4-byte length (see I_GetSongPosition)
|
||||
music_bytes = (UINT32)(position/1000.0L*44100.0L*4); //assume 44.1khz, 4-byte length (see I_GetSongPosition)
|
||||
else
|
||||
// NOTE: This block fires on incorrect song format,
|
||||
// NOT if position input is greater than song length.
|
||||
|
@ -886,7 +886,7 @@ UINT32 I_GetSongPosition(void)
|
|||
if (!music || I_SongType() == MU_MID)
|
||||
return 0;
|
||||
else
|
||||
return music_bytes/44100.0L*1000.0L/4; //assume 44.1khz
|
||||
return (UINT32)(music_bytes/44100.0L*1000.0L/4); //assume 44.1khz
|
||||
// 4 = byte length for 16-bit samples (AUDIO_S16SYS), stereo (2-channel)
|
||||
// This is hardcoded in I_StartupSound. Other formats for factor:
|
||||
// 8M: 1 | 8S: 2 | 16M: 2 | 16S: 4
|
||||
|
|
|
@ -1219,7 +1219,7 @@
|
|||
C01FCF4B08A954540054247B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CURRENT_PROJECT_VERSION = 2.1.23;
|
||||
CURRENT_PROJECT_VERSION = 2.1.25;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
NORMALSRB2,
|
||||
|
@ -1231,7 +1231,7 @@
|
|||
C01FCF4C08A954540054247B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CURRENT_PROJECT_VERSION = 2.1.23;
|
||||
CURRENT_PROJECT_VERSION = 2.1.25;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
|
|
|
@ -54,7 +54,7 @@ typedef enum
|
|||
} skinsound_t;
|
||||
|
||||
// free sfx for S_AddSoundFx()
|
||||
#define NUMSFXFREESLOTS 800 // Matches SOC Editor.
|
||||
#define NUMSFXFREESLOTS 1600 // Matches SOC Editor.
|
||||
#define NUMSKINSFXSLOTS (MAXSKINS*NUMSKINSOUNDS)
|
||||
|
||||
//
|
||||
|
|
|
@ -203,7 +203,7 @@ void ST_Ticker(void)
|
|||
}
|
||||
|
||||
// 0 is default, any others are special palettes.
|
||||
static INT32 st_palette = 0;
|
||||
INT32 st_palette = 0;
|
||||
|
||||
void ST_doPaletteStuff(void)
|
||||
{
|
||||
|
|
|
@ -61,6 +61,7 @@ boolean ST_SameTeam(player_t *a, player_t *b);
|
|||
//--------------------
|
||||
|
||||
extern boolean st_overlay; // sb overlay on or off when fullscreen
|
||||
extern INT32 st_palette; // 0 is default, any others are special palettes.
|
||||
|
||||
extern lumpnum_t st_borderpatchnum;
|
||||
// patches, also used in intermission
|
||||
|
|
40
src/w_wad.c
40
src/w_wad.c
|
@ -150,9 +150,15 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors)
|
|||
{
|
||||
FILE *handle;
|
||||
|
||||
strncpy(filenamebuf, *filename, MAX_WADPATH);
|
||||
filenamebuf[MAX_WADPATH - 1] = '\0';
|
||||
*filename = filenamebuf;
|
||||
// Officially, strncpy should not have overlapping buffers, since W_VerifyNMUSlumps is called after this, and it
|
||||
// changes filename to point at filenamebuf, it would technically be doing that. I doubt any issue will occur since
|
||||
// they point to the same location, but it's better to be safe and this is a simple change.
|
||||
if (filenamebuf != *filename)
|
||||
{
|
||||
strncpy(filenamebuf, *filename, MAX_WADPATH);
|
||||
filenamebuf[MAX_WADPATH - 1] = '\0';
|
||||
*filename = filenamebuf;
|
||||
}
|
||||
|
||||
// open wad file
|
||||
if ((handle = fopen(*filename, "rb")) == NULL)
|
||||
|
@ -335,7 +341,6 @@ static restype_t ResourceFileDetect (const char* filename)
|
|||
static lumpinfo_t* ResGetLumpsStandalone (FILE* handle, UINT16* numlumps, const char* lumpname)
|
||||
{
|
||||
lumpinfo_t* lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
|
||||
lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
|
||||
lumpinfo->position = 0;
|
||||
fseek(handle, 0, SEEK_END);
|
||||
lumpinfo->size = ftell(handle);
|
||||
|
@ -567,14 +572,14 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
|
|||
{
|
||||
CONS_Alert(CONS_ERROR, "Failed to read central directory (%s)\n", strerror(ferror(handle)));
|
||||
Z_Free(lumpinfo);
|
||||
free(zentry);
|
||||
free(zentries);
|
||||
return NULL;
|
||||
}
|
||||
if (memcmp(zentry->signature, pat_central, 4))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Central directory is corrupt\n");
|
||||
Z_Free(lumpinfo);
|
||||
free(zentry);
|
||||
free(zentries);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -587,7 +592,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
|
|||
{
|
||||
CONS_Alert(CONS_ERROR, "Unable to read lumpname (%s)\n", strerror(ferror(handle)));
|
||||
Z_Free(lumpinfo);
|
||||
free(zentry);
|
||||
free(zentries);
|
||||
free(fullname);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -629,6 +634,8 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
|
|||
}
|
||||
}
|
||||
|
||||
free(zentries);
|
||||
|
||||
*nlmp = numlumps;
|
||||
return lumpinfo;
|
||||
}
|
||||
|
@ -1139,6 +1146,22 @@ boolean W_IsLumpWad(lumpnum_t lumpnum)
|
|||
return false; // WADs should never be inside non-PK3s as far as SRB2 is concerned
|
||||
}
|
||||
|
||||
//
|
||||
// W_IsLumpFolder
|
||||
// Is the lump a folder? (in a PK3 obviously)
|
||||
//
|
||||
boolean W_IsLumpFolder(UINT16 wad, UINT16 lump)
|
||||
{
|
||||
if (wadfiles[wad]->type == RET_PK3)
|
||||
{
|
||||
const char *name = wadfiles[wad]->lumpinfo[lump].name2;
|
||||
|
||||
return (name[strlen(name)-1] == '/'); // folders end in '/'
|
||||
}
|
||||
|
||||
return false; // non-PK3s don't have folders
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
/* report a zlib or i/o error */
|
||||
void zerr(int ret)
|
||||
|
@ -1314,8 +1337,9 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si
|
|||
{
|
||||
size = 0;
|
||||
zerr(zErr);
|
||||
(void)inflateEnd(&strm);
|
||||
}
|
||||
|
||||
(void)inflateEnd(&strm);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -154,6 +154,7 @@ size_t W_LumpLengthPwad(UINT16 wad, UINT16 lump);
|
|||
size_t W_LumpLength(lumpnum_t lumpnum);
|
||||
|
||||
boolean W_IsLumpWad(lumpnum_t lumpnum); // for loading maps from WADs in PK3s
|
||||
boolean W_IsLumpFolder(UINT16 wad, UINT16 lump); // for detecting folder "lumps"
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
void zerr(int ret); // zlib error checking
|
||||
|
|
|
@ -36,10 +36,6 @@ ifndef GCC44
|
|||
#OPTS+=-mms-bitfields
|
||||
endif
|
||||
|
||||
ifndef MINGW64
|
||||
OPTS+=-gdwarf-2
|
||||
endif
|
||||
|
||||
ifndef SDL
|
||||
OPTS+=-D_WINDOWS
|
||||
endif
|
||||
|
|
|
@ -91,6 +91,7 @@
|
|||
<Import Project="..\..\libs\FMOD.props" />
|
||||
<Import Project="..\..\libs\zlib.props" />
|
||||
<Import Project="..\..\libs\libpng.props" />
|
||||
<Import Project="..\..\libs\libgme.props" />
|
||||
<Import Project="SRB2Win.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
<PropertyGroup />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<!-- x86/x64 defines: has specific libraries that ARM does not -->
|
||||
<PreprocessorDefinitions Condition="'$(Platform)' == 'Win32' OR '$(Platform)' == 'x64'">HAVE_ZLIB;HAVE_LIBGME;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<!-- ARM defines -->
|
||||
<PreprocessorDefinitions Condition="'$(Platform)' != 'Win32' AND '$(Platform)' != 'x64'">_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link />
|
||||
<Link>
|
||||
|
|
|
@ -147,7 +147,7 @@ static inline BOOL LoadDirectDraw(VOID)
|
|||
DDrawDLL = LoadLibraryA("DDRAW.DLL");
|
||||
if (DDrawDLL == NULL)
|
||||
return false;
|
||||
pfnDirectDrawCreate = (DDCreate)GetProcAddress(DDrawDLL, "DirectDrawCreate");
|
||||
pfnDirectDrawCreate = (DDCreate)(LPVOID)GetProcAddress(DDrawDLL, "DirectDrawCreate");
|
||||
if (pfnDirectDrawCreate == NULL)
|
||||
return false;
|
||||
return true;
|
||||
|
|
|
@ -327,7 +327,7 @@ static inline VOID I_GetConsoleEvents(VOID)
|
|||
break;
|
||||
case VK_RETURN:
|
||||
entering_con_command = false;
|
||||
// Fall through.
|
||||
/* FALLTHRU */
|
||||
default:
|
||||
ev.data1 = MapVirtualKey(input.Event.KeyEvent.wVirtualKeyCode,2); // convert in to char
|
||||
}
|
||||
|
@ -3395,7 +3395,7 @@ BOOL LoadDirectInput(VOID)
|
|||
DInputDLL = LoadLibraryA("DINPUT.DLL");
|
||||
if (DInputDLL == NULL)
|
||||
return false;
|
||||
pfnDirectInputCreateA = (DICreateA)GetProcAddress(DInputDLL, "DirectInputCreateA");
|
||||
pfnDirectInputCreateA = (DICreateA)(LPVOID)GetProcAddress(DInputDLL, "DirectInputCreateA");
|
||||
if (pfnDirectInputCreateA == NULL)
|
||||
return false;
|
||||
return true;
|
||||
|
@ -3529,7 +3529,7 @@ void I_GetDiskFreeSpace(INT64* freespace)
|
|||
|
||||
if (!testwin95)
|
||||
{
|
||||
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
|
||||
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
|
||||
testwin95 = true;
|
||||
}
|
||||
if (pfnGetDiskFreeSpaceEx)
|
||||
|
@ -3615,7 +3615,7 @@ const CPUInfoFlags *I_CPUInfo(void)
|
|||
{
|
||||
static CPUInfoFlags WIN_CPUInfo;
|
||||
SYSTEM_INFO SI;
|
||||
p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent");
|
||||
p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent");
|
||||
|
||||
ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo));
|
||||
if (pfnCPUID)
|
||||
|
@ -3658,9 +3658,9 @@ static p_SetProcessAffinityMask pfnSetProcessAffinityMask = NULL;
|
|||
static inline VOID GetAffinityFuncs(VOID)
|
||||
{
|
||||
HMODULE h = GetModuleHandleA("kernel32.dll");
|
||||
pfnGetCurrentProcess = (p_GetCurrentProcess)GetProcAddress(h, "GetCurrentProcess");
|
||||
pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)GetProcAddress(h, "GetProcessAffinityMask");
|
||||
pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)GetProcAddress(h, "SetProcessAffinityMask");
|
||||
pfnGetCurrentProcess = (p_GetCurrentProcess)(LPVOID)GetProcAddress(h, "GetCurrentProcess");
|
||||
pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)(LPVOID)GetProcAddress(h, "GetProcessAffinityMask");
|
||||
pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)(LPVOID)GetProcAddress(h, "SetProcessAffinityMask");
|
||||
}
|
||||
|
||||
static void CPUAffinity_OnChange(void)
|
||||
|
|
Loading…
Reference in New Issue