Update level

This commit is contained in:
Miloslav Číž 2019-09-29 20:26:53 +02:00
parent 534d1e292c
commit 3621439b2a
2 changed files with 15 additions and 3 deletions

View File

@ -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

8
main.c
View File

@ -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]];