mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2025-02-17 15:40:19 -05:00
Fix
This commit is contained in:
parent
46f485384f
commit
204b046c44
46
main.c
46
main.c
@ -347,14 +347,14 @@ typedef struct
|
|||||||
|
|
||||||
#define SFG_HUD_MARGIN (SFG_GAME_RESOLUTION_X / 20)
|
#define SFG_HUD_MARGIN (SFG_GAME_RESOLUTION_X / 20)
|
||||||
|
|
||||||
#define SFG_HUD_HURT_INDICATOR_WIDTH_PIXELS \
|
#define SFG_HUD_HEALTH_INDICATOR_WIDTH_PIXELS \
|
||||||
(SFG_GAME_RESOLUTION_Y / SFG_HUD_HURT_INDICATOR_WIDTH)
|
(SFG_GAME_RESOLUTION_Y / SFG_HUD_HEALTH_INDICATOR_WIDTH)
|
||||||
|
|
||||||
#define SFG_HUD_HURT_INDICATOR_DURATION_FRAMES \
|
#define SFG_HUD_HEALTH_INDICATOR_DURATION_FRAMES \
|
||||||
(SFG_HUD_HURT_INDICATOR_DURATION / SFG_MS_PER_FRAME)
|
(SFG_HUD_HEALTH_INDICATOR_DURATION / SFG_MS_PER_FRAME)
|
||||||
|
|
||||||
#if SFG_HUD_HURT_INDICATOR_DURATION_FRAMES == 0
|
#if SFG_HUD_HEALTH_INDICATOR_DURATION_FRAMES == 0
|
||||||
#define SFG_HUD_HURT_INDICATOR_DURATION_FRAMES 1
|
#define SFG_HUD_HEALTH_INDICATOR_DURATION_FRAMES 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1833,21 +1833,21 @@ void SFG_gameStep()
|
|||||||
// ^ only substract frames to live every other frame
|
// ^ only substract frames to live every other frame
|
||||||
|
|
||||||
for (int8_t i = 0; i < SFG_currentLevel.projectileRecordCount; ++i)
|
for (int8_t i = 0; i < SFG_currentLevel.projectileRecordCount; ++i)
|
||||||
{
|
{ // ^ has to be signed
|
||||||
SFG_ProjectileRecord *p = &(SFG_currentLevel.projectileRecords[i]);
|
SFG_ProjectileRecord *p = &(SFG_currentLevel.projectileRecords[i]);
|
||||||
|
|
||||||
RCL_Unit pos[3]; // we have to convert from uint16_t because under/overflows
|
RCL_Unit pos[3]; // we have to convert from uint16_t because under/overflows
|
||||||
|
|
||||||
uint8_t eliminate = 0;
|
uint8_t eliminate = 0;
|
||||||
|
|
||||||
for (uint8_t i = 0; i < 3; ++i)
|
for (uint8_t j = 0; j < 3; ++j)
|
||||||
{
|
{
|
||||||
pos[i] = p->position[i];
|
pos[j] = p->position[j];
|
||||||
pos[i] += p->direction[i];
|
pos[j] += p->direction[j];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(pos[i] < 0) ||
|
(pos[j] < 0) ||
|
||||||
(pos[i] >= (SFG_MAP_SIZE * RCL_UNITS_PER_SQUARE)))
|
(pos[j] >= (SFG_MAP_SIZE * RCL_UNITS_PER_SQUARE)))
|
||||||
{
|
{
|
||||||
eliminate = 1;
|
eliminate = 1;
|
||||||
break;
|
break;
|
||||||
@ -1880,9 +1880,9 @@ void SFG_gameStep()
|
|||||||
|
|
||||||
// check collision with active level elements
|
// check collision with active level elements
|
||||||
|
|
||||||
for (uint8_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i)
|
for (uint8_t j = 0; j < SFG_currentLevel.monsterRecordCount; ++j)
|
||||||
{
|
{
|
||||||
SFG_MonsterRecord *m = &(SFG_currentLevel.monsterRecords[i]);
|
SFG_MonsterRecord *m = &(SFG_currentLevel.monsterRecords[j]);
|
||||||
if ((m->stateType & SFG_MONSTER_MASK_STATE) !=
|
if ((m->stateType & SFG_MONSTER_MASK_STATE) !=
|
||||||
SFG_MONSTER_STATE_INACTIVE)
|
SFG_MONSTER_STATE_INACTIVE)
|
||||||
{
|
{
|
||||||
@ -1907,9 +1907,9 @@ void SFG_gameStep()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!eliminate)
|
if (!eliminate)
|
||||||
for (uint8_t i = 0; i < SFG_currentLevel.itemRecordCount; ++i)
|
for (uint8_t j = 0; j < SFG_currentLevel.itemRecordCount; ++j)
|
||||||
{
|
{
|
||||||
const SFG_LevelElement *e = SFG_getActiveItemElement(i);
|
const SFG_LevelElement *e = SFG_getActiveItemElement(j);
|
||||||
|
|
||||||
if (e != 0)
|
if (e != 0)
|
||||||
{
|
{
|
||||||
@ -2245,7 +2245,7 @@ uint8_t SFG_drawNumber(
|
|||||||
return 5 - position;
|
return 5 - position;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SFG_drawHurtIndicator(uint16_t width)
|
void SFG_drawHealthChangeBorder(uint16_t width, uint8_t color)
|
||||||
{
|
{
|
||||||
for (uint16_t j = 0; j < width; ++j)
|
for (uint16_t j = 0; j < width; ++j)
|
||||||
{
|
{
|
||||||
@ -2255,8 +2255,8 @@ void SFG_drawHurtIndicator(uint16_t width)
|
|||||||
{
|
{
|
||||||
if ((i & 0x01) == (j & 0x01))
|
if ((i & 0x01) == (j & 0x01))
|
||||||
{
|
{
|
||||||
SFG_setGamePixel(i,j,175);
|
SFG_setGamePixel(i,j,color);
|
||||||
SFG_setGamePixel(i,j2,175);
|
SFG_setGamePixel(i,j2,color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2269,8 +2269,8 @@ void SFG_drawHurtIndicator(uint16_t width)
|
|||||||
{
|
{
|
||||||
if ((i & 0x01) == (j & 0x01))
|
if ((i & 0x01) == (j & 0x01))
|
||||||
{
|
{
|
||||||
SFG_setGamePixel(i,j,175);
|
SFG_setGamePixel(i,j,color);
|
||||||
SFG_setGamePixel(i2,j,175);
|
SFG_setGamePixel(i2,j,color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2481,8 +2481,8 @@ void SFG_draw()
|
|||||||
SFG_drawWeapon(weaponBobOffset);
|
SFG_drawWeapon(weaponBobOffset);
|
||||||
|
|
||||||
if (SFG_gameFrame - SFG_player.lastHurtFrame
|
if (SFG_gameFrame - SFG_player.lastHurtFrame
|
||||||
<= SFG_HUD_HURT_INDICATOR_DURATION_FRAMES)
|
<= SFG_HUD_HEALTH_INDICATOR_DURATION_FRAMES)
|
||||||
SFG_drawHurtIndicator(SFG_HUD_HURT_INDICATOR_WIDTH_PIXELS);
|
SFG_drawHealthChangeBorder(SFG_HUD_HEALTH_INDICATOR_WIDTH_PIXELS,175);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
settings.h
10
settings.h
@ -136,14 +136,14 @@
|
|||||||
#define SFG_SPRITE_ANIMATION_SPEED 4
|
#define SFG_SPRITE_ANIMATION_SPEED 4
|
||||||
|
|
||||||
/**
|
/**
|
||||||
How wide the hurting indicator (red screen border) is, in fractions of
|
How wide the health indicator (screen border) is, in fractions of screen
|
||||||
screen width.
|
width.
|
||||||
*/
|
*/
|
||||||
#define SFG_HUD_HURT_INDICATOR_WIDTH 32
|
#define SFG_HUD_HEALTH_INDICATOR_WIDTH 32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
For how long hurt indicator stays shown, in ms.
|
For how long health indicator stays shown, in ms.
|
||||||
*/
|
*/
|
||||||
#define SFG_HUD_HURT_INDICATOR_DURATION 500
|
#define SFG_HUD_HEALTH_INDICATOR_DURATION 500
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
Loading…
Reference in New Issue
Block a user