Add overclocked bins
This commit is contained in:
parent
9ba96a12d4
commit
17af4ec989
9 changed files with 24 additions and 16 deletions
BIN
bin/demo1.bin
BIN
bin/demo1.bin
Binary file not shown.
BIN
bin/demo1_overclock.bin
Executable file
BIN
bin/demo1_overclock.bin
Executable file
Binary file not shown.
BIN
bin/demo2.bin
BIN
bin/demo2.bin
Binary file not shown.
BIN
bin/demo2_overclock.bin
Executable file
BIN
bin/demo2_overclock.bin
Executable file
Binary file not shown.
BIN
bin/demo3.bin
BIN
bin/demo3.bin
Binary file not shown.
BIN
bin/demo3_overclock.bin
Executable file
BIN
bin/demo3_overclock.bin
Executable file
Binary file not shown.
|
@ -1332,6 +1332,9 @@ int main()
|
||||||
cFloor = 10;
|
cFloor = 10;
|
||||||
cCeiling = 10;
|
cCeiling = 10;
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < SUBSAMPLED_WIDTH; ++i)
|
||||||
|
zBuffer[i] = RCL_INFINITY;
|
||||||
|
|
||||||
player.setPositionSquare(0,5);
|
player.setPositionSquare(0,5);
|
||||||
player.mCamera.direction = 3 * RCL_UNITS_PER_SQUARE / 4;
|
player.mCamera.direction = 3 * RCL_UNITS_PER_SQUARE / 4;
|
||||||
player.mCamera.height = RCL_CAMERA_COLL_HEIGHT_BELOW;
|
player.mCamera.height = RCL_CAMERA_COLL_HEIGHT_BELOW;
|
||||||
|
|
|
@ -473,7 +473,7 @@ uint16_t backgroundColumn = 0; ///< Precomputed background column.
|
||||||
inline void pixelFunc(RCL_PixelInfo *pixel)
|
inline void pixelFunc(RCL_PixelInfo *pixel)
|
||||||
{
|
{
|
||||||
uint8_t color = 0;
|
uint8_t color = 0;
|
||||||
int16_t intensity = 0;
|
uint8_t intensity = 0;
|
||||||
|
|
||||||
if (pixel->isWall)
|
if (pixel->isWall)
|
||||||
{
|
{
|
||||||
|
@ -482,7 +482,7 @@ inline void pixelFunc(RCL_PixelInfo *pixel)
|
||||||
intensity = pixel->depth / (RCL_UNITS_PER_SQUARE * 2) +
|
intensity = pixel->depth / (RCL_UNITS_PER_SQUARE * 2) +
|
||||||
((pixel->hit.direction == 0 || pixel->hit.direction == 2) ? 4 : 0);
|
((pixel->hit.direction == 0 || pixel->hit.direction == 2) ? 4 : 0);
|
||||||
|
|
||||||
color = addIntensity(squareColors[pixel->hit.type],intensity);
|
color = plusIntensity(squareColors[pixel->hit.type],intensity);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
color = 30;
|
color = 30;
|
||||||
|
@ -492,7 +492,7 @@ inline void pixelFunc(RCL_PixelInfo *pixel)
|
||||||
if (!pixel->isHorizon)
|
if (!pixel->isHorizon)
|
||||||
{
|
{
|
||||||
intensity = pixel->depth / RCL_UNITS_PER_SQUARE;
|
intensity = pixel->depth / RCL_UNITS_PER_SQUARE;
|
||||||
color = addIntensity(floorColors[(pixel->height / RCL_UNITS_PER_SQUARE) % FLOOR_COLORS],intensity);
|
color = plusIntensity(floorColors[(pixel->height / RCL_UNITS_PER_SQUARE) % FLOOR_COLORS],intensity);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
color = floorColors[0];
|
color = floorColors[0];
|
||||||
|
|
31
general.hpp
31
general.hpp
|
@ -200,22 +200,27 @@ void initPalette()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Adds given intensity to a color.
|
Adds given intensity to a color.
|
||||||
|
|
||||||
@param color input color
|
|
||||||
@param intensity intensity to add, can be negative, will be clamped
|
|
||||||
@return new color
|
|
||||||
*/
|
*/
|
||||||
inline uint8_t addIntensity(uint8_t color, int16_t intensity)
|
inline uint8_t addIntensity(uint8_t color, int8_t add)
|
||||||
{
|
{
|
||||||
int16_t newValue = (color & 0b00001111) + intensity; // value as in HSV
|
uint8_t newValue = color + add;
|
||||||
|
|
||||||
|
if ((newValue >> 4) == (color >> 4))
|
||||||
|
return newValue;
|
||||||
|
else
|
||||||
|
return add > 0 ? (color | 0x0f) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (newValue <= 0)
|
static inline uint8_t plusIntensity(uint8_t color, uint8_t plus)
|
||||||
return 0; // black
|
{
|
||||||
|
uint8_t newValue = color + plus;
|
||||||
|
return ((newValue >> 4) == (color >> 4)) ? newValue : (color | 0x0f);
|
||||||
|
}
|
||||||
|
|
||||||
if (newValue >= 16)
|
static inline uint8_t minusIntensity(uint8_t color, uint8_t minus)
|
||||||
newValue = 15;
|
{
|
||||||
|
uint8_t newValue = color - minus;
|
||||||
return (color & 0b11110000) | newValue;
|
return ((newValue >> 4) == (color >> 4)) ? newValue : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -238,7 +243,7 @@ inline uint8_t sampleImage(const unsigned char *image, RCL_Unit x, RCL_Unit y)
|
||||||
Draws a scaled sprite on screen in an optimized way. The sprite has to be
|
Draws a scaled sprite on screen in an optimized way. The sprite has to be
|
||||||
square in resolution for that.
|
square in resolution for that.
|
||||||
*/
|
*/
|
||||||
void inline drawSpriteSquare(const unsigned char *sprite, int16_t x, int16_t y, RCL_Unit depth, int16_t size, int16_t intensity)
|
static void inline drawSpriteSquare(const unsigned char *sprite, int16_t x, int16_t y, RCL_Unit depth, int16_t size, int16_t intensity)
|
||||||
{
|
{
|
||||||
if (size < 0 || size > 200 || // let's not mess up with the incoming array
|
if (size < 0 || size > 200 || // let's not mess up with the incoming array
|
||||||
sprite[0] != sprite[1]) // only draw square sprites
|
sprite[0] != sprite[1]) // only draw square sprites
|
||||||
|
|
Loading…
Reference in a new issue