mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-26 11:10:55 +00:00
Merge remote-tracking branch 'srb2-pub/master' into srb2-merge
This commit is contained in:
commit
d9e29f15cd
28 changed files with 193 additions and 164 deletions
|
@ -92,8 +92,8 @@ before_build:
|
||||||
- ccache -V
|
- ccache -V
|
||||||
- ccache -s
|
- ccache -s
|
||||||
- if [%NOUPX%] == [1] ( set "NOUPX=NOUPX=1" ) else ( set "NOUPX=" )
|
- if [%NOUPX%] == [1] ( set "NOUPX=NOUPX=1" ) else ( set "NOUPX=" )
|
||||||
- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 GCC72=1 NOOBJDUMP=1 %NOUPX%"
|
- 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" )
|
- 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"
|
- set "SRB2_MFLAGS=%SRB2_MFLAGS% %MINGW_FLAGS% %CONFIGURATION%=1"
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
|
|
16
libs/libgme.props
Normal file
16
libs/libgme.props
Normal file
|
@ -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
|
# and other things
|
||||||
#
|
#
|
||||||
|
|
||||||
ifdef GCC81
|
ifdef GCC91
|
||||||
GCC80=1
|
GCC83=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef GCC80
|
ifdef GCC83
|
||||||
|
GCC82=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef GCC82
|
||||||
|
GCC81=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef GCC81
|
||||||
GCC72=1
|
GCC72=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -146,6 +154,9 @@ ifdef GCC43
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
WFLAGS+=-Wsign-compare
|
WFLAGS+=-Wsign-compare
|
||||||
|
ifdef GCC91
|
||||||
|
WFLAGS+=-Wno-error=address-of-packed-member
|
||||||
|
endif
|
||||||
ifdef GCC45
|
ifdef GCC45
|
||||||
WFLAGS+=-Wlogical-op
|
WFLAGS+=-Wlogical-op
|
||||||
endif
|
endif
|
||||||
|
@ -186,6 +197,9 @@ ifndef GCC295
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
WFLAGS+=-Wformat-y2k
|
WFLAGS+=-Wformat-y2k
|
||||||
|
ifdef GCC71
|
||||||
|
WFLAGS+=-Wno-error=format-overflow=2
|
||||||
|
endif
|
||||||
WFLAGS+=-Wformat-security
|
WFLAGS+=-Wformat-security
|
||||||
ifndef GCC29
|
ifndef GCC29
|
||||||
#WFLAGS+=-Winit-self
|
#WFLAGS+=-Winit-self
|
||||||
|
@ -224,7 +238,7 @@ ifdef GCC71
|
||||||
WFLAGS+=-Wno-implicit-fallthrough
|
WFLAGS+=-Wno-implicit-fallthrough
|
||||||
WFLAGS+=-Wno-error=format-truncation
|
WFLAGS+=-Wno-error=format-truncation
|
||||||
endif
|
endif
|
||||||
ifdef GCC80
|
ifdef GCC81
|
||||||
WFLAGS+=-Wno-error=format-overflow
|
WFLAGS+=-Wno-error=format-overflow
|
||||||
WFLAGS+=-Wno-error=stringop-truncation
|
WFLAGS+=-Wno-error=stringop-truncation
|
||||||
WFLAGS+=-Wno-error=stringop-overflow
|
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!
|
if (!stricmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase!
|
||||||
{
|
{
|
||||||
recursion = 0;
|
|
||||||
cmd->function();
|
cmd->function();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -544,10 +543,7 @@ static void COM_ExecuteString(char *ptext)
|
||||||
if (!stricmp(com_argv[0], a->name))
|
if (!stricmp(com_argv[0], a->name))
|
||||||
{
|
{
|
||||||
if (recursion > MAX_ALIAS_RECURSION)
|
if (recursion > MAX_ALIAS_RECURSION)
|
||||||
{
|
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n"));
|
CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n"));
|
||||||
recursion = 0;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
@ -581,13 +577,12 @@ static void COM_ExecuteString(char *ptext)
|
||||||
|
|
||||||
recursion++;
|
recursion++;
|
||||||
COM_BufInsertText(buf);
|
COM_BufInsertText(buf);
|
||||||
|
recursion--;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recursion = 0;
|
|
||||||
|
|
||||||
// check cvars
|
// check cvars
|
||||||
// Hurdler: added at Ebola's request ;)
|
// Hurdler: added at Ebola's request ;)
|
||||||
// (don't flood the console in software mode with bad gr_xxx command)
|
// (don't flood the console in software mode with bad gr_xxx command)
|
||||||
|
|
|
@ -1112,13 +1112,7 @@ boolean CON_Responder(event_t *ev)
|
||||||
else if (key == KEY_KPADSLASH)
|
else if (key == KEY_KPADSLASH)
|
||||||
key = '/';
|
key = '/';
|
||||||
|
|
||||||
// same capslock code as hu_stuff.c's HU_responder. Check there for details.
|
if (key >= 'a' && key <= 'z')
|
||||||
if ((key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z'))
|
|
||||||
{
|
|
||||||
if (shiftdown ^ capslock)
|
|
||||||
key = shiftxform[key];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (shiftdown)
|
if (shiftdown)
|
||||||
key = shiftxform[key];
|
key = shiftxform[key];
|
||||||
|
|
33
src/d_main.c
33
src/d_main.c
|
@ -180,39 +180,11 @@ void D_PostEvent_end(void) {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// modifier keys
|
// modifier keys
|
||||||
|
// Now handled in I_OsPolling
|
||||||
UINT8 shiftdown = 0; // 0x1 left, 0x2 right
|
UINT8 shiftdown = 0; // 0x1 left, 0x2 right
|
||||||
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
|
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
|
||||||
UINT8 altdown = 0; // 0x1 left, 0x2 right
|
UINT8 altdown = 0; // 0x1 left, 0x2 right
|
||||||
boolean capslock = 0; // gee i wonder what this does.
|
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
|
// D_ProcessEvents
|
||||||
|
@ -226,9 +198,6 @@ void D_ProcessEvents(void)
|
||||||
{
|
{
|
||||||
ev = &events[eventtail];
|
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.
|
// Screenshots over everything so that they can be taken anywhere.
|
||||||
if (M_ScreenshotResponder(ev))
|
if (M_ScreenshotResponder(ev))
|
||||||
continue; // ate the event
|
continue; // ate the event
|
||||||
|
|
|
@ -1196,21 +1196,24 @@ UINT8 *HWR_GetScreenshot(void)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean HWR_Screenshot(const char *lbmname)
|
boolean HWR_Screenshot(const char *pathname)
|
||||||
{
|
{
|
||||||
boolean ret;
|
boolean ret;
|
||||||
UINT8 *buf = malloc(vid.width * vid.height * 3 * sizeof (*buf));
|
UINT8 *buf = malloc(vid.width * vid.height * 3 * sizeof (*buf));
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
|
{
|
||||||
|
CONS_Debug(DBG_RENDER, "HWR_Screenshot: Failed to allocate memory\n");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// returns 24bit 888 RGB
|
// returns 24bit 888 RGB
|
||||||
HWD.pfnReadRect(0, 0, vid.width, vid.height, vid.width * 3, (void *)buf);
|
HWD.pfnReadRect(0, 0, vid.width, vid.height, vid.width * 3, (void *)buf);
|
||||||
|
|
||||||
#ifdef USE_PNG
|
#ifdef USE_PNG
|
||||||
ret = M_SavePNG(lbmname, buf, vid.width, vid.height, NULL);
|
ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL);
|
||||||
#else
|
#else
|
||||||
ret = saveTGA(lbmname, buf, vid.width, vid.height);
|
ret = saveTGA(pathname, buf, vid.width, vid.height);
|
||||||
#endif
|
#endif
|
||||||
free(buf);
|
free(buf);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -38,8 +38,6 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player);
|
||||||
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
|
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
|
||||||
void HWR_DrawViewBorder(INT32 clearlines);
|
void HWR_DrawViewBorder(INT32 clearlines);
|
||||||
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum);
|
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_InitTextureMapping(void);
|
||||||
void HWR_SetViewSize(void);
|
void HWR_SetViewSize(void);
|
||||||
void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option);
|
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_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color);
|
||||||
void HWR_DrawPic(INT32 x,INT32 y,lumpnum_t lumpnum);
|
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_AddCommands(void);
|
||||||
void HWR_CorrectSWTricks(void);
|
void HWR_CorrectSWTricks(void);
|
||||||
void transform(float *cx, float *cy, float *cz);
|
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
|
#ifdef USE_WINSOCK2
|
||||||
static HMODULE ipv6dll = NULL;
|
static HMODULE ipv6dll = NULL;
|
||||||
typedef int (WSAAPI *p_getaddrinfo) (const char *node, const char *service,
|
typedef int (WSAAPI *p_getaddrinfo) (const char *, const char *,
|
||||||
const struct my_addrinfo *hints,
|
const struct my_addrinfo *,
|
||||||
struct my_addrinfo **res);
|
struct my_addrinfo **);
|
||||||
typedef void (WSAAPI *p_freeaddrinfo) (struct my_addrinfo *res);
|
typedef void (WSAAPI *p_freeaddrinfo) (struct my_addrinfo *);
|
||||||
|
|
||||||
static p_getaddrinfo WS_getaddrinfo = NULL;
|
static p_getaddrinfo WS_getaddrinfo = NULL;
|
||||||
static p_freeaddrinfo WS_freeaddrinfo = NULL;
|
static p_freeaddrinfo WS_freeaddrinfo = NULL;
|
||||||
|
@ -86,10 +86,10 @@ static HMODULE WS_getfunctions(HMODULE tmp)
|
||||||
{
|
{
|
||||||
if (tmp != NULL)
|
if (tmp != NULL)
|
||||||
{
|
{
|
||||||
WS_getaddrinfo = (p_getaddrinfo)((void *)GetProcAddress(tmp, "getaddrinfo"));
|
WS_getaddrinfo = (p_getaddrinfo)(LPVOID)GetProcAddress(tmp, "getaddrinfo");
|
||||||
if (WS_getaddrinfo == NULL)
|
if (WS_getaddrinfo == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
WS_freeaddrinfo = (p_freeaddrinfo)((void *)GetProcAddress(tmp, "freeaddrinfo"));
|
WS_freeaddrinfo = (p_freeaddrinfo)(LPVOID)GetProcAddress(tmp, "freeaddrinfo");
|
||||||
if (WS_freeaddrinfo == NULL)
|
if (WS_freeaddrinfo == NULL)
|
||||||
{
|
{
|
||||||
WS_getaddrinfo = NULL;
|
WS_getaddrinfo = NULL;
|
||||||
|
|
|
@ -226,7 +226,7 @@ void A_NapalmScatter();
|
||||||
void A_SpawnFreshCopy();
|
void A_SpawnFreshCopy();
|
||||||
|
|
||||||
// ratio of states to sprites to mobj types is roughly 6 : 1 : 1
|
// ratio of states to sprites to mobj types is roughly 6 : 1 : 1
|
||||||
#define NUMMOBJFREESLOTS 256
|
#define NUMMOBJFREESLOTS 512
|
||||||
#define NUMSPRITEFREESLOTS NUMMOBJFREESLOTS
|
#define NUMSPRITEFREESLOTS NUMMOBJFREESLOTS
|
||||||
#define NUMSTATEFREESLOTS (NUMMOBJFREESLOTS*8)
|
#define NUMSTATEFREESLOTS (NUMMOBJFREESLOTS*8)
|
||||||
|
|
||||||
|
|
65
src/m_misc.c
65
src/m_misc.c
|
@ -30,6 +30,7 @@
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "m_misc.h"
|
#include "m_misc.h"
|
||||||
#include "hu_stuff.h"
|
#include "hu_stuff.h"
|
||||||
|
#include "st_stuff.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "g_input.h"
|
#include "g_input.h"
|
||||||
|
@ -57,7 +58,7 @@ typedef off_t off64_t;
|
||||||
#endif
|
#endif
|
||||||
#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"
|
#define PRIdS "u"
|
||||||
#elif defined (_WIN32)
|
#elif defined (_WIN32)
|
||||||
#define PRIdS "Iu"
|
#define PRIdS "Iu"
|
||||||
|
@ -586,6 +587,21 @@ void M_SaveConfig(const char *filename)
|
||||||
fclose(f);
|
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
|
#if NUMSCREENS > 2
|
||||||
static const char *Newsnapshotfile(const char *pathname, const char *ext)
|
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)
|
static inline moviemode_t M_StartMovieAPNG(const char *pathname)
|
||||||
{
|
{
|
||||||
#ifdef USE_APNG
|
#ifdef USE_APNG
|
||||||
|
UINT8 *palette = NULL;
|
||||||
const char *freename = NULL;
|
const char *freename = NULL;
|
||||||
boolean ret = false;
|
boolean ret = false;
|
||||||
|
|
||||||
|
@ -1033,9 +1050,12 @@ static inline moviemode_t M_StartMovieAPNG(const char *pathname)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft)
|
||||||
ret = M_SetupaPNG(va(pandf,pathname,freename), W_CacheLumpName(GetPalette(), PU_CACHE));
|
{
|
||||||
else
|
M_CreateScreenShotPalette();
|
||||||
ret = M_SetupaPNG(va(pandf,pathname,freename), NULL);
|
palette = screenshot_palette;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = M_SetupaPNG(va(pandf,pathname,freename), palette);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
|
@ -1238,7 +1258,7 @@ void M_StopMovie(void)
|
||||||
* \param data The image data.
|
* \param data The image data.
|
||||||
* \param width Width of the picture.
|
* \param width Width of the picture.
|
||||||
* \param height Height 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
|
* \note if palette is NULL, BGR888 format
|
||||||
*/
|
*/
|
||||||
boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,
|
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, PNG_error, PNG_warn);
|
||||||
PNG_error, PNG_warn);
|
|
||||||
if (!png_ptr)
|
if (!png_ptr)
|
||||||
{
|
{
|
||||||
CONS_Debug(DBG_RENDER, "M_SavePNG: Error on initialize libpng\n");
|
CONS_Debug(DBG_RENDER, "M_SavePNG: Error on initialize libpng\n");
|
||||||
|
@ -1415,9 +1434,8 @@ void M_ScreenShot(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Takes a screenshot.
|
/** Takes a screenshot.
|
||||||
* The screenshot is saved as "kartxxxx.pcx" (or "kartxxxx.tga" in hardware
|
* The screenshot is saved as "srb2xxxx.png" where xxxx is the lowest
|
||||||
* rendermode) where xxxx is the lowest four-digit number for which a file
|
* four-digit number for which a file does not already exist.
|
||||||
* does not already exist.
|
|
||||||
*
|
*
|
||||||
* \sa HWR_ScreenShot
|
* \sa HWR_ScreenShot
|
||||||
*/
|
*/
|
||||||
|
@ -1431,6 +1449,10 @@ void M_DoScreenShot(void)
|
||||||
// Don't take multiple screenshots, obviously
|
// Don't take multiple screenshots, obviously
|
||||||
takescreenshot = false;
|
takescreenshot = false;
|
||||||
|
|
||||||
|
// how does one take a screenshot without a render system?
|
||||||
|
if (rendermode == render_none)
|
||||||
|
return;
|
||||||
|
|
||||||
if (cv_screenshot_option.value == 0)
|
if (cv_screenshot_option.value == 0)
|
||||||
pathname = usehome ? srb2home : srb2path;
|
pathname = usehome ? srb2home : srb2path;
|
||||||
else if (cv_screenshot_option.value == 1)
|
else if (cv_screenshot_option.value == 1)
|
||||||
|
@ -1441,16 +1463,13 @@ void M_DoScreenShot(void)
|
||||||
pathname = cv_screenshot_folder.string;
|
pathname = cv_screenshot_folder.string;
|
||||||
|
|
||||||
#ifdef USE_PNG
|
#ifdef USE_PNG
|
||||||
if (rendermode != render_none)
|
freename = Newsnapshotfile(pathname,"png");
|
||||||
freename = Newsnapshotfile(pathname,"png");
|
|
||||||
#else
|
#else
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft)
|
||||||
freename = Newsnapshotfile(pathname,"pcx");
|
freename = Newsnapshotfile(pathname,"pcx");
|
||||||
else if (rendermode != render_none)
|
else if (rendermode == render_opengl)
|
||||||
freename = Newsnapshotfile(pathname,"tga");
|
freename = Newsnapshotfile(pathname,"tga");
|
||||||
#endif
|
#endif
|
||||||
else
|
|
||||||
I_Error("Can't take a screenshot without a render system");
|
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft)
|
||||||
{
|
{
|
||||||
|
@ -1464,18 +1483,16 @@ void M_DoScreenShot(void)
|
||||||
|
|
||||||
// save the pcx file
|
// save the pcx file
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
if (rendermode != render_soft)
|
if (rendermode == render_opengl)
|
||||||
ret = HWR_Screenshot(va(pandf,pathname,freename));
|
ret = HWR_Screenshot(va(pandf,pathname,freename));
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (rendermode != render_none)
|
|
||||||
{
|
{
|
||||||
|
M_CreateScreenShotPalette();
|
||||||
#ifdef USE_PNG
|
#ifdef USE_PNG
|
||||||
ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height,
|
ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette);
|
||||||
W_CacheLumpName(GetPalette(), PU_CACHE));
|
|
||||||
#else
|
#else
|
||||||
ret = WritePCXfile(va(pandf,pathname,freename), linear, vid.width, vid.height,
|
ret = WritePCXfile(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette);
|
||||||
W_CacheLumpName(GetPalette(), PU_CACHE));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1483,14 +1500,14 @@ failure:
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
if (moviemode != MM_SCREENSHOT)
|
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
|
else
|
||||||
{
|
{
|
||||||
if (freename)
|
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
|
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)
|
if (moviemode == MM_SCREENSHOT)
|
||||||
M_StopMovie();
|
M_StopMovie();
|
||||||
|
|
62
src/r_data.c
62
src/r_data.c
|
@ -488,42 +488,31 @@ void R_LoadTextures(void)
|
||||||
{
|
{
|
||||||
patchlump = W_CacheLumpNumPwad((UINT16)w, texstart + j, PU_CACHE);
|
patchlump = W_CacheLumpNumPwad((UINT16)w, texstart + j, PU_CACHE);
|
||||||
|
|
||||||
// Then, check the lump directly to see if it's a texture SOC,
|
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height);
|
||||||
// and if it is, load it using dehacked instead.
|
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||||
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);
|
|
||||||
|
|
||||||
// Set texture properties.
|
// Set texture properties.
|
||||||
M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name));
|
M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name));
|
||||||
texture->width = SHORT(patchlump->width);
|
texture->width = SHORT(patchlump->width);
|
||||||
texture->height = SHORT(patchlump->height);
|
texture->height = SHORT(patchlump->height);
|
||||||
texture->patchcount = 1;
|
texture->patchcount = 1;
|
||||||
texture->holes = false;
|
texture->holes = false;
|
||||||
|
|
||||||
// Allocate information for the texture's patches.
|
// Allocate information for the texture's patches.
|
||||||
patch = &texture->patches[0];
|
patch = &texture->patches[0];
|
||||||
|
|
||||||
patch->originx = patch->originy = 0;
|
patch->originx = patch->originy = 0;
|
||||||
patch->wad = (UINT16)w;
|
patch->wad = (UINT16)w;
|
||||||
patch->lump = texstart + j;
|
patch->lump = texstart + j;
|
||||||
|
|
||||||
Z_Unlock(patchlump);
|
Z_Unlock(patchlump);
|
||||||
|
|
||||||
k = 1;
|
k = 1;
|
||||||
while (k << 1 <= texture->width)
|
while (k << 1 <= texture->width)
|
||||||
k <<= 1;
|
k <<= 1;
|
||||||
|
|
||||||
texturewidthmask[i] = k - 1;
|
texturewidthmask[i] = k - 1;
|
||||||
textureheight[i] = texture->height << FRACBITS;
|
textureheight[i] = texture->height << FRACBITS;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1076,6 +1065,7 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap)
|
||||||
{
|
{
|
||||||
char colormap[9] = "COLORMAP";
|
char colormap[9] = "COLORMAP";
|
||||||
lumpnum_t lump;
|
lumpnum_t lump;
|
||||||
|
const lumpnum_t basecolormaplump = W_GetNumForName(colormap);
|
||||||
|
|
||||||
if (num > 0 && num <= 10000)
|
if (num > 0 && num <= 10000)
|
||||||
snprintf(colormap, 8, "CLM%04u", num-1);
|
snprintf(colormap, 8, "CLM%04u", num-1);
|
||||||
|
@ -1083,8 +1073,16 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap)
|
||||||
// Load in the light tables, now 64k aligned for smokie...
|
// Load in the light tables, now 64k aligned for smokie...
|
||||||
lump = W_GetNumForName(colormap);
|
lump = W_GetNumForName(colormap);
|
||||||
if (lump == LUMPERROR)
|
if (lump == LUMPERROR)
|
||||||
lump = W_GetNumForName("COLORMAP");
|
lump = basecolormaplump;
|
||||||
W_ReadLump(lump, colormaps);
|
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.
|
// Encore mode.
|
||||||
if (newencoremap != LUMPERROR)
|
if (newencoremap != LUMPERROR)
|
||||||
|
|
|
@ -93,6 +93,7 @@
|
||||||
<Import Project="..\..\libs\libpng.props" />
|
<Import Project="..\..\libs\libpng.props" />
|
||||||
<Import Project="..\..\libs\SDL2.props" />
|
<Import Project="..\..\libs\SDL2.props" />
|
||||||
<Import Project="..\..\libs\SDL_mixer.props" />
|
<Import Project="..\..\libs\SDL_mixer.props" />
|
||||||
|
<Import Project="..\..\libs\libgme.props" />
|
||||||
<Import Project="Srb2SDL.props" />
|
<Import Project="Srb2SDL.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
|
|
@ -5,7 +5,10 @@
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<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>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
|
|
|
@ -2960,7 +2960,7 @@ static void I_ShutdownTimer(void)
|
||||||
pfntimeGetTime = NULL;
|
pfntimeGetTime = NULL;
|
||||||
if (winmm)
|
if (winmm)
|
||||||
{
|
{
|
||||||
p_timeEndPeriod pfntimeEndPeriod = (p_timeEndPeriod)GetProcAddress(winmm, "timeEndPeriod");
|
p_timeEndPeriod pfntimeEndPeriod = (p_timeEndPeriod)(LPVOID)GetProcAddress(winmm, "timeEndPeriod");
|
||||||
if (pfntimeEndPeriod)
|
if (pfntimeEndPeriod)
|
||||||
pfntimeEndPeriod(1);
|
pfntimeEndPeriod(1);
|
||||||
FreeLibrary(winmm);
|
FreeLibrary(winmm);
|
||||||
|
@ -3005,10 +3005,10 @@ void I_StartupTimer(void)
|
||||||
winmm = LoadLibraryA("winmm.dll");
|
winmm = LoadLibraryA("winmm.dll");
|
||||||
if (winmm)
|
if (winmm)
|
||||||
{
|
{
|
||||||
p_timeEndPeriod pfntimeBeginPeriod = (p_timeEndPeriod)GetProcAddress(winmm, "timeBeginPeriod");
|
p_timeEndPeriod pfntimeBeginPeriod = (p_timeEndPeriod)(LPVOID)GetProcAddress(winmm, "timeBeginPeriod");
|
||||||
if (pfntimeBeginPeriod)
|
if (pfntimeBeginPeriod)
|
||||||
pfntimeBeginPeriod(1);
|
pfntimeBeginPeriod(1);
|
||||||
pfntimeGetTime = (p_timeGetTime)GetProcAddress(winmm, "timeGetTime");
|
pfntimeGetTime = (p_timeGetTime)(LPVOID)GetProcAddress(winmm, "timeGetTime");
|
||||||
}
|
}
|
||||||
I_AddExitFunc(I_ShutdownTimer);
|
I_AddExitFunc(I_ShutdownTimer);
|
||||||
#endif
|
#endif
|
||||||
|
@ -3307,7 +3307,7 @@ void I_GetDiskFreeSpace(INT64 *freespace)
|
||||||
|
|
||||||
if (!testwin95)
|
if (!testwin95)
|
||||||
{
|
{
|
||||||
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
|
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
|
||||||
testwin95 = true;
|
testwin95 = true;
|
||||||
}
|
}
|
||||||
if (pfnGetDiskFreeSpaceEx)
|
if (pfnGetDiskFreeSpaceEx)
|
||||||
|
@ -3331,7 +3331,7 @@ void I_GetDiskFreeSpace(INT64 *freespace)
|
||||||
|
|
||||||
char *I_GetUserName(void)
|
char *I_GetUserName(void)
|
||||||
{
|
{
|
||||||
static char username[MAXPLAYERNAME];
|
static char username[MAXPLAYERNAME+1];
|
||||||
char *p;
|
char *p;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD i = MAXPLAYERNAME;
|
DWORD i = MAXPLAYERNAME;
|
||||||
|
@ -3827,7 +3827,7 @@ const CPUInfoFlags *I_CPUInfo(void)
|
||||||
#if defined (_WIN32)
|
#if defined (_WIN32)
|
||||||
static CPUInfoFlags WIN_CPUInfo;
|
static CPUInfoFlags WIN_CPUInfo;
|
||||||
SYSTEM_INFO SI;
|
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));
|
ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo));
|
||||||
if (pfnCPUID)
|
if (pfnCPUID)
|
||||||
|
|
|
@ -635,11 +635,6 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||||
if (cv_usemouse.value) I_StartupMouse();
|
if (cv_usemouse.value) I_StartupMouse();
|
||||||
}
|
}
|
||||||
//else firsttimeonmouse = SDL_FALSE;
|
//else firsttimeonmouse = SDL_FALSE;
|
||||||
|
|
||||||
capslock = !!( SDL_GetModState() & KMOD_CAPS );// in case CL changes
|
|
||||||
|
|
||||||
if (USE_MOUSEINPUT)
|
|
||||||
SDLdoGrabMouse();
|
|
||||||
}
|
}
|
||||||
else if (!mousefocus && !kbfocus)
|
else if (!mousefocus && !kbfocus)
|
||||||
{
|
{
|
||||||
|
@ -1296,6 +1291,8 @@ void I_StartupMouse(void)
|
||||||
//
|
//
|
||||||
void I_OsPolling(void)
|
void I_OsPolling(void)
|
||||||
{
|
{
|
||||||
|
SDL_Keymod mod;
|
||||||
|
|
||||||
if (consolevent)
|
if (consolevent)
|
||||||
I_GetConsoleEvents();
|
I_GetConsoleEvents();
|
||||||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
|
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
|
||||||
|
@ -1310,6 +1307,18 @@ void I_OsPolling(void)
|
||||||
I_GetMouseEvents();
|
I_GetMouseEvents();
|
||||||
|
|
||||||
I_GetEvent();
|
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 */ = {
|
C01FCF4B08A954540054247B /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CURRENT_PROJECT_VERSION = 2.1.23;
|
CURRENT_PROJECT_VERSION = 2.1.24;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
NORMALSRB2,
|
NORMALSRB2,
|
||||||
|
@ -1231,7 +1231,7 @@
|
||||||
C01FCF4C08A954540054247B /* Release */ = {
|
C01FCF4C08A954540054247B /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CURRENT_PROJECT_VERSION = 2.1.23;
|
CURRENT_PROJECT_VERSION = 2.1.24;
|
||||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
|
|
@ -98,8 +98,8 @@ static INT32 current_track;
|
||||||
|
|
||||||
static void var_cleanup(void)
|
static void var_cleanup(void)
|
||||||
{
|
{
|
||||||
loop_point = song_length =\
|
song_length = loop_point = 0.0f;
|
||||||
music_bytes = fading_source = fading_target =\
|
music_bytes = fading_source = fading_target =\
|
||||||
fading_timer = fading_duration = 0;
|
fading_timer = fading_duration = 0;
|
||||||
|
|
||||||
songpaused = is_looping =\
|
songpaused = is_looping =\
|
||||||
|
@ -362,7 +362,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||||
gme_track_info(emu, &info, 0);
|
gme_track_info(emu, &info, 0);
|
||||||
|
|
||||||
len = (info->play_length * 441 / 10) << 2;
|
len = (info->play_length * 441 / 10) << 2;
|
||||||
mem = malloc(len);
|
mem = Z_Malloc(len, PU_SOUND, 0);
|
||||||
gme_play(emu, len >> 1, mem);
|
gme_play(emu, len >> 1, mem);
|
||||||
gme_free_info(info);
|
gme_free_info(info);
|
||||||
gme_delete(emu);
|
gme_delete(emu);
|
||||||
|
@ -435,7 +435,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||||
gme_track_info(emu, &info, 0);
|
gme_track_info(emu, &info, 0);
|
||||||
|
|
||||||
len = (info->play_length * 441 / 10) << 2;
|
len = (info->play_length * 441 / 10) << 2;
|
||||||
mem = malloc(len);
|
mem = Z_Malloc(len, PU_SOUND, 0);
|
||||||
gme_play(emu, len >> 1, mem);
|
gme_play(emu, len >> 1, mem);
|
||||||
gme_free_info(info);
|
gme_free_info(info);
|
||||||
gme_delete(emu);
|
gme_delete(emu);
|
||||||
|
@ -569,7 +569,7 @@ static void music_loop(void)
|
||||||
{
|
{
|
||||||
Mix_PlayMusic(music, 0);
|
Mix_PlayMusic(music, 0);
|
||||||
Mix_SetMusicPosition(loop_point);
|
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
|
else
|
||||||
I_StopSong();
|
I_StopSong();
|
||||||
|
@ -842,7 +842,7 @@ boolean I_SetSongPosition(UINT32 position)
|
||||||
|
|
||||||
Mix_RewindMusic(); // needed for mp3
|
Mix_RewindMusic(); // needed for mp3
|
||||||
if(Mix_SetMusicPosition((float)(position/1000.0L)) == 0)
|
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
|
else
|
||||||
// NOTE: This block fires on incorrect song format,
|
// NOTE: This block fires on incorrect song format,
|
||||||
// NOT if position input is greater than song length.
|
// NOT if position input is greater than song length.
|
||||||
|
@ -886,7 +886,7 @@ UINT32 I_GetSongPosition(void)
|
||||||
if (!music || I_SongType() == MU_MID)
|
if (!music || I_SongType() == MU_MID)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
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)
|
// 4 = byte length for 16-bit samples (AUDIO_S16SYS), stereo (2-channel)
|
||||||
// This is hardcoded in I_StartupSound. Other formats for factor:
|
// This is hardcoded in I_StartupSound. Other formats for factor:
|
||||||
// 8M: 1 | 8S: 2 | 16M: 2 | 16S: 4
|
// 8M: 1 | 8S: 2 | 16M: 2 | 16S: 4
|
||||||
|
|
|
@ -1219,7 +1219,7 @@
|
||||||
C01FCF4B08A954540054247B /* Debug */ = {
|
C01FCF4B08A954540054247B /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CURRENT_PROJECT_VERSION = 2.1.23;
|
CURRENT_PROJECT_VERSION = 2.1.24;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
NORMALSRB2,
|
NORMALSRB2,
|
||||||
|
@ -1231,7 +1231,7 @@
|
||||||
C01FCF4C08A954540054247B /* Release */ = {
|
C01FCF4C08A954540054247B /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CURRENT_PROJECT_VERSION = 2.1.23;
|
CURRENT_PROJECT_VERSION = 2.1.24;
|
||||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
|
|
@ -54,7 +54,7 @@ typedef enum
|
||||||
} skinsound_t;
|
} skinsound_t;
|
||||||
|
|
||||||
// free sfx for S_AddSoundFx()
|
// free sfx for S_AddSoundFx()
|
||||||
#define NUMSFXFREESLOTS 800 // Matches SOC Editor.
|
#define NUMSFXFREESLOTS 1600 // Matches SOC Editor.
|
||||||
#define NUMSKINSFXSLOTS (MAXSKINS*NUMSKINSOUNDS)
|
#define NUMSKINSFXSLOTS (MAXSKINS*NUMSKINSOUNDS)
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -203,7 +203,7 @@ void ST_Ticker(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0 is default, any others are special palettes.
|
// 0 is default, any others are special palettes.
|
||||||
static INT32 st_palette = 0;
|
INT32 st_palette = 0;
|
||||||
|
|
||||||
void ST_doPaletteStuff(void)
|
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 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;
|
extern lumpnum_t st_borderpatchnum;
|
||||||
// patches, also used in intermission
|
// patches, also used in intermission
|
||||||
|
|
24
src/w_wad.c
24
src/w_wad.c
|
@ -150,9 +150,15 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors)
|
||||||
{
|
{
|
||||||
FILE *handle;
|
FILE *handle;
|
||||||
|
|
||||||
strncpy(filenamebuf, *filename, MAX_WADPATH);
|
// Officially, strncpy should not have overlapping buffers, since W_VerifyNMUSlumps is called after this, and it
|
||||||
filenamebuf[MAX_WADPATH - 1] = '\0';
|
// changes filename to point at filenamebuf, it would technically be doing that. I doubt any issue will occur since
|
||||||
*filename = filenamebuf;
|
// 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
|
// open wad file
|
||||||
if ((handle = fopen(*filename, "rb")) == NULL)
|
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)
|
static lumpinfo_t* ResGetLumpsStandalone (FILE* handle, UINT16* numlumps, const char* lumpname)
|
||||||
{
|
{
|
||||||
lumpinfo_t* lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
|
lumpinfo_t* lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
|
||||||
lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
|
|
||||||
lumpinfo->position = 0;
|
lumpinfo->position = 0;
|
||||||
fseek(handle, 0, SEEK_END);
|
fseek(handle, 0, SEEK_END);
|
||||||
lumpinfo->size = ftell(handle);
|
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)));
|
CONS_Alert(CONS_ERROR, "Failed to read central directory (%s)\n", strerror(ferror(handle)));
|
||||||
Z_Free(lumpinfo);
|
Z_Free(lumpinfo);
|
||||||
free(zentry);
|
free(zentries);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (memcmp(zentry->signature, pat_central, 4))
|
if (memcmp(zentry->signature, pat_central, 4))
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, "Central directory is corrupt\n");
|
CONS_Alert(CONS_ERROR, "Central directory is corrupt\n");
|
||||||
Z_Free(lumpinfo);
|
Z_Free(lumpinfo);
|
||||||
free(zentry);
|
free(zentries);
|
||||||
return NULL;
|
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)));
|
CONS_Alert(CONS_ERROR, "Unable to read lumpname (%s)\n", strerror(ferror(handle)));
|
||||||
Z_Free(lumpinfo);
|
Z_Free(lumpinfo);
|
||||||
free(zentry);
|
free(zentries);
|
||||||
free(fullname);
|
free(fullname);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -629,6 +634,8 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(zentries);
|
||||||
|
|
||||||
*nlmp = numlumps;
|
*nlmp = numlumps;
|
||||||
return lumpinfo;
|
return lumpinfo;
|
||||||
}
|
}
|
||||||
|
@ -1314,8 +1321,9 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si
|
||||||
{
|
{
|
||||||
size = 0;
|
size = 0;
|
||||||
zerr(zErr);
|
zerr(zErr);
|
||||||
(void)inflateEnd(&strm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void)inflateEnd(&strm);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,10 +36,6 @@ ifndef GCC44
|
||||||
#OPTS+=-mms-bitfields
|
#OPTS+=-mms-bitfields
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef MINGW64
|
|
||||||
OPTS+=-gdwarf-2
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef SDL
|
ifndef SDL
|
||||||
OPTS+=-D_WINDOWS
|
OPTS+=-D_WINDOWS
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -91,6 +91,7 @@
|
||||||
<Import Project="..\..\libs\FMOD.props" />
|
<Import Project="..\..\libs\FMOD.props" />
|
||||||
<Import Project="..\..\libs\zlib.props" />
|
<Import Project="..\..\libs\zlib.props" />
|
||||||
<Import Project="..\..\libs\libpng.props" />
|
<Import Project="..\..\libs\libpng.props" />
|
||||||
|
<Import Project="..\..\libs\libgme.props" />
|
||||||
<Import Project="SRB2Win.props" />
|
<Import Project="SRB2Win.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
|
|
@ -5,7 +5,10 @@
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<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>
|
</ClCompile>
|
||||||
<Link />
|
<Link />
|
||||||
<Link>
|
<Link>
|
||||||
|
|
|
@ -147,7 +147,7 @@ static inline BOOL LoadDirectDraw(VOID)
|
||||||
DDrawDLL = LoadLibraryA("DDRAW.DLL");
|
DDrawDLL = LoadLibraryA("DDRAW.DLL");
|
||||||
if (DDrawDLL == NULL)
|
if (DDrawDLL == NULL)
|
||||||
return false;
|
return false;
|
||||||
pfnDirectDrawCreate = (DDCreate)GetProcAddress(DDrawDLL, "DirectDrawCreate");
|
pfnDirectDrawCreate = (DDCreate)(LPVOID)GetProcAddress(DDrawDLL, "DirectDrawCreate");
|
||||||
if (pfnDirectDrawCreate == NULL)
|
if (pfnDirectDrawCreate == NULL)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -3395,7 +3395,7 @@ BOOL LoadDirectInput(VOID)
|
||||||
DInputDLL = LoadLibraryA("DINPUT.DLL");
|
DInputDLL = LoadLibraryA("DINPUT.DLL");
|
||||||
if (DInputDLL == NULL)
|
if (DInputDLL == NULL)
|
||||||
return false;
|
return false;
|
||||||
pfnDirectInputCreateA = (DICreateA)GetProcAddress(DInputDLL, "DirectInputCreateA");
|
pfnDirectInputCreateA = (DICreateA)(LPVOID)GetProcAddress(DInputDLL, "DirectInputCreateA");
|
||||||
if (pfnDirectInputCreateA == NULL)
|
if (pfnDirectInputCreateA == NULL)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -3529,7 +3529,7 @@ void I_GetDiskFreeSpace(INT64* freespace)
|
||||||
|
|
||||||
if (!testwin95)
|
if (!testwin95)
|
||||||
{
|
{
|
||||||
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
|
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
|
||||||
testwin95 = true;
|
testwin95 = true;
|
||||||
}
|
}
|
||||||
if (pfnGetDiskFreeSpaceEx)
|
if (pfnGetDiskFreeSpaceEx)
|
||||||
|
@ -3615,7 +3615,7 @@ const CPUInfoFlags *I_CPUInfo(void)
|
||||||
{
|
{
|
||||||
static CPUInfoFlags WIN_CPUInfo;
|
static CPUInfoFlags WIN_CPUInfo;
|
||||||
SYSTEM_INFO SI;
|
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));
|
ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo));
|
||||||
if (pfnCPUID)
|
if (pfnCPUID)
|
||||||
|
@ -3658,9 +3658,9 @@ static p_SetProcessAffinityMask pfnSetProcessAffinityMask = NULL;
|
||||||
static inline VOID GetAffinityFuncs(VOID)
|
static inline VOID GetAffinityFuncs(VOID)
|
||||||
{
|
{
|
||||||
HMODULE h = GetModuleHandleA("kernel32.dll");
|
HMODULE h = GetModuleHandleA("kernel32.dll");
|
||||||
pfnGetCurrentProcess = (p_GetCurrentProcess)GetProcAddress(h, "GetCurrentProcess");
|
pfnGetCurrentProcess = (p_GetCurrentProcess)(LPVOID)GetProcAddress(h, "GetCurrentProcess");
|
||||||
pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)GetProcAddress(h, "GetProcessAffinityMask");
|
pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)(LPVOID)GetProcAddress(h, "GetProcessAffinityMask");
|
||||||
pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)GetProcAddress(h, "SetProcessAffinityMask");
|
pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)(LPVOID)GetProcAddress(h, "SetProcessAffinityMask");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CPUAffinity_OnChange(void)
|
static void CPUAffinity_OnChange(void)
|
||||||
|
|
Loading…
Reference in a new issue