Merge remote-tracking branch 'sf/master' into qss

This commit is contained in:
Shpoike 2022-08-04 07:04:30 +01:00
commit 0f1c4fca19
28 changed files with 604 additions and 397 deletions

View file

@ -3,7 +3,7 @@
<title>QuakeSpasm
<toc>
<em>Page last edited: June 2022.</em>
<em>Page last edited: July 2022.</em>
<sect> About <p>
@ -131,11 +131,20 @@ Alternatively, have a look at <bf>Makefile.darwin</bf> for more instructions on
</p>
<sect1> Quake '2021 re-release' <p>
QuakeSpasm 0.94.0 has initial support for playing the 2021 re-release content: Copy the quakespasm binary to your rerelease installation and run quakespasm as you normally do.</p>
QuakeSpasm 0.94 has support for playing the 2021 re-release content: Copy the quakespasm binary to your rerelease installation and run as you normally do.</p>
<sect> Changes<p>
<sect1> Changes in 0.94.7<p>
<itemize>
<item> Fix console history buffer wrapping.
<item> Fix wrong external texture use after vid_restart.
<item> Update lodepng from mainstream git.
<item> Miscellaneous source code cleanups.
</itemize>
</p>
<sect1> Changes in 0.94.6<p>
<itemize>
<item> Server protocol size check fixes for sounds and particles.

View file

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.94.6</string>
<string>0.94.7</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>LSApplicationCategoryType</key>

View file

@ -1,10 +1,10 @@
allow plain files to override files inside a PAK file -- Sander van Dijk.
diff --git a/Quake/common.c b/Quake/common.c
index bd246f1..2326383 100644
index eff4c30..1478d77 100644
--- a/Quake/common.c
+++ b/Quake/common.c
@@ -2039,13 +2039,6 @@ static void COM_AddGameDirectory (const char *base, const char *dir)
@@ -2030,13 +2030,6 @@ static void COM_AddGameDirectory (const char *base, const char *dir)
else path_id = 1U;
_add_path:
@ -18,7 +18,7 @@ index bd246f1..2326383 100644
// add any pak files in the format pak0.pak pak1.pak, ...
for (i = 0; ; i++)
{
@@ -2077,6 +2070,13 @@ _add_path:
@@ -2068,6 +2061,13 @@ _add_path:
if (!pak) break;
}

View file

