Skip to content

Commit

Permalink
Refactor: Continued dismantling the old "refresh" subsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Dec 8, 2013
1 parent 96f89c8 commit e8d105a
Show file tree
Hide file tree
Showing 9 changed files with 333 additions and 338 deletions.
2 changes: 0 additions & 2 deletions doomsday/client/include/dd_pinit.h
Expand Up @@ -41,8 +41,6 @@ extern uint mainWindowIdx;
*/
void DD_ShutdownAll(void);

int DD_CheckArg(char const *tag, const char** value);

#ifdef __CLIENT__
/**
* Compose the title for the main window.
Expand Down
80 changes: 29 additions & 51 deletions doomsday/client/include/render/r_main.h
@@ -1,7 +1,7 @@
/** @file r_main.h
*
* @author Copyright &copy; 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @author Copyright &copy; 2006-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
Expand All @@ -18,8 +18,8 @@
* 02110-1301 USA</small>
*/

#ifndef LIBDENG_RENDER_R_MAIN_H
#define LIBDENG_RENDER_R_MAIN_H
#ifndef DENG_RENDER_R_MAIN_H
#define DENG_RENDER_R_MAIN_H

#include <de/rect.h>
#include "dd_share.h"
Expand All @@ -29,18 +29,21 @@ class BspLeaf;
class Lumobj;
#endif

typedef struct viewport_s {
struct viewport_t
{
int console;
RectRaw geometry;
} viewport_t;
};

typedef struct viewer_s {
struct viewer_t
{
coord_t origin[3];
angle_t angle;
float pitch;
} viewer_t;
};

