mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-11-21 16:35:08 -05:00
Take health kits
This commit is contained in:
parent
204b046c44
commit
598ec97513
39
assets.h
39
assets.h
@ -323,24 +323,27 @@ SFG_PROGRAM_MEMORY uint8_t SFG_wallTextures[][SFG_TEXTURE_STORE_SIZE] =
|
||||
SFG_PROGRAM_MEMORY uint8_t SFG_itemSprites[][SFG_TEXTURE_STORE_SIZE] =
|
||||
{
|
||||
{ // 0, barrel
|
||||
175,7,0,6,174,5,69,4,71,53,3,93,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,34,34,32,0,2,34,34,32,0,0,0,0,0,0,0,2,17,17,18,34,33,17,17,18,
|
||||
0,0,0,0,0,0,0,33,19,51,49,17,19,51,51,53,32,0,0,0,0,0,2,17,54,102,102,102,102,
|
||||
102,102,51,162,0,0,0,0,0,2,85,102,89,89,89,89,89,86,101,162,0,0,0,0,0,2,85,101,
|
||||
149,149,149,149,149,148,101,162,0,0,0,0,0,34,19,129,17,17,17,17,17,52,131,114,0,
|
||||
0,0,0,2,90,19,131,17,17,17,17,17,20,131,114,0,0,0,0,2,42,19,129,20,68,68,68,177,
|
||||
52,131,114,0,0,0,0,2,2,19,131,20,68,68,68,177,20,133,114,0,0,0,0,2,2,161,129,49,
|
||||
49,75,17,49,52,135,32,0,0,0,0,2,0,33,131,19,17,75,19,19,20,135,32,0,0,0,0,2,0,
|
||||
33,129,49,49,75,17,49,52,135,32,0,0,0,0,2,2,161,131,19,17,75,19,19,20,135,32,0,
|
||||
0,0,0,2,2,19,129,20,68,68,68,177,52,133,114,0,0,0,0,2,42,19,131,20,68,68,68,177,
|
||||
20,131,114,0,0,0,0,2,90,19,129,17,17,17,17,17,52,131,114,0,0,0,0,0,34,19,131,17,
|
||||
17,17,17,17,20,131,114,0,0,0,0,0,2,85,105,89,89,89,89,89,84,101,162,0,0,0,0,0,2,
|
||||
85,102,149,149,149,149,149,150,101,162,0,0,0,0,0,2,19,54,102,102,102,102,102,
|
||||
102,53,114,0,0,0,0,0,0,37,51,51,87,119,117,51,51,87,32,0,0,0,0,0,0,2,119,119,
|
||||
114,34,39,119,119,114,0,0,0,0,0,0,0,0,34,34,32,0,2,34,34,32,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
175,6,84,15,11,19,13,7,176,22,2,0,5,20,83,93,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,136,0,0,0,0,0,0,8,
|
||||
128,0,0,0,0,0,0,136,136,136,139,139,139,187,187,139,139,187,184,187,187,139,136,
|
||||
136,136,136,136,136,168,168,168,170,136,170,138,170,138,138,168,168,170,20,170,
|
||||
170,133,170,84,84,132,85,85,84,84,164,20,90,164,20,68,164,69,37,69,36,37,68,68,
|
||||
85,69,84,20,90,68,68,244,85,82,68,232,136,170,34,85,68,84,66,93,42,212,68,101,
|
||||
102,34,228,228,34,110,174,38,34,36,84,66,100,252,98,98,34,46,226,34,98,34,110,
|
||||
162,34,34,34,37,205,44,20,34,34,78,38,78,133,136,226,238,34,34,34,20,29,33,20,
|
||||
38,34,241,194,28,37,132,170,26,38,18,98,20,18,33,145,18,18,225,17,33,36,133,133,
|
||||
226,34,18,25,18,29,33,17,17,31,17,17,18,69,66,49,33,241,17,17,25,18,33,49,17,31,
|
||||
50,74,165,95,209,17,49,241,49,17,49,29,33,49,19,122,113,122,68,252,147,115,17,
|
||||
247,49,19,19,29,33,18,119,114,119,119,116,66,39,55,199,241,23,19,18,18,33,18,23,
|
||||
124,199,119,245,68,68,255,76,199,113,119,21,109,33,119,119,19,247,20,84,255,85,
|
||||
77,114,113,119,115,115,98,33,55,55,51,198,55,60,47,229,214,198,51,115,49,25,29,
|
||||
241,51,51,51,61,195,49,51,145,22,211,19,17,51,17,205,76,147,51,51,51,109,99,19,
|
||||
102,242,17,17,145,25,41,196,66,51,147,51,17,57,100,85,66,193,50,49,25,18,25,202,
|
||||
162,21,105,150,57,49,17,49,145,17,17,25,18,19,25,106,162,21,105,150,57,49,17,49,
|
||||
145,17,17,17,18,19,22,106,162,57,102,153,145,145,145,17,99,33,17,145,97,34,54,
|
||||
40,130,68,111,246,98,102,18,97,34,146,34,34,34,34,34,40,130,0,0,0,0,0,0,2,32,0,
|
||||
0,0,0,0,0,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
},
|
||||
{ // 1, health
|
||||
175,7,73,6,174,5,69,4,71,53,3,93,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
|
@ -109,4 +109,9 @@
|
||||
*/
|
||||
#define SFG_PLAYER_HEALTH_WARNING_LEVEL 20
|
||||
|
||||
/**
|
||||
Amount of health that is increased by taking a health kit.
|
||||
*/
|
||||
#define SFG_HEALTH_KIT_VALUE 20
|
||||
|
||||
#endif // guard
|
||||
|
2
levels.h
2
levels.h
@ -75,7 +75,7 @@ typedef uint8_t SFG_MapArray[SFG_MAP_SIZE * SFG_MAP_SIZE];
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t elementType;
|
||||
uint8_t type;
|
||||
uint8_t coords[2];
|
||||
} SFG_LevelElement;
|
||||
|
||||
|
34
main.c
34
main.c
@ -1063,7 +1063,7 @@ void SFG_setAndInitLevel(const SFG_Level *level)
|
||||
{
|
||||
const SFG_LevelElement *e = &(SFG_currentLevel.levelPointer->elements[i]);
|
||||
|
||||
switch (e->elementType)
|
||||
switch (e->type)
|
||||
{
|
||||
case SFG_LEVEL_ELEMENT_BARREL:
|
||||
case SFG_LEVEL_ELEMENT_HEALTH:
|
||||
@ -1080,7 +1080,7 @@ void SFG_setAndInitLevel(const SFG_Level *level)
|
||||
monster =
|
||||
&(SFG_currentLevel.monsterRecords[SFG_currentLevel.monsterRecordCount]);
|
||||
|
||||
monster->stateType = e->elementType | 0;
|
||||
monster->stateType = e->type | 0;
|
||||
monster->health = 255;
|
||||
monster->coords[0] = e->coords[0] * 4;
|
||||
monster->coords[1] = e->coords[1] * 4;
|
||||
@ -1738,6 +1738,7 @@ void SFG_gameStep()
|
||||
|
||||
// handle player collision with level elements:
|
||||
|
||||
// monsters:
|
||||
for (uint8_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i)
|
||||
{
|
||||
SFG_MonsterRecord *m = &(SFG_currentLevel.monsterRecords[i]);
|
||||
@ -1767,7 +1768,9 @@ void SFG_gameStep()
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < SFG_currentLevel.itemRecordCount; ++i)
|
||||
// items:
|
||||
for (int16_t i = 0; i < SFG_currentLevel.itemRecordCount; ++i)
|
||||
// ^ has to be int16_t (signed)
|
||||
{
|
||||
const SFG_LevelElement *e = SFG_getActiveItemElement(i);
|
||||
|
||||
@ -1791,8 +1794,23 @@ void SFG_gameStep()
|
||||
)
|
||||
)
|
||||
{
|
||||
moveOffset = SFG_resolveCollisionWithElement(
|
||||
SFG_player.camera.position,moveOffset,ePos);
|
||||
if (e->type == SFG_LEVEL_ELEMENT_HEALTH)
|
||||
{
|
||||
SFG_playerChangeHealth(SFG_HEALTH_KIT_VALUE);
|
||||
|
||||
// take, eliminate the item
|
||||
|
||||
for (uint8_t j = i; j < SFG_currentLevel.itemRecordCount - 1; ++j)
|
||||
SFG_currentLevel.itemRecords[j] =
|
||||
SFG_currentLevel.itemRecords[j + 1];
|
||||
|
||||
SFG_currentLevel.itemRecordCount--;
|
||||
|
||||
i--;
|
||||
}
|
||||
else // collide
|
||||
moveOffset = SFG_resolveCollisionWithElement(
|
||||
SFG_player.camera.position,moveOffset,ePos);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1925,6 +1943,8 @@ void SFG_gameStep()
|
||||
0)
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
eliminate = 1;
|
||||
break;
|
||||
}
|
||||
@ -2411,10 +2431,12 @@ void SFG_draw()
|
||||
SFG_player.camera);
|
||||
|
||||
if (p.depth > 0)
|
||||
SFG_drawScaledSprite(SFG_itemSprites[e.elementType - 1],
|
||||
{
|
||||
SFG_drawScaledSprite(SFG_itemSprites[e.type - 1],
|
||||
p.position.x * SFG_RAYCASTING_SUBSAMPLE,p.position.y,
|
||||
RCL_perspectiveScale(SFG_GAME_RESOLUTION_Y / 2,p.depth),
|
||||
p.depth / (RCL_UNITS_PER_SQUARE * 2),p.depth);
|
||||
}
|
||||
}
|
||||
|
||||
// projecile sprites:
|
||||
|
Loading…
Reference in New Issue
Block a user