@ -1,17 +1,17 @@
diff --git a/Quake/gl_model.c b/Quake/gl_model.c
index 94f0023..fdb8c4c 100644
index d193051..783dc4d 100644
--- a/Quake/gl_model.c
+++ b/Quake/gl_model.c
@@ -37,6 +37,8 @@ qmodel_t *Mod_LoadModel (qmodel_t *mod, qboolean crash);
cvar_t external_ents = {"external_ents", "1", CVAR_ARCHIVE};
cvar_t external_vis = {"external_vis", "1", CVAR_ARCHIVE};
@@ -39,6 +39,8 @@ static void Mod_Print (void);
static cvar_t external_ents = {"external_ents", "1", CVAR_ARCHIVE};
static cvar_t external_vis = {"external_vis", "1", CVAR_ARCHIVE};
+extern cvar_t r_externaltexture_fix; //mk
+
static byte *mod_novis;
static int mod_novis_capacity;
@@ -534,6 +536,13 @@ void Mod_LoadTextures (lump_t *l)
@@ -542,6 +544,13 @@ static void Mod_LoadTextures (lump_t *l)
{
if (!q_strncasecmp(tx->name,"sky",3)) //sky texture //also note -- was Q_strncmp, changed to match qbsp
{
@ -23,9 +23,9 @@ index 94f0023..fdb8c4c 100644
+ }
+ }
if (loadmodel->bspversion == BSPVERSION_QUAKE64)
Sky_LoadTextureQ64 (tx);
Sky_LoadTextureQ64 (loadmodel, tx);
else
@@ -588,6 +597,50 @@ void Mod_LoadTextures (lump_t *l)
@@ -596,6 +605,50 @@ static void Mod_LoadTextures (lump_t *l)
//external textures -- first look in "textures/mapname/" then look in "textures/"
mark = Hunk_LowMark ();
COM_StripExtension (loadmodel->name + 5, mapname, sizeof(mapname));
@ -77,10 +77,10 @@ index 94f0023..fdb8c4c 100644
data = Image_LoadImage (filename, &fwidth, &fheight);
if (!data)
diff --git a/Quake/gl_rmain.c b/Quake/gl_rmain.c
index a41d8b1..b0020c5 100644
index 332ab1e..783a9d6 100644
--- a/Quake/gl_rmain.c
+++ b/Quake/gl_rmain.c
@@ -102,6 +102,8 @@ cvar_t r_noshadow_list = {"r_noshadow_list", "progs/flame2.mdl,progs/flame.mdl,p
@@ -99,6 +99,8 @@ cvar_t r_noshadow_list = {"r_noshadow_list", "progs/flame2.mdl,progs/flame.mdl,p
extern cvar_t r_vfog;
//johnfitz
@ -90,7 +90,7 @@ index a41d8b1..b0020c5 100644
cvar_t r_lavaalpha = {"r_lavaalpha","0",CVAR_NONE};
diff --git a/Quake/gl_rmisc.c b/Quake/gl_rmisc.c
index dfdb84d..9c441bd 100644
index dc3dff0..dbfe922 100644
--- a/Quake/gl_rmisc.c
+++ b/Quake/gl_rmisc.c
@@ -47,6 +47,7 @@ extern cvar_t r_nolerp_list;
@ -109,4 +109,3 @@ index dfdb84d..9c441bd 100644
Cvar_RegisterVariable (&gl_zfix); // QuakeSpasm z-fighting fix
Cvar_RegisterVariable (&r_lavaalpha);

View file

@ -2146,8 +2146,6 @@ called when the particle system has changed, and any cached indexes are now prob
*/
void CL_RegisterParticles(void)
{
extern qmodel_t mod_known[];
extern int mod_numknown;
int i;
if (cl.protocol == PROTOCOL_VERSION_DP7) //dpp7 sucks.
@ -2163,8 +2161,7 @@ void CL_RegisterParticles(void)
}
//and make sure models get the right effects+trails etc too
for (i = 0; i < mod_numknown; i++)
PScript_UpdateModelEffects(&mod_known[i]);
Mod_ForEachModel(PScript_UpdateModelEffects);
}
/*

View file

@ -3010,6 +3010,7 @@ static void COM_Game_f (void)
if (!isDedicated)
Draw_ReloadTextures(true);
ExtraMaps_NewGame ();
Host_Resetdemos ();
DemoList_Rebuild ();
Con_Printf("\"game\" changed to \"%s\"\n", COM_GetGameNames(true));

View file

@ -31,19 +31,21 @@ extern gltexture_t *playertextures[MAX_SCOREBOARD]; //spike - to ensure skins do
qmodel_t *loadmodel;
char loadname[32]; // for hunk tags
void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer);
void Mod_LoadBrushModel (qmodel_t *mod, void *buffer);
void Mod_LoadAliasModel (qmodel_t *mod, void *buffer, int pvtype);
static void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer);
static void Mod_LoadBrushModel (qmodel_t *mod, void *buffer);
static void Mod_LoadAliasModel (qmodel_t *mod, void *buffer, int pvtype);
void Mod_LoadMD3Model (qmodel_t *mod, void *buffer);
void Mod_LoadMD5MeshModel (qmodel_t *mod, void *buffer);
void Mod_LoadIQMModel (qmodel_t *mod, const void *buffer);
qmodel_t *Mod_LoadModel (qmodel_t *mod, qboolean crash);
static qmodel_t *Mod_LoadModel (qmodel_t *mod, qboolean crash);
cvar_t external_ents = {"external_ents", "1", CVAR_ARCHIVE};
static void Mod_Print (void);
static cvar_t external_ents = {"external_ents", "1", CVAR_ARCHIVE};
cvar_t gl_load24bit = {"gl_load24bit", "1", CVAR_ARCHIVE};
cvar_t mod_ignorelmscale = {"mod_ignorelmscale", "0"};
static cvar_t mod_ignorelmscale = {"mod_ignorelmscale", "0"};
cvar_t r_replacemodels = {"r_replacemodels", "", CVAR_ARCHIVE};
cvar_t external_vis = {"external_vis", "1", CVAR_ARCHIVE};
static cvar_t external_vis = {"external_vis", "1", CVAR_ARCHIVE};
static byte *mod_novis;
static int mod_novis_capacity;
@ -52,8 +54,8 @@ static byte *mod_decompressed;
static int mod_decompressed_capacity;
#define MAX_MOD_KNOWN 8192 /*spike -- new value, was 2048 in qs, 512 in vanilla. Needs to be big for big maps with many many inline models. */
qmodel_t mod_known[MAX_MOD_KNOWN];
int mod_numknown;
static qmodel_t mod_known[MAX_MOD_KNOWN];
static int mod_numknown;
texture_t *r_notexture_mip; //johnfitz -- moved here from r_main.c
texture_t *r_notexture_mip2; //johnfitz -- used for non-lightmapped surfs with a missing texture
@ -72,6 +74,8 @@ void Mod_Init (void)
Cvar_RegisterVariable (&r_replacemodels);
Cvar_RegisterVariable (&mod_ignorelmscale);
Cmd_AddCommand ("mcache", Mod_Print);
//johnfitz -- create notexture miptex
r_notexture_mip = (texture_t *) Hunk_AllocName (sizeof(texture_t), "r_notexture_mip");
strcpy (r_notexture_mip->name, "notexture");
@ -141,7 +145,7 @@ mleaf_t *Mod_PointInLeaf (vec3_t p, qmodel_t *model)
Mod_DecompressVis
===================
*/
byte *Mod_DecompressVis (byte *in, qmodel_t *model)
static byte *Mod_DecompressVis (byte *in, qmodel_t *model)
{
int c;
byte *out;
@ -234,12 +238,14 @@ void Mod_ClearAll (void)
qmodel_t *mod;
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
{
if (mod->type != mod_alias)
{
mod->needload = true;
TexMgr_FreeTexturesForOwner (mod); //johnfitz
PScript_ClearSurfaceParticles(mod);
}
}
}
void Mod_ResetAll (void)
@ -249,7 +255,7 @@ void Mod_ResetAll (void)
//ericw -- free alias model VBOs
GLMesh_DeleteVertexBuffers ();
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
{
if (!mod->needload) //otherwise Mod_ClearAll() did it already
@ -262,13 +268,23 @@ void Mod_ResetAll (void)
mod_numknown = 0;
}
void Mod_ForEachModel(void(*callback)(qmodel_t *mod))
{
int i;
qmodel_t *mod;
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
{
callback(mod);
}
}
/*
==================
Mod_FindName
==================
*/
qmodel_t *Mod_FindName (const char *name)
static qmodel_t *Mod_FindName (const char *name)
{
int i;
qmodel_t *mod;
@ -280,8 +296,10 @@ qmodel_t *Mod_FindName (const char *name)
// search the currently loaded models
//
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
{
if (!strcmp (mod->name, name) )
break;
}
if (i == mod_numknown)
{
@ -321,7 +339,7 @@ Mod_LoadModel
Loads a model into the cache
==================
*/
qmodel_t *Mod_LoadModel (qmodel_t *mod, qboolean crash)
static qmodel_t *Mod_LoadModel (qmodel_t *mod, qboolean crash)
{
byte *buf;
byte stackbuf[1024]; // avoid dirtying the cache heap
@ -585,12 +603,14 @@ static void Q1BSPX_Setup(qmodel_t *mod, char *filebase, unsigned int filelen, lu
Mod_CheckFullbrights -- johnfitz
=================
*/
qboolean Mod_CheckFullbrights (byte *pixels, int count)
static qboolean Mod_CheckFullbrights (byte *pixels, int count)
{
int i;
for (i = 0; i < count; i++)
{
if (*pixels++ > 223)
return true;
}
return false;
}
@ -700,7 +720,7 @@ Quake64 bsp
Check if we have any missing textures in the array
=================
*/
qboolean Mod_CheckAnimTextureArrayQ64(texture_t *anims[], int numTex)
static qboolean Mod_CheckAnimTextureArrayQ64(texture_t *anims[], int numTex)
{
int i;
@ -717,7 +737,7 @@ qboolean Mod_CheckAnimTextureArrayQ64(texture_t *anims[], int numTex)
Mod_LoadTextures
=================
*/
void Mod_LoadTextures (lump_t *l)
static void Mod_LoadTextures (lump_t *l)
{
int i, j, num, maxanim, altmax;
miptex_t *mt;
@ -730,7 +750,7 @@ void Mod_LoadTextures (lump_t *l)
int nummiptex;
src_offset_t offset;
int mark, fwidth, fheight;
char filename[MAX_OSPATH], filename2[MAX_OSPATH], mapname[MAX_OSPATH];
char filename[MAX_OSPATH], mapname[MAX_OSPATH];
byte *data;
extern byte *hunk_base;
//johnfitz
@ -788,9 +808,9 @@ void Mod_LoadTextures (lump_t *l)
if (!q_strncasecmp(tx->name,"sky",3)) //sky texture //also note -- was Q_strncmp, changed to match qbsp
{
if (loadmodel->bspversion == BSPVERSION_QUAKE64)
Sky_LoadTextureQ64 (tx);
Sky_LoadTextureQ64 (loadmodel, tx);
else
Sky_LoadTexture (tx, fmt, imgwidth, imgheight);
Sky_LoadTexture (loadmodel, tx, fmt, imgwidth, imgheight);
}
else if (tx->name[0] == '*') //warping texture
{
@ -854,6 +874,7 @@ void Mod_LoadTextures (lump_t *l)
//now load whatever we found
if (data) //load external image
{
char filename2[MAX_OSPATH];
tx->gltexture = TexMgr_LoadImage (loadmodel, filename, fwidth, fheight,
rfmt, data, filename, 0, TEXPREF_MIPMAP | extraflags );
@ -871,7 +892,7 @@ void Mod_LoadTextures (lump_t *l)
if (data)
tx->fullbright = TexMgr_LoadImage (loadmodel, filename2, fwidth, fheight,
rfmt, data, filename, 0, TEXPREF_MIPMAP | extraflags );
rfmt, data, filename2, 0, TEXPREF_MIPMAP | extraflags );
}
else //use the texture from the bsp file
{
@ -1005,7 +1026,7 @@ void Mod_LoadTextures (lump_t *l)
Mod_LoadLighting -- johnfitz -- replaced with lit support code via lordhavoc
=================
*/
void Mod_LoadLighting (lump_t *l)
static void Mod_LoadLighting (lump_t *l)
{
int i, mark;
byte *in, *out, *data;
@ -1138,7 +1159,7 @@ void Mod_LoadLighting (lump_t *l)
Mod_LoadVisibility
=================
*/
void Mod_LoadVisibility (lump_t *l)
static void Mod_LoadVisibility (lump_t *l)
{
loadmodel->viswarn = false;
if (!l->filelen)
@ -1156,7 +1177,7 @@ void Mod_LoadVisibility (lump_t *l)
Mod_LoadEntities
=================
*/
void Mod_LoadEntities (lump_t *l)
static void Mod_LoadEntities (lump_t *l)
{
char basemapname[MAX_QPATH];
char entfilename[MAX_QPATH];
@ -1260,7 +1281,7 @@ const char *Mod_ParseWorldspawnKey(qmodel_t *mod, const char *wantkey, char *buf
Mod_LoadVertexes
=================
*/
void Mod_LoadVertexes (lump_t *l)
static void Mod_LoadVertexes (lump_t *l)
{
dvertex_t *in;
mvertex_t *out;
@ -1288,7 +1309,7 @@ void Mod_LoadVertexes (lump_t *l)
Mod_LoadEdges
=================
*/
void Mod_LoadEdges (lump_t *l, int bsp2)
static void Mod_LoadEdges (lump_t *l, int bsp2)
{
medge_t *out;
int i, count;
@ -1338,7 +1359,7 @@ void Mod_LoadEdges (lump_t *l, int bsp2)
Mod_LoadTexinfo
=================
*/
void Mod_LoadTexinfo (lump_t *l)
static void Mod_LoadTexinfo (lump_t *l)
{
texinfo_t *in;
mtexinfo_t *out;
@ -1395,7 +1416,7 @@ CalcSurfaceExtents
Fills in s->texturemins[] and s->extents[]
================
*/
void CalcSurfaceExtents (msurface_t *s)
static void CalcSurfaceExtents (msurface_t *s)
{
float mins[2], maxs[2], val;
int i,j, e;
@ -1472,7 +1493,7 @@ Mod_PolyForUnlitSurface -- johnfitz -- creates polys for unlightmapped surfaces
TODO: merge this into BuildSurfaceDisplayList?
================
*/
void Mod_PolyForUnlitSurface (msurface_t *fa)
static void Mod_PolyForUnlitSurface (msurface_t *fa)
{
vec3_t verts[64];
int numverts, i, lindex;
@ -1517,7 +1538,7 @@ void Mod_PolyForUnlitSurface (msurface_t *fa)
Mod_CalcSurfaceBounds -- johnfitz -- calculate bounding box for per-surface frustum culling
=================
*/
void Mod_CalcSurfaceBounds (msurface_t *s)
static void Mod_CalcSurfaceBounds (msurface_t *s)
{
int i, e;
mvertex_t *v;
@ -1554,7 +1575,7 @@ void Mod_CalcSurfaceBounds (msurface_t *s)
Mod_LoadFaces
=================
*/
void Mod_LoadFaces (lump_t *l, qboolean bsp2)
static void Mod_LoadFaces (lump_t *l, qboolean bsp2)
{
dsface_t *ins;
dlface_t *inl;
@ -1736,7 +1757,7 @@ void Mod_LoadFaces (lump_t *l, qboolean bsp2)
Mod_SetParent
=================
*/
void Mod_SetParent (mnode_t *node, mnode_t *parent)
static void Mod_SetParent (mnode_t *node, mnode_t *parent)
{
node->parent = parent;
if (node->contents < 0)
@ -1750,7 +1771,7 @@ void Mod_SetParent (mnode_t *node, mnode_t *parent)
Mod_LoadNodes
=================
*/
void Mod_LoadNodes_S (lump_t *l)
static void Mod_LoadNodes_S (lump_t *l)
{
int i, j, count, p;
dsnode_t *in;
@ -1806,7 +1827,7 @@ void Mod_LoadNodes_S (lump_t *l)
}
}
void Mod_LoadNodes_L1 (lump_t *l)
static void Mod_LoadNodes_L1 (lump_t *l)
{
int i, j, count, p;
dl1node_t *in;
@ -1858,7 +1879,7 @@ void Mod_LoadNodes_L1 (lump_t *l)
}
}
void Mod_LoadNodes_L2 (lump_t *l)
static void Mod_LoadNodes_L2 (lump_t *l)
{
int i, j, count, p;
dl2node_t *in;
@ -1910,7 +1931,7 @@ void Mod_LoadNodes_L2 (lump_t *l)
}
}
void Mod_LoadNodes (lump_t *l, int bsp2)
static void Mod_LoadNodes (lump_t *l, int bsp2)
{
if (bsp2 == 2)
Mod_LoadNodes_L2(l);
@ -1922,7 +1943,7 @@ void Mod_LoadNodes (lump_t *l, int bsp2)
// Mod_SetParent (loadmodel->nodes, NULL); // sets nodes and leafs
}
void Mod_ProcessLeafs_S (dsleaf_t *in, int filelen)
static void Mod_ProcessLeafs_S (dsleaf_t *in, int filelen)
{
mleaf_t *out;
int i, j, count, p;
@ -1968,7 +1989,7 @@ void Mod_ProcessLeafs_S (dsleaf_t *in, int filelen)
}
}
void Mod_ProcessLeafs_L1 (dl1leaf_t *in, int filelen)
static void Mod_ProcessLeafs_L1 (dl1leaf_t *in, int filelen)
{
mleaf_t *out;
int i, j, count, p;
@ -2011,7 +2032,7 @@ void Mod_ProcessLeafs_L1 (dl1leaf_t *in, int filelen)
}
}
void Mod_ProcessLeafs_L2 (dl2leaf_t *in, int filelen)
static void Mod_ProcessLeafs_L2 (dl2leaf_t *in, int filelen)
{
mleaf_t *out;
int i, j, count, p;
@ -2059,7 +2080,7 @@ void Mod_ProcessLeafs_L2 (dl2leaf_t *in, int filelen)
Mod_LoadLeafs
=================
*/
void Mod_LoadLeafs (lump_t *l, int bsp2)
static void Mod_LoadLeafs (lump_t *l, int bsp2)
{
void *in = (void *)(mod_base + l->fileofs);
@ -2175,7 +2196,7 @@ void Mod_CheckWaterVis(void)
Mod_LoadClipnodes
=================
*/
void Mod_LoadClipnodes (lump_t *l, qboolean bsp2)
static void Mod_LoadClipnodes (lump_t *l, qboolean bsp2)
{
dsclipnode_t *ins;
dlclipnode_t *inl;
@ -2286,7 +2307,7 @@ Mod_MakeHull0
Duplicate the drawing hull structure as a clipping hull
=================
*/
void Mod_MakeHull0 (void)
static void Mod_MakeHull0 (void)
{
mnode_t *in, *child;
mclipnode_t *out; //johnfitz -- was dclipnode_t
@ -2343,7 +2364,7 @@ void Mod_MakeHull0 (void)
Mod_LoadMarksurfaces
=================
*/
void Mod_LoadMarksurfaces (lump_t *l, int bsp2)
static void Mod_LoadMarksurfaces (lump_t *l, int bsp2)
{
int i, j, count;
msurface_t **out;
@ -2401,7 +2422,7 @@ void Mod_LoadMarksurfaces (lump_t *l, int bsp2)
Mod_LoadSurfedges
=================
*/
void Mod_LoadSurfedges (lump_t *l)
static void Mod_LoadSurfedges (lump_t *l)
{
int i, count;
int *in, *out;
@ -2425,7 +2446,7 @@ void Mod_LoadSurfedges (lump_t *l)
Mod_LoadPlanes
=================
*/
void Mod_LoadPlanes (lump_t *l)
static void Mod_LoadPlanes (lump_t *l)
{
int i, j;
mplane_t *out;
@ -2463,7 +2484,7 @@ void Mod_LoadPlanes (lump_t *l)
RadiusFromBounds
=================
*/
float RadiusFromBounds (vec3_t mins, vec3_t maxs)
static float RadiusFromBounds (vec3_t mins, vec3_t maxs)
{
int i;
vec3_t corner;
@ -2481,7 +2502,7 @@ float RadiusFromBounds (vec3_t mins, vec3_t maxs)
Mod_LoadSubmodels
=================
*/
void Mod_LoadSubmodels (lump_t *l)
static void Mod_LoadSubmodels (lump_t *l)
{
mmodel_t *out;
size_t i, j, count;
@ -2572,7 +2593,8 @@ Therefore, the bounding box of the hull can be constructed entirely
from axial planes found in the clipnodes for that hull.
=================
*/
void Mod_BoundsFromClipNode (qmodel_t *mod, int hull, int nodenum)
#if 0 /* disabled for now -- see in Mod_SetupSubmodels() */
static void Mod_BoundsFromClipNode (qmodel_t *mod, int hull, int nodenum)
{
mplane_t *plane;
mclipnode_t *node;
@ -2611,6 +2633,7 @@ void Mod_BoundsFromClipNode (qmodel_t *mod, int hull, int nodenum)
Mod_BoundsFromClipNode (mod, hull, node->children[0]);
Mod_BoundsFromClipNode (mod, hull, node->children[1]);
}
#endif /* #if 0 */
/* EXTERNAL VIS FILE SUPPORT:
*/
@ -2712,7 +2735,7 @@ static void Mod_LoadLeafsExternal(FILE* f)
Mod_LoadBrushModel
=================
*/
void Mod_LoadBrushModel (qmodel_t *mod, void *buffer)
static void Mod_LoadBrushModel (qmodel_t *mod, void *buffer)
{
int i, j;
int bsp2;
@ -2884,17 +2907,14 @@ int max_triangles;
// a pose is a single set of vertexes. a frame may be
// an animating sequence of poses
trivertx_t *poseverts_mdl[MAXALIASFRAMES];
int posenum;
byte **player_8bit_texels_tbl;
byte *player_8bit_texels;
static int posenum;
/*
=================
Mod_LoadAliasFrame
=================
*/
static void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame, int pvtype)
static void *Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame, int pvtype)
{
trivertx_t *pinframe;
int i;
@ -2917,7 +2937,6 @@ static void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame, int pvty
frame->bboxmax.v[i] = pdaliasframe->bboxmax.v[i];
}
pinframe = (trivertx_t *)(pdaliasframe + 1);
poseverts_mdl[posenum] = pinframe;
@ -3007,7 +3026,7 @@ do { \
else if (pos[off] != 255) fdc = pos[off]; \
} while (0)
void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
static void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
{
byte fillcolor = *skin; // assume this is the pixel to fill
floodfill_t fifo[FLOODFILL_FIFO_SIZE];
@ -3020,11 +3039,13 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
filledcolor = 0;
// attempt to find opaque black
for (i = 0; i < 256; ++i)
if (d_8to24table[i] == (unsigned int)LittleLong(255 << 24)) // alpha 1.0
{
if (d_8to24table[i] == (unsigned int)LittleLong(255ul << 24)) // alpha 1.0
{
filledcolor = i;
break;
}
}
}
// can't fill to filled color or to transparent color (used as visited marker)
@ -3058,7 +3079,7 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
Mod_LoadAllSkins
===============
*/
void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
static void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
{
int i, j, k, size, groupskins;
char name[MAX_QPATH];
@ -3409,7 +3430,9 @@ void Mod_SetExtraFlags (qmodel_t *mod)
if (!strcmp (mod->name, "progs/flame2.mdl") ||
!strcmp (mod->name, "progs/flame.mdl") ||
!strcmp (mod->name, "progs/boss.mdl"))
{
mod->flags |= MOD_FBRIGHTHACK;
}
}
#ifdef PSET_SCRIPT
@ -3422,7 +3445,7 @@ void Mod_SetExtraFlags (qmodel_t *mod)
Mod_LoadAliasModel
=================
*/
void Mod_LoadAliasModel (qmodel_t *mod, void *buffer, int pvtype)
static void Mod_LoadAliasModel (qmodel_t *mod, void *buffer, int pvtype)
{
int i, j;
mdl_t *pinmodel;
@ -3611,7 +3634,7 @@ void Mod_LoadAliasModel (qmodel_t *mod, void *buffer, int pvtype)
Mod_LoadSpriteFrame
=================
*/
void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum, enum srcformat fmt)
static void *Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum, enum srcformat fmt)
{
dspriteframe_t *pinframe;
mspriteframe_t *pspriteframe;
@ -3661,7 +3684,7 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum,
Mod_LoadSpriteGroup
=================
*/
void * Mod_LoadSpriteGroup (void * pin, mspriteframe_t **ppframe, int framenum, enum srcformat fmt)
static void *Mod_LoadSpriteGroup (void * pin, mspriteframe_t **ppframe, int framenum, enum srcformat fmt)
{
dspritegroup_t *pingroup;
mspritegroup_t *pspritegroup;
@ -3716,7 +3739,7 @@ void * Mod_LoadSpriteGroup (void * pin, mspriteframe_t **ppframe, int framenum,
Mod_LoadSpriteModel
=================
*/
void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer)
static void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer)
{
int i;
int version;
@ -3803,7 +3826,7 @@ void Mod_LoadSpriteModel (qmodel_t *mod, void *buffer)
Mod_Print
================
*/
void Mod_Print (void)
static void Mod_Print (void)
{
int i;
qmodel_t *mod;

View file

@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __MODEL__
#define __MODEL__
#ifndef GL_MODEL_H
#define GL_MODEL_H
#include "modelgen.h"
#include "spritegn.h"
@ -557,6 +557,7 @@ void Mod_Init (void);
void Mod_ClearAll (void);
void Mod_ResetAll (void); // for gamedir changes (Host_Game_f)
qmodel_t *Mod_ForName (const char *name, qboolean crash);
void Mod_ForEachModel(void(*callback)(qmodel_t *mod));
void *Mod_Extradata (qmodel_t *mod); // handles caching
void Mod_TouchModel (const char *name);
@ -566,4 +567,4 @@ byte *Mod_NoVisPVS (qmodel_t *model);
void Mod_SetExtraFlags (qmodel_t *mod);
#endif // __MODEL__
#endif /* GL_MODEL_H */

View file

@ -24,8 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "glquake.h"
qboolean r_cache_thrash; // compatability
vec3_t modelorg, r_entorigin;
static entity_t r_worldentity; //so we can make sure currententity is valid
@ -37,9 +35,8 @@ int r_framecount; // used for dlight push checking
mplane_t frustum[4];
//johnfitz -- rendering statistics
int rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys;
int rs_brushpolys, rs_aliaspolys, rs_skypolys;
int rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses;
float rs_megatexels;
//
// view origin
@ -600,8 +597,6 @@ void R_SetupView (void)
V_SetContentsColor (viewcontents);
V_CalcBlend ();
r_cache_thrash = false;
//johnfitz -- calculate r_fovx and r_fovy here
r_fovx = r_refdef.fov_x;
r_fovy = r_refdef.fov_y;
@ -1151,7 +1146,7 @@ void R_RenderView (void)
time1 = Sys_DoubleTime ();
//johnfitz -- rendering statistics
rs_brushpolys = rs_aliaspolys = rs_skypolys = rs_particles = rs_fogpolys = rs_megatexels =
rs_brushpolys = rs_aliaspolys = rs_skypolys =
rs_dynamiclightmaps = rs_aliaspasses = rs_skypasses = rs_brushpasses = 0;
}
else if (gl_finish.value)
@ -1260,12 +1255,12 @@ void R_RenderView (void)
time2 = Sys_DoubleTime ();
if (r_pos.value)
Con_Printf ("x %i y %i z %i (pitch %i yaw %i roll %i)\n",
(int)cl.entities[cl.viewentity].origin[0],
(int)cl.entities[cl.viewentity].origin[1],
(int)cl.entities[cl.viewentity].origin[2],
(int)cl.viewangles[PITCH],
(int)cl.viewangles[YAW],
(int)cl.viewangles[ROLL]);
(int)cl.entities[cl.viewentity].origin[0],
(int)cl.entities[cl.viewentity].origin[1],
(int)cl.entities[cl.viewentity].origin[2],
(int)cl.viewangles[PITCH],
(int)cl.viewangles[YAW],
(int)cl.viewangles[ROLL]);
else if (r_speeds.value == 2)
Con_Printf ("%3i ms %4i/%4i wpoly %4i/%4i epoly %3i lmap %4i/%4i sky %1.1f mtex\n",
(int)((time2-time1)*1000),

View file

@ -94,7 +94,6 @@ cvar_t scr_fov = {"fov","90",CVAR_NONE}; // 10 - 170
cvar_t scr_fov_adapt = {"fov_adapt","1",CVAR_ARCHIVE};
cvar_t scr_conspeed = {"scr_conspeed","500",CVAR_ARCHIVE};
cvar_t scr_centertime = {"scr_centertime","2",CVAR_NONE};
cvar_t scr_showram = {"showram","1",CVAR_NONE};
cvar_t scr_showturtle = {"showturtle","0",CVAR_NONE};
cvar_t scr_showpause = {"showpause","1",CVAR_NONE};
cvar_t scr_printspeed = {"scr_printspeed","8",CVAR_NONE};
@ -106,7 +105,6 @@ extern cvar_t crosshair;
qboolean scr_initialized; // ready to draw
qpic_t *scr_ram;
qpic_t *scr_net;
qpic_t *scr_turtle;
@ -471,7 +469,6 @@ SCR_LoadPics -- johnfitz
*/
void SCR_LoadPics (void)
{
scr_ram = Draw_PicFromWad ("ram");
scr_net = Draw_PicFromWad ("net");
scr_turtle = Draw_PicFromWad ("turtle");
}
@ -504,7 +501,6 @@ void SCR_Init (void)
Cvar_RegisterVariable (&scr_fov_adapt);
Cvar_RegisterVariable (&scr_viewsize);
Cvar_RegisterVariable (&scr_conspeed);
Cvar_RegisterVariable (&scr_showram);
Cvar_RegisterVariable (&scr_showturtle);
Cvar_RegisterVariable (&scr_showpause);
Cvar_RegisterVariable (&scr_centertime);
@ -641,24 +637,6 @@ void SCR_DrawDevStats (void)
Draw_String (x, (y++)*8-x, str);
}
/*
==============
SCR_DrawRam
==============
*/
void SCR_DrawRam (void)
{
if (!scr_showram.value)
return;
if (!r_cache_thrash)
return;
GL_SetCanvas (CANVAS_DEFAULT); //johnfitz
Draw_Pic (scr_vrect.x+32, scr_vrect.y, scr_ram);
}
/*
==============
SCR_DrawTurtle
@ -1244,7 +1222,6 @@ void SCR_UpdateScreen (void)
}
else
{
SCR_DrawRam ();
SCR_DrawNet ();
SCR_DrawTurtle ();
SCR_DrawPause ();

View file

@ -29,9 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
float Fog_GetDensity(void);
float *Fog_GetColor(void);
extern qmodel_t *loadmodel;
extern int rs_skypolys; //for r_speeds readout
extern int rs_skypasses; //for r_speeds readout
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];
@ -98,7 +98,7 @@ Sky_LoadTexture
A sky texture is 256*128, with the left side being a masked overlay
==============
*/
void Sky_LoadTexture (texture_t *mt, enum srcformat fmt, unsigned int srcwidth, unsigned int height)
void Sky_LoadTexture (qmodel_t *mod, texture_t *mt, enum srcformat fmt, unsigned int srcwidth, unsigned int height)
{
char texturename[64];
int i, p, r, g, b, count;
@ -123,8 +123,8 @@ void Sky_LoadTexture (texture_t *mt, enum srcformat fmt, unsigned int srcwidth,
for (i=0 ; i<rows ; i++)
memcpy(back_data+bb*i*columns, src+bb*(i*columns*2 + columns), columns*bb);
q_snprintf(texturename, sizeof(texturename), "%s:%s_back", loadmodel->name, mt->name);
solidskytexture = TexMgr_LoadImage (loadmodel, texturename, width, height, fmt, back_data, "", (src_offset_t)back_data, TEXPREF_NONE);
q_snprintf(texturename, sizeof(texturename), "%s:%s_back", mod->name, mt->name);
solidskytexture = TexMgr_LoadImage (mod, texturename, width, height, fmt, back_data, "", (src_offset_t)back_data, TEXPREF_NONE);
// extract front layer and upload
for (i=0 ; i<rows ; i++)
@ -137,8 +137,8 @@ void Sky_LoadTexture (texture_t *mt, enum srcformat fmt, unsigned int srcwidth,
front_data[i] = 255;
}
}
q_snprintf(texturename, sizeof(texturename), "%s:%s_front", loadmodel->name, mt->name);
alphaskytexture = TexMgr_LoadImage (loadmodel, texturename, width, height, fmt, front_data, "", (src_offset_t)front_data, TEXPREF_ALPHA);
q_snprintf(texturename, sizeof(texturename), "%s:%s_front", mod->name, mt->name);
alphaskytexture = TexMgr_LoadImage (mod, texturename, width, height, fmt, front_data, "", (src_offset_t)front_data, TEXPREF_ALPHA);
// calculate r_fastsky color based on average of all opaque foreground colors, if we can.
r = g = b = count = 0;
@ -157,6 +157,7 @@ void Sky_LoadTexture (texture_t *mt, enum srcformat fmt, unsigned int srcwidth,
}
}
}
skyflatcolor[0] = (float)r/(count*255);
skyflatcolor[1] = (float)g/(count*255);
skyflatcolor[2] = (float)b/(count*255);
@ -169,7 +170,7 @@ Sky_LoadTextureQ64
Quake64 sky textures are 32*64
==============
*/
void Sky_LoadTextureQ64 (texture_t *mt)
void Sky_LoadTextureQ64 (qmodel_t *mod, texture_t *mt)
{
char texturename[64];
unsigned i, p, r, g, b, count, halfheight, *rgba;
@ -189,8 +190,8 @@ void Sky_LoadTextureQ64 (texture_t *mt)
front_rgba = (byte *) Hunk_AllocName (4*mt->width*halfheight, "q64_skytex");
// Normal indexed texture for the back layer
q_snprintf(texturename, sizeof(texturename), "%s:%s_back", loadmodel->name, mt->name);
solidskytexture = TexMgr_LoadImage (loadmodel, texturename, mt->width, halfheight, SRC_INDEXED, back, "", (src_offset_t)back, TEXPREF_NONE);
q_snprintf(texturename, sizeof(texturename), "%s:%s_back", mod->name, mt->name);
solidskytexture = TexMgr_LoadImage (mod, texturename, mt->width, halfheight, SRC_INDEXED, back, "", (src_offset_t)back, TEXPREF_NONE);
// front layer, convert to RGBA and upload
p = r = g = b = count = 0;
@ -213,8 +214,8 @@ void Sky_LoadTextureQ64 (texture_t *mt)
count++;
}
q_snprintf(texturename, sizeof(texturename), "%s:%s_front", loadmodel->name, mt->name);
alphaskytexture = TexMgr_LoadImage (loadmodel, texturename, mt->width, halfheight, SRC_RGBA, front_rgba, "", (src_offset_t)front_rgba, TEXPREF_ALPHA);
q_snprintf(texturename, sizeof(texturename), "%s:%s_front", mod->name, mt->name);
alphaskytexture = TexMgr_LoadImage (mod, texturename, mt->width, halfheight, SRC_RGBA, front_rgba, "", (src_offset_t)front_rgba, TEXPREF_ALPHA);
// calculate r_fastsky color based on average of all opaque foreground colors
skyflatcolor[0] = (float)r/(count*255);

View file

@ -670,7 +670,6 @@ void TexMgr_Init (void)
int i;
static byte notexture_data[16] = {159,91,83,255,0,0,0,255,0,0,0,255,159,91,83,255}; //black and pink checker
static byte nulltexture_data[16] = {127,191,255,255,0,0,0,255,0,0,0,255,127,191,255,255}; //black and blue checker
extern texture_t *r_notexture_mip, *r_notexture_mip2;
// init texture list
int initialtexturecount = 256;

View file

@ -45,8 +45,6 @@ float turbsin[] =
//
//==============================================================================
extern qmodel_t *loadmodel;
msurface_t *warpface;
cvar_t gl_subdivide_size = {"gl_subdivide_size", "128", CVAR_ARCHIVE};

View file

@ -131,13 +131,14 @@ typedef struct particle_s
//====================================================
extern qboolean r_cache_thrash; // compatability
extern vec3_t modelorg, r_entorigin;
extern entity_t *currententity;
extern int r_visframecount; // ??? what difs?
extern int r_framecount;
extern mplane_t frustum[4];
extern texture_t *r_notexture_mip, *r_notexture_mip2;
//
// view origin
//
@ -299,9 +300,8 @@ extern qboolean gl_texture_env_combine;
extern qboolean gl_texture_env_add; // for GL_EXT_texture_env_add
//johnfitz -- rendering statistics
extern int rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys;
extern int rs_brushpolys, rs_aliaspolys, rs_skypolys;
extern int rs_dynamiclightmaps, rs_brushpasses, rs_aliaspasses, rs_skypasses;
extern float rs_megatexels;
//johnfitz -- track developer statistics that vary every frame
extern cvar_t devstats;
@ -438,8 +438,8 @@ void Sky_Init (void);
void Sky_ClearAll (void);
void Sky_DrawSky (void);
void Sky_NewMap (void);
void Sky_LoadTexture (texture_t *mt, enum srcformat fmt, unsigned int width, unsigned int height);
void Sky_LoadTextureQ64 (texture_t *mt);
void Sky_LoadTexture (qmodel_t *mod, texture_t *mt, enum srcformat fmt, unsigned int width, unsigned int height);
void Sky_LoadTextureQ64 (qmodel_t *mod, texture_t *mt);
void Sky_LoadSkyBox (const char *name);
extern qboolean skyroom_drawn, skyroom_drawing; //we draw a skyroom this frame
extern qboolean skyroom_enabled; //we know where the skyroom is ...

View file

@ -30,8 +30,6 @@ extern cvar_t pausable;
int current_skill;
void Mod_Print (void);
/*
==================
Host_Quit_f
@ -2517,6 +2515,19 @@ static void Host_Stopdemo_f (void)
CL_Disconnect ();
}
/*
==================
Host_Resetdemos
Clear looping demo list (called on game change)
==================
*/
void Host_Resetdemos (void)
{
memset (cls.demos, 0, sizeof (cls.demos));
cls.demonum = 0;
}
//=============================================================================
//download stuff
@ -2877,7 +2888,5 @@ void Host_InitCommands (void)
Cmd_AddCommand ("viewframe", Host_Viewframe_f);
Cmd_AddCommand ("viewnext", Host_Viewnext_f);
Cmd_AddCommand ("viewprev", Host_Viewprev_f);
Cmd_AddCommand ("mcache", Mod_Print);
}

View file

@ -577,7 +577,7 @@ void Key_Console (int key)
// If the last two lines are identical, skip storing this line in history
// by not incrementing edit_line
if (strcmp(workline, key_lines[(edit_line-1)&(CMDLINES - 1)]))
if (strcmp(workline, key_lines[(edit_line - 1) & (CMDLINES - 1)]))
edit_line = (edit_line + 1) & (CMDLINES - 1);
history_line = edit_line;
@ -676,11 +676,11 @@ void Key_Console (int key)
len = strlen(workline);
if ((int)len == key_linepos)
{
len = strlen(key_lines[(edit_line + (CMDLINES-1)) & (CMDLINES-1)]);
len = strlen(key_lines[(edit_line + (CMDLINES - 1)) & (CMDLINES - 1)]);
if ((int)len <= key_linepos)
return; // no character to get
workline += key_linepos;
*workline = key_lines[(edit_line + (CMDLINES-1)) & (CMDLINES-1)][key_linepos];
*workline = key_lines[(edit_line + (CMDLINES - 1)) & (CMDLINES - 1)][key_linepos];
workline[1] = 0;
key_linepos++;
}
@ -698,7 +698,7 @@ void Key_Console (int key)
history_line_last = history_line;
do
{
history_line = (history_line - 1) & (CMDLINES-1);
history_line = (history_line - 1) & (CMDLINES - 1);
} while (history_line != edit_line && !key_lines[history_line][1]);
if (history_line == edit_line)
@ -721,7 +721,7 @@ void Key_Console (int key)
do
{
history_line = (history_line + 1) & (CMDLINES-1);
history_line = (history_line + 1) & (CMDLINES - 1);
} while (history_line != edit_line && !key_lines[history_line][1]);
if (history_line == edit_line)

View file

@ -1,5 +1,5 @@
/*
LodePNG version 20220109
LodePNG version 20220717
Copyright (c) 2005-2022 Lode Vandevenne
@ -44,10 +44,10 @@ Rename this file to lodepng.cpp to use it for C++, or to lodepng.c to use it for
#pragma warning( disable : 4996 ) /*VS does not like fopen, but fopen_s is not standard C so unusable here*/
#endif /*_MSC_VER */
const char* LODEPNG_VERSION_STRING = "20220109";
const char* LODEPNG_VERSION_STRING = "20220717";
/*
This source file is built up in the following large parts. The code sections
This source file is divided into the following large parts. The code sections
with the "LODEPNG_COMPILE_" #defines divide this up further in an intermixed way.
-Tools for C and common code for PNG and Zlib
-C Code for Zlib (huffman, deflate, ...)
@ -713,10 +713,11 @@ static unsigned HuffmanTree_makeTable(HuffmanTree* tree) {
numpresent = 0;
for(i = 0; i < tree->numcodes; ++i) {
unsigned l = tree->lengths[i];
unsigned symbol = tree->codes[i]; /*the huffman bit pattern. i itself is the value.*/
/*reverse bits, because the huffman bits are given in MSB first order but the bit reader reads LSB first*/
unsigned reverse = reverseBits(symbol, l);
unsigned symbol, reverse;
if(l == 0) continue;
symbol = tree->codes[i]; /*the huffman bit pattern. i itself is the value.*/
/*reverse bits, because the huffman bits are given in MSB first order but the bit reader reads LSB first*/
reverse = reverseBits(symbol, l);
numpresent++;
if(l <= FIRSTBITS) {
@ -1369,8 +1370,11 @@ static unsigned inflateNoCompression(ucvector* out, LodePNGBitReader* reader,
/*read the literal data: LEN bytes are now stored in the out buffer*/
if(bytepos + LEN > size) return 23; /*error: reading outside of in buffer*/
lodepng_memcpy(out->data + out->size - LEN, reader->data + bytepos, LEN);
bytepos += LEN;
/*out->data can be NULL (when LEN is zero), and arithmetics on NULL ptr is undefined*/
if (LEN) {
lodepng_memcpy(out->data + out->size - LEN, reader->data + bytepos, LEN);
bytepos += LEN;
}
reader->bp = bytepos << 3u;
@ -2371,7 +2375,7 @@ const LodePNGDecompressSettings lodepng_default_decompress_settings = {0, 0, 0,
/* ////////////////////////////////////////////////////////////////////////// */
#ifndef LODEPNG_NO_COMPILE_CRC
#ifdef LODEPNG_COMPILE_CRC
/* CRC polynomial: 0xedb88320 */
static unsigned lodepng_crc32_table[256] = {
0u, 1996959894u, 3993919788u, 2567524794u, 124634137u, 1886057615u, 3915621685u, 2657392035u,
@ -2417,9 +2421,11 @@ unsigned lodepng_crc32(const unsigned char* data, size_t length) {
}
return r ^ 0xffffffffu;
}
#else /* !LODEPNG_NO_COMPILE_CRC */
#else /* LODEPNG_COMPILE_CRC */
/*in this case, the function is only declared here, and must be defined externally
so that it will be linked in*/
unsigned lodepng_crc32(const unsigned char* data, size_t length);
#endif /* !LODEPNG_NO_COMPILE_CRC */
#endif /* LODEPNG_COMPILE_CRC */
/* ////////////////////////////////////////////////////////////////////////// */
/* / Reading and writing PNG color channel bits / */
@ -2457,7 +2463,7 @@ static void setBitOfReversedStream(size_t* bitpointer, unsigned char* bitstream,
/* ////////////////////////////////////////////////////////////////////////// */
unsigned lodepng_chunk_length(const unsigned char* chunk) {
return lodepng_read32bitInt(&chunk[0]);
return lodepng_read32bitInt(chunk);
}
void lodepng_chunk_type(char type[5], const unsigned char* chunk) {
@ -2507,34 +2513,32 @@ void lodepng_chunk_generate_crc(unsigned char* chunk) {
}
unsigned char* lodepng_chunk_next(unsigned char* chunk, unsigned char* end) {
if(chunk >= end || end - chunk < 12) return end; /*too small to contain a chunk*/
size_t available_size = (size_t)(end - chunk);
if(chunk >= end || available_size < 12) return end; /*too small to contain a chunk*/
if(chunk[0] == 0x89 && chunk[1] == 0x50 && chunk[2] == 0x4e && chunk[3] == 0x47
&& chunk[4] == 0x0d && chunk[5] == 0x0a && chunk[6] == 0x1a && chunk[7] == 0x0a) {
/* Is PNG magic header at start of PNG file. Jump to first actual chunk. */
return chunk + 8;
} else {
size_t total_chunk_length;
unsigned char* result;
if(lodepng_addofl(lodepng_chunk_length(chunk), 12, &total_chunk_length)) return end;
result = chunk + total_chunk_length;
if(result < chunk) return end; /*pointer overflow*/
return result;
if(total_chunk_length > available_size) return end; /*outside of range*/
return chunk + total_chunk_length;
}
}
const unsigned char* lodepng_chunk_next_const(const unsigned char* chunk, const unsigned char* end) {
if(chunk >= end || end - chunk < 12) return end; /*too small to contain a chunk*/
size_t available_size = (size_t)(end - chunk);
if(chunk >= end || available_size < 12) return end; /*too small to contain a chunk*/
if(chunk[0] == 0x89 && chunk[1] == 0x50 && chunk[2] == 0x4e && chunk[3] == 0x47
&& chunk[4] == 0x0d && chunk[5] == 0x0a && chunk[6] == 0x1a && chunk[7] == 0x0a) {
/* Is PNG magic header at start of PNG file. Jump to first actual chunk. */
return chunk + 8;
} else {
size_t total_chunk_length;
const unsigned char* result;
if(lodepng_addofl(lodepng_chunk_length(chunk), 12, &total_chunk_length)) return end;
result = chunk + total_chunk_length;
if(result < chunk) return end; /*pointer overflow*/
return result;
if(total_chunk_length > available_size) return end; /*outside of range*/
return chunk + total_chunk_length;
}
}
@ -3044,6 +3048,9 @@ void lodepng_info_init(LodePNGInfo* info) {
info->iccp_name = NULL;
info->iccp_profile = NULL;
info->sbit_defined = 0;
info->sbit_r = info->sbit_g = info->sbit_b = info->sbit_a = 0;
LodePNGUnknownChunks_init(info);
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
}
@ -3588,6 +3595,9 @@ unsigned lodepng_convert(unsigned char* out, const unsigned char* in,
return error;
}
#ifdef LODEPNG_COMPILE_ENCODER
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
/* Converts a single rgb color without alpha from one type to another, color bits truncated to
their bitdepth. In case of single channel (gray or palette), only the r channel is used. Slow
@ -3595,7 +3605,7 @@ function, do not use to process all pixels of an image. Alpha channel not suppor
this is for bKGD, supporting alpha may prevent it from finding a color in the palette, from the
specification it looks like bKGD should ignore the alpha values of the palette since it can use
any palette index but doesn't have an alpha channel. Idem with ignoring color key. */
unsigned lodepng_convert_rgb(
static unsigned lodepng_convert_rgb(
unsigned* r_out, unsigned* g_out, unsigned* b_out,
unsigned r_in, unsigned g_in, unsigned b_in,
const LodePNGColorMode* mode_out, const LodePNGColorMode* mode_in) {
@ -3645,7 +3655,7 @@ unsigned lodepng_convert_rgb(
return 0;
}
#ifdef LODEPNG_COMPILE_ENCODER
#endif /* LODEPNG_COMPILE_ANCILLARY_CHUNKS */
void lodepng_color_stats_init(LodePNGColorStats* stats) {
/*stats*/
@ -3938,7 +3948,7 @@ static unsigned auto_choose_color(LodePNGColorMode* mode_out,
if(mode_in->colortype == LCT_PALETTE && mode_in->palettesize >= mode_out->palettesize
&& mode_in->bitdepth == mode_out->bitdepth) {
/*If input should have same palette colors, keep original to preserve its order and prevent conversion*/
lodepng_color_mode_cleanup(mode_out);
lodepng_color_mode_cleanup(mode_out); /*clears palette, keeps the above set colortype and bitdepth fields as-is*/
lodepng_color_mode_copy(mode_out, mode_in);
}
} else /*8-bit or 16-bit per channel*/ {
@ -4725,6 +4735,47 @@ static unsigned readChunk_iCCP(LodePNGInfo* info, const LodePNGDecoderSettings*
if(!error && !info->iccp_profile_size) error = 100; /*invalid ICC profile size*/
return error;
}
/*significant bits chunk (sBIT)*/
static unsigned readChunk_sBIT(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) {
unsigned bitdepth = (info->color.colortype == LCT_PALETTE) ? 8 : info->color.bitdepth;
if(info->color.colortype == LCT_GREY) {
/*error: this chunk must be 1 bytes for grayscale image*/
if(chunkLength != 1) return 114;
if(data[0] == 0 || data[0] > bitdepth) return 115;
info->sbit_defined = 1;
info->sbit_r = info->sbit_g = info->sbit_b = data[0]; /*setting g and b is not required, but sensible*/
} else if(info->color.colortype == LCT_RGB || info->color.colortype == LCT_PALETTE) {
/*error: this chunk must be 3 bytes for RGB and palette image*/
if(chunkLength != 3) return 114;
if(data[0] == 0 || data[1] == 0 || data[2] == 0) return 115;
if(data[0] > bitdepth || data[1] > bitdepth || data[2] > bitdepth) return 115;
info->sbit_defined = 1;
info->sbit_r = data[0];
info->sbit_g = data[1];
info->sbit_b = data[2];
} else if(info->color.colortype == LCT_GREY_ALPHA) {
/*error: this chunk must be 2 byte for grayscale with alpha image*/
if(chunkLength != 2) return 114;
if(data[0] == 0 || data[1] == 0) return 115;
if(data[0] > bitdepth || data[1] > bitdepth) return 115;
info->sbit_defined = 1;
info->sbit_r = info->sbit_g = info->sbit_b = data[0]; /*setting g and b is not required, but sensible*/
info->sbit_a = data[1];
} else if(info->color.colortype == LCT_RGBA) {
/*error: this chunk must be 4 bytes for grayscale image*/
if(chunkLength != 4) return 114;
if(data[0] == 0 || data[1] == 0 || data[2] == 0 || data[3] == 0) return 115;
if(data[0] > bitdepth || data[1] > bitdepth || data[2] > bitdepth || data[3] > bitdepth) return 115;
info->sbit_defined = 1;
info->sbit_r = data[0];
info->sbit_g = data[1];
info->sbit_b = data[2];
info->sbit_a = data[3];
}
return 0; /* OK */
}
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
unsigned lodepng_inspect_chunk(LodePNGState* state, size_t pos,
@ -4739,7 +4790,7 @@ unsigned lodepng_inspect_chunk(LodePNGState* state, size_t pos,
chunkLength = lodepng_chunk_length(chunk);
if(chunkLength > 2147483647) return 63;
data = lodepng_chunk_data_const(chunk);
if(data + chunkLength + 4 > in + insize) return 30;
if(chunkLength + 12 > insize - pos) return 30;
if(lodepng_chunk_type_equals(chunk, "PLTE")) {
error = readChunk_PLTE(&state->info_png.color, data, chunkLength);
@ -4766,6 +4817,8 @@ unsigned lodepng_inspect_chunk(LodePNGState* state, size_t pos,
error = readChunk_sRGB(&state->info_png, data, chunkLength);
} else if(lodepng_chunk_type_equals(chunk, "iCCP")) {
error = readChunk_iCCP(&state->info_png, &state->decoder, data, chunkLength);
} else if(lodepng_chunk_type_equals(chunk, "sBIT")) {
error = readChunk_sBIT(&state->info_png, data, chunkLength);
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
} else {
/* unhandled chunk is ok (is not an error) */
@ -4784,7 +4837,7 @@ static void decodeGeneric(unsigned char** out, unsigned* w, unsigned* h,
LodePNGState* state,
const unsigned char* in, size_t insize) {
unsigned char IEND = 0;
const unsigned char* chunk;
const unsigned char* chunk; /*points to beginning of next chunk*/
unsigned char* idat; /*the data from idat chunks, zlib compressed*/
size_t idatsize = 0;
unsigned char* scanlines = 0;
@ -4820,14 +4873,15 @@ static void decodeGeneric(unsigned char** out, unsigned* w, unsigned* h,
while(!IEND && !state->error) {
unsigned chunkLength;
const unsigned char* data; /*the data in the chunk*/
size_t pos = (size_t)(chunk - in);
/*error: size of the in buffer too small to contain next chunk*/
if((size_t)((chunk - in) + 12) > insize || chunk < in) {
/*error: next chunk out of bounds of the in buffer*/
if(chunk < in || pos + 12 > insize) {
if(state->decoder.ignore_end) break; /*other errors may still happen though*/
CERROR_BREAK(state->error, 30);
}
/*length of the data of the chunk, excluding the length bytes, chunk type and CRC bytes*/
/*length of the data of the chunk, excluding the 12 bytes for length, chunk type and CRC*/
chunkLength = lodepng_chunk_length(chunk);
/*error: chunk length larger than the max PNG chunk size*/
if(chunkLength > 2147483647) {
@ -4835,8 +4889,8 @@ static void decodeGeneric(unsigned char** out, unsigned* w, unsigned* h,
CERROR_BREAK(state->error, 63);
}
if((size_t)((chunk - in) + chunkLength + 12) > insize || (chunk + chunkLength + 12) < in) {
CERROR_BREAK(state->error, 64); /*error: size of the in buffer too small to contain next chunk*/
if(pos + (size_t)chunkLength + 12 > insize || pos + (size_t)chunkLength + 12 < pos) {
CERROR_BREAK(state->error, 64); /*error: size of the in buffer too small to contain next chunk (or int overflow)*/
}
data = lodepng_chunk_data_const(chunk);
@ -4910,6 +4964,9 @@ static void decodeGeneric(unsigned char** out, unsigned* w, unsigned* h,
} else if(lodepng_chunk_type_equals(chunk, "iCCP")) {
state->error = readChunk_iCCP(&state->info_png, &state->decoder, data, chunkLength);
if(state->error) break;
} else if(lodepng_chunk_type_equals(chunk, "sBIT")) {
state->error = readChunk_sBIT(&state->info_png, data, chunkLength);
if(state->error) break;
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
} else /*it's not an implemented chunk type, so ignore it: skip over the data*/ {
/*error: unknown critical chunk (5th bit of first byte of chunk type is 0)*/
@ -5145,6 +5202,10 @@ static unsigned addChunk_PLTE(ucvector* out, const LodePNGColorMode* info) {
unsigned char* chunk;
size_t i, j = 8;
if(info->palettesize == 0 || info->palettesize > 256) {
return 68; /*invalid palette size, it is only allowed to be 1-256*/
}
CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, info->palettesize * 3, "PLTE"));
for(i = 0; i != info->palettesize; ++i) {
@ -5400,6 +5461,42 @@ static unsigned addChunk_iCCP(ucvector* out, const LodePNGInfo* info, LodePNGCom
return error;
}
static unsigned addChunk_sBIT(ucvector* out, const LodePNGInfo* info) {
unsigned bitdepth = (info->color.colortype == LCT_PALETTE) ? 8 : info->color.bitdepth;
unsigned char* chunk = 0;
if(info->color.colortype == LCT_GREY) {
if(info->sbit_r == 0 || info->sbit_r > bitdepth) return 115;
CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 1, "sBIT"));
chunk[8] = info->sbit_r;
} else if(info->color.colortype == LCT_RGB || info->color.colortype == LCT_PALETTE) {
if(info->sbit_r == 0 || info->sbit_g == 0 || info->sbit_b == 0) return 115;
if(info->sbit_r > bitdepth || info->sbit_g > bitdepth || info->sbit_b > bitdepth) return 115;
CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 3, "sBIT"));
chunk[8] = info->sbit_r;
chunk[9] = info->sbit_g;
chunk[10] = info->sbit_b;
} else if(info->color.colortype == LCT_GREY_ALPHA) {
if(info->sbit_r == 0 || info->sbit_a == 0) return 115;
if(info->sbit_r > bitdepth || info->sbit_a > bitdepth) return 115;
CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 2, "sBIT"));
chunk[8] = info->sbit_r;
chunk[9] = info->sbit_a;
} else if(info->color.colortype == LCT_RGBA) {
if(info->sbit_r == 0 || info->sbit_g == 0 || info->sbit_b == 0 || info->sbit_a == 0 ||
info->sbit_r > bitdepth || info->sbit_g > bitdepth ||
info->sbit_b > bitdepth || info->sbit_a > bitdepth) {
return 115;
}
CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 4, "sBIT"));
chunk[8] = info->sbit_r;
chunk[9] = info->sbit_g;
chunk[10] = info->sbit_b;
chunk[11] = info->sbit_a;
}
if(chunk) lodepng_chunk_generate_crc(chunk);
return 0;
}
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
static void filterScanline(unsigned char* out, const unsigned char* scanline, const unsigned char* prevline,
@ -5845,8 +5942,10 @@ unsigned lodepng_encode(unsigned char** out, size_t* outsize,
ucvector outv = ucvector_init(NULL, 0);
LodePNGInfo info;
const LodePNGInfo* info_png = &state->info_png;
LodePNGColorMode auto_color;
lodepng_info_init(&info);
lodepng_color_mode_init(&auto_color);
/*provide some proper output values if error will happen*/
*out = 0;
@ -5856,6 +5955,10 @@ unsigned lodepng_encode(unsigned char** out, size_t* outsize,
/*check input values validity*/
if((info_png->color.colortype == LCT_PALETTE || state->encoder.force_palette)
&& (info_png->color.palettesize == 0 || info_png->color.palettesize > 256)) {
/*this error is returned even if auto_convert is enabled and thus encoder could
generate the palette by itself: while allowing this could be possible in theory,
it may complicate the code or edge cases, and always requiring to give a palette
when setting this color type is a simpler contract*/
state->error = 68; /*invalid palette size, it is only allowed to be 1-256*/
goto cleanup;
}
@ -5876,6 +5979,7 @@ unsigned lodepng_encode(unsigned char** out, size_t* outsize,
lodepng_info_copy(&info, &state->info_png);
if(state->encoder.auto_convert) {
LodePNGColorStats stats;
unsigned allow_convert = 1;
lodepng_color_stats_init(&stats);
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
if(info_png->iccp_defined &&
@ -5897,23 +6001,85 @@ unsigned lodepng_encode(unsigned char** out, size_t* outsize,
/*the background chunk's color must be taken into account as well*/
unsigned r = 0, g = 0, b = 0;
LodePNGColorMode mode16 = lodepng_color_mode_make(LCT_RGB, 16);
lodepng_convert_rgb(&r, &g, &b, info_png->background_r, info_png->background_g, info_png->background_b, &mode16, &info_png->color);
lodepng_convert_rgb(&r, &g, &b,
info_png->background_r, info_png->background_g, info_png->background_b, &mode16, &info_png->color);
state->error = lodepng_color_stats_add(&stats, r, g, b, 65535);
if(state->error) goto cleanup;
}
#endif /* LODEPNG_COMPILE_ANCILLARY_CHUNKS */
state->error = auto_choose_color(&info.color, &state->info_raw, &stats);
state->error = auto_choose_color(&auto_color, &state->info_raw, &stats);
if(state->error) goto cleanup;
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
/*also convert the background chunk*/
if(info_png->background_defined) {
if(lodepng_convert_rgb(&info.background_r, &info.background_g, &info.background_b,
info_png->background_r, info_png->background_g, info_png->background_b, &info.color, &info_png->color)) {
state->error = 104;
goto cleanup;
if(info_png->sbit_defined) {
/*if sbit is defined, due to strict requirements of which sbit values can be present for which color modes,
auto_convert can't be done in many cases. However, do support a few cases here.
TODO: more conversions may be possible, and it may also be possible to get a more appropriate color type out of
auto_choose_color if knowledge about sbit is used beforehand
*/
unsigned sbit_max = LODEPNG_MAX(LODEPNG_MAX(LODEPNG_MAX(info_png->sbit_r, info_png->sbit_g),
info_png->sbit_b), info_png->sbit_a);
unsigned equal = (!info_png->sbit_g || info_png->sbit_g == info_png->sbit_r)
&& (!info_png->sbit_b || info_png->sbit_b == info_png->sbit_r)
&& (!info_png->sbit_a || info_png->sbit_a == info_png->sbit_r);
allow_convert = 0;
if(info.color.colortype == LCT_PALETTE &&
auto_color.colortype == LCT_PALETTE) {
/* input and output are palette, and in this case it may happen that palette data is
expected to be copied from info_raw into the info_png */
allow_convert = 1;
}
/*going from 8-bit RGB to palette (or 16-bit as long as sbit_max <= 8) is possible
since both are 8-bit RGB for sBIT's purposes*/
if(info.color.colortype == LCT_RGB &&
auto_color.colortype == LCT_PALETTE && sbit_max <= 8) {
allow_convert = 1;
}
/*going from 8-bit RGBA to palette is also ok but only if sbit_a is exactly 8*/
if(info.color.colortype == LCT_RGBA && auto_color.colortype == LCT_PALETTE &&
info_png->sbit_a == 8 && sbit_max <= 8) {
allow_convert = 1;
}
/*going from 16-bit RGB(A) to 8-bit RGB(A) is ok if all sbit values are <= 8*/
if((info.color.colortype == LCT_RGB || info.color.colortype == LCT_RGBA) && info.color.bitdepth == 16 &&
auto_color.colortype == info.color.colortype && auto_color.bitdepth == 8 &&
sbit_max <= 8) {
allow_convert = 1;
}
/*going to less channels is ok if all bit values are equal (all possible values in sbit,
as well as the chosen bitdepth of the result). Due to how auto_convert works,
we already know that auto_color.colortype has less than or equal amount of channels than
info.colortype. Palette is not used here. This conversion is not allowed if
info_png->sbit_r < auto_color.bitdepth, because specifically for alpha, non-presence of
an sbit value heavily implies that alpha's bit depth is equal to the PNG bit depth (rather
than the bit depths set in the r, g and b sbit values, by how the PNG specification describes
handling tRNS chunk case with sBIT), so be conservative here about ignoring user input.*/
if(info.color.colortype != LCT_PALETTE && auto_color.colortype != LCT_PALETTE &&
equal && info_png->sbit_r == auto_color.bitdepth) {
allow_convert = 1;
}
}
#endif
if(state->encoder.force_palette) {
if(info.color.colortype != LCT_GREY && info.color.colortype != LCT_GREY_ALPHA &&
(auto_color.colortype == LCT_GREY || auto_color.colortype == LCT_GREY_ALPHA)) {
/*user speficially forced a PLTE palette, so cannot convert to grayscale types because
the PNG specification only allows writing a suggested palette in PLTE for truecolor types*/
allow_convert = 0;
}
}
if(allow_convert) {
lodepng_color_mode_copy(&info.color, &auto_color);
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
/*also convert the background chunk*/
if(info_png->background_defined) {
if(lodepng_convert_rgb(&info.background_r, &info.background_g, &info.background_b,
info_png->background_r, info_png->background_g, info_png->background_b, &info.color, &info_png->color)) {
state->error = 104;
goto cleanup;
}
}
#endif /* LODEPNG_COMPILE_ANCILLARY_CHUNKS */
}
}
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
if(info_png->iccp_defined) {
@ -5984,6 +6150,10 @@ unsigned lodepng_encode(unsigned char** out, size_t* outsize,
state->error = addChunk_cHRM(&outv, &info);
if(state->error) goto cleanup;
}
if(info_png->sbit_defined) {
state->error = addChunk_sBIT(&outv, &info);
if(state->error) goto cleanup;
}
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
/*PLTE*/
if(info.color.colortype == LCT_PALETTE) {
@ -6090,6 +6260,7 @@ unsigned lodepng_encode(unsigned char** out, size_t* outsize,
cleanup:
lodepng_info_cleanup(&info);
lodepng_free(data);
lodepng_color_mode_cleanup(&auto_color);
/*instead of cleaning the vector up, give it to the output*/
*out = outv.data;
@ -6284,6 +6455,8 @@ const char* lodepng_error_text(unsigned code) {
/*max ICC size limit can be configured in LodePNGDecoderSettings. This error prevents
unreasonable memory consumption when decoding due to impossibly large ICC profile*/
case 113: return "ICC profile unreasonably large";
case 114: return "sBIT chunk has wrong size for the color type of the image";
case 115: return "sBIT value out of range";
}
return "unknown error code";
}
@ -6322,7 +6495,7 @@ unsigned decompress(std::vector<unsigned char>& out, const unsigned char* in, si
size_t buffersize = 0;
unsigned error = zlib_decompress(&buffer, &buffersize, 0, in, insize, &settings);
if(buffer) {
out.insert(out.end(), &buffer[0], &buffer[buffersize]);
out.insert(out.end(), buffer, &buffer[buffersize]);
lodepng_free(buffer);
}
return error;
@ -6341,7 +6514,7 @@ unsigned compress(std::vector<unsigned char>& out, const unsigned char* in, size
size_t buffersize = 0;
unsigned error = zlib_compress(&buffer, &buffersize, in, insize, &settings);
if(buffer) {
out.insert(out.end(), &buffer[0], &buffer[buffersize]);
out.insert(out.end(), buffer, &buffer[buffersize]);
lodepng_free(buffer);
}
return error;
@ -6386,7 +6559,7 @@ unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h, const
state.info_raw.colortype = colortype;
state.info_raw.bitdepth = bitdepth;
size_t buffersize = lodepng_get_raw_size(w, h, &state.info_raw);
out.insert(out.end(), &buffer[0], &buffer[buffersize]);
out.insert(out.end(), buffer, &buffer[buffersize]);
}
lodepng_free(buffer);
return error;
@ -6404,7 +6577,7 @@ unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h,
unsigned error = lodepng_decode(&buffer, &w, &h, &state, in, insize);
if(buffer && !error) {
size_t buffersize = lodepng_get_raw_size(w, h, &state.info_raw);
out.insert(out.end(), &buffer[0], &buffer[buffersize]);
out.insert(out.end(), buffer, &buffer[buffersize]);
}
lodepng_free(buffer);
return error;
@ -6436,7 +6609,7 @@ unsigned encode(std::vector<unsigned char>& out, const unsigned char* in, unsign
size_t buffersize;
unsigned error = lodepng_encode_memory(&buffer, &buffersize, in, w, h, colortype, bitdepth);
if(buffer) {
out.insert(out.end(), &buffer[0], &buffer[buffersize]);
out.insert(out.end(), buffer, &buffer[buffersize]);
lodepng_free(buffer);
}
return error;
@ -6456,7 +6629,7 @@ unsigned encode(std::vector<unsigned char>& out,
size_t buffersize;
unsigned error = lodepng_encode(&buffer, &buffersize, in, w, h, &state);
if(buffer) {
out.insert(out.end(), &buffer[0], &buffer[buffersize]);
out.insert(out.end(), buffer, &buffer[buffersize]);
lodepng_free(buffer);
}
return error;

View file

@ -1,5 +1,5 @@
/*
LodePNG version 20220109
LodePNG version 20220717
Copyright (c) 2005-2022 Lode Vandevenne
@ -35,43 +35,50 @@ The following #defines are used to create code sections. They can be disabled
to disable code sections, which can give faster compile time and smaller binary.
The "NO_COMPILE" defines are designed to be used to pass as defines to the
compiler command to disable them without modifying this header, e.g.
-DLODEPNG_NO_COMPILE_ZLIB for gcc.
In addition to those below, you can also define LODEPNG_NO_COMPILE_CRC to
allow implementing a custom lodepng_crc32.
-DLODEPNG_NO_COMPILE_ZLIB for gcc or clang.
*/
/*deflate & zlib. If disabled, you must specify alternative zlib functions in
the custom_zlib field of the compress and decompress settings*/
#ifndef LODEPNG_NO_COMPILE_ZLIB
/*pass -DLODEPNG_NO_COMPILE_ZLIB to the compiler to disable this, or comment out LODEPNG_COMPILE_ZLIB below*/
#define LODEPNG_COMPILE_ZLIB
#endif
/*png encoder and png decoder*/
#ifndef LODEPNG_NO_COMPILE_PNG
/*pass -DLODEPNG_NO_COMPILE_PNG to the compiler to disable this, or comment out LODEPNG_COMPILE_PNG below*/
#define LODEPNG_COMPILE_PNG
#endif
/*deflate&zlib decoder and png decoder*/
#ifndef LODEPNG_NO_COMPILE_DECODER
/*pass -DLODEPNG_NO_COMPILE_DECODER to the compiler to disable this, or comment out LODEPNG_COMPILE_DECODER below*/
#define LODEPNG_COMPILE_DECODER
#endif
/*deflate&zlib encoder and png encoder*/
#ifndef LODEPNG_NO_COMPILE_ENCODER
/*pass -DLODEPNG_NO_COMPILE_ENCODER to the compiler to disable this, or comment out LODEPNG_COMPILE_ENCODER below*/
#define LODEPNG_COMPILE_ENCODER
#endif
/*the optional built in harddisk file loading and saving functions*/
#ifndef LODEPNG_NO_COMPILE_DISK
/*pass -DLODEPNG_NO_COMPILE_DISK to the compiler to disable this, or comment out LODEPNG_COMPILE_DISK below*/
#define LODEPNG_COMPILE_DISK
#endif
/*support for chunks other than IHDR, IDAT, PLTE, tRNS, IEND: ancillary and unknown chunks*/
#ifndef LODEPNG_NO_COMPILE_ANCILLARY_CHUNKS
/*pass -DLODEPNG_NO_COMPILE_ANCILLARY_CHUNKS to the compiler to disable this,
or comment out LODEPNG_COMPILE_ANCILLARY_CHUNKS below*/
#define LODEPNG_COMPILE_ANCILLARY_CHUNKS
#endif
/*ability to convert error numerical codes to English text string*/
#ifndef LODEPNG_NO_COMPILE_ERROR_TEXT
/*pass -DLODEPNG_NO_COMPILE_ERROR_TEXT to the compiler to disable this,
or comment out LODEPNG_COMPILE_ERROR_TEXT below*/
#define LODEPNG_COMPILE_ERROR_TEXT
#endif
@ -79,12 +86,24 @@ the custom_zlib field of the compress and decompress settings*/
you can define the functions lodepng_free, lodepng_malloc and lodepng_realloc in your
source files with custom allocators.*/
#ifndef LODEPNG_NO_COMPILE_ALLOCATORS
/*pass -DLODEPNG_NO_COMPILE_ALLOCATORS to the compiler to disable the built-in ones,
or comment out LODEPNG_COMPILE_ALLOCATORS below*/
#define LODEPNG_COMPILE_ALLOCATORS
#endif
/*Disable built-in CRC function, in that case a custom implementation of
lodepng_crc32 must be defined externally so that it can be linked in.*/
#ifndef LODEPNG_NO_COMPILE_CRC
/*pass -DLODEPNG_NO_COMPILE_CRC to the compiler to disable the built-in one,
or comment out LODEPNG_COMPILE_CRC below*/
#define LODEPNG_COMPILE_CRC
#endif
/*compile the C++ version (you can disable the C++ wrapper here even when compiling for C++)*/
#ifdef __cplusplus
#ifndef LODEPNG_NO_COMPILE_CPP
/*pass -DLODEPNG_NO_COMPILE_CPP to the compiler to disable C++ (not needed if a C-only compiler),
or comment out LODEPNG_COMPILE_CPP below*/
#define LODEPNG_COMPILE_CPP
#endif
#endif
@ -374,8 +393,10 @@ typedef struct LodePNGColorMode {
The alpha channels must be set as well, set them to 255 for opaque images.
When decoding, by default you can ignore this palette, since LodePNG already
fills the palette colors in the pixels of the raw RGBA output.
When decoding, with the default settings you can ignore this palette, since
LodePNG already fills the palette colors in the pixels of the raw RGBA output,
but when decoding to the original PNG color mode it is needed to reconstruct
the colors.
The palette is only supported for color type 3.
*/
@ -465,10 +486,12 @@ typedef struct LodePNGInfo {
with values truncated to the bit depth in the unsigned integer.
For grayscale and palette PNGs, the value is stored in background_r. The values
in background_g and background_b are then unused.
in background_g and background_b are then unused. The decoder will set them
equal to background_r, the encoder ignores them in this case.
So when decoding, you may get these in a different color mode than the one you requested
for the raw pixels.
When decoding, you may get these in a different color mode than the one you requested
for the raw pixels: the colortype and bitdepth defined by info_png.color, that is the
ones defined in the header of the PNG image, are used.
When encoding with auto_convert, you must use the color model defined in info_png.color for
these values. The encoder normally ignores info_png.color when auto_convert is on, but will
@ -535,7 +558,7 @@ typedef struct LodePNGInfo {
unsigned phys_unit; /*may be 0 (unknown unit) or 1 (metre)*/
/*
Color profile related chunks: gAMA, cHRM, sRGB, iCPP
Color profile related chunks: gAMA, cHRM, sRGB, iCPP, sBIT
LodePNG does not apply any color conversions on pixels in the encoder or decoder and does not interpret these color
profile values. It merely passes on the information. If you wish to use color profiles and convert colors, please
@ -598,6 +621,45 @@ typedef struct LodePNGInfo {
unsigned char* iccp_profile;
unsigned iccp_profile_size; /* The size of iccp_profile in bytes */
/*
sBIT chunk: significant bits. Optional metadata, only set this if needed.
If defined, these values give the bit depth of the original data. Since PNG only stores 1, 2, 4, 8 or 16-bit
per channel data, the significant bits value can be used to indicate the original encoded data has another
sample depth, such as 10 or 12.
Encoders using this value, when storing the pixel data, should use the most significant bits
of the data to store the original bits, and use a good sample depth scaling method such as
"left bit replication" to fill in the least significant bits, rather than fill zeroes.
Decoders using this value, if able to work with data that's e.g. 10-bit or 12-bit, should right
shift the data to go back to the original bit depth, but decoders are also allowed to ignore
sbit and work e.g. with the 8-bit or 16-bit data from the PNG directly, since thanks
to the encoder contract, the values encoded in PNG are in valid range for the PNG bit depth.
For grayscale images, sbit_g and sbit_b are not used, and for images that don't use color
type RGBA or grayscale+alpha, sbit_a is not used (it's not used even for palette images with
translucent palette values, or images with color key). The values that are used must be
greater than zero and smaller than or equal to the PNG bit depth.
The color type from the header in the PNG image defines these used and unused fields: if
decoding with a color mode conversion, such as always decoding to RGBA, this metadata still
only uses the color type of the original PNG, and may e.g. lack the alpha channel info
if the PNG was RGB. When encoding with auto_convert (as well as without), also always the
color model defined in info_png.color determines this.
NOTE: enabling sbit can hurt compression, because the encoder can then not always use
auto_convert to choose a more optimal color mode for the data, because the PNG format has
strict requirements for the allowed sbit values in combination with color modes.
For example, setting these fields to 10-bit will force the encoder to keep using a 16-bit per channel
color mode, even if the pixel data would in fact fit in a more efficient 8-bit mode.
*/
unsigned sbit_defined; /*is significant bits given? if not, the values below are unused*/
unsigned sbit_r; /*red or gray component of significant bits*/
unsigned sbit_g; /*green component of significant bits*/
unsigned sbit_b; /*blue component of significant bits*/
unsigned sbit_a; /*alpha component of significant bits*/
/* End of color profile related chunks */
@ -770,7 +832,11 @@ typedef struct LodePNGEncoderSettings {
const unsigned char* predefined_filters;
/*force creating a PLTE chunk if colortype is 2 or 6 (= a suggested palette).
If colortype is 3, PLTE is _always_ created.*/
If colortype is 3, PLTE is always created. If color type is explicitely set
to a grayscale type (1 or 4), this is not done and is ignored. If enabling this,
a palette must be present in the info_png.
NOTE: enabling this may worsen compression if auto_convert is used to choose
optimal color mode, because it cannot use grayscale color modes in this case*/
unsigned force_palette;
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
/*add LodePNG identifier and version as a text chunk, for debugging*/
@ -824,8 +890,8 @@ unsigned lodepng_inspect(unsigned* w, unsigned* h,
#endif /*LODEPNG_COMPILE_DECODER*/
/*
Reads one metadata chunk (other than IHDR) of the PNG file and outputs what it
read in the state. Returns error code on failure.
Reads one metadata chunk (other than IHDR, which is handled by lodepng_inspect)
of the PNG file and outputs what it read in the state. Returns error code on failure.
Use lodepng_inspect first with a new state, then e.g. lodepng_chunk_find_const
to find the desired chunk type, and if non null use lodepng_inspect_chunk (with
chunk_pointer - start_of_file as pos).
@ -1103,7 +1169,7 @@ TODO:
[.] check compatibility with various compilers - done but needs to be redone for every newer version
[X] converting color to 16-bit per channel types
[X] support color profile chunk types (but never let them touch RGB values by default)
[ ] support all public PNG chunk types (almost done except sBIT, sPLT and hIST)
[ ] support all public PNG chunk types (almost done except sPLT and hIST)
[ ] make sure encoder generates no chunks with size > (2^31)-1
[ ] partial decoding (stream processing)
[X] let the "isFullyOpaque" function check color keys and transparent palettes too
@ -1230,18 +1296,16 @@ The following features are supported by the decoder:
gAMA: RGB gamma correction
iCCP: ICC color profile
sRGB: rendering intent
sBIT: significant bits
1.2. features not supported
---------------------------
The following features are _not_ supported:
The following features are not (yet) supported:
*) some features needed to make a conformant PNG-Editor might be still missing.
*) partial loading/stream processing. All data must be available and is processed in one call.
*) The following public chunks are not (yet) supported but treated as unknown chunks by LodePNG:
sBIT
hIST
sPLT
*) The hIST and sPLT public chunks are not (yet) supported but treated as unknown chunks
2. C and C++ version
@ -1845,6 +1909,7 @@ symbol.
Not all changes are listed here, the commit history in github lists more:
https://github.com/lvandeve/lodepng
*) 13 jun 2022: added support for the sBIT chunk.
*) 09 jan 2022: minor decoder speed improvements.
*) 27 jun 2021: added warnings that file reading/writing functions don't support
wide-character filenames (support for this is not planned, opening files is

View file

@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define FITZQUAKE_VERSION 0.85 //johnfitz
#define QUAKESPASM_VERSION 0.94
#define QUAKESPASM_VER_PATCH 6 // helper to print a string like 0.94.6
#define QUAKESPASM_VER_PATCH 7 // helper to print a string like 0.94.7
#ifndef QUAKESPASM_VER_SUFFIX
#define QUAKESPASM_VER_SUFFIX // optional version suffix string literal like "-beta1"
#endif
@ -345,6 +345,7 @@ void Host_Quit_f (void);
void Host_ClientCommands (const char *fmt, ...) FUNC_PRINTF(1,2);
void Host_ShutdownServer (qboolean crash);
void Host_WriteConfiguration (void);
void Host_Resetdemos (void);
void Host_AppendDownloadData(client_t *client, sizebuf_t *buf);
void Host_DownloadAck(client_t *client);

View file

@ -585,7 +585,9 @@ void R_TeleportSplash (vec3_t org)
vec3_t dir;
for (i=-16 ; i<16 ; i+=4)
{
for (j=-16 ; j<16 ; j+=4)
{
for (k=-24 ; k<32 ; k+=4)
{
if (!free_particles)
@ -611,6 +613,8 @@ void R_TeleportSplash (vec3_t org)
vel = 50 + (rand()&63);
VectorScale (dir, vel, p->vel);
}
}
}
}
/*
@ -900,8 +904,6 @@ void R_DrawParticles (void)
glTexCoord2f (0,0.5);
VectorMA (p->org, scale, right, p_right);
glVertex3fv (p_right);
rs_particles++; //johnfitz //FIXME: just use r_numparticles
}
glEnd ();
}
@ -941,8 +943,6 @@ void R_DrawParticles (void)
glTexCoord2f (0,1);
VectorMA (p->org, scale, right, p_right);
glVertex3fv (p_right);
rs_particles++; //johnfitz //FIXME: just use r_numparticles
}
glEnd ();
}

View file

@ -3421,11 +3421,7 @@ void PScript_ClearSurfaceParticles(qmodel_t *mod)
}
static void PScript_ClearAllSurfaceParticles(void)
{ //make sure we hit all models, even ones from the previous map. maybe this is overkill
extern qmodel_t mod_known[];
extern int mod_numknown;
int i;
for (i = 0; i < mod_numknown; i++)
PScript_ClearSurfaceParticles(&mod_known[i]);
Mod_ForEachModel(PScript_ClearSurfaceParticles);
}
void PScript_Shutdown (void)

View file

@ -185,7 +185,6 @@ void R_PushDlights (void);
// surface cache related
//
extern int reinit_surfcache; // if 1, surface cache is currently empty and
extern qboolean r_cache_thrash; // set if thrashing the surface cache
int D_SurfaceCacheForRes (int width, int height);
void D_FlushCaches (void);

View file

@ -8,7 +8,7 @@
<H1>QuakeSpasm</H1>
<H2></H2>
<P><EM>Page last edited: June 2022.</EM></P>
<P><EM>Page last edited: July 2022.</EM></P>
<P>
<H2><A NAME="toc1">1.</A> <A HREF="Quakespasm.html#s1">About </A></H2>
@ -35,30 +35,31 @@
<H2><A NAME="toc5">5.</A> <A HREF="Quakespasm.html#s5">Changes</A></H2>
<UL>
<LI><A NAME="toc5.1">5.1</A> <A HREF="Quakespasm.html#ss5.1">Changes in 0.94.6</A>
<LI><A NAME="toc5.2">5.2</A> <A HREF="Quakespasm.html#ss5.2">Changes in 0.94.5</A>
<LI><A NAME="toc5.3">5.3</A> <A HREF="Quakespasm.html#ss5.3">Changes in 0.94.4</A>
<LI><A NAME="toc5.4">5.4</A> <A HREF="Quakespasm.html#ss5.4">Changes in 0.94.3</A>
<LI><A NAME="toc5.5">5.5</A> <A HREF="Quakespasm.html#ss5.5">Changes in 0.94.2</A>
<LI><A NAME="toc5.6">5.6</A> <A HREF="Quakespasm.html#ss5.6">Changes in 0.94.1</A>
<LI><A NAME="toc5.7">5.7</A> <A HREF="Quakespasm.html#ss5.7">Changes in 0.94.0</A>
<LI><A NAME="toc5.8">5.8</A> <A HREF="Quakespasm.html#ss5.8">Changes in 0.93.2</A>
<LI><A NAME="toc5.9">5.9</A> <A HREF="Quakespasm.html#ss5.9">Changes in 0.93.1</A>
<LI><A NAME="toc5.10">5.10</A> <A HREF="Quakespasm.html#ss5.10">Changes in 0.93.0</A>
<LI><A NAME="toc5.11">5.11</A> <A HREF="Quakespasm.html#ss5.11">Changes in 0.92.1</A>
<LI><A NAME="toc5.12">5.12</A> <A HREF="Quakespasm.html#ss5.12">Changes in 0.92.0</A>
<LI><A NAME="toc5.13">5.13</A> <A HREF="Quakespasm.html#ss5.13">Changes in 0.91.0</A>
<LI><A NAME="toc5.14">5.14</A> <A HREF="Quakespasm.html#ss5.14">Changes in 0.90.1</A>
<LI><A NAME="toc5.15">5.15</A> <A HREF="Quakespasm.html#ss5.15">Changes in 0.90.0</A>
<LI><A NAME="toc5.16">5.16</A> <A HREF="Quakespasm.html#ss5.16">Changes in 0.85.9</A>
<LI><A NAME="toc5.17">5.17</A> <A HREF="Quakespasm.html#ss5.17">Changes in 0.85.8</A>
<LI><A NAME="toc5.18">5.18</A> <A HREF="Quakespasm.html#ss5.18">Changes in 0.85.7</A>
<LI><A NAME="toc5.19">5.19</A> <A HREF="Quakespasm.html#ss5.19">Changes in 0.85.6</A>
<LI><A NAME="toc5.20">5.20</A> <A HREF="Quakespasm.html#ss5.20">Changes in 0.85.5</A>
<LI><A NAME="toc5.21">5.21</A> <A HREF="Quakespasm.html#ss5.21">Changes in 0.85.4</A>
<LI><A NAME="toc5.22">5.22</A> <A HREF="Quakespasm.html#ss5.22">Changes in 0.85.3</A>
<LI><A NAME="toc5.23">5.23</A> <A HREF="Quakespasm.html#ss5.23">Changes in 0.85.2</A>
<LI><A NAME="toc5.24">5.24</A> <A HREF="Quakespasm.html#ss5.24">Changes in 0.85.1</A>
<LI><A NAME="toc5.1">5.1</A> <A HREF="Quakespasm.html#ss5.1">Changes in 0.94.7</A>
<LI><A NAME="toc5.2">5.2</A> <A HREF="Quakespasm.html#ss5.2">Changes in 0.94.6</A>
<LI><A NAME="toc5.3">5.3</A> <A HREF="Quakespasm.html#ss5.3">Changes in 0.94.5</A>
<LI><A NAME="toc5.4">5.4</A> <A HREF="Quakespasm.html#ss5.4">Changes in 0.94.4</A>
<LI><A NAME="toc5.5">5.5</A> <A HREF="Quakespasm.html#ss5.5">Changes in 0.94.3</A>
<LI><A NAME="toc5.6">5.6</A> <A HREF="Quakespasm.html#ss5.6">Changes in 0.94.2</A>
<LI><A NAME="toc5.7">5.7</A> <A HREF="Quakespasm.html#ss5.7">Changes in 0.94.1</A>
<LI><A NAME="toc5.8">5.8</A> <A HREF="Quakespasm.html#ss5.8">Changes in 0.94.0</A>
<LI><A NAME="toc5.9">5.9</A> <A HREF="Quakespasm.html#ss5.9">Changes in 0.93.2</A>
<LI><A NAME="toc5.10">5.10</A> <A HREF="Quakespasm.html#ss5.10">Changes in 0.93.1</A>
<LI><A NAME="toc5.11">5.11</A> <A HREF="Quakespasm.html#ss5.11">Changes in 0.93.0</A>
<LI><A NAME="toc5.12">5.12</A> <A HREF="Quakespasm.html#ss5.12">Changes in 0.92.1</A>
<LI><A NAME="toc5.13">5.13</A> <A HREF="Quakespasm.html#ss5.13">Changes in 0.92.0</A>
<LI><A NAME="toc5.14">5.14</A> <A HREF="Quakespasm.html#ss5.14">Changes in 0.91.0</A>
<LI><A NAME="toc5.15">5.15</A> <A HREF="Quakespasm.html#ss5.15">Changes in 0.90.1</A>
<LI><A NAME="toc5.16">5.16</A> <A HREF="Quakespasm.html#ss5.16">Changes in 0.90.0</A>
<LI><A NAME="toc5.17">5.17</A> <A HREF="Quakespasm.html#ss5.17">Changes in 0.85.9</A>
<LI><A NAME="toc5.18">5.18</A> <A HREF="Quakespasm.html#ss5.18">Changes in 0.85.8</A>
<LI><A NAME="toc5.19">5.19</A> <A HREF="Quakespasm.html#ss5.19">Changes in 0.85.7</A>
<LI><A NAME="toc5.20">5.20</A> <A HREF="Quakespasm.html#ss5.20">Changes in 0.85.6</A>
<LI><A NAME="toc5.21">5.21</A> <A HREF="Quakespasm.html#ss5.21">Changes in 0.85.5</A>
<LI><A NAME="toc5.22">5.22</A> <A HREF="Quakespasm.html#ss5.22">Changes in 0.85.4</A>
<LI><A NAME="toc5.23">5.23</A> <A HREF="Quakespasm.html#ss5.23">Changes in 0.85.3</A>
<LI><A NAME="toc5.24">5.24</A> <A HREF="Quakespasm.html#ss5.24">Changes in 0.85.2</A>
<LI><A NAME="toc5.25">5.25</A> <A HREF="Quakespasm.html#ss5.25">Changes in 0.85.1</A>
</UL>
<P>
<H2><A NAME="toc6">6.</A> <A HREF="Quakespasm.html#s6">Copyright </A></H2>
@ -178,7 +179,7 @@ where DRIVER may be alsa, dsp, pulse, esd ...</LI>
Quakespasm can also be built with the cross-platform Codeblocks.<BR>
Quakespasm's (optional) custom data is now stored in the file <B>quakespasm.pak</B>. This file should be placed alongside your quakespasm binary and <B>id1</B> directory.</P>
<H2><A NAME="ss4.1">4.1</A> <A HREF="#toc4.1">Linux/Unix </A>
<H2><A NAME="ss4.1">4.1</A> <A HREF="#toc4.1">Linux/Unix</A>
</H2>
<P>After extracting the source tarball, "cd Quake" and edit the Makefile for music options. </P>
<P><EM>Streaming music playback requires "libmad" or "libmpg123" for MP3, and "libogg" and "libvorbis" for OGG files.</EM></P>
@ -192,26 +193,37 @@ Compile time options include
</UL>
</P>
<H2><A NAME="ss4.2">4.2</A> <A HREF="#toc4.2">Windows </A>
<H2><A NAME="ss4.2">4.2</A> <A HREF="#toc4.2">Windows</A>
</H2>
<P>QuakeSpasm developers cross-compile windows binaries using
<A HREF="http://mingw-w64.sf.net">MinGW-w64</A> and
<A HREF="https://mingw.osdn.io">MinGW</A>.</P>
<P>The project can also be built using Microsoft Visual Studio 2005 and newer versions.</P>
<A HREF="https://mingw.osdn.io">MinGW</A>.
The project can also be built using Microsoft Visual Studio 2005 and newer versions.</P>
<H2><A NAME="ss4.3">4.3</A> <A HREF="#toc4.3">Mac OS X </A>
<H2><A NAME="ss4.3">4.3</A> <A HREF="#toc4.3">Mac OS X</A>
</H2>
<P>A Quakespasm App (including program launcher and update framework) can be made using the <B>Xcode</B> template found in the MacOSX directory.</P>
<P>Alternatively, have a look at <B>Makefile.darwin</B> for more instructions on building from a console.</P>
<P>A Quakespasm App (including program launcher and update framework) can be made using the <B>Xcode</B> template found in the MacOSX directory.
Alternatively, have a look at <B>Makefile.darwin</B> for more instructions on building from a console.</P>
<H2><A NAME="ss4.4">4.4</A> <A HREF="#toc4.4">Quake '2021 re-release' </A>
<H2><A NAME="ss4.4">4.4</A> <A HREF="#toc4.4">Quake '2021 re-release'</A>
</H2>
<P>QuakeSpasm 0.94.0 has initial support for playing the 2021 re-release content: Copy the quakespasm binary to your rerelease installation and run quakespasm as you normally do.</P>
<P>QuakeSpasm 0.94 has support for playing the 2021 re-release content: Copy the quakespasm binary to your rerelease installation and run as you normally do.</P>
<H2><A NAME="s5">5.</A> <A HREF="#toc5">Changes</A></H2>
<H2><A NAME="ss5.1">5.1</A> <A HREF="#toc5.1">Changes in 0.94.6</A>
<H2><A NAME="ss5.1">5.1</A> <A HREF="#toc5.1">Changes in 0.94.7</A>
</H2>
<P>
<UL>
<LI> Fix console history buffer wrapping.</LI>
<LI> Fix wrong external texture use after vid_restart.</LI>
<LI> Update lodepng from mainstream git.</LI>
<LI> Miscellaneous source code cleanups.</LI>
</UL>
</P>
<H2><A NAME="ss5.2">5.2</A> <A HREF="#toc5.2">Changes in 0.94.6</A>
</H2>
<P>
<UL>
@ -224,7 +236,7 @@ Compile time options include
</UL>
</P>
<H2><A NAME="ss5.2">5.2</A> <A HREF="#toc5.2">Changes in 0.94.5</A>
<H2><A NAME="ss5.3">5.3</A> <A HREF="#toc5.3">Changes in 0.94.5</A>
</H2>
<P>
<UL>
@ -237,7 +249,7 @@ Compile time options include
</UL>
</P>
<H2><A NAME="ss5.3">5.3</A> <A HREF="#toc5.3">Changes in 0.94.4</A>
<H2><A NAME="ss5.4">5.4</A> <A HREF="#toc5.4">Changes in 0.94.4</A>
</H2>
<P>
<UL>
@ -259,7 +271,7 @@ Compile time options include
</UL>
</P>
<H2><A NAME="ss5.4">5.4</A> <A HREF="#toc5.4">Changes in 0.94.3</A>
<H2><A NAME="ss5.5">5.5</A> <A HREF="#toc5.5">Changes in 0.94.3</A>
</H2>
<P>
<UL>
@ -269,7 +281,7 @@ Compile time options include
</UL>
</P>
<H2><A NAME="ss5.5">5.5</A> <A HREF="#toc5.5">Changes in 0.94.2</A>
<H2><A NAME="ss5.6">5.6</A> <A HREF="#toc5.6">Changes in 0.94.2</A>
</H2>
<P>
<UL>
@ -280,7 +292,7 @@ Compile time options include
</UL>
</P>
<H2><A NAME="ss5.6">5.6</A> <A HREF="#toc5.6">Changes in 0.94.1</A>
<H2><A NAME="ss5.7">5.7</A> <A HREF="#toc5.7">Changes in 0.94.1</A>
</H2>
<P>
<UL>
@ -288,7 +300,7 @@ Compile time options include
</UL>
</P>
<H2><A NAME="ss5.7">5.7</A> <A HREF="#toc5.7">Changes in 0.94.0</A>
<H2><A NAME="ss5.8">5.8</A> <A HREF="#toc5.8">Changes in 0.94.0</A>
</H2>
<P>
<UL>
@ -313,7 +325,7 @@ Compile time options include
</UL>
</P>
<H2><A NAME="ss5.8">5.8</A> <A HREF="#toc5.8">Changes in 0.93.2</A>
<H2><A NAME="ss5.9">5.9</A> <A HREF="#toc5.9">Changes in 0.93.2</A>
</H2>
<P>
<UL>
@ -326,7 +338,7 @@ Compile time options include
</UL>
</P>
<H2><A NAME="ss5.9">5.9</A> <A HREF="#toc5.9">Changes in 0.93.1</A>
<H2><A NAME="ss5.10">5.10</A> <A HREF="#toc5.10">Changes in 0.93.1</A>
</H2>
<P>
<UL>
@ -340,7 +352,7 @@ Compile time options include
</UL>
</P>
<H2><A NAME="ss5.10">5.10</A> <A HREF="#toc5.10">Changes in 0.93.0</A>
<H2><A NAME="ss5.11">5.11</A> <A HREF="#toc5.11">Changes in 0.93.0</A>
</H2>
<P>
<UL>
@ -383,7 +395,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
</UL>
</P>
<H2><A NAME="ss5.11">5.11</A> <A HREF="#toc5.11">Changes in 0.92.1</A>
<H2><A NAME="ss5.12">5.12</A> <A HREF="#toc5.12">Changes in 0.92.1</A>
</H2>
<P>
<UL>
@ -393,7 +405,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
</UL>
</P>
<H2><A NAME="ss5.12">5.12</A> <A HREF="#toc5.12">Changes in 0.92.0</A>
<H2><A NAME="ss5.13">5.13</A> <A HREF="#toc5.13">Changes in 0.92.0</A>
</H2>
<P>
<UL>
@ -412,7 +424,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
<LI> Updated some of the third-party libraries. Other fixes/clean-ups.</LI>
</UL>
</P>
<H2><A NAME="ss5.13">5.13</A> <A HREF="#toc5.13">Changes in 0.91.0</A>
<H2><A NAME="ss5.14">5.14</A> <A HREF="#toc5.14">Changes in 0.91.0</A>
</H2>
<H3>Bugfixes</H3>
<P>
@ -462,7 +474,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
</UL>
</P>
<H2><A NAME="ss5.14">5.14</A> <A HREF="#toc5.14">Changes in 0.90.1</A>
<H2><A NAME="ss5.15">5.15</A> <A HREF="#toc5.15">Changes in 0.90.1</A>
</H2>
<H3>Bugfixes</H3>
<P>
@ -512,7 +524,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
</UL>
</P>
<H2><A NAME="ss5.15">5.15</A> <A HREF="#toc5.15">Changes in 0.90.0</A>
<H2><A NAME="ss5.16">5.16</A> <A HREF="#toc5.16">Changes in 0.90.0</A>
</H2>
<P>
<UL>
@ -558,7 +570,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
</UL>
</P>
<H2><A NAME="ss5.16">5.16</A> <A HREF="#toc5.16">Changes in 0.85.9</A>
<H2><A NAME="ss5.17">5.17</A> <A HREF="#toc5.17">Changes in 0.85.9</A>
</H2>
<P>
<UL>
@ -582,7 +594,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
</UL>
</P>
<H2><A NAME="ss5.17">5.17</A> <A HREF="#toc5.17">Changes in 0.85.8</A>
<H2><A NAME="ss5.18">5.18</A> <A HREF="#toc5.18">Changes in 0.85.8</A>
</H2>
<P>
<UL>
@ -607,7 +619,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
</UL>
</P>
<H2><A NAME="ss5.18">5.18</A> <A HREF="#toc5.18">Changes in 0.85.7</A>
<H2><A NAME="ss5.19">5.19</A> <A HREF="#toc5.19">Changes in 0.85.7</A>
</H2>
<P>
<UL>
@ -625,7 +637,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
</UL>
</P>
<H2><A NAME="ss5.19">5.19</A> <A HREF="#toc5.19">Changes in 0.85.6</A>
<H2><A NAME="ss5.20">5.20</A> <A HREF="#toc5.20">Changes in 0.85.6</A>
</H2>
<P>
<UL>
@ -636,7 +648,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
</UL>
</P>
<H2><A NAME="ss5.20">5.20</A> <A HREF="#toc5.20">Changes in 0.85.5</A>
<H2><A NAME="ss5.21">5.21</A> <A HREF="#toc5.21">Changes in 0.85.5</A>
</H2>
<P>
<UL>
@ -655,7 +667,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
</UL>
</P>
<H2><A NAME="ss5.21">5.21</A> <A HREF="#toc5.21">Changes in 0.85.4</A>
<H2><A NAME="ss5.22">5.22</A> <A HREF="#toc5.22">Changes in 0.85.4</A>
</H2>
<P>
<UL>
@ -673,7 +685,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
</UL>
</P>
<H2><A NAME="ss5.22">5.22</A> <A HREF="#toc5.22">Changes in 0.85.3</A>
<H2><A NAME="ss5.23">5.23</A> <A HREF="#toc5.23">Changes in 0.85.3</A>
</H2>
<P>
<UL>
@ -695,7 +707,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
</UL>
</P>
<H2><A NAME="ss5.23">5.23</A> <A HREF="#toc5.23">Changes in 0.85.2</A>
<H2><A NAME="ss5.24">5.24</A> <A HREF="#toc5.24">Changes in 0.85.2</A>
</H2>
<P>
<UL>
@ -713,7 +725,7 @@ quakespasm (cl_alwaysrun 1, cl_forwardspeed 200, cl_backspeed 200)
</UL>
</P>
<H2><A NAME="ss5.24">5.24</A> <A HREF="#toc5.24">Changes in 0.85.1</A>
<H2><A NAME="ss5.25">5.25</A> <A HREF="#toc5.25">Changes in 0.85.1</A>
</H2>
<P>
<UL>

View file

@ -1,68 +1,9 @@
QuakeSpasm
____________________________________________________________
Table of Contents
1. About
2. Downloads
3. Hints
3.1 Music Playback
3.2 Controller Support
3.2.1 Cvars
3.2.2 Buttons
4. Compiling and Installation
4.1 Linux/Unix
4.2 Windows
4.3 Mac OS X
4.4 Quake '2021 re-release'
5. Changes
5.1 Changes in 0.94.6
5.2 Changes in 0.94.5
5.3 Changes in 0.94.4
5.4 Changes in 0.94.3
5.5 Changes in 0.94.2
5.6 Changes in 0.94.1
5.7 Changes in 0.94.0
5.8 Changes in 0.93.2
5.9 Changes in 0.93.1
5.10 Changes in 0.93.0
5.11 Changes in 0.92.1
5.12 Changes in 0.92.0
5.13 Changes in 0.91.0
5.13.1 Bugfixes
5.13.2 Visual improvements
5.13.3 Interface improvements
5.13.4 Code cleanup / Other
5.13.5 Raised limits
5.14 Changes in 0.90.1
5.14.1 Bugfixes
5.14.2 Performance
5.14.3 Visual improvements
5.14.4 Interface improvements
5.14.5 Code cleanup
5.15 Changes in 0.90.0
5.16 Changes in 0.85.9
5.17 Changes in 0.85.8
5.18 Changes in 0.85.7
5.19 Changes in 0.85.6
5.20 Changes in 0.85.5
5.21 Changes in 0.85.4
5.22 Changes in 0.85.3
5.23 Changes in 0.85.2
5.24 Changes in 0.85.1
6. Copyright
7. Contact
8. Links
______________________________________________________________________
Page last edited: June 2022.
Page last edited: July 2022.
1. About
@ -119,7 +60,8 @@
o Use "quakespasm -condebug" to save console log to "qconsole.log".
SDL2 builds no longer generate stdout.txt/stderr.txt.
3.1. Music Playback
Music Playback:
Quakespasm can play various external music formats, including MP3, OGG
and FLAC.
@ -137,7 +79,8 @@
o See Quakespasm-Music.txt for more details.
3.2. Controller Support
Controller Support:
The SDL2 variant of Quakespasm supports Xbox 360 style game
controllers.
@ -150,7 +93,7 @@
in your Quake directory, it is a community-maintained database that
adds support for more controllers to SDL2.
3.2.1. Cvars
Controller Support - Cvars:
o joy_deadzone - Fraction of the stick travel to be deadzone, between
0 and 1. Default 0.175.
@ -177,7 +120,7 @@
o joy_enable - Set to 0 to disable controller support. Default 1.
3.2.2. Buttons
Controller Support - Buttons:
Some of the controller buttons are hardcoded to allow navigating the
menu:
@ -219,7 +162,7 @@
quakespasm.pak. This file should be placed alongside your quakespasm
binary and id1 directory.
4.1. Linux/Unix
Compiling for Linux/Unix:
After extracting the source tarball, "cd Quake" and edit the Makefile
for music options.
@ -239,15 +182,14 @@
o make USE_SDL2=1 to compile against SDL2 instead of SDL-1.2
4.2. Windows
Compiling for Windows:
QuakeSpasm developers cross-compile windows binaries using MinGW-w64
<http://mingw-w64.sf.net> and MinGW <https://mingw.osdn.io>.
<http://mingw-w64.sf.net> and MinGW <https://mingw.osdn.io>. The
project can also be built using Microsoft Visual Studio 2005 and newer
versions.
The project can also be built using Microsoft Visual Studio 2005 and
newer versions.
4.3. Mac OS X
Compiling for Mac OS X:
A Quakespasm App (including program launcher and update framework) can
be made using the Xcode template found in the MacOSX directory.
@ -255,17 +197,28 @@
Alternatively, have a look at Makefile.darwin for more instructions on
building from a console.
4.4. Quake '2021 re-release'
QuakeSpasm 0.94.0 has initial support for playing the 2021 re-release
content: Copy the quakespasm binary to your rerelease installation and
run quakespasm as you normally do.
Quake '2021 re-release':
QuakeSpasm 0.94 has support for playing the 2021 re-release content:
Copy the quakespasm binary to your rerelease installation and run as
you normally do.
5. Changes
Changes in 0.94.7:
5.1. Changes in 0.94.6
o Fix console history buffer wrapping.
o Fix wrong external texture use after vid_restart.
o Update lodepng from mainstream git.
o Miscellaneous source code cleanups.
Changes in 0.94.6:
o Server protocol size check fixes for sounds and particles.
@ -280,7 +233,7 @@
o Other small improvements elsewhere in the code.
5.2. Changes in 0.94.5
Changes in 0.94.5:
o Compatibility with new SDL2 versioning scheme.
@ -297,7 +250,7 @@
o Backported a few fixes to the bundled SDL2-2.0.22 version.
5.3. Changes in 0.94.4
Changes in 0.94.4:
o Fixed getting stuck with loading plaque upon attempting to load a
bad save from the menu
@ -333,7 +286,7 @@
patches.
5.4. Changes in 0.94.3
Changes in 0.94.3:
o Handle sky textures with non-standard sizes and warn about them
(e.g. ad_tears)
@ -345,7 +298,7 @@
o Updated included SDL2 to latest version 2.0.18.
5.5. Changes in 0.94.2
Changes in 0.94.2:
o 2021 rerelease: Support for playing the latest update.
@ -356,13 +309,13 @@
o 2021 rerelease: Look for QuakeEX.kpf under userdir, too.
5.6. Changes in 0.94.1
Changes in 0.94.1:
o Fix lightmap issues after vkQuake surface mark/cull optimizations
merge (sf.net bug/50)
5.7. Changes in 0.94.0
Changes in 0.94.0:
o Initial support for playing the 'Quake 2021 re-release' content
(thanks to Andrei Drexler for bulk of the work, Guillaume Plourde
@ -411,7 +364,7 @@
o Source repository moved to git.
5.8. Changes in 0.93.2
Changes in 0.93.2:
o Lightmaps are now dynamically allocated (from QSS), and
BLOCK_WIDTH/HEIGHT raised from 128 to 256.
@ -431,7 +384,7 @@
o Update the third-party libraries. Other fixes/cleanups.
5.9. Changes in 0.93.1
Changes in 0.93.1:
o Fixed a fog regression which was introduced in 0.93.0.
@ -449,7 +402,7 @@
o Update the third-party libraries. Other fixes/cleanups.
5.10. Changes in 0.93.0
Changes in 0.93.0:
o Raise default "joy_deadzone_trigger" cvar to 0.2.
@ -534,7 +487,7 @@
o Update the third-party libraries.
5.11. Changes in 0.92.1
Changes in 0.92.1:
o Fixed large menu scale factors (was broken in 0.92.0).
@ -543,7 +496,7 @@
o Updated some of the third-party libraries.
5.12. Changes in 0.92.0
Changes in 0.92.0:
o SDL2 Game Controller support.
@ -580,9 +533,9 @@
o Updated some of the third-party libraries. Other fixes/clean-ups.
5.13. Changes in 0.91.0
Changes in 0.91.0:
5.13.1. Bugfixes
Bugfixes:
o Fix unwanted fog mode change upon video restart.
@ -618,7 +571,7 @@
o Prevent a possible vulnerability in MSG_ReadString (old Q1/Q2 bug).
5.13.2. Visual improvements
Visual improvements:
o New cvars r_lavaalpha, r_slimealpha, r_telealpha for fine-tuning
specific liquid opacities (from DirectQ/RMQEngine, non-archived,
@ -629,18 +582,18 @@
o GLSL gamma is now supported on older hardware without NPOT
extension.
5.13.3. Interface improvements
Interface improvements:
o New r_pos command to show player position.
o NaN detection in traceline with "developer 1" set now warns instead
of errors.
5.13.4. Code cleanup / Other
Code cleanup / Other:
o Update third-party libraries.
5.13.5. Raised limits
Raised limits:
o Default max_edicts 8192 (was 2048) and no longer saved to
config.cfg.
@ -652,9 +605,9 @@
o Raised MAX_SFX to 1024 (was 512).
5.14. Changes in 0.90.1
Changes in 0.90.1:
5.14.1. Bugfixes
Bugfixes:
o Fix dynamic light artifact where changing lightmap are rendered one
frame late (bug introduced in 0.90.0).
@ -677,13 +630,13 @@
o Fix crash on out-of-bounds skin number.
5.14.2. Performance
Performance:
o Use multithreaded OpenGL on OS X for better performance.
o New, faster mdl renderer using GLSL. Disable with "-noglslalias".
5.14.3. Visual improvements
Visual improvements:
o New gamma correction implementation using GLSL. Fixes all known
gamma issues (affecting the full display, persisting after
@ -697,7 +650,7 @@
o r_noshadow_list cvar added (from MarkV.)
5.14.4. Interface improvements
Interface improvements:
o Support pausing demo playback with the "pause" command.
@ -714,14 +667,14 @@
"trying to load ent", "bad chunk length", "meshing",
"PR_AlocStringSlots: realloc'ing"
5.14.5. Code cleanup
Code cleanup:
o Clean up IDE project files to build on fresh systems.
o Update 3rd-party libraries.
5.15. Changes in 0.90.0
Changes in 0.90.0:
o Fix issues on Windows systems with DPI scaling.
@ -829,7 +782,7 @@
o Other fixes and clean-ups.
5.16. Changes in 0.85.9
Changes in 0.85.9:
o Fixes for several undefined behaviors in C code (gcc-4.8 support.)
@ -876,7 +829,7 @@
o Several other minor fixes/cleanups.
5.17. Changes in 0.85.8
Changes in 0.85.8:
o Made Quake shareware 1.00 and 1.01 versions to be recognized
properly.
@ -923,7 +876,7 @@
o Miscellaneous source code cleanups.
5.18. Changes in 0.85.7
Changes in 0.85.7:
o Added support for cross-level demo playback
@ -949,7 +902,7 @@
o Several other small changes mostly invisible to the end-user
5.19. Changes in 0.85.6
Changes in 0.85.6:
o More work for string buffer safety
@ -962,7 +915,7 @@
o Minor SDL video fixes.
5.20. Changes in 0.85.5
Changes in 0.85.5:
o SDL input driver updated adding native keymap and dead key support
to the console
@ -993,7 +946,7 @@
o Several code updates from uHexen2 project, several code cleanups.
5.21. Changes in 0.85.4
Changes in 0.85.4:
o Implement music (OGG, MP3, WAV) playback
@ -1021,7 +974,7 @@
o Other minor sound and cdaudio updates
5.22. Changes in 0.85.3
Changes in 0.85.3:
o Fix the "-dedicated" option (thanks Oz) and add platform specific
networking code (default) rather than SDL_net
@ -1058,7 +1011,7 @@
some other CD tweaks.
5.23. Changes in 0.85.2
Changes in 0.85.2:
o Replace the old "Screen size" slider with a "Scale" slider
@ -1086,7 +1039,7 @@
o Add OSX Makefile (tested?)
5.24. Changes in 0.85.1
Changes in 0.85.1:
o 64 bit CPU support
@ -1159,4 +1112,3 @@
http://www.celephais.net/board/view_thread.php?id=60452
o Inside3D forums: http://forums.insideqc.com

View file

@ -1,2 +1,2 @@
#define SDL_REVISION "@a788189020ac220e3c44e1383e0a1621b3309f8f"
#define SDL_REVISION "@09aae5c0ddc04f28f89801b2ef14a63a4365b8d3"
#define SDL_REVISION_NUMBER 0

Binary file not shown.

Binary file not shown.