1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 01:29:43 +01:00

Add finalstretch support for custom levels

This commit is contained in:
AllyTally 2023-08-24 19:51:28 -03:00
parent 6e18cddc69
commit bd3b9cac31
5 changed files with 63 additions and 19 deletions

View file

@ -273,7 +273,7 @@ editorclass::editorclass(void)
register_tilecol(EditorTileset_WARP_ZONE, 3, "basic", 89, "none", 129);
register_tilecol(EditorTileset_WARP_ZONE, 4, "basic", 92, "none", 132);
register_tilecol(EditorTileset_WARP_ZONE, 5, "basic", 95, "none", 135);
register_tilecol(EditorTileset_WARP_ZONE, 6, "basic", 98, "none", 138);
register_tilecol(EditorTileset_WARP_ZONE, 6, "basic", 98, "none", 740);
register_tilecol(EditorTileset_SHIP, 0, "basic", 101, "basic", 741);
register_tilecol(EditorTileset_SHIP, 1, "basic", 104, "basic", 744);
@ -3769,7 +3769,7 @@ bool editorclass::is_warp_zone_background(int tile)
return false;
}
return (tile == 120 || tile == 123 || tile == 126 || tile == 129 || tile == 132 || tile == 135 || tile == 138);
return (tile == 120 || tile == 123 || tile == 126 || tile == 129 || tile == 132 || tile == 135 || tile == 138 || tile == 740);
}
int editorclass::autotile(const int x, const int y)

View file

@ -2579,11 +2579,10 @@ void Graphics::updatebackground(int t)
else
{
// draw the whole thing for the first time!
backoffset = 0;
clear();
for (int j = 0; j < 15; j++)
{
for (int i = 0; i < 21; i++)
for (int i = 0; i < 22; i++)
{
drawtile2((i * 16) - backoffset - 3, (j * 16), temp + 40);
drawtile2((i * 16) - backoffset + 8 - 3, (j * 16), temp + 41);
@ -2622,9 +2621,8 @@ void Graphics::updatebackground(int t)
else
{
// draw the whole thing for the first time!
backoffset = 0;
clear();
for (int j = 0; j < 16; j++)
for (int j = 0; j < 17; j++)
{
for (int i = 0; i < 21; i++)
{
@ -2688,7 +2686,14 @@ void Graphics::drawmap(void)
}
else
{
tile = map.contents[TILE_IDX(x, y)];
if (map.finalstretch && map.custommode)
{
tile = map.finalat(x, y);
}
else
{
tile = map.contents[TILE_IDX(x, y)];
}
tileset = map.tileset;
}

View file

@ -502,7 +502,7 @@ void gamelogic(void)
else
{
//Update colour thingy
if (map.finalmode)
if (map.finalmode || map.custommode)
{
if (map.final_colormode)
{
@ -1407,7 +1407,7 @@ void gamelogic(void)
}
//Update colour cycling for final level
if (map.finalmode && map.final_colormode)
if ((map.finalmode || map.custommode) && map.final_colormode)
{
map.final_aniframedelay--;
if (map.final_aniframedelay == 0)

View file

@ -507,7 +507,8 @@ void mapclass::changefinalcol(int t)
//change the map to colour t - for the game's final stretch.
//First up, the tiles. This is just a setting:
final_mapcol = t;
const int temp = 6 - t;
graphics.rcol = 6 - t;
graphics.backgrounddrawn = false;
//Next, entities
for (size_t i = 0; i < obj.entities.size(); i++)
{
@ -515,28 +516,35 @@ void mapclass::changefinalcol(int t)
{
if (obj.entities[i].animate == 10 || obj.entities[i].animate == 11) //treadmill
{
if(temp<3)
if (custommode)
{
obj.entities[i].tile = 907 + (temp * 80);
obj.entities[i].tile = 568 + (graphics.rcol * 12);
}
else if (graphics.rcol < 3)
{
obj.entities[i].tile = 907 + (graphics.rcol * 80);
}
else
{
obj.entities[i].tile = 911 + ((temp-3) * 80);
obj.entities[i].tile = 911 + ((graphics.rcol - 3) * 80);
}
if (obj.entities[i].animate == 10)
{
obj.entities[i].tile += custommode ? 4 : 40;
}
if(obj.entities[i].animate == 10) obj.entities[i].tile += 40;
}
else if (obj.entities[i].isplatform)
{
obj.entities[i].tile = 915+(temp*40);
obj.entities[i].tile = custommode ? 564 + (graphics.rcol * 12) : 915 + (graphics.rcol * 40);
}
else //just an enemy
else // just an enemy
{
obj.entities[i].colour = maptiletoenemycol(temp);
obj.entities[i].colour = maptiletoenemycol(graphics.rcol);
}
}
else if (obj.entities[i].type == 2) //disappearing platforms
else if (obj.entities[i].type == 2) // disappearing platforms
{
obj.entities[i].tile = 915+(temp*40);
obj.entities[i].tile = custommode ? 564 + (graphics.rcol * 12) : 915 + (graphics.rcol * 40);
}
}
}
@ -1949,6 +1957,12 @@ void mapclass::loadlevel(int rx, int ry)
}
}
if (finalstretch)
{
graphics.rcol = 6 - final_mapcol;
changefinalcol(final_mapcol);
}
//do the appear/remove roomname here
break;
}

View file

@ -1454,6 +1454,31 @@ void scriptclass::run(void)
map.finalmode = true;
map.gotoroom(ss_toi(words[1]), ss_toi(words[2]));
}
else if (words[0] == "finalstretch")
{
if (words[1] == "on")
{
map.finalstretch = true;
map.final_colormode = true;
map.final_colorframe = 1;
graphics.foregrounddrawn = false;
map.final_colorframedelay = 40;
int temp = 1 + (int)(fRandom() * 5);
if (temp == 0) temp = 6;
map.changefinalcol(temp);
}
else if (words[1] == "off")
{
map.finalstretch = false;
map.final_colormode = false;
map.final_mapcol = 0;
map.final_colorframe = 0;
graphics.foregrounddrawn = false;
map.changefinalcol(0);
}
}
else if (words[0] == "rescued")
{
if (words[1] == "red")