Add background

This commit is contained in:
Miloslav Číž 2020-01-03 00:34:50 +01:00
parent ac64be463a
commit 6c28105149
4 changed files with 29 additions and 2 deletions

View File

@ -453,6 +453,26 @@ SFG_PROGRAM_MEMORY uint8_t SFG_backgroundImages[][SFG_TEXTURE_STORE_SIZE] =
36,85,87,105,185,156,0,8,8,0,0,16,17,17,34,34,36,84,86,105,150,102,102,3,192,0,
1,1,17,17,34,34,36,68,71,103,118,108,0,8,0,24,17,16,17,17,34,34,34,68,71,102,
103,102,246,102,248,128,0,1,17,17
},
{ // 1, reddish scifi interior
168,18,17,19,65,153,1,9,152,232,0,45,61,80,96,160,18,114,34,34,34,34,34,80,0,0,
0,0,0,0,0,0,18,114,34,34,34,34,34,80,0,0,0,0,0,0,0,0,0,215,34,34,34,34,34,80,0,
0,0,0,0,0,0,0,0,119,34,34,34,34,34,80,0,0,0,0,0,0,0,0,0,214,34,34,34,34,34,34,
32,0,0,0,0,0,0,0,0,118,34,34,34,34,34,34,36,69,0,0,0,0,0,0,18,118,17,17,17,17,
17,17,20,69,0,0,0,0,0,0,18,118,17,17,17,17,17,17,20,69,0,0,0,0,0,0,18,118,114,
34,34,34,34,34,116,69,0,0,0,0,0,0,18,118,130,34,34,38,0,0,0,0,0,0,0,0,0,0,18,
118,135,34,34,34,0,0,0,0,0,0,0,0,0,0,85,86,138,34,34,34,34,41,133,0,0,0,0,0,0,0,
0,86,138,17,17,17,17,25,133,85,0,0,0,0,0,0,0,86,138,17,17,17,27,25,132,70,0,0,0,
0,0,0,0,85,85,85,17,17,17,25,132,70,0,0,0,0,0,0,0,0,0,5,17,17,17,25,132,70,0,0,
0,0,0,0,0,0,0,5,17,27,17,25,132,70,0,0,0,0,0,0,0,6,128,17,17,17,17,25,132,70,0,
0,0,0,0,0,16,118,128,17,17,27,17,25,246,0,0,0,0,0,0,0,16,118,128,17,17,17,17,25,
132,0,0,0,0,0,0,0,16,118,128,51,51,51,51,57,246,0,0,0,0,0,0,0,16,118,130,51,51,
51,51,50,132,0,0,0,0,0,0,0,16,118,130,51,51,51,51,50,132,0,0,0,0,0,0,0,16,118,
131,51,51,51,51,51,132,70,0,0,0,0,0,0,0,0,5,60,51,51,51,51,36,70,0,0,0,0,0,0,0,
0,5,51,51,51,51,51,36,70,0,0,0,0,0,0,0,14,229,51,51,51,51,51,52,70,0,0,0,0,0,0,
85,85,51,195,51,51,51,51,52,64,0,0,0,0,0,0,18,114,17,17,17,17,17,17,18,64,0,0,0,
0,0,0,18,113,17,17,17,17,17,17,17,64,0,0,0,0,0,0,18,115,51,51,51,51,51,80,0,0,0,
0,0,0,0,0,18,115,51,51,51,51,51,80,0,0,0,0,0,0,0,0
}
};

BIN
assets/background2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

View File

@ -121,6 +121,7 @@ typedef struct
texture used for door. */
uint8_t floorColor;
uint8_t ceilingColor;
uint8_t backgroundImage; /** Index of level background image. */
SFG_LevelElement elements[SFG_MAX_LEVEL_ELEMENTS];
} SFG_Level;
@ -251,6 +252,7 @@ SFG_PROGRAM_MEMORY SFG_Level SFG_level0 =
13, // doorTextureIndex
10, // floorColor
32, // ceilingColor
0, // backgroundImage
{ // elements
{SFG_LEVEL_ELEMENT_BARREL, {9, 1}}, {SFG_LEVEL_ELEMENT_BARREL, {9, 13}},
{SFG_LEVEL_ELEMENT_HEALTH, {12, 4}}, {SFG_LEVEL_ELEMENT_HEALTH, {15, 4}},
@ -426,6 +428,7 @@ SFG_PROGRAM_MEMORY SFG_Level SFG_level1 =
13, // doorTextureIndex
102, // floorColor
32, // ceilingColor
1, // backgroundImage
{ // elements
{SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
{SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},

8
main.c
View File

@ -265,6 +265,8 @@ struct
SFG_ProjectileRecord projectileRecords[SFG_MAX_PROJECTILES];
uint8_t projectileRecordCount;
uint8_t backgroundImage;
} SFG_currentLevel;
#if SFG_DITHERED_SHADOW
@ -596,7 +598,7 @@ void SFG_pixelFunc(RCL_PixelInfo *pixel)
else
{
color = SFG_getTexel(
SFG_backgroundImages[0],
SFG_backgroundImages[SFG_currentLevel.backgroundImage],
SFG_backgroundScaleMap[((pixel->position.x
#if SFG_BACKGROUND_BLUR != 0
+ SFG_backgroundBlurOffsets[SFG_backgroundBlurIndex]
@ -917,6 +919,8 @@ void SFG_setAndInitLevel(const SFG_Level *level)
SFG_currentRandom = 0;
SFG_currentLevel.backgroundImage = level->backgroundImage;
SFG_currentLevel.levelPointer = level;
SFG_currentLevel.floorColor = level->floorColor;
@ -1032,7 +1036,7 @@ void SFG_init()
SFG_backgroundScroll = 0;
SFG_setAndInitLevel(&SFG_level0);
SFG_setAndInitLevel(&SFG_level1);
SFG_lastFrameTimeMs = SFG_getTimeMs();
}