Skip to content

Commit

Permalink
Merge tag 'quakespasm-0.96.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
codeflorist committed Aug 3, 2024
2 parents edb41a9 + cc32abe commit 8d0b92a
Show file tree
Hide file tree
Showing 87 changed files with 705 additions and 253 deletions.
2 changes: 1 addition & 1 deletion Linux/net.sourceforge.quakespasm.Quakespasm.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<category>Game</category>
</categories>
<releases>
<release version="0.96.2" date="2024-06-10"/>
<release version="0.96.3" date="2024-07-31"/>
</releases>
<content_rating type="oars-1.1">
<content_attribute id="violence-fantasy">intense</content_attribute>
Expand Down
12 changes: 11 additions & 1 deletion Linux/sgml/Quakespasm.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<title>QuakeSpasm
<toc>

<em>Page last edited: June 2024.</em>
<em>Page last edited: July 2024.</em>

<sect>About<p>
QuakeSpasm is a modern cross-platform Quake engine based on FitzQuake.
Expand Down Expand Up @@ -137,6 +137,16 @@ QuakeSpasm 0.94 has support for playing the 2021 re-release content: Copy the qu

<sect>Changes<p>

<sect1>Changes in 0.96.3<p>
<itemize>
<item> Fix potential infinite loop when playing sounds with loop start >= end (e.g. misc/forcefield.wav from Madfox's kaptlog.zip)
<item> Fix possible overflow when resampling very big sounds (e.g. gram1.wav from the 'A day like no other' mod.)
<item> Change Sky_ClipPoly to allocate on the heap in if MAX_CLIP_VERTS limit is reached (e.g. with lim_daviddg from Liminal Spaces Jam)
<item> Minor code cleanups. Updates to third party code.
<item> Thanks to Andrei Drexler, Vincent Sonnier, Alexey Lysiuk, and Jaycie Ewald for patches.
</itemize>
</p>

<sect1>Changes in 0.96.2<p>
<itemize>
<item> Fix stack buffer overrun Mod_PolyForUnlitSurface: fixes crash when loading lim_daviddg.bsp from Liminal Spaces Jam.
Expand Down
Binary file modified MacOSX/English.lproj/InfoPlist.strings
Binary file not shown.
2 changes: 1 addition & 1 deletion MacOSX/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.96.2</string>
<string>0.96.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>LSApplicationCategoryType</key>
Expand Down
6 changes: 6 additions & 0 deletions MacOSX/SDL2.framework/Versions/A/Headers/SDL_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@
#if defined(__APPLE__)
/* lets us know what version of Mac OS X we're compiling on */
#include <AvailabilityMacros.h>
#ifndef __has_extension /* Older compilers don't support this */
#define __has_extension(x) 0
#include <TargetConditionals.h>
#undef __has_extension
#else
#include <TargetConditionals.h>
#endif

/* Fix building with older SDKs that don't define these
See this for more information:
Expand Down
27 changes: 15 additions & 12 deletions MacOSX/SDL2.framework/Versions/A/Headers/SDL_stdinc.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,43 +251,43 @@ typedef uint64_t Uint64;
* <stdint.h> should define these but this is not true all platforms.
* (for example win32) */
#ifndef SDL_PRIs64
#ifdef PRIs64
#define SDL_PRIs64 PRIs64
#elif defined(__WIN32__)
#if defined(__WIN32__)
#define SDL_PRIs64 "I64d"
#elif defined(PRIs64)
#define SDL_PRIs64 PRIs64
#elif defined(__LP64__) && !defined(__APPLE__)
#define SDL_PRIs64 "ld"
#else
#define SDL_PRIs64 "lld"
#endif
#endif
#ifndef SDL_PRIu64
#ifdef PRIu64
#define SDL_PRIu64 PRIu64
#elif defined(__WIN32__)
#if defined(__WIN32__)
#define SDL_PRIu64 "I64u"
#elif defined(PRIu64)
#define SDL_PRIu64 PRIu64
#elif defined(__LP64__) && !defined(__APPLE__)
#define SDL_PRIu64 "lu"
#else
#define SDL_PRIu64 "llu"
#endif
#endif
#ifndef SDL_PRIx64
#ifdef PRIx64
#define SDL_PRIx64 PRIx64
#elif defined(__WIN32__)
#if defined(__WIN32__)
#define SDL_PRIx64 "I64x"
#elif defined(PRIx64)
#define SDL_PRIx64 PRIx64
#elif defined(__LP64__) && !defined(__APPLE__)
#define SDL_PRIx64 "lx"
#else
#define SDL_PRIx64 "llx"
#endif
#endif
#ifndef SDL_PRIX64
#ifdef PRIX64
#define SDL_PRIX64 PRIX64
#elif defined(__WIN32__)
#if defined(__WIN32__)
#define SDL_PRIX64 "I64X"
#elif defined(PRIX64)
#define SDL_PRIX64 PRIX64
#elif defined(__LP64__) && !defined(__APPLE__)
#define SDL_PRIX64 "lX"
#else
Expand Down Expand Up @@ -375,9 +375,12 @@ typedef uint64_t Uint64;

#ifndef SDL_COMPILE_TIME_ASSERT
#if defined(__cplusplus)
/* Keep C++ case alone: Some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode. */
#if (__cplusplus >= 201103L)
#define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x)
#endif
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
#define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x)
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x)
#endif
Expand Down
2 changes: 1 addition & 1 deletion Quake/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ Okay to call even when the screen can't be updated
void Con_SafePrintf (const char *fmt, ...)
{
va_list argptr;
char msg[1024];
char msg[MAXPRINTMSG];
int temp;

va_start (argptr, fmt);
Expand Down
101 changes: 65 additions & 36 deletions Quake/gl_sky.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ float *Fog_GetColor(void);
extern int rs_skypolys; // for r_speeds readout
extern int rs_skypasses; // for r_speeds readout

float skyflatcolor[3];
float skymins[2][6], skymaxs[2][6];
static float skyflatcolor[3];
static float skymins[2][6], skymaxs[2][6];

char skybox_name[1024]; //name of current skybox, or "" if no skybox
static char skybox_name[1024]; //name of current skybox, or "" if no skybox

gltexture_t *skybox_textures[6];
gltexture_t *solidskytexture, *alphaskytexture;
static gltexture_t *skybox_textures[6];
static gltexture_t *solidskytexture, *alphaskytexture;

extern cvar_t gl_farclip;
cvar_t r_fastsky = {"r_fastsky", "0", CVAR_NONE};
cvar_t r_sky_quality = {"r_sky_quality", "12", CVAR_NONE};
cvar_t r_skyalpha = {"r_skyalpha", "1", CVAR_NONE};
cvar_t r_skyfog = {"r_skyfog","0.5",CVAR_NONE};
static cvar_t r_fastsky = {"r_fastsky", "0", CVAR_NONE};
static cvar_t r_sky_quality = {"r_sky_quality", "12", CVAR_NONE};
static cvar_t r_skyalpha = {"r_skyalpha", "1", CVAR_NONE};
static cvar_t r_skyfog = {"r_skyfog","0.5",CVAR_NONE};

int skytexorder[6] = {0,2,1,3,4,5}; //for skybox
static const int skytexorder[6] = {0,2,1,3,4,5}; //for skybox

vec3_t skyclip[6] = {
static const vec3_t skyclip[6] = {
{1,1,0},
{1,-1,0},
{0,-1,1},
Expand All @@ -57,7 +57,7 @@ vec3_t skyclip[6] = {
{-1,0,1}
};

int st_to_vec[6][3] =
static const int st_to_vec[6][3] =
{
{3,-1,2},
{-3,1,2},
Expand All @@ -67,7 +67,7 @@ int st_to_vec[6][3] =
{2,-1,-3} // straight down
};

int vec_to_st[6][3] =
static const int vec_to_st[6][3] =
{
{-2,3,1},
{2,3,-1},
Expand All @@ -77,7 +77,7 @@ int vec_to_st[6][3] =
{-2,1,-3}
};

float skyfog; // ericw
static float skyfog; // ericw

//==============================================================================
//
Expand Down Expand Up @@ -213,7 +213,7 @@ void Sky_LoadTextureQ64 (qmodel_t *mod, texture_t *mt)
Sky_LoadSkyBox
==================
*/
const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
static const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
void Sky_LoadSkyBox (const char *name)
{
int i, mark, width, height;
Expand Down Expand Up @@ -339,7 +339,6 @@ void Sky_NewMap (void)

if (!strcmp("skyfog", key))
skyfog = atof(value);

#if 1 /* also accept non-standard keys */
else if (!strcmp("skyname", key)) //half-life
Sky_LoadSkyBox(value);
Expand Down Expand Up @@ -490,20 +489,22 @@ void Sky_ProjectPoly (int nump, vec3_t vecs)
Sky_ClipPoly
=================
*/
void Sky_ClipPoly (int nump, vec3_t vecs, int stage)
static void Sky_ClipPoly (int nump, vec3_t vecs, int stage)
{
float *norm;
const float *norm;
float *v;
qboolean front, back;
float d, e;
float dists[MAX_CLIP_VERTS];
int sides[MAX_CLIP_VERTS];
vec3_t newv[2][MAX_CLIP_VERTS];
int newc[2];
int i, j;

if (nump > MAX_CLIP_VERTS-2)
Sys_Error ("Sky_ClipPoly: MAX_CLIP_VERTS");
const int max_clip_verts = nump + 2;
const int on_heap = max_clip_verts > MAX_CLIP_VERTS;
int *sides;
float *dists;
vec3_t *newv_0;
vec3_t *newv_1;

if (stage == 6) // fully clipped
{
Sky_ProjectPoly (nump, vecs);
Expand All @@ -512,6 +513,10 @@ void Sky_ClipPoly (int nump, vec3_t vecs, int stage)

front = back = false;
norm = skyclip[stage];

sides = (int *) (on_heap ? malloc(max_clip_verts * sizeof(int)) : alloca(max_clip_verts * sizeof(int)));
dists = (float *) (on_heap ? malloc(max_clip_verts * sizeof(float)) : alloca(max_clip_verts * sizeof(float)));

for (i=0, v = vecs ; i<nump ; i++, v+=3)
{
d = DotProduct (v, norm);
Expand All @@ -533,6 +538,10 @@ void Sky_ClipPoly (int nump, vec3_t vecs, int stage)
if (!front || !back)
{ // not clipped
Sky_ClipPoly (nump, vecs, stage+1);
if (on_heap) {
free(dists);
free(sides);
}
return;
}

Expand All @@ -542,22 +551,26 @@ void Sky_ClipPoly (int nump, vec3_t vecs, int stage)
VectorCopy (vecs, (vecs+(i*3)) );
newc[0] = newc[1] = 0;

// 2-dim vec3_t newv[2][MAX_CLIP_VERTS]; as 2 arrays
newv_0 = (vec3_t *) (on_heap ? malloc(max_clip_verts * sizeof(vec3_t)) : alloca(max_clip_verts * sizeof(vec3_t)));
newv_1 = (vec3_t *) (on_heap ? malloc(max_clip_verts * sizeof(vec3_t)) : alloca(max_clip_verts * sizeof(vec3_t)));

for (i=0, v = vecs ; i<nump ; i++, v+=3)
{
switch (sides[i])
{
case SIDE_FRONT:
VectorCopy (v, newv[0][newc[0]]);
VectorCopy (v, newv_0[newc[0]]);
newc[0]++;
break;
case SIDE_BACK:
VectorCopy (v, newv[1][newc[1]]);
VectorCopy (v, newv_1[newc[1]]);
newc[1]++;
break;
case SIDE_ON:
VectorCopy (v, newv[0][newc[0]]);
VectorCopy (v, newv_0[newc[0]]);
newc[0]++;
VectorCopy (v, newv[1][newc[1]]);
VectorCopy (v, newv_1[newc[1]]);
newc[1]++;
break;
}
Expand All @@ -569,16 +582,24 @@ void Sky_ClipPoly (int nump, vec3_t vecs, int stage)
for (j=0 ; j<3 ; j++)
{
e = v[j] + d*(v[j+3] - v[j]);
newv[0][newc[0]][j] = e;
newv[1][newc[1]][j] = e;
newv_0[newc[0]][j] = e;
newv_1[newc[1]][j] = e;
}
newc[0]++;
newc[1]++;
}

// continue
Sky_ClipPoly (newc[0], newv[0][0], stage+1);
Sky_ClipPoly (newc[1], newv[1][0], stage+1);
Sky_ClipPoly (newc[0], newv_0[0], stage+1);
Sky_ClipPoly (newc[1], newv_1[0], stage+1);

if (on_heap)
{
free(dists);
free(sides);
free(newv_0);
free(newv_1);
}
}

/*
Expand All @@ -588,19 +609,27 @@ Sky_ProcessPoly
*/
void Sky_ProcessPoly (glpoly_t *p)
{
int i;
vec3_t verts[MAX_CLIP_VERTS];

//draw it
DrawGLPoly(p);
rs_brushpasses++;

//update sky bounds
if (!r_fastsky.value)
{
for (i=0 ; i<p->numverts ; i++)
const int max_clip_verts = p->numverts + 2;
const int num_verts = p->numverts;
const int on_heap = max_clip_verts > MAX_CLIP_VERTS;
vec3_t *verts = (vec3_t *) (on_heap ?
malloc(max_clip_verts * sizeof(vec3_t)) :
alloca(max_clip_verts * sizeof(vec3_t)));
int i = 0;

for ( ; i < num_verts; i++) {
VectorSubtract (p->verts[i], r_origin, verts[i]);
Sky_ClipPoly (p->numverts, verts[0], 0);
}
Sky_ClipPoly (num_verts, verts[0], 0);

if (on_heap) free(verts);
}
}

Expand Down
3 changes: 3 additions & 0 deletions Quake/pl_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,8 @@ char *PL_GetClipboardData (void)

void PL_ErrorDialog (const char *errorMsg)
{
#if defined(USE_SDL2)
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Quake Error", errorMsg, NULL);
#endif
}

4 changes: 1 addition & 3 deletions Quake/pr_edict.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int pr_edict_size; // in bytes

unsigned short pr_crc;

int type_size[8] = {
const int type_size[NUM_TYPE_SIZES] = {
1, // ev_void
1, // sizeof(string_t) / 4 // ev_string
1, // ev_float
Expand All @@ -55,8 +55,6 @@ int type_size[8] = {
1 // sizeof(void *) / 4 // ev_pointer
};

#define NUM_TYPE_SIZES (int)Q_COUNTOF(type_size)

static ddef_t *ED_FieldAtOfs (int ofs);
static qboolean ED_ParseEpair (void *base, ddef_t *key, const char *s);

Expand Down
3 changes: 2 additions & 1 deletion Quake/progs.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ int NUM_FOR_EDICT(edict_t*);
#define E_VECTOR(e,o) (&((float*)&e->v)[o])
#define E_STRING(e,o) (PR_GetString(*(string_t *)&((float*)&e->v)[o]))

extern int type_size[8];
#define NUM_TYPE_SIZES 8
extern const int type_size[NUM_TYPE_SIZES];

typedef void (*builtin_t) (void);
extern const builtin_t *pr_builtins;
Expand Down
Loading

0 comments on commit 8d0b92a

Please sign in to comment.