1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2025-01-09 18:39:45 +01:00

Adhere to "locked" gravity/warp lines

Ved has this useful feature where you can "lock" a gravity line or warp
line in place, meaning it'll no longer extend its length until it
touches a tile. A line is locked if the p4 of the edentity is 1.

VVVVVV doesn't support this, but now it does. The horrifying thing is
that it stretches the lines out *while rendering the line*, so it looks
like logic and rendering aren't that separate after all (although, I
already learned that when I did my over-30-FPS patch).
This commit is contained in:
Misa 2020-06-30 14:42:34 -07:00 committed by Ethan Lee
parent 7adf71a21b
commit b5783007b3

View file

@ -2657,27 +2657,47 @@ void editorrender()
int tx=edentity[i].x-(ed.levx*40); int tx=edentity[i].x-(ed.levx*40);
int tx2=edentity[i].x-(ed.levx*40); int tx2=edentity[i].x-(ed.levx*40);
int ty=edentity[i].y-(ed.levy*30); int ty=edentity[i].y-(ed.levy*30);
if (edentity[i].p4 != 1)
{
// Unlocked
while(ed.spikefree(tx,ty)==0) tx--; while(ed.spikefree(tx,ty)==0) tx--;
while(ed.spikefree(tx2,ty)==0) tx2++; while(ed.spikefree(tx2,ty)==0) tx2++;
tx++; tx++;
FillRect(graphics.backBuffer, (tx*8),(ty*8)+4, (tx2-tx)*8,1, graphics.getRGB(194,194,194));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(164,255,164));
edentity[i].p2=tx; edentity[i].p2=tx;
edentity[i].p3=(tx2-tx)*8; edentity[i].p3=(tx2-tx)*8;
} }
else
{
// Locked
tx = edentity[i].p2;
tx2 = tx + edentity[i].p3/8;
}
FillRect(graphics.backBuffer, (tx*8),(ty*8)+4, (tx2-tx)*8,1, graphics.getRGB(194,194,194));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(164,255,164));
}
else //Vertical else //Vertical
{ {
int tx=edentity[i].x-(ed.levx*40); int tx=edentity[i].x-(ed.levx*40);
int ty=edentity[i].y-(ed.levy*30); int ty=edentity[i].y-(ed.levy*30);
int ty2=edentity[i].y-(ed.levy*30); int ty2=edentity[i].y-(ed.levy*30);
if (edentity[i].p4 != 1)
{
// Unlocked
while(ed.spikefree(tx,ty)==0) ty--; while(ed.spikefree(tx,ty)==0) ty--;
while(ed.spikefree(tx,ty2)==0) ty2++; while(ed.spikefree(tx,ty2)==0) ty2++;
ty++; ty++;
FillRect(graphics.backBuffer, (tx*8)+3,(ty*8), 1,(ty2-ty)*8, graphics.getRGB(194,194,194));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(164,255,164));
edentity[i].p2=ty; edentity[i].p2=ty;
edentity[i].p3=(ty2-ty)*8; edentity[i].p3=(ty2-ty)*8;
} }
else
{
// Locked
ty = edentity[i].p2;
ty2 = ty + edentity[i].p3/8;
}
FillRect(graphics.backBuffer, (tx*8)+3,(ty*8), 1,(ty2-ty)*8, graphics.getRGB(194,194,194));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(164,255,164));
}
break; break;
case 13://Warp tokens case 13://Warp tokens
graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),18+(ed.entframe%2),196,196,196); graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),18+(ed.entframe%2),196,196,196);
@ -2749,27 +2769,47 @@ void editorrender()
int tx=edentity[i].x-(ed.levx*40); int tx=edentity[i].x-(ed.levx*40);
int tx2=edentity[i].x-(ed.levx*40); int tx2=edentity[i].x-(ed.levx*40);
int ty=edentity[i].y-(ed.levy*30); int ty=edentity[i].y-(ed.levy*30);
if (edentity[i].p4 != 1)
{
// Unlocked
while(ed.free(tx,ty)==0) tx--; while(ed.free(tx,ty)==0) tx--;
while(ed.free(tx2,ty)==0) tx2++; while(ed.free(tx2,ty)==0) tx2++;
tx++; tx++;
fillboxabs((tx*8),(ty*8)+1, (tx2-tx)*8,6, graphics.getRGB(255,255,194));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(255,255,164));
edentity[i].p2=tx; edentity[i].p2=tx;
edentity[i].p3=(tx2-tx)*8; edentity[i].p3=(tx2-tx)*8;
} }
else
{
// Locked
tx = edentity[i].p2;
tx2 = tx + edentity[i].p3/8;
}
fillboxabs((tx*8),(ty*8)+1, (tx2-tx)*8,6, graphics.getRGB(255,255,194));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(255,255,164));
}
else //Vertical else //Vertical
{ {
int tx=edentity[i].x-(ed.levx*40); int tx=edentity[i].x-(ed.levx*40);
int ty=edentity[i].y-(ed.levy*30); int ty=edentity[i].y-(ed.levy*30);
int ty2=edentity[i].y-(ed.levy*30); int ty2=edentity[i].y-(ed.levy*30);
if (edentity[i].p4 != 1)
{
// Unlocked
while(ed.free(tx,ty)==0) ty--; while(ed.free(tx,ty)==0) ty--;
while(ed.free(tx,ty2)==0) ty2++; while(ed.free(tx,ty2)==0) ty2++;
ty++; ty++;
fillboxabs((tx*8)+1,(ty*8), 6,(ty2-ty)*8, graphics.getRGB(255,255,194));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(255,255,164));
edentity[i].p2=ty; edentity[i].p2=ty;
edentity[i].p3=(ty2-ty)*8; edentity[i].p3=(ty2-ty)*8;
} }
else
{
// Locked
ty = edentity[i].p2;
ty2 = ty + edentity[i].p3/8;
}
fillboxabs((tx*8)+1,(ty*8), 6,(ty2-ty)*8, graphics.getRGB(255,255,194));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(255,255,164));
}
break; break;
} }
} }