Skip to content

Commit

Permalink
Refactor|World|Client: Renamed ContactBlockmap source files
Browse files Browse the repository at this point in the history
These files now contain Contact and ContactList.
  • Loading branch information
danij-deng committed Oct 7, 2013
1 parent 2b51264 commit 7c502c0
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 55 deletions.
6 changes: 3 additions & 3 deletions doomsday/client/client.pro
Expand Up @@ -119,7 +119,7 @@ DENG_CONVENIENCE_HEADERS += \
include/BspNode \
include/CommandAction \
include/ChildWidgetOrganizer \
include/ContactBlockmap \
include/Contact \
include/ContactSpreader \
include/Decoration \
include/DialogContentStylist \
Expand Down Expand Up @@ -466,7 +466,7 @@ DENG_HEADERS += \
include/world/bsp/superblockmap.h \
include/world/bspleaf.h \
include/world/bspnode.h \
include/world/contactblockmap.h \
include/world/contact.h \
include/world/contactspreader.h \
include/world/dmuargs.h \
include/world/entitydatabase.h \
Expand Down Expand Up @@ -806,7 +806,7 @@ SOURCES += \
src/world/bsp/superblockmap.cpp \
src/world/bspleaf.cpp \
src/world/bspnode.cpp \
src/world/contactblockmap.cpp \
src/world/contact.cpp \
src/world/contactspreader.cpp \
src/world/dmuargs.cpp \
src/world/entitydatabase.cpp \
Expand Down
1 change: 1 addition & 0 deletions doomsday/client/include/Contact
@@ -0,0 +1 @@
#include "world/contact.h"
1 change: 0 additions & 1 deletion doomsday/client/include/ContactBlockmap

This file was deleted.

2 changes: 1 addition & 1 deletion doomsday/client/include/de_play.h
Expand Up @@ -40,7 +40,7 @@
#include "world/p_ticker.h"
#include "world/p_players.h"
#ifdef __CLIENT__
# include "ContactBlockmap"
# include "Contact"
#endif
#include "Material"
#include "ui/p_control.h"
Expand Down
@@ -1,4 +1,4 @@
/** @file contactblockmap.h World object => BSP leaf "contact" blockmap.
/** @file contact.h World object => BSP leaf "contact" and contact lists.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
Expand All @@ -18,8 +18,8 @@
*/

#ifdef __CLIENT__
#ifndef DENG_CLIENT_WORLD_CONTACTBLOCKMAP_H
#define DENG_CLIENT_WORLD_CONTACTBLOCKMAP_H
#ifndef DENG_CLIENT_WORLD_CONTACT_H
#define DENG_CLIENT_WORLD_CONTACT_H

#include <de/aabox.h>

Expand Down Expand Up @@ -79,25 +79,25 @@ struct Contact
BspLeaf &objectBspLeafAtOrigin() const;
};

struct ListNode;

struct ContactList
{
struct Node;

// Start reusing list nodes.
static void reset();

void link(Contact *contact);

ListNode *begin() const;
Node *begin() const;

private:
/**
* Create a new list node. If there are none available in the list of
* used objects a new one will be allocated and linked to the global list.
*/
static ListNode *newNode(void *object);
static Node *newNode(void *object);

ListNode *_head;
Node *_head;
};

/**
Expand Down Expand Up @@ -131,7 +131,7 @@ void R_AddContact(struct mobj_s &mobj);
void R_AddContact(Lumobj &lumobj);

/**
* Traverse the list of contacts for the current render frame.
* Traverse the list of @em all contacts for the current render frame.
*/
int R_ContactIterator(int (*callback) (Contact &, void *), void *context = 0);

