Limit ammo and health

This commit is contained in:
Miloslav Číž 2020-03-22 11:31:02 +01:00
parent 71fad5e114
commit 1e586ce7ab
5 changed files with 56 additions and 24 deletions

View File

@ -1,21 +1,8 @@
general: general:
- try to make z-buffer 3 line instead of 1D, possibly like this (to keep
performance):
- at compile time selct X = power of 2 closest to vertical resolution
(or something like that)
- in pixel funct do something like
if (pixel->y % X == 0 && pixel->y != 0)
write to z-buffer
- let player start with 100 HP, but allow for collecting a higher amount, e.g.
up to 150.
- Add blinking:
- In menu, the selected level number should blink to indicate it can be
changed.
- Near locked door the specific unlocking card should blink on the HUD bar.
- Add setting SFG_BLINK_PERIOD to control blinking speed.
- try to remove the debug flag (-g1) from compiler and see if it decreases size - try to remove the debug flag (-g1) from compiler and see if it decreases size
- port to GB Meta - port to GB Meta
- add enemy moving/dying sound
- sounds (music?) - sounds (music?)
- level 2D map (with revealing, bitmap), special key for quick displaying map - level 2D map (with revealing, bitmap), special key for quick displaying map
- save/load (optional) - save/load (optional)
@ -64,6 +51,9 @@ level ideas:
has to slowly kill, which means he has to first get rid of the other has to slowly kill, which means he has to first get rid of the other
monsters. monsters.
- ceiling with "holes" through which sky (background) can be seen -- can be done
by having the ceiling texture set transparent and then alternating ceiling and
no ceiling
- boss level: skyscraper top, player goes upwards in a spiral along the OUTSIDE - boss level: skyscraper top, player goes upwards in a spiral along the OUTSIDE
side of the skyscraper side of the skyscraper
- two levels could partially overlap, e.g. level one, a city, could overlap - two levels could partially overlap, e.g. level one, a city, could overlap
@ -141,6 +131,7 @@ bugs:
done: done:
- add headbob - add headbob
- add blinking
- make zBuffer 8bit only? - make zBuffer 8bit only?
- texture coords of floor walls should start from the floor? NO, CAUSES ISSUES - texture coords of floor walls should start from the floor? NO, CAUSES ISSUES
- vertical visual noise when standing on elevator - vertical visual noise when standing on elevator
@ -161,4 +152,15 @@ done:
check collisions for both player and monsters against this array (elevate check collisions for both player and monsters against this array (elevate
these squares for collisions only) -- will also be faster these squares for collisions only) -- will also be faster
- more level prop items - more level prop items
- let player start with 100 HP, but allow for collecting a higher amount, e.g.
up to 150.
- limit maximum ammo amounts
scratched:
- try to make z-buffer 3 line instead of 1D, possibly like this (to keep
performance):
- at compile time selct X = power of 2 closest to vertical resolution
(or something like that)
- in pixel funct do something like
if (pixel->y % X == 0 && pixel->y != 0)
write to z-buffer

BIN
assets/levelY.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -114,7 +114,12 @@
/** /**
Maximum player health. Maximum player health.
*/ */
#define SFG_PLAYER_MAX_HEALTH 100 #define SFG_PLAYER_MAX_HEALTH 150
/**
Start health of player.
*/
#define SFG_PLAYER_START_HEALTH 100
/** /**
At which value health indicator shows a warning (red color). At which value health indicator shows a warning (red color).
@ -166,6 +171,10 @@
#define SFG_AMMO_INCREASE_ROCKETS 5 #define SFG_AMMO_INCREASE_ROCKETS 5
#define SFG_AMMO_INCREASE_PLASMA 8 #define SFG_AMMO_INCREASE_PLASMA 8
#define SFG_AMMO_MAX_BULLETS 200
#define SFG_AMMO_MAX_ROCKETS 100
#define SFG_AMMO_MAX_PLASMA 150
/** /**
Duration of story text (intro/outro) in ms. Duration of story text (intro/outro) in ms.
*/ */
@ -355,6 +364,8 @@
#define SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES 1 #define SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES 1
#endif #endif
#define SFG_BLINK_PERIOD_FRAMES (SFG_BLINK_PERIOD / SFG_MS_PER_FRAME)
#define SFG_HUD_BAR_HEIGHT \ #define SFG_HUD_BAR_HEIGHT \
(SFG_FONT_CHARACTER_SIZE * SFG_FONT_SIZE_MEDIUM + SFG_HUD_MARGIN * 2 + 1) (SFG_FONT_CHARACTER_SIZE * SFG_FONT_SIZE_MEDIUM + SFG_HUD_MARGIN * 2 + 1)

30
main.c
View File

