mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2025-02-07 02:30:15 -05:00
Update map drawing
This commit is contained in:
parent
db4872b67f
commit
08aab543da
36
main.c
36
main.c
@ -457,6 +457,11 @@ uint8_t SFG_random()
|
|||||||
return SFG_game.currentRandom;
|
return SFG_game.currentRandom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int8_t SFG_blinkOn()
|
||||||
|
{
|
||||||
|
return (SFG_game.frame / SFG_BLINK_PERIOD_FRAMES) % 2;
|
||||||
|
}
|
||||||
|
|
||||||
void SFG_playGameSound(uint8_t soundIndex, uint8_t volume)
|
void SFG_playGameSound(uint8_t soundIndex, uint8_t volume)
|
||||||
{
|
{
|
||||||
if (!(SFG_game.soundSettings & 0x01))
|
if (!(SFG_game.soundSettings & 0x01))
|
||||||
@ -1300,7 +1305,12 @@ void SFG_setAndInitLevel(const SFG_Level *level)
|
|||||||
SFG_currentLevel.doorRecordCount = 0;
|
SFG_currentLevel.doorRecordCount = 0;
|
||||||
SFG_currentLevel.projectileRecordCount = 0;
|
SFG_currentLevel.projectileRecordCount = 0;
|
||||||
SFG_currentLevel.teleportCount = 0;
|
SFG_currentLevel.teleportCount = 0;
|
||||||
SFG_currentLevel.mapRevealMask = 0;
|
SFG_currentLevel.mapRevealMask =
|
||||||
|
#if SFG_REVEAL_MAP
|
||||||
|
0xffff;
|
||||||
|
#else
|
||||||
|
0;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (uint8_t j = 0; j < SFG_MAP_SIZE; ++j)
|
for (uint8_t j = 0; j < SFG_MAP_SIZE; ++j)
|
||||||
{
|
{
|
||||||
@ -3365,6 +3375,8 @@ void SFG_drawMap()
|
|||||||
uint16_t x;
|
uint16_t x;
|
||||||
uint16_t y = topLeftY;
|
uint16_t y = topLeftY;
|
||||||
|
|
||||||
|
uint8_t playerColor = SFG_blinkOn() ? 93 : 111;
|
||||||
|
|
||||||
for (int16_t j = 0; j < maxJ; ++j)
|
for (int16_t j = 0; j < maxJ; ++j)
|
||||||
{
|
{
|
||||||
x = topLeftX;
|
x = topLeftX;
|
||||||
@ -3380,23 +3392,23 @@ void SFG_drawMap()
|
|||||||
SFG_TileDefinition tile =
|
SFG_TileDefinition tile =
|
||||||
SFG_getMapTile(SFG_currentLevel.levelPointer,i,j,&properties);
|
SFG_getMapTile(SFG_currentLevel.levelPointer,i,j,&properties);
|
||||||
|
|
||||||
color = 94; // start with player color
|
color = playerColor; // start with player color
|
||||||
|
|
||||||
if (i != SFG_player.squarePosition[0] ||
|
if (i != SFG_player.squarePosition[0] ||
|
||||||
j != SFG_player.squarePosition[1])
|
j != SFG_player.squarePosition[1])
|
||||||
{
|
{
|
||||||
if (properties == SFG_TILE_PROPERTY_ELEVATOR)
|
if (properties == SFG_TILE_PROPERTY_ELEVATOR)
|
||||||
color = 46;
|
color = 214;
|
||||||
else if (properties == SFG_TILE_PROPERTY_SQUEEZER)
|
else if (properties == SFG_TILE_PROPERTY_SQUEEZER)
|
||||||
color = 63;
|
color = 246;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
color =
|
color = 0;
|
||||||
(SFG_TILE_FLOOR_HEIGHT(tile) - SFG_TILE_CEILING_HEIGHT(tile))
|
|
||||||
/ 8 + 2;
|
|
||||||
|
|
||||||
if (properties == SFG_TILE_PROPERTY_DOOR)
|
uint8_t c = SFG_TILE_CEILING_HEIGHT(tile) / 4;
|
||||||
color += 8;
|
|
||||||
|
if (c != 0)
|
||||||
|
color = (SFG_TILE_FLOOR_HEIGHT(tile) % 8 + 3) * 8 + c - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3686,7 +3698,7 @@ void SFG_drawMenu()
|
|||||||
|
|
||||||
uint8_t i = 0;
|
uint8_t i = 0;
|
||||||
|
|
||||||
uint8_t blink = (SFG_game.frame / SFG_BLINK_PERIOD_FRAMES) % 2;
|
uint8_t blink = SFG_blinkOn();
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@ -3718,8 +3730,6 @@ void SFG_drawMenu()
|
|||||||
if ((item == SFG_MENU_ITEM_PLAY || item == SFG_MENU_ITEM_SOUND) &&
|
if ((item == SFG_MENU_ITEM_PLAY || item == SFG_MENU_ITEM_SOUND) &&
|
||||||
((i != SFG_game.selectedMenuItem) || blink))
|
((i != SFG_game.selectedMenuItem) || blink))
|
||||||
{
|
{
|
||||||
//uint8_t blink = (SFG_game.frame / SFG_BLINK_PERIOD_FRAMES) % 2;
|
|
||||||
|
|
||||||
uint32_t x =
|
uint32_t x =
|
||||||
drawX + SFG_characterSize(SFG_FONT_SIZE_MEDIUM) * (textLen + 1);
|
drawX + SFG_characterSize(SFG_FONT_SIZE_MEDIUM) * (textLen + 1);
|
||||||
|
|
||||||
@ -4050,7 +4060,7 @@ void SFG_draw()
|
|||||||
SFG_FONT_SIZE_MEDIUM,
|
SFG_FONT_SIZE_MEDIUM,
|
||||||
4);
|
4);
|
||||||
|
|
||||||
uint8_t blink = (SFG_game.frame / SFG_BLINK_PERIOD_FRAMES) % 2;
|
uint8_t blink = SFG_blinkOn();
|
||||||
|
|
||||||
for (uint8_t i = 0; i < 3; ++i) // access cards
|
for (uint8_t i = 0; i < 3; ++i) // access cards
|
||||||
if (
|
if (
|
||||||
|
@ -241,4 +241,9 @@
|
|||||||
*/
|
*/
|
||||||
#define SFG_START_LEVEL 6
|
#define SFG_START_LEVEL 6
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reveals whole level map from start.
|
||||||
|
*/
|
||||||
|
#define SFG_REVEAL_MAP 1
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
Loading…
Reference in New Issue
Block a user