mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-11-24 18:02:22 -05:00
Optimize
This commit is contained in:
parent
0002cd8244
commit
3f97ebf518
10
game.h
10
game.h
@ -984,15 +984,17 @@ void SFG_pixelFunc(RCL_PixelInfo *pixel)
|
|||||||
);
|
);
|
||||||
|
|
||||||
#if SFG_BACKGROUND_BLUR != 0
|
#if SFG_BACKGROUND_BLUR != 0
|
||||||
|
SFG_backgroundBlurIndex = (SFG_backgroundBlurIndex + 1) % 8;
|
||||||
SFG_backgroundBlurIndex = (SFG_backgroundBlurIndex + 1) % 8;
|
|
||||||
// SFG_backgroundBlurIndex = (SFG_backgroundBlurIndex + 1) % 0x07;
|
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
color = 1;
|
color = 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SFG_RAYCASTING_SUBSAMPLE == 1
|
||||||
|
// the other version will probably get optimized to this, but just in case
|
||||||
|
SFG_setGamePixel(pixel->position.x,pixel->position.y,color);
|
||||||
|
#else
|
||||||
RCL_Unit screenX = pixel->position.x * SFG_RAYCASTING_SUBSAMPLE;
|
RCL_Unit screenX = pixel->position.x * SFG_RAYCASTING_SUBSAMPLE;
|
||||||
|
|
||||||
for (int_fast8_t i = 0; i < SFG_RAYCASTING_SUBSAMPLE; ++i)
|
for (int_fast8_t i = 0; i < SFG_RAYCASTING_SUBSAMPLE; ++i)
|
||||||
@ -1000,6 +1002,7 @@ SFG_backgroundBlurIndex = (SFG_backgroundBlurIndex + 1) % 8;
|
|||||||
SFG_setGamePixel(screenX,pixel->position.y,color);
|
SFG_setGamePixel(screenX,pixel->position.y,color);
|
||||||
screenX++;
|
screenX++;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1254,7 +1257,6 @@ RCL_Unit SFG_floorHeightAt(int16_t x, int16_t y)
|
|||||||
doorHeight = doorHeight != (0xff & SFG_DOOR_VERTICAL_POSITION_MASK) ?
|
doorHeight = doorHeight != (0xff & SFG_DOOR_VERTICAL_POSITION_MASK) ?
|
||||||
doorHeight * SFG_DOOR_HEIGHT_STEP : RCL_UNITS_PER_SQUARE;
|
doorHeight * SFG_DOOR_HEIGHT_STEP : RCL_UNITS_PER_SQUARE;
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
14
levels.h
14
levels.h
@ -155,16 +155,16 @@ static inline SFG_TileDefinition SFG_getMapTile
|
|||||||
uint8_t *properties
|
uint8_t *properties
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (x < 0 || x >= SFG_MAP_SIZE || y < 0 || y >= SFG_MAP_SIZE)
|
if (x >= 0 && x < SFG_MAP_SIZE && y >= 0 && y < SFG_MAP_SIZE)
|
||||||
{
|
{
|
||||||
*properties = SFG_TILE_PROPERTY_NORMAL;
|
uint8_t tile = level->mapArray[y * SFG_MAP_SIZE + x];
|
||||||
return SFG_OUTSIDE_TILE;
|
|
||||||
|
*properties = tile & 0xc0;
|
||||||
|
return level->tileDictionary[tile & 0x3f];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t tile = level->mapArray[y * SFG_MAP_SIZE + x];
|
*properties = SFG_TILE_PROPERTY_NORMAL;
|
||||||
|
return SFG_OUTSIDE_TILE;
|
||||||
*properties = tile & 0xc0;
|
|
||||||
return level->tileDictionary[tile & 0x3f];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SFG_NUMBER_OF_LEVELS 10
|
#define SFG_NUMBER_OF_LEVELS 10
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
// #define SFG_TIME_MULTIPLIER 512
|
// #define SFG_TIME_MULTIPLIER 512
|
||||||
|
|
||||||
// uncomment for perfomance debug
|
// uncomment for perfomance debug
|
||||||
//#define SFG_CPU_LOAD(percent) printf("CPU load: %d%\n",percent);
|
#define SFG_CPU_LOAD(percent) printf("CPU load: %d%\n",percent);
|
||||||
|
|
||||||
#ifndef __EMSCRIPTEN__
|
#ifndef __EMSCRIPTEN__
|
||||||
#ifndef GAME_LQ
|
#ifndef GAME_LQ
|
||||||
|
Loading…
Reference in New Issue
Block a user