mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
De-duplicate map.custommode check when drawing size-type 2/8 entities
Instead of copy-pasting all the BlitSurfaceStandard()s all over again, just make the referenced vector a pointer that changes depending on map.custommode.
This commit is contained in:
parent
6e0b267aac
commit
a6c1d13603
1 changed files with 32 additions and 50 deletions
|
@ -1398,6 +1398,16 @@ void Graphics::drawentities()
|
|||
|
||||
SDL_Rect drawRect;
|
||||
|
||||
std::vector<SDL_Surface*> *tilesvec;
|
||||
if (map.custommode)
|
||||
{
|
||||
tilesvec = &entcolours;
|
||||
}
|
||||
else
|
||||
{
|
||||
tilesvec = &tiles;
|
||||
}
|
||||
|
||||
trinketcolset = false;
|
||||
|
||||
for (int i = obj.entities.size() - 1; i >= 0; i--)
|
||||
|
@ -1525,23 +1535,13 @@ void Graphics::drawentities()
|
|||
drawRect = tiles_rect;
|
||||
drawRect.x += tpoint.x;
|
||||
drawRect.y += tpoint.y;
|
||||
if(map.custommode){
|
||||
BlitSurfaceStandard(entcolours[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(entcolours[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(entcolours[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(entcolours[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
}else{
|
||||
BlitSurfaceStandard(tiles[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(tiles[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(tiles[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(tiles[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
}
|
||||
BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
}
|
||||
else if (obj.entities[i].size == 3) // Big chunky pixels!
|
||||
{
|
||||
|
@ -1589,39 +1589,21 @@ void Graphics::drawentities()
|
|||
drawRect.x += tpoint.x;
|
||||
drawRect.y += tpoint.y;
|
||||
|
||||
if(map.custommode){
|
||||
BlitSurfaceStandard(entcolours[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(entcolours[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(entcolours[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(entcolours[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(entcolours[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(entcolours[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(entcolours[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(entcolours[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
}else{
|
||||
BlitSurfaceStandard(tiles[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(tiles[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(tiles[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(tiles[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(tiles[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(tiles[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(tiles[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard(tiles[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
}
|
||||
BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
drawRect.x += 8;
|
||||
BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||
}
|
||||
else if (obj.entities[i].size == 9) // Really Big Sprite! (2x2)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue