Make a bunch of things extern "C". This should fix C++ builds on OS X and with Lunatic. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4766 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-11-26 04:39:23 +00:00
parent d89caf5187
commit 9268b9f0b6
66 changed files with 399 additions and 154 deletions

View file

@ -8,7 +8,7 @@
#include "compat.h"
#include "osd.h"
#ifdef EXTERNC
#ifdef __cplusplus
extern "C" {
#endif
@ -33,6 +33,7 @@ extern int32_t startwin_close(void);
extern int32_t startwin_puts(const char *);
extern int32_t startwin_settitle(const char *);
extern int32_t startwin_idle(void *);
extern int32_t startwin_run(void);
// video
extern int32_t r_usenewaspect, newaspect_enable;
@ -213,7 +214,7 @@ int32_t baselayer_init();
void makeasmwriteable(void);
void maybe_redirect_outputs(void);
#ifdef EXTERNC
#ifdef __cplusplus
}
#endif

View file

@ -13,7 +13,7 @@
#include "pragmas.h"
#include "glbuild.h"
#ifdef EXTERNC
#ifdef __cplusplus
extern "C" {
#endif
@ -253,6 +253,8 @@ static inline void sector_tracker_hook(uintptr_t address);
static inline void wall_tracker_hook(uintptr_t address);
static inline void sprite_tracker_hook(uintptr_t address);
}
#define TRACKER_NAME_ SectorTracker
#define TRACKER_GLOBAL_HOOK_ sector_tracker_hook
#include "tracker.hpp"
@ -274,6 +276,8 @@ static inline void sprite_tracker_hook(uintptr_t address);
#define Tracker(Container, Type) Container##Tracker<Type>
#define TrackerCast(x) x.cast()
extern "C" {
#else
#define Tracker(Container, Type) Type
@ -753,13 +757,7 @@ EXTERN spritetype *tspriteptr[MAXSPRITESONSCREEN + 1];
EXTERN int32_t xdim, ydim, numpages;
EXTERN int32_t yxaspect, viewingrange;
#ifdef __cplusplus
extern "C" {
#endif
EXTERN intptr_t *ylookup;
#ifdef __cplusplus
};
#endif
#ifndef GEKKO
#define MAXVALIDMODES 256
@ -861,14 +859,8 @@ EXTERN vec2_t tilesiz[MAXTILES];
EXTERN char picsiz[MAXTILES];
EXTERN char walock[MAXTILES];
#ifdef __cplusplus
extern "C" {
#endif
extern const char pow2char[8];
extern const int32_t pow2long[32];
#ifdef __cplusplus
};
#endif
// picanm[].sf:
// |bit(1<<7)
@ -1298,10 +1290,10 @@ static inline int32_t spriteheightofs(int16_t i, int32_t *height, int32_t alsoti
int32_t screencapture(const char *filename, char inverseit, const char *versionstr) ATTRIBUTE((nonnull(1)));
int32_t getclosestcol_lim(int32_t r, int32_t g, int32_t b, int32_t lastokcol);
static inline int32_t getclosestcol(int32_t r, int32_t g, int32_t b)
{
extern int32_t getclosestcol_lim(int32_t r, int32_t g, int32_t b, int32_t lastokcol);
return getclosestcol_lim(r, g, b, 255);
}
@ -1495,8 +1487,13 @@ static inline void pop_nofog(void)
#endif
}
#ifdef LUNATIC
extern const int32_t engine_main_arrays_are_static;
extern const int32_t engine_v8;
int32_t Mulscale(int32_t a, int32_t b, int32_t sh);
#endif
#ifdef EXTERNC
#ifdef __cplusplus
}
#endif

View file

@ -6,7 +6,7 @@
#include "compat.h"
#include "mutex.h"
#ifdef EXTERNC
#ifdef __cplusplus
extern "C" {
#endif
@ -24,6 +24,7 @@ void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr);
void agecache(void);
extern int32_t pathsearchmode; // 0 = gamefs mode (default), 1 = localfs mode (editor's mode)
char *listsearchpath(int32_t initp);
int32_t addsearchpath(const char *p);
int32_t removesearchpath(const char *p);
int32_t findfrompath(const char *fn, char **where);
@ -72,7 +73,7 @@ void kdfwrite(const void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil);
#endif
void dfwrite(const void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil);
#ifdef EXTERNC
#ifdef __cplusplus
}
#endif

View file

