mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-22 08:49:46 +01:00
De-duplicate room tile drawing code in editor
It previously duplicated the for-loop twice, once for tiles.png and tiles2.png, which just made me sad. Now it doesn't do that. Also it previously had an alternate tileset == 10 condition for tiles.png, which didn't seem to do anything because there's no such thing as tileset 10, and anyways it's useless in-game because when playing in the actual game it won't draw tiles.png, so I removed it. I don't know why it was there in the first place. Since I removed the temp variable from the outer scope, the other usage of it has to be updated.
This commit is contained in:
parent
e889a4a9b1
commit
5a6bc8bb9b
1 changed files with 13 additions and 17 deletions
|
@ -537,26 +537,23 @@ void editorrender(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Draw map, in function
|
//Draw map, in function
|
||||||
int temp;
|
|
||||||
if(room->tileset==0 || room->tileset==10)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < 30; j++)
|
for (int j = 0; j < 30; j++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 40; i++)
|
for (int i = 0; i < 40; i++)
|
||||||
{
|
{
|
||||||
temp=cl.gettile(ed.levx, ed.levy, i, j);
|
const int tile = cl.gettile(ed.levx, ed.levy, i, j);
|
||||||
if(temp>0) graphics.drawtile(i*8,j*8,temp);
|
if (tile <= 0)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (room->tileset == 0)
|
||||||
|
{
|
||||||
|
graphics.drawtile(i * 8, j * 8, tile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 30; j++)
|
graphics.drawtile2(i * 8, j * 8, tile);
|
||||||
{
|
|
||||||
for (int i = 0; i < 40; i++)
|
|
||||||
{
|
|
||||||
temp=cl.gettile(ed.levx, ed.levy, i, j);
|
|
||||||
if(temp>0) graphics.drawtile2(i*8,j*8,temp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1031,8 +1028,7 @@ void editorrender(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Draw five lines of the editor
|
//Draw five lines of the editor
|
||||||
temp=ed.dmtile-(ed.dmtile%40);
|
const int temp = ed.dmtile - (ed.dmtile % 40) - 80;
|
||||||
temp-=80;
|
|
||||||
FillRect(graphics.backBuffer, 0,-t2,320,40, graphics.getRGB(0,0,0));
|
FillRect(graphics.backBuffer, 0,-t2,320,40, graphics.getRGB(0,0,0));
|
||||||
FillRect(graphics.backBuffer, 0,-t2+40,320,2, graphics.getRGB(255,255,255));
|
FillRect(graphics.backBuffer, 0,-t2+40,320,2, graphics.getRGB(255,255,255));
|
||||||
if(room->tileset==0)
|
if(room->tileset==0)
|
||||||
|
|
Loading…
Reference in a new issue