typedef struct viewdata_s {
struct viewdata_t
{
viewer_t current;
viewer_t lastSharp[2]; ///< For smoothing.
viewer_t latest; ///< "Sharp" values taken from here.
Expand All @@ -57,14 +60,14 @@ typedef struct viewdata_s {

RectRaw window, windowTarget, windowOld;
float windowInter;
} viewdata_t;
};

typedef enum fontstyle_e {
enum fontstyle_t {
FS_NORMAL,
FS_BOLD,
FS_LIGHT,
FONTSTYLE_COUNT
} fontstyle_t;
};

DENG_EXTERN_C float frameTimePos; // 0...1: fractional part for sharp game tics
DENG_EXTERN_C int loadInStartupMode;
Expand Down Expand Up @@ -93,31 +96,12 @@ DENG_EXTERN_C byte texGammaLut[256];
DENG_EXTERN_C boolean loInited;
#endif

#ifdef __cplusplus
extern "C" {
#endif

/**
* Register console variables.
*/
void R_Register(void);

void R_BuildTexGammaLut(void);

/**
* One-time initialization of the refresh daemon. Called by DD_Main.
*/
void R_Init(void);

/**
* Re-initialize almost everything.
*/
void R_Update(void);
void R_Register();

/**
* Shutdown the refresh daemon.
*/
void R_Shutdown(void);
void R_BuildTexGammaLut();

void R_Ticker(timespan_t time);

Expand All @@ -136,15 +120,15 @@ void R_RenderViewPorts(ui::ViewPortLayer layer);
/**
* Render a blank view for the specified player.
*/
void R_RenderBlankView(void);
void R_RenderBlankView();

/**
* Draw the border around the view window.
*/
void R_RenderPlayerViewBorder(void);
void R_RenderPlayerViewBorder();

/// @return Current viewport; otherwise @c NULL.
viewport_t const *R_CurrentViewPort(void);
viewport_t const *R_CurrentViewPort();

/**
* Set the current GL viewport.
Expand All @@ -155,18 +139,18 @@ viewdata_t const *R_ViewData(int consoleNum);

void R_UpdateViewer(int consoleNum);

void R_ResetViewer(void);
void R_ResetViewer();

int R_NextViewer(void);
int R_NextViewer();

#ifdef __CLIENT__

void R_ClearViewData(void);
void R_ClearViewData();

/**
* To be called at the beginning of a render frame to perform necessary initialization.
*/
void R_BeginFrame(void);
void R_BeginFrame();

/**
* Returns @c true iff the BSP leaf is marked as visible for the current frame.
Expand Down Expand Up @@ -207,7 +191,7 @@ void R_ViewerClipLumobjBySight(Lumobj *lum, BspLeaf *bspLeaf);
* Update the sharp world data by rotating the stored values of plane
* heights and sharp camera positions.
*/
void R_NewSharpWorld(void);
void R_NewSharpWorld();

/**
* Attempt to set up a view grid and calculate the viewports. Set 'numCols' and
Expand All @@ -222,17 +206,11 @@ void R_SetupDefaultViewWindow(int consoleNum);
*/
void R_ViewWindowTicker(int consoleNum, timespan_t ticLength);

void R_SetViewPortPlayer(int consoleNum, int viewPlayer);

void R_LoadSystemFonts(void);
void R_LoadSystemFonts();

#ifdef __CLIENT__
char const *R_ChooseFixedFont(void);
char const *R_ChooseVariableFont(fontstyle_t style, int resX, int resY);
#endif

#ifdef __cplusplus
} // extern "C"
char const *R_ChooseFixedFont();
char const *R_ChooseVariableFont(fontstyle_t style);
#endif

#endif /* LIBDENG_REFRESH_MAIN_H */
#endif // DENG_REFRESH_MAIN_H
1 change: 1 addition & 0 deletions doomsday/client/include/resource/resourcesystem.h
Expand Up @@ -37,6 +37,7 @@
#include "Sprite"
#include "Texture"
#include "TextureScheme"
#include "resource/rawtexture.h" /// @todo not yet owned
#include "resource/wad.h"
#include "resource/zip.h"
#include "uri.hh"
Expand Down
2 changes: 2 additions & 0 deletions doomsday/client/include/world/world.h
Expand Up @@ -47,6 +47,8 @@ class Map;

/**
* @ingroup world
*
* @todo Derive from de::System
*/
class World
{
Expand Down
31 changes: 15 additions & 16 deletions doomsday/client/src/dd_help.cpp
@@ -1,4 +1,5 @@
/** @file dd_help.cpp Runtime help text strings.
/** @file dd_help.cpp Runtime help text strings.
*
* @ingroup base
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
Expand Down Expand Up @@ -29,20 +30,13 @@
#include <QMap>
#include <QStringBuilder>

D_CMD(LoadHelp);

using namespace de;

typedef QMap<int, String> StringsByType; // HST_* type => string
typedef QMap<String, StringsByType> HelpStrings; // id => typed strings

static HelpStrings helps;

void DH_Register(void)
{
C_CMD("loadhelp", "", LoadHelp);
}

/**
* Parses the given file looking for help strings. The contents of the file are
* expected to use UTF-8 encoding.
Expand Down Expand Up @@ -144,13 +138,13 @@ HelpId DH_Find(char const *id)
{
return &found.value();
}
return NULL;
return 0;
}

char const *DH_GetString(HelpId found, int type)
{
if(!found || type < 0 || type > NUM_HELPSTRING_TYPES)
return NULL;
if(!found) return 0;
if(type < 0 || type > NUM_HELPSTRING_TYPES) return 0;

StringsByType const *hs = reinterpret_cast<StringsByType const *>(found);

Expand All @@ -159,10 +153,10 @@ char const *DH_GetString(HelpId found, int type)
{
return Str_Text(AutoStr_FromTextStd(i.value().toUtf8().constData()));
}
return NULL;
return 0;
}

void DD_InitHelp(void)
void DD_InitHelp()
{
LOG_AS("DD_InitHelp");
try
Expand All @@ -175,7 +169,7 @@ void DD_InitHelp(void)
}
}

void DD_ReadGameHelp(void)
void DD_ReadGameHelp()
{
LOG_AS("DD_ReadGameHelp");
try
Expand All @@ -192,16 +186,21 @@ void DD_ReadGameHelp(void)
}
}

void DD_ShutdownHelp(void)
void DD_ShutdownHelp()
{
helps.clear();
}

D_CMD(LoadHelp)
{
DENG2_UNUSED(src); DENG2_UNUSED(argc); DENG2_UNUSED(argv);
DENG2_UNUSED3(src, argc, argv);

DD_ShutdownHelp();
DD_InitHelp();
return true;
}

void DH_Register()
{
C_CMD("loadhelp", "", LoadHelp);
}

0 comments on commit e8d105a

Please sign in to comment.