@ -14,7 +14,7 @@
#include "build.h"
#ifdef EXTERNC
#ifdef __cplusplus
extern "C" {
#endif
@ -135,7 +135,7 @@ void COMMON_clearbackground(int32_t numcols, int32_t numrows);
#define EDUKE32_TMRTIC t[ti++]=getticks()
#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)
#ifdef EXTERNC
#ifdef __cplusplus
}
#endif

View file

@ -144,26 +144,14 @@
// library will need to wrap these functions with suitable emulations.
#define compat_h_macrodef__
#ifdef EXTERNC
# include <cstdarg>
# ifdef compat_h_macrodef__
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <ctime>
# endif
#else
# include <stdarg.h>
# include <stddef.h>
#endif
#include <stdarg.h>
#include <stddef.h>
#ifdef compat_h_macrodef__
# ifndef EXTERNC
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# include <time.h>
# endif
# include <fcntl.h>
# include <ctype.h>
# include <sys/types.h>
@ -350,7 +338,7 @@
# define BITNESS64
#endif
#ifdef EXTERNC
#ifdef __cplusplus
# ifndef SCREWED_UP_CPP
// using namespace std;
@ -861,7 +849,7 @@ FORCE_INLINE void *xaligned_malloc(const bsize_t alignment, const bsize_t size)
}
#ifdef EXTERNC
#ifdef __cplusplus
}
#endif

View file

@ -3,7 +3,7 @@
#include "compat.h"
#ifdef EXTERNC
#ifdef __cplusplus
extern "C" {
#endif
@ -18,7 +18,7 @@ extern uint32_t crc32table[4][256];
extern uint32_t Bcrc32(const void* data, size_t length, uint32_t crc);
extern void initcrc32table(void);
#ifdef EXTERNC
#ifdef __cplusplus
}
#endif

View file

@ -7,8 +7,8 @@
#include <math.h>
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
#define VERSION "2.0.0devel"
@ -394,10 +394,6 @@ enum SaveBoardFlags
M32_SB_ASKOV = 2, // for NEW_MAP_FORMAT build, ask whether write map if going from V7/8 to VX
};
#ifdef EXTERNC
}
#endif
// showdebug is now used as a general informational on-screen display
#define M32_SHOWDEBUG
@ -429,4 +425,8 @@ static inline void inpclamp(int32_t *x, int32_t mi, int32_t ma)
if (*x<mi) *x=mi;
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,7 +1,7 @@
#ifndef glext_h_
#define glext_h_
#ifdef EXTERNC
#ifdef __cplusplus
extern "C" {
#endif
@ -11481,7 +11481,7 @@ typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLe
#endif
#ifdef EXTERNC
#ifdef __cplusplus
}
#endif

View file

@ -1,9 +1,17 @@
#ifndef gtkbits_h_
#define gtkbits_h_
#ifdef __cplusplus
extern "C" {
#endif
extern void gtkbuild_init(int32_t *argc, char ***argv);
extern void gtkbuild_exit(int32_t r);
extern int32_t gtkbuild_msgbox(char *name, char *msg);
extern int32_t gtkbuild_ynbox(char *name, char *msg);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,6 +1,10 @@
#ifndef HIGHTILE_PRIV_H
#define HIGHTILE_PRIV_H
#ifdef __cplusplus
extern "C" {
#endif
struct hicskybox_t {
char *face[6];
};
@ -86,4 +90,8 @@ enum
HICEFFECTMASK = (1|2|4|8),
};
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,4 +1,4 @@
#ifdef EXTERNC
#ifdef __cplusplus
extern "C" {
#endif
@ -58,6 +58,6 @@ static inline int32_t filnamcmp(const char *j, const char *i)
}
extern int32_t wildmatch(const char *match, const char *wild);
#ifdef EXTERNC
#ifdef __cplusplus
}
#endif

View file

@ -1,6 +1,10 @@
#ifndef mdsprite_h_
# define mdsprite_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef USE_OPENGL
#include "hightile.h"
@ -228,4 +232,8 @@ enum {
HUDFLAG_NODEPTH = 8,
};
#ifdef __cplusplus
}
#endif
#endif // !mdsprite_h_

View file

@ -11,7 +11,7 @@
# include "sdl_inc.h"
#endif
#ifdef EXTERNC
#ifdef __cplusplus
extern "C" {
#endif
@ -28,7 +28,7 @@ extern int32_t mutex_lock(mutex_t *mutex);
extern int32_t mutex_unlock(mutex_t *mutex);
#ifdef EXTERNC
#ifdef __cplusplus
}
#endif

