Skip to content

Commit

Permalink
Refactor: Renamed polyobj_t as Polyobj
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Mar 10, 2012
1 parent daf2d23 commit 2065382
Show file tree
Hide file tree
Showing 33 changed files with 129 additions and 133 deletions.
2 changes: 1 addition & 1 deletion doomsday/engine/api/dd_api.h
Expand Up @@ -146,7 +146,7 @@ typedef struct {

// Main structure sizes.
size_t mobjSize; // sizeof(mobj_t)
size_t polyobjSize; // sizeof(polyobj_t)
size_t polyobjSize; // sizeof(Polyobj)

// Map data setup
/**
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/api/dd_share.h
Expand Up @@ -781,7 +781,7 @@ enum { /* Do NOT change the numerical values of the constants. */

/**
* All map think-able objects must use this as a base. Also used for sound
* origin purposes for all of: mobj_t, polyobj_t, Sector/plane_t
* origin purposes for all of: mobj_t, Polyobj, Sector/plane_t
* @ingroup mobj
*/
typedef struct ddmobj_base_s {
Expand Down Expand Up @@ -1065,7 +1065,7 @@ typedef struct aaboxf_s {
int health;\
mobjinfo_t *info; /* &mobjinfo[mobj->type] */

/// Base polyobj_t elements. Games MUST use this as the basis for polyobj_t. @ingroup map
/// Base Polyobj elements. Games MUST use this as the basis for Polyobj. @ingroup map
#define DD_BASE_POLYOBJ_ELEMENTS() \
DD_BASE_DDMOBJ_ELEMENTS() \
\
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/include/edit_map.h
Expand Up @@ -43,7 +43,7 @@ typedef struct editmap_s {
uint numSectors;
Sector** sectors;
uint numPolyObjs;
polyobj_t** polyObjs;
Polyobj** polyObjs;

// The following is for game-specific map object data.
gameobjdata_t gameObjData;
Expand Down
18 changes: 9 additions & 9 deletions doomsday/engine/portable/include/gamemap.h
Expand Up @@ -100,7 +100,7 @@ typedef struct gamemap_s {
SideDef* sideDefs;

uint numPolyObjs;
polyobj_t** polyObjs;
Polyobj** polyObjs;

gameobjdata_t gameObjData;

Expand Down Expand Up @@ -394,7 +394,7 @@ uint GameMap_PolyobjCount(GameMap* map);
* @param id Unique identifier of the Polyobj to be found.
* @return Found Polyobj instance else @c NULL.
*/
polyobj_t* GameMap_PolyobjByID(GameMap* map, uint id);
Polyobj* GameMap_PolyobjByID(GameMap* map, uint id);

/**
* Lookup a Polyobj in the map by tag.
Expand All @@ -403,7 +403,7 @@ polyobj_t* GameMap_PolyobjByID(GameMap* map, uint id);
* @param tag Tag associated with the Polyobj to be found.
* @return Found Polyobj instance else @c NULL.
*/
polyobj_t* GameMap_PolyobjByTag(GameMap* map, int tag);
Polyobj* GameMap_PolyobjByTag(GameMap* map, int tag);

/**
* Lookup a Polyobj in the map by origin.
Expand All @@ -412,7 +412,7 @@ polyobj_t* GameMap_PolyobjByTag(GameMap* map, int tag);
* @param tag Tag associated with the Polyobj to be found.
* @return Found Polyobj instance else @c NULL.
*/
polyobj_t* GameMap_PolyobjByOrigin(GameMap* map, void* ddMobjBase);
Polyobj* GameMap_PolyobjByOrigin(GameMap* map, void* ddMobjBase);

/**
* Have the thinker lists been initialized yet?
Expand Down Expand Up @@ -662,13 +662,13 @@ int GameMap_BspLeafIterator(GameMap* map, int (*callback) (BspLeaf*, void*), voi
*/
void GameMap_InitPolyobjBlockmap(GameMap* map, const_pvec2_t min, const_pvec2_t max);

void GameMap_LinkPolyobjInBlockmap(GameMap* map, polyobj_t* po);
void GameMap_UnlinkPolyobjInBlockmap(GameMap* map, polyobj_t* po);
void GameMap_LinkPolyobjInBlockmap(GameMap* map, Polyobj* po);
void GameMap_UnlinkPolyobjInBlockmap(GameMap* map, Polyobj* po);

int GameMap_IterateCellPolyobjs(GameMap* map, const uint coords[2],
int (*callback) (polyobj_t*, void*), void* parameters);
int (*callback) (Polyobj*, void*), void* parameters);
int GameMap_IterateCellBlockPolyobjs(GameMap* map, const struct gridmapblock_s* blockCoords,
int (*callback) (polyobj_t*, void*), void* parameters);
int (*callback) (Polyobj*, void*), void* parameters);

/**
* The validCount flags are used to avoid checking polys that are marked in
Expand All @@ -678,7 +678,7 @@ int GameMap_IterateCellBlockPolyobjs(GameMap* map, const struct gridmapblock_s*
int GameMap_PolyobjsBoxIterator(GameMap* map, const AABoxf* box,
int (*callback) (struct polyobj_s*, void*), void* parameters);

int GameMap_PolyobjIterator(GameMap* map, int (*callback) (polyobj_t*, void*), void* parameters);
int GameMap_PolyobjIterator(GameMap* map, int (*callback) (Polyobj*, void*), void* parameters);

int GameMap_VertexIterator(GameMap* map, int (*callback) (vertex_t*, void*), void* parameters);

Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/include/p_mapdata.h
Expand Up @@ -180,7 +180,7 @@ extern BspLeaf* bspLeafs;
extern BspNode* bspNodes;
extern LineDef* lineDefs;
extern SideDef* sideDefs;
extern polyobj_t** polyObjs; ///< List of all polyobjs on the current map.
extern Polyobj** polyObjs; ///< List of all polyobjs on the current map.

#include "gamemap.h"

Expand Down Expand Up @@ -226,7 +226,7 @@ const char* P_MapSourceFile(const char* uri);
*/
boolean P_LoadMap(const char* uri);

void P_PolyobjChanged(polyobj_t* po);
void P_PolyobjChanged(Polyobj* po);

void P_RegisterUnknownTexture(const char* name, boolean planeTex);

Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/include/p_maputil.h
Expand Up @@ -169,7 +169,7 @@ int P_LinesBoxIterator(const AABoxf* box, int (*callback) (LineDef*, void*), voi
* multiple mapblocks, so increment validCount before the first call, then
* make one or more calls to it.
*/
int P_PolyobjsBoxIterator(const AABoxf* box, int (*callback) (polyobj_t*, void*), void* parameters);
int P_PolyobjsBoxIterator(const AABoxf* box, int (*callback) (Polyobj*, void*), void* parameters);

int P_PolyobjLinesBoxIterator(const AABoxf* box, int (*callback) (LineDef*, void*), void* parameters);

Expand Down
34 changes: 17 additions & 17 deletions doomsday/engine/portable/include/p_polyob.h
@@ -1,5 +1,5 @@
/**
* @file p_polyob.h
* @file polyobj.h
* Moveable Polygonal Map Objects (Polyobj). @ingroup map
*
* @authors Copyright © 2003-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
Expand All @@ -20,13 +20,13 @@
* 02110-1301 USA</small>
*/

#ifndef LIBDENG_MAP_POLYOB_H
#define LIBDENG_MAP_POLYOB_H
#ifndef LIBDENG_MAP_POLYOBJ_H
#define LIBDENG_MAP_POLYOBJ_H

// We'll use the base polyobj template directly as our mobj.
// We'll use the base polyobj template directly as our polyobj.
typedef struct polyobj_s {
DD_BASE_POLYOBJ_ELEMENTS()
} polyobj_t;
} Polyobj;

#define POLYOBJ_SIZE gx.polyobjSize

Expand All @@ -41,70 +41,70 @@ void P_SetPolyobjCallback(void (*func) (struct mobj_s*, void*, void*));
* @param id Unique identifier of the Polyobj to be found.
* @return Found Polyobj instance else @c NULL.
*/
polyobj_t* P_PolyobjByID(uint id);
Polyobj* P_PolyobjByID(uint id);

/**
* Lookup a Polyobj on the current map by tag.
*
* @param tag Tag associated with the Polyobj to be found.
* @return Found Polyobj instance else @c NULL.
*/
polyobj_t* P_PolyobjByTag(int tag);
Polyobj* P_PolyobjByTag(int tag);

/**
* Lookup a Polyobj on the current map by origin.
*
* @param tag Tag associated with the Polyobj to be found.
* @return Found Polyobj instance else @c NULL.
*/
polyobj_t* P_PolyobjByOrigin(void* ddMobjBase);
Polyobj* P_PolyobjByOrigin(void* ddMobjBase);

/**
* Translate the origin of @a polyobj in the map coordinate space.
*/
boolean P_PolyobjMove(polyobj_t* polyobj, float xy[2]);
boolean P_PolyobjMoveXY(polyobj_t* polyobj, float x, float y);
boolean P_PolyobjMove(Polyobj* polyobj, float xy[2]);
boolean P_PolyobjMoveXY(Polyobj* polyobj, float x, float y);

/**
* Rotate @a polyobj in the map coordinate space.
*/
boolean P_PolyobjRotate(polyobj_t* polyobj, angle_t angle);
boolean P_PolyobjRotate(Polyobj* polyobj, angle_t angle);

/**
* Link @a polyobj to the current map. To be called after moving, rotating
* or any other translation of the Polyobj within the map.
*/
void P_PolyobjLink(polyobj_t* polyobj);
void P_PolyobjLink(Polyobj* polyobj);

/**
* Unlink @a polyobj from the current map. To be called prior to moving,
* rotating or any other translation of the Polyobj within the map.
*/
void P_PolyobjUnlink(polyobj_t* polyobj);
void P_PolyobjUnlink(Polyobj* polyobj);

/**
* Update the Polyobj's map space axis-aligned bounding box to encompass
* the points defined by it's vertices.
*
* @param polyobj Polyobj instance.
*/
void Polyobj_UpdateAABox(polyobj_t* polyobj);
void Polyobj_UpdateAABox(Polyobj* polyobj);

/**
* Update the Polyobj's map space surface tangents according to the points
* defined by the associated LineDef's vertices.
*
* @param polyobj Polyobj instance.
*/
void Polyobj_UpdateSurfaceTangents(polyobj_t* polyobj);
void Polyobj_UpdateSurfaceTangents(Polyobj* polyobj);

/**
* Update the Polyobj's SideDef's map space origins according to the points
* defined by the center of the associated LineDef's vertices.
*
* @param polyobj Polyobj instance.
*/
void Polyobj_UpdateSideDefOrigins(polyobj_t* polyobj);
void Polyobj_UpdateSideDefOrigins(Polyobj* polyobj);

/**
* Iterate over the lines of the Polyobj making a callback for each.
Expand All @@ -120,7 +120,7 @@ void Polyobj_UpdateSideDefOrigins(polyobj_t* polyobj);
*
* @return @c 0 iff iteration completed wholly.
*/
int Polyobj_LineIterator(polyobj_t* polyobj,
int Polyobj_LineIterator(Polyobj* polyobj,
int (*callback) (struct linedef_s*, void* paramaters), void* paramaters);

#endif /// LIBDENG_MAP_POLYOB_H
16 changes: 6 additions & 10 deletions doomsday/engine/portable/include/p_polyobj.h
@@ -1,4 +1,4 @@
/**\file
/**\file p_polyobj.h
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
Expand All @@ -22,17 +22,13 @@
* Boston, MA 02110-1301 USA
*/

/**
* r_polyobj.h: World polyobj.
*/

#ifndef __DOOMSDAY_WORLD_POLYOBJ_H__
#define __DOOMSDAY_WORLD_POLYOBJ_H__
#ifndef LIBDENG_P_POLYOBJ_H
#define LIBDENG_P_POLYOBJ_H

#include "r_data.h"
#include "p_dmu.h"

boolean Polyobj_GetProperty(const polyobj_t *po, setargs_t *args);
boolean Polyobj_SetProperty(polyobj_t *po, const setargs_t *args);
boolean Polyobj_GetProperty(const Polyobj* po, setargs_t* args);
boolean Polyobj_SetProperty(Polyobj* po, const setargs_t* args);

#endif
#endif /// LIBDENG_P_POLYOBJ_H
2 changes: 1 addition & 1 deletion doomsday/engine/portable/include/sv_pool.h
Expand Up @@ -403,7 +403,7 @@ void Sv_AckDeltaSet(uint clientNumber, int set, byte resent);
uint Sv_CountUnackedDeltas(uint clientNumber);

void Sv_NewSoundDelta(int soundId, mobj_t* emitter,
Sector* sourceSector, polyobj_t* sourcePoly,
Sector* sourceSector, Polyobj* sourcePoly,
float volume, boolean isRepeating,
int clientsMask);

Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/cl_sound.c
Expand Up @@ -63,7 +63,7 @@ void Cl_ReadSoundDelta2(deltatype_t type, boolean skip)
mobj_t *cmo = NULL;
thid_t mobjId = 0;
Sector *sector = NULL;
polyobj_t *poly = NULL;
Polyobj *poly = NULL;
mobj_t *emitter = NULL;
float volume = 1;

Expand Down
6 changes: 3 additions & 3 deletions doomsday/engine/portable/src/cl_world.c
Expand Up @@ -53,7 +53,7 @@ typedef struct clplane_s {
typedef struct clpolyobj_s {
thinker_t thinker;
uint number;
polyobj_t* polyobj;
Polyobj* polyobj;
boolean move;
boolean rotate;
} clpolyobj_t;
Expand Down Expand Up @@ -460,7 +460,7 @@ clplane_t* GameMap_NewClPlane(GameMap* map, uint sectorIndex, clplanetype_t type

void Cl_PolyMoverThinker(clpolyobj_t* mover)
{
polyobj_t* po;
Polyobj* po;
float dx, dy, dist;
assert(mover);

Expand Down Expand Up @@ -860,7 +860,7 @@ void Cl_ReadPolyDelta2(boolean skip)
{
int df;
unsigned short num;
polyobj_t *po;
Polyobj *po;
float destX = 0, destY = 0;
float speed = 0;
int destAngle = 0, angleSpeed = 0;
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/dam_file.c
Expand Up @@ -857,7 +857,7 @@ static void archiveReject(GameMap *map, boolean write)

static void writePolyobj(const GameMap* map, uint idx)
{
polyobj_t* p = map->polyObjs[idx];
Polyobj* p = map->polyObjs[idx];
uint i;

writeLong((long) p->idx);
Expand Down Expand Up @@ -898,7 +898,7 @@ static void writePolyobj(const GameMap* map, uint idx)

static void readPolyobj(const GameMap* map, uint idx)
{
polyobj_t* p = map->polyObjs[idx];
Polyobj* p = map->polyObjs[idx];
long obIdx;
HEdge* hedges;
uint i;
Expand Down
14 changes: 7 additions & 7 deletions doomsday/engine/portable/src/edit_map.c
Expand Up @@ -143,9 +143,9 @@ static Sector* createSector(void)
return sec;
}

static polyobj_t* createPolyobj(void)
static Polyobj* createPolyobj(void)
{
polyobj_t* po;
Polyobj* po;

po = M_Calloc(sizeof(*po));

Expand All @@ -164,7 +164,7 @@ static void destroyEditablePolyObjs(editmap_t* map)
uint i;
for(i = 0; i < map->numPolyObjs; ++i)
{
polyobj_t* po = map->polyObjs[i];
Polyobj* po = map->polyObjs[i];
M_Free(po->lines);
M_Free(po);
}
Expand Down Expand Up @@ -1385,11 +1385,11 @@ static void hardenPolyobjs(GameMap* dest, editmap_t* src)
}

dest->numPolyObjs = src->numPolyObjs;
dest->polyObjs = Z_Malloc((dest->numPolyObjs+1) * sizeof(polyobj_t*), PU_MAP, 0);
dest->polyObjs = Z_Malloc((dest->numPolyObjs+1) * sizeof(Polyobj*), PU_MAP, 0);

for(i = 0; i < dest->numPolyObjs; ++i)
{
polyobj_t* destP, *srcP = src->polyObjs[i];
Polyobj* destP, *srcP = src->polyObjs[i];
HEdge* hedges;
uint j;

Expand Down Expand Up @@ -1864,7 +1864,7 @@ boolean MPE_End(void)
// Finish the polyobjs (after the vertexes are hardened).
for(i = 0; i < gamemap->numPolyObjs; ++i)
{
polyobj_t* po = gamemap->polyObjs[i];
Polyobj* po = gamemap->polyObjs[i];
LineDef** lineIter;
uint n = 0;

Expand Down Expand Up @@ -2272,7 +2272,7 @@ uint MPE_SectorCreate(float lightlevel, float red, float green, float blue)
uint MPE_PolyobjCreate(uint* lines, uint lineCount, int tag, int sequenceType,
float anchorX, float anchorY)
{
polyobj_t* po;
Polyobj* po;
uint i;

if(!editMapInited || !lineCount || !lines) return 0;
Expand Down

0 comments on commit 2065382

Please sign in to comment.