make this more readable

This commit is contained in:
Alug committed 2024-10-02 20:32:26 +02:00
1 parent 8f8ec6ef5d
commit ae99bcfca2
1 file changed
+38 -34
+38 -34
View File
@@ -592,7 +592,8 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t
{
I_Assert(mobj != NULL);
I_Assert(sector != NULL);
if (sector->f_slope) {
if (sector->f_slope)
{
fixed_t testx, testy;
pslope_t *slope = sector->f_slope;
@@ -607,7 +608,8 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t
else
testy = -mobj->radius;
if ((slope->zdelta > 0) ^ !!(lowest)) {
if ((slope->zdelta > 0) ^ !!(lowest))
{
testx = -testx;
testy = -testy;
}
@@ -620,22 +622,21 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t
return P_GetZAt(slope, testx, testy);
// If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point
if (perfect) {
if (perfect)
{
size_t i;
line_t *ld;
fixed_t bbox[4];
fixed_t finalheight;
if (lowest)
finalheight = INT32_MAX;
else
finalheight = INT32_MIN;
finalheight = lowest ? INT32_MAX : INT32_MIN;
bbox[BOXLEFT] = x-mobj->radius;
bbox[BOXRIGHT] = x+mobj->radius;
bbox[BOXTOP] = y+mobj->radius;
bbox[BOXBOTTOM] = y-mobj->radius;
for (i = 0; i < boundsec->linecount; i++) {
for (i = 0; i < boundsec->linecount; i++)
{
ld = boundsec->lines[i];
if (bbox[BOXRIGHT] <= ld->bbox[BOXLEFT] || bbox[BOXLEFT] >= ld->bbox[BOXRIGHT]
@@ -668,7 +669,8 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed
{
I_Assert(mobj != NULL);
I_Assert(sector != NULL);
if (sector->c_slope) {
if (sector->c_slope)
{
fixed_t testx, testy;
pslope_t *slope = sector->c_slope;
@@ -683,7 +685,8 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed
else
testy = -mobj->radius;
if ((slope->zdelta > 0) ^ !!(lowest)) {
if ((slope->zdelta > 0) ^ !!(lowest))
{
testx = -testx;
testy = -testy;
}
@@ -696,22 +699,21 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed
return P_GetZAt(slope, testx, testy);
// If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point
if (perfect) {
if (perfect)
{
size_t i;
line_t *ld;
fixed_t bbox[4];
fixed_t finalheight;
if (lowest)
finalheight = INT32_MAX;
else
finalheight = INT32_MIN;
finalheight = lowest ? INT32_MAX : INT32_MIN;
bbox[BOXLEFT] = x-mobj->radius;
bbox[BOXRIGHT] = x+mobj->radius;
bbox[BOXTOP] = y+mobj->radius;
bbox[BOXBOTTOM] = y-mobj->radius;
for (i = 0; i < boundsec->linecount; i++) {
for (i = 0; i < boundsec->linecount; i++)
{
ld = boundsec->lines[i];
if (bbox[BOXRIGHT] <= ld->bbox[BOXLEFT] || bbox[BOXLEFT] >= ld->bbox[BOXRIGHT]
@@ -746,7 +748,8 @@ fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fix
I_Assert(mobj != NULL);
I_Assert(sector != NULL);
if (sector->f_slope) {
if (sector->f_slope)
{
fixed_t testx, testy;
pslope_t *slope = sector->f_slope;
@@ -761,7 +764,8 @@ fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fix
else
testy = -mobj->radius;
if ((slope->zdelta > 0) ^ !!(lowest)) {
if ((slope->zdelta > 0) ^ !!(lowest))
{
testx = -testx;
testy = -testy;
}
@@ -774,22 +778,21 @@ fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fix
return P_GetZAt(slope, testx, testy);
// If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point
if (perfect) {
if (perfect)
{
size_t i;
line_t *ld;
fixed_t bbox[4];
fixed_t finalheight;
if (lowest)
finalheight = INT32_MAX;
else
finalheight = INT32_MIN;
finalheight = lowest ? INT32_MAX : INT32_MIN;
bbox[BOXLEFT] = x-mobj->radius;
bbox[BOXRIGHT] = x+mobj->radius;
bbox[BOXTOP] = y+mobj->radius;
bbox[BOXBOTTOM] = y-mobj->radius;
for (i = 0; i < boundsec->linecount; i++) {
for (i = 0; i < boundsec->linecount; i++)
{
ld = boundsec->lines[i];
if (bbox[BOXRIGHT] <= ld->bbox[BOXLEFT] || bbox[BOXLEFT] >= ld->bbox[BOXRIGHT]
@@ -823,7 +826,8 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f
I_Assert(mobj != NULL);
I_Assert(sector != NULL);
if (sector->c_slope) {
if (sector->c_slope)
{
fixed_t testx, testy;
pslope_t *slope = sector->c_slope;
@@ -838,7 +842,8 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f
else
testy = -mobj->radius;
if ((slope->zdelta > 0) ^ !!(lowest)) {
if ((slope->zdelta > 0) ^ !!(lowest))
{
testx = -testx;
testy = -testy;
}
@@ -851,22 +856,21 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f
return P_GetZAt(slope, testx, testy);
// If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point
if (perfect) {
if (perfect)
{
size_t i;
line_t *ld;
fixed_t bbox[4];
fixed_t finalheight;
if (lowest)
finalheight = INT32_MAX;
else
finalheight = INT32_MIN;
finalheight = lowest ? INT32_MAX : INT32_MIN;
bbox[BOXLEFT] = x-mobj->radius;
bbox[BOXRIGHT] = x+mobj->radius;
bbox[BOXTOP] = y+mobj->radius;
bbox[BOXBOTTOM] = y-mobj->radius;
for (i = 0; i < boundsec->linecount; i++) {
for (i = 0; i < boundsec->linecount; i++)
{
ld = boundsec->lines[i];
if (bbox[BOXRIGHT] <= ld->bbox[BOXLEFT] || bbox[BOXLEFT] >= ld->bbox[BOXRIGHT]
@@ -6007,7 +6011,7 @@ void P_RollPitchMobj(mobj_t* mobj)
if (cv_sloperolldist.value > 0)
usedist = true;
if ((cv_spriteroll.value) && (cv_sloperoll.value == 2))
if (cv_spriteroll.value && cv_sloperoll.value == 2)
{
K_RollMobjBySlopes(mobj, usedist);
}
@@ -6233,7 +6237,7 @@ void P_MobjThinker(mobj_t *mobj)
return;
}
if (mobj->state == &states[S_SHADOW] && cv_sloperoll.value == 2)
if (cv_sloperoll.value == 2 && mobj->state == &states[S_SHADOW])
{
mobj->slopepitch = mobj->target->slopepitch;
mobj->sloperoll = mobj->target->sloperoll;