Skip to content

Commit

Permalink
API: Use LineDef (and not Seg) with P_SetPolyobjCallback()
Browse files Browse the repository at this point in the history
The original game would use the seg angles for the purpose of testing
collisions with mobjs. This rather defied the design of the idtech 1
engine which otherwise used linedefs everywhere else for this purpose.
This exposing of a polyobj's segs to the playsim is unnecessary.

Polyobjs now use linedef angles for collision purposes.
  • Loading branch information
danij-deng committed Feb 25, 2012
1 parent 5011857 commit 97dc854
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
19 changes: 10 additions & 9 deletions doomsday/engine/api/doomsday.h
Expand Up @@ -516,15 +516,16 @@ void P_SpawnDamageParticleGen(struct mobj_s* mo, struct mobj_s* infli
*/
///@{

// Play: Polyobjs.
boolean P_PolyobjMoveXY(struct polyobj_s* po, float x, float y);
boolean P_PolyobjRotate(struct polyobj_s* po, angle_t angle);
void P_PolyobjLink(struct polyobj_s* po);
void P_PolyobjUnLink(struct polyobj_s* po);

struct polyobj_s* P_PolyobjByID(uint id);
struct polyobj_s* P_PolyobjByTag(int tag);
void P_SetPolyobjCallback(void (*func)(struct mobj_s*, void*, void*));
// Play: Polyobjs.
boolean P_PolyobjMoveXY(struct polyobj_s* po, float x, float y);
boolean P_PolyobjRotate(struct polyobj_s* po, angle_t angle);
void P_PolyobjLink(struct polyobj_s* po);
void P_PolyobjUnLink(struct polyobj_s* po);

struct polyobj_s* P_PolyobjByID(uint id);
struct polyobj_s* P_PolyobjByTag(int tag);
void P_SetPolyobjCallback(void (*func)(struct mobj_s*, void*, void*));

///@}

/// @addtogroup material
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/p_polyob.c
Expand Up @@ -31,7 +31,7 @@ static void rotatePoint(int an, float* x, float* y, float startSpotX, float star
static boolean checkMobjBlocking(seg_t* seg, polyobj_t* po);

// Called when the polyobj hits a mobj.
static void (*po_callback) (mobj_t* mobj, void* seg, void* po);
static void (*po_callback) (mobj_t* mobj, void* lineDef, void* polyobj);

polyobj_t** polyObjs; // List of all poly-objects in the map.
uint numPolyObjs;
Expand Down Expand Up @@ -473,7 +473,7 @@ int PTR_checkMobjBlocking(mobj_t* mo, void* data)
if(P_BoxOnLineSide(&moBox, params->lineDef) == -1)
{
if(po_callback)
po_callback(mo, params->seg, params->polyobj);
po_callback(mo, params->lineDef, params->polyobj);

params->blocked = true;
}
Expand Down

0 comments on commit 97dc854

Please sign in to comment.