mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-11-21 08:25:05 -05:00
Take cards
This commit is contained in:
parent
6c57ef314a
commit
b7ba33a77a
1
TODO.txt
1
TODO.txt
@ -20,6 +20,7 @@
|
||||
- add jump pads?
|
||||
- add robot deactivator item? (encourages "stealth" gameplay)
|
||||
- add "pletivo" transparent wall texture?
|
||||
- add universal corpse sprite?
|
||||
|
||||
bugs:
|
||||
|
||||
|
BIN
assets/item_card.png
Normal file
BIN
assets/item_card.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 547 B |
20
images.h
20
images.h
@ -510,6 +510,26 @@ SFG_PROGRAM_MEMORY uint8_t SFG_itemSprites[][SFG_TEXTURE_STORE_SIZE] =
|
||||
0,1,17,17,34,130,36,0,0,0,0,30,229,167,16,0,0,0,0,1,36,130,36,0,0,0,0,30,90,125,
|
||||
16,0,0,0,0,0,17,22,36,0,0,0,0,1,167,209,0,0,0,0,0,0,0,1,17,0,0,0,0,0,17,16,0,0,
|
||||
0,0,0,0,0,0,0
|
||||
},
|
||||
{ // 6, access card
|
||||
175,0,21,45,44,23,46,2,19,34,69,22,68,60,131,8,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,17,17,17,17,17,17,17,0,0,0,0,0,0,0,0,1,
|
||||
68,17,24,102,101,86,97,0,0,0,0,0,0,0,0,1,68,17,24,102,85,86,101,16,0,0,0,0,0,0,
|
||||
0,1,67,17,24,101,85,86,101,183,16,0,0,0,0,0,0,1,51,17,24,85,85,102,59,178,16,0,
|
||||
0,0,0,0,0,1,51,17,24,85,86,232,219,34,240,0,0,0,0,0,0,1,51,17,24,85,86,131,130,
|
||||
34,240,0,0,0,0,0,0,1,51,17,24,85,102,52,114,34,16,0,0,0,0,0,0,1,54,17,24,86,99,
|
||||
56,66,34,16,0,0,0,0,0,0,1,102,17,24,86,51,141,114,34,16,0,0,0,0,0,0,1,101,17,24,
|
||||
102,51,211,114,34,16,0,0,0,0,0,0,1,101,17,24,99,51,55,114,34,16,0,0,0,0,0,0,1,
|
||||
85,17,24,51,51,119,226,34,16,0,0,0,0,0,0,1,85,17,24,51,52,71,34,34,16,0,0,0,0,0,
|
||||
0,1,85,17,24,51,52,119,130,34,16,0,0,0,0,0,0,1,85,17,24,51,68,228,114,34,16,0,0,
|
||||
0,0,0,0,1,85,17,24,52,68,66,34,34,16,0,0,0,0,0,0,1,86,17,25,52,68,66,34,34,16,0,
|
||||
0,0,0,0,0,1,86,17,23,68,68,34,34,34,16,0,0,0,0,0,0,1,102,17,23,68,68,34,34,34,
|
||||
16,0,0,0,0,0,0,1,99,17,23,68,153,153,114,34,16,0,0,0,0,0,0,1,99,17,23,68,154,
|
||||
170,114,34,16,0,0,0,0,0,0,1,51,17,23,68,154,204,114,34,16,0,0,0,0,0,0,1,51,17,
|
||||
23,68,154,204,114,34,16,0,0,0,0,0,0,1,51,17,23,68,151,119,114,34,16,0,0,0,0,0,0,
|
||||
1,51,17,23,66,130,34,130,34,16,0,0,0,0,0,0,1,51,17,23,66,130,34,130,34,16,0,0,0,
|
||||
0,0,0,0,17,17,17,17,17,17,17,17,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
|
||||
}
|
||||
};
|
||||
|
||||
|
7
levels.h
7
levels.h
@ -93,6 +93,9 @@ typedef struct
|
||||
#define SFG_LEVEL_ELEMENT_ROCKETS 0x04
|
||||
#define SFG_LEVEL_ELEMENT_PLASMA 0x05
|
||||
#define SFG_LEVEL_ELEMENT_TREE 0x06
|
||||
#define SFG_LEVEL_ELEMENT_CARD0 0x07
|
||||
#define SFG_LEVEL_ELEMENT_CARD1 0x08
|
||||
#define SFG_LEVEL_ELEMENT_CARD2 0x09
|
||||
|
||||
/*
|
||||
Monsters have lower 4 bits zero and are only distinguished by the 4 upper
|
||||
@ -281,8 +284,8 @@ SFG_PROGRAM_MEMORY SFG_Level SFG_level0 =
|
||||
{SFG_LEVEL_ELEMENT_PLASMA, {3, 57}}, {SFG_LEVEL_ELEMENT_PLASMA, {3, 58}},
|
||||
{SFG_LEVEL_ELEMENT_TREE, {16, 44}}, {SFG_LEVEL_ELEMENT_TREE, {16, 45}},
|
||||
{SFG_LEVEL_ELEMENT_TREE, {16, 46}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
|
||||
{SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
|
||||
{SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
|
||||
{SFG_LEVEL_ELEMENT_CARD0, {13, 20}}, {SFG_LEVEL_ELEMENT_CARD1, {14, 20}},
|
||||
{SFG_LEVEL_ELEMENT_CARD2, {13, 21}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
|
||||
{SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
|
||||
{SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
|
||||
{SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
|
||||
|
39
main.c
39
main.c
@ -122,7 +122,7 @@ void SFG_init();
|
||||
#define RCL_TEXTURE_VERTICAL_STRETCH 0
|
||||
|
||||
#define RCL_CAMERA_COLL_HEIGHT_BELOW 800
|
||||
#define RCL_CAMERA_COLL_HEIGHT_ABOVE 150
|
||||
#define RCL_CAMERA_COLL_HEIGHT_ABOVE 200
|
||||
|
||||
#include "raycastlib.h"
|
||||
|
||||
@ -248,6 +248,8 @@ struct
|
||||
uint8_t freeLook; /**< If on, the vertical looking (shear) does
|
||||
not automatically shear back. This is mainly
|
||||
for mouse control. */
|
||||
uint8_t cards; /**< Lowest bits say which access cards have
|
||||
been taken. */
|
||||
} SFG_player;
|
||||
|
||||
uint8_t SFG_explosionSoundPlayed; /**< Prevents playing too many explosion
|
||||
@ -975,6 +977,8 @@ void SFG_initPlayer()
|
||||
|
||||
SFG_player.health = SFG_PLAYER_MAX_HEALTH;
|
||||
|
||||
SFG_player.cards = 0;
|
||||
|
||||
for (uint8_t i = 0; i < SFG_AMMO_TOTAL; ++i)
|
||||
SFG_player.ammo[i] = 0;
|
||||
}
|
||||
@ -1782,6 +1786,12 @@ static inline uint8_t SFG_elementCollides(
|
||||
<= SFG_ELEMENT_COLLISION_DISTANCE;
|
||||
}
|
||||
|
||||
uint8_t SFG_getLevelElementSpriteIndex(uint8_t elementType)
|
||||
{
|
||||
return ((elementType < SFG_LEVEL_ELEMENT_CARD0)
|
||||
? elementType : SFG_LEVEL_ELEMENT_CARD0) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
Performs one game step (logic, physics), happening SFG_MS_PER_FRAME after
|
||||
previous frame.
|
||||
@ -2207,6 +2217,12 @@ void SFG_gameStep()
|
||||
SFG_player.ammo[SFG_AMMO_PLASMA] += SFG_AMMO_INCREASE_PLASMA;
|
||||
break;
|
||||
|
||||
case SFG_LEVEL_ELEMENT_CARD0:
|
||||
case SFG_LEVEL_ELEMENT_CARD1:
|
||||
case SFG_LEVEL_ELEMENT_CARD2:
|
||||
SFG_player.cards |= 1 << (e->type - SFG_LEVEL_ELEMENT_CARD0);
|
||||
break;
|
||||
|
||||
default:
|
||||
eliminate = 0;
|
||||
break;
|
||||
@ -2449,6 +2465,7 @@ void SFG_gameStep()
|
||||
SFG_currentLevel.checkedDoorIndex = 0;
|
||||
}
|
||||
|
||||
// move door up/down:
|
||||
for (uint32_t i = 0; i < SFG_currentLevel.doorRecordCount; ++i)
|
||||
{
|
||||
SFG_DoorRecord *door = &(SFG_currentLevel.doorRecords[i]);
|
||||
@ -2948,7 +2965,8 @@ void SFG_draw()
|
||||
|
||||
if (p.depth > 0)
|
||||
{
|
||||
SFG_drawScaledSprite(SFG_itemSprites[e.type - 1],
|
||||
SFG_drawScaledSprite(
|
||||
SFG_itemSprites[SFG_getLevelElementSpriteIndex(e.type)],
|
||||
p.position.x * SFG_RAYCASTING_SUBSAMPLE,p.position.y,
|
||||
RCL_perspectiveScale(SFG_SPRITE_SIZE(size),p.depth),
|
||||
p.depth / (RCL_UNITS_PER_SQUARE * 2),p.depth - 1000);
|
||||
@ -3024,11 +3042,13 @@ void SFG_draw()
|
||||
color = 2;
|
||||
}
|
||||
|
||||
#define TEXT_Y (SFG_GAME_RESOLUTION_Y - SFG_HUD_MARGIN - \
|
||||
SFG_FONT_CHARACTER_SIZE * SFG_FONT_SIZE_MEDIUM)
|
||||
|
||||
SFG_drawNumber( // health
|
||||
SFG_player.health,
|
||||
SFG_HUD_MARGIN,
|
||||
SFG_GAME_RESOLUTION_Y - SFG_HUD_MARGIN -
|
||||
SFG_FONT_CHARACTER_SIZE * SFG_FONT_SIZE_MEDIUM,
|
||||
TEXT_Y,
|
||||
SFG_FONT_SIZE_MEDIUM,
|
||||
SFG_player.health > SFG_PLAYER_HEALTH_WARNING_LEVEL ? 4 : 175);
|
||||
|
||||
@ -3036,11 +3056,18 @@ void SFG_draw()
|
||||
SFG_player.ammo[SFG_weaponAmmo(SFG_player.weapon)],
|
||||
SFG_GAME_RESOLUTION_X - SFG_HUD_MARGIN -
|
||||
SFG_FONT_CHARACTER_SIZE * SFG_FONT_SIZE_MEDIUM * 3,
|
||||
SFG_GAME_RESOLUTION_Y - SFG_HUD_MARGIN -
|
||||
SFG_FONT_CHARACTER_SIZE * SFG_FONT_SIZE_MEDIUM,
|
||||
TEXT_Y,
|
||||
SFG_FONT_SIZE_MEDIUM,
|
||||
4);
|
||||
|
||||
for (uint8_t i = 0; i < 3; ++i) // access cards
|
||||
if (SFG_player.cards & (1 << i))
|
||||
SFG_drawText(",",SFG_HUD_MARGIN + SFG_FONT_CHARACTER_SIZE *
|
||||
SFG_FONT_SIZE_MEDIUM * (6 + i),
|
||||
TEXT_Y,SFG_FONT_SIZE_MEDIUM,i == 0 ? 93 : (i == 1 ? 124 : 60));
|
||||
|
||||
#undef TEXT_Y
|
||||
|
||||
// border indicator
|
||||
|
||||
if (SFG_gameFrame - SFG_player.lastHurtFrame
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
author: Miloslav "drummyfish" Ciz
|
||||
license: CC0 1.0
|
||||
version: 0.901
|
||||
version: 0.902
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
@ -1681,7 +1681,6 @@ RCL_PixelInfo RCL_mapToScreen(RCL_Vector2D worldPosition, RCL_Unit height,
|
||||
|
||||
result.position.y = camera.resolution.y / 2 -
|
||||
(((3 * camera.resolution.y) / 4 ) *
|
||||
// ((camera.resolution.y / 2) *
|
||||
RCL_perspectiveScale(height - camera.height,result.depth))
|
||||
/ RCL_UNITS_PER_SQUARE + camera.shear;
|
||||
|
||||
@ -1760,8 +1759,9 @@ void RCL_moveCameraWithCollision(RCL_Camera *camera, RCL_Vector2D planeOffset,
|
||||
dir##Collides = 1;\
|
||||
else if (ceilingHeightFunc != 0)\
|
||||
{\
|
||||
height = ceilingHeightFunc(s1,s2);\
|
||||
if (height < topLimit)\
|
||||
RCL_Unit height2 = ceilingHeightFunc(s1,s2);\
|
||||
if ((height2 < topLimit) || ((height2 - height) < \
|
||||
(RCL_CAMERA_COLL_HEIGHT_ABOVE + RCL_CAMERA_COLL_HEIGHT_BELOW)))\
|
||||
dir##Collides = 1;\
|
||||
}\
|
||||
}\
|
||||
|
Loading…
Reference in New Issue
Block a user