View file

@ -5,7 +5,7 @@
#ifndef osd_h_
#define osd_h_
#ifdef EXTERNC
#ifdef __cplusplus
extern "C" {
#endif
@ -302,7 +302,10 @@ static inline void OSD_SetHistory(int32_t histIdx, const char *src)
extern int32_t osdcmd_restartvid(const osdfuncparm_t *parm);
#ifdef EXTERNC
extern void M32RunScript(const char *s);
#ifdef __cplusplus
}
#endif

View file

@ -2,7 +2,15 @@
#define osxbits_h_
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
int32_t osx_msgbox(const char *name, const char *msg);
int32_t osx_ynbox(const char *name, const char *msg);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -13,6 +13,10 @@
# include "polymost.h"
# include "pragmas.h"
#ifdef __cplusplus
extern "C" {
#endif
#define PR_LINEAR_FOG
// CVARS
@ -568,4 +572,8 @@ static inline void relvec2f(GLfloat *v1, GLfloat *v2, GLfloat *out)
# endif // !POLYMER_C
#ifdef __cplusplus
}
#endif
#endif // !polymer_h_

View file

@ -5,7 +5,7 @@
#ifndef pragmas_h_
#define pragmas_h_
#ifdef EXTERNC
#ifdef __cplusplus
extern "C" {
#endif
@ -27,7 +27,7 @@ extern "C" {
#endif
extern int32_t reciptable[2048], fpuasm;
#if !defined(NOASM) && defined __cplusplus
};
}
#endif
// break the C version of divscale out from the others
@ -259,7 +259,7 @@ static inline void swapbufreverse(void *s, void *d, int32_t c)
while (c--) swapchar(dst++, src--);
}
#ifdef EXTERNC
#ifdef __cplusplus
}
#endif

View file

@ -2,7 +2,7 @@
#ifndef BUILD_SCRIPTFILE_H_
#define BUILD_SCRIPTFILE_H_
#ifdef EXTERNC
#ifdef __cplusplus
extern "C" {
#endif
@ -34,7 +34,7 @@ int32_t scriptfile_getsymbolvalue(char *name, int32_t *val);
int32_t scriptfile_addsymbolvalue(char *name, int32_t val);
void scriptfile_clearsymbols(void);
#ifdef EXTERNC
#ifdef __cplusplus
}
#endif

View file

@ -1,6 +1,10 @@
#ifndef texcache_h_
# define texcache_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef USE_OPENGL
#define TEXCACHEMAGIC "LZ40"
@ -64,4 +68,9 @@ extern void texcache_checkgarbage(void);
extern void texcache_setupindex(void);
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -28,3 +28,5 @@ extern void ShowErrorBox(const char *m);
extern LPTSTR GetWindowsErrorMsg(DWORD code);
extern int32_t addsearchpath_ProgramFiles(const char *p);
extern int32_t G_GetVersionFromWebsite(char *buffer);

View file

@ -145,7 +145,7 @@ extern "C" {
#endif
extern intptr_t dep_begin, dep_end;
#ifdef __cplusplus
};
}
#endif
#endif

View file

