Skip to content

Commit

Permalink
Fix enemy/plat bounds not being drawn if any side touches a screen edge
Browse files Browse the repository at this point in the history
Enemy/platform bounds are intended to not be drawn if they cover the
whole screen, since that's what their default bounds are.

However, the code inadvertently made it so if ANY of the bounds touched
a screen edge, the bounds wouldn't be drawn. This is because the
conditionals used "and"s instead of "or"s. The proper way to write the
positive conditional is "x1 is 0 and y1 is 0 and x2 is 320 and y2 is
240", and when you invert that conditional, you need to also invert all
"and"s to be "or"s. This is not the first time that the game developers
failed to properly negate conjunctional statements...
  • Loading branch information
InfoTeddy committed Aug 28, 2021
1 parent fe1c8d3 commit fea2010
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions desktop_version/src/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3076,17 +3076,17 @@ void editorrender(void)
else
{
//Draw boundaries
if(room->enemyx1!=0 && room->enemyy1!=0
&& room->enemyx2!=320 && room->enemyy2!=240)
if(room->enemyx1!=0 || room->enemyy1!=0
|| room->enemyx2!=320 || room->enemyy2!=240)
{
fillboxabs( room->enemyx1, room->enemyy1,
room->enemyx2-room->enemyx1,
room->enemyy2-room->enemyy1,
graphics.getBGR(255-(help.glow/2),64,64));
}

if(room->platx1!=0 && room->platy1!=0
&& room->platx2!=320 && room->platy2!=240)
if(room->platx1!=0 || room->platy1!=0
|| room->platx2!=320 || room->platy2!=240)
{
fillboxabs( room->platx1, room->platy1,
room->platx2-room->platx1,
Expand Down

0 comments on commit fea2010

Please sign in to comment.