This commit is contained in:
Miloslav Číž 2019-10-17 00:05:45 +02:00
parent d3a4b42c49
commit e0bcec79ca
2 changed files with 16 additions and 4 deletions

View File

@ -727,6 +727,13 @@ uint8_t SFG_weaponImages[][SFG_TEXTURE_SIZE * SFG_TEXTURE_SIZE] =
} }
}; };
/* TODO: ENEMIES: create a functions that will take enemy ID and frame type
(idle, attacking, ...) and will return pointer to sprite representing it --
allows reusing sprites and saving memory (e.g. a fyling monster can have same
frame for idle and walking, some enemies can share the same dead sprite etc.).
Also: add flip option to sprite drawing function so that some frames can be
reused flipped (good for walk anims). */
uint8_t SFG_charToFontIndex(char c) uint8_t SFG_charToFontIndex(char c)
{ {
if (c >= 'a' && c <= 'z') if (c >= 'a' && c <= 'z')

13
main.c
View File

@ -1177,11 +1177,16 @@ void SFG_gameStep()
SFG_currentLevel.levelPointer->elements[item]; SFG_currentLevel.levelPointer->elements[item];
if ( if (
(RCL_absVal(SFG_player.squarePosition[0] - e.coords[0]) RCL_absVal(SFG_player.squarePosition[0] - e.coords[0])
<= SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE) <= SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE
&& &&
(RCL_absVal(SFG_player.squarePosition[1] - e.coords[1]) RCL_absVal(SFG_player.squarePosition[1] - e.coords[1])
<= SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE) <= SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE
&&
RCL_absVal(
SFG_player.camera.height -
SFG_floorHeightAt(e.coords[0],e.coords[1]))
<= (SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE * RCL_UNITS_PER_SQUARE)
) )
item |= SFG_ITEM_RECORD_ACTIVE_MASK; item |= SFG_ITEM_RECORD_ACTIVE_MASK;