mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-12-22 07:18:49 -05:00
Add invisible wall
This commit is contained in:
parent
7dfa0d32a5
commit
4e4dd996da
3
TODO.txt
3
TODO.txt
@ -82,6 +82,9 @@ level ideas:
|
||||
- barrel on elevator
|
||||
- platforming vertical section in which the player is going upwards out of a big
|
||||
hole
|
||||
- invisible bridge (perhaps not straight) made of bleckers (invisible walls)
|
||||
over a hole, leading to an easter egg
|
||||
- start of level: a corner blocked by an invisible wall, to indicate entrance
|
||||
|
||||
bugs:
|
||||
|
||||
|
3
levels.h
3
levels.h
@ -105,6 +105,7 @@ typedef struct
|
||||
access card. */
|
||||
#define SFG_LEVEL_ELEMENT_LOCK1 0x0e
|
||||
#define SFG_LEVEL_ELEMENT_LOCK2 0x0f
|
||||
#define SFG_LEVEL_ELEMENT_BLOCKER 0x10 ///< Invisible wall.
|
||||
|
||||
/*
|
||||
Monsters have lower 4 bits zero and are only distinguished by the 4 upper
|
||||
@ -304,7 +305,7 @@ SFG_PROGRAM_MEMORY SFG_Level SFG_levels[SFG_NUMBER_OF_LEVELS] =
|
||||
{SFG_LEVEL_ELEMENT_TELEPORT, {20, 40}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
|
||||
{SFG_LEVEL_ELEMENT_TERMINAL, {11, 25}}, {SFG_LEVEL_ELEMENT_TERMINAL, {11, 26}},
|
||||
{SFG_LEVEL_ELEMENT_MONSTER_WARRIOR, {10, 45}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
|
||||
{SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}},
|
||||
{SFG_LEVEL_ELEMENT_BLOCKER, {14, 26}}, {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}},
|
||||
|
47
main.c
47
main.c
@ -1114,10 +1114,10 @@ RCL_Unit SFG_ceilingHeightAt(int16_t x, int16_t y)
|
||||
Gets sprite (image and sprite size) for given item.
|
||||
*/
|
||||
void SFG_getItemSprite(
|
||||
uint8_t elementType, uint8_t *spriteIndex, uint8_t *spriteSize)
|
||||
uint8_t elementType, const uint8_t **sprite, uint8_t *spriteSize)
|
||||
{
|
||||
*spriteSize = 0;
|
||||
*spriteIndex = elementType - 1;
|
||||
*sprite = (const uint8_t *) &(SFG_itemSprites[elementType - 1]);
|
||||
|
||||
switch (elementType)
|
||||
{
|
||||
@ -1137,7 +1137,12 @@ void SFG_getItemSprite(
|
||||
case SFG_LEVEL_ELEMENT_CARD0:
|
||||
case SFG_LEVEL_ELEMENT_CARD1:
|
||||
case SFG_LEVEL_ELEMENT_CARD2:
|
||||
*spriteIndex = SFG_LEVEL_ELEMENT_CARD0 - 1;
|
||||
*sprite =
|
||||
(const uint8_t *) &(SFG_itemSprites[SFG_LEVEL_ELEMENT_CARD0 - 1]);
|
||||
break;
|
||||
|
||||
case SFG_LEVEL_ELEMENT_BLOCKER:
|
||||
*sprite = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1153,7 +1158,8 @@ uint8_t SFG_itemCollides(uint8_t elementType)
|
||||
return
|
||||
elementType == SFG_LEVEL_ELEMENT_BARREL ||
|
||||
elementType == SFG_LEVEL_ELEMENT_TREE ||
|
||||
elementType == SFG_LEVEL_ELEMENT_TERMINAL;
|
||||
elementType == SFG_LEVEL_ELEMENT_TERMINAL ||
|
||||
elementType == SFG_LEVEL_ELEMENT_BLOCKER;
|
||||
}
|
||||
|
||||
void SFG_setAndInitLevel(const SFG_Level *level)
|
||||
@ -3649,25 +3655,28 @@ void SFG_draw()
|
||||
worldPosition.y =
|
||||
SFG_ELEMENT_COORD_TO_RCL_UNITS(e.coords[1]);
|
||||
|
||||
uint8_t spriteIndex;
|
||||
const uint8_t *sprite;
|
||||
uint8_t spriteSize;
|
||||
|
||||
SFG_getItemSprite(e.type,&spriteIndex,&spriteSize);
|
||||
SFG_getItemSprite(e.type,&sprite,&spriteSize);
|
||||
|
||||
RCL_PixelInfo p =
|
||||
RCL_mapToScreen(
|
||||
worldPosition,
|
||||
SFG_floorHeightAt(e.coords[0],e.coords[1])
|
||||
+ SFG_SPRITE_SIZE_TO_HEIGH_ABOVE_GROUND(spriteSize),
|
||||
SFG_player.camera);
|
||||
|
||||
if (p.depth > 0)
|
||||
if (sprite != 0)
|
||||
{
|
||||
SFG_drawScaledSprite(
|
||||
SFG_itemSprites[spriteIndex],
|
||||
p.position.x * SFG_RAYCASTING_SUBSAMPLE,p.position.y,
|
||||
RCL_perspectiveScale(SFG_SPRITE_SIZE(spriteSize),p.depth),
|
||||
p.depth / (RCL_UNITS_PER_SQUARE * 2),p.depth - 1000);
|
||||
RCL_PixelInfo p =
|
||||
RCL_mapToScreen(
|
||||
worldPosition,
|
||||
SFG_floorHeightAt(e.coords[0],e.coords[1])
|
||||
+ SFG_SPRITE_SIZE_TO_HEIGH_ABOVE_GROUND(spriteSize),
|
||||
SFG_player.camera);
|
||||
|
||||
if (p.depth > 0)
|
||||
{
|
||||
SFG_drawScaledSprite(
|
||||
sprite,
|
||||
p.position.x * SFG_RAYCASTING_SUBSAMPLE,p.position.y,
|
||||
RCL_perspectiveScale(SFG_SPRITE_SIZE(spriteSize),p.depth),
|
||||
p.depth / (RCL_UNITS_PER_SQUARE * 2),p.depth - 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user