@ -611,8 +611,6 @@ int32_t app_main(int32_t argc, const char **argv)
#ifdef STARTUP_SETUP_WINDOW
if (i || forcesetup || cmdsetup)
{
extern int32_t startwin_run(void);
if (quitevent || !startwin_run())
{
uninitengine();

View file

@ -179,7 +179,7 @@ intptr_t bufplce[4];
int32_t globaltilesizy;
int32_t globalx1, globaly2, globalx3, globaly3;
#if !defined(NOASM) && defined __cplusplus
};
}
#endif
int32_t sloptable[16384];
@ -249,8 +249,25 @@ static int16_t maphacklight[PR_MAXLIGHTS];
#endif
// forward refs
#ifdef __cplusplus
extern "C" {
#endif
void setblendtab(int32_t blend, const char *tab);
#ifdef LUNATIC
extern const char *(getblendtab)(int32_t blend);
int32_t setpalookup(int32_t palnum, const uint8_t *shtab);
#endif
void setup_sideview_sincos(void);
int32_t getscreenvdisp(int32_t bz, int32_t zoome);
void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome);
int32_t scalescreeny(int32_t sy);
#ifdef YAX_ENABLE
void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore);
#endif
int32_t getinvdisplacement(int32_t *dx, int32_t *dy, int32_t dz);
#ifdef __cplusplus
}
#endif
static void scansector(int16_t startsectnum);
static void draw_rainbow_background(void);
@ -2401,7 +2418,6 @@ char palfadedelta = 0;
static uint8_t numalphatabs;
static char *blendtable[MAXBLENDTABS];
void setblendtab(int32_t blend, const char *tab);
#define getblendtab(blend) (blendtable[blend])
static void setpalettefade_calc(uint8_t offset);
@ -16360,7 +16376,7 @@ int32_t getscreenvdisp(int32_t bz, int32_t zoome)
return mulscale32(bz,zoome*m32_sidecos);
}
void setup_sideview_sincos()
void setup_sideview_sincos(void)
{
if (m32_sideview)
{

View file

@ -21,7 +21,7 @@ extern "C" {
extern intptr_t asm1, asm2, asm3, asm4;
extern int32_t globalx1, globaly2;
#if !defined(NOASM) && defined __cplusplus
};
}
#endif
extern uint8_t basepalcount;

View file

@ -10,6 +10,8 @@
#include "baselayer.h"
#include "build.h"
#include "gtkbits.h"
int32_t gtkenabled = 0;
static GdkPixbuf *appicon = NULL;

View file

@ -18,6 +18,7 @@ extern "C" {
}
#endif
#include "build.h"
#include "cache1d.h"
#include "osd.h"
@ -139,7 +140,6 @@ void L_DestroyState(L_State *estate)
static void L_OnOutOfMem(void)
{
extern void uninitengine(void);
OSD_Printf("Out of memory in Lunatic.\n");
uninitengine();
exit(127);

View file

@ -72,7 +72,6 @@ static int32_t (*_getrowheight)(int32_t) = _internal_getrowheight;
static hashtable_t h_cvars = { OSDMAXSYMBOLS<<1, NULL };
int32_t m32_osd_tryscript=0; // whether to try executing m32script on unkown command in the osd
extern void M32RunScript(const char *s);
int32_t OSD_RegisterCvar(const cvar_t *cvar)
{

View file

@ -47,6 +47,7 @@ int32_t startwin_close(void) { return 0; }
int32_t startwin_puts(const char *s) { UNREFERENCED_PARAMETER(s); return 0; }
int32_t startwin_idle(void *s) { UNREFERENCED_PARAMETER(s); return 0; }
int32_t startwin_settitle(const char *s) { UNREFERENCED_PARAMETER(s); return 0; }
int32_t startwin_run(void) { return 0; }
#endif
/// These can be useful for debugging sometimes...

View file

@ -30,8 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef function_private_h_
#define function_private_h_
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
// KEEPINSYNC lunatic/con_lang.lua
char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] =
@ -504,7 +504,7 @@ static const char * joystickdigitaldefaults[] =
#endif
#endif
#ifdef EXTERNC
};
#ifdef __cplusplus
}
#endif
#endif

View file

@ -25,6 +25,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "player.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MAXSLEEPDIST 16384
#define SLEEPTIME 1536
#define ZOFFSET (1<<8)
@ -330,6 +334,14 @@ void Sect_ToggleInterpolation(int sectnum, int doset);
FORCE_INLINE void Sect_ClearInterpolation(int sectnum) { Sect_ToggleInterpolation(sectnum, 0); }
FORCE_INLINE void Sect_SetInterpolation(int sectnum) { Sect_ToggleInterpolation(sectnum, 1); }
#ifdef LUNATIC
int32_t G_ToggleWallInterpolation(int32_t w, int32_t doset);
#endif
#ifdef __cplusplus
}
#endif
#include "actors_inline.h"
#endif

View file

@ -23,6 +23,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef actors_inline_h_
#define actors_inline_h_
#ifdef __cplusplus
extern "C" {
#endif
#if KRANDDEBUG
# define ACTOR_INLINE __fastcall
# define ACTOR_INLINE_HEADER extern __fastcall
@ -44,6 +48,10 @@ EXTERN_INLINE_HEADER int32_t G_CheckForSpaceFloor(int32_t sectnum);
EXTERN_INLINE_HEADER int32_t A_CheckEnemySprite(const spritetype *s);
#ifdef __cplusplus
}
#endif
#ifndef DISABLE_INLINING
#include "actors_inline.c"
#endif

