Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
libdoom64: Switched d_main.c to C++
  • Loading branch information
danij-deng committed Feb 17, 2014
1 parent 4f831e1 commit 80d6cbb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
6 changes: 3 additions & 3 deletions doomsday/plugins/common/src/p_saveg.cpp
Expand Up @@ -57,7 +57,7 @@ targetplraddress_t *targetPlayerAddrs;
* @return File path to the reachable save directory. If the game-save path
* is unreachable then a zero-length string is returned instead.
*/
static de::Path composeGameSavePathForClientSessionId(uint sessionId)
static de::Path savePathForClientSessionId(uint sessionId)
{
// Do we have a valid path?
if(!F_MakePath(de::NativePath(SV_ClientSavePath()).expand().toUtf8().constData()))
Expand Down Expand Up @@ -976,7 +976,7 @@ void SV_SaveGameClient(uint sessionId)
if(!IS_CLIENT || !mo)
return;

de::Path path = composeGameSavePathForClientSessionId(sessionId);
de::Path path = savePathForClientSessionId(sessionId);
if(!SV_OpenFile(path, "wp"))
{
App_Log(DE2_RES_WARNING, "SV_SaveGameClient: Failed opening \"%s\" for writing",
Expand Down Expand Up @@ -1031,7 +1031,7 @@ void SV_LoadGameClient(uint sessionId)
if(!IS_CLIENT || !mo)
return;

de::Path path = composeGameSavePathForClientSessionId(sessionId);
de::Path path = savePathForClientSessionId(sessionId);
if(!SV_OpenFile(path, "rp"))
{
App_Log(DE2_RES_WARNING, "SV_LoadGameClient: Failed opening \"%s\" for reading",
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/doom64/doom64.pro
Expand Up @@ -68,7 +68,7 @@ SOURCES += \
src/d_api.c \
src/d_console.c \
src/d_items.c \
src/d_main.c \
src/d_main.cpp \
src/d_refresh.c \
src/m_cheat.c \
src/m_random.c \
Expand Down
@@ -1,4 +1,4 @@
/** @file d_main.c Doom64-specific game initialization.
/** @file d_main.cpp Doom64-specific game initialization.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
Expand Down Expand Up @@ -30,8 +30,8 @@
#include "p_inventory.h"
#include "p_saveg.h"
#include "p_map.h"
#include <assert.h>
#include <string.h>
#include <cassert>
#include <cstring>

int verbose;
float turboMul; // Multiplier for turbo.
Expand Down Expand Up @@ -69,22 +69,22 @@ void *D_GetVariable(int id)
switch(id)
{
case DD_PLUGIN_NAME:
return PLUGIN_NAMETEXT;
return (void*)PLUGIN_NAMETEXT;

case DD_PLUGIN_NICENAME:
return PLUGIN_NICENAME;
return (void*)PLUGIN_NICENAME;

case DD_PLUGIN_VERSION_SHORT:
return PLUGIN_VERSION_TEXT;
return (void*)PLUGIN_VERSION_TEXT;

case DD_PLUGIN_VERSION_LONG:
return PLUGIN_VERSION_TEXTLONG "\n" PLUGIN_DETAILS;
return (void*)(PLUGIN_VERSION_TEXTLONG "\n" PLUGIN_DETAILS);

case DD_PLUGIN_HOMEURL:
return PLUGIN_HOMEURL;
return (void*)PLUGIN_HOMEURL;

case DD_PLUGIN_DOCSURL:
return PLUGIN_DOCSURL;
return (void*)PLUGIN_DOCSURL;

case DD_GAME_CONFIG:
return gameConfigString;
Expand Down Expand Up @@ -148,11 +148,10 @@ void D_PreInit()
cfg.hudShown[HUD_FRAGS] = true;
cfg.hudShown[HUD_INVENTORY] = false; // They will be visible when the automap is.
cfg.hudShown[HUD_LOG] = true;
{ int i;
for(i = 0; i < NUMHUDUNHIDEEVENTS; ++i) // When the hud/statusbar unhides.
for(int i = 0; i < NUMHUDUNHIDEEVENTS; ++i) // When the hud/statusbar unhides.
{
cfg.hudUnHide[i] = 1;
}}
}
cfg.hudScale = .6f;
cfg.hudColor[0] = 1;
cfg.hudColor[1] = cfg.hudColor[2] = 0;
Expand Down Expand Up @@ -301,8 +300,6 @@ void D_PostInit()
{
dd_bool autoStart = false;
Uri *startMapUri = 0;
AutoStr *path;
int p;

// Common post init routine.
G_CommonPostInit();
Expand Down Expand Up @@ -332,7 +329,7 @@ void D_PostInit()
gameRules.respawnMonsters = CommandLine_Check("-respawn")? true : false;
gameRules.fast = CommandLine_Check("-fast")? true : false;

p = CommandLine_Check("-timer");
int p = CommandLine_Check("-timer");
if(p && p < myargc - 1 && gameRules.deathmatch)
{
int time = atoi(CommandLine_At(p + 1));
Expand Down Expand Up @@ -400,7 +397,7 @@ void D_PostInit()
}

// Validate episode and map.
path = Uri_Compose(startMapUri);
AutoStr *path = Uri_Compose(startMapUri);
if((autoStart || IS_NETGAME) && P_MapExists(Str_Text(path)))
{
G_DeferredNewGame(startMapUri, 0/*default*/, &gameRules);
Expand Down

0 comments on commit 80d6cbb

Please sign in to comment.