Skip to content

Commit

Permalink
Refactor|World|Client: Moved ClPlaneMover into new source files
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jan 10, 2014
1 parent c3fbda7 commit 5d60944
Show file tree
Hide file tree
Showing 6 changed files with 288 additions and 250 deletions.
2 changes: 2 additions & 0 deletions doomsday/client/client.pro
Expand Up @@ -216,6 +216,7 @@ DENG_HEADERS += \
include/client/cl_player.h \
include/client/cl_sound.h \
include/client/cl_world.h \
include/client/clplanemover.h \
include/clientapp.h \
include/color.h \
include/con_bar.h \
Expand Down Expand Up @@ -602,6 +603,7 @@ SOURCES += \
src/client/cl_player.cpp \
src/client/cl_sound.cpp \
src/client/cl_world.cpp \
src/client/clplanemover.cpp \
src/clientapp.cpp \
src/color.cpp \
src/con_bar.cpp \
Expand Down
2 changes: 0 additions & 2 deletions doomsday/client/include/client/cl_world.h
Expand Up @@ -49,8 +49,6 @@ void Cl_ReadServerMobjStateIDs();
int Cl_LocalMobjType(int serverMobjType);
int Cl_LocalMobjState(int serverMobjState);

void Cl_SetPolyMover(uint number, int move, int rotate);

/**
* Reads a sector delta from the PSV_FRAME2 message buffer and applies it to the world.
*/
Expand Down
41 changes: 41 additions & 0 deletions doomsday/client/include/client/clplanemover.h
@@ -0,0 +1,41 @@
/** @file clplanemover.h Clientside plane mover (thinker).
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2007-2013 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <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, see:
* http://www.gnu.org/licenses</small>
*/

#ifndef DENG_CLIENT_PLANEMOVER_H
#define DENG_CLIENT_PLANEMOVER_H

#include "api_thinker.h"

/**
* Plane movement thinker. Makes changes to planes using DMU.
*
* @ingroup world
*/
struct ClPlaneMover
{
thinker_t thinker;
int sectorIndex;
int planeIndex;
coord_t destination;
float speed;
};

void ClPlaneMover_Thinker(ClPlaneMover *mover);

#endif // DENG_CLIENT_PLANEMOVER_H
21 changes: 7 additions & 14 deletions doomsday/client/include/world/map.h
Expand Up @@ -27,6 +27,8 @@
#include "Polyobj"

#ifdef __CLIENT__
# include "client/clplanemover.h"

# include "world/world.h"
# include "p_particle.h"

Expand Down Expand Up @@ -67,15 +69,6 @@ typedef struct cmhash_s {

#define CLIENT_MAX_MOVERS 1024 // Definitely enough!

/**
* @ingroup world
*/
typedef enum {
CPT_FLOOR,
CPT_CEILING
} clplanetype_t;

struct ClPlaneMover;
struct ClPolyMover;

#endif // __CLIENT__
Expand Down Expand Up @@ -167,7 +160,7 @@ class Map
#ifdef __CLIENT__
cmhash_t clMobjHash[CLIENT_MOBJ_HASH_SIZE];

struct ClPlaneMover *clActivePlanes[CLIENT_MAX_MOVERS];
ClPlaneMover *clActivePlanes[CLIENT_MAX_MOVERS];
struct ClPolyMover *clActivePolyobjs[CLIENT_MAX_MOVERS];
#endif

Expand Down Expand Up @@ -691,13 +684,13 @@ class Map
*
* @return The new mover or @c NULL if arguments are invalid.
*/
struct ClPlaneMover *newClPlane(int sectorIdx, clplanetype_t type, coord_t dest, float speed);
ClPlaneMover *newClPlane(int sectorIdx, int planeIndex, coord_t dest, float speed);

void deleteClPlane(struct ClPlaneMover *mover);
void deleteClPlane(ClPlaneMover *mover);

int clPlaneIndex(struct ClPlaneMover *mover);
int clPlaneIndex(ClPlaneMover *mover);

struct ClPlaneMover *clPlaneBySectorIndex(int index, clplanetype_t type);
ClPlaneMover *clPlaneBySectorIndex(int index, int planeIndex);

bool isValidClPlane(int i);

Expand Down

0 comments on commit 5d60944

Please sign in to comment.