Compare commits

...
Author SHA1 Message Date
Alug d4a494d7ae opengl: replace mipmap linked list with unordered map
this seems to cut the time spent searching the list for color mipmaps in half
2026-01-20 15:43:36 +01:00
Alug aa96f9ceb3 V_DrawVhsEffect: fix scaling with highreshudscale, fix downwards bar going out of screen bounds
this shouldnt account for highreshudscale at all
on very high resolutions the bars are still only half size, but atleast they dont become minuscule or just dont draw at all
also ensures both bars are clamped, on some resolutions sometimes they just go out of visible screen range
2026-01-20 14:57:18 +01:00
Alug 104b8260fb add reducevfx to accesability menu
If there are things that should be handled by that toggle def feel free to suggest them!
2026-01-19 14:35:10 +01:00
Alug edebc728ef remove unused stuff from joyinfo 2026-01-18 19:00:05 +01:00
Alug 08e7ce3b5b m_menu: clean up the skin display stuff a little 2026-01-16 13:27:20 +01:00
Alug 29f187b751 fix some windoze specific "-Wzero-as-null-pointer-constant" warnings 2026-01-16 12:53:34 +01:00
indev ac3a1ad5eb Add gcc 13.3 into list of supported versions 2026-01-16 12:02:21 +03:00
indev 1b8d7b1541 I_Error when dedi tries to go to main error
This will not fix the issue entirely but will at least prevent server
getting stuck and backtrace will show where did it try to go into menu from
2026-01-16 11:11:36 +03:00
Alug b812d61da2 Merge branch 'crashissuereports' into Saturn-Next 2026-01-14 12:58:44 +01:00
indev 6fd64383d3 This isn't ceepeepee rn :SmolBuncle: 2026-01-12 22:33:30 +03:00
Alug e984e7a6c8 Merge branch 'menumodels' into Saturn-Next 2026-01-12 19:13:21 +01:00
Alug 51aec0e012 Merge branch 'menumodels' into Saturn-Next 2026-01-12 18:40:38 +01:00
Alug f38ca9aa28 Signal Handler: Add button to report issues to github
mostly based on what srb2 does with some stuff from srb2-legacy
the button will attempt to open the issue page on the saturn git when a crash occurs
2025-12-27 12:41:41 +01:00
14 changed files with 309 additions and 236 deletions

No files matched your search

