Skip to content

Commit

Permalink
Refactor|libcommon: Switched more libcommon source files to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jan 29, 2014
1 parent 2b495a6 commit d9f4cc5
Show file tree
Hide file tree
Showing 11 changed files with 632 additions and 793 deletions.
10 changes: 5 additions & 5 deletions doomsday/plugins/common/common.pri
Expand Up @@ -96,22 +96,22 @@ SOURCES += \
$$common_src/mobj.c \
$$common_src/pause.c \
$$common_src/p_actor.cpp \
$$common_src/p_ceiling.c \
$$common_src/p_ceiling.cpp \
$$common_src/p_door.c \
$$common_src/p_floor.c \
$$common_src/p_floor.cpp \
$$common_src/p_inventory.c \
$$common_src/p_iterlist.c \
$$common_src/p_map.cpp \
$$common_src/p_mapsetup.cpp \
$$common_src/p_mapspec.c \
$$common_src/p_plat.c \
$$common_src/p_plat.cpp \
$$common_src/p_player.c \
$$common_src/p_saveg.cpp \
$$common_src/p_saveio.c \
$$common_src/p_scroll.c \
$$common_src/p_scroll.cpp \
$$common_src/p_sound.cpp \
$$common_src/p_start.cpp \
$$common_src/p_switch.c \
$$common_src/p_switch.cpp \
$$common_src/p_terraintype.c \
$$common_src/p_tick.c \
$$common_src/p_user.c \
Expand Down
68 changes: 39 additions & 29 deletions doomsday/plugins/common/include/p_ceiling.h
@@ -1,38 +1,29 @@
/**\file p_ceiling.h
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
/** @file p_ceiling.h Moving ceilings (lowering, crushing, raising).
*
*\author Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
*\author Copyright © 1993-1996 by id Software, Inc.
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 1993-1996 id Software, Inc.
*
* 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
*/

/**
* Common playsim routines relating to ceilings.
* <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_THINKER_CEILING_H
#define LIBCOMMON_THINKER_CEILING_H

#ifdef __cplusplus
extern "C" {
#endif
#define CEILSPEED (1)
#define CEILWAIT (150)

typedef enum {
CS_DOWN,
Expand Down Expand Up @@ -75,20 +66,39 @@ typedef struct {
int tag; // id.
} ceiling_t;

#define CEILSPEED (1)
#define CEILWAIT (150)
#ifdef __cplusplus
extern "C" {
#endif

void T_MoveCeiling(void *ceilingThinkerPtr);

/**
* Move a ceiling up/down.
*/
#if __JHEXEN__
int EV_DoCeiling(Line* line, byte* args, ceilingtype_e type);
#else
int EV_DoCeiling(Line* li, ceilingtype_e type);
#endif

/**
* Reactivates all stopped crushers with the right tag.
*
* @param tag Tag of ceilings to activate.
*
* @return @c true, if a ceiling is activated.
*/
#if __JDOOM__ || __JDOOM64__ || __JHERETIC__
int P_CeilingActivate(short tag);
#endif

/**
* Stops all active ceilings with the right tag.
*
* @param tag Tag of ceilings to stop.
*
* @return @c true, if a ceiling put in stasis.
*/
int P_CeilingDeactivate(short tag);

#ifdef __cplusplus
Expand Down
100 changes: 48 additions & 52 deletions doomsday/plugins/common/include/p_floor.h
@@ -1,38 +1,28 @@
/**\file
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
/** @file p_floor.h Common playsim routines relating to moving floors.
*
*\author Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
*\author Copyright © 1993-1996 by id Software, Inc.
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 1993-1996 id Software, Inc.
*
* 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
*/

/**
* p_floor.h: Common playsim routines relating to moving floors.
* <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 __COMMON_THINKER_FLOOR_H__
#define __COMMON_THINKER_FLOOR_H__
#ifndef LIBCOMMON_THINKER_FLOOR_H
#define LIBCOMMON_THINKER_FLOOR_H

#ifdef __cplusplus
extern "C" {
#endif
#define FLOORSPEED (1)

typedef enum {
FS_DOWN = -1, // Moving down.
Expand Down Expand Up @@ -92,43 +82,49 @@ typedef enum {
} floortype_e;

typedef struct {
thinker_t thinker;
floortype_e type;
dd_bool crush;
Sector* sector;
floorstate_e state;
int newSpecial;
Material* material;
coord_t floorDestHeight;
float speed;
thinker_t thinker;
floortype_e type;
dd_bool crush;
Sector *sector;
floorstate_e state;
int newSpecial;
Material *material;
coord_t floorDestHeight;
float speed;
#if __JHEXEN__
int delayCount;
int delayTotal;
coord_t stairsDelayHeight;
coord_t stairsDelayHeightDelta;
coord_t resetHeight;
short resetDelay;
short resetDelayCount;
int delayCount;
int delayTotal;
coord_t stairsDelayHeight;
coord_t stairsDelayHeightDelta;
coord_t resetHeight;
short resetDelay;
short resetDelayCount;
#endif
} floor_t;

#define FLOORSPEED (1)
#ifdef __cplusplus
extern "C" {
#endif

void T_MoveFloor(void *floorThinker);
void T_MoveFloor(void *floorThinker);

/**
* Handle moving floors.
*/
#if __JHEXEN__
int EV_DoFloor(Line* li, byte* args, floortype_e type);
int EV_DoFloor(Line *li, byte *args, floortype_e type);
#else
int EV_DoFloor(Line* li, floortype_e type);
int EV_DoFloor(Line *li, floortype_e type);
#endif

#if __JHEXEN__
int EV_DoFloorAndCeiling(Line* li, byte* args, int ftype, int ctype);
int EV_DoFloorAndCeiling(Line *li, byte *args, int ftype, int ctype);
#elif __JDOOM64__
int EV_DoFloorAndCeiling(Line* li, int ftype, int ctype);
int EV_DoFloorAndCeiling(Line *li, int ftype, int ctype);
#endif

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

#endif
#endif // LIBCOMMON_THINKER_FLOOR_H

0 comments on commit d9f4cc5

Please sign in to comment.