Skip to content

Commit

Permalink
Refactor|libcommon: Post hu_stuff C++ fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Sep 3, 2012
1 parent cc1659a commit 22033a7
Show file tree
Hide file tree
Showing 33 changed files with 318 additions and 78 deletions.
8 changes: 8 additions & 0 deletions doomsday/engine/api/dd_api.h
Expand Up @@ -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.
Expand Down Expand Up @@ -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 */
8 changes: 8 additions & 0 deletions doomsday/plugins/common/include/fi_lib.h
Expand Up @@ -32,6 +32,10 @@

#include "d_net.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @defgroup finaleMode Finale Mode.
*/
Expand Down Expand Up @@ -104,4 +108,8 @@ int FI_PrivilegedResponder(const void* ev);

void NetCl_UpdateFinaleState(Reader* msg);

#ifdef __cplusplus
} extern "C"
#endif

#endif /* LIBCOMMON_INFINE_LIB */
8 changes: 8 additions & 0 deletions doomsday/plugins/common/include/gl_drawpatch.h
Expand Up @@ -31,6 +31,10 @@

#include "doomsday.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @defgroup drawPatchFlags Draw Patch Flags.
*/
Expand All @@ -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 */
8 changes: 8 additions & 0 deletions doomsday/plugins/common/include/hu_menu.h
Expand Up @@ -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)
Expand Down Expand Up @@ -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 */
8 changes: 8 additions & 0 deletions doomsday/plugins/common/include/hu_msg.h
Expand Up @@ -26,6 +26,10 @@

#include "common.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
MSG_CANCEL = -1,
MSG_NO,
Expand Down Expand Up @@ -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
117 changes: 62 additions & 55 deletions 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 <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2012 Daniel Swanson <danij@dengine.net>
*\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 &copy; 2005-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright &copy; 2005-2012 Daniel Swanson <danij@dengine.net>
* @authors Copyright &copy; 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
* <small>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</small>
*/

#ifndef LIBCOMMON_HU_STUFF_H
Expand All @@ -29,6 +27,10 @@
#include "doomsday.h"
#include "gl_drawpatch.h"

#ifdef __cplusplus
extern "C" {
#endif

// The fonts.
typedef enum {
GF_FIRST = 1,
Expand Down Expand Up @@ -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.
Expand All @@ -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);
Expand All @@ -145,25 +148,25 @@ 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);

/**
* 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);
Expand All @@ -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 */
8 changes: 8 additions & 0 deletions doomsday/plugins/common/include/p_mapsetup.h
Expand Up @@ -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;

Expand Down Expand Up @@ -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 */
8 changes: 8 additions & 0 deletions doomsday/plugins/common/include/p_tick.h
Expand Up @@ -31,6 +31,10 @@

#include "dd_types.h"

#ifdef __cplusplus
extern "C" {
#endif

extern int mapTime;
extern int actualMapTime;
extern int timerGame;
Expand All @@ -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 */
8 changes: 8 additions & 0 deletions doomsday/plugins/common/include/r_common.h
Expand Up @@ -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))
Expand Down Expand Up @@ -66,4 +70,8 @@ void R_GetGammaMessageStrings(void);

void R_CycleGammaLevel(void);

#ifdef __cplusplus
} // extern "C"
#endif

#endif /* LIBCOMMON_REFRESH_H */

0 comments on commit 22033a7

Please sign in to comment.