mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-08 18:09:45 +01:00
Remove checks to prevent having both warp lines/BGs in editor
It's perfectly acceptable to have both warp lines and a warping background in the same room. Many levels do this exact thing, I would say at least 30 or so levels, many of them popular and played by many, and this has never caused any issues at all. All that having both warp lines and warp BG does is make it so the warping of the warping background gets overriden by the warp lines, but make it so the background is still a warp background. So in effect, you can have a warp background without any warping. This is perfectly defined behavior. Except, for whatever reason, it's unintentional, and the editor tries to prevent you from doing it. Key word being "tries". The code to prevent having both warp types is bugged (at least when you change the warp BG. The check when you place warp lines seems to be solid). It compares the p1 and p2 attributes of warp lines to the x-coordinate and y-coordinate of the room, despite p1 and p2 having nothing to do with room coordinates. p1 is the type of the warp line and should be treated as an enum, and p2 is the offset of the warp line from the top/left of the screen. This results in this check sometimes working if you're unlucky, but never actually working properly most of the time. This means people can first place warp lines, and then change the warp background later, to have both warp lines and a warp background. Having these checks just further complicates the code, makes it more error-prone, and just inconveniences people when they want to do something that's perfectly fine to do. So it's best if we just remove these checks.
This commit is contained in:
parent
6658a46b2e
commit
d677ba3837
1 changed files with 35 additions and 64 deletions
|
@ -4572,51 +4572,30 @@ void editorinput()
|
|||
|
||||
if(key.keymap[SDLK_w])
|
||||
{
|
||||
int j=0, tx=0, ty=0;
|
||||
for(size_t i=0; i<edentity.size(); i++)
|
||||
ed.level[ed.levx+(ed.levy*ed.maxwidth)].warpdir=(ed.level[ed.levx+(ed.levy*ed.maxwidth)].warpdir+1)%4;
|
||||
if(ed.level[ed.levx+(ed.levy*ed.maxwidth)].warpdir==0)
|
||||
{
|
||||
if(edentity[i].t==50)
|
||||
{
|
||||
tx=(edentity[i].p1-(edentity[i].p1%40))/40;
|
||||
ty=(edentity[i].p2-(edentity[i].p2%30))/30;
|
||||
if(tx==ed.levx && ty==ed.levy)
|
||||
{
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(j>0)
|
||||
{
|
||||
ed.note="ERROR: Cannot have both warp types";
|
||||
ed.note="Room warping disabled";
|
||||
ed.notedelay=45;
|
||||
graphics.backgrounddrawn=false;
|
||||
}
|
||||
else
|
||||
else if(ed.level[ed.levx+(ed.levy*ed.maxwidth)].warpdir==1)
|
||||
{
|
||||
ed.level[ed.levx+(ed.levy*ed.maxwidth)].warpdir=(ed.level[ed.levx+(ed.levy*ed.maxwidth)].warpdir+1)%4;
|
||||
if(ed.level[ed.levx+(ed.levy*ed.maxwidth)].warpdir==0)
|
||||
{
|
||||
ed.note="Room warping disabled";
|
||||
ed.notedelay=45;
|
||||
graphics.backgrounddrawn=false;
|
||||
}
|
||||
else if(ed.level[ed.levx+(ed.levy*ed.maxwidth)].warpdir==1)
|
||||
{
|
||||
ed.note="Room warps horizontally";
|
||||
ed.notedelay=45;
|
||||
graphics.backgrounddrawn=false;
|
||||
}
|
||||
else if(ed.level[ed.levx+(ed.levy*ed.maxwidth)].warpdir==2)
|
||||
{
|
||||
ed.note="Room warps vertically";
|
||||
ed.notedelay=45;
|
||||
graphics.backgrounddrawn=false;
|
||||
}
|
||||
else if(ed.level[ed.levx+(ed.levy*ed.maxwidth)].warpdir==3)
|
||||
{
|
||||
ed.note="Room warps in all directions";
|
||||
ed.notedelay=45;
|
||||
graphics.backgrounddrawn=false;
|
||||
}
|
||||
ed.note="Room warps horizontally";
|
||||
ed.notedelay=45;
|
||||
graphics.backgrounddrawn=false;
|
||||
}
|
||||
else if(ed.level[ed.levx+(ed.levy*ed.maxwidth)].warpdir==2)
|
||||
{
|
||||
ed.note="Room warps vertically";
|
||||
ed.notedelay=45;
|
||||
graphics.backgrounddrawn=false;
|
||||
}
|
||||
else if(ed.level[ed.levx+(ed.levy*ed.maxwidth)].warpdir==3)
|
||||
{
|
||||
ed.note="Room warps in all directions";
|
||||
ed.notedelay=45;
|
||||
graphics.backgrounddrawn=false;
|
||||
}
|
||||
ed.keydelay=6;
|
||||
}
|
||||
|
@ -5198,33 +5177,25 @@ void editorinput()
|
|||
else if(ed.drawmode==14)
|
||||
{
|
||||
//Warp lines
|
||||
if(ed.level[ed.levx+(ed.maxwidth*ed.levy)].warpdir==0)
|
||||
if(ed.tilex==0)
|
||||
{
|
||||
if(ed.tilex==0)
|
||||
{
|
||||
addedentity(ed.tilex+ (ed.levx*40),ed.tiley+ (ed.levy*30),50,0);
|
||||
}
|
||||
else if(ed.tilex==39)
|
||||
{
|
||||
addedentity(ed.tilex+ (ed.levx*40),ed.tiley+ (ed.levy*30),50,1);
|
||||
}
|
||||
else if(ed.tiley==0)
|
||||
{
|
||||
addedentity(ed.tilex+ (ed.levx*40),ed.tiley+ (ed.levy*30),50,2);
|
||||
}
|
||||
else if(ed.tiley==29)
|
||||
{
|
||||
addedentity(ed.tilex+ (ed.levx*40),ed.tiley+ (ed.levy*30),50,3);
|
||||
}
|
||||
else
|
||||
{
|
||||
ed.note="ERROR: Warp lines must be on edges";
|
||||
ed.notedelay=45;
|
||||
}
|
||||
addedentity(ed.tilex+ (ed.levx*40),ed.tiley+ (ed.levy*30),50,0);
|
||||
}
|
||||
else if(ed.tilex==39)
|
||||
{
|
||||
addedentity(ed.tilex+ (ed.levx*40),ed.tiley+ (ed.levy*30),50,1);
|
||||
}
|
||||
else if(ed.tiley==0)
|
||||
{
|
||||
addedentity(ed.tilex+ (ed.levx*40),ed.tiley+ (ed.levy*30),50,2);
|
||||
}
|
||||
else if(ed.tiley==29)
|
||||
{
|
||||
addedentity(ed.tilex+ (ed.levx*40),ed.tiley+ (ed.levy*30),50,3);
|
||||
}
|
||||
else
|
||||
{
|
||||
ed.note="ERROR: Cannot have both warp types";
|
||||
ed.note="ERROR: Warp lines must be on edges";
|
||||
ed.notedelay=45;
|
||||
}
|
||||
ed.lclickdelay=1;
|
||||
|
|
Loading…
Reference in a new issue