View file

@ -7,6 +7,10 @@
#ifndef EDUKE32_COMMON_GAME_H_
#define EDUKE32_COMMON_GAME_H_
#ifdef __cplusplus
extern "C" {
#endif
extern int32_t usecwd;
#define GAMEFLAG_DUKE 0x00000001
@ -113,4 +117,8 @@ extern uint8_t *basepaltable[BASEPALCOUNT];
extern int32_t g_firstFogPal;
extern int32_t G_LoadLookups(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -23,10 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef duke3d_h_
#define duke3d_h_
#ifdef EXTERNC
{
#endif
// JBF
#include "compat.h"
#include "a.h"
@ -169,7 +165,4 @@ static inline int32_t G_InitialActorStrength(int32_t actortile)
#endif
}
#ifdef EXTERNC
}
#endif
#endif

View file

@ -30,8 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef function_public_h_
#define function_public_h_
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
#define NUMKEYENTRIES 56
@ -101,7 +101,7 @@ enum GameFunction_t
gamefunc_Dpad_Select,
gamefunc_Dpad_Aiming
};
#ifdef EXTERNC
};
#ifdef __cplusplus
}
#endif
#endif

View file

@ -81,7 +81,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# include <shellapi.h>
extern int32_t G_GetVersionFromWebsite(char *buffer);
# define UPDATEINTERVAL 604800 // 1w
# include "winbits.h"
#else
@ -10785,7 +10784,6 @@ static void A_InitEnemyFlags(void)
}
#undef SETFLAG
extern int32_t startwin_run(void);
static void G_SetupGameButtons(void);
#ifdef LUNATIC

View file

@ -25,6 +25,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "premap.h"
#ifdef __cplusplus
extern "C" {
#endif
// Compile game-side legacy Room over Room code?
#define LEGACY_ROR 1
@ -315,8 +319,6 @@ extern int32_t minitext_lowercase;
int32_t minitext_(int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t sb);
int32_t mpgametext(int32_t y,const char *t,int32_t s,int32_t dabits);
int32_t startwin_run(void);
#ifdef YAX_ENABLE
void Yax_SetBunchZs(int32_t sectnum, int32_t cf, int32_t daz);
#else
@ -399,10 +401,6 @@ static inline int32_t G_GetTeamPalette(int32_t team)
return pal[team];
}
#if defined(_WIN32)
int32_t G_GetVersionFromWebsite(char *buffer);
#endif
#ifdef USE_OPENGL
extern char forcegl;
#endif
@ -580,4 +578,14 @@ static inline int32_t G_GetMusicIdx(const char *str)
extern void G_StartMusic(void);
#ifdef LUNATIC
void El_SetCON(const char *conluacode);
void G_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum,
int32_t shade, int32_t orientation, int32_t p);
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -23,10 +23,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef game_inline_h_
#define game_inline_h_
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_INLINE_HEADER void G_SetStatusBarScale(int32_t sc);
EXTERN_INLINE_HEADER void SetIfGreater(int32_t *variable, int32_t potentialValue);
#ifdef __cplusplus
}
#endif
#ifndef DISABLE_INLINING
#include "game_inline.c"
#endif

View file

@ -26,6 +26,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "build.h" // hashtable_t
#include "common.h" // tokenlist
#ifdef __cplusplus
extern "C" {
#endif
#define MAXGAMEEVENTS 128
#define LABEL_HASPARM2 1
#define LABEL_ISSTRING 2
@ -102,7 +106,23 @@ typedef struct {
extern vmstate_t vm;
#if !defined LUNATIC
void G_DoGameStartup(const int32_t *params);
void C_DefineMusic(int32_t vol, int32_t lev, const char *fn);
#if defined LUNATIC
void C_DefineSound(int32_t sndidx, const char *fn, int32_t args[5]);
void C_DefineQuote(int32_t qnum, const char *qstr);
void C_DefineVolumeName(int32_t vol, const char *name);
void C_DefineSkillName(int32_t skill, const char *name);
void C_DefineLevelName(int32_t vol, int32_t lev, const char *fn,
int32_t partime, int32_t designertime,
const char *levelname);
void C_DefineGameFuncName(int32_t idx, const char *name);
void C_DefineGameType(int32_t idx, int32_t flags, const char *name);
int32_t C_SetDefName(const char *name);
void C_DefineProjectile(int32_t j, int32_t what, int32_t val);
void C_SetCfgName(const char *cfgname);
#else
void C_ReportError(int32_t iError);
void C_Compile(const char *filenam);
@ -948,4 +968,9 @@ enum ScriptKeywords_t
};
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua
#endif
#ifdef __cplusplus
}
#endif
#endif // gamedef_h_

