From b8a496f3df255a7934f72167b4a3ac0ed2172363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Wed, 13 Jan 2021 14:52:05 +0100 Subject: [PATCH] Add settings --- game.h | 37 ++++++++++++++++++++++--------------- settings.h | 17 +++++++++++++++++ 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/game.h b/game.h index 329d712..c9e4eca 100755 --- a/game.h +++ b/game.h @@ -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(); diff --git a/settings.h b/settings.h index 081c2e8..2c8820a 100644 --- a/settings.h +++ b/settings.h @@ -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.