mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Make some variables const in drawentities()
I'm going to refactor drawing an entity out to a separate function, and since I'm going to do that, I might as well make some things const to clarify intent first and foremost and possibly improve performance or compiler optimization.
This commit is contained in:
parent
688b23b85d
commit
081030fb2f
1 changed files with 7 additions and 15 deletions
|
@ -1593,26 +1593,18 @@ void Graphics::drawentities()
|
||||||
|
|
||||||
#if !defined(NO_CUSTOM_LEVELS)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
// Special case for gray Warp Zone tileset!
|
// Special case for gray Warp Zone tileset!
|
||||||
int room = game.roomx-100 + (game.roomy-100) * ed.maxwidth;
|
const int room = game.roomx-100 + (game.roomy-100) * ed.maxwidth;
|
||||||
bool custom_gray = INBOUNDS_ARR(room, ed.level)
|
const bool custom_gray = INBOUNDS_ARR(room, ed.level)
|
||||||
&& ed.level[room].tileset == 3 && ed.level[room].tilecol == 6;
|
&& ed.level[room].tileset == 3 && ed.level[room].tilecol == 6;
|
||||||
#else
|
#else
|
||||||
bool custom_gray = false;
|
const bool custom_gray = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<SDL_Surface*>& tilesvec = (map.custommode && !map.finalmode) ? entcolours : tiles;
|
std::vector<SDL_Surface*>& tilesvec = (map.custommode && !map.finalmode) ? entcolours : tiles;
|
||||||
|
|
||||||
std::vector<SDL_Surface*>& spritesvec = flipmode ? flipsprites : sprites;
|
std::vector<SDL_Surface*>& spritesvec = flipmode ? flipsprites : sprites;
|
||||||
|
|
||||||
int yoff;
|
const int yoff = map.towermode ? lerp(map.oldypos, map.ypos) : 0;
|
||||||
if (map.towermode)
|
|
||||||
{
|
|
||||||
yoff = lerp(map.oldypos, map.ypos);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
yoff = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = obj.entities.size() - 1; i >= 0; i--)
|
for (int i = obj.entities.size() - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
@ -1621,8 +1613,8 @@ void Graphics::drawentities()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xp = lerp(obj.entities[i].lerpoldxp, obj.entities[i].xp);
|
const int xp = lerp(obj.entities[i].lerpoldxp, obj.entities[i].xp);
|
||||||
int yp = lerp(obj.entities[i].lerpoldyp, obj.entities[i].yp);
|
const int yp = lerp(obj.entities[i].lerpoldyp, obj.entities[i].yp);
|
||||||
|
|
||||||
switch (obj.entities[i].size)
|
switch (obj.entities[i].size)
|
||||||
{
|
{
|
||||||
|
@ -1671,7 +1663,7 @@ void Graphics::drawentities()
|
||||||
wrappedPoint.y -= 230;
|
wrappedPoint.y -= 230;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isInWrappingAreaOfTower = map.towermode && !map.minitowermode && map.ypos >= 500 && map.ypos <= 5000;
|
const bool isInWrappingAreaOfTower = map.towermode && !map.minitowermode && map.ypos >= 500 && map.ypos <= 5000;
|
||||||
if (wrapX && (map.warpx || isInWrappingAreaOfTower))
|
if (wrapX && (map.warpx || isInWrappingAreaOfTower))
|
||||||
{
|
{
|
||||||
drawRect = sprites_rect;
|
drawRect = sprites_rect;
|
||||||
|
|
Loading…
Reference in a new issue