mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2025-03-03 02:41:56 -05:00
Continue elevators
This commit is contained in:
parent
4cc267cdec
commit
e3685b58a5
2
levels.h
2
levels.h
@ -99,7 +99,7 @@ static const SFG_Level SFG_level0 =
|
||||
.tileDictionary =
|
||||
{
|
||||
SFG_TD(0 ,31,0,0),SFG_TD(15,63,5,0),SFG_TD(28,63,1,0),SFG_TD(6 ,63,6,0), // 0
|
||||
SFG_TD(10,28,4,0),SFG_TD(4 ,63,4,0),SFG_TD(5 ,63,4,0),SFG_TD(1 ,10,1,0), // 4
|
||||
SFG_TD(0 ,28,2,0),SFG_TD(4 ,63,4,0),SFG_TD(5 ,63,4,0),SFG_TD(1 ,10,1,0), // 4
|
||||
SFG_TD(0 ,31,0,0),SFG_TD(0 ,63,0,0),SFG_TD(0 ,63,0,0),SFG_TD(0 ,63,0,0), // 8
|
||||
SFG_TD(0 ,31,0,0),SFG_TD(0 ,63,0,0),SFG_TD(0 ,63,0,0),SFG_TD(0 ,63,0,0), // 12
|
||||
SFG_TD(0 ,31,0,0),SFG_TD(0 ,63,0,0),SFG_TD(0 ,63,0,0),SFG_TD(0 ,63,0,0), // 16
|
||||
|
20
main.c
20
main.c
@ -88,12 +88,19 @@ void SFG_pixelFunc(RCL_PixelInfo *pixel)
|
||||
(pixel->hit.type & 0x7) :
|
||||
((pixel->hit.type & 0x38) >> 3);
|
||||
|
||||
RCL_Unit textureV = pixel->height - pixel->texCoords.y;
|
||||
|
||||
if (pixel->hit.type & SFG_TILE_PROPERTY_ELEVATOR)
|
||||
textureV -= pixel->wallHeight;
|
||||
|
||||
textureV %= RCL_UNITS_PER_SQUARE; // hopefully gets optimized to bitwise and
|
||||
|
||||
color =
|
||||
textureIndex != SFG_TILE_TEXTURE_TRANSPARENT ?
|
||||
(SFG_getTexel(
|
||||
SFG_currentLevel.textures[pixel->hit.type],
|
||||
SFG_currentLevel.textures[textureIndex],
|
||||
pixel->texCoords.x / 32,
|
||||
((pixel->height - pixel->texCoords.y) % RCL_UNITS_PER_SQUARE) / 32)
|
||||
textureV / 32)
|
||||
) :
|
||||
SFG_TRANSPARENT_COLOR;
|
||||
|
||||
@ -139,11 +146,12 @@ void SFG_pixelFunc(RCL_PixelInfo *pixel)
|
||||
|
||||
RCL_Unit SFG_texturesAt(int16_t x, int16_t y)
|
||||
{
|
||||
uint8_t properties;
|
||||
uint8_t p;
|
||||
|
||||
SFG_TileDefinition tile = SFG_getMapTile(&(SFG_level0.map),x,y,&properties);
|
||||
return SFG_TILE_FLOOR_TEXTURE(tile) | (SFG_TILE_CEILING_TEXTURE(tile) << 3);
|
||||
// ^ store both textures (floor and ceiling) in one number
|
||||
SFG_TileDefinition tile = SFG_getMapTile(&(SFG_level0.map),x,y,&p);
|
||||
return
|
||||
SFG_TILE_FLOOR_TEXTURE(tile) | (SFG_TILE_CEILING_TEXTURE(tile) << 3) | p;
|
||||
// ^ store both textures (floor and ceiling) and properties in one number
|
||||
}
|
||||
|
||||
RCL_Unit SFG_movingWallHeight
|
||||
|
@ -267,6 +267,7 @@ typedef struct
|
||||
int8_t isHorizon; ///< If the pixel belongs to horizon segment.
|
||||
RCL_Unit depth; ///< Corrected depth.
|
||||
RCL_Unit height; ///< World height (mostly for floor).
|
||||
RCL_Unit wallHeight;///< Only for wall pixels, says its height.
|
||||
RCL_HitResult hit; ///< Corresponding ray hit.
|
||||
RCL_Vector2D texCoords; /**< Normalized (0 to RCL_UNITS_PER_SQUARE - 1)
|
||||
texture coordinates. */
|
||||
@ -1238,6 +1239,7 @@ void _RCL_columnFunctionComplex(RCL_HitResult *hits, uint16_t hitCount, uint16_t
|
||||
p.height = 0;
|
||||
p.texCoords.x = 0;
|
||||
p.texCoords.y = 0;
|
||||
p.wallHeight = 0;
|
||||
|
||||
// we'll be simulatenously drawing the floor and the ceiling now
|
||||
for (RCL_Unit j = 0; j <= hitCount; ++j)
|
||||
@ -1294,6 +1296,7 @@ void _RCL_columnFunctionComplex(RCL_HitResult *hits, uint16_t hitCount, uint16_t
|
||||
// draw floor until wall
|
||||
p.isFloor = 1;
|
||||
p.height = fZ1World + _RCL_camera.height;
|
||||
p.wallHeight = 0;
|
||||
|
||||
#if RCL_COMPUTE_FLOOR_DEPTH == 1
|
||||
p.depth = (_RCL_fHorizontalDepthStart - fPosY) * _RCL_horizontalDepthStep;
|
||||
@ -1336,6 +1339,7 @@ void _RCL_columnFunctionComplex(RCL_HitResult *hits, uint16_t hitCount, uint16_t
|
||||
p.isFloor = 1;
|
||||
p.texCoords.x = hit.textureCoord;
|
||||
p.height = fZ1World + _RCL_camera.height;
|
||||
p.wallHeight = fWallHeight;
|
||||
|
||||
// draw floor wall
|
||||
|
||||
@ -1366,6 +1370,7 @@ void _RCL_columnFunctionComplex(RCL_HitResult *hits, uint16_t hitCount, uint16_t
|
||||
{
|
||||
p.isFloor = 0;
|
||||
p.height = cZ1World + _RCL_camera.height;
|
||||
p.wallHeight = cWallHeight;
|
||||
|
||||
limit = _RCL_drawWall(cPosY,cZ1Screen,cZ2Screen,
|
||||
-1,fPosY - 1,
|
||||
@ -1398,6 +1403,7 @@ void _RCL_columnFunctionSimple(RCL_HitResult *hits, uint16_t hitCount,
|
||||
|
||||
RCL_PixelInfo p;
|
||||
p.position.x = x;
|
||||
p.wallHeight = RCL_UNITS_PER_SQUARE;
|
||||
|
||||
if (hitCount > 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user