View file

@ -30,8 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef gamedefs_public_h_
#define gamedefs_public_h_
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
//****************************************************************************
@ -128,8 +128,8 @@ enum
};
#ifdef EXTERNC
};
#ifdef __cplusplus
}
#endif
#endif

View file

@ -32,6 +32,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# include "lunatic_game.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern int32_t ticrandomseed;
extern vmstate_t vm;
@ -92,4 +96,20 @@ void VM_ScriptInfo(void);
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
} while (0)
void G_GetTimeDate(int32_t *vals);
int32_t G_StartTrack(int32_t level);
int32_t A_Dodge(spritetype *s);
#ifdef LUNATIC
void G_ShowView(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, int32_t sect,
int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t unbiasedp);
void P_AddWeaponMaybeSwitchI(int32_t snum, int32_t weap);
void VM_FallSprite(int32_t i);
int32_t VM_ResetPlayer2(int32_t snum);
int32_t VM_CheckSquished2(int32_t i, int32_t snum);
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -50,6 +50,10 @@ G_EXTERN int32_t bakipos[MAXINTERPOLATIONS];
#include "sector.h"
#include "quotes.h"
#ifdef __cplusplus
extern "C" {
#endif
G_EXTERN DukeStatus_t sbar;
G_EXTERN actor_t actor[MAXSPRITES];
// g_tile: tile-specific data THAT DOES NOT CHANGE during the course of a game
@ -153,4 +157,8 @@ G_EXTERN char CheatKeys[2];
G_EXTERN char setupfilename[BMAX_PATH];
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -19,8 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef linklist_h_
#define linklist_h_
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
@ -107,7 +107,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define LL_Move LL_MoveNode
#ifdef EXTERNC
};
#ifdef __cplusplus
}
#endif
#endif

View file

@ -34,8 +34,8 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#ifndef control_private_h_
#define control_private_h_
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
@ -185,7 +185,7 @@ typedef struct
//
//***************************************************************************
#ifdef EXTERNC
};
#ifdef __cplusplus
}
#endif
#endif

View file

@ -31,8 +31,8 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#ifndef scriplib_private_h_
#define scriplib_private_h_
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
#define SCRIPTSECTIONSTART ('[')
@ -203,7 +203,7 @@ void SCRIPT_AddEntry
void SCRIPT_DecodeToken ( int32_t scripthandle, char * str );
#ifdef EXTERNC
};
#ifdef __cplusplus
}
#endif
#endif

View file

@ -33,8 +33,8 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#ifndef animlib_public_h_
#define animlib_public_h_
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
//****************************************************************************
@ -86,7 +86,7 @@ uint8_t * ANIM_DrawFrame(int32_t framenumber);
uint8_t * ANIM_GetPalette(void);
#ifdef EXTERNC
};
#ifdef __cplusplus
}
#endif
#endif

View file

@ -33,8 +33,8 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#ifndef control_public_h_
#define control_public_h_
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
@ -212,7 +212,7 @@ void CONTROL_ProcessBinds(void);
extern int32_t CONTROL_OSDInput[CONTROL_NUM_FLAGS];
extern int32_t CONTROL_SmoothMouse;
#ifdef EXTERNC
};
#ifdef __cplusplus
}
#endif
#endif

View file

@ -26,8 +26,8 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#ifndef file_lib_public_
#define file_lib_public_
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
enum
@ -254,7 +254,7 @@ int32_t ChangeDrive (char *drive);
#endif
#ifdef EXTERNC
};
#ifdef __cplusplus
}
#endif
#endif

View file

@ -2,8 +2,8 @@
#ifndef __joystick_h
#define __joystick_h
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
#if defined(GEKKO)
@ -50,7 +50,7 @@ int32_t JOYSTICK_GetAxis( int32_t a );
void JOYSTICK_ClearAxis( int32_t a );
void JOYSTICK_ClearAllAxes( void );
#ifdef EXTERNC
};
#ifdef __cplusplus
}
#endif
#endif /* __joystick_h */

View file

