Skip to content

Commit

Permalink
Fixed (All Games): "S1 lower Floor - nearest floor adjacent Sectors". [
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Nov 17, 2009
1 parent 294d4d3 commit 23c1997
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 40 deletions.
8 changes: 4 additions & 4 deletions doomsday/plugins/common/include/p_mapspec.h
Expand Up @@ -44,10 +44,10 @@ iterlist_t *P_GetSectorIterListForTag(int tag, boolean createNewList);

sector_t* P_GetNextSector(linedef_t *line, sector_t *sec);

sector_t* P_FindSectorSurroundingLowestFloor(sector_t *sec, float *val);
sector_t* P_FindSectorSurroundingHighestFloor(sector_t *sec, float *val);
sector_t* P_FindSectorSurroundingLowestCeiling(sector_t *sec, float *val);
sector_t* P_FindSectorSurroundingHighestCeiling(sector_t *sec, float *val);
sector_t* P_FindSectorSurroundingLowestFloor(sector_t *sec, float max, float *val);
sector_t* P_FindSectorSurroundingHighestFloor(sector_t *sec, float min, float *val);
sector_t* P_FindSectorSurroundingLowestCeiling(sector_t *sec, float max, float *val);
sector_t* P_FindSectorSurroundingHighestCeiling(sector_t *sec, float min, float *val);
sector_t* P_FindSectorSurroundingLowestLight(sector_t *sector, float *val);
sector_t* P_FindSectorSurroundingHighestLight(sector_t *sector, float *val);

Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/common/src/p_ceiling.c
Expand Up @@ -347,7 +347,7 @@ static int EV_DoCeiling2(int tag, float basespeed, ceilingtype_e type)
break;

case CT_RAISETOHIGHEST:
P_FindSectorSurroundingHighestCeiling(sec, &ceiling->topHeight);
P_FindSectorSurroundingHighestCeiling(sec, 0, &ceiling->topHeight);
#if __JDOOM64__
ceiling->topHeight -= 8; // jd64
#endif
Expand All @@ -367,7 +367,7 @@ static int EV_DoCeiling2(int tag, float basespeed, ceilingtype_e type)

if(bitmipR > 0)
{
P_FindSectorSurroundingHighestCeiling(sec, &ceiling->topHeight);
P_FindSectorSurroundingHighestCeiling(sec, 0, &ceiling->topHeight);
ceiling->state = CS_UP;
ceiling->speed *= bitmipL;
ceiling->topHeight -= bitmipR;
Expand Down
12 changes: 6 additions & 6 deletions doomsday/plugins/common/src/p_door.c
Expand Up @@ -356,15 +356,15 @@ static int EV_DoDoor2(int tag, float speed, int topwait, doortype_e type)
{
#if __JDOOM__ || __JDOOM64__
case DT_BLAZECLOSE:
P_FindSectorSurroundingLowestCeiling(sec, &door->topHeight);
P_FindSectorSurroundingLowestCeiling(sec, (float) MAXINT, &door->topHeight);
door->topHeight -= 4;
door->state = DS_DOWN;
door->speed *= 4;
sound = SFX_DOORBLAZECLOSE;
break;
#endif
case DT_CLOSE:
P_FindSectorSurroundingLowestCeiling(sec, &door->topHeight);
P_FindSectorSurroundingLowestCeiling(sec, (float) MAXINT, &door->topHeight);
door->topHeight -= 4;
door->state = DS_DOWN;
#if !__JHEXEN__
Expand All @@ -386,7 +386,7 @@ static int EV_DoDoor2(int tag, float speed, int topwait, doortype_e type)
#if !__JHEXEN__
case DT_BLAZEOPEN:
door->state = DS_UP;
P_FindSectorSurroundingLowestCeiling(sec, &door->topHeight);
P_FindSectorSurroundingLowestCeiling(sec, (float) MAXINT, &door->topHeight);
door->topHeight -= 4;
# if __JHERETIC__
door->speed *= 3;
Expand All @@ -401,7 +401,7 @@ static int EV_DoDoor2(int tag, float speed, int topwait, doortype_e type)
case DT_NORMAL:
case DT_OPEN:
door->state = DS_UP;
P_FindSectorSurroundingLowestCeiling(sec, &door->topHeight);
P_FindSectorSurroundingLowestCeiling(sec, (float) MAXINT, &door->topHeight);
door->topHeight -= 4;

#if !__JHEXEN__
Expand Down Expand Up @@ -856,7 +856,7 @@ boolean EV_VerticalDoor(linedef_t* line, mobj_t* mo)
}

// find the top and bottom of the movement range
P_FindSectorSurroundingLowestCeiling(sec, &door->topHeight);
P_FindSectorSurroundingLowestCeiling(sec, (float) MAXINT, &door->topHeight);
door->topHeight -= 4;
return true;
}
Expand Down Expand Up @@ -895,7 +895,7 @@ void P_SpawnDoorRaiseIn5Mins(sector_t *sec)
door->state = DS_INITIALWAIT;
door->type = DT_RAISEIN5MINS;
door->speed = DOORSPEED;
P_FindSectorSurroundingLowestCeiling(sec, &door->topHeight);
P_FindSectorSurroundingLowestCeiling(sec, (float) MAXINT, &door->topHeight);
door->topHeight -= 4;
door->topWait = DOORWAIT;
door->topCountDown = 5 * 60 * TICSPERSEC;
Expand Down
18 changes: 10 additions & 8 deletions doomsday/plugins/common/src/p_floor.c
Expand Up @@ -636,7 +636,7 @@ int EV_DoFloor(linedef_t *line, floortype_e floortype)
floor->speed *= 4;
# endif
#endif
P_FindSectorSurroundingHighestFloor(sec, &floor->floorDestHeight);
P_FindSectorSurroundingHighestFloor(sec, -500, &floor->floorDestHeight);
break;

case FT_LOWERTOLOWEST:
Expand All @@ -648,7 +648,8 @@ int EV_DoFloor(linedef_t *line, floortype_e floortype)
floor->speed *= 4;
# endif
#endif
P_FindSectorSurroundingLowestFloor(sec, &floor->floorDestHeight);
P_FindSectorSurroundingLowestFloor(sec,
P_GetFloatp(sec, DMU_FLOOR_HEIGHT), &floor->floorDestHeight);
break;
#if __JHEXEN__
case FT_LOWERBYVALUE:
Expand All @@ -671,7 +672,7 @@ int EV_DoFloor(linedef_t *line, floortype_e floortype)
floor->state = FS_DOWN;
floor->sector = sec;
floor->speed = FLOORSPEED * 4;
P_FindSectorSurroundingHighestFloor(sec, &floor->floorDestHeight);
P_FindSectorSurroundingHighestFloor(sec, -500, &floor->floorDestHeight);
# if __JHERETIC__
floor->floorDestHeight += 8;
# else
Expand All @@ -686,7 +687,7 @@ int EV_DoFloor(linedef_t *line, floortype_e floortype)
floor->state = FS_DOWN;
floor->sector = sec;
floor->speed = FLOORSPEED;
P_FindSectorSurroundingHighestFloor(sec, &floor->floorDestHeight);
P_FindSectorSurroundingHighestFloor(sec, -500, &floor->floorDestHeight);
if(floor->floorDestHeight != P_GetFloatp(sec,
DMU_FLOOR_HEIGHT))
floor->floorDestHeight += 8;
Expand All @@ -698,7 +699,7 @@ int EV_DoFloor(linedef_t *line, floortype_e floortype)
floor->state = FS_DOWN;
floor->sector = sec;
floor->speed = FLOORSPEED * bitmipL;
P_FindSectorSurroundingHighestFloor(sec, &floor->floorDestHeight);
P_FindSectorSurroundingHighestFloor(sec, -500, &floor->floorDestHeight);

if(floor->floorDestHeight != P_GetFloatp(sec,
DMU_FLOOR_HEIGHT))
Expand Down Expand Up @@ -742,7 +743,7 @@ int EV_DoFloor(linedef_t *line, floortype_e floortype)
#if __JHEXEN__
floor->floorDestHeight = P_GetFloatp(sec, DMU_CEILING_HEIGHT)-8;
#else
P_FindSectorSurroundingLowestCeiling(sec, &floor->floorDestHeight);
P_FindSectorSurroundingLowestCeiling(sec, (float) MAXINT, &floor->floorDestHeight);

if(floor->floorDestHeight > P_GetFloatp(sec, DMU_CEILING_HEIGHT))
floor->floorDestHeight = P_GetFloatp(sec, DMU_CEILING_HEIGHT);
Expand All @@ -760,7 +761,7 @@ int EV_DoFloor(linedef_t *line, floortype_e floortype)
floor->speed *= 4;
# endif
#endif
P_FindSectorSurroundingLowestCeiling(sec, &floor->floorDestHeight);
P_FindSectorSurroundingLowestCeiling(sec, (float) MAXINT, &floor->floorDestHeight);

if(floor->floorDestHeight > P_GetFloatp(sec, DMU_CEILING_HEIGHT))
floor->floorDestHeight = P_GetFloatp(sec, DMU_CEILING_HEIGHT);
Expand Down Expand Up @@ -909,7 +910,8 @@ int EV_DoFloor(linedef_t *line, floortype_e floortype)
floor->state = FS_DOWN;
floor->sector = sec;
floor->speed = FLOORSPEED;
P_FindSectorSurroundingLowestFloor(sec, &floor->floorDestHeight);
P_FindSectorSurroundingLowestFloor(sec,
P_GetFloatp(sec, DMU_FLOOR_HEIGHT), &floor->floorDestHeight);
floor->material = P_GetPtrp(sec, DMU_FLOOR_MATERIAL);

{
Expand Down
16 changes: 8 additions & 8 deletions doomsday/plugins/common/src/p_mapspec.c
Expand Up @@ -423,13 +423,13 @@ int findExtremalPlaneHeight(void *ptr, void *context)
/**
* Find the sector with the lowest floor height in surrounding sectors.
*/
sector_t* P_FindSectorSurroundingLowestFloor(sector_t* sec, float* val)
sector_t* P_FindSectorSurroundingLowestFloor(sector_t* sec, float max, float* val)
{
findextremalplaneheightparams_t params;

params.baseSec = sec;
params.flags = FEPHF_MIN | FEPHF_FLOOR;
params.val = DDMAXFLOAT;
params.val = max;
params.foundSec = NULL;
P_Iteratep(sec, DMU_LINEDEF, &params, findExtremalPlaneHeight);

Expand All @@ -441,13 +441,13 @@ sector_t* P_FindSectorSurroundingLowestFloor(sector_t* sec, float* val)
/**
* Find the sector with the highest floor height in surrounding sectors.
*/
sector_t* P_FindSectorSurroundingHighestFloor(sector_t* sec, float* val)
sector_t* P_FindSectorSurroundingHighestFloor(sector_t* sec, float min, float* val)
{
findextremalplaneheightparams_t params;

params.baseSec = sec;
params.flags = FEPHF_FLOOR;
params.val = DDMINFLOAT;
params.val = min;
params.foundSec = NULL;
P_Iteratep(sec, DMU_LINEDEF, &params, findExtremalPlaneHeight);

Expand All @@ -459,13 +459,13 @@ sector_t* P_FindSectorSurroundingHighestFloor(sector_t* sec, float* val)
/**
* Find lowest ceiling in the surrounding sector.
*/
sector_t* P_FindSectorSurroundingLowestCeiling(sector_t *sec, float *val)
sector_t* P_FindSectorSurroundingLowestCeiling(sector_t *sec, float max, float *val)
{
findextremalplaneheightparams_t params;

params.baseSec = sec;
params.flags = FEPHF_MIN;
params.val = DDMAXFLOAT;
params.val = max;
params.foundSec = NULL;
P_Iteratep(sec, DMU_LINEDEF, &params, findExtremalPlaneHeight);

Expand All @@ -477,13 +477,13 @@ sector_t* P_FindSectorSurroundingLowestCeiling(sector_t *sec, float *val)
/**
* Find highest ceiling in the surrounding sectors.
*/
sector_t* P_FindSectorSurroundingHighestCeiling(sector_t *sec, float *val)
sector_t* P_FindSectorSurroundingHighestCeiling(sector_t *sec, float min, float *val)
{
findextremalplaneheightparams_t params;

params.baseSec = sec;
params.flags = 0;
params.val = DDMINFLOAT;
params.val = min;
params.foundSec = NULL;
P_Iteratep(sec, DMU_LINEDEF, &params, findExtremalPlaneHeight);

Expand Down
16 changes: 10 additions & 6 deletions doomsday/plugins/common/src/p_plat.c
Expand Up @@ -322,7 +322,8 @@ static int doPlat(linedef_t *line, int tag, plattype_e type, int amount)
break;
#endif
case PT_DOWNWAITUPSTAY:
P_FindSectorSurroundingLowestFloor(sec, &plat->low);
P_FindSectorSurroundingLowestFloor(sec,
P_GetFloatp(sec, DMU_FLOOR_HEIGHT), &plat->low);
#if __JHEXEN__
plat->low += 8;
#else
Expand All @@ -345,7 +346,7 @@ static int doPlat(linedef_t *line, int tag, plattype_e type, int amount)

#if __JDOOM64__ || __JHEXEN__
case PT_UPWAITDOWNSTAY:
P_FindSectorSurroundingHighestFloor(sec, &plat->high);
P_FindSectorSurroundingHighestFloor(sec, -500, &plat->high);

if(plat->high < floorHeight)
plat->high = floorHeight;
Expand All @@ -366,7 +367,8 @@ static int doPlat(linedef_t *line, int tag, plattype_e type, int amount)
#if __JDOOM64__
case PT_DOWNWAITUPDOOR: // jd64
plat->speed = PLATSPEED * 8;
P_FindSectorSurroundingLowestFloor(sec, &plat->low);
P_FindSectorSurroundingLowestFloor(sec,
P_GetFloatp(sec, DMU_FLOOR_HEIGHT), &plat->low);

if(plat->low > floorHeight)
plat->low = floorHeight;
Expand Down Expand Up @@ -400,7 +402,8 @@ static int doPlat(linedef_t *line, int tag, plattype_e type, int amount)
#if __JDOOM__ || __JDOOM64__
case PT_DOWNWAITUPSTAYBLAZE:
plat->speed = PLATSPEED * 8;
P_FindSectorSurroundingLowestFloor(sec, &plat->low);
P_FindSectorSurroundingLowestFloor(sec,
P_GetFloatp(sec, DMU_FLOOR_HEIGHT), &plat->low);

if(plat->low > floorHeight)
plat->low = floorHeight;
Expand All @@ -412,7 +415,8 @@ static int doPlat(linedef_t *line, int tag, plattype_e type, int amount)
break;
#endif
case PT_PERPETUALRAISE:
P_FindSectorSurroundingLowestFloor(sec, &plat->low);
P_FindSectorSurroundingLowestFloor(sec,
P_GetFloatp(sec, DMU_FLOOR_HEIGHT), &plat->low);
#if __JHEXEN__
plat->low += 8;
#else
Expand All @@ -421,7 +425,7 @@ static int doPlat(linedef_t *line, int tag, plattype_e type, int amount)
if(plat->low > floorHeight)
plat->low = floorHeight;

P_FindSectorSurroundingHighestFloor(sec, &plat->high);
P_FindSectorSurroundingHighestFloor(sec, -500, &plat->high);

if(plat->high < floorHeight)
plat->high = floorHeight;
Expand Down
8 changes: 4 additions & 4 deletions doomsday/plugins/common/src/p_xgsec.c
Expand Up @@ -1279,28 +1279,28 @@ boolean XS_GetPlane(linedef_t* actline, sector_t* sector, int ref,
if(ref == SPREF_HIGHEST_CEILING)
{
otherSec =
P_FindSectorSurroundingHighestCeiling(sector, &otherHeight);
P_FindSectorSurroundingHighestCeiling(sector, DDMINFLOAT, &otherHeight);
if(otherSec)
otherMat = P_GetPtrp(otherSec, DMU_CEILING_MATERIAL);
}
else if(ref == SPREF_HIGHEST_FLOOR)
{
otherSec =
P_FindSectorSurroundingHighestFloor(sector, &otherHeight);
P_FindSectorSurroundingHighestFloor(sector, DDMINFLOAT, &otherHeight);
if(otherSec)
otherMat = P_GetPtrp(otherSec, DMU_CEILING_MATERIAL);
}
else if(ref == SPREF_LOWEST_CEILING)
{
otherSec =
P_FindSectorSurroundingLowestCeiling(sector, &otherHeight);
P_FindSectorSurroundingLowestCeiling(sector, DDMAXFLOAT, &otherHeight);
if(otherSec)
otherMat = P_GetPtrp(otherSec, DMU_CEILING_MATERIAL);
}
else if(ref == SPREF_LOWEST_FLOOR)
{
otherSec =
P_FindSectorSurroundingLowestFloor(sector, &otherHeight);
P_FindSectorSurroundingLowestFloor(sector, DDMAXFLOAT, &otherHeight);
if(otherSec)
otherMat = P_GetPtrp(otherSec, DMU_FLOOR_MATERIAL);
}
Expand Down
31 changes: 31 additions & 0 deletions doomsday/plugins/jhexen/include/h2def.h
Expand Up @@ -46,6 +46,37 @@
#include "version.h"
#include "info.h"

// Predefined with some OS.
#ifdef UNIX

#include <limits.h>

#define MAXCHAR SCHAR_MAX
#define MAXSHORT SHRT_MAX
#define MAXINT INT_MAX
#define MAXLONG LONG_MAX

#define MINCHAR SCHAR_MIN
#define MINSHORT SHRT_MIN
#define MININT INT_MIN
#define MINLONG LONG_MIN

#else /* not UNIX */

#define MAXCHAR ((char)0x7f)
#define MAXSHORT ((short)0x7fff)

// Max pos 32-bit int.
#define MAXINT ((int)0x7fffffff)
#define MAXLONG ((long)0x7fffffff)
#define MINCHAR ((char)0x80)
#define MINSHORT ((short)0x8000)

// Max negative 32-bit integer.
#define MININT ((int)0x80000000)
#define MINLONG ((long)0x80000000)
#endif

#define Set DD_SetInteger
#define Get DD_GetInteger

Expand Down
5 changes: 3 additions & 2 deletions doomsday/plugins/jhexen/src/p_pillar.c
Expand Up @@ -179,7 +179,8 @@ int EV_OpenPillar(linedef_t *line, byte *args)
pillar->sector = sec;
if(!args[2])
{
P_FindSectorSurroundingLowestFloor(sec, &pillar->floorDest);
P_FindSectorSurroundingLowestFloor(sec,
P_GetFloatp(sec, DMU_FLOOR_HEIGHT), &pillar->floorDest);
}
else
{
Expand All @@ -189,7 +190,7 @@ int EV_OpenPillar(linedef_t *line, byte *args)

if(!args[3])
{
P_FindSectorSurroundingHighestCeiling(sec, &pillar->ceilingDest);
P_FindSectorSurroundingHighestCeiling(sec, 0, &pillar->ceilingDest);
}
else
{
Expand Down

0 comments on commit 23c1997

Please sign in to comment.