Fixed Linedef type 57 is broken

Status
Not open for further replies.

Ricardo

Dead Guybrush in netgames
In file p_spec.c, line 5180:
Code:
case 56: // New super cool and awesome moving floor and ceiling crush type
case 57: // New super cool and awesome moving floor crush type
    if (lines[i].backsector)
        EV_DoFloor(&lines[i], bounceFloorCrush);

case 58: // New super cool and awesome moving ceiling crush type
    if (lines[i].backsector)
        EV_DoCeiling(&lines[i], bounceCeilingCrush);
    break;
I think there's a break missing there.

For those who can't read C or don't want to bother, if you try using LD56 or LD57, the end result is the same: both floor and ceiling move, when clearly in type 57 only the floor should.
 
Last edited by a moderator:
Just putting a 'break;' won't fix this, because type #56 relies on both statements executing.
 
Yes, of course, I should have mentioned that, but on the other hand I assumed the person is going to fix this would know that.
 
Code:
case 56: // New super cool and awesome moving floor and ceiling crush type
case 57: // New super cool and awesome moving floor crush type
	if (lines[i].backsector)
		EV_DoFloor(&lines[i], bounceFloorCrush);

[B]	if (lines[i].special == 57)
		break; //only move the floor[/B]
case 58: // New super cool and awesome moving ceiling crush type
	if (lines[i].backsector)
		EV_DoCeiling(&lines[i], bounceCeilingCrush);
	break;

Obviously this is what he meant.
 
Messy switch statement. I'd probably do
Code:
case 56: // New super cool and awesome moving floor and ceiling crush type
	if (lines[i].backsector)
		EV_DoCeiling(&lines[i], bounceCeilingCrush);

case 57: // New super cool and awesome moving floor crush type
	if (lines[i].backsector)
		EV_DoFloor(&lines[i], bounceFloorCrush);
	break;

case 58: // New super cool and awesome moving ceiling crush type
	if (lines[i].backsector)
		EV_DoCeiling(&lines[i], bounceCeilingCrush);

	break;
even if it means repeating some code, because it just looks dumb doing an if (lines.special == 57) when you're inside a switch for that very same variable. If you already checked to see if it was 57, then it's probably still 57!
 
And I find what you're doing even messier, in my hearty opinion. To each their own..
 
I suppose if they both work, it isn't really an issue, is it? Unless you're planning to go back and edit it some more later, in which case it would only be an issue if you can't understand what you put before. And I don't think that would be a problem.
 
...or 56 could just do what it says, instead of falling into another case.
Code:
case 56: // New super cool and awesome moving floor and ceiling crush type
	if (lines[i].backsector)
	{
		EV_DoFloor(&lines[i], bounceFloorCrush);
		EV_DoCeiling(&lines[i], bounceCeilingCrush);
	}
	break;

case 57: // New super cool and awesome moving floor crush type
	if (lines[i].backsector)
		EV_DoFloor(&lines[i], bounceFloorCrush);
	break;

case 58: // New super cool and awesome moving ceiling crush type
	if (lines[i].backsector)
		EV_DoCeiling(&lines[i], bounceCeilingCrush);
	break;
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top