@ -27,8 +27,8 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#ifndef keyboard_public_h_
#define keyboard_public_h_
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
#include "baselayer.h" // for the keyboard stuff
@ -100,7 +100,7 @@ kb_scancode KB_StringToScanCode( const char * string ); // convert a string int
void KB_Startup( void );
void KB_Shutdown( void );
#ifdef EXTERNC
};
#ifdef __cplusplus
}
#endif
#endif

View file

@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//-------------------------------------------------------------------------
#include "common.h"
#include "mathutil.h"
int32_t FindDistance2D(int32_t x, int32_t y)
{

View file

@ -26,13 +26,13 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
extern int32_t FindDistance2D(int32_t dx, int32_t dy);
extern int32_t FindDistance3D(int32_t dx, int32_t dy, int32_t dz);
#ifdef EXTERNC
#ifdef __cplusplus
}
#endif

View file

@ -27,8 +27,8 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#ifndef mouse_h_
#define mouse_h_
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
#define LEFT_MOUSE 1
@ -50,7 +50,7 @@ int32_t MOUSE_GetButtons( void );
#define MOUSE_ClearAllButtons() mouseb = 0
#define MOUSE_GetDelta(x, y) readmousexy(x,y)
#ifdef EXTERNC
};
#ifdef __cplusplus
}
#endif
#endif /* __mouse_h */

View file

