Add settings

This commit is contained in:
Miloslav Číž 2021-01-13 14:52:05 +01:00
parent d265b36ff2
commit b8a496f3df
2 changed files with 39 additions and 15 deletions

37
game.h
View File

@ -951,12 +951,25 @@ void SFG_pixelFunc(RCL_PixelInfo *pixel)
shadow = pixel->hit.direction >> 1;
}
else
else // floor/ceiling
{
color = pixel->isFloor ?
(SFG_currentLevel.floorColor) :
(
#if SFG_DIFFERENT_FLOOR_CEILING_COLORS
2 + (pixel->height / SFG_WALL_HEIGHT_STEP) % 4
#else
SFG_currentLevel.floorColor
#endif
) :
(pixel->height < SFG_CEILING_MAX_HEIGHT ?
SFG_currentLevel.ceilingColor : SFG_TRANSPARENT_COLOR);
(
#if SFG_DIFFERENT_FLOOR_CEILING_COLORS
18 + (pixel->height / SFG_WALL_HEIGHT_STEP) % 4
#else
SFG_currentLevel.ceilingColor
#endif
)
: SFG_TRANSPARENT_COLOR);
}
if (color != SFG_TRANSPARENT_COLOR)
@ -1006,6 +1019,12 @@ void SFG_pixelFunc(RCL_PixelInfo *pixel)
#endif
}
#if SFG_BRIGHTNESS > 0
color = palette_plusValue(color,SFG_BRIGHTNESS);
#elif SFG_BRIGHTNESS < 0
color = palette_minusValue(color,-1 * SFG_BRIGHTNESS);
#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);
@ -4644,18 +4663,6 @@ void SFG_draw()
SFG_backgroundBlurIndex = 0;
#endif
uint8_t aaa = 0;
/*
for (uint16_t j = 0; j < SFG_SCREEN_RESOLUTION_Y; ++j)
for (uint16_t i = 0; i < SFG_SCREEN_RESOLUTION_Y; ++i)
{
SFG_setGamePixel(i,j,2);
aaa++;
}
SFG_drawText("aaa",10,10,2,7,255,0);
return;
*/
if (SFG_game.state == SFG_GAME_STATE_MENU)
{
SFG_drawMenu();

View File

@ -44,6 +44,14 @@
#define SFG_FPS 60
#endif
/**
Increases or decreases the brightness of the rendered world (but not menu,
HUD etc.). Effective values are -8 to 8.
*/
#ifndef SFG_BRIGHTNESS
#define SFG_BRIGHTNESS 0
#endif
/**
On platforms with mouse this sets its horizontal sensitivity. 128 means 1
RCL_Unit turn angle per mouse pixel travelled.
@ -148,6 +156,15 @@
#define SFG_FOG_DIMINISH_STEP 2048
#endif
/**
If set, floor and ceiling will be colored differently depending on their
height. This can be useful when fog is turned on and different floor levels
are hard to distinguish.
*/
#ifndef SFG_DIFFERENT_FLOOR_CEILING_COLORS
#define SFG_DIFFERENT_FLOOR_CEILING_COLORS 0
#endif
/**
Maximum number of squares that will be traversed by any cast ray. Smaller
number is faster but can cause visual artifacts.