From 22033a7bf70da5c5633997de77e80d0e1530f32b Mon Sep 17 00:00:00 2001 From: danij Date: Tue, 4 Sep 2012 00:45:35 +0100 Subject: [PATCH] Refactor|libcommon: Post hu_stuff C++ fixes --- doomsday/engine/api/dd_api.h | 8 ++ doomsday/plugins/common/include/fi_lib.h | 8 ++ .../plugins/common/include/gl_drawpatch.h | 8 ++ doomsday/plugins/common/include/hu_menu.h | 8 ++ doomsday/plugins/common/include/hu_msg.h | 8 ++ doomsday/plugins/common/include/hu_stuff.h | 117 ++++++++++-------- doomsday/plugins/common/include/p_mapsetup.h | 8 ++ doomsday/plugins/common/include/p_tick.h | 8 ++ doomsday/plugins/common/include/r_common.h | 8 ++ doomsday/plugins/common/src/hu_stuff.cpp | 22 ++-- doomsday/plugins/jdoom/include/d_api.h | 8 ++ doomsday/plugins/jdoom/include/d_config.h | 8 ++ doomsday/plugins/jdoom/include/d_main.h | 8 ++ doomsday/plugins/jdoom/include/g_game.h | 8 ++ doomsday/plugins/jdoom/include/st_stuff.h | 8 ++ doomsday/plugins/jdoom64/include/d_api.h | 8 ++ doomsday/plugins/jdoom64/include/d_config.h | 8 ++ doomsday/plugins/jdoom64/include/d_main.h | 8 ++ doomsday/plugins/jdoom64/include/g_game.h | 8 ++ doomsday/plugins/jdoom64/include/st_stuff.h | 8 ++ doomsday/plugins/jheretic/include/g_game.h | 13 +- doomsday/plugins/jheretic/include/h_api.h | 8 ++ doomsday/plugins/jheretic/include/h_config.h | 8 ++ doomsday/plugins/jheretic/include/h_main.h | 8 ++ doomsday/plugins/jheretic/include/h_stat.h | 8 -- doomsday/plugins/jheretic/include/st_stuff.h | 8 ++ doomsday/plugins/jhexen/include/g_game.h | 13 ++ doomsday/plugins/jhexen/include/p_mapinfo.h | 8 ++ doomsday/plugins/jhexen/include/st_stuff.h | 8 ++ doomsday/plugins/jhexen/include/x_api.h | 8 ++ doomsday/plugins/jhexen/include/x_config.h | 8 ++ doomsday/plugins/jhexen/include/x_main.h | 8 ++ doomsday/plugins/jhexen/include/x_state.h | 7 -- 33 files changed, 318 insertions(+), 78 deletions(-) diff --git a/doomsday/engine/api/dd_api.h b/doomsday/engine/api/dd_api.h index b7671d0ee8..adee800b1b 100644 --- a/doomsday/engine/api/dd_api.h +++ b/doomsday/engine/api/dd_api.h @@ -25,6 +25,10 @@ #include "dd_share.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * The data exported out of the Doomsday engine. @ingroup game * @todo Refactor away - there should be no need for an ABI in this direction. @@ -179,4 +183,8 @@ typedef struct { /// Function pointer for @c GetGameAPI() (exported by game plugin). @ingroup game typedef game_export_t* (*GETGAMEAPI) (game_import_t *); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBDENG_API_H */ diff --git a/doomsday/plugins/common/include/fi_lib.h b/doomsday/plugins/common/include/fi_lib.h index fa745ac933..1787d7e594 100644 --- a/doomsday/plugins/common/include/fi_lib.h +++ b/doomsday/plugins/common/include/fi_lib.h @@ -32,6 +32,10 @@ #include "d_net.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @defgroup finaleMode Finale Mode. */ @@ -104,4 +108,8 @@ int FI_PrivilegedResponder(const void* ev); void NetCl_UpdateFinaleState(Reader* msg); +#ifdef __cplusplus +} extern "C" +#endif + #endif /* LIBCOMMON_INFINE_LIB */ diff --git a/doomsday/plugins/common/include/gl_drawpatch.h b/doomsday/plugins/common/include/gl_drawpatch.h index 540f270a95..48d23b003e 100644 --- a/doomsday/plugins/common/include/gl_drawpatch.h +++ b/doomsday/plugins/common/include/gl_drawpatch.h @@ -31,6 +31,10 @@ #include "doomsday.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @defgroup drawPatchFlags Draw Patch Flags. */ @@ -57,4 +61,8 @@ void GL_DrawPatchXY3(patchid_t id, int x, int y, int alignFlags, int patchFlags) void GL_DrawPatchXY2(patchid_t id, int x, int y, int alignFlags); void GL_DrawPatchXY(patchid_t id, int x, int y); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBCOMMON_GRAPHICS_DRAW_PATCH_H */ diff --git a/doomsday/plugins/common/include/hu_menu.h b/doomsday/plugins/common/include/hu_menu.h index 59c2dc605f..0e35dd9168 100644 --- a/doomsday/plugins/common/include/hu_menu.h +++ b/doomsday/plugins/common/include/hu_menu.h @@ -33,6 +33,10 @@ #include "dd_types.h" #include "hu_lib.h" +#ifdef __cplusplus +extern "C" { +#endif + // Sounds played in the menu. #if __JDOOM__ || __JDOOM64__ #define SFX_MENU_CLOSE (SFX_SWTCHX) @@ -211,4 +215,8 @@ int Hu_MenuUpdateColorWidgetColor(mn_object_t* obj, mn_actionid_t action, void* D_CMD(MenuOpen); D_CMD(MenuCommand); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBCOMMON_HU_MENU_H */ diff --git a/doomsday/plugins/common/include/hu_msg.h b/doomsday/plugins/common/include/hu_msg.h index 3b6a783c17..3ae25d8b62 100644 --- a/doomsday/plugins/common/include/hu_msg.h +++ b/doomsday/plugins/common/include/hu_msg.h @@ -26,6 +26,10 @@ #include "common.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { MSG_CANCEL = -1, MSG_NO, @@ -80,4 +84,8 @@ boolean Hu_IsMessageActiveWithCallback(msgfunc_t callback); */ void Hu_MsgStart(msgtype_t type, const char* msg, msgfunc_t callback, int userValue, void* userPointer); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /// LIBCOMMON_HUD_MESSAGE_H diff --git a/doomsday/plugins/common/include/hu_stuff.h b/doomsday/plugins/common/include/hu_stuff.h index c5a784ea34..0a4af555dd 100644 --- a/doomsday/plugins/common/include/hu_stuff.h +++ b/doomsday/plugins/common/include/hu_stuff.h @@ -1,26 +1,24 @@ -/**\file hu_stuff.h - *\section License - * License: GPL - * Online License Link: http://www.gnu.org/licenses/gpl.html - * - *\author Copyright © 2005-2012 Jaakko Keränen - *\author Copyright © 2005-2012 Daniel Swanson - *\author Copyright © 1993-1996 by id Software, Inc. +/** + * @file hu_stuff.h + * Miscellaneous routines for heads-up displays and UI. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * @authors Copyright © 2005-2012 Jaakko Keränen + * @authors Copyright © 2005-2012 Daniel Swanson + * @authors Copyright © 1993-1996 by id Software, Inc. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA */ #ifndef LIBCOMMON_HU_STUFF_H @@ -29,6 +27,10 @@ #include "doomsday.h" #include "gl_drawpatch.h" +#ifdef __cplusplus +extern "C" { +#endif + // The fonts. typedef enum { GF_FIRST = 1, @@ -89,31 +91,31 @@ extern boolean shiftdown; extern const char shiftXForm[]; extern patchid_t borderPatches[8]; -void Hu_LoadData(void); -void Hu_Drawer(void); -void Hu_Ticker(void); -void HU_WakeWidgets(int player); -void Hu_UnloadData(void); +void Hu_LoadData(void); +void Hu_Drawer(void); +void Hu_Ticker(void); +void HU_WakeWidgets(int player); +void Hu_UnloadData(void); -void Hu_MapTitleDrawer(const RectRaw* portGeometry); +void Hu_MapTitleDrawer(const RectRaw* portGeometry); -void Hu_FogEffectTicker(timespan_t time); -void Hu_FogEffectSetAlphaTarget(float alpha); -void Hu_DrawFogEffect(int effectID, DGLuint tex, float texOffset[2], float texAngle, float alpha, float arg1); +void Hu_FogEffectTicker(timespan_t time); +void Hu_FogEffectSetAlphaTarget(float alpha); +void Hu_DrawFogEffect(int effectID, DGLuint tex, float texOffset[2], float texAngle, float alpha, float arg1); -void HU_ScoreBoardUnHide(int player); -void HU_DrawScoreBoard(int player); +void HU_ScoreBoardUnHide(int player); +void HU_DrawScoreBoard(int player); -void Hu_DrawMapTitle(const Point2Raw* offset); +void Hu_DrawMapTitle(const Point2Raw* offset); -void Draw_BeginZoom(float s, float originX, float originY); -void Draw_EndZoom(void); +void Draw_BeginZoom(float s, float originX, float originY); +void Draw_EndZoom(void); -void M_DrawTextFragmentShadowed(const char* string, int x, int y, int alignFlags, short textFlags, float r, float g, float b, float a); +void M_DrawTextFragmentShadowed(const char* string, int x, int y, int alignFlags, short textFlags, float r, float g, float b, float a); -void M_DrawShadowedPatch(patchid_t id, int x, int y); -void M_DrawShadowedPatch2(patchid_t id, int x, int y, int alignFlags, int patchFlags); -void M_DrawShadowedPatch3(patchid_t id, int x, int y, int alignFlags, int patchFlags, float r, float g, float b, float a); +void M_DrawShadowedPatch(patchid_t id, int x, int y); +void M_DrawShadowedPatch2(patchid_t id, int x, int y, int alignFlags, int patchFlags); +void M_DrawShadowedPatch3(patchid_t id, int x, int y, int alignFlags, int patchFlags, float r, float g, float b, float a); typedef enum { PRM_NONE = 0, ///< No replacement. @@ -123,20 +125,21 @@ typedef enum { #define PRM_FIRST (PRM_NONE) #define PRM_LAST (PRM_ALLOW_TEXT) - /** * @defgroup patchReplacementFlags Patch Replacement Flags. * @{ */ -#define PRF_NO_IWAD 0x1 /// Allow if resource does not originate from an IWAD. -#define PRF_NO_PWAD 0x2 /// Allow if resource does not originate from a PWAD/external source. +#define PRF_NO_IWAD 0x1 ///< Allow if resource does not originate from an IWAD. +#define PRF_NO_PWAD 0x2 ///< Allow if resource does not originate from a PWAD/external source. /**@}*/ /** * Given a unique patch identifier (@a id) lookup a patch replacement string * associated with this. - * @param patchId Unique patch identifier. - * @param flags @see patchReplacementFlags + * + * @param patchId Unique patch identifier. + * @param flags @ref patchReplacementFlags + * * @return Patch replacement string if defined/found else @c NULL. */ const char* Hu_FindPatchReplacementString(patchid_t patchId, int flags); @@ -145,11 +148,11 @@ const char* Hu_FindPatchReplacementString(patchid_t patchId, int flags); * Determine whether a string-replacement for the specified patch is allowed * according the current user and/or game configuration. * - * \note If the patch does not originate from an IWAD it will not be replaced. + * @note If the patch does not originate from an IWAD it will not be replaced. * - * @param replaceMode Replacement mode. - * @param patchId Unique identifier of the patch to choose a replacement for. - * @param text A prechoosen string replacement to be used if appropriate. + * @param replaceMode Replacement mode. + * @param patchId Unique identifier of the patch to choose a replacement for. + * @param text A prechoosen string replacement to be used if appropriate. */ const char* Hu_ChoosePatchReplacement2(patchreplacemode_t replaceMode, patchid_t patchId, const char* text); const char* Hu_ChoosePatchReplacement(patchreplacemode_t replaceMode, patchid_t patchId); @@ -157,13 +160,13 @@ const char* Hu_ChoosePatchReplacement(patchreplacemode_t replaceMode, patchid_t /** * Implements patch replacement. * - * @param patchId Unique identifier of the patch to be drawn if no replacement. - * @param replacement Patch replacement string. Will be drawn instead of the - * patch if not @c NULL. - * @param origin Orient drawing about this offset (topleft:[0,0]). - * @param alignFlags @see alignmentFlags - * @param patchFlags @see drawPatchFlags - * @param textFlags @see drawTextFlags + * @param patchId Unique identifier of the patch to be drawn if no replacement. + * @param replacement Patch replacement string. Will be drawn instead of the + * patch if not @c NULL. + * @param origin Orient drawing about this offset (topleft:[0,0]). + * @param alignFlags @ref alignmentFlags + * @param patchFlags @ref drawPatchFlags + * @param textFlags @ref drawTextFlags */ void WI_DrawPatch3(patchid_t patchId, const char* replacement, const Point2Raw* origin, int alignFlags, int patchFlags, short textFlags); void WI_DrawPatch2(patchid_t patchId, const char* replacement, const Point2Raw* origin, int alignFlags); @@ -180,6 +183,10 @@ void WI_DrawPatchXY(patchid_t patchId, const char* replacement, int x, int y); * Misc specialised elements: */ -void M_DrawGlowBar(const float a[2], const float b[2], float thickness, boolean left, boolean right, boolean caps, float red, float green, float blue, float alpha); +void M_DrawGlowBar(const float a[2], const float b[2], float thickness, boolean left, boolean right, boolean caps, float red, float green, float blue, float alpha); + +#ifdef __cplusplus +} // extern "C" +#endif #endif /* LIBCOMMON_HU_STUFF_H */ diff --git a/doomsday/plugins/common/include/p_mapsetup.h b/doomsday/plugins/common/include/p_mapsetup.h index f3115dfd6d..13c25bdca4 100644 --- a/doomsday/plugins/common/include/p_mapsetup.h +++ b/doomsday/plugins/common/include/p_mapsetup.h @@ -31,6 +31,10 @@ #include "common.h" +#ifdef __cplusplus +extern "C" { +#endif + // If true we are in the process of setting up a map. extern boolean mapSetup; @@ -66,4 +70,8 @@ void P_SpawnSectorMaterialOriginScrollers(void); void P_SpawnSideMaterialOriginScrollers(void); void P_SpawnAllMaterialOriginScrollers(void); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBCOMMON_PLAYSETUP_H */ diff --git a/doomsday/plugins/common/include/p_tick.h b/doomsday/plugins/common/include/p_tick.h index 626ecf5726..c6805de03d 100644 --- a/doomsday/plugins/common/include/p_tick.h +++ b/doomsday/plugins/common/include/p_tick.h @@ -31,6 +31,10 @@ #include "dd_types.h" +#ifdef __cplusplus +extern "C" { +#endif + extern int mapTime; extern int actualMapTime; extern int timerGame; @@ -39,4 +43,8 @@ void P_RunPlayers(timespan_t ticLength); boolean P_IsPaused(void); void P_DoTick(void); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBCOMMON_P_TICK_H */ diff --git a/doomsday/plugins/common/include/r_common.h b/doomsday/plugins/common/include/r_common.h index a26a0418f5..3c97e6f2b6 100644 --- a/doomsday/plugins/common/include/r_common.h +++ b/doomsday/plugins/common/include/r_common.h @@ -27,6 +27,10 @@ #include "doomsday.h" +#ifdef __cplusplus +extern "C" { +#endif + // Translate between fixed screen dimensions to actual, current. #define FIXXTOSCREENX(x) (portSize.width * ((x) / (float) SCREENWIDTH)) #define FIXYTOSCREENY(y) (portSize.height * ((y) / (float) SCREENHEIGHT)) @@ -66,4 +70,8 @@ void R_GetGammaMessageStrings(void); void R_CycleGammaLevel(void); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBCOMMON_REFRESH_H */ diff --git a/doomsday/plugins/common/src/hu_stuff.cpp b/doomsday/plugins/common/src/hu_stuff.cpp index 6bbfd43ea0..030a122d8e 100644 --- a/doomsday/plugins/common/src/hu_stuff.cpp +++ b/doomsday/plugins/common/src/hu_stuff.cpp @@ -1,5 +1,5 @@ /** - * @file hu_stuff.c + * @file hu_stuff.cpp * Miscellaneous routines for heads-up displays and UI. * * @authors Copyright © 2003-2012 Jaakko Keränen @@ -195,7 +195,7 @@ void Hu_LoadData(void) # if __JDOOM64__ { pMapNamesSize = 32; - pMapNames = Z_Malloc(sizeof(patchid_t) * pMapNamesSize, PU_GAMESTATIC, 0); + pMapNames = (patchid_t*) Z_Malloc(sizeof(patchid_t) * pMapNamesSize, PU_GAMESTATIC, 0); for(i = 0; i < pMapNamesSize; ++i) { sprintf(name, "WILV%2.2u", i); @@ -206,7 +206,7 @@ void Hu_LoadData(void) if(gameModeBits & GM_ANY_DOOM2) { pMapNamesSize = 32; - pMapNames = Z_Malloc(sizeof(patchid_t) * pMapNamesSize, PU_GAMESTATIC, 0); + pMapNames = (patchid_t*) Z_Malloc(sizeof(patchid_t) * pMapNamesSize, PU_GAMESTATIC, 0); for(i = 0; i < pMapNamesSize; ++i) { sprintf(name, "CWILV%2.2u", i); @@ -221,7 +221,7 @@ void Hu_LoadData(void) // Don't waste space - patches are loaded back to back // ie no space in the array is left for E1M10 pMapNamesSize = 9*4; - pMapNames = Z_Malloc(sizeof(patchid_t) * pMapNamesSize, PU_GAMESTATIC, 0); + pMapNames = (patchid_t*) Z_Malloc(sizeof(patchid_t) * pMapNamesSize, PU_GAMESTATIC, 0); for(i = 0; i < numEpisodes; ++i) { for(j = 0; j < 9; ++j) // Number of maps per episode. @@ -292,6 +292,7 @@ void HU_WakeWidgets(int player) } } +#if __JHERETIC__ || __JHEXEN__ static void drawQuad(float x, float y, float w, float h, float s, float t, float r, float g, float b, float a) { @@ -310,6 +311,7 @@ static void drawQuad(float x, float y, float w, float h, float s, float t, DGL_Vertex2f(x, y + h); DGL_End(); } +#endif void HU_DrawText(const char* str, float x, float y, float scale, float r, float g, float b, float a, int alignFlags, short textFlags) @@ -374,6 +376,8 @@ static void sortScoreInfo(scoreinfo_t* vec, size_t size) static int buildScoreBoard(scoreinfo_t* scoreBoard, int maxPlayers, int player) { + DENG_UNUSED(player); + #if __JHEXEN__ static const int plrColors[] = { AM_PLR1_COLOR, @@ -505,8 +509,12 @@ static void drawTable(float x, float ly, float width, float height, if(!numCols) return; - colX = calloc(1, sizeof(*colX) * numCols); - colW = calloc(1, sizeof(*colW) * numCols); + /// @todo - Preprocess the table to avoid constant allocations. + colX = (float*) calloc(1, sizeof(*colX) * numCols); + if(!colX) Con_Error("drawTable: Failed on allocation of %lu bytes for colX data table.", (unsigned long) (sizeof(*colX) * numCols)); + + colW = (float*) calloc(1, sizeof(*colW) * numCols); + if(!colW) Con_Error("drawTable: Failed on allocation of %lu bytes for colW data table.", (unsigned long) (sizeof(*colW) * numCols)); lineHeight = .5f + height / (MAXPLAYERS + 1); fontHeight = FR_CharHeight('A'); @@ -1478,7 +1486,7 @@ void Hu_MapTitleDrawer(const RectRaw* portGeometry) R_ChooseAlignModeAndScaleFactor(&scale, SCREENWIDTH, SCREENHEIGHT, portGeometry->size.width, portGeometry->size.height, - cfg.menuScaleMode); + scalemode_t(cfg.menuScaleMode)); DGL_MatrixMode(DGL_MODELVIEW); DGL_PushMatrix(); diff --git a/doomsday/plugins/jdoom/include/d_api.h b/doomsday/plugins/jdoom/include/d_api.h index ea239b9cbf..223b921d54 100644 --- a/doomsday/plugins/jdoom/include/d_api.h +++ b/doomsday/plugins/jdoom/include/d_api.h @@ -35,7 +35,15 @@ #include "dd_api.h" +#ifdef __cplusplus +extern "C" { +#endif + extern game_import_t gi; extern game_export_t gx; +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBJDOOM_API_H */ diff --git a/doomsday/plugins/jdoom/include/d_config.h b/doomsday/plugins/jdoom/include/d_config.h index 66a0bc7d39..ea42e49df9 100644 --- a/doomsday/plugins/jdoom/include/d_config.h +++ b/doomsday/plugins/jdoom/include/d_config.h @@ -37,6 +37,10 @@ #include "doomdef.h" #include "hu_lib.h" +#ifdef __cplusplus +extern "C" { +#endif + enum { HUD_HEALTH, HUD_ARMOR, @@ -241,4 +245,8 @@ typedef struct jdoom_config_s { extern game_config_t cfg; +#ifdef __cplusplus +} // extern "C" +#endif + #endif diff --git a/doomsday/plugins/jdoom/include/d_main.h b/doomsday/plugins/jdoom/include/d_main.h index 765bee9e03..1cabe65537 100644 --- a/doomsday/plugins/jdoom/include/d_main.h +++ b/doomsday/plugins/jdoom/include/d_main.h @@ -31,6 +31,10 @@ #include "doomdef.h" +#ifdef __cplusplus +extern "C" { +#endif + extern int verbose; extern boolean noMonstersParm; // checkparm of -nomonsters @@ -59,4 +63,8 @@ void D_Shutdown(void); int D_GetInteger(int id); void* D_GetVariable(int id); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBJDOOM_MAIN_H */ diff --git a/doomsday/plugins/jdoom/include/g_game.h b/doomsday/plugins/jdoom/include/g_game.h index f586b227f6..db06d621c0 100644 --- a/doomsday/plugins/jdoom/include/g_game.h +++ b/doomsday/plugins/jdoom/include/g_game.h @@ -38,6 +38,10 @@ #include "d_event.h" #include "d_player.h" +#ifdef __cplusplus +extern "C" { +#endif + extern int gaSaveGameSlot; extern int gaLoadGameSlot; @@ -144,4 +148,8 @@ void G_PrepareWIData(void); void G_QueueBody(mobj_t* body); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBJDOOM_G_GAME_H */ diff --git a/doomsday/plugins/jdoom/include/st_stuff.h b/doomsday/plugins/jdoom/include/st_stuff.h index d454fecdff..fc4131a5b4 100644 --- a/doomsday/plugins/jdoom/include/st_stuff.h +++ b/doomsday/plugins/jdoom/include/st_stuff.h @@ -40,6 +40,10 @@ #include "hu_lib.h" #include "d_config.h" +#ifdef __cplusplus +extern "C" { +#endif + #define ST_HEIGHT (32 * SCREEN_MUL) #define ST_WIDTH (SCREENWIDTH) #define ST_Y (SCREENHEIGHT - ST_HEIGHT) @@ -145,4 +149,8 @@ D_CMD(ChatOpen); D_CMD(ChatAction); D_CMD(ChatSendMacro); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBDOOM_STUFF_H */ diff --git a/doomsday/plugins/jdoom64/include/d_api.h b/doomsday/plugins/jdoom64/include/d_api.h index 59b8d173c0..f168343f58 100644 --- a/doomsday/plugins/jdoom64/include/d_api.h +++ b/doomsday/plugins/jdoom64/include/d_api.h @@ -35,7 +35,15 @@ #include "dd_api.h" +#ifdef __cplusplus +extern "C" { +#endif + extern game_import_t gi; extern game_export_t gx; +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBJDOOM64_API_H */ diff --git a/doomsday/plugins/jdoom64/include/d_config.h b/doomsday/plugins/jdoom64/include/d_config.h index c28d72f232..575cb4cf5c 100644 --- a/doomsday/plugins/jdoom64/include/d_config.h +++ b/doomsday/plugins/jdoom64/include/d_config.h @@ -38,6 +38,10 @@ #include "doomdef.h" #include "hu_lib.h" +#ifdef __cplusplus +extern "C" { +#endif + enum { HUD_HEALTH, HUD_ARMOR, @@ -233,4 +237,8 @@ typedef struct jdoom64_config_s { extern game_config_t cfg; +#ifdef __cplusplus +} // extern "C" +#endif + #endif diff --git a/doomsday/plugins/jdoom64/include/d_main.h b/doomsday/plugins/jdoom64/include/d_main.h index c62f240ec7..16bb3bea58 100644 --- a/doomsday/plugins/jdoom64/include/d_main.h +++ b/doomsday/plugins/jdoom64/include/d_main.h @@ -31,6 +31,10 @@ #include "doomdef.h" +#ifdef __cplusplus +extern "C" { +#endif + extern int verbose; extern boolean noMonstersParm; // checkparm of -nomonsters @@ -62,4 +66,8 @@ void D_EndFrame(void); int D_GetInteger(int id); void* D_GetVariable(int id); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBJDOOM64_MAIN_H */ diff --git a/doomsday/plugins/jdoom64/include/g_game.h b/doomsday/plugins/jdoom64/include/g_game.h index 23252d9b99..8c7af78f11 100644 --- a/doomsday/plugins/jdoom64/include/g_game.h +++ b/doomsday/plugins/jdoom64/include/g_game.h @@ -38,6 +38,10 @@ #include "d_player.h" #include "wi_stuff.h" +#ifdef __cplusplus +extern "C" { +#endif + extern int gaSaveGameSaveSlot; extern int gaLoadGameSaveSlot; @@ -146,4 +150,8 @@ void G_PrepareWIData(void); void G_QueueBody(mobj_t* body); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBJDOOM64_G_GAME_H */ diff --git a/doomsday/plugins/jdoom64/include/st_stuff.h b/doomsday/plugins/jdoom64/include/st_stuff.h index 02d997f231..78fa02ec37 100644 --- a/doomsday/plugins/jdoom64/include/st_stuff.h +++ b/doomsday/plugins/jdoom64/include/st_stuff.h @@ -39,6 +39,10 @@ #include "hu_lib.h" #include "d_config.h" +#ifdef __cplusplus +extern "C" { +#endif + // Palette indices. // For damage/bonus red-/gold-shifts #define STARTREDPALS (1) @@ -153,4 +157,8 @@ D_CMD(ChatOpen); D_CMD(ChatAction); D_CMD(ChatSendMacro); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBDOOM64_STUFF_H */ diff --git a/doomsday/plugins/jheretic/include/g_game.h b/doomsday/plugins/jheretic/include/g_game.h index 4f80fea60e..694f8814f8 100644 --- a/doomsday/plugins/jheretic/include/g_game.h +++ b/doomsday/plugins/jheretic/include/g_game.h @@ -38,13 +38,20 @@ #include "h_event.h" #include "h_player.h" +#ifdef __cplusplus +extern "C" { +#endif + extern int gaSaveGameSaveSlot; extern int gaLoadGameSaveSlot; +extern player_t players[MAXPLAYERS]; + extern boolean deathmatch; extern boolean respawnMonsters; extern boolean userGame; -extern player_t players[MAXPLAYERS]; +extern boolean paused; +extern boolean precache; extern skillmode_t gameSkill; extern uint gameEpisode; @@ -138,4 +145,8 @@ int G_Responder(event_t* ev); void G_ScreenShot(void); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBJHERETIC_G_GAME_H */ diff --git a/doomsday/plugins/jheretic/include/h_api.h b/doomsday/plugins/jheretic/include/h_api.h index 0739ed6469..4d4f203ea6 100644 --- a/doomsday/plugins/jheretic/include/h_api.h +++ b/doomsday/plugins/jheretic/include/h_api.h @@ -35,7 +35,15 @@ #include "dd_api.h" +#ifdef __cplusplus +extern "C" { +#endif + extern game_import_t gi; extern game_export_t gx; +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBJHERETIC_API_H */ diff --git a/doomsday/plugins/jheretic/include/h_config.h b/doomsday/plugins/jheretic/include/h_config.h index 80e0813bf3..18d1622046 100644 --- a/doomsday/plugins/jheretic/include/h_config.h +++ b/doomsday/plugins/jheretic/include/h_config.h @@ -38,6 +38,10 @@ #include "doomdef.h" #include "hu_lib.h" +#ifdef __cplusplus +extern "C" { +#endif + enum { HUD_AMMO, HUD_ARMOR, @@ -246,4 +250,8 @@ extern game_config_t cfg; // in g_game.c int GetDefInt(char *def, int *returned_value); +#ifdef __cplusplus +} // extern "C" +#endif + #endif diff --git a/doomsday/plugins/jheretic/include/h_main.h b/doomsday/plugins/jheretic/include/h_main.h index cd27199a23..6490aec4b5 100644 --- a/doomsday/plugins/jheretic/include/h_main.h +++ b/doomsday/plugins/jheretic/include/h_main.h @@ -29,6 +29,10 @@ # error "Using jHeretic headers without __JHERETIC__" #endif +#ifdef __cplusplus +extern "C" { +#endif + extern int verbose; extern boolean noMonstersParm; // checkparm of -nomonsters @@ -57,4 +61,8 @@ void H_Shutdown(void); int H_GetInteger(int id); void* H_GetVariable(int id); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBJHERETIC_MAIN_H */ diff --git a/doomsday/plugins/jheretic/include/h_stat.h b/doomsday/plugins/jheretic/include/h_stat.h index 232f72e470..d43aa6bcc3 100644 --- a/doomsday/plugins/jheretic/include/h_stat.h +++ b/doomsday/plugins/jheretic/include/h_stat.h @@ -48,17 +48,9 @@ //#define maketic Get(DD_MAKETIC) //#define ticdup 1 -// Status flags for refresh. -extern boolean paused; -// If true, load all graphics at level load. -extern boolean precache; - // wipegamestate can be set to -1 to force a wipe on the next draw extern gamestate_t wipeGameState; extern int bodyQueueSlot; -// This one is related to the 3-screen display mode. -// ANG90 = left side, ANG270 = right -extern int viewAngleOffset; #endif diff --git a/doomsday/plugins/jheretic/include/st_stuff.h b/doomsday/plugins/jheretic/include/st_stuff.h index d579eae2cb..9c4c6d1d2d 100644 --- a/doomsday/plugins/jheretic/include/st_stuff.h +++ b/doomsday/plugins/jheretic/include/st_stuff.h @@ -39,6 +39,10 @@ #include "hu_lib.h" #include "h_config.h" +#ifdef __cplusplus +extern "C" { +#endif + // Size of statusbar, now sensitive for scaling. #define ST_HEIGHT (42 * SCREEN_MUL) #define ST_WIDTH (SCREENWIDTH) @@ -146,4 +150,8 @@ D_CMD(ChatOpen); D_CMD(ChatAction); D_CMD(ChatSendMacro); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBHERETIC_STUFF_H */ diff --git a/doomsday/plugins/jhexen/include/g_game.h b/doomsday/plugins/jhexen/include/g_game.h index 846beab682..1b9741ac6b 100644 --- a/doomsday/plugins/jhexen/include/g_game.h +++ b/doomsday/plugins/jhexen/include/g_game.h @@ -33,18 +33,27 @@ #endif #include "p_mobj.h" +#include "x_player.h" + +#ifdef __cplusplus +extern "C" { +#endif extern int debugSound; // debug flag for displaying sound info extern int gaSaveGameSaveSlot; extern int gaLoadGameSaveSlot; +extern player_t players[MAXPLAYERS]; + extern uint gameEpisode; extern uint gameMap; extern uint gameMapEntryPoint; extern skillmode_t gameSkill; extern boolean deathmatch; +extern boolean paused; +extern boolean precache; extern boolean userGame; extern boolean customPal; @@ -137,4 +146,8 @@ int G_PrivilegedResponder(event_t* ev); /// @return @c true if the input event @a ev was eaten. int G_Responder(event_t* ev); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBJHEXEN_G_GAME_H */ diff --git a/doomsday/plugins/jhexen/include/p_mapinfo.h b/doomsday/plugins/jhexen/include/p_mapinfo.h index 50bb42dcd8..5bab62ffef 100644 --- a/doomsday/plugins/jhexen/include/p_mapinfo.h +++ b/doomsday/plugins/jhexen/include/p_mapinfo.h @@ -34,6 +34,10 @@ # error "Using jHexen headers without __JHEXEN__" #endif +#if __cplusplus +extern "C" { +#endif + void P_InitMapInfo(void); void P_InitMapMusicInfo(void); @@ -82,4 +86,8 @@ int P_GetCDEnd3Track(void); int P_GetCDIntermissionTrack(void); int P_GetCDTitleTrack(void); +#if __cplusplus +} // extern "C" +#endif + #endif diff --git a/doomsday/plugins/jhexen/include/st_stuff.h b/doomsday/plugins/jhexen/include/st_stuff.h index 392c2e83ab..ea93729b69 100644 --- a/doomsday/plugins/jhexen/include/st_stuff.h +++ b/doomsday/plugins/jhexen/include/st_stuff.h @@ -38,6 +38,10 @@ #include "hu_lib.h" #include "x_config.h" +#ifdef __cplusplus +extern "C" { +#endif + // Size of statusbar. #define ST_HEIGHT (38*SCREEN_MUL) #define ST_WIDTH (SCREENWIDTH) @@ -145,4 +149,8 @@ D_CMD(ChatOpen); D_CMD(ChatAction); D_CMD(ChatSendMacro); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBHEXEN_STUFF_H */ diff --git a/doomsday/plugins/jhexen/include/x_api.h b/doomsday/plugins/jhexen/include/x_api.h index 7bf45af766..00b69d4252 100644 --- a/doomsday/plugins/jhexen/include/x_api.h +++ b/doomsday/plugins/jhexen/include/x_api.h @@ -35,7 +35,15 @@ #include "dd_api.h" +#ifdef __cplusplus +extern "C" { +#endif + extern game_import_t gi; extern game_export_t gx; +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBJHEXEN_API_H */ diff --git a/doomsday/plugins/jhexen/include/x_config.h b/doomsday/plugins/jhexen/include/x_config.h index 40398e415e..9010294b82 100644 --- a/doomsday/plugins/jhexen/include/x_config.h +++ b/doomsday/plugins/jhexen/include/x_config.h @@ -32,6 +32,10 @@ #include "h2def.h" #include "hu_lib.h" +#ifdef __cplusplus +extern "C" { +#endif + enum { HUD_MANA, HUD_HEALTH, @@ -203,4 +207,8 @@ typedef struct { extern game_config_t cfg; +#ifdef __cplusplus +} // extern "C" +#endif + #endif diff --git a/doomsday/plugins/jhexen/include/x_main.h b/doomsday/plugins/jhexen/include/x_main.h index 743d24c0fe..afa4c61191 100644 --- a/doomsday/plugins/jhexen/include/x_main.h +++ b/doomsday/plugins/jhexen/include/x_main.h @@ -29,6 +29,10 @@ # error "Using jHexen headers without __JHEXEN__" #endif +#ifdef __cplusplus +extern "C" { +#endif + extern int verbose; extern boolean noMonstersParm; // checkparm of -nomonsters @@ -56,4 +60,8 @@ void X_Shutdown(void); int X_GetInteger(int id); void* X_GetVariable(int id); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* LIBJHEXEN_MAIN_H */ diff --git a/doomsday/plugins/jhexen/include/x_state.h b/doomsday/plugins/jhexen/include/x_state.h index d43593e33f..ada4abad2f 100644 --- a/doomsday/plugins/jhexen/include/x_state.h +++ b/doomsday/plugins/jhexen/include/x_state.h @@ -60,7 +60,6 @@ extern int viewangleoffset; // Timer, for scores. extern int mapStartTic; // Game tic at map start. extern int mapTime; // Tics in game play for par. -extern int actualMapTime; // Quit after playing a demo from cmdline. extern boolean singledemo; @@ -73,16 +72,10 @@ extern boolean singledemo; //#define GAMETIC (*((timespan_t*) DD_GetVariable(DD_GAMETIC))) -// Bookkeeping on players - state. -extern player_t players[MAXPLAYERS]; - //----------------------------------------- // Internal parameters, used for engine. // - -// if true, load all graphics at map load -extern boolean precache; extern int bodyqueslot; #endif