diff options
author | James Haley | 2013-02-10 18:34:41 +0000 |
---|---|---|
committer | James Haley | 2013-02-10 18:34:41 +0000 |
commit | 1011b3bd314e515e6357df8b5b77d33a2528ae34 (patch) | |
tree | 0599280b008f2b84d6faef2ecda2933676ec5192 /src/strife | |
parent | e20874a9aa4a5d25ae6608536a56d549b82b3dc9 (diff) | |
download | chocolate-doom-1011b3bd314e515e6357df8b5b77d33a2528ae34.tar.gz chocolate-doom-1011b3bd314e515e6357df8b5b77d33a2528ae34.tar.bz2 chocolate-doom-1011b3bd314e515e6357df8b5b77d33a2528ae34.zip |
* Made formatting consistent in T_MovePlane so code could be read
* Fixed an error in the translation of T_MovePlane changes; floors
moving up SHOULD test crush == true before calling P_ChangeSector
again.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2559
Diffstat (limited to 'src/strife')
-rw-r--r-- | src/strife/p_floor.c | 283 |
1 files changed, 143 insertions, 140 deletions
diff --git a/src/strife/p_floor.c b/src/strife/p_floor.c index df966d28..31f2a7cf 100644 --- a/src/strife/p_floor.c +++ b/src/strife/p_floor.c @@ -46,167 +46,170 @@ // // Move a plane (floor or ceiling) and check for crushing // +// [STRIFE] Various changes were made to remove calls to P_ChangeSector when +// P_ChangeSector returns true. +// result_e T_MovePlane -( sector_t* sector, - fixed_t speed, - fixed_t dest, - boolean crush, - int floorOrCeiling, - int direction ) +( sector_t* sector, + fixed_t speed, + fixed_t dest, + boolean crush, + int floorOrCeiling, + int direction ) { - boolean flag; - fixed_t lastpos; - + boolean flag; + fixed_t lastpos; + switch(floorOrCeiling) { - case 0: - // FLOOR - switch(direction) - { - case -1: - // DOWN - if (sector->floorheight - speed < dest) - { + case 0: + // FLOOR + switch(direction) + { + case -1: + // DOWN + if (sector->floorheight - speed < dest) + { // villsa [STRIFE] unused - //lastpos = sector->floorheight; - sector->floorheight = dest; - flag = P_ChangeSector(sector,crush); + //lastpos = sector->floorheight; + sector->floorheight = dest; + flag = P_ChangeSector(sector,crush); // villsa [STRIFE] unused - /*if (flag == true) - { - sector->floorheight =lastpos; - P_ChangeSector(sector,crush); - //return crushed; - }*/ - return pastdest; - } - else - { + /*if (flag == true) + { + sector->floorheight =lastpos; + P_ChangeSector(sector,crush); + //return crushed; + }*/ + return pastdest; + } + else + { // villsa [STRIFE] unused - //lastpos = sector->floorheight; - sector->floorheight -= speed; - flag = P_ChangeSector(sector,crush); + //lastpos = sector->floorheight; + sector->floorheight -= speed; + flag = P_ChangeSector(sector,crush); // villsa [STRIFE] unused - /*if (flag == true) - { - sector->floorheight = lastpos; - P_ChangeSector(sector,crush); - return crushed; - }*/ + /*if (flag == true) + { + sector->floorheight = lastpos; + P_ChangeSector(sector,crush); + return crushed; + }*/ return ok; - } - break; - - case 1: - // UP - if (sector->floorheight + speed > dest) - { - lastpos = sector->floorheight; - sector->floorheight = dest; - flag = P_ChangeSector(sector,crush); - if (flag == true) - { - sector->floorheight = lastpos; - P_ChangeSector(sector,crush); - //return crushed; - } - return pastdest; - } - else - { - // COULD GET CRUSHED - lastpos = sector->floorheight; - sector->floorheight += speed; - flag = P_ChangeSector(sector,crush); - if (flag == true) - { - // villsa [STRIFE] unused - //if (crush == true) - //return crushed; - sector->floorheight = lastpos; - P_ChangeSector(sector,crush); - return crushed; - } + } + break; + + case 1: + // UP + if (sector->floorheight + speed > dest) + { + lastpos = sector->floorheight; + sector->floorheight = dest; + flag = P_ChangeSector(sector,crush); + if (flag == true) + { + sector->floorheight = lastpos; + P_ChangeSector(sector,crush); + //return crushed; + } + return pastdest; + } + else + { + // COULD GET CRUSHED + lastpos = sector->floorheight; + sector->floorheight += speed; + flag = P_ChangeSector(sector,crush); + if (flag == true) + { + // haleyjd 20130210: Bug fix - Strife DOES do this. + if (crush == true) + return crushed; + sector->floorheight = lastpos; + P_ChangeSector(sector,crush); + return crushed; + } else return ok; - } - break; - } - break; - - case 1: - // CEILING - switch(direction) - { - case -1: - // DOWN - if (sector->ceilingheight - speed < dest) - { - lastpos = sector->ceilingheight; - sector->ceilingheight = dest; - flag = P_ChangeSector(sector,crush); - - if (flag == true) - { - sector->ceilingheight = lastpos; - P_ChangeSector(sector,crush); - //return crushed; - } - return pastdest; - } - else - { - // COULD GET CRUSHED - lastpos = sector->ceilingheight; - sector->ceilingheight -= speed; - flag = P_ChangeSector(sector,crush); - - if (flag == true) - { - if (crush == true) - return crushed; - sector->ceilingheight = lastpos; - P_ChangeSector(sector,crush); - return crushed; - } - } - break; - - case 1: - // UP - if (sector->ceilingheight + speed > dest) - { + } + break; + } + break; + + case 1: + // CEILING + switch(direction) + { + case -1: + // DOWN + if (sector->ceilingheight - speed < dest) + { + lastpos = sector->ceilingheight; + sector->ceilingheight = dest; + flag = P_ChangeSector(sector,crush); + + if (flag == true) + { + sector->ceilingheight = lastpos; + P_ChangeSector(sector,crush); + //return crushed; + } + return pastdest; + } + else + { + // COULD GET CRUSHED + lastpos = sector->ceilingheight; + sector->ceilingheight -= speed; + flag = P_ChangeSector(sector,crush); + + if (flag == true) + { + if (crush == true) + return crushed; + sector->ceilingheight = lastpos; + P_ChangeSector(sector,crush); + return crushed; + } + } + break; + + case 1: + // UP + if (sector->ceilingheight + speed > dest) + { // villsa [STRIFE] unused - //lastpos = sector->ceilingheight; - sector->ceilingheight = dest; + //lastpos = sector->ceilingheight; + sector->ceilingheight = dest; // villsa [STRIFE] unused - //flag = P_ChangeSector(sector,crush); - /*if (flag == true) - { - sector->ceilingheight = lastpos; - P_ChangeSector(sector,crush); - //return crushed; - }*/ - return pastdest; - } - else - { + //flag = P_ChangeSector(sector,crush); + /*if (flag == true) + { + sector->ceilingheight = lastpos; + P_ChangeSector(sector,crush); + //return crushed; + }*/ + return pastdest; + } + else + { // villsa [STRIFE] unused - //lastpos = sector->ceilingheight; - sector->ceilingheight += speed; + //lastpos = sector->ceilingheight; + sector->ceilingheight += speed; // villsa [STRIFE] unused - //flag = P_ChangeSector(sector,crush); + //flag = P_ChangeSector(sector,crush); return ok; - } - break; - } - break; - + } + break; + } + break; + } return ok; } |