- got rid of common.h

All still relevant content was moved to places closer to its use.
This commit is contained in:
Christoph Oelckers 2020-09-08 18:39:47 +02:00
parent 5524d8eab7
commit ec1c42b04a
37 changed files with 39 additions and 126 deletions

View file

@ -29,7 +29,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "automap.h"
#include "pragmas.h"
#include "mmulti.h"
#include "common.h"
#include "common_game.h"
#include "actor.h"

View file

@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "build.h"
#include "mmulti.h"
#include "compat.h"
#include "common.h"
#include "common_game.h"
#include "g_input.h"
#include "automap.h"

View file

@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#pragma once
#include "build.h"
#include "common.h"
#include "pragmas.h"
#include "misc.h"
#include "printf.h"

View file

@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "ns.h" // Must come before everything else!
#include "compat.h"
#include "common.h"
#include "blood.h"
#include "dude.h"

View file

@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "build.h"
#include "v_draw.h"
#include "common.h"
#include "mmulti.h"
#include "common_game.h"
#include "blood.h"

View file

@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//-------------------------------------------------------------------------
#pragma once
#include "common.h"
#include "m_fixed.h"
#include "filesystem.h"
BEGIN_BLD_NS

View file

@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <string.h>
#include "compat.h"
#include "build.h"
#include "common.h"
#include "common_game.h"
#include "blood.h"

View file

@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//-------------------------------------------------------------------------
#pragma once
#include "build.h"
#include "common.h"
#include "common_game.h"
#include "blood.h"

View file

@ -31,6 +31,8 @@ static_assert('\xff' == 255, "Char must be unsigned!");
#include "buildtiles.h"
#include "c_cvars.h"
#include "cmdlib.h"
#include "m_fixed.h"
#include "mathutil.h"
typedef int64_t coord_t;

View file

@ -1,72 +0,0 @@
//
// Definitions of common non-engine data structures/functions
// (and declarations of data appearing in both)
// for EDuke32 and Mapster32
//
#ifndef EDUKE32_COMMON_H_
#define EDUKE32_COMMON_H_
#include "compat.h"
#include "pragmas.h" // klabs
#include "scriptfile.h"
#include "mathutil.h"
//// TYPES
struct strllist
{
struct strllist *next;
char *str;
};
typedef struct
{
const char *text;
int32_t tokenid;
}
tokenlist;
enum
{
T_EOF = -2,
T_ERROR = -1,
};
//// EXTERN DECLS
extern const char *s_buildRev;
extern const char *s_buildTimestamp;
//// FUNCTIONS
void G_AddDef(const char *buffer);
void G_AddDefModule(const char *buffer);
// returns a buffer of size BMAX_PATH
static inline char *dup_filename(const char *fn)
{
char * const buf = (char *) Xmalloc(BMAX_PATH);
return Bstrncpyz(buf, fn, BMAX_PATH);
}
static inline void realloc_copy(char **fn, const char *buf)
{
uint8_t len = Bstrlen(buf) + 1;
*fn = (char *)Xrealloc(*fn, len);
Bstrncpy(*fn, buf, len);
}
int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens);
void COMMON_clearbackground(int32_t numcols, int32_t numrows);
// timer defs for profiling function chunks the simple way
#define EDUKE32_TMRDEF int32_t t[20], ti=0; const char *tmrstr=__func__; fprintf(stderr,"%s\n",tmrstr); t[ti++]=I_msTime();
#define EDUKE32_TMRTIC t[ti++]=I_msTime()
#define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii<ti; ii++) fprintf(stderr,"%d ", t[ii]-t[ii-1]); fprintf(stderr,"\n"); } while (0)
#endif

View file

@ -284,10 +284,6 @@ typedef struct MAY_ALIAS {
int32_t x, y;
} vec2_t;
typedef struct {
uint32_t x, y;
} vec2u_t;
typedef struct {
float x, y;
} vec2f_t;
@ -424,18 +420,6 @@ static FORCE_INLINE char *Bstrncpyz(char *dst, const char *src, bsize_t n)
////////// Inlined external libraries //////////
#include "m_fixed.h"
#include "vectors.h"
inline FVector3 GetSoundPos(const vec3_t *pos)
{
// converts a Build coordinate to a sound system coordinate
const float xmul = 1 / 16.f;
const float ymul = -1 / 16.f;
const float zmul = -1 / 256.f;
return { pos->x* xmul, pos->z* zmul, pos->y* ymul };
}
/* End dependence on compat.o object. */

View file

@ -30,4 +30,21 @@ int32_t scriptfile_getsymbolvalue(char const *name, int32_t *val);
int32_t scriptfile_addsymbolvalue(char const *name, int32_t val);
void scriptfile_clearsymbols(void);
typedef struct
{
const char *text;
int32_t tokenid;
}
tokenlist;
enum
{
T_EOF = -2,
T_ERROR = -1,
};
int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens);
#endif

View file