Expand All @@ -144,15 +144,15 @@ ContactList &R_ContactList(BspLeaf &leaf, ContactType type);
* Traverse the list of mobj contacts linked directly to the specified BSP @a leaf,
* for the current render frame.
*/
int R_IterateBspLeafMobjContacts(BspLeaf &leaf,
int R_BspLeafMobjContactIterator(BspLeaf &leaf,
int (*callback) (struct mobj_s &, void *), void *context = 0);

/**
* Traverse the list of lumobj contacts linked directly to the specified BSP @a leaf,
* for the current render frame.
*/
int R_IterateBspLeafLumobjContacts(BspLeaf &leaf,
int R_BspLeafLumobjContactIterator(BspLeaf &leaf,
int (*callback) (Lumobj &, void *), void *context = 0);

#endif // DENG_CLIENT_WORLD_CONTACTBLOCKMAP_H
#endif // DENG_CLIENT_WORLD_CONTACT_H
#endif // __CLIENT__
2 changes: 1 addition & 1 deletion doomsday/client/src/dd_main.cpp
Expand Up @@ -74,7 +74,7 @@
#include "world/entitydef.h"
#include "world/p_players.h"
#ifdef __CLIENT__
# include "ContactBlockmap"
# include "Contact"
#endif
#include "world/world.h"

Expand Down
6 changes: 3 additions & 3 deletions doomsday/client/src/render/projector.cpp
Expand Up @@ -26,7 +26,7 @@
#include "BspLeaf"
#include "Surface"
#include "world/p_object.h"
#include "ContactBlockmap"
#include "Contact"

#include "render/projector.h"

Expand Down Expand Up @@ -311,7 +311,7 @@ void Rend_ProjectLumobjs(BspLeaf *bspLeaf, Vector3d const &topLeft,
parm.bottomRight = &bottomRight;
parm.tangentMatrix = &tangentMatrix;

R_IterateBspLeafLumobjContacts(*bspLeaf, projectLumobjWorker, &parm);
R_BspLeafLumobjContactIterator(*bspLeaf, projectLumobjWorker, &parm);
}

/**
Expand Down Expand Up @@ -512,7 +512,7 @@ void Rend_ProjectMobjShadows(BspLeaf *bspLeaf, Vector3d const &topLeft,
parm.bottomRight = &bottomRight;
parm.tangentMatrix = &tangentMatrix;

R_IterateBspLeafMobjContacts(*bspLeaf, projectMobjShadowWorker, &parm);
R_BspLeafMobjContactIterator(*bspLeaf, projectMobjShadowWorker, &parm);
}

int Rend_IterateProjectionList(uint listIdx, int (*callback) (TexProjection const *, void *),
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/render/r_main.cpp
Expand Up @@ -45,7 +45,7 @@

#include "world/linesighttest.h"
#include "world/p_players.h"
#include "ContactBlockmap"
#include "Contact"
#include "world/thinkers.h"
#include "BspLeaf"
#include "Surface"
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/src/render/rend_main.cpp
Expand Up @@ -54,7 +54,7 @@
#include "world/generators.h"
#include "world/lineowner.h"
#include "world/p_object.h"
#include "ContactBlockmap"
#include "Contact"
#include "world/p_players.h"
#include "world/thinkers.h"

Expand Down Expand Up @@ -2483,7 +2483,7 @@ static void projectLeafSprites()
if(leaf->lastSpriteProjectFrame() == frameCount)
return; // Already added.

R_IterateBspLeafMobjContacts(*leaf, projectSpriteWorker);
R_BspLeafMobjContactIterator(*leaf, projectSpriteWorker);

leaf->setLastSpriteProjectFrame(frameCount);
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/src/render/vlight.cpp
Expand Up @@ -29,7 +29,7 @@
#include "BspLeaf"
#include "Surface"
#include "world/map.h"
#include "ContactBlockmap"
#include "Contact"

#include "render/vlight.h"

Expand Down Expand Up @@ -255,7 +255,7 @@ static void lightWithLumobjs(Vector3d const &origin, BspLeaf &bspLeaf, uint list
lightwithlumobjs_params_t parms; zap(parms);
parms.origin = origin;
parms.listIdx = listIdx;
R_IterateBspLeafLumobjContacts(bspLeaf, lightWithLumobjsWorker, &parms);
R_BspLeafLumobjContactIterator(bspLeaf, lightWithLumobjsWorker, &parms);
}

/**
Expand Down
@@ -1,4 +1,4 @@
/** @file contactblockmap.cpp World object => BSP leaf "contact" blockmap.
/** @file contact.cpp World object => BSP leaf "contact" and contact lists.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2013 Daniel Swanson <danij@dengine.net>
Expand All @@ -17,26 +17,15 @@
* http://www.gnu.org/licenses</small>
*/

//#include <QBitArray>

#include <de/memoryzone.h>
#include <de/vector1.h>

#include <de/Error>

#include "Face"

#include "world/map.h"
//#include "world/blockmap.h"
#include "world/p_object.h"
#include "BspLeaf"
//#include "Surface"

//#include "render/r_main.h" // validCount
//#include "render/rend_main.h" // Rend_MapSurfaceMaterialSpec
//#include "WallEdge"

#include "world/contactblockmap.h"
#include "world/contact.h"

using namespace de;

Expand Down Expand Up @@ -96,14 +85,14 @@ BspLeaf &Contact::objectBspLeafAtOrigin() const
}
}