@ -28,8 +28,8 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#ifndef scriplib_public_h_
#define scriplib_public_h_
#ifdef EXTERNC
{
#ifdef __cplusplus
extern "C" {
#endif
/*
@ -294,7 +294,7 @@ void SCRIPT_PutDouble
);
#ifdef EXTERNC
};
#ifdef __cplusplus
}
#endif
#endif

View file

@ -77,9 +77,6 @@ extern int luaopen_lpeg(lua_State *L);
#endif
typedef struct {
uint32_t x, y, z, c;
} rng_jkiss_t;
// See: Good Practice in (Pseudo) Random Number Generation for
// Bioinformatics Applications, by David Jones
@ -283,12 +280,6 @@ LUNATIC_EXTERN void El_OnError(const char *str)
}
}
static void El_OnOutOfMem(void)
{
extern void G_GameExit(const char *msg);
G_GameExit("Out of memory in Lunatic.");
}
void El_ClearErrors(void)
{
int32_t i;
@ -360,6 +351,9 @@ static int32_t SetTweakTracebackMsg_CF(lua_State *L)
// http://www.freelists.org/post/luajit/intermitten-lua-pcall-crash-on-x86-64-linux,1
// Some of these are duplicate declarations:
#ifdef __cplusplus
extern "C" {
#endif
extern void P_AddWeaponMaybeSwitchI(int32_t snum, int32_t weap);
extern void P_CheckWeaponI(int32_t snum);
extern int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel);
@ -376,6 +370,10 @@ extern int32_t A_PlaySound(uint32_t num, int32_t i);
extern void A_DeleteSprite(int32_t s);
extern void G_ShowView(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, int32_t sect,
int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t unbiasedp);
extern void G_GameExit(const char *msg);
#ifdef __cplusplus
}
#endif
#define LARG(index) lua_tointeger(L, index)
@ -487,6 +485,11 @@ static void El_StateSetup(lua_State *L)
lua_pushcfunction(L, &our_traceback_CF);
}
static void El_OnOutOfMem(void)
{
G_GameExit("Out of memory in Lunatic.");
}
// 0: success, <0: failure
int32_t El_CreateState(L_State *estate, const char *name)
{

View file

@ -7,6 +7,9 @@
#include "events_defs.h" // MAXEVENTS
#include "actors.h" // con_move_t, con_action_t
#ifdef __cplusplus
extern "C" {
#endif
extern L_State g_ElState;
@ -48,4 +51,15 @@ extern int32_t (*El_RestoreGamevars)(const char *savecode);
static inline int32_t El_HaveEvent(int32_t eventidx) { return g_elEvents[eventidx]!=0; }
static inline int32_t El_HaveActor(int32_t actortile) { return g_elActors[actortile].haveit!=0; }
typedef struct {
uint32_t x, y, z, c;
} rng_jkiss_t;
uint32_t rand_jkiss_u32(rng_jkiss_t *s);
double rand_jkiss_dbl(rng_jkiss_t *s);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -5,7 +5,15 @@
#include "lunatic.h"
#ifdef __cplusplus
extern "C" {
#endif
int Em_CreateState(L_State *estate);
void Em_DestroyState(L_State *estate);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1896,6 +1896,15 @@ static void FuncMenu_Process(const StatusBarMenu *m, int32_t col, int32_t row)
#ifdef LUNATIC
typedef const char *(*luamenufunc_t)(void);
#ifdef __cplusplus
extern "C" {
#endif
extern void LM_Register(const char *name, luamenufunc_t funcptr, const char *description);
extern void LM_Clear(void);
#ifdef __cplusplus
}
#endif
static int32_t g_numLuaFuncs = 0;
static luamenufunc_t g_LuaFuncPtrs[MENU_MAX_ENTRIES];

View file

@ -25,6 +25,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__ANDROID__)
#define DROIDMENU
#endif
@ -378,4 +382,8 @@ void M_OpenMenu(size_t playerID);
void M_CloseMenu(size_t playerID);
void M_DisplayMenus(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -23,6 +23,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef osdcmds_h_
#define osdcmds_h_
#ifdef __cplusplus
extern "C" {
#endif
struct osdcmd_cheatsinfo {
int32_t cheatnum; // -1 = none, else = see DoCheats()
int32_t volume,level;
@ -44,5 +48,9 @@ typedef struct {
extern const keydef_t ConsoleKeys[];
extern const char *const ConsoleButtons[];
#ifdef __cplusplus
}
#endif
#endif // osdcmds_h_

View file

@ -23,6 +23,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef player_h_
#define player_h_
#ifdef __cplusplus
extern "C" {
#endif
extern int32_t playerswhenstarted;
#define MOVEFIFOSIZ 2
@ -376,6 +380,8 @@ void P_QuickKill(DukePlayer_t *p);
void P_SelectNextInvItem(DukePlayer_t *p);
void P_UpdateScreenPal(DukePlayer_t *p);
void P_CheckWeaponI(int32_t snum);
#if !defined LUNATIC
void P_SetWeaponGamevars(int32_t snum, const DukePlayer_t *p);
#else
@ -412,4 +418,8 @@ static inline int32_t P_Get(int32_t spritenum)
return P_GetP(&sprite[spritenum]);
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -23,6 +23,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef premap_h_
#define premap_h_
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int32_t x1, y1;
int32_t xdimen, ydimen;
@ -54,4 +58,8 @@ void G_ClearFIFO(void);
void G_SetupCamTile(int32_t i,int32_t wn);
void G_ResetInterpolations(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -25,6 +25,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "game.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LUNATIC
# define SV_MAJOR_VER 2
#else
@ -95,6 +99,11 @@ void G_Util_PtrToIdx2(void *ptr, int32_t count, size_t stride, const void *base,
#ifdef LUNATIC
extern const char *(*El_SerializeGamevars)(int32_t *slenptr, int32_t levelnum);
void El_FreeSaveCode(void);
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -28,6 +28,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "player.h" // playerspawn_t
#include "namesdyn.h" // for G_GetForcefieldPicnum()
#ifdef __cplusplus
extern "C" {
#endif
#define MAXCYCLERS 1024
#define MAXANIMATES 256
#define MAXANIMWALLS 512
@ -143,6 +147,10 @@ static inline int32_t G_GetForcefieldPicnum(int32_t wallnum)
return picnum;
}
#ifdef __cplusplus
}
#endif
#include "sector_inline.h"
#endif

View file

@ -23,8 +23,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef sector_inline_h_
#define sector_inline_h_
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_INLINE_HEADER int32_t G_CheckPlayerInSector(int32_t sect);
#ifdef __cplusplus
}
#endif
#ifndef DISABLE_INLINING
#include "sector_inline.c"
#endif

View file

@ -31,6 +31,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "sounds_common.h"
#ifdef __cplusplus
extern "C" {
#endif
// KEEPINSYNC lunatic/con_lang.lua
#define MAXSOUNDS 4096
#define MAXSOUNDINSTANCES 8
@ -106,4 +110,8 @@ static inline int32_t S_IsAmbientSFX(int32_t i)
return (sprite[i].picnum==MUSICANDSFX && sprite[i].lotag < 999);
}
#ifdef __cplusplus
}
#endif
#endif

View file

@ -456,8 +456,6 @@ static int osdcmd_map(const osdfuncparm_t *parm) {
return OSDCMD_OK;
}
extern int startwin_run(void);
int32_t app_main(int32_t argc, const char **argv)
{
#if defined STARTUP_SETUP_WINDOW