Skip to content

Commit

Permalink
Refactor|libcommon: Switched common/src/p_mapsetup to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Aug 7, 2013
1 parent 730cce9 commit a507687
Show file tree
Hide file tree
Showing 17 changed files with 329 additions and 296 deletions.
2 changes: 1 addition & 1 deletion doomsday/plugins/common/common.pri
Expand Up @@ -98,7 +98,7 @@ SOURCES += \
$$common_src/p_inventory.c \
$$common_src/p_iterlist.c \
$$common_src/p_map.c \
$$common_src/p_mapsetup.c \
$$common_src/p_mapsetup.cpp \
$$common_src/p_mapspec.c \
$$common_src/p_plat.c \
$$common_src/p_player.c \
Expand Down
16 changes: 12 additions & 4 deletions doomsday/plugins/common/include/d_net.h
Expand Up @@ -184,6 +184,15 @@ enum {
#define CMDF_BTN_PAUSE 0x08
#define CMDF_BTN_SUICIDE 0x10 // Now ignored in ticcmds

// Console commands.
DENG_EXTERN_C ccmdtemplate_t netCCmds[];

DENG_EXTERN_C float netJumpPower;

#ifdef __cplusplus
extern "C" {
#endif

Writer* D_NetWrite(void);
Reader* D_NetRead(const byte* buffer, size_t len);
void D_NetClearBuffer(void);
Expand Down Expand Up @@ -212,10 +221,9 @@ void D_NetConsoleRegistration(void);
void D_NetMessage(int player, const char *msg);
void D_NetMessageNoSound(int player, const char *msg);

// Console commands.
extern ccmdtemplate_t netCCmds[];

extern float netJumpPower;
#ifdef __cplusplus
} // extern "C"
#endif

#include "d_netsv.h"
#include "d_netcl.h"
Expand Down
20 changes: 8 additions & 12 deletions doomsday/plugins/common/include/g_controls.h
Expand Up @@ -29,18 +29,6 @@
#ifndef LIBCOMMON_CONTROLS_H
#define LIBCOMMON_CONTROLS_H

/*
// Game registered bindContexts
enum {
GBC_CLASS1 = NUM_DDBINDCLASSES,
GBC_CLASS2,
GBC_CLASS3,
GBC_MENUHOTKEY,
GBC_CHAT,
GBC_MESSAGE
};
*/

// Control identifiers.
enum {
CTL_SPEED = CTL_FIRST_GAME_CONTROL,
Expand Down Expand Up @@ -147,6 +135,10 @@ typedef struct playerbrain_s {
uint logRefresh: 1;
} playerbrain_t;

#ifdef __cplusplus
extern "C" {
#endif

/**
* Register the CVars and CCmds for input/controls.
*/
Expand All @@ -160,4 +152,8 @@ void G_ControlReset(int pnum);
float G_GetLookOffset(int pnum);
void G_ResetLookOffset(int pnum);

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

#endif /* LIBCOMMON_CONTROLS_H */
8 changes: 8 additions & 0 deletions doomsday/plugins/common/include/hu_pspr.h
Expand Up @@ -29,7 +29,15 @@
#ifndef __COMMON_PSPRITE_H__
#define __COMMON_PSPRITE_H__

#ifdef __cplusplus
extern "C" {
#endif

void HU_UpdatePsprites(void);
float HU_PSpriteYOffset(player_t* pl);

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

#endif
58 changes: 28 additions & 30 deletions doomsday/plugins/common/include/p_mapsetup.h
@@ -1,43 +1,37 @@
/**\file p_mapsetup.h
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
/** @file p_mapsetup.h Common map setup routines.
*
*\author Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
* Management of extended map data objects (e.g., xlines) is done here.
*
* 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 © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
*
* 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>
*/

/**
* Common map setup routines
*/

#ifndef LIBCOMMON_PLAYSETUP_H
#define LIBCOMMON_PLAYSETUP_H
#ifndef LIBCOMMON_PLAYSIM_MAPSETUP_H
#define LIBCOMMON_PLAYSIM_MAPSETUP_H

#include "common.h"

// If true we are in the process of setting up a map.
DENG_EXTERN_C boolean mapSetup;

#ifdef __cplusplus
extern "C" {
#endif

// If true we are in the process of setting up a map.
extern boolean mapSetup;

/**
* Doomsday calls this once a map change has completed to allow us (the game)
* to do any finalization we need (such as spawning thinkers or cataloguing
Expand All @@ -52,20 +46,24 @@ void P_FinalizeMapChange(Uri const *uri);
*/
void P_SetupMap(Uri *uri);

const char* P_GetMapNiceName(void);
char const *P_GetMapNiceName(void);

patchid_t P_FindMapTitlePatch(uint episode, uint map);
const char* P_GetMapAuthor(boolean supressGameAuthor);

char const *P_GetMapAuthor(boolean supressGameAuthor);

#if __JDOOM__ || __JDOOM64__ || __JHERETIC__
void P_FindSecrets(void);
#endif

void P_SpawnSectorMaterialOriginScrollers(void);

void P_SpawnSideMaterialOriginScrollers(void);

void P_SpawnAllMaterialOriginScrollers(void);

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

#endif /* LIBCOMMON_PLAYSETUP_H */
#endif /* LIBCOMMON_PLAYSIM_MAPSETUP_H */
69 changes: 36 additions & 33 deletions doomsday/plugins/common/include/p_xg.h
@@ -1,55 +1,58 @@
/**\file
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
/** @file p_xg.h Extended Generalised Line / Sector Types.
*
*\author Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 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>
*
* 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.
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* 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>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 __EXTENDED_GENERAL_H__
#define __EXTENDED_GENERAL_H__
#ifndef LIBCOMMON_PLAYSIM_XG_H
#define LIBCOMMON_PLAYSIM_XG_H

#include "p_xgline.h"
#include "p_xgsec.h"

extern int xgDev;
extern boolean xgDataLumps;
DENG_EXTERN_C int xgDev;
DENG_EXTERN_C boolean xgDataLumps;

#ifdef __cplusplus
extern "C" {
#endif

// Debug message printer.
void XG_Dev(const char *format, ...) PRINTF_F(1,2);
void XG_Dev(char const *format, ...) PRINTF_F(1,2);

// Called once, at post init.
void XG_ReadTypes(void);
// Called once post init.
void XG_ReadTypes(void);

// Init both XG lines and sectors. Called for each map.
void XG_Init(void);
void XG_Init(void);

// Thinks for XG lines and sectors.
void XG_Ticker(void);
void XG_Ticker(void);

// Updates XG state during engine reset.
void XG_Update(void);
void XG_Update(void);

//void XG_WriteTypes(FILE * file);
void XG_ReadTypes(void);
void XG_ReadTypes(void);

linetype_t *XG_GetLumpLine(int id);
sectortype_t *XG_GetLumpSector(int id);
linetype_t *XG_GetLumpLine(int id);
sectortype_t *XG_GetLumpSector(int id);

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

#endif /* LIBCOMMON_PLAYSIM_XG_H */

0 comments on commit a507687

Please sign in to comment.