struct ListNode
struct ContactList::Node
{
ListNode *next; ///< Next in the BSP leaf.
ListNode *nextUsed; ///< Next used contact.
Node *next; ///< Next in the BSP leaf.
Node *nextUsed; ///< Next used contact.
void *obj;
};
static ListNode *firstNode; ///< First unused list node.
static ListNode *cursor; ///< Current list node.
static ContactList::Node *firstNode; ///< First unused list node.
static ContactList::Node *cursor; ///< Current list node.

void ContactList::reset() // static
{
Expand All @@ -114,25 +103,25 @@ void ContactList::link(Contact *contact)
{
if(!contact) return;

ListNode *node = newNode(contact->objectPtr());
Node *node = newNode(contact->objectPtr());

node->next = _head;
_head = node;
}

ListNode *ContactList::begin() const
ContactList::Node *ContactList::begin() const
{
return _head;
}

ListNode *ContactList::newNode(void *object) // static
ContactList::Node *ContactList::newNode(void *object) // static
{
DENG2_ASSERT(object != 0);

ListNode *node;
Node *node;
if(!cursor)
{
node = (ListNode *) Z_Malloc(sizeof(*node), PU_APPSTATIC, 0);
node = (Node *) Z_Malloc(sizeof(*node), PU_APPSTATIC, 0);

// Link in the global list of used nodes.
node->nextUsed = firstNode;
Expand Down Expand Up @@ -252,23 +241,23 @@ int R_ContactIterator(int (*callback) (Contact &, void *), void *context)
return false; // Continue iteration.
}

int R_IterateBspLeafMobjContacts(BspLeaf &bspLeaf,
int R_BspLeafMobjContactIterator(BspLeaf &bspLeaf,
int (*callback)(mobj_s &, void *), void *context)
{
ContactList &list = R_ContactList(bspLeaf, ContactMobj);
for(ListNode *node = list.begin(); node; node = node->next)
for(ContactList::Node *node = list.begin(); node; node = node->next)
{
if(int result = callback(*static_cast<mobj_t *>(node->obj), context))
return result;
}
return false; // Continue iteration.
}

int R_IterateBspLeafLumobjContacts(BspLeaf &bspLeaf,
int R_BspLeafLumobjContactIterator(BspLeaf &bspLeaf,
int (*callback)(Lumobj &, void *), void *context)
{
ContactList &list = R_ContactList(bspLeaf, ContactLumobj);
for(ListNode *node = list.begin(); node; node = node->next)
for(ContactList::Node *node = list.begin(); node; node = node->next)
{
if(int result = callback(*static_cast<Lumobj *>(node->obj), context))
return result;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/world/contactspreader.cpp
Expand Up @@ -25,7 +25,7 @@
#include "HEdge"

#include "BspLeaf"
#include "ContactBlockmap"
#include "Contact"
#include "Sector"
#include "Surface"

Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/world/map.cpp
Expand Up @@ -52,7 +52,7 @@
#include "world/p_intercept.h"
#include "world/p_object.h"
#ifdef __CLIENT__
# include "ContactBlockmap"
# include "Contact"
# include "ContactSpreader"
#endif
#include "world/thinkers.h"
Expand Down

0 comments on commit 7c502c0

Please sign in to comment.