+1 -1
View File
@@ -66,7 +66,7 @@ endif
gcc_versions:=\
152 151 150 15\
142 141 140 14\
132 131 130 13\
133 132 131 130 13\
123 122 121 120 12\
114 113 112 111 110 11\
105 104 103 102 101 100 10\
+3
View File
@@ -946,6 +946,9 @@ void D_ClearState(void)
//
void D_StartTitle(void)
{
if (dedicated)
I_Error("D_StartTitle is called on dedicated server");
D_ClearState();
multiplayer = netgame = false; // title menu shouldnt be a netgame or multiplayer lmao
F_StartTitleScreen();
+3 -5
View File
@@ -945,6 +945,8 @@ void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT8 color)
static void G_ResetPlayerGamepadIndicatorColor(INT32 playernum)
{
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
if (cv_gamepadled[playernum].value == 0)
{
I_SetGamepadIndicatorColor(playernum, 0, 0, 255);
@@ -973,13 +975,8 @@ void G_DeviceLEDTick(void)
newcolor = G_GetSkinColorForGamepad(i);
// compiler be absolutely tripping
// delet this if this gets fixed within gcc
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
if (curcolor[i] == newcolor) // dont update if same colour
continue;
#pragma GCC diagnostic pop
G_SetPlayerGamepadIndicatorColor(i, newcolor);
curcolor[i] = newcolor;
@@ -994,6 +991,7 @@ void G_ResetDeviceLED(void)
static void G_ResetPlayerDeviceRumble(INT32 playernum)
{
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
I_GamepadRumble(playernum, 0, 0, 0);
}
+1 -1
View File
@@ -2,7 +2,7 @@ hw_bsp.c
hw_draw.c
hw_main.cpp
hw_clip.c
hw_md2.c
hw_md2.cpp
hw_cache.c
hw_md2load.c
hw_md3load.c
+45 -31
View File
@@ -16,6 +16,7 @@
#ifdef HWRENDER
#include <unordered_set>
#include <unordered_map>
#include "hw_main.h"
#include "hw_glob.h"
@@ -35,6 +36,10 @@
#include "../p_spec.h" // anim_t
#include "../r_sky.h"
struct ColorMipMap {
std::unordered_map<const UINT8*, GLMipmap_t*> map;
};
INT32 patchformat = GL_TEXFMT_AP_88; // use alpha for holes
INT32 textureformat = GL_TEXFMT_P_8; // use chromakey for hole
@@ -448,7 +453,7 @@ typedef struct
} GLMapTextureSet_t; // idk i suck at naming things
static size_t gl_numtextures = 0; // Texture count
static GLMapTextureSet_t *gl_textures; // For all textures
static GLMapTextureSet_t *gl_textures = NULL; // For all textures
static void HWR_FreeTextureData(patch_t *patch)
{
@@ -504,34 +509,31 @@ static void HWR_FreeTextureColormaps(patch_t *patch)
return;
// The mipmap must be valid, obviously
while (pat->mipmap)
if (!pat->mipmap)
return;
if (pat->mipmap->nextcolormap)
{
// Confusing at first, but pat->mipmap->nextcolormap
// at the beginning of the loop is the first colormap
// from the linked list of colormaps.
GLMipmap_t *next = NULL;
for (auto& pair : pat->mipmap->nextcolormap->map)
{
GLMipmap_t *glMipmap = pair.second;
// No mipmap in this patch, break out of the loop.
if (!pat->mipmap)
break;
if (glMipmap)
{
// Free image data from memory.
Z_Free(glMipmap->data);
Z_Free(glMipmap->colormap);
glMipmap->data = NULL;
glMipmap->colormap = NULL;
GL_DeleteTexture(glMipmap);
// No colormap mipmaps either.
if (!pat->mipmap->nextcolormap)
break;
// Free the colormap mipmap from memory.
free(glMipmap);
}
}
// Set the first colormap to the one that comes after it.
next = pat->mipmap->nextcolormap;
pat->mipmap->nextcolormap = next->nextcolormap;
// Free image data from memory.
Z_Free(next->data);
Z_Free(next->colormap);
next->data = NULL;
next->colormap = NULL;
GL_DeleteTexture(next);
// Free the old colormap mipmap from memory.
free(next);
delete pat->mipmap->nextcolormap;
pat->mipmap->nextcolormap = NULL;
}
}
@@ -1085,7 +1087,7 @@ void HWR_GetPatch(patch_t *patch)
void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap)
{
GLPatch_t *glPatch;
GLMipmap_t *glMipmap, *newMipmap;
GLMipmap_t *newMipmap;
if (!patch->hardware)
Patch_CreateGL(patch);
@@ -1099,11 +1101,19 @@ void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap)
return;
}
// search for the mipmap
// skip the first (no colormap translated)
for (glMipmap = glPatch->mipmap; glMipmap->nextcolormap;)
// gotta make our map if theres none
if (!glPatch->mipmap->nextcolormap)
{
glMipmap = glMipmap->nextcolormap;
glPatch->mipmap->nextcolormap = new ColorMipMap();
}
// search for the mipmap
auto& map = glPatch->mipmap->nextcolormap->map;
auto it = map.find(colormap);
if (it != map.end())
{
GLMipmap_t *glMipmap = it->second;
if (glMipmap->colormap && glMipmap->colormap->source == colormap)
{
@@ -1113,7 +1123,9 @@ void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap)
HWR_UpdatePatchMipmap(patch, glMipmap);
}
else
{
HWR_LoadPatchMipmap(patch, glMipmap);
}
return;
}
@@ -1128,7 +1140,9 @@ void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap)
newMipmap = static_cast<GLMipmap_t *>(calloc(1, sizeof (*newMipmap)));
if (newMipmap == NULL)
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
glMipmap->nextcolormap = newMipmap;
// add to nextcolormap map
map[colormap] = newMipmap;
newMipmap->colormap = static_cast<GLColormap_t *>(Z_Calloc(sizeof(*newMipmap->colormap), PU_HWRPATCHCOLMIPMAP, NULL));
newMipmap->colormap->source = colormap;
+2 -1
View File
@@ -23,6 +23,7 @@
typedef enum GLTextureFormat_e
{
GL_TEXFMT_NULL = 0x00,
GL_TEXFMT_P_8 = 0x01, /* 8-bit palette */
GL_TEXFMT_AP_88 = 0x02, /* 8-bit alpha, 8-bit palette */
@@ -54,7 +55,7 @@ struct GLMipmap_s
UINT16 width, height;
UINT32 downloaded; // The GPU has this texture.
struct GLMipmap_s *nextcolormap;
struct ColorMipMap *nextcolormap;
struct GLColormap_s *colormap;
};
typedef struct GLMipmap_s GLMipmap_t;
@@ -13,6 +13,7 @@
/// Inspired from md2.c by Mete Ciragan (mete@swissquake.ch)
#include "hw_data.h"
#ifdef __GNUC__
#include <unistd.h>
#endif
@@ -72,6 +73,12 @@
#include <errno.h>
#endif
#include <unordered_map>
struct ColorMipMap {
std::unordered_map<const UINT8*, GLMipmap_t*> map;
};
md2_t md2_models[NUMSPRITES] = {};
md2_t md2_playermodels[MAXSKINS] = {};
md2_t md2_localplayermodels[MAXLOCALSKINS] = {};
@@ -93,10 +100,10 @@ static void md2_freeModel (model_t *model)
static model_t *md2_readModel(const char *filename)
{
//Filename checking fixed ~Monster Iestyn and Golden
if (FIL_FileExists(va("%s"PATHSEP"%s", srb2home, filename)))
return LoadModel(va("%s"PATHSEP"%s", srb2home, filename), PU_STATIC);
else if (FIL_FileExists(va("%s"PATHSEP"%s", srb2path, filename)))
return LoadModel(va("%s"PATHSEP"%s", srb2path, filename), PU_STATIC);
if (FIL_FileExists(va("%s" PATHSEP "%s", srb2home, filename)))
return LoadModel(va("%s" PATHSEP "%s", srb2home, filename), PU_STATIC);
else if (FIL_FileExists(va("%s" PATHSEP "%s", srb2path, filename)))
return LoadModel(va("%s" PATHSEP "%s", srb2path, filename), PU_STATIC);
return NULL;
}
@@ -159,18 +166,18 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
#endif
volatile png_FILE_p png_FILE;
//Filename checking fixed ~Monster Iestyn and Golden
char *pngfilename = va("%s"PATHSEP"mdls"PATHSEP"%s", srb2home, filename);
char *pngfilename = va("%s" PATHSEP "mdls" PATHSEP "%s", srb2home, filename);
FIL_ForceExtension(pngfilename, ".png");
png_FILE = fopen(pngfilename, "rb");
if (!png_FILE)
{
pngfilename = va("%s"PATHSEP"mdls"PATHSEP"%s", srb2path, filename);
pngfilename = va("%s" PATHSEP "mdls" PATHSEP "%s", srb2path, filename);
FIL_ForceExtension(pngfilename, ".png");
png_FILE = fopen(pngfilename, "rb");
//CONS_Debug(DBG_RENDER, "M_SavePNG: Error on opening %s for loading\n", filename);
if (!png_FILE)
return 0;
return GL_TEXFMT_NULL;
}
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL,
@@ -179,7 +186,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
{
CONS_Debug(DBG_RENDER, "PNG_Load: Error on initialize libpng\n");
fclose(png_FILE);
return 0;
return GL_TEXFMT_NULL;
}
png_info_ptr = png_create_info_struct(png_ptr);
@@ -188,7 +195,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
CONS_Debug(DBG_RENDER, "PNG_Load: Error on allocate for libpng\n");
png_destroy_read_struct(&png_ptr, NULL, NULL);
fclose(png_FILE);
return 0;
return GL_TEXFMT_NULL;
}
#ifdef USE_FAR_KEYWORD
@@ -201,7 +208,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL);
fclose(png_FILE);
Z_Free(glpatch->mipmap->data);
return 0;
return GL_TEXFMT_NULL;
}
#ifdef USE_FAR_KEYWORD
png_memcpy(png_jmpbuf(png_ptr), jmpbuf, sizeof jmp_buf);
@@ -241,8 +248,8 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
{
png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr);
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRMODELTEXTURE, &glpatch->mipmap->data);
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
png_bytep PNG_image = static_cast<png_bytep>(Z_Malloc(pitch*height, PU_HWRMODELTEXTURE, &glpatch->mipmap->data));
png_bytepp row_pointers = static_cast<png_bytepp>(png_malloc(png_ptr, height * sizeof (png_bytep)));
for (i = 0; i < height; i++)
row_pointers[i] = PNG_image + i*pitch;
png_read_image(png_ptr, row_pointers);
@@ -292,42 +299,42 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
INT32 ch, rep;
FILE *file;
//Filename checking fixed ~Monster Iestyn and Golden
char *pcxfilename = va("%s"PATHSEP"mdls"PATHSEP"%s", srb2home, filename);
char *pcxfilename = va("%s" PATHSEP "mdls" PATHSEP "%s", srb2home, filename);
FIL_ForceExtension(pcxfilename, ".pcx");
file = fopen(pcxfilename, "rb");
if (!file)
{
pcxfilename = va("%s"PATHSEP"mdls"PATHSEP"%s", srb2path, filename);
pcxfilename = va("%s" PATHSEP "mdls" PATHSEP "%s", srb2path, filename);
FIL_ForceExtension(pcxfilename, ".pcx");
file = fopen(pcxfilename, "rb");
if (!file)
return 0;
return GL_TEXFMT_NULL;
}
if (fread(&header, sizeof (PcxHeader), 1, file) != 1)
{
fclose(file);
return 0;
return GL_TEXFMT_NULL;
}
if (header.bitsPerPixel != 8)
{
fclose(file);
return 0;
return GL_TEXFMT_NULL;
}
fseek(file, -PALSIZE, SEEK_END);
pw = *w = header.xmax - header.xmin + 1;
ph = *h = header.ymax - header.ymin + 1;
image = Z_Malloc(pw*ph*4, PU_HWRMODELTEXTURE, &glpatch->mipmap->data);
image = static_cast<RGBA_t *>(Z_Malloc(pw*ph*4, PU_HWRMODELTEXTURE, &glpatch->mipmap->data));
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
{
Z_Free(image);
fclose(file);
return 0;
return GL_TEXFMT_NULL;
}
fseek(file, sizeof (PcxHeader), SEEK_SET);
@@ -369,8 +376,8 @@ static void md2_loadTexture(md2_t *model)
if (model->glpatch)
{
patch = model->glpatch;
glPatch = (GLPatch_t *)(patch->hardware);
patch = static_cast<patch_t *>(model->glpatch);
glPatch = static_cast<GLPatch_t *>(patch->hardware);
if (glPatch)
Z_Free(glPatch->mipmap->data);
}
@@ -381,7 +388,7 @@ static void md2_loadTexture(md2_t *model)
Patch_AllocateHardwarePatch(patch);
if (glPatch == NULL)
glPatch = (GLPatch_t *)(patch->hardware);
glPatch = static_cast<GLPatch_t *>(patch->hardware);
if (!glPatch->mipmap->downloaded && !glPatch->mipmap->data)
{
@@ -389,10 +396,10 @@ static void md2_loadTexture(md2_t *model)
#ifdef HAVE_PNG
glPatch->mipmap->format = PNG_Load(filename, &w, &h, glPatch);
if (glPatch->mipmap->format == 0)
if (glPatch->mipmap->format == GL_TEXFMT_NULL)
#endif
glPatch->mipmap->format = PCX_Load(filename, &w, &h, glPatch);
if (glPatch->mipmap->format == 0)
if (glPatch->mipmap->format == GL_TEXFMT_NULL)
{
model->notexturefile = true; // mark it so its not searched for again repeatedly
return;
@@ -412,7 +419,7 @@ static void md2_loadTexture(md2_t *model)
UINT32 size;
RGBA_t *image;
// Lactozilla: Apply colour cube
image = glPatch->mipmap->data;
image = static_cast<RGBA_t *>(glPatch->mipmap->data);
size = w*h;
while (size--)
{
@@ -433,7 +440,7 @@ static void md2_loadBlendTexture(md2_t *model)
patch_t *patch;
GLPatch_t *glPatch = NULL;
char *filename = Z_Malloc(strlen(model->filename)+7, PU_STATIC, NULL);
char *filename = static_cast<char *>(Z_Malloc(strlen(model->filename)+7, PU_STATIC, NULL));
strcpy(filename, model->filename);
@@ -441,8 +448,8 @@ static void md2_loadBlendTexture(md2_t *model)
if (model->blendglpatch)
{
patch = model->blendglpatch;
glPatch = (GLPatch_t *)(patch->hardware);
patch = static_cast<patch_t *>(model->blendglpatch);
glPatch = static_cast<GLPatch_t *>(patch->hardware);
if (glPatch)
Z_Free(glPatch->mipmap->data);
}
@@ -453,17 +460,17 @@ static void md2_loadBlendTexture(md2_t *model)
Patch_AllocateHardwarePatch(patch);
if (glPatch == NULL)
glPatch = (GLPatch_t *)(patch->hardware);
glPatch = static_cast<GLPatch_t *>(patch->hardware);
if (!glPatch->mipmap->downloaded && !glPatch->mipmap->data)
{
int w = 0, h = 0;
#ifdef HAVE_PNG
glPatch->mipmap->format = PNG_Load(filename, &w, &h, glPatch);
if (glPatch->mipmap->format == 0)
if (glPatch->mipmap->format == GL_TEXFMT_NULL)
#endif
glPatch->mipmap->format = PCX_Load(filename, &w, &h, glPatch);
if (glPatch->mipmap->format == 0)
if (glPatch->mipmap->format == GL_TEXFMT_NULL)
{
model->noblendfile = true; // mark it so its not searched for again repeatedly
Z_Free(filename);
@@ -532,11 +539,11 @@ void HWR_InitMD2(void)
// read the mdls.dat file
//Filename checking fixed ~Monster Iestyn and Golden
f = fopen(va("%s"PATHSEP"%s", srb2home, "mdls.dat"), "rt");
f = fopen(va("%s" PATHSEP "%s", srb2home, "mdls.dat"), "rt");
if (!f)
{
f = fopen(va("%s"PATHSEP"%s", srb2path, "mdls.dat"), "rt");
f = fopen(va("%s" PATHSEP "%s", srb2path, "mdls.dat"), "rt");
if (!f)
{
CONS_Printf("%s %s\n", M_GetText("Error while loading mdls.dat:"), strerror(errno));
@@ -593,11 +600,11 @@ void HWR_AddPlayerMD2(int skin, boolean local) // For MD2's that were added afte
// read the mdls.dat file
//Filename checking fixed ~Monster Iestyn and Golden
f = fopen(va("%s"PATHSEP"%s", srb2home, "mdls.dat"), "rt");
f = fopen(va("%s" PATHSEP "%s", srb2home, "mdls.dat"), "rt");
if (!f)
{
f = fopen(va("%s"PATHSEP"%s", srb2path, "mdls.dat"), "rt");
f = fopen(va("%s" PATHSEP "%s", srb2path, "mdls.dat"), "rt");
if (!f)
{
CONS_Printf("%s %s\n", M_GetText("Error while loading mdls.dat:"), strerror(errno));
@@ -645,11 +652,11 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu
// Read the md2.dat file
//Filename checking fixed ~Monster Iestyn and Golden
f = fopen(va("%s"PATHSEP"%s", srb2home, "mdls.dat"), "rt");
f = fopen(va("%s" PATHSEP "%s", srb2home, "mdls.dat"), "rt");
if (!f)
{
f = fopen(va("%s"PATHSEP"%s", srb2path, "mdls.dat"), "rt");
f = fopen(va("%s" PATHSEP "%s", srb2path, "mdls.dat"), "rt");
if (!f)
{
@@ -689,8 +696,8 @@ spritemd2found:
static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMipmap_t *glMipmap, INT32 skinnum, skincolors_t color)
{
GLPatch_t *hwrPatch = gpatch->hardware;
GLPatch_t *hwrBlendPatch = blendgpatch->hardware;
GLPatch_t *hwrPatch = static_cast<GLPatch_t *>(gpatch->hardware);
GLPatch_t *hwrBlendPatch = static_cast<GLPatch_t *>(blendgpatch->hardware);
UINT16 w = gpatch->width, h = gpatch->height;
UINT32 size = w*h;
RGBA_t *image, *blendimage, *cur, blendcolor;
@@ -722,11 +729,11 @@ static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMi
glMipmap->data = NULL;
}
cur = Z_Malloc(size*4, PU_HWRMODELTEXTURE, &glMipmap->data);
cur = static_cast<RGBA_t *>(Z_Malloc(size*4, PU_HWRMODELTEXTURE, &glMipmap->data));
memset(cur, 0x00, size*4);
image = hwrPatch->mipmap->data;
blendimage = hwrBlendPatch->mipmap->data;
image = static_cast<RGBA_t *>(hwrPatch->mipmap->data);
blendimage = static_cast<RGBA_t *>(hwrBlendPatch->mipmap->data);
// TC_METALSONIC includes an actual skincolor translation, on top of its flashing.
if (skinnum == TC_METALSONIC)
@@ -972,15 +979,15 @@ static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMi
colorbright = 1; // no dividing by 0 please
tempcolor = (brightness * blendcolor.s.red) / colorbright;
tempcolor = min(255, tempcolor);
tempcolor = std::min<UINT32>(255, tempcolor);
cur->s.red = (UINT8)tempcolor;
tempcolor = (brightness * blendcolor.s.green) / colorbright;
tempcolor = min(255, tempcolor);
tempcolor = std::min<UINT32>(255, tempcolor);
cur->s.green = (UINT8)tempcolor;
tempcolor = (brightness * blendcolor.s.blue) / colorbright;
tempcolor = min(255, tempcolor);
tempcolor = std::min<UINT32>(255, tempcolor);
cur->s.blue = (UINT8)tempcolor;
cur->s.alpha = image->s.alpha;
}
@@ -990,15 +997,15 @@ static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMi
INT32 tempcolor;
tempcolor = ((image->s.red * (255-blendimage->s.alpha)) / 255) + ((blendcolor.s.red * blendimage->s.alpha) / 255);
tempcolor = min(255, tempcolor);
tempcolor = std::min<UINT32>(255, tempcolor);
cur->s.red = (UINT8)tempcolor;
tempcolor = ((image->s.green * (255-blendimage->s.alpha)) / 255) + ((blendcolor.s.green * blendimage->s.alpha) / 255);
tempcolor = min(255, tempcolor);
tempcolor = std::min<UINT32>(255, tempcolor);
cur->s.green = (UINT8)tempcolor;
tempcolor = ((image->s.blue * (255-blendimage->s.alpha)) / 255) + ((blendcolor.s.blue * blendimage->s.alpha) / 255);
tempcolor = min(255, tempcolor);
tempcolor = std::min<UINT32>(255, tempcolor);
cur->s.blue = (UINT8)tempcolor;
cur->s.alpha = image->s.alpha;
}
@@ -1034,22 +1041,30 @@ skippixel:
static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolors_t color)
{
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
GLPatch_t *glPatch = patch->hardware;
GLMipmap_t *glMipmap, *newMipmap;
GLPatch_t *glPatch = static_cast<GLPatch_t *>(patch->hardware);
GLMipmap_t *newMipmap;
if (blendgpatch == NULL || colormap == colormaps || colormap == NULL)
if (blendgpatch == NULL || colormap == colormaps
|| colormap == NULL || colormap == (const UINT8*)(COLORMAP_REMAPOFFSET))
{
// Don't do any blending
GL_SetTexture(glPatch->mipmap);
return;
}
// search for the Mipmap
// skip the first (no colormap translated)
for (glMipmap = glPatch->mipmap; glMipmap->nextcolormap; )
// gotta make our map if theres none
if (!glPatch->mipmap->nextcolormap)
{
glMipmap = glMipmap->nextcolormap;
glPatch->mipmap->nextcolormap = new ColorMipMap();
}
// search for the Mipmap
auto& map = glPatch->mipmap->nextcolormap->map;
auto it = map.find(colormap);
if (it != map.end())
{
GLMipmap_t *glMipmap = it->second;
if (glMipmap->colormap && glMipmap->colormap->source == colormap)
{
@@ -1077,12 +1092,14 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendgpatch, INT32 sk
// (it have a liste of mipmap)
// this malloc is cleared in HWR_FreeTextureCache
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
newMipmap = calloc(1, sizeof (*newMipmap));
newMipmap = static_cast<GLMipmap_t *>(calloc(1, sizeof(*newMipmap)));
if (newMipmap == NULL)
I_Error("%s: Out of memory", "HWR_GetBlendedTexture");
glMipmap->nextcolormap = newMipmap;
newMipmap->colormap = Z_Calloc(sizeof(*newMipmap->colormap), PU_HWRPATCHCOLMIPMAP, NULL);
// add to nextcolormap map
map[colormap] = newMipmap;
newMipmap->colormap = static_cast<GLColormap_t *>(Z_Calloc(sizeof(*newMipmap->colormap), PU_HWRPATCHCOLMIPMAP, NULL));
newMipmap->colormap->source = colormap;
memcpy(newMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
@@ -1179,7 +1196,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
else
blendmode = spr->mobj->blendmode;
blendmode = min(AST_MODULATE, blendmode);
blendmode = std::min<INT32>(AST_MODULATE, blendmode);
if (spr->mobj->flags2 & MF2_SHADOW)
{
@@ -1268,7 +1285,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
}
//Hurdler: arf, I don't like that implementation at all... too much crappy
gpatch = md2->glpatch;
gpatch = static_cast<patch_t *>(md2->glpatch);
if (gpatch)
hwrPatch = ((GLPatch_t *)gpatch->hardware);
@@ -1277,12 +1294,12 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
md2_loadTexture(md2);
// Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
gpatch = md2->glpatch;
gpatch = static_cast<patch_t *>(md2->glpatch);
if (gpatch)
hwrPatch = ((GLPatch_t *)gpatch->hardware);
// Load blend texture
blendgpatch = md2->blendglpatch;
blendgpatch = static_cast<patch_t *>(md2->blendglpatch);
if (blendgpatch)
hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware);
@@ -1292,7 +1309,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
md2_loadBlendTexture(md2);
// Load it again, because it isn't being loaded into blendgpatch after md2_loadblendtexture...
blendgpatch = md2->blendglpatch;
blendgpatch = static_cast<patch_t *>(md2->blendglpatch);
if (blendgpatch)
hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware);
+57 -57
View File
@@ -7902,7 +7902,7 @@ static void M_HandleConnectIP(INT32 choice)
if (exitmenu)
{
if (currentMenu->prevMenu)
M_SetupNextMenu (currentMenu->prevMenu);
M_SetupNextMenu(currentMenu->prevMenu);
else
M_ClearMenus(true);
}
@@ -8271,10 +8271,9 @@ static void M_DrawSetupMultiPlayerMenu(void)
INT32 curx = (((setupm_skinselect % SKINGRIDNEWWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDNEWWIDTH/2)) + SKINXSHIFT) + 20;
INT32 cury = (((setupm_skinselect / SKINGRIDNEWWIDTH) - setupm_skinypos) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDNEWWIDTH/2))+ gridyoffset);
UINT8 cursorframe = (I_GetTime() / 4) % 7;
cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH);
V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL);
UINT8 cursorframe = (I_GetTime() / 4) % 7;
cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH);
V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL);
}
break;
@@ -8313,14 +8312,12 @@ static void M_DrawSetupMultiPlayerMenu(void)
if (setupm_skinselect < numskins)
{
UINT8 *cmap = R_GetTranslationColormap(setupm_skinselect, setupm_fakecolor, GTC_MENUCACHE);
cursor = facewantprefix[skinsorted[setupm_skinselect]];
V_DrawFixedPatch(((curx-8) << FRACBITS), ((cury-8) << FRACBITS), FRACUNIT, 0, cursor, cmap);
}
else
{
UINT8 cursorframe = (I_GetTime() / 4) % 7;
cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH);
V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL);
}
@@ -8384,7 +8381,6 @@ static void M_DrawSetupMultiPlayerMenu(void)
else
{
UINT8 cursorframe = (I_GetTime() / 4) % 7;
cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH);
V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL);
}
@@ -8509,7 +8505,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
switch (cv_skinselectmenu.value)
{
case SKINMENUTYPE_2D:
skintodisplay = setupm_fakeskin;
skintodisplay = (UINT8)setupm_fakeskin;
if (setupm_skinlockedselect) // show the skin we are trying to select
skintodisplay = skinstats[setupm_skinxpos][setupm_skinypos][setupm_skinselect];
else if (skinstatscount[setupm_skinxpos][setupm_skinypos] && itemOn == 1)
@@ -8517,13 +8513,16 @@ static void M_DrawSetupMultiPlayerMenu(void)
break;
case SKINMENUTYPE_EXTENDED:
case SKINMENUTYPE_GRID:
skintodisplay = (itemOn == 1 && setupm_skinselect < numskins ? skinsorted[setupm_skinselect] : setupm_fakeskin);
skintodisplay = ((itemOn == 1 && (setupm_skinselect < numskins)) ? skinsorted[setupm_skinselect] : (UINT8)setupm_fakeskin);
break;
default:
skintodisplay = setupm_fakeskin;
skintodisplay = (UINT8)setupm_fakeskin;
break;
}
if (skintodisplay >= MAXSKINS)
skintodisplay = 0;
skinnum = R_SkinAvailable(skins[skintodisplay].name);
if (skinnum < 0 || skinnum >= MAXSKINS)
@@ -8538,18 +8537,6 @@ static void M_DrawSetupMultiPlayerMenu(void)
if (frame >= sprdef->numframes) // Walking animation missing
frame = 0; // Try to use standing frame
sprframe = &sprdef->spriteframes[frame];
// minenice's speen css, it's a piece of shit but hey
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
// this is a very shitty solution for checking if a sprite needs flipping
// but it works
if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
flags = V_FLIP; // This sprite is left/right flipped!
patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
// draw box around guy
V_DrawFill(mx + 36 - (charw/2), my+65, charw, 84, 239);
#undef charw
@@ -8560,33 +8547,47 @@ static void M_DrawSetupMultiPlayerMenu(void)
UINT8 *colormap = R_GetTranslationColormap(skintodisplay, setupm_fakecolor, GTC_MENUCACHE);
#ifdef HWRENDER
md2_t *md2 = &md2_playermodels[skinnum];
#endif
mx += 36;
my += 131;
#ifdef HWRENDER
// if we have 3d models enabled and a model exists
// try to show it instead of the sprite
if (rendermode == render_opengl && cv_glmdls.value
&& !md2->error && !md2->notfound)
{
mx += 36;
my += 131;
const angle_t ROTATE_PER_TIC = (UINT64)ANGLE_45 * cv_skinselectspin.value / TICRATE;
angle_t angle = I_GetTime()*ROTATE_PER_TIC + FixedMul(cv_uncappedhud.value ? renderdeltatics : FRACUNIT, ROTATE_PER_TIC);
HWR_Draw2DModel(md2, mx, my, skinnum, (skincolors_t)setupm_fakecolor, colormap, 8*FRACUNIT/3, frame, angle);
}
else
#endif
{
sprframe = &sprdef->spriteframes[frame];
// minenice's speen css, it's a piece of shit but hey
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
// this is a very shitty solution for checking if a sprite needs flipping
// but it works
if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
{
flags = V_FLIP; // This sprite is left/right flipped!
}
patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
if (skins[skintodisplay].flags & SF_HIRES)
{
V_DrawFixedPatch((mx+36)<<FRACBITS,
(my+131)<<FRACBITS,
skins[skintodisplay].highresscale,
flags, patch, colormap);
V_DrawFixedPatch(mx<<FRACBITS,
my<<FRACBITS,
skins[skintodisplay].highresscale,
flags, patch, colormap);
}
else
V_DrawMappedPatch(mx+36, my+131, flags, patch, colormap);
{
V_DrawMappedPatch(mx, my, flags, patch, colormap);
}
}
}
}
@@ -9889,7 +9890,7 @@ static void M_DrawLocalSkinMenu(void)
spriteframe_t *sprframe;
patch_t *patch;
UINT8 frame;
INT16 skintodisplay;
INT32 skintodisplay = 0;
UINT32 speenframe;
skin_t displayskin;
@@ -9942,25 +9943,10 @@ static void M_DrawLocalSkinMenu(void)
if (frame >= sprdef->numframes) // Walking animation missing
frame = 0; // Try to use standing frame
sprframe = &sprdef->spriteframes[frame];
//minenice's speen css, it's a piece of shit but hey
//patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[1], PU_PATCH);
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
//this is a very shitty solution for checking if a sprite needs flipping
//but it works
if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
{
flags = V_FLIP; // This sprite is left/right flipped!
}
patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
// draw box around guy
V_DrawFill(mx + 220 - (charw/2), my+54, charw, 84, 239);
#undef charw
// draw player sprite
UINT8 *colormap = R_GetLocalTranslationColormap(&skins[displayskin.localnum], (displayskin.localskin ? &localskins[displayskin.localnum] : NULL), cv_playercolor.value, GTC_MENUCACHE, displayskin.localskin);
V_DrawMappedPatch(mx, my+50, 0, (patch_t *)W_CachePatchName(displayskin.facewant, PU_PATCH), colormap);
@@ -9974,6 +9960,9 @@ static void M_DrawLocalSkinMenu(void)
V_DrawString(mx+20, my+118, V_ALLOWLOWERCASE|highlightflags, displayskin.realname);
// draw player sprite
mx += 220;
my += 120;
#ifdef HWRENDER
md2_t *md2 = (displayskin.localskin ? &md2_localplayermodels[skintodisplay] : &md2_playermodels[skintodisplay]);
@@ -9982,24 +9971,35 @@ static void M_DrawLocalSkinMenu(void)
if (rendermode == render_opengl && cv_glmdls.value
&& !md2->error && !md2->notfound)
{
mx += 220;
my += 120;
const angle_t ROTATE_PER_TIC = (UINT64)ANGLE_45 * cv_skinselectspin.value / TICRATE;
angle_t angle = I_GetTime()*ROTATE_PER_TIC + FixedMul(cv_uncappedhud.value ? renderdeltatics : FRACUNIT, ROTATE_PER_TIC);
HWR_Draw2DModel(md2, mx, my, skintodisplay, (skincolors_t)cv_playercolor.value, colormap, 8*FRACUNIT/3, frame, angle);
}
else
#endif
{
sprframe = &sprdef->spriteframes[frame];
// minenice's speen css, it's a piece of shit but hey
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
// this is a very shitty solution for checking if a sprite needs flipping
// but it works
if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
{
flags = V_FLIP; // This sprite is left/right flipped!
}
patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
if (displayskin.flags & SF_HIRES)
{
V_DrawFixedPatch((mx+220)<<FRACBITS, (my+120)<<FRACBITS, displayskin.highresscale, flags, patch, colormap);
V_DrawFixedPatch(mx<<FRACBITS, my<<FRACBITS, displayskin.highresscale, flags, patch, colormap);
}
else
V_DrawMappedPatch(mx+220, my+120, flags, patch, colormap);
{
V_DrawMappedPatch(mx, my, flags, patch, colormap);
}
}
}
+18 -16
View File
@@ -1633,33 +1633,34 @@ static menuitem_t OP_AccessibilityMenu[] =
{IT_STRING|IT_CVAR|IT_CV_SLIDER, NULL, "Saturation", &cv_globalsaturation, 25},
{IT_SUBMENU|IT_STRING, NULL, "Video Color Settings...", &OP_ColorOptionsDef, 30},
{IT_STRING|IT_CVAR, NULL, "Midnight Channel Flicker", &cv_lessflicker, 35},
{IT_STRING|IT_CVAR, NULL, "Reduce Effects", &cv_reducevfx, 35},
{IT_STRING|IT_CVAR, NULL, "Midnight Channel Flicker", &cv_lessflicker, 40}, // obsolete now? or still better be a seperate toggle?
{IT_STRING|IT_CVAR, NULL, "Minimum Sector Brightness", &cv_secbright, 40},
{IT_STRING|IT_CVAR, NULL, "Minimum Sector Brightness", &cv_secbright, 45},
#ifdef HWRENDER
{IT_STRING|IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 45},
{IT_STRING|IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 50},
#endif
{IT_STRING|IT_CVAR, NULL, "Water Surface Ripples", &cv_ripplewater, 50},
{IT_STRING|IT_CVAR, NULL, "Water Surface Ripples", &cv_ripplewater, 55},
{IT_STRING|IT_CVAR, NULL, "Fade Players near Camera", &cv_playerfade, 55},
{IT_STRING|IT_CVAR, NULL, "Fade Players near Camera", &cv_playerfade, 60},
{IT_STRING|IT_CVAR, NULL, "Quake Screenshakes", &cv_screenquake, 60},
{IT_STRING|IT_CVAR, NULL, "Quake Screenshakes", &cv_screenquake, 65},
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 65},
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 70},
{IT_HEADER, NULL, "Audio", NULL, 75},
{IT_HEADER, NULL, "Audio", NULL, 80},
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 85},
{IT_STRING|IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 90},
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 90},
{IT_STRING|IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 95},
{IT_HEADER, NULL, "Controls", NULL, 100},
{IT_HEADER, NULL, "Controls", NULL, 105},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P1)", &cv_autoaccel[0], 110},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P2)", &cv_autoaccel[1], 115},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P3)", &cv_autoaccel[2], 120},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P4)", &cv_autoaccel[3], 125},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P1)", &cv_autoaccel[0], 115},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P2)", &cv_autoaccel[1], 120},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P3)", &cv_autoaccel[2], 125},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P4)", &cv_autoaccel[3], 130},
};
static const char* OP_AccessibilityTooltips[] =
@@ -1669,10 +1670,11 @@ static const char* OP_AccessibilityTooltips[] =
"Gamma (brightness) of the game.",
"Saturation of the game.",
"Advanced color settings of the game.",
"Reduces or disables certain effects players might be sensitive to\nSuch as flashing, flickering, certain screen effects and more.",
"Disables the flicker effect on Midnight Channel.",
"Sets minimum sector brightness, useful for dark areas",
#ifdef HWRENDER
"Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.",
"Disabling Screen Textures will disable the Underwater and Heat screen effects.",
#endif
"Toggles the ripple effect on water surfaces",
"Fades other Players that are close to the camera in and out",
+76 -45
View File
@@ -727,12 +727,11 @@ static void JoyReset(SDLJoyInfo_t *JoySet)
JoySet->dev = NULL;
JoySet->oldjoy = -1;
JoySet->id = -1;
JoySet->axises = JoySet->buttons = JoySet->hats = JoySet->balls = 0;
}
/** \brief SDL info about joystick
*/
SDLJoyInfo_t JoyInfo[MAXSPLITSCREENPLAYERS];
SDLJoyInfo_t JoyInfo[MAXSPLITSCREENPLAYERS] = {};
INT32 numcontrollers = 0;
//
@@ -740,26 +739,26 @@ INT32 numcontrollers = 0;
//
void I_JoyScale(void)
{
Joystick[0].bGamepadStyle = cv_joyscale[0].value==0;
JoyInfo[0].scale = Joystick[0].bGamepadStyle?1:cv_joyscale[0].value;
Joystick[0].bGamepadStyle = cv_joyscale[0].value == 0;
JoyInfo[0].scale = Joystick[0].bGamepadStyle ? 1 : cv_joyscale[0].value;
}
void I_JoyScale2(void)
{
Joystick[1].bGamepadStyle = cv_joyscale[1].value==0;
JoyInfo[1].scale = Joystick[1].bGamepadStyle?1:cv_joyscale[1].value;
Joystick[1].bGamepadStyle = cv_joyscale[1].value == 0;
JoyInfo[1].scale = Joystick[1].bGamepadStyle ? 1 : cv_joyscale[1].value;
}
void I_JoyScale3(void)
{
Joystick[2].bGamepadStyle = cv_joyscale[2].value==0;
JoyInfo[2].scale = Joystick[2].bGamepadStyle?1:cv_joyscale[2].value;
Joystick[2].bGamepadStyle = cv_joyscale[2].value == 0;
JoyInfo[2].scale = Joystick[2].bGamepadStyle ? 1 : cv_joyscale[2].value;
}
void I_JoyScale4(void)
{
Joystick[3].bGamepadStyle = cv_joyscale[3].value==0;
JoyInfo[3].scale = Joystick[3].bGamepadStyle?1:cv_joyscale[3].value;
Joystick[3].bGamepadStyle = cv_joyscale[3].value == 0;
JoyInfo[3].scale = Joystick[3].bGamepadStyle ? 1 : cv_joyscale[3].value;
}
// Cheat to get the device index for a joystick handle
@@ -931,33 +930,18 @@ static int joy_open(int playerIndex, int joyIndex)
}
JoyInfo[playerIndex].dev = newdev;
JoyInfo[playerIndex].id = I_GetJoystickDeviceIndex(JoyInfo[playerIndex].dev);
if (JoyInfo[playerIndex].dev == NULL)
{
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: Couldn't open device - %s\n"), SDL_GetError());
return -1;
}
else
{
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_GameControllerName(JoyInfo[playerIndex].dev));
JoyInfo[playerIndex].axises = SDL_CONTROLLER_AXIS_MAX;
if (JoyInfo[playerIndex].axises > JOYAXISSET*2)
JoyInfo[playerIndex].axises = JOYAXISSET*2;
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_GameControllerName(JoyInfo[playerIndex].dev));
JoyInfo[playerIndex].buttons = SDL_CONTROLLER_BUTTON_MAX ; // dpad is 4 buttons
if (JoyInfo[playerIndex].buttons > JOYBUTTONS)
JoyInfo[playerIndex].buttons = JOYBUTTONS;
JoyInfo[playerIndex].id = I_GetJoystickDeviceIndex(JoyInfo[playerIndex].dev);
JoyInfo[playerIndex].hats = 4;
if (JoyInfo[playerIndex].hats > JOYHATS)
JoyInfo[playerIndex].hats = JOYHATS;
JoyInfo[playerIndex].balls = 0;
return JoyInfo[playerIndex].axises;
}
return SDL_CONTROLLER_AXIS_MAX;
}
//
@@ -1002,7 +986,6 @@ void I_InitJoystick(UINT8 index)
JoyInfo[index].dev = NULL;
JoyInfo[index].oldjoy = -1;
JoyInfo[index].id = -1;
JoyInfo[index].axises = JoyInfo[index].buttons = JoyInfo[index].hats = JoyInfo[index].balls = 0;
if (cv_usejoystick[index].value)
newcontroller = SDL_GameControllerOpen(cv_usejoystick[index].value-1);
@@ -1386,7 +1369,7 @@ void I_SleepDuration(precise_t duration)
#endif
}
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg);
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg, char *signal_ttl);
#ifdef HAVE_LIBBACKTRACE
#include <backtrace.h>
@@ -1482,6 +1465,7 @@ static void bt_error_cb(void *data, const char *msg, int errnum)
static void write_backtrace(bt_crash_reason_t reason)
{
char sig_msg[512];
char sig_name[128];
const char *filename = va("%s" PATHSEP CRASH_LOGFILE_NAME, srb2home);
FILE *out = fopen(filename, "a+");
@@ -1538,8 +1522,8 @@ static void write_backtrace(bt_crash_reason_t reason)
switch (reason.type)
{
case BTCRASH_SIGNAL:
I_PrintSignal(reason.value.signal, false, sig_msg);
fprintf(out, "%s", sig_msg);
I_PrintSignal(reason.value.signal, false, sig_msg, sig_name);
fprintf(out, "%s - %s", sig_name, sig_msg);
break;
case BTCRASH_ERRORMSG:
@@ -1575,42 +1559,49 @@ static std::thread::id g_main_thread_id;
boolean g_in_exiting_signal_handler = false;
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg)
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg, char *signal_name)
{
const char *sigmsg;
const char *sigmsg, *signame;
switch (signal_num)
{
#ifdef SIGINT
case SIGINT:
sigmsg = ("SIGINT - SRB2Kart-Saturn was interrupted prematurely by the user.");
sigmsg = ("SRB2Kart-Saturn was interrupted prematurely by the user.");
signame = "SIGINT";
break;
#endif
case SIGILL: // illegal instruction - invalid function image
sigmsg = ("SIGILL - SRB2Kart-Saturn has attempted to execute an illegal instruction and needs to close.");
sigmsg = ("SRB2Kart-Saturn has attempted to execute an illegal instruction and needs to close.");
signame = "SIGILL";
break;
case SIGFPE: // mathematical exception
sigmsg = ("SIGFPE - SRB2Kart-Saturn has encountered a mathematical exception and needs to close.");
sigmsg = ("SRB2Kart-Saturn has encountered a mathematical exception and needs to close.");
signame = "SIGFPE";
break;
case SIGSEGV: // segment violation
sigmsg = ("SIGSEGV - SRB2Kart-Saturn has attempted to access a memory location that it shouldn't and needs to close.");
sigmsg = ("SRB2Kart-Saturn has attempted to access a memory location that it shouldn't and needs to close.");
signame = "SIGSEGV";
break;
#ifdef SIGTERM
case SIGTERM: // Software termination signal from kill
sigmsg = ("SIGTERM - SRB2Kart-Saturn was terminated by a kill signal.");
sigmsg = ("SRB2Kart-Saturn was terminated by a kill signal.");
signame = "SIGTERM";
break;
#endif
#ifdef SIGBREAK
case SIGBREAK: // Ctrl-Break sequence
sigmsg =("SIGBREAK - SRB2Kart-Saturn was terminated by a Ctrl-Break sequence.");
signame = "SIGBREAK";
break;
#endif
case SIGABRT: // abnormal termination triggered by abort call
sigmsg = ("SIGABRT - SRB2Kart-Saturn was terminated by an abort signal.");
sigmsg = ("SRB2Kart-Saturn was terminated by an abort signal.");
signame = "SIGABRT";
break;
default:
sprintf(signal_msg, "Signal number %d", signal_num);
sigmsg = (core_dumped ? "Unknown signal" : signal_msg);
sigmsg = "SRB2Kart-Saturn was terminated by an unknown signal.";
signame = core_dumped ? "Unknown signal" : va("Signal number %d", signal_num);
break;
}
@@ -1625,18 +1616,58 @@ static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_ms
{
sprintf(signal_msg, "%s", sigmsg);
}
sprintf(signal_name, "%s", signame);
}
static int I_OpenURL(const char *url)
{
#if SDL_VERSION_ATLEAST(2,0,14)
return SDL_OpenURL(va("%s", url));
#else
return -1;
#endif
}
static void I_ReportSignal(int num, int coredumped)
{
char sigmsg[512];
char signame[128];
char sigttl[512] = "Process killed by signal: ";
const char *reportmsg = "\n\n\nTo help us figure out the cause, please report the issue to our github page with " CRASH_LOGFILE_NAME " attached.\n\nSorry for the inconvenience!";
I_PrintSignal(num, coredumped, sigmsg);
I_PrintSignal(num, coredumped, sigmsg, signame);
size_t len = strlen(sigmsg);
snprintf(sigmsg + len, sizeof(sigmsg) - len, "\n\nCrash report has been saved into %s", CRASH_LOGFILE_NAME);
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg);
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Process killed by signal", sigmsg, NULL);
strcat(sigttl, signame);
I_OutputMsg("\n%s\n\n", sigttl);
if (M_CheckParm("-dedicated"))
return;
const SDL_MessageBoxButtonData buttons[] = {
{ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 0, "OK" },
{ 0, 1, "Report Issue" },
};
const SDL_MessageBoxData messageboxdata = {
SDL_MESSAGEBOX_ERROR, /* .flags */
NULL, /* .window */
sigttl, /* .title */
va("%s %s", sigmsg, reportmsg), /* .message */
SDL_arraysize(buttons), /* .numbuttons */
buttons, /* .buttons */
NULL /* .colorScheme */
};
int buttonid;
SDL_ShowMessageBox(&messageboxdata, &buttonid);
if (buttonid == 1)
I_OpenURL("https://github.com/Indev450/SRB2Kart-Saturn/issues");
}
#ifndef NEWSIGNALHANDLER
+1 -1
View File
@@ -467,7 +467,7 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
}
else
{
raxis = JoyInfo[pid].scale!=1?((raxis/JoyInfo[pid].scale)*JoyInfo[pid].scale):raxis;
raxis = JoyInfo[pid].scale != 1 ? ((raxis/JoyInfo[pid].scale)*JoyInfo[pid].scale) : raxis;
#ifdef SDL_JDEADZONE
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
+4 -4
View File
@@ -44,15 +44,15 @@ typedef struct SDLJoyInfo_s
/// number of old joystick
int oldjoy;
/// number of axies
int axises;
//int axises;
/// scale of axises
INT32 scale;
/// number of buttons
int buttons;
//int buttons;
/// number of hats
int hats;
//int hats;
/// number of balls
int balls;
//int balls;
} SDLJoyInfo_t;
/** \brief SDL info about controller 1
+11 -4
View File
@@ -1742,6 +1742,7 @@ void V_DrawHorizontallyScaledFullScreenPatch(patch_t *patch)
void V_DrawVhsEffect(boolean rewind)
{
fixed_t uby, dby;
// upbary is the bar going from top to bottom for some reason
static fixed_t upbary = 100*FRACUNIT, downbary = 150*FRACUNIT;
UINT8 barsize, updistort, downdistort;
@@ -1759,20 +1760,26 @@ void V_DrawVhsEffect(boolean rewind)
if (cv_reducevfx.value)
return;
barsize = vid.dup << 5;
updistort = vid.dup << (rewind ? 5 : 3);
const INT32 dup = min(vid.width / BASEVIDWIDTH, vid.height / BASEVIDHEIGHT);
barsize = dup << 5;
updistort = dup << (rewind ? 5 : 3);
downdistort = updistort >> 1;
if (rewind)
V_DrawVhsEffect(false); // experimentation
upbary -= renderdeltatics * (vid.dup * (rewind ? 3 : 1.8f));
downbary += renderdeltatics * (vid.dup * (rewind ? 2 : 1));
upbary -= renderdeltatics * (fixed_t)(dup * (rewind ? 3 : 1.8f));
downbary += renderdeltatics * (dup * (rewind ? 2 : 1));
if (upbary < -barsize*FRACUNIT)
upbary = vid.height << FRACBITS;
if (upbary > vid.height << FRACBITS)
upbary = -barsize*FRACUNIT;
if (downbary > vid.height << FRACBITS)
downbary = -barsize*FRACUNIT;
if (downbary < -barsize*FRACUNIT)
downbary = vid.height << FRACBITS;
uby = upbary >> FRACBITS;
dby = downbary >> FRACBITS;
+6 -6
View File
@@ -187,13 +187,13 @@ static VOID ShowModuleInfo(HANDLE LogFile, HMODULE ModuleHandle)
// Open the code module file so that we can get its file date
// and size.
ModuleFile = CreateFileA(ModName, GENERIC_READ,
FILE_SHARE_READ, 0, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (ModuleFile != INVALID_HANDLE_VALUE)
{
FILETIME LastWriteTime;
FileSize = GetFileSize(ModuleFile, 0);
if (GetFileTime(ModuleFile, 0, 0, &LastWriteTime))
FileSize = GetFileSize(ModuleFile, NULL);
if (GetFileTime(ModuleFile, NULL, NULL, &LastWriteTime))
{
wsprintfA(TimeBuffer, " - file date is ");
PrintTime(TimeBuffer + strlen(TimeBuffer), LastWriteTime);
@@ -227,7 +227,7 @@ static VOID RecordModuleList(HANDLE LogFile)
size_t PageSize;
size_t NumPages;
size_t pageNum = 0;
LPVOID LastAllocationBase = 0;
LPVOID LastAllocationBase = NULL;
FPrintf(LogFile, "\r\n"
"\tModule list: names, addresses, sizes, time stamps "
@@ -385,7 +385,7 @@ LONG WINAPI RecordExceptionInfo(PEXCEPTION_POINTERS data/*, LPCSTR Message, LPST
}
// Append to the error log.
SetFilePointer(fileHandle, 0, 0, FILE_END);
SetFilePointer(fileHandle, 0, NULL, FILE_END);
// Print out some blank lines to separate this error log from any previous ones.
FPrintf(fileHandle, "Email Sonic Team Junior so we can fix the bugs\r\n"); // Tails