@ -21,6 +21,11 @@
#include <vpx/vp8dx.h>
#include "animvpx.h"
struct vec2u_t
{
uint32_t x, y;
} ;
const char *animvpx_read_ivf_header_errmsg[] = {
"All OK",
"couldn't read 32-byte IVF header",

View file

@ -10,7 +10,6 @@
#include "engine_priv.h"
#include "scriptfile.h"
#include "common.h"
#include "mdsprite.h" // md3model_t
#include "buildtiles.h"
#include "bitmap.h"

View file

@ -13,7 +13,6 @@
#include "automap.h"
#include "imagehelpers.h"
#include "common.h"
#include "compat.h"
#include "engine_priv.h"
#include "palette.h"

View file

@ -9,7 +9,6 @@
#include "polymost.h"
#include "mdsprite.h"
#include "common.h"
#include "palette.h"
#include "textures.h"
#include "bitmap.h"

View file

@ -7,7 +7,6 @@ Ken Silverman's official web site: http://www.advsys.net/ken
#include "build.h"
#include "automap.h"
#include "common.h"
#include "engine_priv.h"
#include "mdsprite.h"
#include "polymost.h"

View file

@ -8,7 +8,6 @@
#include "compat.h"
#include "scriptfile.h"
#include "compat.h"
#include "common.h"
#include "filesystem.h"
#include "printf.h"

View file

@ -35,7 +35,6 @@
*/
#include "c_cvars.h"
#include "common.h"
#include "gameconfigfile.h"
#include "gamecontrol.h"
#include "m_argv.h"

View file

@ -12,11 +12,6 @@ struct vec2_t
int32_t x, y;
};
struct vec2u_t
{
uint32_t x, y;
};
struct vec2f_t
{
float x, y;
@ -50,4 +45,4 @@ struct vec3_16_t
vec2_16_t vec2;
};
};
#endif
#endif

View file

@ -36,7 +36,6 @@
#include "palette.h"
#include "superfasthash.h"
#include "common.h"
#include "memarena.h"
#include "palettecontainer.h"
#include "palutil.h"

View file

@ -1,5 +1,18 @@
#pragma once
#include "s_soundinternal.h"
#include "m_fixed.h"
#include "vectors.h"
#include "build.h"
inline FVector3 GetSoundPos(const vec3_t *pos)
{
// converts a Build coordinate to a sound system coordinate
const float xmul = 1 / 16.f;
const float ymul = -1 / 16.f;
const float zmul = -1 / 256.f;
return { pos->x* xmul, pos->z* zmul, pos->y* ymul };
}
enum
{

View file

@ -41,7 +41,6 @@
#include "sc_man.h"
#include "resourcefile.h"
#include "printf.h"
#include "common.h"
#include "version.h"
#include "gamecontrol.h"
#include "m_argv.h"

View file

@ -18,7 +18,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "ns.h"
#include "automap.h"
#include "compat.h"
#include "common.h"
#include "engine.h"
#include "exhumed.h"
#include "sequence.h"

View file

@ -17,7 +17,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//-------------------------------------------------------------------------
#include "ns.h"
#include "compat.h"
#include "common.h"
#include "engine.h"
#include "exhumed.h"
#include "sequence.h"
@ -54,8 +53,6 @@ BEGIN_PS_NS
extern short bPlayerPan;
extern short bLockPan;
extern const char* s_buildRev;
extern const char* s_buildTimestamp;
void uploadCinemaPalettes();

View file

@ -17,7 +17,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//-------------------------------------------------------------------------
#include "ns.h"
#include "compat.h"
#include "common.h"
#include "engine.h"
#include "exhumed.h"
#include "sequence.h"

View file

@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "ns.h"
#include "compat.h"
#include "build.h"
#include "common.h"
#include "exhumed.h"
#include "player.h"
#include "view.h"

View file

@ -26,7 +26,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "ns.h"
#include "build.h"
#include "common.h"
#include "names2.h"
#include "game.h"

View file

@ -60,7 +60,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "misc.h"
#include "jsector.h"
#include "common.h"
#include "gameconfigfile.h"
#include "printf.h"
#include "m_argv.h"

View file

@ -26,7 +26,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "ns.h"
#include "build.h"
#include "common.h"
#include "names2.h"
#include "panel.h"

View file

@ -26,7 +26,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "ns.h"
#include "build.h"
#include "common.h"
#include "mytypes.h"
#include "names2.h"

View file

@ -35,7 +35,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamecontrol.h"
#include "gstrings.h"
#include "common.h"
#include "v_text.h"
#include "printf.h"

View file

@ -28,7 +28,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#undef MAIN
#include "build.h"
#include "common.h"
#include "names2.h"
#include "panel.h"

View file

@ -26,7 +26,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "ns.h"
#include "build.h"
#include "common.h"
#include "mytypes.h"
#include "names2.h"

View file

@ -26,7 +26,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "ns.h"
#include "build.h"
#include "common.h"
#include "gamecontrol.h"

View file

@ -25,7 +25,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
//-------------------------------------------------------------------------
#include "ns.h"
#include "build.h"
#include "common.h"
#include "names2.h"
#include "panel.h"

View file

@ -25,7 +25,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
//-------------------------------------------------------------------------
#include "ns.h"
#include "build.h"
#include "common.h"
#include "names2.h"
#include "panel.h"