From 3621439b2aa5b87633cb5cf24cd2ec18b7dcf749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sun, 29 Sep 2019 20:26:53 +0200 Subject: [PATCH] Update level --- levels.h | 10 ++++++++-- main.c | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/levels.h b/levels.h index 93f7ac1..493ff32 100644 --- a/levels.h +++ b/levels.h @@ -67,6 +67,8 @@ typedef struct texture). */ uint8_t doorTextureIndex; /**< Index (global, NOT from textureIndices) of a texture used for door. */ + uint8_t floorColor; + uint8_t ceilingColor; } SFG_Level; static inline SFG_TileDefinition SFG_getMapTile @@ -180,7 +182,9 @@ static const SFG_Level SFG_level0 = SFG_TD(0 ,31,0,0),SFG_TD(0 ,63,0,0),SFG_TD(0 ,63,0,0),SFG_TD(0 ,63,0,0), // 60 }, {0, 1, 2, 6, 3,12, 10}, // textureIndices - 7 // doorTextureIndex + 7, // doorTextureIndex + 10, // floorColor + 32 // ceilingColor }; static const SFG_Level SFG_level1 = @@ -280,7 +284,9 @@ static const SFG_Level SFG_level1 = SFG_TD(0 ,31,0,0),SFG_TD(0 ,63,0,0),SFG_TD(0 ,63,0,0),SFG_TD(0 ,63,0,0), // 60 }, {0, 1, 2, 3, 4, 5, 11}, // textureIndices - 7 // doorTextureIndex + 7, // doorTextureIndex + 10, // floorColor + 32 // ceilingColor }; #endif // guard diff --git a/main.c b/main.c index cf67613..169e47d 100755 --- a/main.c +++ b/main.c @@ -90,6 +90,8 @@ struct const SFG_Level *levelPointer; const uint8_t* textures[7]; uint32_t timeStart; + uint8_t floorColor; + uint8_t ceilingColor; } SFG_currentLevel; void SFG_pixelFunc(RCL_PixelInfo *pixel) @@ -138,7 +140,8 @@ void SFG_pixelFunc(RCL_PixelInfo *pixel) } else { - color = pixel->isFloor ? 20 : 50; + color = pixel->isFloor ? + SFG_currentLevel.floorColor : SFG_currentLevel.ceilingColor; } if (color != SFG_TRANSPARENT_COLOR) @@ -270,6 +273,9 @@ void SFG_setLevel(const SFG_Level *level) SFG_currentLevel.levelPointer = level; + SFG_currentLevel.floorColor = level->floorColor; + SFG_currentLevel.ceilingColor = level->ceilingColor; + for (uint8_t i = 0; i < 7; ++i) SFG_currentLevel.textures[i] = SFG_texturesWall[level->textureIndices[i]];