Skip to content

Commit

Permalink
Fixed missing function P_GetXSectorOfSubsector in jDoom.
Browse files Browse the repository at this point in the history
  • Loading branch information
danij committed Nov 23, 2007
1 parent 5dc7772 commit 00a3f01
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
37 changes: 19 additions & 18 deletions doomsday/plugins/common/src/p_mapsetup.c
Expand Up @@ -24,6 +24,7 @@

/**
* p_setup.c: Common map setup routines.
*
* Management of extended map data objects (eg xlines) is done here
*/

Expand Down Expand Up @@ -129,6 +130,24 @@ xsector_t* P_ToXSector(sector_t *sector)
}
}

/**
* Given a subsector - find its parent xsector.
*/
xsector_t* P_ToXSectorOfSubsector(subsector_t *sub)
{
sector_t* sec = P_GetPtrp(sub, DMU_SECTOR);

// Is it a dummy?
if(P_IsDummy(sec))
{
return P_DummyExtraData(sec);
}
else
{
return &xsectors[P_ToIndex(sec)];
}
}

/**
* Given the index of an xline, return it.
*
Expand Down Expand Up @@ -163,24 +182,6 @@ xsector_t* P_GetXSector(uint index)
return &xsectors[index];
}

/**
* Given a subsector - find its parent xsector.
*/
xsector_t* P_ToXSectorOfSubsector(subsector_t *sub)
{
sector_t* sec = P_GetPtrp(sub, DMU_SECTOR);

// Is it a dummy?
if(P_IsDummy(sec))
{
return P_DummyExtraData(sec);
}
else
{
return &xsectors[P_ToIndex(sec)];
}
}

/**
* Doomsday calls this (before any data is read) for each type of map object
* at the start of the level load process. This is to allow us (the game) to do
Expand Down
4 changes: 3 additions & 1 deletion doomsday/plugins/jdoom/include/r_defs.h
Expand Up @@ -4,6 +4,7 @@
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2007 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2005-2007 Daniel Swanson <danij@dengine.net>
*
* 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
Expand Down Expand Up @@ -89,7 +90,8 @@ typedef struct xline_s {

xline_t* P_ToXLine(line_t* line);
xsector_t* P_ToXSector(sector_t* sector);
xsector_t* P_ToXSectorOfSubsector(subsector_t* sub);

xline_t* P_GetXLine(uint idx);
xsector_t* P_GetXSector(uint idx);
xsector_t* P_GetXSectorOfSubsector(subsector_t* sub);
#endif
2 changes: 1 addition & 1 deletion doomsday/plugins/jdoom/src/p_inter.c
Expand Up @@ -924,7 +924,7 @@ void P_DamageMobj2(mobj_t *target, mobj_t *inflictor, mobj_t *source,
}

// End of game hell hack
if(P_GetXSectorOfSubsector(target->subsector)->special == 11 &&
if(P_ToXSectorOfSubsector(target->subsector)->special == 11 &&
damage >= target->health)
{
damage = target->health - 1;
Expand Down

0 comments on commit 00a3f01

Please sign in to comment.