@ -1119,7 +1119,7 @@ void SFG_initPlayer()
SFG_player.lastHurtFrame = SFG_game.frame; SFG_player.lastHurtFrame = SFG_game.frame;
SFG_player.lastItemTakenFrame = SFG_game.frame; SFG_player.lastItemTakenFrame = SFG_game.frame;
SFG_player.health = SFG_PLAYER_MAX_HEALTH; SFG_player.health = SFG_PLAYER_START_HEALTH;
SFG_player.cards = 0; SFG_player.cards = 0;
@ -2479,7 +2479,7 @@ void SFG_gameStepPlaying()
return; return;
} }
int8_t recomputeDirection = 0; int8_t recomputeDirection = SFG_currentLevel.frameStart == SFG_game.frame;
RCL_Vector2D moveOffset; RCL_Vector2D moveOffset;
@ -2877,21 +2877,33 @@ void SFG_gameStepPlaying()
switch (e->type) switch (e->type)
{ {
case SFG_LEVEL_ELEMENT_HEALTH: case SFG_LEVEL_ELEMENT_HEALTH:
SFG_playerChangeHealth(SFG_HEALTH_KIT_VALUE); if (SFG_player.health < SFG_PLAYER_MAX_HEALTH)
SFG_playerChangeHealth(SFG_HEALTH_KIT_VALUE);
else
eliminate = 0;
break; break;
#define addAmmo(type) \
if (SFG_player.ammo[SFG_AMMO_##type] < SFG_AMMO_MAX_##type) \
SFG_player.ammo[SFG_AMMO_##type] = RCL_min(SFG_AMMO_MAX_##type,\
SFG_player.ammo[SFG_AMMO_##type] + SFG_AMMO_INCREASE_##type);\
else\
eliminate = 0;
case SFG_LEVEL_ELEMENT_BULLETS: case SFG_LEVEL_ELEMENT_BULLETS:
SFG_player.ammo[SFG_AMMO_BULLETS] += SFG_AMMO_INCREASE_BULLETS; addAmmo(BULLETS)
break; break;
case SFG_LEVEL_ELEMENT_ROCKETS: case SFG_LEVEL_ELEMENT_ROCKETS:
SFG_player.ammo[SFG_AMMO_ROCKETS] += SFG_AMMO_INCREASE_ROCKETS; addAmmo(ROCKETS)
break; break;
case SFG_LEVEL_ELEMENT_PLASMA: case SFG_LEVEL_ELEMENT_PLASMA:
SFG_player.ammo[SFG_AMMO_PLASMA] += SFG_AMMO_INCREASE_PLASMA; addAmmo(PLASMA)
break; break;
#undef addAmmo
case SFG_LEVEL_ELEMENT_CARD0: case SFG_LEVEL_ELEMENT_CARD0:
case SFG_LEVEL_ELEMENT_CARD1: case SFG_LEVEL_ELEMENT_CARD1:
case SFG_LEVEL_ELEMENT_CARD2: case SFG_LEVEL_ELEMENT_CARD2:
@ -3562,7 +3574,9 @@ void SFG_drawMenu()
SFG_drawText(text,drawX,y,SFG_FONT_SIZE_MEDIUM,textColor,0,0); SFG_drawText(text,drawX,y,SFG_FONT_SIZE_MEDIUM,textColor,0,0);
if (item == SFG_MENU_ITEM_PLAY) if (item == SFG_MENU_ITEM_PLAY &&
(((i != SFG_game.selectedMenuItem) ||
(SFG_game.frame / SFG_BLINK_PERIOD_FRAMES) % 2)))
SFG_drawNumber((SFG_game.selectedLevel + 1), SFG_drawNumber((SFG_game.selectedLevel + 1),
drawX + SFG_characterSize(SFG_FONT_SIZE_MEDIUM) * (textLen + 1), drawX + SFG_characterSize(SFG_FONT_SIZE_MEDIUM) * (textLen + 1),
y,SFG_FONT_SIZE_MEDIUM,93); y,SFG_FONT_SIZE_MEDIUM,93);

View File

@ -189,12 +189,17 @@
*/ */
#define SFG_BACKGROUND_BLUR 0 #define SFG_BACKGROUND_BLUR 0
/**
Defines the period, in ms, of things that blink, such as text.
*/
#define SFG_BLINK_PERIOD 500
//------ developer/debug settings ------ //------ developer/debug settings ------
/** /**
Developer cheat for having infinite ammo in all weapons. Developer cheat for having infinite ammo in all weapons.
*/ */
#define SFG_INFINITE_AMMO 1 #define SFG_INFINITE_AMMO 0
/** /**
Developer cheat for immortality. Developer cheat for immortality.